/* The Tally — The Ell at Marchwell.  A surveyor's field book left in a farmhouse that isn't there.
   Two of a thing is one of a thing: borders are doubled, headings echo as insanity rises. */

:root {
  --bg: #0d0b09; --bg2: #14110d; --panel: #1a1511; --panel2: #221b15; --line: #3a2f24; --line2: #5a4832;
  --ink: #ebe5d4; --muted: #b0a58d; --faint: #766c5a;
  --tallow: #e8c46a; --brass: #b08d57; --clay: #d9cdb4; --clay-ink: #2a2218;
  --rust: #c0634a; --sage: #8fae84; --ash: #8ea4aa; --dm: #c0634a;
  --accent: var(--tallow); --echo-c: rgba(120, 205, 215, .75); --echo: 0px;
  --display: "IM Fell English", "IM Fell English SC", Georgia, serif;
  --serif: "Spectral", Georgia, "Times New Roman", serif;
  --num: "Spectral", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --r: 4px;
  color-scheme: dark;
}
html[data-insanity="1"] { --echo: .5px; }
html[data-insanity="2"] { --echo: 1px; --accent: #e1c070; }
html[data-insanity="3"] { --echo: 1.6px; --accent: #d9c46f; --echo-c: rgba(135, 210, 200, .8); }
html[data-insanity="4"] { --echo: 2.4px; --accent: #cfc87a; --echo-c: rgba(150, 215, 190, .85); }
html[data-insanity="5"] { --echo: 3.4px; --accent: #bfd08a; --echo-c: rgba(180, 230, 170, .9); }
html[data-insanity="6"] { --echo: 4.5px; --accent: #d0e19a; --echo-c: rgba(210, 240, 170, .95); }

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font: 400 17px/1.55 var(--serif);
  background:
    radial-gradient(1200px 600px at 50% -10%, #2a2118 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 100%, #1c1710 0%, transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body::before { /* paper grain over everything */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5; mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .6  0 0 0 0 .55  0 0 0 0 .45  0 0 0 .55 0'/></filter><rect width='220' height='220' filter='url(%23n)'/></svg>");
}
body::after { /* vignette; tightens with insanity */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(ellipse at center, transparent calc(78% - var(--echo) * 4), rgba(0, 0, 0, .55) 120%);
}
#app, #layer, #toasts { position: relative; z-index: 1; }
a { color: var(--tallow); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 400; line-height: 1.15; margin: 0 0 .4em; letter-spacing: .01em; }
h1 { font-size: 2.3rem; } h2 { font-size: 1.55rem; } h3 { font-size: 1.2rem; } h4 { font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-family: var(--serif); font-weight: 600; }
h1, h2, .echoable { text-shadow: var(--echo) 0 0 var(--echo-c), calc(var(--echo) * -.5) 0 0 rgba(220, 120, 100, .35); }
p { margin: 0 0 .7em; } small, .small { font-size: .84rem; } .muted { color: var(--muted); } .faint { color: var(--faint); }
code, .mono { font-family: var(--mono); font-size: .85em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
.ico { vertical-align: -.2em; flex: none; }
.sr { position: absolute; left: -9999px; }
.right { margin-left: auto; } .row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; } .col { display: flex; flex-direction: column; gap: .6rem; }
.grow { flex: 1 1 0; min-width: 0; }
.spacer { height: 1rem; }

/* ---------- buttons, chips, fields ---------- */
.btn { font: 500 .92rem var(--serif); display: inline-flex; gap: .45em; align-items: center; justify-content: center; cursor: pointer; color: var(--ink); background: var(--panel2); border: 1px solid var(--line2); border-radius: var(--r); padding: .5em .95em; text-decoration: none; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: #2c231a; border-color: var(--brass); text-decoration: none; } .btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(#f0cf7c, #c9a24c); color: #1a1208; border-color: #f0cf7c; font-weight: 600; } .btn.primary:hover { background: linear-gradient(#f7dc92, #d6af58); }
.btn.ghost { background: transparent; } .btn.danger { color: #ffd6cc; border-color: #7a3a2a; background: #3a1d17; } .btn.danger:hover { background: #4d2419; }
.btn.sm { padding: .28em .65em; font-size: .82rem; } .btn.xs { padding: .12em .45em; font-size: .78rem; } .btn.icon { padding: .4em; } .btn[disabled] { opacity: .4; pointer-events: none; }
.badge { display: inline-flex; gap: .35em; align-items: center; padding: .1em .6em; border-radius: 99px; font: 600 .72rem var(--serif); letter-spacing: .06em; text-transform: uppercase; background: #2a2218; border: 1px solid var(--line2); color: var(--muted); }
.badge.gold { color: #1c1408; background: var(--tallow); border-color: var(--tallow); } .badge.bad { color: #ffd6cc; background: #4a2018; border-color: #7a3a2a; } .badge.good { color: #12200f; background: var(--sage); border-color: var(--sage); }
.badge.dm { color: #ffd6cc; border-color: #7a3a2a; background: #2c1612; } .badge.ash { color: #0f1a1c; background: var(--ash); border-color: var(--ash); }
.chip { display: inline-flex; align-items: center; gap: .35em; font: 500 .82rem var(--serif); padding: .15em .6em; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line2); color: var(--ink); cursor: default; }
button.chip { cursor: pointer; } button.chip:hover { border-color: var(--brass); } .chip.on { background: var(--tallow); color: #1a1208; border-color: var(--tallow); }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: var(--r); overflow: hidden; flex-wrap: wrap; }
.seg button { font: 500 .85rem var(--serif); background: transparent; color: var(--muted); border: 0; padding: .3em .7em; cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; } .seg button.on { background: var(--tallow); color: #1a1208; } .seg button:hover:not(.on) { background: var(--panel2); color: var(--ink); }
.field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .8rem; } .field > span { font: 600 .74rem var(--serif); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); } .field small { color: var(--faint); }
input, select, textarea { font: 400 .95rem var(--serif); color: var(--ink); background: #0f0c09; border: 1px solid var(--line2); border-radius: var(--r); padding: .5em .65em; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--tallow) 60%, transparent); outline-offset: 1px; border-color: var(--tallow); }
input[type=checkbox] { width: auto; accent-color: var(--tallow); } input[type=number] { width: 5.5em; } textarea { min-height: 5.5em; resize: vertical; line-height: 1.45; }
select { padding-right: 1.6em; } .inline-input { width: auto; display: inline-block; }
label.check { display: inline-flex; gap: .45em; align-items: center; cursor: pointer; font-size: .92rem; }

/* ---------- plates (doubled borders) ---------- */
.plate { background: linear-gradient(180deg, var(--panel), #16110d); border: 1px solid var(--line2); outline: 1px solid var(--line); outline-offset: 3px; border-radius: var(--r); padding: 1rem 1.15rem; margin: 4px; position: relative; }
.plate > h3:first-child, .plate > .plate-head:first-child { margin-top: 0; }
.plate-head { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; margin-bottom: .6rem; } .plate-head h3 { margin: 0; }
.plate.tight { padding: .7rem .85rem; } .plate.flat { outline: 0; margin: 0; }
.paper { background: var(--clay); color: var(--clay-ink); border-radius: var(--r); padding: .8rem 1rem; box-shadow: inset 0 0 40px rgba(110, 80, 40, .22), 0 1px 0 #fff3 inset; }
.paper h3, .paper h4 { color: #4a3a22; } .paper a { color: #7a3a22; }
.read-aloud { background: #1d1912; border-left: 3px solid var(--tallow); padding: .5rem .9rem; border-radius: 0 var(--r) var(--r) 0; font-style: italic; color: #efe6cf; margin: .5rem 0; }
.dm-only { background: #231411; border: 1px solid #5c2b20; border-left: 3px solid var(--dm); border-radius: var(--r); padding: .55rem .85rem; margin: .5rem 0; color: #ecd2c8; position: relative; }
.dm-only::before { content: "DM ONLY"; position: absolute; top: -.62em; right: .6em; font: 700 .62rem var(--serif); letter-spacing: .16em; color: #ffcfc2; background: #5c2b20; padding: .05em .55em; border-radius: 2px; }
.grid { display: grid; gap: .9rem; } .g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); } .g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } .g4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.empty { text-align: center; padding: 2.2rem 1rem; color: var(--muted); } .empty .ico { opacity: .55; margin-bottom: .4rem; }
.section-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin: 1.4rem 0 .7rem; } .section-head h2 { margin: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .15rem .9rem; margin: 0; } .kv dt { color: var(--muted); font-size: .85rem; } .kv dd { margin: 0; }

/* ---------- topbar ---------- */
.topbar { display: flex; align-items: center; gap: 1rem; padding: .7rem clamp(1rem, 3vw, 2rem); border-bottom: 1px solid var(--line); background: linear-gradient(#0f0c09ee, #0d0b09cc); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); } .brand:hover { text-decoration: none; }
.brand .dmark { color: var(--tallow); filter: drop-shadow(var(--echo) 0 0 var(--echo-c)); }
.brand b { font: 400 1.35rem var(--display); display: block; line-height: 1; text-shadow: var(--echo) 0 0 var(--echo-c); } .brand small { font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.who { margin-left: auto; display: flex; align-items: center; gap: .7rem; } .who-text { line-height: 1.15; } .who-text b { display: block; font-weight: 600; } .who-text small { color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line2); } .avatar.letter { display: grid; place-items: center; font: 600 .85rem var(--serif); background: hsl(var(--h) 25% 22%); color: #eadfc6; }

/* ---------- landing ---------- */
.hero { position: relative; height: min(640px, 72vh); overflow: hidden; border-bottom: 1px solid var(--line); background: #07080f; }
.hero-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero::after { content: ""; position: absolute; inset: auto 0 0 0; height: 55%; background: linear-gradient(transparent, var(--bg)); }
.hero-title { position: absolute; z-index: 2; left: 0; right: 0; bottom: 2.2rem; text-align: center; padding: 0 1rem; }
.hero-title .kicker { font: 600 .78rem var(--serif); letter-spacing: .42em; text-transform: uppercase; color: var(--tallow); margin-bottom: .6rem; }
.hero-title h1 { font-size: clamp(2.3rem, 7vw, 4.6rem); margin: 0; letter-spacing: .02em; }
.hero-title .sub { font-style: italic; color: var(--muted); font-size: 1.1rem; margin: .4rem 0 0; }
.hero-title .rule { color: var(--tallow); margin-top: .5rem; opacity: .8; }
.hero .tick { position: absolute; z-index: 2; right: 6%; top: 18%; color: #d9cdb4; opacity: .6; font: 400 .8rem var(--mono); letter-spacing: .1em; text-align: right; animation: breathe 6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .25; } }
.doors { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); max-width: 940px; margin: 1.5rem auto 3rem; padding: 0 1rem; }
.door { text-align: center; } .door h2 { margin-top: .3rem; } .door .ico { color: var(--tallow); }
.google-btn { display: inline-flex; align-items: center; gap: .7rem; background: #fff; color: #222; border-radius: 4px; padding: .55em 1.1em; font: 500 .95rem Roboto, Arial, sans-serif; box-shadow: 0 1px 2px #0006; } .google-btn:hover { text-decoration: none; background: #f3f3f3; } .g-logo { display: inline-flex; }
.guest-form { display: flex; gap: .5rem; max-width: 380px; margin: .8rem auto 0; } .warn { color: #f3c48b; font-size: .9rem; }

/* ---------- registry ---------- */
.registry { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.reg-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.reg-card { display: block; color: var(--ink); } .reg-card:hover { text-decoration: none; border-color: var(--tallow); } .reg-card h3 { margin-bottom: .2rem; } .reg-card .tag { font-style: italic; color: var(--muted); }
.reg-meta { display: flex; gap: .45rem; flex-wrap: wrap; margin: .7rem 0 .4rem; }

/* ---------- campaign header & tabs ---------- */
.camp { max-width: 1240px; margin: 0 auto; padding: 0 clamp(.7rem, 2.5vw, 1.6rem) 3rem; }
.camp-head { padding: 1.1rem 0 0; display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: end; }
.camp-title .back { font-size: .85rem; color: var(--muted); } .camp-title h1 { margin: .2rem 0 .1rem; } .camp-title p { color: var(--muted); margin: 0; font-style: italic; }
.camp-title .badges { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .6rem; }
.head-gauge { text-align: center; color: var(--ink); min-width: 160px; } .head-gauge .gauge { display: block; margin: 0 auto; } .head-gauge .nm { font: 400 1.05rem var(--display); margin-top: -.2rem; } .head-gauge small { color: var(--muted); display: block; }
.tabs { display: flex; gap: .25rem; margin: 1.1rem 0 1.1rem; border-bottom: 1px solid var(--line2); overflow-x: auto; scrollbar-width: thin; grid-column: 1 / -1; }
.tab { display: inline-flex; align-items: center; gap: .45em; padding: .55em .95em; color: var(--muted); border: 1px solid transparent; border-bottom: 0; border-radius: var(--r) var(--r) 0 0; white-space: nowrap; font-size: .95rem; }
.tab:hover { color: var(--ink); text-decoration: none; background: var(--panel); } .tab.on { color: var(--ink); background: var(--panel); border-color: var(--line2); box-shadow: 0 2px 0 var(--bg) inset; position: relative; top: 1px; } .tab.on .ico { color: var(--tallow); }
.tab.dm { color: #d9a090; } .tab.dm.on { color: #ffd6cc; } .tab .n { font: 600 .68rem var(--serif); background: var(--tallow); color: #1a1208; border-radius: 99px; padding: 0 .45em; }
.foot { text-align: center; color: var(--faint); padding: 2rem 1rem; font-size: .82rem; }
.boot { display: grid; place-items: center; height: 70vh; color: var(--tallow); } .spin { animation: turn 12s linear infinite; } @keyframes turn { to { transform: rotate(360deg); } }

/* ---------- insanity ---------- */
.gauge { color: var(--ink); overflow: visible; } .gauge .gt { fill: var(--muted); font: 500 10px var(--mono); } .gauge .gt.on { fill: var(--accent); font-weight: 600; }
.gauge .gbig { fill: var(--ink); font: 500 30px var(--num); } .gauge .echo { transform-origin: center; }
html[data-insanity="4"] .gauge .echo, html[data-insanity="5"] .gauge .echo { animation: jitter 3.2s steps(2, end) infinite; }
@keyframes jitter { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(1.2px); } }
.insane-panel { display: grid; grid-template-columns: auto 1fr; gap: 1.2rem; align-items: center; } @media (max-width: 640px) { .insane-panel { grid-template-columns: 1fr; text-align: center; } }
.effects { display: flex; gap: .6rem; flex-wrap: wrap; margin: .5rem 0; } .effect { background: #0f0c09; border: 1px solid var(--line2); border-radius: var(--r); padding: .3em .7em; font: 500 .95rem var(--mono); } .effect b { color: var(--accent); }
.level-bar { display: flex; gap: 3px; margin: .6rem 0; } .level-bar i { flex: 1; height: 9px; background: #2a2218; border-radius: 1px; position: relative; } .level-bar i.on { background: var(--accent); box-shadow: var(--echo) 0 0 var(--echo-c); } .level-bar i.cap { background: var(--rust); }
.mark { display: flex; gap: .5rem; align-items: baseline; padding: .3rem 0; border-bottom: 1px dashed var(--line); } .mark:last-child { border: 0; } .mark .lv { font: 600 .7rem var(--mono); color: var(--accent); background: #0f0c09; border: 1px solid var(--line2); border-radius: 3px; padding: 0 .35em; }
.hist { font-size: .88rem; } .hist li { padding: .2rem 0; border-bottom: 1px dashed var(--line); list-style: none; } .hist ul { padding: 0; margin: 0; } .hist .arrow { font-family: var(--mono); color: var(--accent); }
.delta-up { color: #f0b36a; } .delta-down { color: var(--sage); }

/* ---------- party ---------- */
.pc { display: grid; gap: .5rem; } .pc-top { display: flex; gap: .7rem; align-items: center; } .pc-top h3 { margin: 0; } .pc-top small { color: var(--muted); }
.pc .stats { display: flex; gap: .5rem; flex-wrap: wrap; } .stat { text-align: center; background: #0f0c09; border: 1px solid var(--line2); border-radius: var(--r); min-width: 58px; padding: .15rem .45rem; } .stat b { display: block; font: 500 1.25rem var(--num); line-height: 1.1; } .stat small { text-transform: uppercase; letter-spacing: .1em; font-size: .62rem; color: var(--muted); }
.bar { height: 9px; background: #0f0c09; border: 1px solid var(--line2); border-radius: 2px; overflow: hidden; } .bar-fill { height: 100%; transition: width .3s; } .bar-fill.good { background: linear-gradient(#9fc593, #6f9a64); } .bar-fill.warn { background: linear-gradient(#e8c46a, #b88f33); } .bar-fill.bad { background: linear-gradient(#d9775e, #9c3f2c); } .bar-fill.ink { background: var(--ash); }
.hp-ctl { display: flex; gap: .25rem; flex-wrap: wrap; } .hp-ctl button { font: 600 .75rem var(--mono); background: #231b14; color: var(--ink); border: 1px solid var(--line2); border-radius: 3px; padding: .15em .45em; cursor: pointer; } .hp-ctl button:hover { border-color: var(--tallow); }
.cond { font-size: .75rem; padding: .05em .5em; border-radius: 99px; background: #3a1d17; border: 1px solid #7a3a2a; color: #ffd6cc; }
.status-filed, .status-dead { opacity: .6; } .status-filed h3::after { content: " — Filed"; color: var(--rust); font-size: .9rem; } .status-dead h3::after { content: " — Dead"; color: var(--rust); font-size: .9rem; }

/* ---------- acts ---------- */
.act { margin-bottom: 1rem; } .act-head { display: flex; gap: 1rem; align-items: center; cursor: pointer; flex-wrap: wrap; }
.act-num { font: 500 2.6rem var(--num); color: var(--tallow); line-height: 1; min-width: 2.2rem; text-shadow: var(--echo) 0 0 var(--echo-c); }
.progress { height: 6px; background: #0f0c09; border: 1px solid var(--line2); border-radius: 2px; width: 100%; max-width: 260px; } .progress i { display: block; height: 100%; background: var(--tallow); }
.beat { display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; padding: .55rem .4rem; border-bottom: 1px dashed var(--line); align-items: start; } .beat:last-child { border: 0; }
.beat .state { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line2); display: grid; place-items: center; background: #0f0c09; color: var(--muted); cursor: pointer; padding: 0; margin-top: .1rem; }
.beat .state:hover { border-color: var(--tallow); } .beat.done .state { background: var(--sage); color: #12200f; border-color: var(--sage); } .beat.active .state { background: var(--tallow); color: #1a1208; border-color: var(--tallow); animation: breathe 2.4s infinite; } .beat.skipped .state { opacity: .5; text-decoration: line-through; }
.beat.done .btitle { color: var(--muted); } .btitle { font: 400 1.1rem var(--display); cursor: pointer; } .kind { font: 600 .62rem var(--serif); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-left: .5rem; }
.beat-body { grid-column: 2 / -1; } .beat-body .chips { display: flex; gap: .35rem; flex-wrap: wrap; margin: .4rem 0; }
.session { display: grid; grid-template-columns: auto 1fr; gap: .2rem 1rem; padding: .7rem 0; border-bottom: 1px dashed var(--line); } .session .n { font: 500 1.5rem var(--num); color: var(--tallow); grid-row: span 3; }

/* ---------- the Ell ---------- */
.depths { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; } @media (max-width: 760px) { .depths { grid-template-columns: repeat(3, 1fr); } }
.depth { text-align: center; padding: .5rem .3rem; border: 1px solid var(--line2); background: #14100c; cursor: pointer; border-radius: var(--r); color: var(--muted); font: inherit; } .depth:hover { border-color: var(--brass); } .depth.on { background: #2a2116; border-color: var(--tallow); color: var(--ink); box-shadow: inset 0 -3px 0 var(--tallow); } .depth b { display: block; font: 500 1.4rem var(--num); } .depth small { font-size: .7rem; letter-spacing: .04em; }
.dice { display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; background: #0f0c09; border: 1px solid var(--line2); border-radius: 6px; font: 600 1.2rem var(--mono); color: var(--tallow); }
.rest-result { border-left: 3px solid var(--tallow); background: #1c1710; padding: .7rem .9rem; border-radius: 0 var(--r) var(--r) 0; margin-top: .7rem; } .rest-result.bad { border-color: var(--rust); } .rest-result.ok { border-color: var(--sage); }
.rest-result .big { font: 400 1.7rem var(--display); }
.counter { text-align: center; } .counter b { font: 500 2.4rem var(--num); display: block; line-height: 1; } .counter small { color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-size: .68rem; }
.boxes { display: flex; gap: 5px; justify-content: center; margin: .4rem 0; } .boxes i { width: 22px; height: 22px; border: 1.5px solid var(--line2); border-radius: 3px; background: #0f0c09; display: grid; place-items: center; font-style: normal; color: #1a1208; } .boxes i.on { background: var(--tallow); border-color: var(--tallow); } .boxes i.echo { border-style: dashed; color: var(--muted); }
.house { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: .5rem 0; } @media (max-width: 640px) { .house { grid-template-columns: repeat(4, 1fr); } }
.ver { text-align: center; padding: .4rem .2rem; border: 1px solid var(--line2); border-radius: var(--r); background: #14100c; cursor: pointer; font: inherit; color: var(--muted); } .ver b { font: 500 1.2rem var(--num); display: block; } .ver small { font: 500 .66rem var(--mono); } .ver.on { background: #2a2116; border-color: var(--tallow); color: var(--ink); } .ver.seen { color: var(--ink); } .ver.v7 { border-color: var(--rust); }
.door-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; } @media (max-width: 560px) { .door-btns { grid-template-columns: repeat(2, 1fr); } }
.door-btn { padding: .6rem .3rem; text-align: center; border: 1px solid var(--line2); border-radius: var(--r); background: #1b150f; color: var(--ink); cursor: pointer; font: inherit; } .door-btn:hover { border-color: var(--tallow); } .door-btn b { display: block; font: 400 1.05rem var(--display); } .door-btn small { color: var(--muted); }
.trail { font: 400 .8rem var(--mono); color: var(--muted); display: flex; gap: .3rem; flex-wrap: wrap; } .trail span { background: #0f0c09; border: 1px solid var(--line); border-radius: 3px; padding: 0 .35em; }
.room { border: 1px solid var(--line2); border-radius: var(--r); background: #16110d; margin-bottom: .6rem; } .room-h { display: flex; gap: .6rem; align-items: center; padding: .55rem .8rem; cursor: pointer; flex-wrap: wrap; } .room-h .rn { font: 500 1.15rem var(--num); color: var(--tallow); min-width: 1.6rem; } .room-b { padding: .2rem .9rem .8rem; border-top: 1px dashed var(--line); }
.room.known { border-left: 3px solid var(--tallow); } .room.heard { border-left: 3px solid var(--ash); }
.doorrow { display: grid; grid-template-columns: 1fr 5.5em auto auto; gap: .4rem; align-items: center; padding: .25rem 0; } .doorrow input { padding: .25em .5em; font-size: .88rem; } .doorrow.defaced input { text-decoration: line-through; opacity: .6; }
.set-card { border: 1px solid var(--line2); border-radius: var(--r); padding: .55rem .75rem; margin-bottom: .5rem; background: #14100c; } .set-card .nm { font: 400 1.15rem var(--display); color: var(--tallow); } .set-card li { font-size: .88rem; list-style: none; } .set-card ul { margin: .3rem 0; padding: 0; }
.rule-pair { color: var(--sage); } .rule-random { color: #f0b36a; } .rule-true { color: var(--ash); }

/* ---------- tally ---------- */
.frame-wrap { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: 1.2rem; align-items: start; } @media (max-width: 860px) { .frame-wrap { grid-template-columns: 1fr; } }
.doorframe { width: 100%; height: auto; } .frame-title { fill: #9a8561; font: 400 12px var(--mono); letter-spacing: .25em; } .cut.struck path:not(.strike) { opacity: .75; } .cut-label { fill: #b9a98a; stroke: none; font: 400 9px var(--mono); letter-spacing: .04em; }
.strike { stroke: #d9775e; stroke-width: 2.6; } .cut:hover, .cut:focus { stroke: var(--tallow); outline: none; }
.count-line { font: 400 1.4rem var(--serif); text-align: center; padding: .6rem; } .count-line.ok b { color: var(--sage); } .count-line.bad b { color: var(--rust); }
.marks-list { padding: 0; margin: 0; } .marks-list li { list-style: none; display: grid; grid-template-columns: 1fr auto; gap: .4rem; padding: .35rem 0; border-bottom: 1px dashed var(--line); align-items: center; } .marks-list li.struck .nm { text-decoration: line-through; color: var(--muted); }

/* ---------- codex / journal ---------- */
.filters { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .8rem; align-items: center; }
.entry { border: 1px solid var(--line2); border-radius: var(--r); padding: .6rem .85rem; background: #16110d; margin-bottom: .55rem; } .entry.hidden { opacity: .62; border-style: dashed; } .entry.heard { border-left: 3px solid var(--ash); } .entry.known { border-left: 3px solid var(--tallow); }
.entry h3 { margin: 0; font-size: 1.1rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; } .entry .meta { color: var(--muted); font-size: .8rem; }
.state-pills { display: inline-flex; gap: 3px; } .state-pills button { font: 600 .68rem var(--serif); letter-spacing: .08em; text-transform: uppercase; padding: .15em .55em; border-radius: 99px; border: 1px solid var(--line2); background: #14100c; color: var(--muted); cursor: pointer; } .state-pills button.on.none { background: #2a2218; color: var(--ink); } .state-pills button.on.heard { background: var(--ash); color: #0f1a1c; border-color: var(--ash); } .state-pills button.on.known { background: var(--tallow); color: #1a1208; border-color: var(--tallow); }
.ladder { position: relative; padding-left: 1.6rem; } .ladder::before { content: ""; position: absolute; left: .55rem; top: .5rem; bottom: .5rem; width: 2px; background: repeating-linear-gradient(var(--line2) 0 6px, transparent 6px 10px); } .rung { position: relative; margin-bottom: .6rem; } .rung::before { content: ""; position: absolute; left: -1.45rem; top: .75rem; width: 11px; height: 11px; background: #14100c; border: 2px solid var(--line2); border-radius: 50%; } .rung.known::before { background: var(--tallow); border-color: var(--tallow); } .rung.must::before { border-radius: 2px; }

/* ---------- items / money ---------- */
.item-card { display: grid; gap: .3rem; } .rarity { font: 600 .66rem var(--serif); letter-spacing: .12em; text-transform: uppercase; color: var(--brass); }
.money { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } .money .stat { min-width: 0; padding: .5rem; } .money .stat b { font-size: 1.6rem; }

/* ---------- fights ---------- */
.init { display: grid; grid-template-columns: 2.6rem 1fr auto; gap: .6rem; align-items: center; padding: .55rem .6rem; border: 1px solid var(--line2); border-radius: var(--r); background: #16110d; margin-bottom: .4rem; } .init.turn { border-color: var(--tallow); box-shadow: 0 0 0 1px var(--tallow), 0 0 18px #e8c46a33; } .init.foe { border-left: 4px solid var(--rust); } .init.pc { border-left: 4px solid var(--sage); } .init.ally { border-left: 4px solid var(--ash); } .init.down { opacity: .5; } .init.waiting { opacity: .55; border-style: dashed; }
.init .ib { text-align: center; font: 500 1.2rem var(--num); color: var(--tallow); } .init .nm { font: 400 1.1rem var(--display); } .init .ctl { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.dmg { width: 4.2em !important; padding: .2em .4em; }
.banner { display: flex; gap: .8rem; align-items: center; background: linear-gradient(90deg, #3a1d17, #1e1410); border: 1px solid #7a3a2a; border-radius: var(--r); padding: .6rem .9rem; margin: 4px 4px .9rem; flex-wrap: wrap; }

/* ---------- reference library ---------- */
.lib { display: grid; grid-template-columns: 290px 1fr; gap: 1rem; align-items: start; } @media (max-width: 900px) { .lib { grid-template-columns: 1fr; } }
.lib-nav { position: sticky; top: 4.4rem; max-height: calc(100vh - 6rem); overflow: auto; padding: .6rem .7rem; } @media (max-width: 900px) { .lib-nav { position: static; max-height: 280px; } }
.lib-nav .docs { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .6rem; } .lib-nav ul { list-style: none; padding: 0; margin: 0; } .lib-nav li a { display: block; padding: .15rem .3rem; color: var(--muted); font-size: .86rem; border-radius: 3px; cursor: pointer; } .lib-nav li a:hover, .lib-nav li a.on { background: #2a2116; color: var(--ink); text-decoration: none; } .lib-nav li.l2 a { padding-left: .9rem; } .lib-nav li.l3 a { padding-left: 1.5rem; font-size: .8rem; } .lib-nav li.l4 a { padding-left: 2.1rem; font-size: .78rem; }
.prose { max-width: 78ch; } .prose h3, .prose h4, .prose h5 { margin-top: 1.2em; } .prose h3 { font-size: 1.4rem; color: var(--tallow); } .prose h4 { color: var(--ink); text-transform: none; letter-spacing: 0; font-family: var(--display); font-size: 1.15rem; } .prose h5 { font-size: .95rem; color: var(--muted); }
.prose blockquote { margin: .7em 0; padding: .3rem 1rem; border-left: 3px solid var(--tallow); background: #1d1912; font-style: italic; border-radius: 0 var(--r) var(--r) 0; } .prose blockquote p { margin: .3em 0; }
.prose pre { background: #0f0c09; border: 1px solid var(--line); padding: .7rem; overflow: auto; font: 400 .82rem/1.35 var(--mono); border-radius: var(--r); }
.prose code { background: #0f0c09; padding: .05em .35em; border-radius: 3px; border: 1px solid var(--line); }
.prose ul, .prose ol { padding-left: 1.3rem; } .prose li { margin: .15rem 0; }
.tbl { overflow-x: auto; margin: .7rem 0; } table { border-collapse: collapse; width: 100%; font-size: .9rem; } th, td { border: 1px solid var(--line); padding: .35rem .55rem; text-align: left; vertical-align: top; } th { background: #231b14; font: 600 .74rem var(--serif); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.hit { padding: .5rem .6rem; border-bottom: 1px dashed var(--line); cursor: pointer; } .hit:hover { background: #1d1710; } .hit small { color: var(--muted); display: block; }

/* ---------- overview ---------- */
.ov { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } @media (max-width: 960px) { .ov { grid-template-columns: 1fr; } }
.now { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: center; } .now .act-num { font-size: 3.4rem; }
.quick { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.log-item { padding: .5rem 0; border-bottom: 1px dashed var(--line); display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; } .log-item:last-child { border: 0; } .log-item .t { font: 500 .72rem var(--mono); color: var(--faint); white-space: nowrap; } .log-item b { font-family: var(--serif); font-weight: 600; font-size: 1rem; } .log-item.hid { opacity: .6; }
.depth-line { font: 400 1.2rem var(--display); color: var(--ink); } .depth-line small { font: 400 .85rem var(--serif); color: var(--muted); }
.next-up { border: 1px dashed var(--tallow); border-radius: var(--r); padding: .6rem .8rem; background: #1b160e; }

/* ---------- modals & toasts ---------- */
#layer { position: relative; z-index: 50; }
.modal-back { position: fixed; inset: 0; background: rgba(5, 4, 3, .72); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 1rem; z-index: 50; animation: fade .15s; }
.modal-card { background: var(--panel); border: 1px solid var(--line2); outline: 1px solid var(--line); outline-offset: 4px; border-radius: var(--r); width: 100%; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 80px #000a; } .modal-card.narrow { max-width: 480px; } .modal-card.wide { max-width: 860px; }
.modal-card header { display: flex; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--line); } .modal-card header h2 { margin: 0; font-size: 1.35rem; flex: 1; } .modal-card .x { background: transparent; border: 0; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.modal-body { padding: 1rem; overflow: auto; } .modal-card footer { padding: .7rem 1rem; display: flex; gap: .5rem; justify-content: flex-end; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: .4rem; z-index: 90; align-items: center; pointer-events: none; }
.toast { background: #251d15; border: 1px solid var(--line2); border-left: 4px solid var(--tallow); padding: .55rem 1rem; border-radius: var(--r); box-shadow: 0 6px 24px #000a; max-width: min(90vw, 460px); transition: opacity .5s; } .toast.bad { border-left-color: var(--rust); } .toast.good { border-left-color: var(--sage); } .toast.out { opacity: 0; }

@media (max-width: 640px) { body { font-size: 16px; } h1 { font-size: 1.8rem; } .camp-head { grid-template-columns: 1fr; } .head-gauge { order: -1; } .who-text { display: none; } .beat { grid-template-columns: auto 1fr; } .beat > .right { grid-column: 2; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { body::before, body::after, .topbar, .tabs { display: none; } }
