/* The Oregon Trail, interface.
   Built for iPad first: everything tappable is at least 46px, nothing depends on hover,
   and the layout works in both orientations. Type is set large enough to read at arm's
   length on a desk. */

:root {
  --ink:        #1C1611;
  --ink-2:      #3A3026;
  --paper:      #F2EAD8;
  --paper-2:    #E7DCC3;
  --paper-3:    #D9CAAA;
  --rule:       #BCA986;
  --brick:      #9B3520;
  --brick-lite: #C1502F;
  --moss:       #4F5D3A;
  --sky:        #3E5C7E;
  --gold:       #D2A24A;
  --good:       #4C6B3C;
  --bad:        #A8412A;
  --night:      #14110D;
  /* Dark chrome that floats over the landscape */
  --glass:      rgba(26, 21, 16, .82);
  --glass-2:    rgba(38, 31, 23, .78);
  --glass-3:    rgba(52, 43, 32, .74);
  --glass-line: rgba(226, 210, 178, .18);
  --cream:      #EFE4CE;
  --cream-dim:  #B9AC93;
  --shadow:     0 2px 10px rgba(28, 20, 12, .18);
  --shadow-lg:  0 18px 48px rgba(20, 14, 8, .42);
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: var(--night); color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
h1,h2,h3,h4 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: .01em; }

#bgScene {
  position: fixed; inset: 0; width: 100%; height: 100%;
  display: block; z-index: 0; background: #14110D;
}
#app { position: fixed; inset: 0; display: flex; flex-direction: column; z-index: 1; }
/* Menus, the store and the library dim the landscape so type stays readable over it. */
#app.dim::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 78% 62% at 50% 44%, rgba(10,8,5,.40) 0%, rgba(10,8,5,.12) 62%, rgba(10,8,5,0) 100%),
    linear-gradient(180deg, rgba(10,8,5,.44) 0%, rgba(10,8,5,.06) 30%, rgba(10,8,5,.16) 62%, rgba(10,8,5,.58) 100%);
  backdrop-filter: saturate(.92) blur(2px); -webkit-backdrop-filter: saturate(.92) blur(2px);
}
body.no3d #bgScene { background: linear-gradient(170deg, #24303C 0%, #3E4636 55%, #1A160F 100%); }

/* ---------- shared bits ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: 0 22px; border-radius: 6px;
  background: var(--glass-3); color: var(--cream);
  border: 1px solid var(--glass-line);
  box-shadow: 0 3px 14px rgba(0,0,0,.30);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-weight: 600; font-size: 15px; letter-spacing: .015em;
  transition: transform .09s ease, background .15s ease, box-shadow .15s;
}
.btn:active { transform: translateY(1px) scale(.995); background: rgba(70,58,42,.86); }
.btn.primary {
  background: linear-gradient(180deg, var(--brick-lite), var(--brick));
  color: #FFF3E0; border-color: rgba(255,210,170,.26);
  box-shadow: 0 4px 18px rgba(155,53,32,.34);
}
.btn.primary:active { background: var(--brick); }
.btn.ghost { background: rgba(20,16,11,.42); border-color: var(--glass-line); box-shadow: none; }
.btn.dark {
  background: rgba(20,16,11,.62); color: #EFE6D2; border-color: rgba(239,230,210,.22);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.btn.dark:active { background: rgba(20,16,11,.78); }
.btn:disabled { opacity: .38; pointer-events: none; }
.btn.sm { min-height: 38px; padding: 0 13px; font-size: 13px; }
.btn.wide { width: 100%; }

.card {
  background: var(--glass); border: 1px solid var(--glass-line); border-radius: 7px;
  box-shadow: 0 6px 24px rgba(0,0,0,.34);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  color: var(--cream);
}
.rule { height: 1px; background: linear-gradient(90deg, transparent, rgba(226,210,178,.26), transparent); margin: 16px 0; }
.tag {
  display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .10em;
  text-transform: uppercase; padding: 4px 9px; border-radius: 3px;
  background: rgba(210,162,74,.14); color: var(--gold); border: 1px solid rgba(210,162,74,.32);
}
.muted { color: var(--cream-dim); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ---------- title screen ---------- */
#title {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: calc(24px + var(--safe-t)) 24px calc(24px + var(--safe-b));
  z-index: 50;
}
#titleCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#titleInner { position: relative; z-index: 2; max-width: 620px; width: 100%; }
#title h1 {
  font-size: clamp(38px, 8vw, 78px); color: #F7EFDC; line-height: .96;
  text-shadow: 0 2px 4px rgba(0,0,0,.5), 0 6px 34px rgba(0,0,0,.75); letter-spacing: -.015em;
}
#title .sub {
  color: #DCCCA8; font-size: clamp(13px, 2.4vw, 16px); margin-top: 14px;
  letter-spacing: .18em; text-transform: uppercase; font-weight: 600;
  text-shadow: 0 1px 10px rgba(0,0,0,.75);
}
#title .lede {
  color: #D4C7AC; font-size: 15px; line-height: 1.62; margin: 22px auto 30px; max-width: 460px;
  text-shadow: 0 1px 12px rgba(0,0,0,.7);
}
#titleBtns { display: flex; flex-direction: column; gap: 11px; max-width: 340px; margin: 0 auto; }
#title .foot { margin-top: 30px; color: #988D79; font-size: 11.5px; line-height: 1.7;
  text-shadow: 0 1px 8px rgba(0,0,0,.8); }

/* ---------- generic screen ---------- */
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  background: transparent; z-index: 40; color: var(--cream);
}
.screen-head {
  flex: 0 0 auto; padding: calc(12px + var(--safe-t)) 18px 12px;
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(180deg, rgba(14,11,8,.92), rgba(14,11,8,.62));
  border-bottom: 1px solid var(--glass-line); color: var(--cream);
}
.screen-head h2 { font-size: 21px; flex: 1; color: var(--cream); letter-spacing: .005em;
  text-shadow: 0 1px 10px rgba(0,0,0,.6); }
.screen-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 18px;
  max-width: 1180px; width: 100%; margin: 0 auto; }
.screen-foot {
  flex: 0 0 auto; padding: 12px 18px calc(12px + var(--safe-b));
  background: linear-gradient(0deg, rgba(14,11,8,.95), rgba(14,11,8,.70));
  border-top: 1px solid var(--glass-line);
  display: flex; gap: 10px; align-items: center;
}

/* ---------- setup ---------- */
.step-dots { display: flex; gap: 6px; }
.step-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--rule); display: block; }
.step-dots i.on { background: var(--brick); }

.opt-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.opt {
  text-align: left; padding: 14px 16px; border-radius: 7px; border: 1.5px solid var(--glass-line);
  background: var(--glass-2); min-height: 66px; display: block; width: 100%;
  color: var(--cream);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: border-color .13s, background .13s, transform .09s;
}
.opt:active { transform: scale(.99); }
.opt.on {
  border-color: var(--gold); background: rgba(72,56,34,.86);
  box-shadow: inset 0 0 0 1px rgba(210,162,74,.30), 0 4px 20px rgba(0,0,0,.3);
}
.opt .n { font-family: var(--serif); font-size: 17px; font-weight: 600; display: block; color: var(--cream); }
.opt .d { font-size: 12.5px; color: var(--cream-dim); margin-top: 5px; line-height: 1.5; display: block; }
.opt .h { font-size: 11.5px; color: #A9A188; margin-top: 8px; line-height: 1.55; font-style: italic; display: block; }

.field { margin-bottom: 18px; }
.field > label { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--gold); margin-bottom: 9px; }
input[type=text] {
  width: 100%; min-height: 48px; padding: 0 15px; font-size: 17px; font-family: var(--serif);
  background: rgba(16,13,9,.7); border: 1.5px solid var(--glass-line); border-radius: 6px;
  color: var(--cream);
}
input[type=text]::placeholder { color: #8A8069; }
input[type=text]:focus { outline: 2px solid rgba(210,162,74,.55); outline-offset: -1px; }

.player-row {
  display: flex; gap: 10px; align-items: center; padding: 11px;
  border: 1px solid var(--rule); border-radius: 5px; background: var(--paper-2); margin-bottom: 9px;
}
.swatch { width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto; border: 2px solid rgba(0,0,0,.16); }

/* ---------- store ---------- */
.store-wrap { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 860px) { .store-wrap { grid-template-columns: 1fr 300px; } }
.cat-tabs { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.cat-tabs .btn { white-space: nowrap; flex: 0 0 auto; }
.cat-tabs .btn.on { background: linear-gradient(180deg, var(--brick-lite), var(--brick));
  color: #FFF3E0; border-color: rgba(255,210,170,.26); }

.good-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  border-bottom: 1px solid rgba(226,210,178,.12);
}
.good-row:last-child { border-bottom: 0; }
.good-row .info { flex: 1; min-width: 0; }
.good-row .nm { font-family: var(--serif); font-size: 16px; font-weight: 600; }
.good-row .ds { font-size: 12.5px; color: var(--cream-dim); line-height: 1.5; margin-top: 4px; }
.good-row .pr { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14px; white-space: nowrap; }
.stepper { display: flex; align-items: center; gap: 0; flex: 0 0 auto; }
.stepper button {
  width: 44px; height: 44px; background: rgba(60,50,36,.8); border: 1px solid var(--glass-line);
  color: var(--cream); font-size: 21px; font-weight: 600; display: grid; place-items: center;
}
.stepper button:first-child { border-radius: 4px 0 0 4px; }
.stepper button:last-child { border-radius: 0 4px 4px 0; }
.stepper button:active { background: rgba(86,72,52,.9); }
.stepper .q {
  width: 48px; height: 44px; display: grid; place-items: center;
  border-top: 1px solid var(--glass-line); border-bottom: 1px solid var(--glass-line);
  background: rgba(16,13,9,.72); color: var(--cream);
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px;
}

.meter { height: 9px; border-radius: 5px; background: rgba(0,0,0,.42); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--moss); transition: width .3s ease; }
.meter.warn > i { background: var(--gold); }
.meter.over > i { background: var(--bad); }

/* ---------- the trail ---------- */
#trail { position: absolute; inset: 0; display: flex; flex-direction: column; background: transparent; }


.hud-top {
  position: relative; z-index: 3; padding: calc(9px + var(--safe-t)) 12px 22px;
  display: flex; gap: 9px; align-items: center;
  background: linear-gradient(180deg, rgba(10,8,6,.72) 0%, rgba(10,8,6,.42) 55%, rgba(10,8,6,0) 100%);
  color: #EFE6D2; pointer-events: none;
}
.hud-top > * { pointer-events: auto; }
.hud-pill {
  background: rgba(20,16,11,.78); border: 1px solid rgba(239,230,210,.20);
  border-radius: 4px; padding: 6px 11px; backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px);
  display: flex; flex-direction: column; line-height: 1.15;
}
.hud-pill .k { font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: #A2957E; font-weight: 700; }
.hud-pill .v { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hud-icon {
  width: 44px; height: 44px; border-radius: 4px; display: grid; place-items: center;
  background: rgba(20,16,11,.78); border: 1px solid rgba(239,230,210,.20);
  backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px); font-size: 19px;
}
.hud-spacer { flex: 1; }

.hud-bottom {
  position: relative; z-index: 3; margin-top: auto;
  padding: 20px 14px calc(10px + var(--safe-b));
  background: linear-gradient(0deg, rgba(10,8,6,.96) 0%, rgba(10,8,6,.93) 46%, rgba(10,8,6,.62) 76%, rgba(10,8,6,0) 100%);
  color: #EFE6D2;
}
/* On a short, wide window the HUD must not eat the picture. */
@media (max-height: 560px) {
  .hud-bottom { padding-top: 16px; }
  .log-strip { max-height: 18vh; }
  .party-strip { padding-bottom: 6px; }
}
.progress-track {
  height: 5px; border-radius: 3px; background: rgba(239,230,210,.18); position: relative; margin-bottom: 10px;
}
.progress-track > i { position: absolute; inset: 0 auto 0 0; background: var(--brick-lite); border-radius: 3px; }
.progress-track .pip { position: absolute; top: -3px; width: 2px; height: 11px; background: rgba(239,230,210,.30); }
.progress-track .me {
  position: absolute; top: -5px; width: 13px; height: 13px; margin-left: -6.5px;
  border-radius: 50%; background: #F2E8D2; border: 2.5px solid var(--brick); box-shadow: 0 1px 6px rgba(0,0,0,.5);
}

.party-strip { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.pmini {
  flex: 0 0 auto; min-width: 96px; padding: 8px 10px; border-radius: 5px;
  background: rgba(46,38,28,.72); border: 1px solid rgba(239,230,210,.18);
}
.pmini.dead { opacity: .38; }
.pmini .nm { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pmini .st { font-size: 10.5px; color: #B3A68E; margin-top: 2px; }
.hearts { display: flex; gap: 2px; margin-top: 4px; }
.hearts i { width: 8px; height: 8px; border-radius: 2px; background: rgba(239,230,210,.20); display: block; }
.hearts i.on { background: #C4553A; }
.hearts i.sick { background: var(--gold); }

.trail-actions { display: flex; gap: 8px; }
.trail-actions .btn { flex: 1; }

.log-strip {
  max-height: 30vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  margin-bottom: 11px; display: flex; flex-direction: column; gap: 6px;
}
.log-line {
  font-size: 13.5px; line-height: 1.5; padding: 8px 11px; border-radius: 4px;
  background: rgba(46,38,28,.72); border-left: 2.5px solid rgba(239,230,210,.28);
  animation: slideIn .3s ease;
}
.log-line.death   { border-left-color: #C4553A; background: rgba(196,85,58,.13); }
.log-line.illness { border-left-color: var(--gold); }
.log-line.good    { border-left-color: #7FA05A; }
.log-line.recover { border-left-color: #7FA05A; }
.log-line.diary   { border-left-color: #C9B588; background: rgba(201,181,136,.10); font-style: italic; }
@keyframes slideIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- modal ---------- */
.modal-back {
  position: absolute; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(9,7,4,.70); backdrop-filter: blur(7px) saturate(.9); -webkit-backdrop-filter: blur(7px) saturate(.9);
  animation: fadeIn .2s ease;
}
@media (min-width: 700px) { .modal-back { align-items: center; } }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  width: 100%; max-width: 620px; max-height: 92vh; display: flex; flex-direction: column;
  color: var(--ink);
  background-color: #F1E7D0;
  background-image:
    radial-gradient(120% 80% at 12% 0%, rgba(255,253,246,.9), rgba(255,253,246,0) 62%),
    linear-gradient(168deg, #F7EFDC 0%, #EFE4CB 46%, #E4D7BA 100%);
  border: 1px solid rgba(120,98,64,.30);
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -6px 60px rgba(0,0,0,.55), 0 2px 0 rgba(255,255,255,.4) inset;
  animation: rise .28s cubic-bezier(.16,1,.3,1);
  position: relative; overflow: hidden;
}
/* A faint laid-paper tooth so the reading surface is not a flat slab. */
.modal::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    repeating-linear-gradient(0deg, rgba(120,98,64,.05) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(120,98,64,.04) 0 1px, transparent 1px 4px);
}
.modal > * { position: relative; }
@media (min-width: 700px) { .modal { border-radius: 12px; max-height: 86vh; } }
@keyframes rise { from { transform: translateY(28px); opacity: 0 } to { transform: none; opacity: 1 } }
.modal-head { padding: 20px 22px 13px; border-bottom: 1px solid rgba(120,98,64,.26); flex: 0 0 auto; }
.modal-head h3 { font-size: 22px; line-height: 1.2; }
.modal-body { padding: 18px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }
.modal-foot .btn:not(.primary) { background: rgba(255,252,244,.72); color: var(--ink);
  border-color: rgba(120,98,64,.34); backdrop-filter: none; -webkit-backdrop-filter: none; }
.modal-foot { padding: 14px 22px calc(16px + var(--safe-b)); border-top: 1px solid rgba(120,98,64,.26);
  background: rgba(210,193,158,.30); flex: 0 0 auto; display: flex; gap: 9px; }

.narrative { font-family: var(--serif); font-size: 17px; line-height: 1.62; color: var(--ink-2); }
.narrative p { margin: 0 0 13px; }

.choice {
  display: block; width: 100%; text-align: left; padding: 15px 17px; margin-bottom: 10px;
  border: 1.5px solid rgba(120,98,64,.32); border-radius: 7px;
  background: linear-gradient(180deg, rgba(255,252,244,.80), rgba(232,222,196,.72));
  color: var(--ink); min-height: 56px;
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 2px 8px rgba(90,70,40,.10);
  transition: border-color .12s, background .12s, transform .09s;
}
.choice:active { transform: scale(.995); background: rgba(224,212,182,.9); }
.choice .lb { font-family: var(--serif); font-size: 16.5px; font-weight: 600; }
.choice .dt { font-size: 13px; color: #6B5C46; margin-top: 4px; line-height: 1.5; }
.choice .req { font-size: 11.5px; color: var(--brick); margin-top: 6px; font-weight: 600; }
.choice.locked { opacity: .48; }
.choice.gated { border-color: rgba(79,93,58,.55);
  background: linear-gradient(180deg, rgba(246,250,236,.85), rgba(226,234,206,.72)); }
.choice.gated .lb::after {
  content: '✓'; color: var(--moss); font-size: 13px; margin-left: 7px; font-weight: 700;
}

.fx-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.fx {
  font-size: 12.5px; font-weight: 600; padding: 5px 10px; border-radius: 3px;
  background: rgba(0,0,0,.05); border: 1px solid rgba(0,0,0,.09);
}
.fx.good  { background: rgba(79,93,58,.12); color: #3E4E2C; border-color: rgba(79,93,58,.28); }
.fx.bad   { background: rgba(154,59,35,.10); color: #7E2F1C; border-color: rgba(154,59,35,.24); }
.fx.death { background: rgba(154,59,35,.22); color: #6C2415; border-color: rgba(154,59,35,.42); font-weight: 700; }
.fx.time  { background: rgba(62,92,126,.11); color: #2F485F; border-color: rgba(62,92,126,.26); }

/* Historian's Note, the teaching payload, visually distinct from the fiction. */
.hnote {
  margin-top: 20px; padding: 16px 18px; border-radius: 7px;
  background: linear-gradient(180deg, rgba(238,243,250,.86), rgba(226,234,244,.78));
  border: 1px solid rgba(62,92,126,.30); border-left: 4px solid var(--sky);
  box-shadow: 0 2px 10px rgba(40,60,90,.08);
}
.hnote .lab {
  font-size: 10.5px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase;
  color: var(--sky); margin-bottom: 6px;
}
.hnote h4 { font-size: 16px; margin-bottom: 7px; }
.hnote p { font-size: 14px; line-height: 1.65; color: var(--ink-2); margin: 0; }

/* Diary excerpt */
.diary {
  margin: 4px 0 0; padding: 18px 20px; border-radius: 7px;
  background: linear-gradient(168deg, #FBF5E4 0%, #F0E6CC 100%);
  border: 1px solid rgba(120,98,64,.30); border-left: 4px solid var(--gold);
  box-shadow: 0 2px 12px rgba(90,70,40,.10);
}
.diary .q {
  font-family: var(--serif); font-size: 17px; line-height: 1.66; font-style: italic; color: var(--ink-2);
}
.diary .a { font-size: 13px; margin-top: 11px; color: #6B5C46; font-weight: 600; }
.diary .c { font-size: 12.5px; margin-top: 8px; color: #7A6849; line-height: 1.55; }

/* ---------- landmark ---------- */
.lm-hero { padding: 20px; background: linear-gradient(#2A3340, #1A2029); color: #EFE6D2; }
.lm-hero h2 { font-size: 27px; line-height: 1.1; }
.lm-hero .sub { font-size: 13px; color: #A2957E; margin-top: 6px; letter-spacing: .05em; }
.lm-stats { display: flex; gap: 18px; margin-top: 15px; flex-wrap: wrap; }
.lm-stats div { font-size: 12px; color: #A2957E; }
.lm-stats b { display: block; font-size: 17px; color: #EFE6D2; font-variant-numeric: tabular-nums; }
.fact-list { margin: 0; padding-left: 18px; }
.fact-list li { font-size: 14px; line-height: 1.62; margin-bottom: 8px; color: var(--ink-2); }

/* ---------- library ---------- */
.lib-item {
  display: block; width: 100%; text-align: left; padding: 15px 17px; margin-bottom: 9px;
  border: 1px solid var(--glass-line); border-radius: 7px; background: var(--glass-2);
  color: var(--cream);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.lib-item .t { font-family: var(--serif); font-size: 16.5px; font-weight: 600; }
.lib-item .s { font-size: 12.5px; color: var(--cream-dim); margin-top: 5px; line-height: 1.5; }
.lib-item.locked { opacity: .42; }
.pull {
  margin: 16px 0; padding: 14px 18px; border-left: 3px solid var(--gold);
  background: rgba(185,138,52,.07); font-family: var(--serif); font-size: 16px;
  line-height: 1.6; font-style: italic; color: var(--ink-2);
}
.article { font-size: 15.5px; line-height: 1.75; color: var(--ink-2); }
.article p { margin: 0 0 14px; }

/* ---------- end report ---------- */
.report-hero { padding: 32px 22px; text-align: center; color: #EFE6D2; }
.report-hero h2 { font-size: clamp(28px, 6vw, 44px); line-height: 1.05; }
.report-hero .sub { margin-top: 10px; color: #A2957E; font-size: 14px; letter-spacing: .06em; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { padding: 14px; border: 1px solid var(--glass-line); border-radius: 7px; background: var(--glass-2);
  color: var(--cream); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.stat .k { font-size: 10.5px; letter-spacing: .11em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.stat .v { font-size: 25px; font-family: var(--serif); font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .n { font-size: 11.5px; color: var(--cream-dim); margin-top: 4px; line-height: 1.45; }

.compare-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(226,210,178,.16); }
.compare-row .lbl { flex: 1; font-size: 14px; }
.compare-row .you { font-weight: 700; font-variant-numeric: tabular-nums; }
.compare-row .hist { font-size: 12.5px; color: var(--cream-dim); font-variant-numeric: tabular-nums; }

.grave-row { display: flex; gap: 11px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid rgba(226,210,178,.14); }
.grave-row .n { font-family: var(--serif); font-size: 15.5px; font-weight: 600; flex: 1; }
.grave-row .d { font-size: 12.5px; color: var(--cream-dim); }

/* ---------- toast ---------- */
#toast {
  position: absolute; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%);
  z-index: 80; background: rgba(20,16,11,.94); color: #EFE6D2; padding: 11px 18px;
  border-radius: 22px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .22s ease, transform .22s ease; max-width: 84vw; text-align: center;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(-6px); }

/* ---------- code box ---------- */
.codebox {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11.5px; line-height: 1.55;
  background: rgba(255,252,244,.72); border: 1px solid rgba(120,98,64,.30); border-radius: 5px; padding: 13px;
  word-break: break-all; max-height: 190px; overflow-y: auto; -webkit-overflow-scrolling: touch;
  white-space: pre-wrap; user-select: all; -webkit-user-select: all;
}
textarea.codebox { width: 100%; min-height: 130px; resize: vertical; color: var(--ink); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
