/* The Way Out — interactive player v1
   Brand: Prezi blue system (no gold). Brand Blue #3377F4 → Deep Blue #2456D8,
   Royal Navy #0F2D5F, Slate Panel #1B2C3E, Cool White #F5F6F8,
   problem red #CD362F, wealth green #5DB44A → #3E7C22. Montserrat. */

@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-v31-latin-700.ttf") format("truetype");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-v31-latin-800.ttf") format("truetype");
  font-weight: 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-v31-latin-800italic.ttf") format("truetype");
  font-weight: 800; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-v31-latin-900italic.ttf") format("truetype");
  font-weight: 900; font-style: italic; font-display: swap;
}

:root {
  --brand: #3377F4;
  --deep: #2456D8;
  --navy: #0F2D5F;
  --slate: #1B2C3E;
  --slate-ribbon: #394553;
  --paper: #F5F6F8;
  --red: #CD362F;
  --green-1: #5DB44A;
  --green-2: #3E7C22;
  --blue-grad: linear-gradient(135deg, #3377F4 0%, #2456D8 100%);
  --green-grad: linear-gradient(135deg, #5DB44A 0%, #3E7C22 100%);
  --bg-grad: linear-gradient(160deg, #0F2D5F 0%, #1B2C3E 90%);
}

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

html, body { height: 100%; }

body {
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg-grad);
  background-attachment: fixed;
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100dvh; display: flex; flex-direction: column; }

.screen { flex: 1; display: flex; flex-direction: column; }
.screen[hidden] { display: none; }

/* ---------- shared ---------- */

.headline {
  font-weight: 900; font-style: italic; text-transform: uppercase;
  letter-spacing: .01em; line-height: 1.05;
  font-size: clamp(2.4rem, 11vw, 4.2rem);
}
.headline .blue { color: var(--brand); }
.headline.small { font-size: clamp(1.5rem, 6.5vw, 2.2rem); }

.tagline { font-size: clamp(1rem, 4.4vw, 1.25rem); font-weight: 700; opacity: .92; }

.btn {
  font-family: inherit; font-weight: 800; border: none; cursor: pointer;
  border-radius: 14px; color: var(--paper); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 14px 22px; font-size: 1.05rem;
  transition: transform .08s ease, filter .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--blue-grad); box-shadow: 0 8px 24px rgba(36, 86, 216, .45); }
.btn-big { font-size: clamp(1.15rem, 5vw, 1.4rem); min-height: 68px; padding: 18px 30px; width: 100%; }
.btn-ghost { background: rgba(245, 246, 248, .08); border: 1px solid rgba(245, 246, 248, .25); font-size: .95rem; min-height: 46px; }
.btn-ghost.small { min-height: 36px; padding: 8px 12px; font-size: .8rem; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.brand-logo { width: min(300px, 68vw); height: auto; }
.brand-logo.small { width: min(210px, 52vw); }
.brand-icon { width: 38px; height: 38px; flex: none; }

/* ---------- start screen ---------- */

#screen-start { align-items: center; justify-content: center; padding: 32px 22px; }
.start-inner { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; max-width: 560px; width: 100%; }
.greeting { font-size: clamp(1.15rem, 5vw, 1.4rem); font-weight: 800; }
.invited-by { font-size: 1rem; font-weight: 700; opacity: .85; }
.start-note { font-size: .9rem; opacity: .7; font-weight: 700; }

/* ---------- player screen ---------- */

#screen-player { padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); gap: 10px; }
.player-top { display: flex; align-items: center; gap: 12px; padding: 2px 4px; }
.progress-wrap { flex: 1; }
.progress-meta { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 700; opacity: .9; margin-bottom: 5px; gap: 10px; }
.sharer-credit { opacity: .75; text-align: right; }
.progress-bar { height: 7px; border-radius: 99px; background: rgba(245, 246, 248, .15); overflow: hidden; }
#progress-fill { height: 100%; width: 0%; background: var(--blue-grad); border-radius: 99px; transition: width .3s ease; }

.stage {
  position: relative; flex: 1; display: flex; align-items: center; justify-content: center;
  background: #000; border-radius: 16px; overflow: hidden; min-height: 0;
}
.stage video { width: 100%; height: 100%; max-height: calc(100dvh - 170px); object-fit: contain; background: #000; display: block; }
/* The rule above (display:block) overrides the UA [hidden] mapping, so the
   hidden preload video needs this explicit guard — same pattern as
   .screen[hidden] / .overlay[hidden]. Without it, #video-preload renders as
   a second flex item beside #video-main, frozen on the next section's first
   frame (split-screen bug found by Rob on his Mac, 22 Nov 2026). */
.stage video[hidden] { display: none; }

.spinner {
  position: absolute; width: 52px; height: 52px; border-radius: 50%;
  border: 5px solid rgba(245, 246, 248, .25); border-top-color: var(--brand);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.player-controls { display: flex; gap: 10px; justify-content: center; }

/* ---------- interaction overlay & cards ---------- */

.overlay {
  position: absolute; inset: 0; overflow-y: auto;
  background: linear-gradient(165deg, rgba(15, 45, 95, .97), rgba(27, 44, 62, .97));
  display: flex; align-items: flex-start; justify-content: center;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  z-index: 5;
}
.overlay[hidden] { display: none; }

.card { width: 100%; max-width: 640px; display: flex; flex-direction: column; gap: 16px; margin: auto 0; }
.card-kicker { font-size: .8rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--brand); }
.card-question {
  font-size: clamp(1.55rem, 6.4vw, 2.3rem); font-weight: 900; font-style: italic;
  line-height: 1.15; text-transform: none;
}
.card-instruction { font-size: 1rem; font-weight: 700; opacity: .85; }
.card-title {
  font-size: clamp(1.4rem, 6vw, 2rem); font-weight: 900; font-style: italic; text-transform: uppercase;
}
.card-title .blue { color: var(--brand); }

.opt-grid { display: flex; flex-direction: column; gap: 12px; }
.opt-row { display: flex; gap: 12px; }
.opt-row .opt-btn { flex: 1; }

.opt-btn {
  font-family: inherit; font-weight: 800; color: var(--paper); cursor: pointer;
  background: var(--slate-ribbon); border: 2px solid rgba(245, 246, 248, .22);
  border-radius: 16px; min-height: 76px; padding: 16px 18px;
  font-size: clamp(1.05rem, 4.8vw, 1.35rem); text-align: center;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: border-color .15s, background .15s, box-shadow .15s, opacity .15s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; width: 100%;
}
.opt-btn .opt-letter {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--blue-grad); display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.05rem;
}
.opt-btn.green { background: var(--green-grad); border-color: transparent; }
.opt-btn.spotlight { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(51, 119, 244, .55), 0 0 26px rgba(51, 119, 244, .5); }
.opt-btn.picked { border-color: var(--brand); background: #2456D8; }
.opt-btn.correct { background: var(--green-grad); border-color: transparent; }
.opt-btn.dim { opacity: .45; }
.opt-btn .rank-badge {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  background: var(--blue-grad); font-size: 1.15rem; font-weight: 900;
  display: inline-flex; align-items: center; justify-content: center;
}
.opt-btn .rank-badge.empty { background: rgba(245, 246, 248, .14); color: transparent; }
.opt-btn .fig { margin-left: auto; font-weight: 900; color: #9DBEFF; white-space: nowrap; }
.opt-btn .fig-note { display: block; font-size: .78rem; font-weight: 700; opacity: .8; }
.opt-btn .opt-main { flex: 1; text-align: left; }
.opt-btn.center .opt-main { text-align: center; }

.validation {
  background: rgba(51, 119, 244, .14); border: 1px solid rgba(51, 119, 244, .45);
  border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 10px;
}
.validation[hidden] { display: none; }
.validation-text { font-size: clamp(1.02rem, 4.6vw, 1.2rem); font-weight: 700; line-height: 1.45; }
.validation-headline { font-size: clamp(1.3rem, 5.6vw, 1.7rem); font-weight: 900; font-style: italic; }
.todo-badge {
  display: inline-block; font-size: .68rem; font-weight: 800; letter-spacing: .08em;
  background: var(--red); color: #fff; border-radius: 6px; padding: 2px 7px; vertical-align: middle;
}
.reveal-list { list-style: none; display: flex; flex-direction: column; gap: 7px; font-weight: 700; }
.reveal-list li { display: flex; justify-content: space-between; gap: 12px; }
.reveal-list .amt { color: #9DBEFF; font-weight: 900; white-space: nowrap; }

.response-rows { display: flex; flex-direction: column; gap: 12px; }
.response-row { background: rgba(245, 246, 248, .06); border: 2px solid rgba(245, 246, 248, .14); border-radius: 16px; padding: 16px; }
.response-row.picked { border-color: var(--brand); background: rgba(51, 119, 244, .16); }
.response-row h3 { font-size: 1rem; letter-spacing: .1em; margin-bottom: 6px; color: #9DBEFF; }
.response-row p { font-weight: 700; line-height: 1.5; font-size: 1rem; }

.rows-reveal { display: flex; flex-direction: column; gap: 10px; }
.rows-reveal .ry-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  background: rgba(245, 246, 248, .06); border-radius: 12px; padding: 14px 16px; font-weight: 800;
}
.rows-reveal .ry-row .amt { font-size: 1.25rem; font-weight: 900; }
.rows-reveal .ry-row.short .amt { color: #FF9D97; }
.rows-reveal .need-row { border: 1px solid rgba(51, 119, 244, .5); }
.credit-line { font-size: .78rem; opacity: .7; font-weight: 700; line-height: 1.5; }

.career-select {
  width: 100%; font-family: inherit; font-size: 1.05rem; font-weight: 800;
  background: rgba(0, 0, 0, .35); color: var(--paper); border: 1px solid rgba(245, 246, 248, .3);
  border-radius: 12px; padding: 14px; min-height: 52px; appearance: none;
}
.career-panel {
  background: rgba(51, 119, 244, .12); border: 1px solid rgba(51, 119, 244, .45);
  border-radius: 16px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px;
}
.career-panel[hidden] { display: none; }
.career-name { font-size: 1.15rem; font-weight: 900; font-style: italic; }
.career-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-weight: 800; }
.career-row .amt { font-size: 1.15rem; font-weight: 900; white-space: nowrap; }
.career-row.short .amt { color: #FF9D97; }
.career-row.clear .amt { color: #8FD07E; }

.calc-rows { display: flex; flex-direction: column; gap: 10px; }
.calc-row { display: flex; align-items: center; gap: 12px; background: rgba(245, 246, 248, .06); border-radius: 12px; padding: 10px 14px; }
.calc-row label { flex: 1; font-weight: 800; font-size: 1rem; }
.calc-row .money { display: flex; align-items: center; gap: 4px; font-weight: 800; }
.calc-row input {
  width: 110px; font-family: inherit; font-size: 1.05rem; font-weight: 800; text-align: right;
  background: rgba(0, 0, 0, .35); color: var(--paper); border: 1px solid rgba(245, 246, 248, .3);
  border-radius: 10px; padding: 10px;
}
.calc-result { background: rgba(93, 180, 74, .14); border: 1px solid rgba(93, 180, 74, .5); border-radius: 16px; padding: 16px 18px; }
.calc-result .big { font-size: clamp(1.5rem, 6.5vw, 2rem); font-weight: 900; }
.calc-result p { font-weight: 700; line-height: 1.5; }

.dream-cat { background: rgba(245, 246, 248, .05); border: 1px solid rgba(245, 246, 248, .14); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.dream-cat h3 { font-size: 1.05rem; letter-spacing: .08em; }
.dream-cat h3 .blue { color: var(--brand); }
.dream-cat .descriptor { font-weight: 700; opacity: .8; font-size: .95rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: inherit; font-weight: 800; font-size: .95rem; cursor: pointer;
  background: var(--slate-ribbon); color: var(--paper); border: 2px solid rgba(245, 246, 248, .2);
  border-radius: 99px; padding: 10px 16px; min-height: 46px;
}
.chip.picked { background: var(--blue-grad); border-color: transparent; }
.dream-cat input[type="text"] {
  font-family: inherit; font-size: 1rem; font-weight: 700; width: 100%;
  background: rgba(0, 0, 0, .35); color: var(--paper); border: 1px solid rgba(245, 246, 248, .3);
  border-radius: 10px; padding: 12px;
}
.skip-link { align-self: flex-end; background: none; border: none; color: var(--paper); opacity: .65; font-family: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; text-decoration: underline; }

/* ---------- dream board (I-10) ---------- */

.subcat-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; }
.subcat-chip {
  flex: none; font-family: inherit; font-weight: 800; font-size: .8rem; cursor: pointer;
  color: var(--paper); background: rgba(0, 0, 0, .35); border: 1px solid rgba(245, 246, 248, .3);
  border-radius: 999px; padding: 8px 13px; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.subcat-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px;
  max-height: 44dvh; overflow-y: auto; padding: 2px;
}
.gallery-item {
  position: relative; padding: 0; cursor: pointer; background: #000; overflow: hidden;
  border: 2px solid rgba(245, 246, 248, .2); border-radius: 12px; aspect-ratio: 4 / 3;
  font-family: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-item .g-label {
  position: absolute; left: 0; right: 0; bottom: 0; text-align: left;
  font-size: .68rem; font-weight: 800; color: var(--paper);
  padding: 12px 7px 5px; background: linear-gradient(transparent, rgba(11, 21, 38, .82));
}
.gallery-item.picked { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(51, 119, 244, .55), 0 0 18px rgba(51, 119, 244, .45); }

.similar-row { display: flex; gap: 8px; align-items: center; overflow-x: auto; padding: 2px 0; }
.similar-row[hidden] { display: none; }
.similar-label { font-size: .8rem; font-weight: 800; opacity: .8; white-space: nowrap; }
.similar-item {
  flex: none; width: 64px; height: 48px; padding: 0; cursor: pointer; background: #000; overflow: hidden;
  border: 2px solid rgba(245, 246, 248, .25); border-radius: 8px; font-family: inherit;
}
.similar-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

.own-row { display: flex; gap: 10px; align-items: stretch; }
.own-row input[type="text"] {
  flex: 1; min-width: 0; font-family: inherit; font-size: 1rem; font-weight: 700;
  background: rgba(0, 0, 0, .35); color: var(--paper); border: 1px solid rgba(245, 246, 248, .3);
  border-radius: 10px; padding: 12px;
}
.own-row .btn { flex: none; }
.pick-status { font-weight: 800; color: #9DBEFF; min-height: 1.25em; font-size: .95rem; }
.step-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.step-nav .skip-link { align-self: center; }

.board-title { line-height: 1.12; }
.board-collage { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 92px; grid-auto-flow: dense; gap: 8px; }
.tile { position: relative; border-radius: 12px; overflow: hidden; background: var(--slate-ribbon); }
.tile.s0 { grid-column: span 2; grid-row: span 2; }
.tile.s1, .tile.s4, .tile.s5 { grid-column: span 2; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-label {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 1px;
  padding: 16px 9px 7px; background: linear-gradient(transparent, rgba(11, 21, 38, .88));
}
.tile-cat { font-size: .62rem; font-weight: 800; letter-spacing: .12em; color: #9DBEFF; }
.tile-pick { font-size: .82rem; font-weight: 800; line-height: 1.25; }
.tile-words { font-size: .74rem; font-weight: 700; font-style: italic; opacity: .92; line-height: 1.3; }
.tile.text-tile { background: var(--blue-grad); display: flex; align-items: center; }
.tile-text { padding: 12px 12px 30px; font-weight: 900; font-style: italic; font-size: 1rem; line-height: 1.3; }
.tile-text.muted { opacity: .55; font-size: .85rem; text-align: center; width: 100%; }
.tile.empty-tile { display: flex; align-items: center; justify-content: center; }
.tile.words-tile { background: var(--slate); border: 1px solid rgba(51, 119, 244, .45); display: flex; align-items: center; justify-content: center; }
.words-text { font-weight: 900; font-style: italic; text-transform: uppercase; font-size: clamp(1rem, 4.6vw, 1.45rem); letter-spacing: .01em; }
.words-text .blue { color: var(--brand); }

.board-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.board-actions .btn { flex: 1 1 42%; }
.textback-note { font-weight: 700; font-size: .92rem; line-height: 1.45; }
.textback-note[hidden] { display: none; }

/* ---------- end screen ---------- */

#screen-end { align-items: center; padding: 30px 20px calc(30px + env(safe-area-inset-bottom)); overflow-y: auto; }
.end-inner { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; max-width: 620px; width: 100%; }
.motto { display: flex; flex-direction: column; gap: 2px; }
.motto div { font-size: clamp(1.6rem, 7.5vw, 2.4rem); font-weight: 900; font-style: italic; text-transform: uppercase; }
.motto .blue { color: var(--brand); }
.recap-list { width: 100%; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.recap-item { background: rgba(245, 246, 248, .06); border-left: 4px solid var(--brand); border-radius: 10px; padding: 13px 15px; font-weight: 700; line-height: 1.5; font-size: .98rem; }
.recap-item .you-said { color: #9DBEFF; font-weight: 900; }
.belief-callback, .joneses { font-size: clamp(1.05rem, 4.8vw, 1.25rem); font-weight: 800; line-height: 1.5; }
.joneses { color: #9DBEFF; }
.cta-note { font-weight: 700; opacity: .85; }
.end-tagline { margin-top: 4px; }

/* ---------- debug panel ---------- */

#debug-panel {
  position: fixed; inset: auto 0 0 0; max-height: 55dvh; z-index: 50;
  background: #0B1526; border-top: 2px solid var(--brand); display: flex; flex-direction: column;
}
#debug-panel[hidden] { display: none; }
.debug-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; flex-wrap: wrap; }
#debug-content { overflow: auto; padding: 0 12px 14px; font-size: .72rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }

@media (min-width: 760px) {
  .opt-grid.two-col { flex-direction: row; flex-wrap: wrap; }
  .opt-grid.two-col .opt-btn { flex: 1 1 calc(50% - 6px); }
}

/* ---- interactive-flow pass (22 Nov 2026): fork + enrollment screen ---- */
.opt-btn .opt-sub { font-size: .82em; font-weight: 600; opacity: .85; line-height: 1.3; display: inline-block; margin-top: 4px; }
.opt-btn.pill-blue { border-color: #3377F4; }
.opt-btn.pill-red { border-color: #CD362F; }
.opt-btn.pill-red.picked { background: #CD362F; border-color: #CD362F; }
.enroll-dream { width: 100%; max-width: 520px; border-radius: 14px; margin: 10px auto 4px; display: block; }
.enroll-h { color: var(--ink); margin: 18px 0 6px; font-size: 1.05rem; }
.enroll-list { text-align: left; margin: 0 auto 4px; max-width: 520px; line-height: 1.5; }
.enroll-line { max-width: 560px; margin: 8px auto; line-height: 1.5; }
#enroll-ids-link { color: var(--brand-light, #9DBEFF); font-weight: 700; }
