/* Mighty Men of Valor
   ─────────────────────────────────────────────────────────────────────────
   THE RULE: the app is the shop at night; the Scripture page is a steel plate.

   Six tokens below are SURFACE-RELATIVE. They resolve to shop values at :root
   and are re-declared on .plate. That is why no .pl-* component rule ever needs
   a second colour: put anything on a plate and it dresses itself.

   Do not give a card a translucent background. The shop paints a texture layer
   behind everything, and translucency drags that texture into every contrast
   calculation on the screen.
*/

@font-face {
  font-family: "Bitter";
  src: url("fonts/bitter-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
:root {
  --ground: #0b0f18;
  --card: #161c2b;
  --card-hi: #1b2233;
  --brass: #c8a24a;
  --brass-lo: #8f6d2a;
  --brass-hi: #e0c489;
  --bad: #c96a5a;
  --bad-hi: #e08e7e;
  --good: #6f9a63;

  /* surface-relative — redeclared on .plate */
  --ink: #e2e6ec;
  --muted: #8c96aa;
  --faint: #828da1;   /* 5.08:1 on cards, 5.73:1 on the shop floor */
  --line: rgba(200, 162, 74, 0.20);
  --rule: rgba(255, 255, 255, 0.07);
  --edge: rgba(255, 255, 255, 0.055);

  --slab: "Bitter", "Rockwell", "Bookman Old Style", Georgia, serif;
  --focus: #8ab4ff;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --tap: 44px;
}

.plate {
  --ink: #141922;
  --muted: #5c6672;
  --faint: #78828e;
  --line: rgba(0, 0, 0, 0.13);
  --rule: rgba(0, 0, 0, 0.13);
  --edge: rgba(0, 0, 0, 0.10);
  --brass: #7a6431;
  --brass-lo: #6d5119;
  --brass-hi: #8a7139;
  --focus: #2b4fb8;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { background: #05070c; }

body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

/* the shop: brushed tooth + a little forge glow at the top */
#shopfloor {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(103deg, rgba(255,255,255,.018) 0 1px, transparent 1px 4px),
    radial-gradient(120% 55% at 50% 0%, rgba(200,162,74,.07), transparent 60%),
    radial-gradient(100% 45% at 50% 100%, rgba(0,0,0,.5), transparent 70%);
}

#app { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding-bottom: 86px; }

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: var(--brass); }

/* iOS Safari force-zooms any input under 16px. Never go below it. */
input, textarea { font-size: 16px; }

/* ── header ───────────────────────────────────────────────────────────── */
header.bar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(16,21,33,.5), transparent);
}
.mark { width: 26px; height: 31px; flex: none; }
.wm { font-family: var(--slab); line-height: .98; letter-spacing: .055em; }
.wm b { display: block; font-size: 12.5px; font-weight: 700; }
.wm i { display: block; font-size: 9px; font-style: normal; color: var(--brass);
        letter-spacing: .16em; margin-top: 2px; }
.bar .right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.iconbtn { width: var(--tap); height: var(--tap); display: grid; place-items: center;
           color: var(--muted); border-radius: 2px; position: relative; }
.iconbtn.on { color: var(--brass); }
.dot { position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; border-radius: 50%;
       background: var(--brass); box-shadow: 0 0 0 2px var(--ground); }

.hi { padding: 15px 16px 4px; font-size: 13.5px; color: var(--muted); }
.hi b { color: var(--ink); font-weight: 600; }

/* ── section labels ───────────────────────────────────────────────────── */
.sec { display: flex; align-items: baseline; padding: 22px 16px 9px; }
.sec h2 { font-family: var(--slab); font-size: 11px; letter-spacing: .22em;
          color: var(--brass); font-weight: 700; }
.sec .more { margin-left: auto; font-size: 11px; color: var(--faint); letter-spacing: .04em; }

/* ── streak: private, never ranked ────────────────────────────────────── */
.streak {
  margin: 12px 16px 0; padding: 12px 14px; display: flex; align-items: center; gap: 13px;
  background: linear-gradient(180deg, #1a2132, #141a28);
  border: 1px solid var(--line); border-left: 3px solid var(--brass); border-radius: 3px;
}
.streak .n { font-family: var(--slab); font-size: 29px; line-height: 1; color: var(--brass); }
.streak .l { font-size: 10px; letter-spacing: .15em; color: var(--muted); text-transform: uppercase; }
.streak .l s { display: block; text-decoration: none; color: var(--faint); font-size: 9.5px;
               letter-spacing: .06em; text-transform: none; font-style: italic; margin-top: 3px; }
.streak .best { margin-left: auto; text-align: right; font-size: 10px; letter-spacing: .12em;
                color: var(--faint); }
.streak .best b { display: block; font-family: var(--slab); font-size: 16px; color: #9aa4b6;
                  letter-spacing: 0; }

/* ── THE PLATE ────────────────────────────────────────────────────────── */
.plate {
  position: relative; margin: 10px 16px 0; padding: 20px 19px 19px; border-radius: 2px;
  background:
    repeating-linear-gradient(96deg, rgba(0,0,0,.045) 0 1px, transparent 1px 3px),
    linear-gradient(168deg, #e8ecef 0%, #cdd4db 42%, #dfe4e9 63%, #bcc4cd 100%);
  border: 1px solid #9aa4ae;
  box-shadow: 0 10px 26px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.75);
  color: var(--ink);
}
.plate .rv { position: absolute; width: 7px; height: 7px; border-radius: 50%;
  background: radial-gradient(circle at 33% 30%, #fbfcfd, #8e97a1 62%, #5d666f);
  box-shadow: inset 0 -1px 1px rgba(0,0,0,.35); }
.rv.tl { top: 7px; left: 7px; } .rv.tr { top: 7px; right: 7px; }
.rv.bl { bottom: 7px; left: 7px; } .rv.br { bottom: 7px; right: 7px; }
.plate .over { font-size: 9.5px; letter-spacing: .2em; color: var(--brass); font-weight: 700; }
.plate h3 { font-family: var(--slab); font-size: 25px; line-height: 1.1; margin: 9px 0 0; }
.plate .ref { font-family: var(--slab); font-size: 10.5px; letter-spacing: .16em;
              color: var(--muted); margin-top: 9px; }
.plate .lede { font-size: 13.5px; line-height: 1.55; color: #39424f; margin-top: 11px;
               border-top: 1px solid var(--rule); padding-top: 11px; }

/* full reading view */
.plate.read { margin-top: 14px; padding: 26px 22px 24px; }
.plate.read .passage { font-family: var(--slab); font-size: 15px; line-height: 1.62;
  color: #232b36; margin-top: 14px; padding: 14px 0; border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule); }
.plate.read .prose { margin-top: 16px; font-size: 15.5px; line-height: 1.68; color: #2b3440; }
.plate.read .prose p + p { margin-top: 12px; }
.plate.read .charge { margin-top: 18px; font-family: var(--slab); font-size: 14px;
  line-height: 1.45; color: #4a3c17; background: rgba(200,162,74,.16);
  border-left: 3px solid var(--brass); padding: 11px 13px; }

/* ── buttons ──────────────────────────────────────────────────────────── */
.cta {
  display: block; width: 100%; margin-top: 15px; padding: 13px; border-radius: 2px;
  background: linear-gradient(180deg, #d8b25a, #a87f2c); color: #1a1305;
  font-family: var(--slab); font-size: 13px; letter-spacing: .13em; font-weight: 700;
  box-shadow: 0 2px 0 #6d5119, inset 0 1px 0 rgba(255,255,255,.45);
  min-height: var(--tap);
}
.cta[disabled] { opacity: .45; box-shadow: none; }
.btn {
  padding: 9px 14px; border-radius: 2px; font-size: 11px; letter-spacing: .1em;
  font-weight: 700; border: 1px solid var(--brass); color: var(--brass);
  min-height: var(--tap);
}
.btn.in { background: rgba(200,162,74,.14); color: var(--brass-hi); }
.btn.ghost { border-color: var(--rule); color: var(--muted); }
.btn:disabled { opacity: .5; }

/* ── cards ────────────────────────────────────────────────────────────── */
.card {
  margin: 10px 16px 0; padding: 14px 15px; border-radius: 2px;
  background: linear-gradient(180deg, var(--card-hi), var(--card));
  border: 1px solid var(--edge);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.card.hot { border-left: 3px solid var(--bad); }
.card.pin { border-left: 3px solid var(--brass); }
.card.done { opacity: .62; }
.row { display: flex; align-items: center; gap: 11px; }
.ico { width: 30px; height: 30px; flex: none; color: var(--brass); opacity: .9; }
.k { font-family: var(--slab); font-size: 14.5px; letter-spacing: .06em; }
.t { font-size: 12px; color: var(--muted); margin-top: 3px; }
.chip { margin-left: auto; font-size: 9.5px; letter-spacing: .13em; padding: 4px 8px;
        border-radius: 2px; background: rgba(200,162,74,.13); color: var(--brass);
        border: 1px solid var(--line); white-space: nowrap; }
.chip.red { background: rgba(201,106,90,.15); color: var(--bad-hi);
            border-color: rgba(201,106,90,.35); }
.chip.green { background: rgba(111,154,99,.15); color: #9ec192;
              border-color: rgba(111,154,99,.35); }
.foot { display: flex; align-items: center; gap: 9px; margin-top: 12px;
        border-top: 1px solid var(--rule); padding-top: 11px; }
.count { font-size: 11px; color: var(--faint); letter-spacing: .03em; }
.count b { color: #9aa4b6; font-weight: 600; }

.who { display: flex; align-items: center; gap: 10px; }
.av { width: 31px; height: 31px; flex: none; border-radius: 2px; display: grid;
      place-items: center; background: linear-gradient(160deg, #2b3448, #232b3d);
      border: 1px solid var(--line); font-family: var(--slab); font-size: 11.5px;
      color: var(--brass); }
.who .n { font-size: 12.5px; font-weight: 600; }
.who .w { font-size: 10.5px; color: var(--faint); margin-top: 1px; letter-spacing: .04em; }
.body { font-size: 14px; line-height: 1.55; color: #c3cad6; margin-top: 11px;
        white-space: pre-wrap; overflow-wrap: anywhere; }

.replies { margin-top: 11px; border-top: 1px solid var(--rule); padding-top: 10px; }
.reply { padding: 8px 0 8px 12px; border-left: 2px solid var(--rule); }
.reply + .reply { margin-top: 6px; }
.reply .n { font-size: 11.5px; font-weight: 600; color: #9aa4b6; }
.reply .body { margin-top: 4px; font-size: 13px; }

.meter { display: flex; gap: 4px; margin-top: 11px; }
.meter i { flex: 1; height: 5px; border-radius: 1px; background: #0d1220;
           border: 1px solid var(--edge); }
.meter i.on { background: linear-gradient(90deg, var(--brass-lo), var(--brass)); border-color: transparent; }

/* ── composer ─────────────────────────────────────────────────────────── */
.composer { margin: 12px 16px 0; }
.composer textarea {
  width: 100%; min-height: 92px; padding: 12px; resize: vertical;
  background: #0d1220; border: 1px solid var(--line); border-radius: 2px;
  color: var(--ink); line-height: 1.5;
}
.composer textarea::placeholder { color: var(--faint); }
.composer .under { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.toggle { display: flex; align-items: center; gap: 9px; font-size: 12.5px;
          color: var(--muted); min-height: var(--tap); padding: 0 4px 0 0;
          cursor: pointer; }
.toggle input { width: 22px; height: 22px; accent-color: var(--bad); flex: none; }

/* plate answer boxes: the one writing surface, deliberately obvious */
.answers { margin-top: 18px; }
.qbox + .qbox { margin-top: 14px; }
.qbox .q { font-family: var(--slab); font-size: 13.5px; line-height: 1.4; color: #2b3440; }
.qbox textarea {
  width: 100%; min-height: 76px; margin-top: 8px; padding: 10px 11px; resize: vertical;
  font-family: var(--sans); line-height: 1.55; color: #1b2129;
  background: rgba(201,160,80,.10);
  border: 1px solid transparent;
  box-shadow: inset 0 0 0 1px #a97e2f;
  border-radius: 2px;
}
/* once he has written, withdraw the tint so a filled page reads as the page */
.qbox textarea.has-text { background: rgba(255,255,255,.5); box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); }
.qbox .stamp { font-size: 10px; letter-spacing: .1em; color: #6f7c63; margin-top: 5px;
               min-height: 13px; }
/* focus must beat .has-text — equal specificity, so source order decides.
   KEEP THIS RULE LAST among .qbox textarea rules. */
.qbox textarea:focus { outline: 0; background: #fff; box-shadow: inset 0 0 0 2px var(--focus); }

/* ── verse footer ─────────────────────────────────────────────────────── */
.verse { margin: 26px 16px 18px; padding: 15px 10px; text-align: center;
         border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.verse p { font-family: var(--slab); font-style: italic; font-size: 12.5px; line-height: 1.6;
           color: #93805a; }
.verse s { display: block; text-decoration: none; font-size: 9px; letter-spacing: .24em;
           color: #6f6650; margin-top: 8px; font-family: var(--sans); }

/* ── week map ─────────────────────────────────────────────────────────── */
.weekhead { display: flex; align-items: baseline; gap: 9px; padding: 20px 16px 6px; }
.weekhead .wn { font-family: var(--slab); font-size: 10px; letter-spacing: .2em; color: var(--brass); }
.weekhead .wt { font-family: var(--slab); font-size: 15px; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; padding: 0 16px; }
.day {
  aspect-ratio: 1; display: grid; place-content: center; gap: 2px; border-radius: 2px;
  background: var(--card); border: 1px solid var(--edge); color: var(--muted);
  font-size: 13px; font-family: var(--slab);
}
.day.open { border-color: var(--line); color: var(--ink); }
.day.done { background: rgba(200,162,74,.16); border-color: var(--brass); color: var(--brass-hi); }
.day.locked { opacity: .4; }
.day small { font-size: 8px; letter-spacing: .06em; }

/* ── nav ──────────────────────────────────────────────────────────────── */
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(6, 1fr);
  padding: 8px 2px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #0e1320, #070a12);
  border-top: 1px solid var(--line);
}
nav.tabs a { display: grid; justify-items: center; align-content: center; gap: 5px;
             text-decoration: none; color: #828da1; position: relative;
             min-height: var(--tap); padding-top: 3px; }
nav.tabs a.on { color: var(--brass); }
nav.tabs a.on::before { content: ""; position: absolute; top: -8px; width: 26px; height: 2px;
                        background: var(--brass); }
nav.tabs span { font-size: 9.5px; letter-spacing: .07em; font-weight: 600; }

/* ── auth ─────────────────────────────────────────────────────────────── */
.gate { max-width: 420px; margin: 0 auto; padding: 44px 22px 40px; min-height: 100vh;
        display: flex; flex-direction: column; justify-content: center; }
.gate .crest { display: grid; place-items: center; gap: 14px; margin-bottom: 30px; }
.gate .crest svg { width: 62px; height: 74px; }
.gate h1 { font-family: var(--slab); font-size: 25px; text-align: center; line-height: 1.1;
           letter-spacing: .04em; }
.gate .sub { text-align: center; color: var(--brass); font-size: 10px; letter-spacing: .2em;
             margin-top: 7px; font-family: var(--slab); }
.gate label { display: block; font-size: 10px; letter-spacing: .16em; color: var(--muted);
              margin: 18px 0 7px; text-transform: uppercase; }
.gate input {
  width: 100%; padding: 13px; background: #0d1220; border: 1px solid var(--line);
  border-radius: 2px; color: var(--ink); min-height: var(--tap);
}
.gate input:focus { outline: 0; box-shadow: inset 0 0 0 2px var(--focus); }
.gate .swap { margin-top: 20px; text-align: center; font-size: 12.5px; color: var(--muted); }
.gate .swap button { color: var(--brass); text-decoration: underline; font-size: 12.5px; }
.gate .note { margin-top: 16px; font-size: 12px; line-height: 1.5; color: var(--faint);
              text-align: center; }

/* ── overlays / toast ─────────────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(5,7,12,.86);
           display: grid; place-items: center; padding: 22px; }
.sheet { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line);
         border-radius: 3px; padding: 20px; }
.sheet h3 { font-family: var(--slab); font-size: 17px; margin-bottom: 9px; }
.sheet p { font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.sheet ol { margin: 12px 0 0 18px; font-size: 13px; color: var(--muted); line-height: 1.7; }
.sheet .acts { display: flex; gap: 9px; margin-top: 18px; }
.acctform { margin-top: 16px; }
.acctform label { display: block; font-size: 10px; letter-spacing: .16em; color: var(--muted);
                  text-transform: uppercase; margin: 14px 0 7px; }
.acctform input { width: 100%; padding: 12px; min-height: var(--tap); background: #0d1220;
                  border: 1px solid var(--line); border-radius: 2px; color: var(--ink); }
.acctform input:focus { outline: 0; box-shadow: inset 0 0 0 2px var(--focus); }
.sheet .acts .btn { flex: 1; text-align: center; }

#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
         z-index: 30; background: #1b2233; border: 1px solid var(--line); color: var(--ink);
         padding: 11px 16px; border-radius: 2px; font-size: 13px; max-width: 88vw;
         text-align: center; opacity: 0; pointer-events: none; transition: opacity .18s; }
#toast.show { opacity: 1; }

.empty { padding: 34px 22px; text-align: center; color: var(--faint); font-size: 13px;
         line-height: 1.6; }
.empty b { display: block; font-family: var(--slab); color: var(--muted); font-size: 15px;
           margin-bottom: 7px; }

.loading { padding: 40px; text-align: center; color: var(--faint); font-size: 12px;
           letter-spacing: .15em; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
