/* =================================================================
 * Spencer Quests — "The Chronicle" tome aesthetic
 * Parchment & ink, candlelit, carved into an ancient leather book.
 * ================================================================= */
:root {
  --ink: #221913;          /* main text, near-black brown */
  --text: #2c2015;
  --muted: #63502c;        /* faded ink (tuned for contrast on parchment) */
  --line: #b79b68;         /* ruled-line brown */
  --line-soft: rgba(120, 92, 46, 0.35);

  --parch: #e9dab4;        /* parchment base */
  --parch-hi: #f3e8ca;     /* highlight */
  --parch-lo: #d8c191;     /* shadowed parchment */
  --panel: #1a130a;        /* dark wood/leather */

  --gold: #9c7a2f;
  --gold-hi: #c9a94f;
  --wine: #8c2f24;         /* deep red, negatives / seals */
  --moss: #4f6b2f;         /* aged green, positives */

  /* Readability helpers on the light parchment surface */
  --muted-strong: #5f4a2b; /* darker faded ink, use where contrast matters */
  --on-dark: #efe3c6;      /* primary text on dark wood/leather */
  --on-dark-dim: #d3c095;  /* secondary text on dark wood/leather */

  /* Status */
  --ok: #4d6b30;
  --bad: #8c4a3f;

  --shadow: 0 22px 60px rgba(0, 0, 0, 0.55);

  /* Consistent spacing + radius scale */
  --sp-1: 6px;  --sp-2: 10px;  --sp-3: 16px;  --sp-4: 22px;  --sp-5: 30px;
  --r-sm: 4px;  --r: 6px;  --r-lg: 10px;

  --c-fruitiness: #9c3b2f;
  --c-fun: #b5852a;
  --c-money: #8a6a24;
  --c-charisma: #5c4a7a;

  /* Fixed meter bar: --meter-bar-h is synced from #meters in game.js (fallback below) */
  --meter-bar-h: 124px;
  --meter-lift: max(6px, env(safe-area-inset-bottom, 6px));
  --meter-gap: 14px;
}
@media (min-width: 701px) {
  :root {
    --meter-lift: max(24px, env(safe-area-inset-bottom, 24px));
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  font-family: "EB Garamond", Georgia, serif;
  color: var(--text);
  background: #0d0906;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
}

/* Text selection stays on-theme */
::selection { background: rgba(201,169,79,0.35); color: #1a130a; }

/* Accessible keyboard focus: a clear gold ring everywhere */
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; border-radius: 2px; }
.choice:focus-visible, .mode-card:focus-visible { outline-offset: 3px; }

/* Respect users who prefer less motion: calm the ambient animations */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------------------------------------------------------------- */
/* Location backdrop — candlelit, sepia, muted                      */
/* ---------------------------------------------------------------- */
.bg {
  position: fixed; inset: 0; z-index: 0;
  transition: background 1s ease;
  overflow: hidden;
  filter: saturate(0.72) brightness(0.82);
}
.bg-layer { position: absolute; inset: -10%; pointer-events: none; }

/* Sanctum / Monk intro */
.bg-monk { background: radial-gradient(120% 100% at 50% 12%, #3a2b12 0%, #241608 55%, #0e0803 100%); }
.bg-monk .l1 {
  background:
    radial-gradient(2px 2px at 22% 30%, rgba(255,214,140,0.8), transparent),
    radial-gradient(2px 2px at 70% 22%, rgba(255,214,140,0.6), transparent),
    radial-gradient(1.5px 1.5px at 40% 68%, rgba(255,214,140,0.7), transparent),
    radial-gradient(2px 2px at 85% 60%, rgba(255,214,140,0.5), transparent),
    radial-gradient(1.5px 1.5px at 15% 80%, rgba(255,214,140,0.6), transparent);
  animation: twinkle 5s ease-in-out infinite;
}
.bg-monk .l2 { background: radial-gradient(55% 40% at 50% 40%, rgba(201,169,79,0.22), transparent 70%); animation: drift 20s ease-in-out infinite; }

/* RV dawn — sepia sunrise */
.bg-rv { background: linear-gradient(180deg, #6b4e24 0%, #7c5320 32%, #5c3f1c 60%, #34260f 100%); }
.bg-rv .l1 { background: radial-gradient(closest-side, rgba(255,224,150,0.85) 55%, transparent 72%); width: 190px; height: 190px; left: 66%; top: 12%; border-radius: 50%; animation: bob 10s ease-in-out infinite; filter: blur(3px); }
.bg-rv .l2 { background: radial-gradient(60px 30px at 30% 26%, rgba(60,42,20,0.5), transparent 70%); animation: clouds 46s linear infinite; }

/* Office — gloomy ruled ledger */
.bg-office { background: linear-gradient(180deg, #4b442f 0%, #3a3423 55%, #2a2618 100%); }
.bg-office .l1 {
  background-image: linear-gradient(rgba(20, 16, 8, 0.35) 1px, transparent 1px), linear-gradient(90deg, rgba(20, 16, 8, 0.35) 1px, transparent 1px);
  background-size: 48px 48px; animation: slide-grid 34s linear infinite;
}
.bg-office .l2 { background: linear-gradient(180deg, rgba(255,220,150,0.12), transparent 32%); }

/* Outdoors — mossy sepia field */
.bg-outdoors { background: linear-gradient(180deg, #5a5a2c 0%, #4a4a22 42%, #37401d 66%, #262c12 100%); }
.bg-outdoors .l1 { background: radial-gradient(closest-side, rgba(255,224,150,0.6) 55%, transparent 72%); width: 150px; height: 150px; left: 14%; top: 12%; border-radius: 50%; animation: bob 9s ease-in-out infinite; }
.bg-outdoors .l2 { background: radial-gradient(70px 30px at 55% 26%, rgba(20,20,10,0.4), transparent 70%); animation: clouds 52s linear infinite; }

/* Cozy — candle chamber */
.bg-cozy { background: radial-gradient(90% 80% at 50% 32%, #40301a 0%, #251a0c 60%, #120c05 100%); }
.bg-cozy .l1 { background: radial-gradient(45% 38% at 50% 36%, rgba(201,169,79,0.3), transparent 70%); animation: tvflicker 6s ease-in-out infinite; }

/* Sinder — dim wine hall */
.bg-sinder { background: linear-gradient(155deg, #5c2330 0%, #431a26 48%, #2a121a 100%); }
.bg-sinder .l1 {
  background:
    radial-gradient(14px 14px at 22% 82%, rgba(201,169,79,0.35), transparent 60%),
    radial-gradient(10px 10px at 70% 90%, rgba(201,169,79,0.28), transparent 60%),
    radial-gradient(18px 18px at 45% 95%, rgba(201,169,79,0.3), transparent 60%);
  animation: floatUp 13s linear infinite;
}

/* Book — candlelit writing desk */
.bg-book { background: radial-gradient(90% 90% at 68% 20%, #5a3d1d 0%, #38260f 55%, #1c1206 100%); }
.bg-book .l1 { background: radial-gradient(40% 40% at 70% 22%, rgba(255, 214, 140, 0.45), transparent 70%); animation: lamp 6s ease-in-out infinite; }

/* Tavern — the crew at night */
.bg-bar { background: linear-gradient(180deg, #3a2410 0%, #4a2a12 52%, #341a10 100%); }
.bg-bar .l1 {
  background:
    radial-gradient(70px 70px at 22% 30%, rgba(201,169,79,0.32), transparent 70%),
    radial-gradient(80px 80px at 80% 26%, rgba(140,47,36,0.28), transparent 70%),
    radial-gradient(60px 60px at 55% 62%, rgba(181,133,42,0.28), transparent 70%);
  animation: neon 7s ease-in-out infinite;
}

/* Gym / active */
.bg-gym { background: linear-gradient(180deg, #3a4a3a 0%, #253424 100%); }
.bg-gym .l1 { background-image: repeating-linear-gradient(120deg, rgba(255,255,255,0.06) 0 20px, transparent 20px 40px); animation: slide-grid 14s linear infinite; }

/* World — night voyage */
.bg-world { background: linear-gradient(180deg, #1a2140 0%, #24304f 45%, #3a2a14 100%); }
.bg-world .l1 {
  background:
    radial-gradient(2px 2px at 30% 20%, rgba(255,240,200,0.9), transparent),
    radial-gradient(2px 2px at 60% 30%, rgba(255,240,200,0.8), transparent),
    radial-gradient(2px 2px at 80% 15%, rgba(255,240,200,0.85), transparent);
  animation: twinkle 4s ease-in-out infinite;
}
.bg-world .l2 { background: radial-gradient(closest-side, rgba(255,224,150,0.7) 55%, transparent 72%); width: 120px; height: 120px; left: 74%; top: 14%; border-radius: 50%; animation: bob 11s ease-in-out infinite; }

/* Summary / chronicle */
.bg-summary { background: radial-gradient(100% 100% at 50% 0%, #33240f 0%, #1a1207 70%); }
.bg-summary .l1 { background: radial-gradient(50% 40% at 50% 20%, rgba(201,169,79,0.2), transparent 70%); }

/* The Great Quest: the biblical lands Spencer travels through */
.bg-wilderness { background: linear-gradient(180deg, #b98a45 0%, #9c6f31 34%, #6e4a1e 66%, #3a2810 100%); }
.bg-wilderness .l1 { background: radial-gradient(closest-side, rgba(255,236,180,0.9) 55%, transparent 72%); width: 170px; height: 170px; left: 68%; top: 12%; border-radius: 50%; filter: blur(2px); animation: bob 12s ease-in-out infinite; }
.bg-wilderness .l2 { background: radial-gradient(80px 26px at 40% 78%, rgba(60,42,20,0.4), transparent 70%); animation: clouds 60s linear infinite; }

.bg-sea { background: linear-gradient(180deg, #17324f 0%, #1f3f5c 40%, #3a2f2a 72%, #1a120c 100%); }
.bg-sea .l1 { background: radial-gradient(60% 50% at 50% 60%, rgba(120,47,36,0.35), transparent 70%); animation: drift 16s ease-in-out infinite; }
.bg-sea .l2 { background: repeating-linear-gradient(180deg, rgba(255,255,255,0.05) 0 3px, transparent 3px 22px); animation: slide-grid 20s linear infinite; }

.bg-sinai { background: radial-gradient(120% 100% at 50% 8%, #4a4038 0%, #2b241c 55%, #100b06 100%); }
.bg-sinai .l1 { background: radial-gradient(50% 34% at 50% 16%, rgba(220,225,255,0.28), transparent 70%); animation: tvflicker 4s ease-in-out infinite; }
.bg-sinai .l2 { background: radial-gradient(60% 40% at 50% 84%, rgba(20,14,8,0.6), transparent 70%); }

.bg-valley { background: linear-gradient(180deg, #23201a 0%, #171410 55%, #0a0806 100%); }
.bg-valley .l1 { background: radial-gradient(45% 34% at 50% 30%, rgba(201,169,79,0.16), transparent 70%); animation: drift 22s ease-in-out infinite; }

.bg-jordan { background: linear-gradient(180deg, #2f4a3a 0%, #2a4030 42%, #3a3320 70%, #1a1409 100%); }
.bg-jordan .l1 { background: radial-gradient(closest-side, rgba(255,236,180,0.55) 55%, transparent 72%); width: 130px; height: 130px; left: 20%; top: 14%; border-radius: 50%; animation: bob 10s ease-in-out infinite; }
.bg-jordan .l2 { background: repeating-linear-gradient(180deg, rgba(255,255,255,0.04) 0 2px, transparent 2px 20px); animation: slide-grid 24s linear infinite; }

.bg-lions { background: radial-gradient(90% 90% at 50% 40%, #2e1f10 0%, #1a1108 58%, #080503 100%); }
.bg-lions .l1 { background: radial-gradient(30% 26% at 50% 44%, rgba(201,169,79,0.22), transparent 70%); animation: tvflicker 5s ease-in-out infinite; }

.bg-garden { background: radial-gradient(100% 90% at 40% 20%, #2d3a24 0%, #1e2618 55%, #0c0f08 100%); }
.bg-garden .l1 { background: radial-gradient(40% 34% at 60% 24%, rgba(201,169,79,0.2), transparent 70%); animation: lamp 7s ease-in-out infinite; }

.bg-heaven { background: radial-gradient(120% 110% at 50% 0%, #d9c483 0%, #a9863f 34%, #5c4620 68%, #241a0c 100%); }
.bg-heaven .l1 { background: radial-gradient(55% 44% at 50% 6%, rgba(255,248,220,0.75), transparent 70%); animation: tvflicker 6s ease-in-out infinite; }
.bg-heaven .l2 { background: conic-gradient(from 0deg at 50% 4%, rgba(255,248,220,0.14), transparent 22%, rgba(255,248,220,0.14) 44%, transparent 66%, rgba(255,248,220,0.14) 88%, transparent); animation: drift 30s ease-in-out infinite; }

@keyframes twinkle { 0%,100%{opacity:0.4;} 50%{opacity:1;} }
@keyframes drift { 0%,100%{transform:translateX(-3%);} 50%{transform:translateX(3%);} }
@keyframes bob { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-14px);} }
@keyframes clouds { 0%{transform:translateX(-8%);} 100%{transform:translateX(8%);} }
@keyframes slide-grid { 0%{transform:translate(0,0);} 100%{transform:translate(48px,48px);} }
@keyframes tvflicker { 0%,100%{opacity:0.6;} 45%{opacity:0.95;} 55%{opacity:0.5;} }
@keyframes floatUp { 0%{transform:translateY(0);opacity:0.8;} 100%{transform:translateY(-120%);opacity:0;} }
@keyframes lamp { 0%,100%{opacity:0.7;} 50%{opacity:1;} }
@keyframes neon { 0%,100%{opacity:0.7;} 50%{opacity:1;} }

/* Heavy candlelit vignette over everything */
.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(120% 100% at 50% 40%, transparent 45%, rgba(0,0,0,0.5) 100%),
    radial-gradient(80% 60% at 50% 0%, rgba(201,169,79,0.06), transparent 60%);
}

/* ---------------------------------------------------------------- */
/* App layout                                                       */
/* ---------------------------------------------------------------- */
.app {
  position: relative; z-index: 2;
  min-height: 100vh; max-width: 1240px; margin: 0 auto;
  padding: 10px 16px calc(var(--meter-bar-h) + var(--meter-lift) + var(--meter-gap));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 188px;
  grid-template-rows: auto auto auto;
  grid-template-areas:
    "top   top"
    "week  rail"
    "stage rail";
  column-gap: 14px;
  row-gap: 0;
  align-content: start;
}
.app.prologue {
  grid-template-columns: 1fr;
  grid-template-areas: "stage";
  grid-template-rows: minmax(0, 1fr);
  max-width: 920px;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  box-sizing: border-box;
  padding: 20px 28px 0;
  column-gap: 0;
}
.app.prologue.has-daypanel {
  grid-template-columns: 1fr;
  grid-template-areas: "stage";
}
.app.prologue .topbar,
.app.prologue .weekmap,
.app.prologue .daypanel,
.app.prologue .siderail {
  display: none !important;
}
.app.prologue .stage {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  padding-bottom: calc(var(--meter-bar-h) + var(--meter-lift) + var(--meter-gap));
}
.app.prologue.prologue-no-meters {
  padding-bottom: 24px;
}
.app.prologue.prologue-no-meters .stage {
  padding-bottom: 0;
}
.app.prologue .card {
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: min(560px, calc(100dvh - 150px));
  max-height: calc(100dvh - var(--meter-bar-h) - var(--meter-lift) - 24px - var(--meter-gap));
  padding: 32px 36px 28px;
  overflow: hidden;
}
.app.prologue.prologue-no-meters .card {
  min-height: min(480px, calc(100dvh - 80px));
  max-height: calc(100dvh - 48px);
}
.app.prologue .monk-scene { flex: 1; gap: 18px; align-items: flex-start; }
.app.prologue .monk-bubble { flex: 1; display: flex; flex-direction: column; }
.app.prologue .monk-avatar { width: 88px; height: 88px; }
.app.prologue .monk-name { font-size: 16px; margin-bottom: 8px; }
.app.prologue .scene-text {
  font-size: 19px;
  line-height: 1.55;
  margin-bottom: 14px;
}
.app.prologue .choices { margin-top: auto; padding-top: 16px; }
.app.prologue .continue-btn {
  margin-top: 0;
  padding: 16px 22px;
  font-size: 18px;
  min-height: 56px;
  align-items: center;
  justify-content: center;
}
.app.prologue .intro-monk-panel { padding: 16px 18px; margin-bottom: 14px; gap: 14px; }
.app.prologue .intro-monk-panel .monk-avatar { width: 68px; height: 68px; }
.app.prologue .intro-monk-panel .monk-name { font-size: 15px; margin-bottom: 6px; }
.app.prologue .intro-step-title { font-size: 21px; margin: 0 0 10px; line-height: 1.22; }
.app.prologue .intro-step-copy { font-size: 18px; line-height: 1.48; }
.app.prologue .intro-eg-grid { margin-top: 10px; gap: 16px; }
.app.prologue .intro-eg-grid .eg-tile { min-height: 0; padding: 16px 14px; gap: 10px; }
.app.prologue .intro-eg-grid .eg-tile .eg-tname { font-size: 18px; margin-bottom: 2px; }
.app.prologue .intro-eg-grid .eg-check { margin: 8px 0 2px; }
.app.prologue .intro-eg-grid .eg-check li { font-size: 15.5px; line-height: 1.42; margin-bottom: 3px; padding: 4px 0; gap: 8px; }
.app.prologue .intro-eg-grid .eg-check .ck-mark { margin-top: 2px; }
.app.prologue .intro-eg-grid .eg-check .ck-mark svg { width: 17px; height: 17px; }
.app.prologue .card.intro-board-wrap {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 22px 26px 18px;
  min-height: 0;
}
.app.prologue .intro-board-wrap .intro-monk-panel {
  flex: 0 0 auto;
}
.app.prologue .intro-board-wrap .eg-tsub,
.app.prologue .intro-board-wrap .eg-status,
.app.prologue .intro-board-wrap .boss-banner {
  display: none;
}
.app.prologue .intro-board-wrap .eg-tile {
  justify-content: flex-start;
  align-items: stretch;
  text-align: left;
}
.app.prologue .intro-board-wrap .eg-tname { text-align: center; }
.app.prologue .intro-eg-grid.intro-eg-single {
  grid-template-columns: 1fr;
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}
.app.prologue .intro-eg-grid.intro-eg-single .eg-check {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 12px;
}
.app.prologue .intro-eg-grid.intro-eg-single .eg-check li {
  font-size: 14px;
  line-height: 1.34;
  padding: 2px 0;
}
.app.prologue .intro-eg-grid.intro-eg-all {
  grid-template-columns: 1fr 1fr;
  width: 100%;
  gap: 12px;
  margin-top: 8px;
}
.app.prologue .intro-eg-grid.intro-eg-all .eg-tile {
  padding: 10px 10px 12px;
}
.app.prologue .intro-eg-grid.intro-eg-all .eg-tname {
  font-size: 16px;
}
.app.prologue .intro-eg-grid.intro-eg-all .eg-check {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 8px;
  margin: 6px 0 0;
}
.app.prologue .intro-eg-grid.intro-eg-all .eg-check li {
  font-size: 12.5px;
  line-height: 1.32;
  padding: 2px 0;
  gap: 5px;
}
.app.prologue .intro-eg-grid.intro-eg-all .eg-check .ck-mark svg {
  width: 14px;
  height: 14px;
}
.app.prologue .intro-eg-grid.intro-eg-triple {
  grid-template-columns: 1fr;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
  gap: 10px;
}
.app.prologue .intro-eg-grid.intro-eg-triple .eg-tile {
  padding: 10px 12px;
  min-height: auto;
}
.app.prologue .intro-eg-grid.intro-eg-triple .eg-tname {
  font-size: 15px;
}
.app.prologue .intro-eg-grid.intro-eg-triple .eg-check {
  display: block;
  margin: 6px 0 0;
}
.app.prologue .intro-eg-grid.intro-eg-triple .eg-tile[data-eg="trip"] .eg-check {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 10px;
}
.app.prologue .intro-eg-grid.intro-eg-triple .eg-check li {
  font-size: 13.5px;
  line-height: 1.36;
  padding: 2px 0;
  gap: 6px;
}
.app.prologue .intro-board-wrap .intro-eg-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  align-content: start;
  overscroll-behavior: contain;
}
.app.prologue .intro-board-wrap .eg-tile {
  min-height: auto;
}
.app.prologue .intro-board-wrap .center {
  flex: 0 0 auto;
  margin-top: 12px !important;
  padding-top: 10px;
  border-top: 1px solid rgba(120, 92, 46, 0.28);
  background: linear-gradient(180deg, rgba(255, 251, 238, 0) 0%, rgba(255, 251, 238, 0.92) 18%, rgba(255, 251, 238, 1) 100%);
}
.app.prologue .intro-board-wrap .btn-cta {
  width: 100%;
  min-height: 48px;
  font-size: 16px;
  padding: 12px 16px;
}
.app.prologue .start-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: min(420px, calc(100dvh - 80px));
  padding: 40px 36px 36px;
}
.app.prologue .start-title { font-size: 42px; }
.app.prologue .start-sub { font-size: 19px; margin-bottom: 28px; }
.app.prologue .mode-card { padding: 22px 18px; }
.app.prologue .mode-name { font-size: 17px; }
.app.prologue .mode-desc { font-size: 15px; }
.app.prologue-no-meters .meters {
  display: none;
}
body.prologue-lock {
  overflow: hidden;
  height: 100%;
}
.start-box {
  padding: 32px 28px 28px;
}
.start-box .start-title { margin-bottom: 6px; }
.start-box .start-sub { margin-bottom: 22px; font-size: 16px; }
.app.has-daypanel {
  grid-template-columns: 152px minmax(0, 1fr) 188px;
  grid-template-areas:
    "top   top   top"
    ".     week  ."
    "ctx   stage rail";
  grid-template-rows: auto auto minmax(0, 1fr);
  align-items: stretch;
  column-gap: 10px;
  max-height: calc(100dvh - var(--meter-bar-h) - var(--meter-lift) - 12px - var(--meter-gap));
  overflow: hidden;
}
body:has(.app.has-daypanel:not(.prologue)) {
  overflow: hidden;
}
@media (max-width: 700px) {
  body:has(.app.has-daypanel:not(.prologue)) {
    overflow: hidden;
    height: 100%;
  }
}
.app.has-daypanel .daypanel {
  align-self: stretch;
  position: static;
  top: auto;
  justify-content: flex-start;
  min-height: 0;
  margin-right: 2px;
  padding: 12px 10px;
  gap: 8px;
  border-radius: 5px;
}
.app.has-daypanel .daypanel-day { font-size: 18px; }
.app.has-daypanel .daypanel-phase { font-size: 15px; padding-bottom: 6px; }
.app.has-daypanel .daypanel-time { font-size: 16px; }
.app.has-daypanel .daypanel-task {
  margin-top: 8px;
  padding: 8px 8px;
  font-size: 14px;
}
.app.has-daypanel .stage {
  align-self: stretch;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
}
.app.has-daypanel .stage .card {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  width: 100%;
  padding: 22px 24px 18px;
  box-sizing: border-box;
}
.app.has-daypanel .stage .scene-body {
  flex: 0 0 auto;
}
.app.has-daypanel .stage .scene-text {
  font-size: 20px;
  line-height: 1.48;
  margin-bottom: 12px;
}
.app.has-daypanel .stage .scene-text.dialogue {
  font-size: 20px;
}
.app.has-daypanel .stage .scene-from,
.app.has-daypanel .stage .speaker-label {
  font-size: 13px;
  margin: 10px 0 6px;
}
.app.has-daypanel .stage .monk-ask {
  font-size: 12px;
  padding: 10px 14px;
  margin-top: 14px;
  margin-bottom: 0;
}
.app.has-daypanel .stage .choices {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 11px;
  min-height: 0;
}
.app.has-daypanel .stage .choice,
.app.has-daypanel .stage .continue-btn {
  flex: 0 0 auto;
  min-height: 0;
  padding: 11px 15px;
  font-size: 17.5px;
  line-height: 1.48;
  align-items: center;
}
.app.has-daypanel .siderail {
  align-self: stretch;
  position: static;
  top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  height: auto;
  justify-content: flex-start;
}
.app.has-daypanel .siderail .rail-title {
  flex: 0 0 auto;
  margin: 0;
  padding-bottom: 4px;
}
.app.has-daypanel .siderail .widget {
  flex: 0 0 auto;
  width: 100%;
  border-radius: 5px;
  padding: 10px 9px;
  box-sizing: border-box;
}
.app.has-daypanel .siderail .widget-book {
  flex: 0 0 auto;
}
.app.has-daypanel .rail-bonds {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 0;
  margin-top: 0;
  padding: 8px 9px;
  border-radius: 5px;
  border: 1px solid rgba(201, 169, 79, 0.42);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 248, 230, 0.08);
}
.app.has-daypanel .rail-bonds .rail-title {
  flex: 0 0 auto;
  padding-bottom: 2px;
  border-bottom: 1px solid rgba(201, 169, 79, 0.28);
}
.app.has-daypanel .railbond-legend {
  flex: 0 0 auto;
  margin: 0;
  font-size: 10px;
}
.app.has-daypanel .rail-bonds .railbond-row {
  flex: 0 0 auto;
  justify-content: center;
  min-height: 0;
  gap: 2px;
}
.app.has-daypanel .railbond-name { font-size: 11px; }
.app.has-daypanel .railbond-val { font-size: 11px; }
.app.has-daypanel .railbond-tier { font-size: 8px; }
.app.has-daypanel .railbond-bar { height: 6px; }

/* Left status box — day, phase, time, task (beside the parchment card; gameplay only) */
.daypanel {
  grid-area: ctx;
  display: none;
  align-self: start;
  position: sticky;
  top: 10px;
  flex-direction: column;
  gap: 8px;
  padding: 12px 11px;
  border-radius: 5px;
  background: linear-gradient(165deg, #4a4030 0%, #2e2820 55%, #241f18 100%);
  border: 1px solid rgba(201, 169, 79, 0.42);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 248, 230, 0.08);
  color: #f5f1e3;
}
.daypanel-day {
  font-family: "Cinzel", serif;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 1px;
  text-transform: uppercase;
  line-height: 1.15;
  color: #fff8ec;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.daypanel-phase {
  font-family: "IM Fell English", serif;
  font-style: italic;
  font-size: 16px;
  line-height: 1.35;
  color: #d9c79a;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(201, 169, 79, 0.28);
}
.daypanel-time {
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.8px;
  color: #e8d4a8;
}
.daypanel-task {
  margin-top: 2px;
  padding: 8px 10px;
  border-radius: 5px;
  font-family: "Cinzel", serif;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: none;
  line-height: 1.2;
  text-align: center;
  color: #fff6e8;
  background: linear-gradient(135deg, #9a3828, #6e2218);
  border: 1px solid rgba(110, 34, 24, 0.85);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
}
.app.has-daypanel:not(.prologue) .daypanel {
  display: flex;
}

.topbar { grid-area: top; display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.logo {
  font-family: "Cinzel", serif; font-weight: 800; font-size: 23px; letter-spacing: 1px;
  color: #efe3c6; text-shadow: 0 2px 10px rgba(0,0,0,0.7);
}
.logo span { color: var(--gold-hi); }
.daytag { margin-left: auto; text-align: right; line-height: 1.2; }
.daytag-day { display: block; font-family: "Cinzel", serif; font-weight: 700; font-size: 15px; letter-spacing: 0.5px; color: #efe3c6; text-shadow: 0 2px 8px rgba(0,0,0,0.7); }
.daytag-phase { display: block; font-family: "IM Fell English", serif; font-style: italic; font-size: 13px; color: #d9c79a; text-shadow: 0 1px 6px rgba(0,0,0,0.7); }

.btn {
  font-family: "Cinzel", serif; font-size: 12px; font-weight: 600; letter-spacing: 0.5px;
  color: #efe3c6; background: rgba(40, 28, 14, 0.6);
  border: 1px solid var(--gold); padding: 8px 13px; border-radius: 4px; cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}
.btn:hover { transform: translateY(-1px); background: rgba(60, 42, 20, 0.75); box-shadow: 0 0 14px rgba(201,169,79,0.4); }
.btn:active { transform: translateY(0); }
.btn-ghost { background: rgba(30, 20, 10, 0.5); }
#music-btn { min-width: 92px; }

/* ---------------------------------------------------------------- */
/* The week is the dungeon — chamber strip                          */
/* ---------------------------------------------------------------- */
.weekmap {
  grid-area: week;
  display: flex; align-items: center; justify-content: stretch; gap: 0;
  width: 100%; max-width: 100%; margin: 0 auto 6px;
  padding: 8px 14px; border-radius: 6px;
  background: linear-gradient(180deg, rgba(26,18,8,0.75), rgba(14,9,4,0.75));
  border: 1px solid rgba(156,122,47,0.45);
  box-shadow: inset 0 0 24px rgba(0,0,0,0.6);
}
.weekmap:empty { display: none; }
.chamber {
  position: relative; flex: 1 1 0; min-width: 0;
  text-align: center; padding: 4px 2px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.chamber + .chamber::before {
  content: ""; position: absolute; left: -50%; top: 20px; width: 100%; height: 2px;
  background: repeating-linear-gradient(90deg, rgba(156,122,47,0.5) 0 5px, transparent 5px 9px);
  z-index: 0;
}
.chamber-node {
  position: relative; z-index: 1;
  width: 30px; height: 30px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-family: "Cinzel", serif; font-weight: 700; font-size: 13px;
  color: #7a6338; background: #241a0d;
  border: 1.5px solid rgba(156,122,47,0.5);
  transform: rotate(45deg);
}
.chamber-node span { transform: rotate(-45deg); }
.chamber.done .chamber-node { color: #1a130a; background: linear-gradient(135deg, #c9a94f, #9c7a2f); border-color: var(--gold-hi); }
.chamber.current .chamber-node { color: #f3e8ca; background: #3a2a12; border-color: var(--gold-hi); box-shadow: 0 0 0 2px rgba(201,169,79,0.4), 0 0 16px rgba(201,169,79,0.6); animation: chamberglow 2s ease-in-out infinite; }
.chamber.boss .chamber-node {
  border-color: #c44a3a; border-width: 2px; color: #e7b6a0;
  background: #2a1210;
  box-shadow: 0 0 0 1px rgba(196,74,58,0.55), 0 0 12px rgba(140,47,36,0.45);
}
.chamber.boss .chamber-label { color: #d47368; }
.chamber.boss.current .chamber-node {
  box-shadow: 0 0 0 2px rgba(196,74,58,0.75), 0 0 18px rgba(140,47,36,0.85);
  animation: bossglow 2s ease-in-out infinite;
}
.chamber.boss.done .chamber-node { background: linear-gradient(135deg, #b3503f, #8c2f24); color: #f3e0d6; border-color: #c44a3a; }
@keyframes bossglow { 0%,100%{ filter: brightness(1); } 50%{ filter: brightness(1.2); } }
.chamber-label { font-family: "Cinzel", serif; font-size: 10px; letter-spacing: 0.5px; text-transform: uppercase; color: #c2a970; }
.chamber.current .chamber-label { color: var(--gold-hi); }
.chamber-note { font-family: "IM Fell English", serif; font-style: italic; font-size: 10.5px; color: #a58d5c; line-height: 1.2; }
.chamber-note:empty { display: none; }
@keyframes chamberglow { 0%,100%{ filter: brightness(1); } 50%{ filter: brightness(1.25); } }

/* ---------------------------------------------------------------- */
/* Stage / parchment cards                                          */
/* ---------------------------------------------------------------- */
.stage { grid-area: stage; min-width: 0; display: flex; flex-direction: column; justify-content: flex-start; align-self: start; }

.card {
  position: relative;
  background:
    radial-gradient(120% 80% at 15% 10%, rgba(255,250,235,0.5), transparent 45%),
    radial-gradient(100% 90% at 90% 90%, rgba(150,120,70,0.18), transparent 50%),
    linear-gradient(160deg, var(--parch-hi) 0%, var(--parch) 45%, var(--parch-lo) 100%);
  color: var(--ink);
  border: 1px solid #7a5d2c;
  border-radius: 5px;
  padding: 22px 22px 18px;
  box-shadow: var(--shadow), inset 0 0 0 2px rgba(120,92,46,0.25), inset 0 0 60px rgba(120,92,46,0.14);
  animation: rise 0.5s cubic-bezier(0.2, 0.9, 0.2, 1);
}
/* corner flourish frame */
.card::before {
  content: ""; position: absolute; inset: 8px; border: 1px solid rgba(120,92,46,0.35); border-radius: 3px; pointer-events: none;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.99); } to { opacity: 1; transform: none; } }

.locbadge {
  display: inline-block;
  font-family: "Cinzel", serif; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px;
  color: #5a4321; background: rgba(156,122,47,0.16);
  border: 1px solid rgba(120,92,46,0.45); padding: 6px 12px; border-radius: 4px; margin-bottom: 16px;
}
/* legacy: evtcount no longer used in locbadge (moved to daypanel) */
.locbadge .evtcount { display: none; }

.scene-title {
  font-family: "Cinzel", serif; font-weight: 700; font-size: 25px; line-height: 1.18;
  margin-bottom: 12px; color: #2a1d0e;
}
.scene-text { font-family: "EB Garamond", serif; font-size: 18px; line-height: 1.5; color: #2c2013; margin-bottom: 10px; max-width: none; }
.scene-text:last-of-type { margin-bottom: 0; }
.scene-text.dialogue { font-family: "IM Fell English", serif; font-style: italic; color: #442915; }
.scene-text.dialogue::before { content: "\201C"; }
.scene-text.dialogue::after { content: "\201D"; }
.speaker-label {
  font-family: "EB Garamond", serif;
  font-size: 12px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase;
  color: #9a7b3a;
  margin: 6px 0 1px;
}
.speaker-label + .scene-text.dialogue { margin-top: 0; }
/* The "who it's from" line that opens a character prompt */
.scene-from { font-size: 13.5px; letter-spacing: 1.4px; color: #7c5d20; margin: 14px 0 5px; }

/* Choices — stacked vertically; grow to fill the card during play */
.choices { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.stage .choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-content: stretch;
}
.choice {
  position: relative; text-align: left; width: 100%;
  background: linear-gradient(180deg, rgba(255,251,238,0.6), rgba(216,193,145,0.5));
  border: 1px solid #9c7a3f; border-left: 4px solid var(--gold);
  border-radius: var(--r-sm); padding: 13px 16px;
  color: #2c2015; font-family: "EB Garamond", serif; font-size: 16px; font-weight: 500; line-height: 1.35;
  cursor: pointer; transition: transform 0.12s ease, background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.choice:hover { transform: translateX(4px); border-left-color: var(--wine); background: linear-gradient(180deg, rgba(255,251,238,0.85), rgba(224,203,158,0.7)); box-shadow: 0 6px 18px rgba(0,0,0,0.3); }
.choice .c-text { flex: 1; min-width: 60%; }

.fx { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-left: 6px; }
.fx-badge { font-family: "Cinzel", serif; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 3px; }
.fx-up { background: rgba(79,107,47,0.2); color: #3c541f; }
.fx-down { background: rgba(140,47,36,0.16); color: #7c2b23; }

.continue-btn { margin-top: 20px; border-left-color: var(--gold); }

.choice.locked { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.3); }
.choice.locked:hover { transform: none; box-shadow: none; border-left-color: var(--gold); }
.choice-req {
  margin-left: auto; font-family: "Cinzel", serif; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 3px 8px; border-radius: 3px; white-space: nowrap;
}
.choice-req.have { background: rgba(79,107,47,0.2); color: #3c541f; }
.choice-req.need { background: rgba(140,47,36,0.16); color: #7c2b23; }

/* Saturday endgame board */
.eg-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.eg-row {
  display: flex; align-items: flex-start; gap: 12px;
  background: linear-gradient(180deg, rgba(255,251,238,0.5), rgba(216,193,145,0.4));
  border: 1px solid #9c7a3f; border-radius: 4px; padding: 13px 15px;
}
.eg-info { flex: 1; min-width: 0; }
.eg-name { font-family: "Cinzel", serif; font-weight: 700; font-size: 19px; color: #2a1d0e; }
.eg-sub { font-family: "IM Fell English", serif; font-style: italic; font-size: 15px; color: var(--muted); margin-top: 2px; }
.btn-play {
  font-family: "Cinzel", serif; background: linear-gradient(135deg, #b3893f, #8c6a24); color: #1a130a; border: 1px solid var(--gold-hi);
  font-weight: 700; padding: 9px 18px; white-space: nowrap; border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}
/* Saturday board: 2x2 grid of the four journeys */
.eg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
.eg-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 8px; min-height: 150px; padding: 18px 16px; border-radius: 6px;
  background: linear-gradient(180deg, rgba(255,251,238,0.55), rgba(216,193,145,0.42));
  border: 1px solid #9c7a3f;
}
.eg-tile .eg-tname { font-family: "Cinzel", serif; font-weight: 800; font-size: 18px; color: #2a1d0e; }
.eg-tile .eg-tsub { font-family: "IM Fell English", serif; font-style: italic; font-size: 13.5px; color: var(--muted); max-width: 220px; }
.eg-tile.ready { box-shadow: 0 0 20px rgba(201,169,79,0.28), inset 0 0 24px rgba(201,169,79,0.1); }
.eg-tile.won { border-color: var(--moss, #6b8e4e); background: linear-gradient(180deg, rgba(230,240,210,0.6), rgba(180,200,150,0.4)); }
.eg-tile.missed { border-color: var(--wine, #8c4a3f); }
.eg-status { font-family: "Cinzel", serif; font-weight: 700; font-size: 14px; }
.eg-status.win { color: #4d6b30; }
.eg-status.fail { color: #8c4a3f; }
.eg-status.ready { color: #876812; }
/* Locked tile: greyed out with a padlock over it */
.eg-tile.locked {
  background: linear-gradient(180deg, rgba(120,110,92,0.28), rgba(70,62,48,0.34));
  border-color: rgba(120,105,70,0.55); border-style: dashed;
}
.eg-tile.locked .eg-tname { color: #6b6047; }
.eg-lock { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.eg-lock .lockicon { color: #8a7c5c; opacity: 0.85; }
.eg-lock .eg-lockmsg {
  font-family: "Cinzel", serif; font-weight: 700; font-size: 12px; letter-spacing: 0.4px;
  text-transform: uppercase; color: #7a6c4c;
}
.eg-status.locked { color: #7a6c4c; letter-spacing: 0.5px; text-transform: uppercase; font-size: 11.5px; }
/* Per-gate checklist inside each Saturday tile + final week summary */
.eg-check {
  list-style: none; margin: 10px 0 4px; padding: 0;
  display: block; width: 100%; text-align: left;
}
.eg-check li { display: flex; align-items: flex-start; gap: 10px; line-height: 1.45;
  font-family: "EB Garamond", serif; font-size: 17px; font-weight: 500; padding: 3px 0; }
.eg-check li.done { color: #3f5a26; }
.eg-check li.todo { color: #4a3820; }
.eg-check li.done .ck-label { text-decoration: none; }
.eg-check li.todo .ck-label { opacity: 1; }
.eg-check .ck-mark { flex: 0 0 auto; display: inline-flex; margin-top: 3px; }
.eg-check .ck-mark svg { width: 18px; height: 18px; }
.eg-check li.done .ck-mark { color: #5f8043; }
.eg-check li.todo .ck-mark { color: #a58c5c; }
.eg-tile .eg-check { margin-top: 8px; }
.eg-tile .eg-check li { font-size: 15.5px; }
.eg-row .eg-check { margin-top: 8px; }
.eg-row .eg-check li { font-size: 17px; }

.final-title.win { color: var(--moss); }
.final-title.lose { color: var(--wine); }

/* ---------------------------------------------------------------- */
/* Spencer's Great Quest — the pilgrimage map                        */
/* ---------------------------------------------------------------- */
.quest-unlock {
  margin-top: 16px; padding: 16px; border-radius: 6px; text-align: center;
  background: linear-gradient(160deg, rgba(201,169,79,0.22), rgba(90,67,33,0.28));
  border: 1px solid var(--gold-hi); box-shadow: 0 0 26px rgba(201,169,79,0.35), inset 0 0 30px rgba(201,169,79,0.12);
  animation: chamberglow 2.4s ease-in-out infinite;
}
.quest-unlock .qu-eyebrow { font-family: "Cinzel", serif; font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: #7c5d20; }
.quest-unlock .qu-title { font-family: "Cinzel", serif; font-weight: 800; font-size: 22px; color: #2a1d0e; margin: 4px 0 6px; }
.quest-unlock .qu-sub { font-family: "IM Fell English", serif; font-style: italic; font-size: 15px; color: #4a3820; margin-bottom: 12px; }

.questmap {
  display: flex; align-items: stretch; gap: 0; margin: 4px 0 16px;
  padding: 10px 12px; border-radius: 6px;
  background: linear-gradient(180deg, rgba(26,18,8,0.7), rgba(14,9,4,0.7));
  border: 1px solid rgba(156,122,47,0.45); box-shadow: inset 0 0 24px rgba(0,0,0,0.6);
}
.qstation { position: relative; flex: 1; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 2px; }
.qstation + .qstation::before {
  content: ""; position: absolute; left: -50%; top: 14px; width: 100%; height: 2px;
  background: repeating-linear-gradient(90deg, rgba(156,122,47,0.5) 0 5px, transparent 5px 9px); z-index: 0;
}
.qnode {
  position: relative; z-index: 1; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: "Cinzel", serif; font-weight: 700; font-size: 12px;
  color: #7a6338; background: #241a0d; border: 1.5px solid rgba(156,122,47,0.5);
}
.qstation.pass .qnode { background: linear-gradient(135deg, #9bbf6a, #5f7c33); color: #12180a; border-color: #a9c97f; }
.qstation.fail .qnode { background: linear-gradient(135deg, #b3503f, #7c2b23); color: #f3e0d6; border-color: var(--wine); }
.qstation.current .qnode {
  color: #f3e8ca; background: #3a2a12; border-color: var(--gold-hi);
  box-shadow: 0 0 0 2px rgba(201,169,79,0.4), 0 0 16px rgba(201,169,79,0.6);
  animation: chamberglow 2s ease-in-out infinite;
}
.qlabel { font-family: "Cinzel", serif; font-size: 10px; letter-spacing: 0.4px; text-transform: uppercase; color: #c2a970; line-height: 1.2; min-height: 22px; }
.qstation.current .qlabel { color: var(--gold-hi); }

.quest-kind { display: inline-block; font-family: "Cinzel", serif; font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: #7c5d20; background: rgba(156,122,47,0.16); border: 1px solid rgba(120,92,46,0.4); padding: 3px 10px; border-radius: 3px; margin-bottom: 10px; }
.quest-arrive { font-family: "IM Fell English", serif; font-style: italic; font-size: 17px; color: #4a3820; margin: 4px 0 14px; }
.quest-q { font-family: "Cinzel", serif; font-weight: 700; font-size: 20px; color: #2a1d0e; margin: 4px 0 2px; line-height: 1.3; }
.quest-verdict { font-family: "Cinzel", serif; font-weight: 700; font-size: 21px; margin: 6px 0 4px; }
.quest-verdict.right { color: var(--moss); }
.quest-verdict.wrong { color: var(--wine); }
.quest-grace { font-family: "Cinzel", serif; font-size: 12px; letter-spacing: 0.5px; color: #7c5d20; margin-top: 8px; }
.kiss-img {
  display: block; margin: 14px auto 4px; max-width: 300px; width: 78%; height: auto;
  border-radius: 8px; border: 3px solid var(--gold-hi);
  box-shadow: 0 0 30px rgba(201,169,79,0.5), 0 10px 30px rgba(0,0,0,0.5);
}
.kiss-img.img-missing { display: none; }

/* ---------------------------------------------------------------- */
/* Mode picker (start screen): Regular vs Impossible                 */
/* ---------------------------------------------------------------- */
.mode-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; text-align: left; }
.mode-card {
  display: flex; flex-direction: column; gap: 8px; cursor: pointer;
  padding: 18px 16px; border-radius: var(--r-lg);
  /* Solid dark fill so the light text stays high-contrast over the parchment card */
  background: linear-gradient(180deg, #2c1e0e, #1a1206);
  border: 1px solid rgba(201,169,79,0.55);
  box-shadow: inset 0 0 22px rgba(0,0,0,0.4);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
.mode-card:hover { transform: translateY(-3px); border-color: var(--gold-hi); box-shadow: 0 10px 26px rgba(0,0,0,0.45), inset 0 0 24px rgba(201,169,79,0.14); }
.mode-card.impossible {
  background: linear-gradient(180deg, #45151f, #2a0f16);
  border-color: rgba(180,80,90,0.7);
}
.mode-card.impossible:hover { border-color: #c96a5e; box-shadow: 0 10px 26px rgba(0,0,0,0.45), inset 0 0 24px rgba(160,70,80,0.22); }
.mode-name { font-family: "Cinzel", serif; font-weight: 800; font-size: 19px; color: #f1e3bf; }
.mode-card.impossible .mode-name { color: #f2cabf; }
.mode-desc { font-family: "EB Garamond", serif; font-size: 14.5px; line-height: 1.45; color: #e0d2ac; }
.mode-goal { margin-top: auto; font-family: "Cinzel", serif; font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: #d3b26e; }
.mode-card.impossible .mode-goal { color: #dda6a0; }

@media (max-width: 640px) {
  .mode-picker { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- */
/* Dissolve-to-black transition + Monk Spencer's arrival             */
/* ---------------------------------------------------------------- */
.dissolve {
  position: fixed; inset: 0; z-index: 9000; background: #000;
  opacity: 0; pointer-events: none; transition: opacity 0.7s ease;
}
.dissolve.on { opacity: 1; pointer-events: all; }

/* Monk Spencer pops into view whenever he appears */
@keyframes monkPop {
  0% { opacity: 0; transform: translateY(26px) scale(0.62); }
  62% { opacity: 1; transform: translateY(-5px) scale(1.07); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.monk-scene .monk-avatar { animation: monkPop 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both; }

/* End-of-week nudge to try again and unlock everything */
.retry-note {
  margin: 18px auto 0; max-width: 560px; padding: 14px 16px; border-radius: 6px;
  font-family: "EB Garamond", serif; font-size: 15px; line-height: 1.5; color: #4a3820;
  background: linear-gradient(180deg, rgba(201,169,79,0.16), rgba(90,67,33,0.12));
  border: 1px solid rgba(156,122,47,0.5);
}
.retry-note b { color: #2a1d0e; font-weight: 700; }
.retry-note.alert {
  background: linear-gradient(180deg, rgba(124,47,47,0.16), rgba(90,30,30,0.12));
  border-color: rgba(160,70,80,0.5); color: #5a2a2a;
}
.retry-note.alert b { color: #3a1414; }

/* Saturday gate reveal: each row fades/slides in one at a time */
.reveal-pending { opacity: 0; transform: translateY(10px); pointer-events: none; }
.reveal-pending.revealed {
  opacity: 1; transform: translateY(0); pointer-events: auto;
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.2,0.8,0.2,1);
}

/* The Week Remembers: running-gag payoffs on the final screen */
.gag-ledger {
  margin: 18px auto 0; max-width: 560px; text-align: left; padding: 14px 18px; border-radius: 6px;
  background: linear-gradient(180deg, rgba(40,28,14,0.5), rgba(26,18,9,0.5));
  border: 1px solid rgba(156,122,47,0.45);
}
.gag-ledger-title {
  font-family: "Cinzel", serif; font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: #c9a94f; text-align: center; margin-bottom: 8px;
}
.gag-ledger ul { margin: 0; padding-left: 18px; }
.gag-ledger li {
  font-family: "EB Garamond", serif; font-size: 14.5px; line-height: 1.5; color: #e6d6b0;
  margin-bottom: 7px;
}
.gag-ledger li:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------- */
/* Monk Spencer                                                     */
/* ---------------------------------------------------------------- */
.monk-scene { display: flex; gap: 16px; align-items: flex-start; }
.monk-avatar {
  width: 92px; height: 92px; flex: none; border-radius: 6px; object-fit: cover;
  border: 2px solid var(--gold); box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 18px rgba(201,169,79,0.35);
  background: radial-gradient(circle at 50% 40%, #3a2a12, #1b1108);
}
.monk-avatar.img-missing::after { content: "Monk"; font-family: "Cinzel", serif; font-size: 12px; font-weight: 700; color: var(--gold-hi); }
.monk-bubble { flex: 1; }
.monk-name {
  font-family: "Cinzel", serif; font-weight: 700; font-size: 15px; color: #7c5d20;
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px;
}
.monk-name span { font-family: "IM Fell English", serif; font-style: italic; font-weight: 400; font-size: 12px; color: var(--muted); }

.monk-ask {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 6px;
  font-family: "Cinzel", serif; font-weight: 600; font-size: 12px; letter-spacing: 0.5px;
  color: #1a130a; background: linear-gradient(135deg, #c9a94f, #9c7a2f);
  border: 1px solid var(--gold-hi); border-radius: 4px; padding: 9px 14px; cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
  transition: transform 0.12s ease, filter 0.2s ease;
}
.monk-ask:hover { transform: translateY(-1px); filter: brightness(1.08); }
.monk-ask:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.5); }
.monk-ask .monk-mini { width: 22px; height: 22px; border-radius: 4px; object-fit: cover; border: 1px solid #1a130a; }

/* Intro: compact meter preview + bullet explanations */
.meter-intro-wrap { margin: 10px 0 12px; }
.meter-intro-bars {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
  padding: 10px 12px; border-radius: 5px;
  background: linear-gradient(180deg, rgba(30,20,10,0.94), rgba(16,10,5,0.97));
  border: 1px solid rgba(201,169,79,0.45);
  box-shadow: inset 0 1px 0 rgba(255,248,230,0.06), 0 6px 18px rgba(0,0,0,0.35);
}
.meter-intro-cell { min-width: 0; }
.meter-intro-top {
  display: flex; align-items: baseline; justify-content: space-between; gap: 4px;
  margin-bottom: 4px;
}
.meter-intro-name {
  font-family: "Cinzel", serif; font-size: 9px; font-weight: 700;
  letter-spacing: 0.6px; text-transform: uppercase; color: #d9c79a;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.meter-intro-num {
  font-family: "Cinzel", serif; font-size: 13px; font-weight: 700; color: #f3e8ca; line-height: 1;
}
.meter-intro-bar { height: 8px; }
.meter-intro-list {
  list-style: none; margin: 12px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.meter-intro-list li {
  position: relative; padding-left: 1.1em;
  font-family: "IM Fell English", serif; font-style: italic;
  font-size: 17px; line-height: 1.45; color: #442915;
}
.meter-intro-list li::before {
  content: "\2022"; position: absolute; left: 0; top: 0.05em;
  font-style: normal; color: #9c7a2f; font-weight: 700;
}
.meter-intro-list li strong {
  font-family: "Cinzel", serif; font-style: normal; font-weight: 700;
  color: #2a1d0e; letter-spacing: 0.3px;
}
.app.prologue .meter-intro-list li { font-size: 18px; }
.app.prologue .meter-intro-bars { padding: 12px 14px; gap: 10px; }
.app.prologue .meter-intro-name { font-size: 10px; }
.app.prologue .meter-intro-num { font-size: 15px; }
.app.prologue .meter-intro-bar { height: 9px; }

/* Modals (shared) */
.monk-modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 22px; background: rgba(10,6,2,0.72); backdrop-filter: blur(3px); animation: rise 0.25s ease; }
.monk-modal[hidden] { display: none; }
.monk-modal-inner { display: flex; gap: 16px; max-width: 480px; background: linear-gradient(160deg, var(--parch-hi), var(--parch-lo)); border-radius: 5px; padding: 24px; box-shadow: var(--shadow); border: 1px solid #7a5d2c; }
.monk-modal-avatar { width: 84px; height: 84px; border-radius: 5px; object-fit: cover; border: 2px solid var(--gold); flex: none; }
.monk-modal-name { font-family: "Cinzel", serif; font-weight: 700; color: #7c5d20; margin-bottom: 6px; }
.monk-modal-name span { font-family: "IM Fell English", serif; font-style: italic; font-weight: 400; font-size: 12px; color: var(--muted); }
.monk-modal-text { font-family: "EB Garamond", serif; font-size: 16px; color: var(--ink); margin-bottom: 14px; line-height: 1.5; }
.btn-monk { font-family: "Cinzel", serif; background: linear-gradient(135deg, #c9a94f, #9c7a2f); color: #1a130a; border: 1px solid var(--gold-hi); }

/* Bonds modal */
.bonds-inner {
  width: 100%; max-width: 460px; background: linear-gradient(160deg, var(--parch-hi), var(--parch-lo));
  border-radius: 5px; padding: 24px; box-shadow: var(--shadow); border: 1px solid #7a5d2c; text-align: center;
}
.bonds-title { font-family: "Cinzel", serif; font-weight: 800; font-size: 22px; color: #2a1d0e; letter-spacing: 0.5px; }
.bonds-sub { font-family: "IM Fell English", serif; font-style: italic; color: var(--muted); font-size: 14px; margin: 4px 0 16px; }
.bonds-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; text-align: left; }
.bond-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.bond-name { font-family: "Cinzel", serif; font-weight: 700; font-size: 15px; color: #2a1d0e; }
.bond-role { font-family: "IM Fell English", serif; font-style: italic; font-size: 12px; color: var(--muted); margin-left: 6px; }
.bond-tier { font-family: "Cinzel", serif; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gold); }
.bond-bar { height: 10px; border-radius: 3px; background: #3a2a14; overflow: hidden; border: 1px solid rgba(120,92,46,0.5); }
.bond-fill { height: 100%; background: linear-gradient(90deg, #b3893f, #c9a94f); transition: width 0.6s cubic-bezier(0.2,0.8,0.2,1); }

/* ---------------------------------------------------------------- */
/* Meters — carved into a wooden ledger                             */
/* ---------------------------------------------------------------- */
.meters {
  position: fixed; z-index: 30;
  left: 50%; transform: translateX(-50%);
  bottom: var(--meter-lift);
  width: min(1240px, calc(100% - 24px));
  display: flex; align-items: flex-end; justify-content: flex-start; gap: 18px;
  padding: 14px 22px 20px;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(30,20,10,0.96), rgba(16,10,5,0.98));
  border: 2px solid var(--gold); border-radius: 6px;
  box-shadow: 0 -12px 34px rgba(0,0,0,0.6), 0 8px 28px rgba(0,0,0,0.45);
}
.app.prologue .meters {
  width: min(920px, calc(100% - 24px));
  gap: 16px;
}
.player-portrait {
  flex: 0 0 auto; margin: 0; padding: 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 76px;
}
.player-photo {
  display: block; width: 72px; height: 72px; object-fit: cover; object-position: center 18%;
  border-radius: 6px; border: 2px solid var(--gold-hi);
  box-shadow: 0 4px 14px rgba(0,0,0,0.55), inset 0 0 0 1px rgba(255,251,238,0.12);
  background: #2a1d0d;
}
.player-photo.img-missing { opacity: 0.35; }
.player-name {
  font-family: "Cinzel", serif; font-size: 10px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase; color: #d9c79a;
  text-align: center; line-height: 1.1;
}
.meters-grid {
  flex: 1 1 auto; min-width: 0; width: 100%;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px;
}
.meter { min-width: 0; width: 100%; text-align: center; }
.meter-top { display: flex; flex-direction: column; align-items: center; gap: 3px; margin-bottom: 11px; }
.meter-name { font-family: "Cinzel", serif; font-size: 13px; font-weight: 600; color: #d9c79a; text-transform: uppercase; letter-spacing: 0.9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.meter-num { font-family: "Cinzel", serif; font-size: 28px; font-weight: 700; line-height: 1; color: #f3e8ca; text-shadow: 0 1px 3px rgba(0,0,0,0.7); }
.bar { position: relative; height: 12px; width: 100%; border-radius: 3px; background: #2a1d0d; overflow: hidden; border: 1px solid rgba(120,92,46,0.5); box-shadow: inset 0 2px 4px rgba(0,0,0,0.6); }
.bar-fill { height: 100%; width: 50%; border-radius: 2px; transition: width 0.6s cubic-bezier(0.2,0.8,0.2,1); box-shadow: 0 0 8px rgba(201,169,79,0.3) inset; }
/* End-of-week benchmark tick: where a well-played week wants this stat by Saturday.
   Green once the goal is met; the Fruitiness line is a red "stay under" ceiling. */
.bar-target { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #f3e8ca; box-shadow: 0 0 3px rgba(0,0,0,0.9); opacity: 0.9; z-index: 2; }
.bar-target.met { background: #7bd88f; opacity: 1; }
.bar-target.danger, .bar-target.danger.met { background: #e0736a; }
.fill-fruitiness { background: linear-gradient(90deg, #7c2b23, var(--c-fruitiness)); }
.fill-fun { background: linear-gradient(90deg, #8a6420, var(--c-fun)); }
.fill-money { background: linear-gradient(90deg, #6e5320, var(--c-money)); }
.fill-charisma { background: linear-gradient(90deg, #453766, var(--c-charisma)); }
.meter.bump .bar-fill { animation: bump 0.6s ease; }
@keyframes bump { 0%,100%{filter:none;} 40%{filter:brightness(1.5) saturate(1.4);} }
.meter.bump { animation: meterpop 0.6s ease; }
@keyframes meterpop { 0%,100%{transform:none;} 35%{transform:translateY(-4px);} }
.meter.bump .meter-num { animation: numpop 0.6s ease; }
@keyframes numpop { 0%,100%{transform:none;} 35%{transform:scale(1.4);} }

/* ---------------------------------------------------------------- */
/* Start / summary / ending                                         */
/* ---------------------------------------------------------------- */
.center { text-align: center; }
.start-title { font-family: "Cinzel", serif; font-weight: 800; font-size: 38px; color: #2a1d0e; margin-bottom: 8px; letter-spacing: 1px; }
.start-sub { font-family: "IM Fell English", serif; font-style: italic; font-size: 17px; color: #4a3820; margin-bottom: 18px; line-height: 1.5; }
/* Intro: locked Saturday preview board with step-by-step highlights */
.intro-board-wrap { padding-top: 8px; }
.intro-monk-panel {
  display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px;
  padding: 14px 16px; border-radius: 6px;
  background: linear-gradient(160deg, rgba(255,251,238,0.7), rgba(216,193,145,0.35));
  border: 1px solid #9c7a3f;
}
.intro-monk-panel .monk-avatar { width: 72px; height: 72px; flex: 0 0 auto; border-radius: 50%; }
.intro-monk-bubble { flex: 1; min-width: 0; }
.intro-step-title {
  font-family: "Cinzel", serif; font-weight: 800; font-size: 22px; color: #2a1d0e;
  margin: 6px 0 8px; line-height: 1.25;
}
.intro-step-copy {
  font-family: "EB Garamond", serif; font-size: 18px; line-height: 1.5; color: #3a2a14; margin: 0;
}
.intro-eg-grid { margin-top: 6px; }
.intro-board-wrap .eg-tile {
  transition: opacity 0.35s ease, transform 0.35s ease, box-shadow 0.35s ease, filter 0.35s ease;
}
.intro-board-wrap .eg-tile.intro-dim {
  opacity: 0.38; filter: grayscale(0.25) saturate(0.7); transform: scale(0.98);
}
.intro-board-wrap .eg-tile.intro-focus {
  opacity: 1; transform: scale(1.02);
  box-shadow: 0 0 0 3px var(--gold-hi), 0 0 28px rgba(201,169,79,0.42);
  border-color: var(--gold-hi); z-index: 1;
}
.intro-board-wrap .eg-tile.intro-lit {
  opacity: 1; border-color: #9c7a3f;
  box-shadow: 0 0 16px rgba(201,169,79,0.18);
}
.intro-board-wrap .eg-check li { font-size: 15px; }
.intro-board-wrap .eg-tile .eg-status.locked {
  font-size: 11px; letter-spacing: 0.6px; margin-top: 4px;
}

.btn-cta {
  font-family: "Cinzel", serif; font-weight: 700; font-size: 16px; letter-spacing: 0.5px;
  background: linear-gradient(135deg, #c9a94f, #8c6a24); color: #1a130a; border: 1px solid var(--gold-hi);
  padding: 14px 34px; border-radius: 5px; cursor: pointer;
  box-shadow: 0 10px 26px rgba(0,0,0,0.5); transition: transform 0.12s ease, filter 0.2s ease;
}
.btn-cta:hover { transform: translateY(-2px) scale(1.02); filter: brightness(1.06); }

.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 4px; }
.sum-row { display: flex; align-items: center; justify-content: space-between; background: rgba(255,251,238,0.4); border: 1px solid #9c7a3f; border-radius: 4px; padding: 10px 12px; }
.sum-label { font-family: "Cinzel", serif; font-weight: 600; font-size: 13px; display:flex; align-items:center; gap:6px; color: #2a1d0e; }
.sum-delta { font-family: "Cinzel", serif; font-weight: 700; font-size: 15px; line-height: 1.35; text-align: right; max-width: 42%; }
.up { color: var(--moss); }
.down { color: var(--wine); }
.flat { color: var(--muted); }

.boss-banner {
  text-align: center; font-family: "Cinzel", serif; font-weight: 700; letter-spacing: 3px; text-transform: uppercase;
  color: var(--wine); font-size: 12px; margin-bottom: 10px; animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:0.55;} 50%{opacity:1;} }

.final-title { font-family: "Cinzel", serif; font-weight: 800; font-size: 30px; text-align: center; margin-bottom: 6px; color: #2a1d0e; }
.final-tag { font-family: "IM Fell English", serif; font-style: italic; text-align: center; color: var(--muted); margin-bottom: 16px; }
.final-score { font-family: "Cinzel", serif; font-size: 46px; text-align: center; color: var(--gold); margin: 6px 0; }

/* Toast + delta readout */
.toast {
  position: fixed; bottom: calc(var(--meter-bar-h) + var(--meter-lift) + 12px); left: 50%; transform: translateX(-50%) translateY(20px);
  background: linear-gradient(180deg, #241a0c, #14100a); color: #f3e8ca; padding: 11px 18px;
  border-radius: 5px; font-family: "EB Garamond", serif; font-size: 15px; font-weight: 500;
  border: 1px solid var(--gold); opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease; z-index: 60; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.has-chips { padding: 12px 16px; max-width: min(92vw, 540px); }
.toast-say { font-family: "IM Fell English", serif; font-style: italic; font-size: 14px; margin-bottom: 8px; color: #f3e8ca; line-height: 1.4; text-align: center; }
.toast-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.dchip { font-family: "Cinzel", serif; font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 3px; white-space: nowrap; }
.dchip.up { background: rgba(79,107,47,0.3); color: #b7d488; border: 1px solid rgba(79,107,47,0.7); }
.dchip.down { background: rgba(140,47,36,0.3); color: #e7a894; border: 1px solid rgba(140,47,36,0.7); }
.dchip.prog { background: rgba(201,169,79,0.28); color: #e8cf8f; border: 1px solid rgba(201,169,79,0.6); }
.dchip.bond { background: rgba(92,74,122,0.32); color: #cbb8e0; border: 1px solid rgba(92,74,122,0.7); }
.dchip.gate { background: rgba(46,86,92,0.32); color: #9fd6de; border: 1px solid rgba(46,110,120,0.7); }
.dchip.roll { letter-spacing: 0.6px; text-transform: uppercase; }
.dchip.roll.win { background: rgba(201,169,79,0.34); color: #f2dc98; border: 1px solid rgba(201,169,79,0.85); }
.dchip.roll.lose { background: rgba(140,47,36,0.4); color: #f0b19f; border: 1px solid rgba(140,47,36,0.9); }

/* Genie gate tags: which Saturday path a choice feeds (shown after a Monk summon) */
.gate-tag {
  display: inline-block; margin: 5px 5px 0 0; padding: 2px 8px; border-radius: 3px;
  font-family: "Cinzel", serif; font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  background: rgba(46,86,92,0.22); color: #2c5a60; border: 1px solid rgba(46,110,120,0.55);
}

/* ---------------------------------------------------------------- */
/* Side rail — the phone (Sinder) & the book                        */
/* ---------------------------------------------------------------- */
.siderail {
  grid-area: rail; align-self: start; position: sticky; top: 10px; z-index: 10;
  display: flex; flex-direction: column; gap: 10px; width: 100%;
}
.siderail[hidden] { display: none; }
.rail-title {
  font-family: "Cinzel", serif; font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: #b39a67; text-align: center;
  padding-bottom: 4px; border-bottom: 1px solid rgba(156,122,47,0.35);
}
.widget {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 11px 10px 10px; border-radius: 8px; cursor: default;
  background: linear-gradient(180deg, rgba(30,20,10,0.95), rgba(16,10,5,0.97));
  border: 1px solid var(--gold); color: #efe3c6;
  box-shadow: 0 8px 22px rgba(0,0,0,0.5); position: relative;
}
.widget-phone { cursor: pointer; transition: transform 0.12s ease, box-shadow 0.2s ease; }
.widget-phone:hover { transform: translateY(-2px); box-shadow: 0 0 16px rgba(201,169,79,0.5); }
.widget-kind { font-family: "Cinzel", serif; font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--on-dark-dim); }
.widget-glyph { font-size: 26px; color: #d1737b; line-height: 1; }
.widget-val { font-family: "Cinzel", serif; font-size: 11px; color: #f3e8ca; }
.widget-val b { font-size: 14px; }
.widget-badge {
  position: absolute; top: -7px; right: -7px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--wine); color: #fff; border: 1px solid #f3e0d6;
  font-family: "Cinzel", serif; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.widget-phone.alert { animation: phonebuzz 1.1s ease-in-out infinite; border-color: var(--wine); box-shadow: 0 0 18px rgba(140,47,36,0.7); }
@keyframes phonebuzz { 0%,100%{ transform: translateY(0) rotate(0); } 25%{ transform: translateY(-1px) rotate(-3deg);} 75%{ transform: translateY(-1px) rotate(3deg);} }
.book-gauge { width: 100%; height: 12px; border-radius: 6px; background: #2a1d0d; border: 1px solid rgba(120,92,46,0.6); overflow: hidden; }
.book-gauge-fill { width: var(--pct, 0%); height: 100%; background: linear-gradient(90deg, #8a6420, #c9a94f); transition: width 0.6s cubic-bezier(0.2,0.8,0.2,1); }
.widget-book .widget-val { align-self: stretch; text-align: center; }

/* The Crew: the four bonds, always on the right rail */
.rail-bonds {
  display: flex; flex-direction: column; gap: 6px; margin-top: 0;
  padding: 8px 9px; border-radius: 8px;
  background: linear-gradient(180deg, rgba(30,20,10,0.9), rgba(16,10,5,0.95));
  border: 1px solid rgba(156,122,47,0.55);
}
.rail-bonds .rail-title { border-bottom: none; padding-bottom: 2px; }
.railbond-legend { font-family: "IM Fell English", serif; font-style: italic; font-size: 10.5px; color: #b6a074; margin: -2px 0 4px; }
.railbond-row { display: flex; flex-direction: column; gap: 3px; }
.railbond-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.railbond-name { font-family: "Cinzel", serif; font-weight: 700; font-size: 12px; color: #efe3c6; }
.railbond-meta { display: inline-flex; align-items: baseline; gap: 6px; }
.railbond-val { font-family: "Cinzel", serif; font-size: 12px; font-weight: 800; color: #d9c79a; }
.railbond-tier { font-family: "Cinzel", serif; font-size: 9px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--gold); }
.railbond-bar { position: relative; height: 7px; border-radius: 4px; background: #2a1d0d; overflow: hidden; border: 1px solid rgba(120,92,46,0.5); }
.railbond-fill { height: 100%; background: linear-gradient(90deg, #b3893f, #c9a94f); transition: width 0.6s cubic-bezier(0.2,0.8,0.2,1); }
.railbond-tick { position: absolute; top: -1px; bottom: -1px; width: 2px; background: rgba(233,207,143,0.9); box-shadow: 0 0 3px rgba(0,0,0,0.6); }
.railbond-row.attending .railbond-val { color: #b7d492; }
.railbond-row.attending .railbond-fill { background: linear-gradient(90deg, #6b8e4e, #a9c97e); }

/* bond perk pips + unlocked-perk footer */
.railbond-perks { display: inline-flex; gap: 3px; margin-left: 5px; vertical-align: middle; }
.railbond-perks i { width: 6px; height: 6px; border-radius: 50%; background: #4a3a1e; border: 1px solid rgba(120,92,46,0.7); display: inline-block; }
.railbond-perks i.on { background: #e9cf8f; box-shadow: 0 0 4px rgba(233,207,143,0.8); border-color: #e9cf8f; }
.railbond-tick.perk { width: 1px; background: rgba(233,207,143,0.3); box-shadow: none; }
.rail-perks { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(120,92,46,0.35); }
.perkchip { font-family: "Cinzel", serif; font-size: 9px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; color: #1a1206; background: linear-gradient(180deg,#e9cf8f,#c9a94f); border-radius: 4px; padding: 2px 6px; cursor: default; }

/* bond milestone celebration card */
.bondup-banner { font-family: "Cinzel", serif; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; font-size: 12px; text-align: center; color: #1a1206; background: linear-gradient(180deg,#e9cf8f,#c9a94f); border-radius: 6px; padding: 7px 14px; margin: 0 auto 14px; width: fit-content; box-shadow: 0 2px 12px rgba(0,0,0,0.4); }
.bondup-title { text-align: center; }
.perk-unlock { margin-top: 16px; padding: 13px 15px; border-radius: 8px; background: linear-gradient(180deg, rgba(60,45,18,0.92), rgba(30,20,8,0.96)); border: 1px solid rgba(201,169,79,0.6); text-align: center; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 0 18px rgba(201,169,79,0.15); }
.perk-badge { font-family: "Cinzel", serif; font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--gold); }
.perk-name { font-family: "Cinzel", serif; font-size: 19px; font-weight: 800; color: #f3e8ca; }
.perk-desc { font-family: "IM Fell English", serif; font-style: italic; font-size: 13px; color: #d3c19a; }

/* Sinder message modal — a phone screen */
.sinder-inner {
  width: 100%; max-width: 440px; background: linear-gradient(160deg, var(--parch-hi), var(--parch-lo));
  border-radius: 14px; padding: 22px 24px 20px; box-shadow: var(--shadow); border: 2px solid var(--wine);
}
.sinder-head {
  border-bottom: 1px solid rgba(140,47,36,0.35);
  padding-bottom: 10px; margin-bottom: 0;
}
.sinder-app { font-family: "Cinzel", serif; font-weight: 800; letter-spacing: 1.2px; color: var(--wine); font-size: 20px; }
.sinder-profile {
  margin: 14px 0 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(140,47,36,0.28);
}
.sinder-name {
  font-family: "Cinzel", serif; font-weight: 700; font-size: 22px; line-height: 1.25;
  color: #2a1d0e; margin-bottom: 8px;
}
.sinder-bio {
  font-family: "IM Fell English", serif; font-style: italic; font-size: 18px; line-height: 1.48;
  color: #4a3820; margin: 0;
}
.sinder-text {
  font-family: "IM Fell English", serif; font-style: italic; font-size: 19px; line-height: 1.48;
  color: #3a2418; background: rgba(140,47,36,0.1); border: 1px solid rgba(140,47,36,0.3);
  border-radius: 8px; border-bottom-left-radius: 2px; padding: 14px 16px; margin-bottom: 6px;
}
.sinder-inner .choices { margin-top: 14px; gap: 10px; }
.sinder-inner .choice { font-size: 17px; padding: 14px 16px; min-height: 52px; }
.sinder-dismiss { display: block; width: 100%; margin-top: 12px; background: none; border: none; cursor: pointer; font-family: "IM Fell English", serif; font-style: italic; color: var(--muted); font-size: 14px; }
.sinder-dismiss:hover { color: var(--wine); }

/* ---------------------------------------------------------------- */
/* The Sinder date — live conversation                              */
/* ---------------------------------------------------------------- */
.date-vibe { margin: 6px 0 14px; }
.date-vibe-top { display: flex; justify-content: space-between; font-family: "Cinzel", serif; font-size: 12px; font-weight: 600; color: #5a4321; margin-bottom: 4px; }
.date-vibe-note { font-family: "IM Fell English", serif; font-style: italic; font-size: 12px; color: var(--muted); margin-top: 3px; }
.chat-log { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; max-height: 42vh; overflow-y: auto; padding-right: 6px; scrollbar-width: thin; scrollbar-color: rgba(120,92,46,0.6) transparent; }
.chat-log::-webkit-scrollbar, .type-target::-webkit-scrollbar { width: 8px; height: 8px; }
.chat-log::-webkit-scrollbar-track, .type-target::-webkit-scrollbar-track { background: rgba(120,92,46,0.12); border-radius: 8px; }
.chat-log::-webkit-scrollbar-thumb, .type-target::-webkit-scrollbar-thumb { background: rgba(120,92,46,0.55); border-radius: 8px; }
.chat-log::-webkit-scrollbar-thumb:hover, .type-target::-webkit-scrollbar-thumb:hover { background: rgba(120,92,46,0.8); }
.chat-msg { max-width: 82%; padding: 10px 13px; border-radius: 8px; font-size: 16px; line-height: 1.45; }
.chat-maya { align-self: flex-start; background: rgba(140,47,36,0.14); border: 1px solid rgba(140,47,36,0.4); color: #3a2418; font-family: "IM Fell English", serif; font-style: italic; border-bottom-left-radius: 2px; }
.chat-me { align-self: flex-end; background: rgba(156,122,47,0.2); border: 1px solid rgba(156,122,47,0.5); color: #2c2015; border-bottom-right-radius: 2px; }
.chat-name { font-family: "Cinzel", serif; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.7; margin-bottom: 3px; }
.chat-typing { font-family: "IM Fell English", serif; font-style: italic; color: var(--muted); }
.date-input-row { display: flex; gap: 8px; margin-top: 6px; }
.date-input {
  flex: 1; font-family: "EB Garamond", serif; font-size: 16px; color: #2c2015;
  background: rgba(255,251,238,0.7); border: 1px solid #9c7a3f; border-radius: 4px; padding: 11px 13px; resize: none;
}
.date-input:focus { outline: none; border-color: var(--wine); box-shadow: 0 0 0 2px rgba(140,47,36,0.2); }
.date-send { font-family: "Cinzel", serif; font-weight: 700; background: linear-gradient(135deg, #b3503f, #8c2f24); color: #f3e0d6; border: 1px solid var(--wine); border-radius: 4px; padding: 0 18px; cursor: pointer; }
.date-send:disabled { opacity: 0.5; cursor: not-allowed; }
.date-hint { font-family: "IM Fell English", serif; font-style: italic; font-size: 12.5px; color: var(--muted); margin-top: 8px; text-align: center; }

/* The Negotiation: live deal terms HUD */
.nego-terms { margin: 6px 0 14px; }
.nego-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.nego-chip {
  font-family: "Cinzel", serif; font-size: 12px; font-weight: 700; letter-spacing: 0.3px;
  padding: 6px 12px; border-radius: 4px; border: 1px solid #9c7a3f; color: #4a3820;
  background: linear-gradient(180deg, rgba(255,251,238,0.6), rgba(216,193,145,0.4));
}
.nego-chip b { color: #2a1d0e; }
.nego-chip.money { border-color: var(--gold-hi); }
.nego-chip.held { color: #2f4a1e; border-color: #6b8e4e; background: linear-gradient(180deg, rgba(220,235,200,0.7), rgba(170,195,140,0.4)); }
.nego-chip.open { opacity: 0.72; border-style: dashed; }
.nego-mood-top { display: flex; justify-content: space-between; font-family: "Cinzel", serif; font-size: 12px; font-weight: 600; color: #5a4321; margin-bottom: 4px; }

/* Homies Game Night: attendance reveal + scoreboard */
.hn-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.hn-line { font-family: "IM Fell English", serif; font-size: 15px; line-height: 1.4; padding: 9px 13px; border-radius: 5px; border: 1px solid transparent; }
.hn-in { color: #2f4a1e; background: rgba(107,142,78,0.16); border-color: rgba(107,142,78,0.5); }
.hn-out { color: #7a5148; background: rgba(140,47,36,0.1); border-color: rgba(140,47,36,0.35); font-style: italic; }
.hn-score { display: flex; justify-content: space-between; align-items: baseline; font-family: "Cinzel", serif; font-size: 12.5px; font-weight: 600; color: #5a4321; margin: 4px 0 12px; }
.hn-score b { color: #2a1d0e; font-size: 15px; }

.meter-book { display: none; }

@media (max-width: 560px) {
  /* Layout/shell rules live in styles-mobile.css (≤700px). Typography only here. */
  .card { padding: 22px 18px; }
  .locbadge { font-size: 12px; padding: 5px 10px; }
  .scene-title { font-size: 22px; }
  .scene-text { font-size: 17px; line-height: 1.55; }
  .monk-avatar { width: 66px; height: 66px; }
  .monk-scene { gap: 12px; }
  .summary-grid { grid-template-columns: 1fr; }
  .chamber-note { display: none; }
  .eg-grid { grid-template-columns: 1fr; }
}

/* On narrower screens the two-column layout collapses: the rail becomes a
   compact row of widgets sitting above the stage, and choices stack.
   Tablet only — phones use styles-mobile.css (≤700px). */
@media (min-width: 701px) and (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-areas:
      "top"
      "week"
      "rail"
      "stage";
    column-gap: 0;
  }
  .app.has-daypanel {
    grid-template-columns: 1fr;
    grid-template-areas:
      "top"
      "week"
      "rail"
      "ctx"
      "stage";
    column-gap: 0;
  }
  .app.has-daypanel .daypanel {
    margin-right: 0;
    min-height: 0;
    justify-content: flex-start;
  }
  .app.has-daypanel .daypanel-task {
    margin-top: 2px;
  }
  .app.has-daypanel .stage .card {
    min-height: 0;
    height: auto;
  }
  .weekmap { margin-bottom: 12px; }
  .daypanel {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 18px;
    padding: 14px 16px;
    margin-bottom: 4px;
  }
  .daypanel-phase {
    flex: 1 1 140px;
    border-bottom: none;
    padding-bottom: 0;
  }
  .daypanel-task {
    flex: 1 1 100%;
    margin-top: 0;
    font-size: 17px;
  }
  .siderail {
    position: static; top: auto; width: auto; flex-direction: row; flex-wrap: wrap;
    justify-content: flex-end; align-items: stretch; gap: 10px; margin: 0 0 14px;
  }
  .rail-title { display: none; }
  .widget { flex-direction: row; align-items: center; gap: 10px; padding: 9px 14px; }
  .widget-phone { flex: 0 0 auto; }
  .widget-book { flex: 1 1 200px; max-width: 320px; }
  .book-gauge { width: 100%; min-width: 60px; }
  .stage .choices { grid-template-columns: 1fr; }
  .gatenote { display: none; }
  .rail-bonds { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 0; }
  .rail-bonds .rail-title { display: none; }
  .railbond-row { flex: 1 1 120px; min-width: 100px; }
  .eg-grid { gap: 10px; }
  .eg-tile { min-height: 120px; padding: 14px 10px; }
  .eg-tile .eg-tsub { font-size: 12.5px; }
  .eg-tile .eg-check li { font-size: 15px; }
  .eg-row .eg-check li { font-size: 16px; }
  .eg-row { flex-direction: column; gap: 8px; }
  .sum-delta { max-width: none; text-align: left; font-size: 14px; }
  .intro-monk-panel { flex-direction: column; align-items: center; text-align: center; }
  .intro-step-copy { font-size: 16px; }
  .intro-board-wrap .eg-check li { font-size: 14px; }
}

/* ============================================================
 * MINI-GAMES
 * ============================================================ */
.card.mini { text-align: center; }

/* ---- Backflow pressure gauge ---- */
.bf-gauge {
  position: relative;
  height: 46px;
  margin: 22px auto 16px;
  max-width: 460px;
  border: 2px solid var(--gold);
  border-radius: 6px;
  background:
    repeating-linear-gradient(90deg, rgba(120,92,46,0.18) 0 1px, transparent 1px 24px),
    linear-gradient(180deg, #efe0bb, #d8c191);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.25);
  overflow: hidden;
}
.bf-zone {
  position: absolute; top: 0; bottom: 0;
  background: linear-gradient(180deg, rgba(79,107,47,0.85), rgba(79,107,47,0.55));
  border-left: 1px solid rgba(255,255,255,0.35);
  border-right: 1px solid rgba(255,255,255,0.35);
}
.bf-zone::after {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0;
  width: 2px; transform: translateX(-1px);
  background: rgba(243,232,202,0.9);
}
.bf-needle {
  position: absolute; top: -4px; bottom: -4px; width: 4px;
  margin-left: -2px;
  background: var(--wine);
  box-shadow: 0 0 8px rgba(140,47,36,0.9);
  border-radius: 2px;
}
.bf-readout {
  font-family: "IM Fell English", serif;
  font-size: 18px; color: var(--ink);
  min-height: 24px; margin-bottom: 6px;
}
.bf-readout b { color: var(--gold); }

.mini-btn { justify-content: center; font-weight: 700; }

/* ---- Typing sprint ---- */
.type-stats {
  display: flex; justify-content: center; gap: 26px;
  font-family: "Cinzel", serif; font-weight: 700;
  color: var(--gold); font-size: 15px;
  margin: 8px 0 14px; letter-spacing: 0.04em;
}
.type-stats.big { font-size: 20px; margin: 16px 0; }
.type-stats #ty-time { color: var(--wine); }

.type-target {
  text-align: left;
  font-family: "EB Garamond", serif;
  font-size: 20px; line-height: 1.7;
  color: var(--muted-strong);
  background: rgba(243,232,202,0.5);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 14px 16px; margin-bottom: 14px;
  max-height: 220px; overflow: auto;
  user-select: none;
}
.type-target .ty-ok { color: var(--moss); }
.type-target .ty-bad { color: #fff; background: var(--wine); border-radius: 2px; }
.type-target .ty-cur { background: var(--gold-hi); color: var(--ink); border-radius: 2px; }

.type-input {
  width: 100%; box-sizing: border-box;
  font-family: "EB Garamond", serif; font-size: 18px;
  color: var(--ink);
  background: var(--parch-hi);
  border: 2px solid var(--gold);
  border-radius: 6px; padding: 12px 14px;
  outline: none; resize: none;
}
.type-input:focus { box-shadow: 0 0 0 3px rgba(201,169,79,0.25); }
