/* =========================================================================
   The Second Dawn — a Chronicle of Aetheria
   A medieval manuscript interface: parchment, iron-gall ink, gold leaf.
   ========================================================================= */

/* ---------------------------------------------------------------- tokens */
:root {
  --ink:            #241708;
  --ink-soft:       #4b3620;
  --ink-faint:      #6d543a;
  --parch-hi:       #f2e7cd;
  --parch:          #e9dbba;
  --parch-mid:      #dcc9a2;
  --parch-lo:       #c9b184;
  --leather:        #2a1c11;
  --leather-lo:     #150d07;
  --gold:           #a8802a;
  --gold-bright:    #e6c76d;
  --gold-dim:       #7c5f22;
  --oxblood:        #7d2018;
  --oxblood-bright: #b53a2a;
  --moss:           #3d5338;
  --night:          #120c06;
  --aqua:           #2c6f86;
  --violet:         #5b3a76;

  --rule:           1px solid rgba(90, 65, 35, .35);
  --rule-strong:    1px solid rgba(70, 48, 22, .55);

  --font-display: "Cinzel Decorative", "Cinzel", Georgia, serif;
  --font-head:    "Cinzel", "Trajan Pro", Georgia, serif;
  --font-body:    "EB Garamond", "Iowan Old Style", Georgia, "Times New Roman", serif;

  --shadow-page: 0 1px 0 rgba(255,250,235,.5) inset,
                 0 18px 46px -18px rgba(0,0,0,.75),
                 0 2px 0 rgba(0,0,0,.35);
  --shadow-deep: 0 24px 60px -20px rgba(0,0,0,.85);
  --radius: 3px;

  --stagger: 190ms;
}

/* ----------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

html { background: var(--night); }

body {
  font-family: var(--font-body);
  font-size: 19px;
  line-height: 1.68;
  color: var(--ink);
  background:
    radial-gradient(120% 90% at 50% -10%, #33220f 0%, #1d1209 45%, #0d0805 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: rgba(168,128,42,.35); color: var(--ink); }

button { font: inherit; color: inherit; }
kbd {
  font-family: var(--font-head);
  font-size: .68em;
  border: 1px solid rgba(90,65,35,.5);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: .05em .38em;
  background: rgba(255,250,235,.4);
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; }

/* ------------------------------------------------------------ atmosphere */
.atmosphere { position: fixed; inset: 0; pointer-events: none; z-index: 0; }

.vignette {
  position: absolute; inset: 0;
  background:
    radial-gradient(140% 110% at 50% 40%, transparent 42%, rgba(8,4,1,.55) 82%, rgba(4,2,0,.9) 100%);
}

.candle {
  position: absolute; inset: 0;
  background:
    radial-gradient(48% 34% at 50% 0%, rgba(255,206,120,.20), transparent 68%),
    radial-gradient(30% 22% at 12% 92%, rgba(255,168,70,.09), transparent 70%),
    radial-gradient(26% 20% at 88% 86%, rgba(255,168,70,.07), transparent 70%);
  animation: flicker 7.5s ease-in-out infinite;
}
@keyframes flicker {
  0%,100% { opacity: .92; }
  24%     { opacity: .74; }
  46%     { opacity: 1; }
  61%     { opacity: .8; }
  78%     { opacity: .97; }
}

.grain {
  position: absolute; inset: -50%;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 8s steps(6) infinite;
  mix-blend-mode: overlay;
}
@keyframes grain-shift {
  0%   { transform: translate(0,0); }
  20%  { transform: translate(-3%, 2%); }
  40%  { transform: translate(2%, -3%); }
  60%  { transform: translate(-2%, -2%); }
  80%  { transform: translate(3%, 1%); }
  100% { transform: translate(0,0); }
}

.dust { position: absolute; inset: 0; overflow: hidden; }
.mote {
  position: absolute;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,226,164,.85), rgba(255,210,130,0));
  animation: drift linear infinite;
  opacity: 0;
}
@keyframes drift {
  0%   { transform: translate3d(0, 12vh, 0) scale(.6); opacity: 0; }
  12%  { opacity: .55; }
  88%  { opacity: .3; }
  100% { transform: translate3d(var(--dx, 6vw), -104vh, 0) scale(1.05); opacity: 0; }
}

/* ---------------------------------------------------------------- layout */
.app {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 26px 20px 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* -------------------------------------------------------------- masthead */
.masthead {
  position: relative;
  margin-bottom: 22px;
  color: var(--gold-bright);
  animation: rise-in .7s cubic-bezier(.2,.7,.3,1) both;
}
.masthead[hidden] { display: none; }

.masthead-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border: 1px solid rgba(190,152,70,.32);
  border-top-color: rgba(230,199,109,.5);
  border-bottom-color: rgba(120,88,30,.5);
  background:
    linear-gradient(180deg, rgba(58,38,18,.72), rgba(28,18,9,.85)),
    radial-gradient(120% 200% at 50% 0%, rgba(255,206,120,.09), transparent 60%);
  box-shadow: 0 10px 30px -18px #000, inset 0 1px 0 rgba(255,225,160,.12);
  border-radius: var(--radius);
  backdrop-filter: blur(2px);
}

.crest { color: var(--gold-bright); opacity: .9; flex: none; filter: drop-shadow(0 0 8px rgba(230,199,109,.3)); }
.masthead-text { flex: 1 1 auto; min-width: 0; }

.wordmark {
  font-family: var(--font-display);
  font-size: clamp(19px, 3.4vw, 30px);
  letter-spacing: .035em;
  line-height: 1.1;
  background: linear-gradient(180deg, #fdf1cd 0%, var(--gold-bright) 45%, #9d7722 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 1px 0 rgba(0,0,0,.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.subtitle {
  margin: 3px 0 0;
  font-family: var(--font-head);
  font-size: 10.5px;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: rgba(230,199,109,.62);
}

.masthead-actions { display: flex; gap: 8px; flex: none; }

.ghost-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px;
  font-family: var(--font-head);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(240,222,176,.82);
  background: linear-gradient(180deg, rgba(120,90,40,.22), rgba(60,42,18,.3));
  border: 1px solid rgba(190,152,70,.3);
  border-radius: 2px;
  cursor: pointer;
  transition: .18s ease;
}
.ghost-btn:hover, .ghost-btn:focus-visible {
  color: #ffeec2;
  border-color: rgba(230,199,109,.72);
  background: linear-gradient(180deg, rgba(168,128,42,.34), rgba(80,56,22,.4));
  box-shadow: 0 0 0 1px rgba(230,199,109,.12), 0 6px 18px -10px rgba(230,199,109,.5);
  outline: none;
}
.ghost-btn:active { transform: translateY(1px); }

.chapter-rule {
  display: flex; align-items: center; gap: 12px;
  margin: 12px 2px 0;
  font-family: var(--font-head);
  font-size: 10.5px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: rgba(230,199,109,.55);
}
.chapter-rule::before, .chapter-rule::after {
  content: ""; height: 1px; flex: 1;
  background: linear-gradient(90deg, transparent, rgba(190,152,70,.45), transparent);
}

/* ----------------------------------------------------------------- stage */
.stage { flex: 1 1 auto; }

/* ------------------------------------------------------------ the page -- */
.page {
  position: relative;
  background:
    radial-gradient(120% 80% at 18% 4%, rgba(255,252,240,.75), transparent 55%),
    radial-gradient(90% 70% at 92% 96%, rgba(150,116,64,.22), transparent 60%),
    linear-gradient(168deg, var(--parch-hi) 0%, var(--parch) 38%, var(--parch-mid) 78%, var(--parch-lo) 100%);
  border-radius: var(--radius);
  box-shadow: var(--shadow-page);
  padding: clamp(22px, 4.2vw, 52px) clamp(20px, 4.6vw, 60px);
  overflow: hidden;
  animation: page-in .55s cubic-bezier(.22,.72,.28,1) both;
}
.page::before {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.62' numOctaves='5' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23p)' opacity='0.4'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}
.page::after {
  content: "";
  position: absolute; inset: 11px;
  pointer-events: none;
  border: 1px solid rgba(120,88,40,.28);
  box-shadow: inset 0 0 0 3px rgba(255,250,232,.35), inset 0 0 0 4px rgba(120,88,40,.16);
  border-radius: 2px;
}
.page > * { position: relative; z-index: 1; }

@keyframes page-in {
  from { opacity: 0; transform: translateY(14px) scale(.994); }
  to   { opacity: 1; transform: none; }
}
@keyframes rise-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}

/* corner flourishes */
.fleuron {
  position: absolute;
  width: 54px; height: 54px;
  color: rgba(126,92,40,.5);
  pointer-events: none;
  z-index: 2;
}
.fleuron.tl { top: 6px; left: 6px; }
.fleuron.tr { top: 6px; right: 6px; transform: scaleX(-1); }
.fleuron.bl { bottom: 6px; left: 6px; transform: scaleY(-1); }
.fleuron.br { bottom: 6px; right: 6px; transform: scale(-1,-1); }

/* ------------------------------------------------------- scene: runes ---- */
.scene-head { text-align: center; margin-bottom: 26px; }

.scene-location {
  font-family: var(--font-head);
  font-size: clamp(17px, 2.6vw, 23px);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #43301a;
  text-shadow: 0 1px 0 rgba(255,252,240,.7);
}
.scene-time {
  margin-top: 6px;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 15px;
  color: var(--ink-faint);
  letter-spacing: .02em;
}

.ornament {
  display: block;
  width: min(340px, 78%);
  height: 18px;
  margin: 14px auto 0;
  color: rgba(126,92,40,.6);
}

/* ------------------------------------------------------ narrative blocks */
.prose { max-width: 68ch; margin: 0 auto; }

.block {
  margin: 0 0 1.05em;
  opacity: 0;
  transform: translateY(7px);
  animation: block-in .5s cubic-bezier(.2,.75,.3,1) forwards;
  animation-delay: var(--d, 0ms);
}
.block.shown { opacity: 1; transform: none; }
@keyframes block-in { to { opacity: 1; transform: none; } }

.block.narration {
  color: #2f2010;
  text-align: justify;
  hyphens: auto;
}
.block.narration.drop::first-letter {
  font-family: var(--font-display);
  float: left;
  font-size: 3.5em;
  line-height: .82;
  padding: .06em .12em 0 0;
  margin: .04em .1em 0 0;
  color: var(--oxblood);
  text-shadow: 1px 1px 0 rgba(255,250,235,.65), 2px 3px 6px rgba(60,30,10,.22);
}

.block.speech {
  margin-left: 0;
  padding-left: 16px;
  border-left: 2px solid rgba(126,92,40,.4);
  color: #33220f;
}
.block.speech .speaker {
  display: block;
  font-family: var(--font-head);
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--oxblood);
  margin-bottom: 2px;
}
.block.speech .speech-text { font-style: italic; }

.block.thought {
  color: #4a3520;
  font-style: italic;
  padding: 10px 16px;
  background: linear-gradient(90deg, rgba(126,92,40,.09), transparent 70%);
  border-left: 2px dotted rgba(126,92,40,.5);
}

.block.verse {
  text-align: center;
  font-style: italic;
  color: #5a4327;
  white-space: pre-line;
  margin: 1.5em auto;
  font-size: .97em;
  letter-spacing: .015em;
}
.block.verse::before, .block.verse::after {
  content: "❧";
  display: block;
  color: rgba(126,92,40,.45);
  font-style: normal;
  font-size: 13px;
  line-height: 2.4;
}

.block.letter {
  font-family: var(--font-body);
  font-style: italic;
  color: #3a2814;
  margin: 1.4em 0;
  padding: 16px 20px;
  background: rgba(255,250,232,.5);
  border: 1px solid rgba(126,92,40,.3);
  border-radius: 2px;
  box-shadow: inset 0 0 22px rgba(150,116,64,.14), 0 2px 10px -6px rgba(0,0,0,.4);
  white-space: pre-line;
}

.block.system {
  font-family: var(--font-head);
  font-size: 12.5px;
  letter-spacing: .13em;
  text-transform: uppercase;
  text-align: center;
  color: #6c4a1d;
  margin: 1.5em auto;
}
.block.system::before, .block.system::after { content: "—"; color: rgba(126,92,40,.4); margin: 0 .6em; }

/* --------------------------------------------------------------- choices */
.choices { max-width: 68ch; margin: 30px auto 4px; display: grid; gap: 11px; }

.choice {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  padding: 15px 52px 15px 22px;
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.5;
  color: #33220f;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(255,251,238,.62), rgba(226,209,172,.42));
  border: 1px solid rgba(112,80,34,.4);
  border-radius: 2px;
  box-shadow: 0 2px 0 rgba(255,252,240,.5) inset, 0 6px 16px -12px rgba(40,24,8,.9);
  transition: transform .16s cubic-bezier(.2,.8,.3,1), box-shadow .16s, border-color .16s, background .16s;
  animation: block-in .45s cubic-bezier(.2,.75,.3,1) forwards;
  animation-delay: var(--d, 0ms);
  opacity: 0;
  transform: translateY(7px);
}
.choice:hover, .choice:focus-visible {
  outline: none;
  transform: translateY(-2px);
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(255,253,244,.85), rgba(235,220,182,.6));
  box-shadow: 0 3px 0 rgba(255,255,245,.6) inset, 0 12px 26px -14px rgba(120,88,30,.85);
}
.choice::after {
  content: "❯";
  position: absolute;
  right: 20px; top: 50%;
  transform: translateY(-50%) translateX(-4px);
  color: var(--gold);
  opacity: 0;
  transition: .18s ease;
  font-size: 15px;
}
.choice:hover::after, .choice:focus-visible::after { opacity: 1; transform: translateY(-50%); }

.choice .hint {
  display: block;
  margin-top: 5px;
  font-size: 14px;
  font-style: italic;
  color: var(--ink-faint);
}
.choice .key {
  position: absolute;
  left: 7px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-head);
  font-size: 10px;
  color: rgba(126,92,40,.55);
}
.choice[data-tone="bold"] { border-left: 3px solid rgba(125,32,24,.55); }
.choice[data-tone="wise"] { border-left: 3px solid rgba(44,111,134,.5); }
.choice[data-tone="grim"] { border-left: 3px solid rgba(70,70,70,.5); }

.continue {
  max-width: 68ch;
  margin: 28px auto 0;
  text-align: center;
}
.continue-btn {
  font-family: var(--font-head);
  font-size: 13px;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: #5a3f18;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px 18px;
  border-bottom: 1px solid rgba(126,92,40,.45);
  transition: .18s ease;
}
.continue-btn:hover, .continue-btn:focus-visible {
  color: var(--oxblood);
  border-bottom-color: var(--oxblood);
  outline: none;
}
.continue-btn::after { content: " ❧"; color: rgba(126,92,40,.6); }
.pulse { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .6; } 50% { opacity: 1; } }

/* ---------------------------------------------------------- effect notes */
.effects {
  max-width: 68ch;
  margin: 0 auto 22px;
  display: grid;
  gap: 6px;
}
.effect-note {
  font-family: var(--font-head);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #6b4a1c;
  padding: 8px 14px;
  border: 1px solid rgba(126,92,40,.3);
  border-left: 3px solid var(--gold);
  background: linear-gradient(90deg, rgba(230,199,109,.22), rgba(255,250,232,.3));
  border-radius: 2px;
  animation: block-in .4s both;
  animation-delay: var(--d, 0ms);
}

/* ------------------------------------------------------------ stat bars - */
.meter {
  position: relative;
  height: 11px;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(60,40,18,.28), rgba(60,40,18,.15));
  box-shadow: inset 0 1px 2px rgba(30,18,6,.5), 0 1px 0 rgba(255,250,232,.4);
  overflow: hidden;
  border: 1px solid rgba(100,72,30,.35);
}
.meter > i {
  display: block; height: 100%;
  border-radius: 5px;
  transition: width .45s cubic-bezier(.3,.8,.3,1);
  background: linear-gradient(180deg, #d0604a, var(--oxblood) 60%, #571410);
  box-shadow: inset 0 1px 0 rgba(255,220,190,.35);
}
.meter.hp > i { background: linear-gradient(180deg, #d0604a, var(--oxblood) 60%, #571410); }
.meter.mp > i { background: linear-gradient(180deg, #6db6cf, var(--aqua) 60%, #16414f); }
.meter.xp > i { background: linear-gradient(180deg, var(--gold-bright), var(--gold) 60%, #6d4f16); }
.meter.thin { height: 8px; }

/* --------------------------------------------------------------- sheet --- */
.sheet-block { margin-bottom: 26px; }
.sheet-title {
  font-family: var(--font-head);
  font-size: 12px;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: #47301a;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 10px;
}
.sheet-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(126,92,40,.4), transparent); }

.hero-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.hero-name { font-family: var(--font-display); font-size: 26px; color: #35240f; letter-spacing: .01em; }
.hero-level { font-family: var(--font-head); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: #7a5a22; }
.hero-origin { font-style: italic; color: var(--ink-faint); font-size: 15px; margin-bottom: 16px; }

.pools { display: grid; gap: 10px; margin-bottom: 6px; }
.pool-row { display: grid; grid-template-columns: 46px 1fr 84px; align-items: center; gap: 10px; }
.pool-label { font-family: var(--font-head); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: #57391a; }
.pool-value { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; color: #4a3520; }

.attr-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.attr {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px;
  border: 1px solid rgba(126,92,40,.28);
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(255,250,235,.5), rgba(226,209,172,.3));
}
.attr-name { font-family: var(--font-head); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #57391a; }
.attr-val { font-variant-numeric: tabular-nums; font-weight: 600; color: #2f2010; }
.attr .plus {
  width: 22px; height: 22px; flex: none;
  border: 1px solid rgba(126,92,40,.45); border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-bright), var(--gold));
  color: #2b1c08; font-size: 15px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 2px 6px -3px rgba(0,0,0,.7);
}
.attr .plus:hover { filter: brightness(1.12); }

.points-banner {
  margin-bottom: 14px; padding: 10px 14px;
  font-family: var(--font-head); font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: #3d2a0d;
  border: 1px solid var(--gold); border-left-width: 4px;
  background: linear-gradient(90deg, rgba(230,199,109,.4), rgba(255,250,232,.4));
  border-radius: 2px;
}

.item-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(126,92,40,.24);
  border-radius: 2px;
  background: rgba(255,250,235,.36);
  margin-bottom: 7px;
}
.item-row .icon { width: 26px; height: 26px; color: var(--gold-dim); flex: none; }
.item-row .item-name { flex: 1; }
.item-row .item-name b { display: block; font-weight: 600; color: #2f2010; }
.item-row .item-name small { display: block; font-size: 13.5px; color: var(--ink-faint); font-style: italic; }
.item-row .count { font-variant-numeric: tabular-nums; color: #6b4a1c; font-family: var(--font-head); font-size: 12px; }
.use-btn {
  font-family: var(--font-head); font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  padding: 6px 10px; border: 1px solid rgba(126,92,40,.45); border-radius: 2px;
  background: rgba(255,250,235,.5); cursor: pointer; transition: .15s;
}
.use-btn:hover { background: var(--gold-bright); border-color: var(--gold); }

.skill-chip {
  display: inline-flex; align-items: baseline; gap: 7px;
  padding: 5px 11px; margin: 0 5px 6px 0;
  font-size: 14.5px;
  border: 1px solid rgba(126,92,40,.3);
  border-radius: 14px;
  background: rgba(255,250,235,.4);
}
.skill-chip.unknown { opacity: .42; font-style: italic; }
.skill-chip .el { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); font-family: var(--font-head); }
.el-fire { color: #9c3512; } .el-water { color: #22607a; } .el-earth { color: #6b5424; }
.el-wind { color: #3f6b56; } .el-light { color: #9a8220; } .el-shadow { color: #4b3570; } .el-steel { color: #5a5a5c; }

/* -------------------------------------------------------------- drawers -- */
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(430px, 92vw);
  z-index: 40;
  padding: 26px 24px 60px;
  overflow-y: auto;
  background:
    radial-gradient(120% 60% at 80% 0%, rgba(255,250,235,.7), transparent 60%),
    linear-gradient(160deg, var(--parch-hi), var(--parch-mid) 70%, var(--parch-lo));
  box-shadow: -30px 0 70px -30px rgba(0,0,0,.9), inset 1px 0 0 rgba(255,250,232,.5);
  animation: drawer-in .34s cubic-bezier(.2,.8,.25,1) both;
}
.drawer[hidden] { display: none; }
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }

.drawer-close {
  position: absolute; top: 12px; right: 14px;
  width: 32px; height: 32px;
  border: 1px solid rgba(126,92,40,.35); border-radius: 50%;
  background: rgba(255,250,235,.5); cursor: pointer;
  color: #4a3520; font-size: 13px;
}
.drawer-close:hover { background: var(--oxblood); color: #f7ecd2; border-color: var(--oxblood); }

.scrim {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(8,4,1,.62);
  backdrop-filter: blur(2px);
  animation: fade .25s both;
}
.scrim[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------------------------------------- overlay --- */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  padding: 24px;
  overflow-y: auto;
  background: radial-gradient(90% 70% at 50% 40%, rgba(20,12,5,.82), rgba(4,2,0,.95));
  animation: fade .3s both;
}
.overlay[hidden] { display: none; }

.card {
  position: relative;
  width: min(680px, 100%);
  padding: clamp(26px, 4vw, 46px);
  background:
    radial-gradient(100% 60% at 30% 4%, rgba(255,252,240,.7), transparent 60%),
    linear-gradient(165deg, var(--parch-hi), var(--parch-mid) 72%, var(--parch-lo));
  border-radius: var(--radius);
  box-shadow: var(--shadow-deep), inset 0 0 0 1px rgba(255,250,232,.5);
  animation: card-in .45s cubic-bezier(.2,.8,.25,1) both;
  color: var(--ink);
}
.card::after {
  content: ""; position: absolute; inset: 9px; pointer-events: none;
  border: 1px solid rgba(120,88,40,.3);
  box-shadow: inset 0 0 0 3px rgba(255,250,232,.4), inset 0 0 0 4px rgba(120,88,40,.14);
  border-radius: 2px;
}
.card > * { position: relative; z-index: 1; }
.card.dark {
  background: linear-gradient(165deg, #2c1e11, #180f07 70%, #0d0805);
  color: var(--parch);
}
.card.dark::after { border-color: rgba(190,152,70,.3); }

@keyframes card-in { from { opacity: 0; transform: translateY(20px) scale(.97); } to { opacity: 1; transform: none; } }

.card h2 {
  font-family: var(--font-display);
  font-size: clamp(22px, 3.6vw, 32px);
  color: #33220f;
  text-align: center;
  margin-bottom: 6px;
}
.card.dark h2 { color: var(--gold-bright); }
.card .lede { text-align: center; font-style: italic; color: var(--ink-faint); margin: 0 0 22px; }
.card.dark .lede { color: rgba(233,219,186,.7); }

/* title screen */
.title-screen { text-align: center; }
.title-screen .big {
  font-family: var(--font-display);
  font-size: clamp(34px, 8vw, 66px);
  line-height: 1;
  letter-spacing: .02em;
  background: linear-gradient(180deg, #fff4d2, var(--gold-bright) 42%, #8f6c1d 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 2px 12px rgba(230,199,109,.25);
  margin-bottom: 14px;
}
.title-screen .kicker {
  font-family: var(--font-head); font-size: 11px; letter-spacing: .42em; text-transform: uppercase;
  color: rgba(230,199,109,.6); margin-bottom: 18px;
}
.title-screen .blurb {
  max-width: 44ch; margin: 0 auto 30px;
  font-size: 18.5px; font-style: italic; color: rgba(240,226,192,.82); line-height: 1.65;
}

.field { margin-bottom: 18px; text-align: left; }
.field > label {
  display: block; margin-bottom: 7px;
  font-family: var(--font-head); font-size: 11px; letter-spacing: .2em; text-transform: uppercase;
  color: rgba(230,199,109,.72);
}
.field input[type=text] {
  width: 100%;
  padding: 13px 16px;
  font-family: var(--font-body); font-size: 20px;
  color: #f3e6c8;
  background: rgba(0,0,0,.34);
  border: 1px solid rgba(190,152,70,.4);
  border-radius: 2px;
  outline: none;
  transition: .18s;
}
.field input[type=text]:focus { border-color: var(--gold-bright); box-shadow: 0 0 0 3px rgba(230,199,109,.14); }

.origin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.origin {
  text-align: left; cursor: pointer;
  padding: 14px 15px;
  border: 1px solid rgba(190,152,70,.3);
  border-radius: 2px;
  background: rgba(0,0,0,.24);
  color: #eddfbe;
  transition: .18s ease;
}
.origin:hover { border-color: rgba(230,199,109,.7); background: rgba(168,128,42,.16); transform: translateY(-2px); }
.origin.selected {
  border-color: var(--gold-bright);
  background: linear-gradient(180deg, rgba(230,199,109,.24), rgba(168,128,42,.1));
  box-shadow: 0 0 0 1px rgba(230,199,109,.35), 0 12px 26px -16px rgba(230,199,109,.6);
}
.origin .o-name { font-family: var(--font-head); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-bright); }
.origin .o-blurb { display: block; margin-top: 5px; font-style: italic; font-size: 15px; color: rgba(233,219,186,.75); }
.origin .o-bonus { display: block; margin-top: 9px; font-family: var(--font-head); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: rgba(140,214,180,.85); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 26px;
  font-family: var(--font-head);
  font-size: 12.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: #241708;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold) 60%, #8a671d);
  border: 1px solid #6b4f16;
  border-radius: 2px;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(255,246,214,.6) inset, 0 10px 22px -14px rgba(0,0,0,.9);
  transition: .16s ease;
}
.btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.ghost {
  background: transparent; color: var(--gold-bright);
  border-color: rgba(190,152,70,.5);
  box-shadow: none;
}
.btn.ghost:hover { background: rgba(168,128,42,.18); }
.btn.oxblood { background: linear-gradient(180deg, #b8462f, var(--oxblood) 60%, #55130e); color: #ffe9d2; border-color: #4a100c; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 24px; }

/* chapter card */
.chapter-card { text-align: center; }
.chapter-card .numeral {
  font-family: var(--font-display);
  font-size: clamp(52px, 13vw, 96px);
  line-height: .9;
  color: transparent;
  background: linear-gradient(180deg, #fff6da, var(--gold-bright) 45%, #8a671d);
  -webkit-background-clip: text; background-clip: text;
  margin-bottom: 4px;
}
.chapter-card .roman { font-family: var(--font-head); letter-spacing: .5em; font-size: 12px; color: rgba(230,199,109,.7); text-transform: uppercase; margin-bottom: 12px; }
.chapter-card h2 { color: var(--gold-bright); font-size: clamp(26px, 5vw, 42px); letter-spacing: .04em; }
.chapter-card .ornament { color: rgba(230,199,109,.5); }

/* death */
.death-card { text-align: center; }
.death-card .skull { color: rgba(200,180,140,.5); margin-bottom: 14px; }
.death-card h2 { color: #e3c368; }
.death-card .death-text { font-style: italic; color: rgba(233,219,186,.8); max-width: 42ch; margin: 0 auto 22px; }
.receipt {
  margin-top: 18px; padding: 13px 16px;
  font-family: var(--font-head); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(233,219,186,.72);
  border: 1px dashed rgba(190,152,70,.42);
  border-radius: 2px;
  background: rgba(0,0,0,.26);
}
.price-tag {
  display: inline-flex; align-items: baseline; gap: 8px;
  margin: 4px 0 20px; padding: 8px 18px;
  border: 1px solid rgba(190,152,70,.45); border-radius: 999px;
  font-family: var(--font-head); font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold-bright); background: rgba(0,0,0,.3);
}
.price-tag .strike { text-decoration: line-through; opacity: .5; }
.price-tag .free { color: #8ddcb0; }

/* shop */
.shop-grid { display: grid; gap: 9px; margin: 20px 0 8px; max-height: 52vh; overflow-y: auto; padding-right: 4px; }
.shop-row {
  display: grid; grid-template-columns: 30px 1fr auto auto; align-items: center; gap: 12px;
  padding: 11px 14px;
  border: 1px solid rgba(126,92,40,.28); border-radius: 2px;
  background: rgba(255,250,235,.42);
}
.shop-row .icon { color: var(--gold-dim); }
.shop-row .s-name { font-weight: 600; }
.shop-row .s-desc { display: block; font-size: 13.5px; font-style: italic; color: var(--ink-faint); }
.shop-row .s-price { font-family: var(--font-head); font-size: 12px; letter-spacing: .1em; color: #6b4a1c; white-space: nowrap; }
.shop-row .use-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ending */
.ending-card { text-align: center; }
.ending-card h2 { color: #4a2a12; }
.ending-card blockquote {
  margin: 22px auto; max-width: 48ch;
  font-style: italic; font-size: 19px; color: #4a3520;
  padding: 16px 20px;
  border-top: 1px solid rgba(126,92,40,.35);
  border-bottom: 1px solid rgba(126,92,40,.35);
}

/* -------------------------------------------------------------- combat --- */
.battle { animation: page-in .5s both; }
.battle-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.battle-title { font-family: var(--font-head); font-size: 13px; letter-spacing: .3em; text-transform: uppercase; color: #6b4a1c; }
.round-pip { font-family: var(--font-head); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-faint); }

.foes { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 22px; }
.foe {
  position: relative;
  text-align: center;
  padding: 16px 14px 14px;
  border: 1px solid rgba(126,92,40,.32);
  border-radius: 2px;
  background:
    radial-gradient(80% 60% at 50% 0%, rgba(255,250,235,.6), transparent 70%),
    linear-gradient(180deg, rgba(226,209,172,.5), rgba(201,177,132,.42));
  box-shadow: 0 6px 20px -16px rgba(0,0,0,.9);
  transition: .2s;
}
.foe.boss { border-color: rgba(125,32,24,.55); box-shadow: 0 0 0 1px rgba(125,32,24,.2), 0 8px 26px -18px rgba(125,32,24,.9); }
.foe.dead { opacity: .34; filter: grayscale(.85); }
.foe.hit { animation: shake .34s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}
.foe .sigil { color: #5c3f18; height: 62px; display: grid; place-items: center; margin-bottom: 8px; }
.foe.boss .sigil { color: var(--oxblood); filter: drop-shadow(0 0 12px rgba(125,32,24,.35)); }
.foe.dead .sigil { color: #5a5a5a; }
.foe .f-name { font-family: var(--font-head); font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; color: #3d2a12; }
.foe .f-title { font-size: 13.5px; font-style: italic; color: var(--ink-faint); margin: 2px 0 9px; min-height: 2.4em; }
.foe .f-hp { margin-top: 7px; }
.foe .f-hp-num { font-variant-numeric: tabular-nums; font-size: 12.5px; color: #5a3f18; margin-top: 4px; }
.status-row { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: 8px; min-height: 20px; }
.status {
  font-family: var(--font-head); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 10px;
  border: 1px solid rgba(126,92,40,.4);
  background: rgba(255,250,235,.5);
  color: #6b4a1c;
}
.status.bad { border-color: rgba(125,32,24,.45); background: rgba(125,32,24,.12); color: var(--oxblood); }
.status.good { border-color: rgba(60,110,80,.5); background: rgba(80,150,110,.14); color: #2f5c42; }

.damage-float {
  position: absolute; left: 50%; top: 34%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--oxblood);
  text-shadow: 0 2px 0 rgba(255,250,232,.8), 0 8px 18px rgba(0,0,0,.35);
  pointer-events: none;
  animation: float-up 1.1s cubic-bezier(.2,.7,.3,1) forwards;
  z-index: 5;
}
.damage-float.heal { color: #2f7a4d; }
.damage-float.crit { font-size: 42px; color: #8a1c10; }
.damage-float.miss { font-size: 18px; font-family: var(--font-head); letter-spacing: .2em; text-transform: uppercase; color: #5a5a5a; }
@keyframes float-up {
  0%   { opacity: 0; transform: translate(-50%, 12px) scale(.7); }
  22%  { opacity: 1; transform: translate(-50%, -4px) scale(1.12); }
  100% { opacity: 0; transform: translate(-50%, -58px) scale(1); }
}

.player-strip {
  display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center;
  padding: 14px 18px; margin-bottom: 18px;
  border: 1px solid rgba(126,92,40,.34); border-radius: 2px;
  background: linear-gradient(180deg, rgba(255,252,240,.55), rgba(226,209,172,.4));
}
.player-pools { display: grid; gap: 7px; }
.player-pools .pool-row { grid-template-columns: 40px 1fr 78px; }
.player-sigil { color: #5c3f18; opacity: .8; }

.battle-log {
  max-height: 240px; overflow-y: auto;
  padding: 14px 16px;
  margin-bottom: 18px;
  border: 1px solid rgba(126,92,40,.28); border-radius: 2px;
  background: rgba(255,250,235,.32);
  font-size: 16.5px;
}
.battle-log p { margin: 0 0 .55em; animation: block-in .3s both; }
.battle-log p:last-child { margin-bottom: 0; }
.log-system { color: #6d543a; font-style: italic; }
.log-player { color: #2f4c33; }
.log-player::before { content: "❯ "; color: rgba(60,110,80,.7); }
.log-enemy { color: #7d2018; }
.log-enemy::before { content: "✦ "; color: rgba(125,32,24,.6); }
.log-crit { color: #8a1c10; font-weight: 600; }
.log-heal { color: #2f7a4d; }
.log-status { color: #6b4a1c; font-style: italic; }
.log-loot { color: #7a5a22; font-family: var(--font-head); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }

.actions { display: grid; gap: 12px; }
.action-group-title {
  font-family: var(--font-head); font-size: 10.5px; letter-spacing: .24em; text-transform: uppercase;
  color: #6d543a; margin-bottom: 7px; display: flex; align-items: center; gap: 9px;
}
.action-group-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(126,92,40,.35), transparent); }

.action-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.action {
  position: relative;
  padding: 11px 16px;
  font-family: var(--font-head); font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase;
  color: #33220f;
  border: 1px solid rgba(112,80,34,.45); border-radius: 2px;
  background: linear-gradient(180deg, rgba(255,251,238,.7), rgba(226,209,172,.5));
  cursor: pointer;
  transition: .15s ease;
}
.action:hover:not(:disabled), .action:focus-visible:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 8px 18px -12px rgba(120,88,30,.9);
  outline: none;
}
.action:disabled { opacity: .38; cursor: not-allowed; }
.action small { display: block; font-family: var(--font-body); font-size: 12.5px; letter-spacing: 0; text-transform: none; color: var(--ink-faint); margin-top: 3px; }
.action .cost { color: var(--aqua); font-weight: 600; }
.action.spell { border-left: 3px solid var(--aqua); }
.action.art { border-left: 3px solid var(--oxblood); }
.action.guard { border-left: 3px solid #6b6b6b; }
.action.flee { border-left: 3px solid var(--gold-dim); }
.action.skill { border-left: 3px solid var(--aqua); }

/* ------------------------------------------------------------- journal --- */
.journal-entry {
  padding: 9px 0;
  border-bottom: 1px dotted rgba(126,92,40,.3);
  font-size: 16px;
  color: #3a2814;
}
.journal-entry .when { font-family: var(--font-head); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); display: block; }
.journal-entry.kind-death { color: var(--oxblood); }
.journal-entry.kind-revive { color: #2f7a4d; }
.journal-entry.kind-victory { color: #2f4c33; }

/* -------------------------------------------------------------- toasts --- */
.toasts {
  position: fixed; z-index: 80;
  bottom: 22px; left: 50%; transform: translateX(-50%);
  display: grid; gap: 8px; justify-items: center;
  pointer-events: none;
  width: min(560px, 92vw);
}
.toast {
  padding: 11px 20px;
  font-family: var(--font-head); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--parch-hi);
  background: linear-gradient(180deg, rgba(58,38,18,.96), rgba(24,15,7,.98));
  border: 1px solid rgba(190,152,70,.45);
  border-radius: 2px;
  box-shadow: 0 14px 34px -18px #000;
  animation: toast-in .35s cubic-bezier(.2,.8,.25,1) both;
  text-align: center;
}
.toast.bad { border-color: rgba(181,58,42,.7); color: #ffd9cd; }
.toast.good { border-color: rgba(110,200,150,.55); color: #d6ffe8; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------ colophon --- */
.colophon {
  margin-top: 26px;
  text-align: center;
  font-family: var(--font-head);
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(230,199,109,.4);
  display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap;
}
.colophon .sep { opacity: .5; }
.colophon kbd { color: rgba(230,199,109,.7); border-color: rgba(190,152,70,.35); background: rgba(0,0,0,.25); }

/* ------------------------------------------------------------- loading --- */
.loading { display: grid; place-items: center; min-height: 46vh; color: rgba(230,199,109,.75); text-align: center; }
.loading .spinner {
  width: 42px; height: 42px; margin-bottom: 18px;
  border: 2px solid rgba(190,152,70,.25);
  border-top-color: var(--gold-bright);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* =========================================================================
   The Last Wick — mechanical surfaces
   Ember is one pool. Stance is one dial. The Dim is one clock. Everything
   below exists so a player can read all three at a glance.
   ========================================================================= */

/* masthead vitals */
.masthead-vitals { display: inline-flex; gap: 10px; align-items: baseline; margin-left: 14px; }
.masthead-vitals .vital {
  font-family: var(--font-head); font-size: 11px; letter-spacing: .1em;
  color: rgba(240,222,176,.85); white-space: nowrap;
}
.masthead-vitals .vital small { opacity: .55; font-size: 10px; margin-left: 1px; }
.masthead-vitals .vital.ember { color: #e8a05a; }
.masthead-vitals .vital.ash { color: #b9b3a6; }
.masthead-vitals .vital.gold { color: var(--gold-bright); }

/* temper chips */
.temper {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  font-family: var(--font-head); font-size: 9px; letter-spacing: .14em; text-transform: uppercase;
  border-radius: 9px; border: 1px solid currentColor; opacity: .9; vertical-align: middle;
}
.temper-kindle { color: #d4692f; }
.temper-rime   { color: #62a9c9; }
.temper-bloom  { color: #7fae63; }
.temper-hollow { color: #9b7fc4; }
.temper-pale   { color: #a99a72; }

/* ---- the Dim ---- */
.dim-meter { display: flex; align-items: center; gap: 10px; flex: 1 1 260px; min-width: 200px; }
.dim-label {
  font-family: var(--font-head); font-size: 10px; letter-spacing: .22em; text-transform: uppercase;
  color: rgba(230,199,109,.6); white-space: nowrap;
}
.dim-track {
  position: relative; flex: 1; height: 10px; border-radius: 5px;
  background: linear-gradient(180deg, rgba(30,18,8,.5), rgba(30,18,8,.3));
  border: 1px solid rgba(190,152,70,.35); overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.6);
}
.dim-track > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, #4a3550, #6d4a76 55%, #8a3f6a);
  transition: width .4s cubic-bezier(.3,.8,.3,1);
}
.dim-track > i.close { background: linear-gradient(90deg, #6d4a76, #a83f5c 60%, #b5443a); }
.dim-track > i.dire  { background: linear-gradient(90deg, #a83f5c, #c04a2e 60%, #d4562a); animation: dim-pulse 1.6s ease-in-out infinite; }
@keyframes dim-pulse { 0%,100% { opacity: .85; } 50% { opacity: 1; } }
.dim-mark {
  position: absolute; top: -2px; bottom: -2px; width: 1px;
  background: rgba(255,235,190,.5);
}
.dim-value { font-family: var(--font-head); font-size: 10px; letter-spacing: .1em; color: rgba(230,199,109,.7); white-space: nowrap; }

/* ---- intents (the telegraph) ---- */
.intent {
  margin-top: 9px; padding: 6px 8px; border-radius: 2px;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px;
  font-size: 12.5px; line-height: 1.3; text-align: left;
  border: 1px solid rgba(126,92,40,.3);
  background: rgba(255,250,235,.4);
}
.intent-name { font-weight: 600; color: #3d2a12; }
.intent-kind { font-style: italic; color: var(--ink-faint); font-size: 12px; }
.intent-kind b { font-style: normal; color: var(--oxblood); }
.intent-arrow { color: var(--gold-dim); font-size: 10px; }
.intent-severe { border-color: rgba(125,32,24,.6); background: rgba(125,32,24,.1); }
.intent-severe .intent-name { color: var(--oxblood); }
.intent-severe .intent-arrow { color: var(--oxblood); animation: pulse 1.6s ease-in-out infinite; }
.intent-worrying { border-color: rgba(122,90,34,.55); background: rgba(230,199,109,.16); }
.intent-light { opacity: .9; }

/* ---- player strip ---- */
.player-vitals { display: grid; gap: 10px; }
.ember-block { position: relative; }
.ember-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.ash-block { display: flex; align-items: center; gap: 10px; }
.ash-value {
  font-family: var(--font-head); font-size: 18px; color: #4a4436;
  text-shadow: 0 1px 0 rgba(255,252,240,.6);
}
.ash-block .pool-label { color: #5b5443; }
.desperation-mark {
  position: absolute; bottom: 0; width: 1px; height: 11px;
  background: rgba(125,32,24,.55);
}
.desperation-mark::after {
  content: ""; position: absolute; top: -2px; left: -2px;
  border-left: 2.5px solid transparent; border-right: 2.5px solid transparent;
  border-top: 4px solid rgba(125,32,24,.6);
}
.player-strip.desperate .ember-head .pool-value { color: var(--oxblood); font-weight: 600; }
.player-strip.desperate .ember-head .pool-value::after { content: " ⚠"; }

/* ---- the stance dial ---- */
.stance-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 16px;
  border: 1px solid rgba(126,92,40,.34); border-radius: 2px;
  background: linear-gradient(180deg, rgba(255,252,240,.5), rgba(226,209,172,.34));
}
.stance-label {
  font-family: var(--font-head); font-size: 10px; letter-spacing: .22em; text-transform: uppercase;
  color: #6d543a; margin-right: 4px;
}
.stance {
  flex: 1 1 150px; text-align: left; cursor: pointer;
  padding: 8px 12px; border-radius: 2px;
  border: 1px solid rgba(126,92,40,.35);
  background: rgba(255,250,235,.35);
  transition: .16s ease;
}
.stance:hover { transform: translateY(-2px); border-color: var(--gold); }
.stance.active {
  border-color: var(--gold-bright);
  background: linear-gradient(180deg, rgba(230,199,109,.35), rgba(200,165,80,.2));
  box-shadow: 0 0 0 1px rgba(168,128,42,.4), inset 0 1px 0 rgba(255,252,240,.5);
}
.stance-symbol { font-size: 15px; color: var(--gold-dim); margin-right: 5px; }
.stance.active .stance-symbol { color: #6b4a1c; }
.stance-name { font-family: var(--font-head); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: #3d2a12; }
.stance-delta { display: block; font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }
.stance-readout {
  margin-top: 14px; padding: 10px 14px; border-radius: 2px;
  border: 1px solid rgba(126,92,40,.28); background: rgba(255,250,235,.4);
  font-size: 14px; color: var(--ink-faint);
}
.stance-readout b { color: #3d2a12; font-family: var(--font-head); letter-spacing: .08em; margin-right: 8px; }
.stance-readout .stance-label { display: block; margin: 0 0 4px; }

/* ---- action buttons ---- */
.action .a-name { display: flex; align-items: center; flex-wrap: wrap; }
.action .cost { color: var(--aqua); font-weight: 600; }
.action .cost.ash { color: #6b6152; }
.action .cost.free { color: #4f7a5c; }
.action.strike { border-left: 3px solid #5a5a5c; }
.action.tend { border-left: 3px solid #6da97f; }
.action.item { border-left: 3px solid var(--gold-dim); }
.action.muted { opacity: .5; cursor: default; }
.meter.ash > i { background: linear-gradient(180deg, #cfc7b4, #a49b86 60%, #6f6857); }

/* ---- the eleven ---- */
.attune-card { width: min(920px, 100%); }
.keeper-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px; margin: 20px 0 8px; max-height: 62vh; overflow-y: auto; padding-right: 4px;
}
.keeper {
  padding: 14px; border-radius: 2px; text-align: left;
  border: 1px solid rgba(190,152,70,.28);
  background: rgba(0,0,0,.22);
  display: flex; flex-direction: column; gap: 8px;
}
.keeper.attuned {
  border-color: var(--gold-bright);
  background: linear-gradient(180deg, rgba(230,199,109,.16), rgba(0,0,0,.28));
  box-shadow: 0 0 0 1px rgba(230,199,109,.3);
}
.k-head { display: flex; align-items: center; gap: 10px; }
.k-head h3 { font-family: var(--font-head); font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-bright); margin: 0; }
.k-sigil { width: 34px; height: 34px; color: var(--gold-bright); opacity: .85; flex: none; }
.k-sigil svg { width: 34px; height: 34px; }
.k-epithet { display: block; font-size: 12.5px; font-style: italic; color: rgba(233,219,186,.55); }
.k-voice { margin: 0; font-style: italic; font-size: 14px; color: rgba(240,226,192,.8); }
.k-creed { margin: 0; font-size: 13.5px; color: rgba(233,219,186,.62); padding-left: 10px; border-left: 2px solid rgba(190,152,70,.3); }
.k-doctrine { padding: 8px 10px; border-radius: 2px; background: rgba(120,200,150,.09); border: 1px solid rgba(110,200,150,.28); }
.k-doctrine b { display: block; font-family: var(--font-head); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #8ddcb0; }
.k-doctrine span { font-size: 13px; color: rgba(233,219,186,.75); }
.k-arts { display: flex; flex-wrap: wrap; gap: 5px; }
.art-chip {
  font-size: 12.5px; padding: 3px 9px; border-radius: 11px;
  border: 1px solid rgba(190,152,70,.35); background: rgba(0,0,0,.25); color: rgba(240,226,192,.85);
}
.art-chip em { font-style: normal; opacity: .55; margin-left: 4px; font-size: 11px; }
.art-chip.rite { border-color: rgba(230,199,109,.6); }
.keeper .btn { padding: 9px 14px; font-size: 10.5px; }
.keeper .btn:disabled { opacity: .4; cursor: not-allowed; }

/* sheet extras */
.attr-glyph { font-size: 14px; opacity: .5; margin-right: 7px; }
.keeper-row .icon svg { width: 26px; height: 26px; }
.field-note { font-size: 13.5px; font-style: italic; color: rgba(233,219,186,.6); margin: 6px 0 0; }
#origin-grid + .field-note { margin: 10px 0 0; }



/* =========================================================================
   Landing content, skip link and no-script fallback
   The game is client-rendered, so the page carries its own honest description
   in plain HTML below it. That is what a crawler indexes and what a visitor
   with JavaScript off actually reads.
   ========================================================================= */

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  padding: 12px 20px;
  background: var(--gold-bright); color: #241708;
  font-family: var(--font-head); font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
  border-radius: 0 0 3px 0;
}
.skip-link:focus { left: 0; outline: 2px solid #241708; }

.ghost-btn:disabled { opacity: .45; cursor: default; }
.ghost-btn:disabled:hover { transform: none; box-shadow: none; border-color: rgba(190,152,70,.3); background: linear-gradient(180deg, rgba(120,90,40,.22), rgba(60,42,18,.3)); color: rgba(240,222,176,.82); }

/* the pre-boot state, replaced by the client the moment it has something to show */
.static-intro .loading-inline {
  display: inline-block;
  font-family: var(--font-head); font-size: 12px; letter-spacing: .26em; text-transform: uppercase;
  color: #5a3f18; opacity: .75;
}
.static-intro .loading-inline::after {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 10px;
  border-radius: 50%; background: var(--gold);
  animation: pulse 1.6s ease-in-out infinite;
  vertical-align: middle;
}
.static-cta { text-align: center; margin-top: 30px; }

/* ---- the section below the game ---- */
.about-chronicle {
  position: relative; z-index: 1;
  margin-top: 10px;
  border-top: 1px solid rgba(190,152,70,.22);
  background: linear-gradient(180deg, rgba(28,18,9,.0), rgba(28,18,9,.6) 12%);
}
.about-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 58px 20px 80px;
  color: rgba(233,219,186,.82);
}
.about-inner h2 {
  font-family: var(--font-display);
  font-size: clamp(26px, 4.4vw, 40px);
  line-height: 1.1;
  margin-bottom: 14px;
  background: linear-gradient(180deg, #fdf1cd, var(--gold-bright) 48%, #9d7722);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.about-inner h3 {
  font-family: var(--font-head);
  font-size: 13px; letter-spacing: .26em; text-transform: uppercase;
  color: var(--gold-bright); opacity: .9;
  margin: 38px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(190,152,70,.22);
}
.about-inner p { margin: 0 0 1em; font-size: 18.5px; line-height: 1.72; }
.about-inner strong { color: #f3e6c8; font-weight: 600; }
.about-lede {
  font-style: italic; font-size: 20px !important;
  color: rgba(240,226,192,.9);
  padding-left: 16px; border-left: 2px solid rgba(190,152,70,.45);
  margin-bottom: 1.4em !important;
}
.about-inner ul, .about-inner ol { margin: 0 0 1.2em; padding-left: 22px; }
.about-inner li { margin-bottom: .6em; font-size: 18px; line-height: 1.65; }
.about-inner li::marker { color: var(--gold-dim); }
.chapter-list { counter-reset: chap; list-style: none; padding-left: 0; }
.chapter-list li {
  position: relative; padding-left: 46px; margin-bottom: 1em;
}
.chapter-list li::before {
  counter-increment: chap; content: counter(chap, upper-roman);
  position: absolute; left: 0; top: 1px;
  font-family: var(--font-head); font-size: 15px; letter-spacing: .1em;
  color: var(--gold); opacity: .85;
  min-width: 34px;
}
.faq dt {
  font-family: var(--font-head); font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
  color: rgba(230,199,109,.85); margin-top: 20px;
}
.faq dd { margin: 6px 0 0; font-size: 18px; line-height: 1.65; color: rgba(233,219,186,.78); }

.noscript-note {
  position: relative; z-index: 5;
  max-width: 760px; margin: 0 auto 40px; padding: 18px 22px;
  background: rgba(125,32,24,.16);
  border: 1px solid rgba(181,58,42,.5); border-left-width: 4px; border-radius: 3px;
  color: rgba(255,222,206,.9); font-size: 17px; line-height: 1.6;
}
.noscript-note strong { color: #ffd9cd; }


/* ----------------------------------------------------------- responsive -- */
@media (max-width: 720px) {
  body { font-size: 18px; }
  .app { padding: 14px 12px 30px; }
  .masthead-actions span { display: none; }
  .ghost-btn { padding: 9px 11px; }
  .page { padding: 24px 18px; }
  .page::after { inset: 7px; }
  .fleuron { width: 38px; height: 38px; }
  .attr-grid { grid-template-columns: 1fr; }
  .foes { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .colophon { font-size: 9px; letter-spacing: .14em; }
  .pool-row { grid-template-columns: 38px 1fr 72px; }
  .dim-meter { flex: 1 1 100%; order: 3; }
  .stance { flex: 1 1 100%; }
  .masthead-vitals { display: none; }
  .keeper-grid { grid-template-columns: 1fr; }
  .about-inner { padding: 40px 16px 60px; }
  .about-inner p, .about-inner li, .faq dd { font-size: 17px; }
  .chapter-list li { padding-left: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .block, .choice { opacity: 1 !important; transform: none !important; }
}

/* print — a chronicle should be printable */
@media print {
  .atmosphere, .masthead-actions, .colophon, .toasts { display: none; }
  body { background: #fff; }
  .page { box-shadow: none; }
}
