/* Valdris — Editorial Dark Fantasy UI (Phase 21)
   Ported from mockups/tome_editorial_v2.html + the design-guide doc. */
:root{
  --ground:#121212;
  --ground-2:#1a1a1a;
  --ink:#e0e0e0;
  --ink-2:#b0b0b0;
  --muted:#7a7a7a;
  --hair:#333333;
  --accent:#c9a86a;
  --accent-glow: #e8d099;
  --accent-soft: rgba(201, 168, 106, 0.15);
  --meas:60ch;
  --font-size: 20px;
  color-scheme: dark;
}
:root.light-theme {
  --ground:#f7f5ef;
  --ground-2:#ffffff;
  --ink:#1a1a1a;
  --ink-2:#5c5c5c;
  --muted:#8c8c8c;
  --hair:#e6e3da;
  --accent:#b58a3c;
  --accent-glow:#966b1e;
  --accent-soft: rgba(181, 138, 60, 0.1);
  color-scheme: light;
}
*{ box-sizing:border-box; }
body{
  /* dvh tracks iOS Safari's shrinking/growing toolbar so the composer never
     hides under the address bar; 100vh is the fallback for old engines. */
  margin:0; height:100vh; height:100dvh; display: flex; overflow: hidden;
  background:var(--ground); color:var(--ink);
  font-family:"Newsreader",Georgia,serif; font-size:var(--font-size); line-height:1.72; transition: background 0.3s, color 0.3s;
  font-feature-settings:"onum" 1,"liga" 1,"kern" 1;
  -webkit-font-smoothing:antialiased;
}
.sans{ font-family:"Inter",-apple-system,sans-serif; }
.u-label{ font-family:"Inter",sans-serif; text-transform:uppercase; letter-spacing:.16em;
  font-size:11px; font-weight:500; color:var(--muted); }

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--ground-2);
  border-right: 1px solid var(--hair);
  padding: 30px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: margin-left 0.3s ease;
}
body.sidebar-closed .sidebar { margin-left: -280px; }
.side-title {
  font-family: "Inter", sans-serif;
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  border-bottom: 1px solid var(--hair);
  padding-bottom: 8px;
  margin-bottom: 20px;
}
.hpblock .top{ display:flex; justify-content:space-between; align-items:baseline; margin-bottom:8px; }
.hpblock .top .n{ font-family:"Fraunces",serif; font-size:15px; }
.bar{ height:4px; border-radius:3px; background:var(--ground); box-shadow:inset 0 0 0 1px var(--hair); overflow:hidden; }
.bar i{ display:block; height:100%; background:var(--accent); border-radius:3px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stat-grid .cell .v { font-family: "Fraunces", serif; font-size: 21px; font-weight: 500; color: var(--ink); margin-top: 4px; }

.inv-list, .cond-list { list-style: none; padding: 0; margin: 0; font-family: "Newsreader", serif; font-size: 16px; color: var(--ink-2); }
.inv-list li, .cond-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--hair); }
.inv-list li .qty { color: var(--muted); font-size: 13px; }

/* Main Wrapper */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
}

/* masthead */
.masthead{
  display: flex; justify-content: space-between; align-items: center;
  padding:16px 40px;
  padding-top:calc(16px + env(safe-area-inset-top, 0px));
  padding-left:max(40px, env(safe-area-inset-left, 0px));
  padding-right:max(40px, env(safe-area-inset-right, 0px));
  border-bottom:1px solid var(--hair);
  position: sticky; top: 0; background: var(--ground-2); z-index: 10; transition: background 0.3s;
}
.masthead .word{ font-family:"Inter",sans-serif; text-transform:uppercase; letter-spacing:.42em;
  font-size:12px; font-weight:600; color:var(--ink-2); padding-left:.42em; }
.masthead .actions { display: flex; gap: 16px; color: var(--muted); align-items: center; position: relative; }
.act-icons { display: flex; gap: 20px; align-items: center; }
.masthead .actions svg { width: 18px; height: 18px; cursor: pointer; transition: color 0.2s; }
.masthead .actions svg:hover { color: var(--accent); }
/* mobile "more" menu toggle — hidden on desktop, the icons show inline */
.act-menu-btn{ display:none; background:none; border:0; color:var(--muted); cursor:pointer;
  padding:6px; margin:-6px; border-radius:8px; }
.act-menu-btn:hover{ color:var(--accent); }

.shell{ max-width:720px; margin:0 auto; padding:0 28px; width: 100%; }

/* header */
.hd{ display:flex; align-items:flex-end; gap:20px; padding:40px 0 8px; }
.hd .name{ font-family:"Fraunces",serif; font-weight:500; font-size:30px; line-height:1; letter-spacing:.1px; color: var(--accent-glow); }
.hd .who{ margin-top:9px; }
.hd .meta{ margin-left:auto; text-align:right; }
.hd .meta .day{ display:block; }
.hd .status{ display:inline-block; margin-top:9px; color:var(--accent);
  font-family:"Inter",sans-serif; text-transform:uppercase; letter-spacing:.16em; font-size:11px; font-weight:600; }
.hd .status::before{ content:""; display:inline-block; width:5px; height:5px; border-radius:50%;
  background:var(--accent); margin-right:7px; vertical-align:2px; }

.divider {
  display: flex; align-items: center; justify-content: center; margin: 30px 0; gap: 15px;
}
.divider::before, .divider::after {
  content: ''; height: 1px; width: 80px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.5;
}
.divider-icon { color: var(--accent); font-size: 14px; }

/* recap ("previously on Valdris") */
.recap{ max-width:var(--meas); margin:0 auto 20px; padding:16px 20px; background:var(--ground-2);
  border-left:2px solid var(--accent); border-radius:6px; font-style:italic; color:var(--ink-2); }
.recap .u-label{ display:block; margin-bottom:8px; font-style:normal; }

/* "Catch me up" — collapsible orientation/recap below the opening prose */
.catchup{ max-width:var(--meas); margin:32px auto 12px; }
.catchup > summary{ font-family:"Inter",sans-serif; text-transform:uppercase;
  letter-spacing:.16em; font-size:.72rem; color:var(--ink-2); cursor:pointer;
  list-style:none; padding:6px 0; opacity:.75; user-select:none; }
.catchup > summary::-webkit-details-marker{ display:none; }
.catchup > summary::before{ content:"▸ "; }
.catchup[open] > summary::before{ content:"▾ "; }
.catchup > summary:hover{ opacity:1; }
.catchup .recap{ margin:12px auto 0; }

/* prose */
.prose{ max-width:var(--meas); margin:0 auto; }
.narr{ margin:0 0 26px; white-space:pre-wrap; }
.narr em{ font-style:italic; }
.lead .drop{
  float:left; font-family:"Fraunces",serif; font-weight:500; font-size:88px; line-height:.74;
  padding:8px 14px 0 0; color:var(--accent-glow);
}

/* player line — indented, bounded, clear distinction */
.you{
  margin: 32px 0 32px 40px;
  padding: 16px 24px;
  background: var(--ground-2);
  border-radius: 6px;
  border-left: 2px solid var(--accent);
  position: relative;
}
.you .tag{ display:block; margin-bottom:8px; color: var(--accent); }
.you .said{ color:var(--ink); font-style: italic; }

/* roll = editorial footnote, centered */
.roll{ max-width:44ch; margin:34px auto; text-align:center; }
.roll .cap{ display:inline-block; width:34px; height:1px; background:var(--muted); opacity:.5; margin-bottom:16px; }
.roll .lab{ display:block; margin-bottom:7px; }
.roll .val{ font-size:20px; }
.roll .val b{ font-weight:600; color: var(--accent-glow); }
.roll .res{ font-style:italic; color:var(--muted); margin-top:3px; }
.roll .foe{ color:var(--accent); font-style:italic; }
.roll.crit .lab{ color:var(--accent); }
.roll.crit .cap{ background:var(--accent); opacity:.9; width:44px; }
.roll.crit .flag{ font-family:"Inter",sans-serif; text-transform:uppercase; letter-spacing:.2em;
  font-size:11px; font-weight:600; color:var(--accent); margin-top:9px; }
.roll{ animation:fade .45s ease both; }
@keyframes fade{ from{ opacity:0; transform:translateY(5px); } to{ opacity:1; transform:none; } }

/* Phase 1a growth surfaces — sidebar XP bar + honed skills */
.xpblock .bar i{ background:linear-gradient(90deg,var(--accent),var(--accent-glow));
  transition:width .8s ease; }
.xpblock.gain .bar{ box-shadow:inset 0 0 0 1px var(--accent); }
.xpblock.gain .bar i{ box-shadow:0 0 10px rgba(201,168,106,.55); }
.honed-list{ display:flex; flex-wrap:wrap; gap:8px; }
.honed-chip{ border:1px solid var(--hair); border-radius:20px; padding:3px 12px;
  font-family:"Inter",sans-serif; font-size:12px; color:var(--ink-2); }
.honed-chip b{ color:var(--accent-glow); font-weight:600; }

/* Companion v1 (2026-07-23) — sidebar chip: name + role, muted like a label. */
.companion-chip{ font-family:"Inter",sans-serif; font-size:12px; color:var(--ink-2); }
.companion-chip b{ color:var(--accent-glow); font-weight:600; }

/* Phase 1a — three mechanics tiers in the feed:
   dice (.roll) loud · xp/tick quiet · level-up banner loudest-and-last. */
.mech-xp{ text-align:center; font-family:"Inter",sans-serif; font-size:11.5px;
  color:var(--muted); letter-spacing:.04em; margin:10px auto 0; animation:fade .45s ease both; }
.mech-tick{ max-width:44ch; margin:16px auto 0; text-align:center;
  font-family:"Inter",sans-serif; font-size:12.5px; color:var(--ink-2);
  animation:fade .45s ease both; }
.mech-tick::before{ content:""; display:block; width:26px; height:1px;
  background:var(--accent); opacity:.6; margin:0 auto 8px; }
.levelup-banner{ max-width:52ch; margin:38px auto; border:1px solid var(--accent);
  border-radius:8px; background:var(--accent-soft); padding:18px 22px;
  text-align:center; box-shadow:0 0 18px rgba(201,168,106,.18);
  animation:fade .6s ease both; }
.levelup-banner .lu-head{ font-family:"Inter",sans-serif; text-transform:uppercase;
  letter-spacing:.22em; font-size:12px; font-weight:600; color:var(--accent); }
.levelup-banner .lu-body{ font-family:"Fraunces",serif; font-size:19px;
  color:var(--ink); margin-top:8px; line-height:1.45; }

/* Phase 2 (2026-07-27) — adventure completion: the loudest beat the game
   has, bigger than level-up. Same construction as .levelup-banner (bordered,
   glowing, centred), scaled up. Built entirely from the theme's own custom
   properties (--accent / --accent-soft / --ink), so it reads correctly in
   both the dark default and :root.light-theme the app ships — no color is
   hardcoded here for one theme only. */
.adventure-banner{ max-width:42ch; margin:26px auto; border:1px solid var(--accent);
  border-radius:7px; background:var(--accent-soft); padding:13px 18px;
  text-align:center; animation:fade .5s ease both; }
.adventure-banner .adv-head{ font-family:"Inter",sans-serif; text-transform:uppercase;
  letter-spacing:.2em; font-size:10px; font-weight:600; color:var(--accent); }
.adventure-banner .adv-title{ font-family:"Fraunces",serif; font-size:16px;
  color:var(--ink); margin-top:7px; line-height:1.4; }
.adventure-banner .adv-xp{ font-family:"Inter",sans-serif; font-size:10.5px;
  color:var(--muted); letter-spacing:.04em; margin-top:7px; }

/* A capability is a NEW VERB the player earned — louder than a rank tick,
   quieter than a level-up. Built from theme vars so it flips with the theme. */
.capability-banner{ max-width:50ch; margin:30px auto; border:1px solid var(--accent);
  border-left:3px solid var(--accent); border-radius:8px; background:var(--accent-soft);
  padding:16px 20px; animation:fade .5s ease both; }
.capability-banner .cap-head{ font-family:"Inter",sans-serif; text-transform:uppercase;
  letter-spacing:.2em; font-size:11px; font-weight:600; color:var(--accent); }
.capability-banner .cap-body{ font-family:"Fraunces",serif; font-size:17px;
  color:var(--ink); margin-top:7px; line-height:1.45; }

/* Phase 1a — combat-stretch legibility: rounds labeled, your line boxed,
   enemy lines unboxed/muted, misses always shown, peril line closes. */
.combat-ex{ max-width:56ch; margin:34px auto; font-family:"Inter",sans-serif;
  font-size:13px; animation:fade .45s ease both; }
.combat-ex .rline{ text-transform:uppercase; letter-spacing:.16em; font-size:10.5px;
  color:var(--muted); margin:12px 0 6px; text-align:center; }
.combat-ex .pl{ color:var(--ink); background:var(--accent-soft);
  border:1px solid var(--hair); border-radius:6px; padding:4px 10px; margin:4px 0;
  font-variant-numeric:tabular-nums; }
.combat-ex .en{ color:var(--muted); padding:2px 10px; margin:2px 0;
  font-variant-numeric:tabular-nums; }
.combat-ex .peril{ color:var(--accent-glow); border-top:1px dashed var(--accent);
  margin-top:12px; padding-top:9px; text-align:center; font-style:italic; }
.combat-ex .st{ color:var(--muted); text-align:center; margin-top:10px; }
.combat-ex .outcome{ color:var(--accent-glow); text-align:center; margin-top:10px;
  font-style:italic; }
.footer-bar .fxp i{ display:inline-block; height:100%;
  background:var(--accent); border-radius:2px; }
.footer-bar .fxp .fxp-track{ display:inline-block; width:52px; height:4px;
  background:var(--ground); box-shadow:inset 0 0 0 1px var(--hair);
  border-radius:2px; vertical-align:2px; margin-right:6px; overflow:hidden; }

/* action choices */
.actions-list { display: flex; flex-direction: column; gap: 12px; margin: 34px 0 10px; }
.action-btn { background: transparent; border: 1px solid rgba(201, 168, 106, 0.3); color: var(--ink); padding: 16px 24px; font: 400 calc(var(--font-size) - 2px)/1.5 "Newsreader",Georgia,serif; text-align: left; cursor: pointer; border-radius: 6px; transition: all .3s ease; width: 100%; }
.action-btn:hover { border-color: var(--accent); color: var(--accent-glow); background: rgba(201, 168, 106, 0.05); transform: translateY(-1px); }
.action-btn .opt-num { color: var(--accent); font-family: "Fraunces", serif; font-weight: 500; margin-right: 8px; }

/* composer */
.composer{ max-width:var(--meas); margin:46px auto 60px; }
.field{ display:flex; align-items:center; gap:16px; border-bottom:1px solid var(--hair); padding:10px 2px; transition:border-color .25s; }
.field:focus-within{ border-color:var(--accent); }
.field input, .field textarea{ flex:1; border:0; background:transparent; outline:none;
  font:400 calc(var(--font-size) - 1px)/1.5 "Newsreader",Georgia,serif; color:var(--ink); }
.field textarea{ resize:none; overflow-y:auto; min-height:1.5em; max-height:9em;
  padding:0; margin:0; display:block; }
.field input::placeholder, .field textarea::placeholder{ color:var(--muted); font-style:italic; }
.field .send{ background:transparent; border:0; cursor:pointer; color:var(--ink-2);
  font-family:"Inter",sans-serif; text-transform:uppercase; letter-spacing:.18em; font-size:11px; font-weight:600;
  padding:6px 2px; transition:color .2s; }
.field .send:hover{ color:var(--accent); }

/* footer (always-on) */
.footer-bar{ position: sticky; bottom: 0; display:flex; gap:24px; justify-content:center;
  padding:10px; background:var(--ground-2); border-top:1px solid var(--hair); font-family:"Inter",sans-serif;
  font-size:11px; letter-spacing:.08em; color:var(--ink-2); text-transform:uppercase; }
/* On desktop the sidebar already shows HP/AC/XP/silver/conditions, so the
   footer bar is redundant — hide it there. Kept on mobile (≤800px), where the
   sidebar is off-canvas and this is the only always-on stat surface. */
@media (min-width:801px){ #footer-bar{ display:none !important; } }
.footer-bar b{ color:var(--accent-glow); font-family:"Fraunces",serif; font-size:13px; text-transform:none; letter-spacing:0; }

/* journal panel (off-canvas, reuses sidebar mechanics) */
.journal-panel{ position: fixed; top:0; right:-360px; bottom:0; width:340px; background:var(--ground-2);
  border-left:1px solid var(--hair); padding:30px 24px; overflow-y:auto; transition: right .3s ease; z-index: 60; }
.journal-panel.open{ right: 0; }
.journal-header{ display:flex; align-items:center; justify-content:space-between;
  margin-bottom: 20px; }
.journal-heading{ font-family:"Fraunces",serif; font-size:20px; font-weight:500;
  color:var(--accent-glow); }
.journal-close{ background:none; border:none; color:var(--muted); font-size:24px;
  line-height:1; cursor:pointer; padding:0; transition:color .2s; }
.journal-close:hover{ color:var(--ink); }
.journal-panel h3.side-title{ margin-top: 24px; }
.journal-header + h3.side-title{ margin-top: 0; }
.journal-list{ list-style:none; padding:0; margin:0; font-size:15px; color:var(--ink-2); }
.journal-list li{ padding:6px 0; border-bottom:1px dashed var(--hair); }

/* teaser (cliffhanger, on quit) */
.teaser{ max-width:var(--meas); margin:40px auto; text-align:center; padding:24px; font-style:italic;
  color:var(--accent-glow); border-top:1px solid var(--hair); border-bottom:1px solid var(--hair); }

/* 29a-3: merchant note — in-world shop listing or buy confirmation */
.merchant-note{
  max-width:var(--meas); margin:20px 0; padding:16px 20px;
  border-left:2px solid var(--hair); color:var(--ink-2);
  font-family:"Newsreader",Georgia,serif; font-size:.95em; line-height:1.7;
  animation:fade .3s ease;
}
.merchant-note p{ margin:0 0 .5em; }
.merchant-note p:last-child{ margin-bottom:0; }
/* Vg (A6c): the engine's "· " lines render as a price list — name left,
   compact stat muted, silver right — the sidebar inventory idiom. */
.merchant-note ul.stock{ list-style:none; padding:0; margin:.2em 0 .4em; }
.merchant-note ul.stock li{ display:flex; align-items:baseline; gap:14px;
  padding:6px 0; border-bottom:1px dashed var(--hair); }
.merchant-note ul.stock li .n{ flex:1; }
.merchant-note ul.stock li .s{ color:var(--muted); font-family:"Inter",sans-serif;
  font-size:12px; font-variant-numeric:tabular-nums; flex:none; }
.merchant-note ul.stock li .p{ color:var(--ink-2); font-family:"Inter",sans-serif;
  font-size:12.5px; font-variant-numeric:tabular-nums; flex:none;
  min-width:2.2em; text-align:right; }

/* Mobile off-canvas */
.sidebar-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 40; opacity: 0; transition: opacity 0.3s; pointer-events: none; display: none; }

.sidebar-toggle-btn {
  /* z-index below the overlays (chronicle/reference 80, feedback 90) so it
     never floats on top of an open modal and hijacks taps. */
  position: fixed; bottom: 24px; left: 304px; z-index: 60;
  color: var(--muted); cursor: pointer;
  transition: left 0.3s ease, color 0.2s ease;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-toggle-btn:hover { color: var(--accent); }
body.sidebar-closed .sidebar-toggle-btn { left: 24px; }
/* Masthead hamburger — the sidebar opener on mobile (desktop uses the
   floating toggle). Hidden on desktop. */
.mast-sidebar-btn { display: none; background: none; border: 0; color: var(--muted);
  cursor: pointer; padding: 6px; margin: -6px 4px -6px -6px; border-radius: 8px; }
.mast-sidebar-btn:hover { color: var(--accent); }

@media (prefers-reduced-motion:reduce){ *{ animation:none !important; } }
@media (max-width:800px){
  body { flex-direction: row; }
  .sidebar-toggle-btn { left: 24px; width: 44px; height: 44px; }
  body.sidebar-open .sidebar-toggle-btn { left: 304px; }
  .sidebar-overlay { display: block; }
  body.sidebar-open .sidebar-overlay { opacity: 1; pointer-events: auto; }
  .sidebar {
    position: fixed; top: 0; left: -300px; bottom: 0; width: 280px;
    z-index: 50; transition: transform 0.3s ease;
    border-right: 1px solid var(--hair);
    -webkit-overflow-scrolling: touch;
    padding-top: calc(30px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(30px + env(safe-area-inset-bottom, 0px));
  }
  body.sidebar-open .sidebar { transform: translateX(300px); }

  /* masthead keeps its safe-area padding, just tighter side gutters */
  .masthead {
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  .shell { padding: 0 16px; }
  .you { margin: 24px 0 24px 16px; padding: 12px 16px; }
  .action-btn { padding: 14px 16px; font-size: 16px; }
  .journal-panel{ width: 85vw; right: -90vw; }

  /* Masthead reflow: secondary icons collapse behind the "more" button. */
  .act-menu-btn { display: block; }
  .act-icons {
    position: absolute; top: calc(100% + 12px); right: 0; z-index: 30;
    display: none; flex-wrap: wrap; gap: 2px; width: max-content; max-width: 78vw;
    background: var(--ground-2); border: 1px solid var(--hair); border-radius: 12px;
    padding: 6px; box-shadow: 0 12px 34px rgba(0,0,0,.4);
  }
  .actions.menu-open .act-icons { display: flex; }
  .act-icons svg {
    width: 22px; height: 22px; box-sizing: content-box; padding: 11px; border-radius: 8px;
  }
  .act-icons svg:active { background: var(--accent-soft); }

  /* Composer clears the home indicator; 16px input defeats iOS focus-zoom. */
  .composer { margin: 24px auto calc(20px + env(safe-area-inset-bottom, 0px)); }
  .field input, .field textarea { font-size: 16px; }
  .field .send { padding: 10px 6px; }

  /* Bigger tap targets for the tappable prose options. */
  .action-opt { padding: 10px 0; }

  /* Overlays go full-bleed and scroll with momentum. */
  .chronicle-view { padding: 0; }
  .chronicle-shell { border-radius: 0; min-height: 100%; padding: 28px 20px calc(28px + env(safe-area-inset-bottom, 0px)); }
  .chronicle-view, .journal-panel, .creation-log { -webkit-overflow-scrolling: touch; }

  /* Footer bar clears the home indicator. */
  .footer-bar { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }

  /* Sidebar opener moves into the masthead (hamburger); the floating toggle
     is hidden so it can't overlap the composer or an open overlay. */
  .mast-sidebar-btn { display: flex; align-items: center; }
  .sidebar-toggle-btn { display: none; }

}

/* ── Instance picker ────────────────────────────────────────────────── */
#picker-view{ flex:1; display:flex; align-items:center; justify-content:center; overflow-y:auto; }
.picker-shell{ max-width:560px; width:100%; padding:40px 28px; }
.picker-shell h1{ font-family:"Fraunces",serif; font-weight:500; color:var(--accent-glow); font-size:32px; margin:0 0 8px; }
.picker-shell .sub{ color:var(--ink-2); margin-bottom:32px; }
.instance-list{ list-style:none; padding:0; margin:0 0 24px; display:flex; flex-direction:column; gap:12px; }
.instance-card{ display:flex; justify-content:space-between; align-items:center; padding:18px 22px;
  border:1px solid var(--hair); border-radius:8px; cursor:pointer; transition:border-color .2s, background .2s; }
.instance-card:hover{ border-color:var(--accent); background:var(--accent-soft); }
.instance-card .who{ font-family:"Fraunces",serif; font-size:18px; color:var(--ink); }
.instance-card .meta{ color:var(--muted); font-size:13px; margin-top:4px; }
.instance-card .del{ color:var(--muted); background:none; border:0; cursor:pointer; font-size:18px; padding:4px 8px; }
.instance-card .del:hover{ color:#c9524a; }
.new-game-btn{ width:100%; padding:16px; border:1px dashed var(--accent); border-radius:8px; background:transparent;
  color:var(--accent); font:400 16px "Newsreader",Georgia,serif; cursor:pointer; transition:background .2s; }
.new-game-btn:hover{ background:var(--accent-soft); }
.empty-note{ color:var(--muted); font-style:italic; margin-bottom:24px; }

/* ═══ Phase 25: conversational creation view ═══ */
#creation-view{
  width:100%; height:100%; display:flex; align-items:center; justify-content:center;
  padding:24px; box-sizing:border-box;
}
.creation-shell{
  width:100%; max-width:64ch; display:flex; flex-direction:column; gap:18px;
  max-height:100%;
}
.creation-log{
  flex:1; overflow-y:auto; display:flex; flex-direction:column; gap:16px;
  padding:8px 2px; min-height:120px;
}
.creation-log .dm{
  font-family:"Newsreader",Georgia,serif; color:var(--ink); line-height:1.7;
  animation:fade .4s ease;
}
/* The DM's markdown is rendered into real paragraphs (app.js); space them. */
.creation-log .dm p{ margin:0 0 .7em; }
.creation-log .dm p:last-child{ margin-bottom:0; }
.creation-log .dm strong{ color:var(--accent-glow); font-weight:600; }
.creation-log .dm.greet{ color:var(--accent-glow); }
.creation-log .you{
  font-family:"Inter",sans-serif; color:var(--ink-2); font-size:.85em;
  align-self:flex-end; text-align:right; max-width:80%;
}
.creation-log .you::before{
  content:"You"; display:block;
  font-size:10px; letter-spacing:.16em; text-transform:uppercase; color:var(--muted);
}
.creation-chips{ display:flex; flex-wrap:wrap; gap:8px; min-height:0; }
.creation-chips .chip{
  font-family:"Inter",sans-serif; font-size:12px; padding:4px 10px; border-radius:12px;
  background:var(--accent-soft); color:var(--accent-glow); border:1px solid var(--hair);
}
.creation-chips .chip b{ color:var(--muted); font-weight:500; margin-right:4px; text-transform:uppercase; letter-spacing:.08em; font-size:10px; }
/* Composer: the quiet underline field the game view uses — not a boxed form.
   (.field / .send styling is shared; these are creation-only tweaks.) */
.creation-composer{ margin-top:2px; }

/* In-world asides — soft text prompts, not chrome. The creation flow is
   deliberately pure free-text conversation (the DM never reads a menu of
   options), so these whispered prompts are the only affordances the player
   needs beyond simply typing. */
.creation-asides{ display:flex; gap:10px; align-items:center; flex-wrap:wrap;
  font-family:"Newsreader",Georgia,serif; font-style:italic; font-size:14px; }
.creation-asides .aside{ background:none; border:0; padding:0; cursor:pointer;
  font:inherit; color:var(--ink-2); border-bottom:1px dotted var(--hair); transition:color .2s, border-color .2s; }
.creation-asides .aside:hover{ color:var(--accent-glow); border-color:var(--accent); }
.creation-asides .aside.quiet{ color:var(--muted); margin-left:auto; }
.creation-asides .aside-dot{ color:var(--muted); }
.creation-asides .aside:disabled{ opacity:.4; cursor:default; }

/* Mobile creation screen — placed AFTER the base #creation-view rules so it
   wins on source order (equal specificity). Drops the full-height CENTERED
   flex layout: when the shell is taller than the viewport (guaranteed under an
   accessibility Display-Zoom) a centered flex column squeezes/clips its
   children and they visually collide. Plain top-to-bottom document flow that
   scrolls as one page makes overlap structurally impossible. Requires the JS
   to leave #creation-view's inline display unset (CSS owns it). */
@media (max-width:800px){
  #creation-view{
    display:block;
    height:auto;
    min-height:100dvh;
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
    padding:16px;
    padding-top:calc(16px + env(safe-area-inset-top, 0px));
    padding-bottom:calc(16px + env(safe-area-inset-bottom, 0px));
    padding-left:max(16px, env(safe-area-inset-left, 0px));
    padding-right:max(16px, env(safe-area-inset-right, 0px));
  }
  .creation-shell{ max-height:none; height:auto; gap:14px; }
  .creation-log{ flex:0 0 auto; overflow:visible; min-height:0; }
}

/* 29f: typing affordance — quiet in-world cue during a creation API call */
.creation-typing{
  font-family:"Newsreader",Georgia,serif; font-style:italic;
  color:var(--muted); font-size:.9em;
}
@keyframes creation-dots{
  0%,20%  { content:"."; }
  40%     { content:".."; }
  60%,100%{ content:"..."; }
}
.creation-typing-dots::after{
  content:"."; animation:creation-dots 1.2s steps(1,end) infinite;
}

/* Map viewer — a photo-viewer, not a document overlay, so it sits on its own
   near-black ground regardless of theme: the plate is a warm parchment object
   and anything but a dark surround fights it. */
.map-view {
  position: fixed; inset: 0; z-index: 90;
  background: #0b0b0b;
  display: none; flex-direction: column;
  animation: fade .2s ease;
}
.map-view.open { display: flex; }
.map-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 16px calc(12px) 20px;
  border-bottom: 1px solid rgba(255,255,255,.10);
  flex-shrink: 0; background: rgba(0,0,0,.35);
}
.map-title {
  font-family: "Fraunces", serif; font-size: 16px; font-weight: 500;
  color: #e8d099; letter-spacing: .01em; line-height: 1.3;
}
.map-sub { color: #8a8378; font-style: italic; }
.map-tools { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.map-btn-ui {
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.14);
  color: #ddd6c8; width: 38px; height: 38px; border-radius: 4px; padding: 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .18s, border-color .18s, color .18s;
}
.map-btn-ui:hover:not(:disabled) { background: rgba(255,255,255,.12); color: #fff; }
.map-btn-ui:disabled { opacity: .3; cursor: default; }
.map-btn-ui:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#map-close { border-color: rgba(255,255,255,.24); }

.map-stage {
  flex: 1; position: relative; overflow: hidden;
  touch-action: none;              /* we own pinch + pan; stops the page zooming */
  cursor: grab; background: #0b0b0b;
}
.map-stage.grabbing { cursor: grabbing; }
.map-stage img {
  position: absolute; top: 0; left: 0; transform-origin: 0 0;
  max-width: none; display: block;
  user-select: none; -webkit-user-select: none; -webkit-user-drag: none;
  will-change: transform;
}
.map-spinner {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: "Inter", sans-serif; font-size: 13px; letter-spacing: .08em;
  text-transform: uppercase; color: #6f6a60;
}
.map-hint {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  font-family: "Inter", sans-serif; font-size: 11.5px; letter-spacing: .06em;
  color: #b9b1a2; background: rgba(0,0,0,.62); border: 1px solid rgba(255,255,255,.10);
  padding: 7px 14px; border-radius: 999px; pointer-events: none;
  transition: opacity .45s ease; white-space: nowrap; max-width: 92vw;
}
.map-hint.gone { opacity: 0; }

@media (max-width: 640px) {
  .map-bar { padding: 10px 12px 10px 14px; }
  .map-title { font-size: 14px; }
  .map-sub { display: none; }
  .map-btn-ui { width: 40px; height: 40px; }
  .map-hint { font-size: 11px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) {
  .map-view { animation: none; }
  .map-hint { transition: none; }
}

/* Chronicle overlay (Phase 32) */
.chronicle-view {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,0.75); display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 60px 24px 60px;
  animation: fade .25s ease;
}
.chronicle-shell {
  background: var(--ground-2); border: 1px solid var(--hair);
  border-radius: 4px; max-width: 68ch; width: 100%;
  padding: 48px 52px 40px; position: relative;
}
.chronicle-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 24px;
  margin-bottom: 32px;
}
.chronicle-title {
  font-family: "Fraunces", serif; font-size: 1.5em; font-weight: 500;
  color: var(--accent-glow); line-height: 1.25; margin: 0;
}
.chronicle-close {
  background: none; border: none; color: var(--muted); font-size: 24px; line-height: 1;
  cursor: pointer; padding: 0; margin-top: -2px; flex-shrink: 0;
  transition: color 0.2s;
}
.chronicle-close:hover { color: var(--ink); }
.chronicle-body {
  font-family: "Newsreader", Georgia, serif; font-size: 1em; line-height: 1.78;
  color: var(--ink); max-width: 60ch;
}
.chronicle-body p { margin: 0 0 1.4em; }
.chronicle-body p:last-child { margin-bottom: 0; }
.chronicle-body em { font-style: italic; color: var(--ink-2); }
.chronicle-footer { margin-top: 40px; display: flex; justify-content: flex-end; }
.chronicle-download {
  font-family: "Inter", sans-serif; font-size: 13px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .12em;
  padding: 8px 18px; border-radius: 4px;
  border: 1px solid var(--accent); background: var(--accent-soft);
  color: var(--accent-glow); cursor: pointer; transition: background 0.2s;
}
.chronicle-download:hover { background: var(--accent); color: var(--ground); }
.chronicle-download:disabled { opacity: .4; cursor: default; }
.chronicle-spinner {
  font-family: "Newsreader", Georgia, serif; font-style: italic;
  color: var(--muted); font-size: .9em;
}
@media (max-width: 800px) {
  .chronicle-shell { padding: 32px 24px 28px; }
}

/* ═══ Skill reference overlay (Phase 1b) ═══ */
.reference-shell { max-width: 78ch; }
.reference-intro {
  font-family: "Inter", sans-serif; font-size: 14px; line-height: 1.6;
  color: var(--ink-2); max-width: 72ch; margin: -12px 0 28px;
}
.reference-body { display: flex; flex-direction: column; gap: 22px; }
.ref-group { display: flex; flex-direction: column; gap: 10px; }
.ref-ablabel {
  font-family: "Inter", sans-serif; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em; color: var(--accent);
  border-bottom: 1px solid var(--hair); padding-bottom: 5px;
}
.ref-skill { display: flex; flex-direction: column; gap: 2px; }
.ref-skname {
  font-family: "Fraunces", serif; font-size: 16px; color: var(--ink); margin-bottom: 2px;
}
.ref-ska {
  font-family: ui-monospace, Menlo, monospace; font-size: 10px; color: var(--muted);
  border: 1px solid var(--hair); border-radius: 4px; padding: 0 5px;
  margin-left: 6px; vertical-align: 2px;
}
.ref-rung {
  display: grid; grid-template-columns: 54px 148px 1fr; gap: 10px; align-items: baseline;
  padding: 2px 0; font-family: "Inter", sans-serif; font-size: 13px;
}
.ref-rl {
  font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
}
.ref-rn { color: var(--accent-glow); font-weight: 600; }
.ref-rv { color: var(--ink-2); }
@media (max-width: 560px) {
  .ref-rung { grid-template-columns: 46px 1fr; gap: 3px; }
  .ref-rv { grid-column: 1 / -1; padding-left: 46px; }
}

/* The one intentional threshold: begin your tale. This stays a real button. */
#creation-begin{
  align-self:flex-start; margin-top:4px;
  font-family:"Fraunces",serif; font-size:16px; font-weight:500; padding:12px 22px;
  border-radius:8px; border:1px solid var(--accent); background:var(--accent-soft);
  color:var(--accent-glow); cursor:pointer; box-shadow:0 0 16px var(--accent-soft);
  transition:background .2s;
}
#creation-begin:hover{ background:var(--accent); color:var(--ground); }

/* Typewriter word fade-in (Narration Overhaul, 2026-07-13) */
.narr span.twx{ opacity:0; animation:twFadeIn .5s ease-out forwards; }
@keyframes twFadeIn{ from{ opacity:0; } to{ opacity:1; } }

/* Options as text (not buttons) — the player answers in the composer */
.action-opt{ padding:4px 0; color:var(--accent-glow); }
.action-opt .opt-num{ color:var(--muted); margin-right:6px; }

/* World-forging overlay: blurs the stage while the opening generates and
   cycles slow in-character setup messages. */
#worldgen-overlay{
  position:fixed; inset:0; z-index:200;
  display:flex; align-items:center; justify-content:center;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--ground) 62%, transparent);
}
.worldgen-msg{
  font-family:'Fraunces', serif; font-size:22px; font-style:italic;
  color: var(--accent-glow); text-align:center; max-width:520px; padding:0 24px;
  opacity:0; transition: opacity 1.1s ease;
}
.worldgen-msg.show{ opacity:1; }

/* Clickwrap ToS gate: same veil as the world-forging overlay, one notch above
   it so nothing (including a resuming stream) can paint over consent. */
#tos-gate{
  position:fixed; inset:0; z-index:300;
  display:flex; align-items:center; justify-content:center;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--ground) 72%, transparent);
}
.tos-card{
  max-width:440px; margin:0 20px; padding:28px 30px; border-radius:12px;
  border:1px solid var(--accent); background:var(--ground);
  text-align:center;
}
.tos-card h2{
  font-family:'Fraunces', serif; font-size:24px; font-weight:600;
  color:var(--accent-glow); margin:0 0 12px;
}
.tos-card p{
  font-family:'Inter', sans-serif; font-size:14px; line-height:1.55;
  color:var(--ink); margin:0 0 18px;
}
.tos-card a{ color:var(--accent-glow); }
#tos-agree{
  height:38px; padding:0 22px; border-radius:999px; cursor:pointer;
  border:1px solid var(--accent); background:var(--accent-soft);
  color:var(--accent-glow); font-family:'Inter', sans-serif;
  font-size:14px; font-weight:600; transition:background .2s;
}
#tos-agree:hover{ background:var(--accent); }
.tos-err{ color:#c0574f; font-size:13px !important; margin-top:12px !important; }

/* ═══ Beta feedback (pill + sheet + toast) ═══ */
.fb-pill{
  display:inline-flex; align-items:center; gap:6px;
  height:30px; padding:0 12px; border-radius:999px;
  border:1px solid var(--accent); background:var(--accent-soft); color:var(--accent-glow);
  font-family:"Inter",sans-serif; font-size:12px; font-weight:600; cursor:pointer;
  white-space:nowrap; transition:background .2s;
}
.fb-pill:hover{ background:var(--accent); color:var(--ground); }
.fb-pill:hover .fb-beta{ color:var(--ground); }
.fb-dot{ width:6px; height:6px; border-radius:50%; background:var(--accent);
  box-shadow:0 0 6px var(--accent); flex:none; }
.fb-beta{ font-size:9px; text-transform:uppercase; letter-spacing:.12em; color:var(--accent); }
.fb-scrim{
  position:fixed; inset:0; z-index:90; background:rgba(0,0,0,.6);
  display:flex; align-items:flex-end; justify-content:center; animation:fade .2s ease;
}
.fb-sheet{
  width:100%; max-width:520px; background:var(--ground-2);
  border:1px solid var(--hair); border-radius:16px 16px 0 0;
  padding:22px 22px calc(20px + env(safe-area-inset-bottom, 0px));
}
@media (min-width:640px){
  .fb-scrim{ align-items:center; }
  .fb-sheet{ border-radius:14px; }
}
.fb-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:4px; }
.fb-title{ font-family:"Fraunces",serif; font-size:18px; color:var(--accent-glow); }
.fb-close{ background:none; border:0; color:var(--muted); font-size:24px; line-height:1;
  cursor:pointer; padding:0 4px; transition:color .2s; }
.fb-close:hover{ color:var(--ink); }
.fb-note{ font-family:"Inter",sans-serif; font-size:13px; color:var(--muted); margin:0 0 12px; }
.fb-area{
  width:100%; min-height:96px; border:1px solid var(--hair); border-radius:12px;
  background:var(--ground); color:var(--ink);
  font:400 16px/1.55 "Newsreader",Georgia,serif; padding:12px 14px; resize:vertical; outline:none;
}
.fb-area:focus{ border-color:var(--accent); }
.fb-area::placeholder{ color:var(--muted); font-style:italic; }
.fb-ctx{ font-family:"Inter",sans-serif; font-size:11px; color:var(--muted);
  margin:9px 2px 16px; line-height:1.5; }
.fb-send{
  width:100%; padding:13px; border-radius:12px; border:1px solid var(--accent);
  background:var(--accent); color:var(--ground);
  font-family:"Inter",sans-serif; font-size:15px; font-weight:600; cursor:pointer; transition:filter .2s;
}
.fb-send:hover{ filter:brightness(1.08); }
.fb-send:disabled{ opacity:.5; cursor:default; }
.fb-toast{
  position:fixed; left:50%; bottom:calc(28px + env(safe-area-inset-bottom, 0px));
  transform:translateX(-50%); z-index:95;
  background:var(--ground-2); border:1px solid var(--accent); border-radius:999px;
  padding:10px 20px; font-family:"Inter",sans-serif; font-size:13px; color:var(--accent-glow);
  box-shadow:0 8px 28px rgba(0,0,0,.4); animation:fade .2s ease;
}

/* ═══ Auth gate (Clerk sign-in) ═══ */
#auth-view{ flex:1; display:flex; align-items:center; justify-content:center; overflow-y:auto; padding:40px 20px; }
.auth-shell{ max-width:420px; width:100%; display:flex; flex-direction:column; align-items:center; text-align:center; }
.auth-title{ font-family:"Fraunces",serif; font-weight:500; color:var(--accent-glow); font-size:40px; margin:0 0 6px; letter-spacing:.5px; }
.auth-tagline{ font-family:"Newsreader",serif; font-style:italic; color:var(--ink-2); font-size:18px; margin:0 0 14px; }
.auth-beta-badge{ font-family:"Inter",sans-serif; text-transform:uppercase; letter-spacing:.16em; font-size:11px; font-weight:600; color:var(--accent); border:1px solid var(--hair); border-radius:999px; padding:4px 12px; margin-bottom:20px; }
.auth-invite-note{ font-family:"Inter",sans-serif; font-size:13px; color:var(--muted); margin:0 0 28px; max-width:340px; line-height:1.5; }
/* Waitlist escape hatch for anyone who reaches the gate without an invite.
   style.css has no global anchor rule, so without this it renders default
   browser blue on the dark shell. */
.auth-invite-note a{ color:var(--accent); text-decoration:none;
  border-bottom:1px solid var(--accent-soft); transition:color .2s, border-color .2s; }
.auth-invite-note a:hover{ color:var(--accent-glow); border-bottom-color:var(--accent-glow); }
#sign-in{ display:flex; justify-content:center; min-height:40px; }
.auth-footer{ margin-top:28px; color:var(--muted); font-family:"Inter",sans-serif; font-size:12px; line-height:1.6; }
.auth-footer p{ margin:4px 0; }
.auth-footer strong{ color:var(--ink-2); font-weight:600; }
.auth-legal{ margin-top:10px; }
.auth-legal a{ color:var(--muted); text-decoration:none; border-bottom:1px solid var(--hair); }
.auth-legal a:hover{ color:var(--accent); }
.auth-legal span{ margin:0 8px; }

/* Signed-in account control in the picker (Clerk UserButton avatar) */
.picker-account{ display:flex; align-items:center; justify-content:flex-end; gap:10px; margin-bottom:24px; }
.tier-chip{ font-family:"Inter",sans-serif; text-transform:uppercase; letter-spacing:.14em; font-size:10px; font-weight:600; color:var(--muted); border:1px solid var(--hair); border-radius:999px; padding:3px 10px; }
.tier-btn{ font-family:"Inter",sans-serif; font-size:12px; font-weight:600; border-radius:999px; padding:5px 14px; cursor:pointer; border:1px solid var(--hair); background:transparent; color:var(--ink-2); }
.tier-btn:hover{ color:var(--accent); border-color:var(--accent); }
.tier-btn.upgrade{ background:var(--accent); border-color:var(--accent); color:#fff; }
.tier-btn.upgrade:hover{ filter:brightness(1.08); color:#fff; }
/* Subscribe-wall UX (2026-07-23 plan, S4): quiet forewarning chip, ≤5 free
   turns left. Muted — never competes with the prose above it. */
/* Subscribe-wall forewarning flag (revised per mockup review): its own small
   box above the composer, Claude-style, with an inline Upgrade action. */
.free-turns-banner{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  margin:0 0 10px; padding:8px 14px;
  background:var(--ground-2); border:1px solid var(--hair); border-radius:10px;
  font-family:"Inter",sans-serif; font-size:12.5px; color:var(--ink-2);
}
.ft-upgrade{
  flex-shrink:0; height:26px; padding:0 14px; border-radius:999px; cursor:pointer;
  border:1px solid var(--accent); background:var(--accent-soft); color:var(--accent-glow);
  font-family:"Inter",sans-serif; font-size:12px; font-weight:600; transition:background .2s;
}
.ft-upgrade:hover{ background:var(--accent); color:var(--ground); }
.limit-card{ margin:36px auto; max-width:520px; text-align:center; padding:28px 24px; border:1px solid var(--hair); border-radius:14px; background:var(--panel, rgba(0,0,0,0.02)); }
.limit-msg{ font-family:"Fraunces",serif; font-size:20px; color:var(--ink); margin:0 0 8px; }
.limit-sub{ font-family:"Inter",sans-serif; font-size:14px; color:var(--muted); margin:0 0 18px; line-height:1.5; }
.limit-card .tier-btn{ font-size:14px; padding:8px 20px; }

/* Tier picker: the ladder has three purchasable rungs, so the upgrade path is
   a choice, not a yes/no. Same veil as the ToS gate, one notch below it. */
#tier-picker{
  position:fixed; inset:0; z-index:290;
  display:flex; align-items:center; justify-content:center;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--ground) 72%, transparent);
}
.picker-card{
  max-width:420px; margin:0 20px; padding:26px 24px; border-radius:14px;
  border:1px solid var(--accent); background:var(--ground); text-align:center;
  max-height:88dvh; overflow-y:auto;
}
.picker-card .limit-sub{ margin-bottom:20px; }
.picker-tier{
  display:grid; grid-template-columns:1fr auto; gap:2px 12px;
  width:100%; margin:0 0 10px; padding:12px 16px; text-align:left; cursor:pointer;
  border:1px solid var(--hair); border-radius:10px;
  background:transparent; color:var(--ink);
  transition:border-color .18s, background .18s;
}
.picker-tier:hover, .picker-tier:focus-visible{
  border-color:var(--accent); background:color-mix(in srgb, var(--accent) 8%, transparent);
}
.picker-tier.featured{ border-color:color-mix(in srgb, var(--accent) 55%, var(--hair)); }
.pt-name{ font-family:"Fraunces",serif; font-size:17px; }
.pt-price{ font-family:"Inter",sans-serif; font-size:14px; font-weight:600; color:var(--accent); text-align:right; }
.pt-turns{ grid-column:1 / -1; font-family:"Inter",sans-serif; font-size:12px; color:var(--muted); }
.picker-dismiss{ margin-top:4px; }

/* Legal pages: the app body locks scroll (the feed scrolls internally) —
   these long-form documents must scroll as normal pages. */
body.legal-page{ display:block; height:auto; min-height:100dvh;
  overflow:auto; -webkit-overflow-scrolling:touch; }

/* Placeholder legal pages */
.legal-shell{ max-width:640px; margin:0 auto; padding:56px 28px; }
.legal-shell h1{ font-family:"Fraunces",serif; font-weight:500; color:var(--accent-glow); font-size:32px; margin:0 0 20px; }
.legal-shell h2{ font-family:"Inter",sans-serif; text-transform:uppercase; letter-spacing:.14em; font-size:13px; color:var(--muted); margin:28px 0 8px; }
.legal-shell p{ color:var(--ink-2); margin:8px 0; }
.legal-note{ padding:14px 18px; background:var(--accent-soft); border-left:2px solid var(--accent); border-radius:6px; }
.legal-back{ margin-top:32px; }
.legal-back a{ color:var(--accent); text-decoration:none; }

/* A way out, at the TOP. These documents are long, and the only exit used to
   be a link after twenty-three sections -- so anyone who opened the Terms to
   check one clause was stranded. Sticky, because the scroll is the problem. */
.legal-masthead{
  position:sticky; top:0; z-index:10;
  display:flex; align-items:center; justify-content:space-between; gap:20px;
  max-width:640px; margin:0 auto; padding:16px 28px;
  background:color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter:blur(8px);
  border-bottom:1px solid color-mix(in srgb, var(--muted) 22%, transparent);
}
.legal-masthead .wordmark{
  font-family:"Fraunces",serif; font-size:20px; letter-spacing:.01em;
  color:var(--accent-glow); text-decoration:none;
}
.legal-masthead nav{ display:flex; gap:20px; }
.legal-masthead nav a{
  font-family:"Inter",sans-serif; font-size:12px; text-transform:uppercase;
  letter-spacing:.12em; color:var(--muted); text-decoration:none;
}
.legal-masthead nav a:hover,
.legal-masthead .wordmark:hover{ color:var(--accent); }
.legal-masthead nav a[aria-current="page"]{ color:var(--ink-2); }
@media (max-width:520px){
  .legal-masthead{ padding:12px 20px; }
  .legal-masthead nav{ gap:14px; }
  .legal-masthead nav a{ font-size:11px; letter-spacing:.08em; }
}
