/* CIO Circle Asset Allocation Game — tablet-first kiosk styling.
   Warm-heritage brand palette (espresso/cream/bronze). */
:root {
  --espresso: #272019;
  --espresso-2: #322a21;
  --cream: #F4EEE3;
  --ink: #1A1714;
  --taupe: #8A7F6B;
  --sand: #E7DCC9;
  --stone: #C9BBA2;
  --bronze: #9C6F3F;
  --bronze-2: #C08E4F;
  --sage: #5E6B57;
  --danger: #9c4f3f;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "SF Mono", Menlo, monospace;
  --radius: 16px;
  --pad: clamp(20px, 3.5vw, 48px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--sans);
  background-color: var(--espresso);
  /* dim overlay keeps text readable over the engraved texture (absent until generated) */
  background-image: linear-gradient(rgba(39, 32, 25, .86), rgba(39, 32, 25, .94)), url("assets/hero.png");
  background-size: cover;
  background-position: center;
  color: var(--cream);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

#app { position: fixed; inset: 0; }

/* Screen scaffolding -------------------------------------------------------- */
.screen {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  padding: var(--pad);
  opacity: 0;
  transition: opacity .45s ease;
  /* Scroll when a screen's content is taller than the viewport (e.g. the Q3
     reveal on shorter iPads). The inner is centered with margin:auto, which —
     unlike justify-content:center — keeps both ends reachable when scrolling,
     so the continue button can never be stranded off-screen on the kiosk. */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.screen.active { display: flex; opacity: 1; }
.screen-inner {
  margin: auto;
  width: min(920px, 100%);
  display: flex; flex-direction: column; gap: clamp(16px, 2.4vw, 28px);
}

/* Typography ---------------------------------------------------------------- */
h1, h2, h3 { font-family: var(--serif); font-weight: 500; margin: 0; line-height: 1.1; }
h1 { font-size: clamp(34px, 6vw, 64px); }
h2 { font-size: clamp(26px, 4.4vw, 44px); }
h3 { font-size: clamp(19px, 2.8vw, 26px); }
p { font-size: clamp(16px, 2.1vw, 21px); line-height: 1.5; margin: 0; color: var(--sand); }
.eyebrow {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .18em;
  font-size: clamp(11px, 1.5vw, 14px); color: var(--bronze-2);
}
.muted { color: var(--taupe); }
.data { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pos { color: var(--sage); }
.neg { color: var(--danger); }

/* Buttons ------------------------------------------------------------------- */
.btn {
  font-family: var(--sans); font-weight: 600;
  font-size: clamp(16px, 2.2vw, 20px);
  padding: clamp(14px, 1.8vw, 20px) clamp(26px, 3.4vw, 40px);
  border-radius: 999px; border: 1.5px solid transparent;
  cursor: pointer; transition: transform .12s ease, background .2s ease, opacity .2s;
  touch-action: manipulation;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--bronze); color: var(--cream); }
.btn-primary:disabled { background: var(--espresso-2); color: var(--taupe); cursor: default; border-color: var(--taupe); }
.btn-ghost { background: transparent; color: var(--cream); border-color: var(--taupe); }
.btn-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }

/* Logo / attract ------------------------------------------------------------ */
.attract { align-items: center; justify-content: center; text-align: center; cursor: pointer; }
.logo-attract { position: relative; margin: 0 auto clamp(18px, 3vw, 32px); width: clamp(150px, 22vw, 240px); aspect-ratio: 1; display: grid; place-items: center; }
.logo-attract img { width: 86%; height: auto; animation: pulse 2.6s ease-in-out infinite; }
.logo-attract::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1px solid var(--bronze); opacity: .4; animation: ripple 2.8s ease-out infinite; }
.ring {
  width: clamp(120px, 18vw, 200px); aspect-ratio: 1; border-radius: 50%;
  border: 3px solid var(--bronze-2); margin: 0 auto clamp(20px, 3vw, 36px);
  display: grid; place-items: center; position: relative;
  animation: pulse 2.6s ease-in-out infinite;
}
.ring::after {
  content: ""; position: absolute; inset: -14px; border-radius: 50%;
  border: 1px solid var(--bronze); opacity: .4; animation: ripple 2.6s ease-out infinite;
}
.ring span { font-family: var(--serif); font-size: clamp(15px, 2.2vw, 22px); color: var(--cream); line-height: 1; }
@keyframes pulse { 0%,100%{ transform: scale(1);} 50%{ transform: scale(1.03);} }
@keyframes ripple { 0%{ transform: scale(1); opacity:.5;} 100%{ transform: scale(1.25); opacity:0;} }
.tap-hint { margin-top: 14px; font-family: var(--mono); letter-spacing: .12em; color: var(--bronze-2); animation: fade 2s ease-in-out infinite; }
@keyframes fade { 0%,100%{opacity:.4;} 50%{opacity:1;} }

/* Progress ------------------------------------------------------------------ */
.progress { display: flex; gap: 8px; justify-content: center; margin-bottom: 6px; }
.progress i { width: 34px; height: 4px; border-radius: 2px; background: var(--espresso-2); display: block; }
.progress i.done { background: var(--bronze-2); }
.progress i.cur { background: var(--cream); }

/* Cards / lists ------------------------------------------------------------- */
.card {
  background: var(--espresso-2); border: 1px solid #3d342a; border-radius: var(--radius);
  padding: clamp(14px, 1.8vw, 20px);
}
.bench {
  display: flex; align-items: center; gap: 14px;
  background: var(--espresso-2); border: 1px solid #3d342a; border-radius: 14px;
  padding: clamp(12px, 1.6vw, 18px) clamp(14px, 1.8vw, 20px);
}
.bench .name { font-family: var(--serif); font-size: clamp(18px, 2.5vw, 24px); }
.bench .ac { font-family: var(--mono); font-size: 12px; color: var(--taupe); text-transform: uppercase; letter-spacing: .08em; }
.bench .grow { flex: 1; min-width: 0; }
.bench .badge {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-family: var(--mono); font-weight: 600;
  background: var(--bronze); color: var(--cream);
}
.reorder { display: flex; flex-direction: column; gap: 8px; }
/* Side-by-side (not stacked) so each is a big, easy fat-finger target. */
.bench .arrows { display: flex; flex-direction: row; gap: 10px; flex: none; }
.bench .arrows button {
  width: clamp(52px, 7vw, 62px); height: clamp(46px, 6vw, 54px);
  border-radius: 10px; border: 1px solid var(--taupe);
  background: transparent; color: var(--cream); font-size: 22px; cursor: pointer;
}
.bench .arrows button:active:not(:disabled) { background: var(--bronze); border-color: var(--bronze); }
.bench .arrows button:disabled { opacity: .25; cursor: default; }

/* Q1 reveal right/wrong markers --------------------------------------------- */
.bench.is-right { border-color: var(--sage); }
.bench.is-wrong { border-color: var(--danger); border-width: 1.5px; }
.bench .mark {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; font-size: 26px; font-weight: 800; color: var(--cream);
}
.bench.is-right .mark { background: var(--sage); }
.bench.is-wrong .mark { background: var(--danger); box-shadow: 0 0 0 5px rgba(156, 79, 63, .28); }
.bench .ac.is-ok { color: var(--sage); }
/* Prominent "belongs at #N" correction on wrong rows. */
.correction {
  font-family: var(--mono); font-size: clamp(12px, 1.7vw, 15px);
  text-transform: uppercase; letter-spacing: .06em; color: var(--bronze-2);
}
.correction b { color: var(--cream); font-size: 1.2em; }

/* Q2 multiple-choice options ------------------------------------------------ */
.q2opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.q2opt { font-family: var(--mono); font-size: clamp(20px, 4vw, 32px); padding: clamp(18px, 3vw, 30px) 0; }

/* Q3 best-mix chips --------------------------------------------------------- */
.best-mix { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.chip { display: flex; align-items: center; gap: 8px; background: var(--espresso); border: 1px solid #3d342a; border-radius: 999px; padding: 5px 16px 5px 5px; }
.chip span { font-family: var(--serif); font-size: clamp(14px, 1.8vw, 18px); }
.chip .emblem { width: 32px; height: 32px; }

/* Selectable grid (Q3) ------------------------------------------------------ */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pick {
  background: var(--espresso-2); border: 1.5px solid #3d342a; border-radius: 14px;
  padding: 14px; cursor: pointer; transition: border-color .15s, background .15s;
  display: flex; flex-direction: column; gap: 4px;
}
.pick.sel { border-color: var(--bronze-2); background: #3a2f23; }
.pick .name { font-family: var(--serif); font-size: clamp(15px, 2vw, 20px); }
.pick .ac { font-family: var(--mono); font-size: 11px; color: var(--taupe); text-transform: uppercase; }
.pick.disabled { opacity: .4; pointer-events: none; }

/* Slider -------------------------------------------------------------------- */
.slider-wrap { display: flex; flex-direction: column; gap: 10px; }
.slider-val { font-family: var(--mono); font-size: clamp(40px, 8vw, 72px); color: var(--bronze-2); text-align: center; }
input[type=range] { -webkit-appearance: none; width: 100%; height: 8px; border-radius: 4px; background: var(--espresso-2); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--bronze); border: 3px solid var(--cream); cursor: pointer;
}

/* Engraved emblems (generated via fal.ai) ----------------------------------- */
.emblem {
  width: clamp(40px, 5.2vw, 54px); height: clamp(40px, 5.2vw, 54px);
  border-radius: 50%; object-fit: cover; flex: none; background: var(--espresso);
  box-shadow: 0 0 0 1px var(--bronze);
}
.pick .emblem { width: 50px; height: 50px; margin: 0 auto 4px; }
.tier-badge {
  width: clamp(128px, 22vw, 190px); height: auto; display: block; margin: 0 auto;
  border-radius: 50%; box-shadow: 0 0 0 2px var(--bronze-2);
}

/* Reveal / score ------------------------------------------------------------ */
.scorebig { position: relative; font-family: var(--mono); font-size: clamp(56px, 12vw, 120px); color: var(--bronze-2); line-height: 1; }
.scorebig::before {
  content: ""; position: absolute; inset: -55% -38%; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(192, 142, 79, .30), rgba(192, 142, 79, 0) 68%);
}
.bar { height: 26px; border-radius: 13px; background: var(--espresso-2); position: relative; overflow: hidden; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 13px; display: block; }
.bar.avg > i { background: var(--taupe); }
.bar.real > i { background: var(--sage); }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; }
.legend span::before { content: "■ "; }

/* Form ---------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--taupe); }
.field input, .field select {
  font-family: var(--sans); font-size: 18px; padding: 14px 16px; border-radius: 12px;
  border: 1px solid #3d342a; background: var(--espresso-2); color: var(--cream);
}
.field input:focus, .field select:focus { outline: 2px solid var(--bronze-2); }

/* Scatter chart ------------------------------------------------------------- */
.scatter { width: 100%; aspect-ratio: 3 / 2; background: var(--espresso-2); border-radius: var(--radius); }

.center { text-align: center; }
.right { text-align: right; }
.spread { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.kicker { color: var(--bronze-2); font-family: var(--mono); }
.flag { font-size: 13px; color: var(--taupe); font-family: var(--mono); }

/* Attract: prominent "3 minutes" pill --------------------------------------- */
.time-badge {
  display: inline-block; margin: clamp(14px, 2.4vw, 22px) auto 0;
  font-family: var(--mono); font-weight: 600; font-size: clamp(13px, 1.8vw, 16px);
  letter-spacing: .1em; color: var(--cream); background: var(--bronze);
  border-radius: 999px; padding: 10px 24px;
}

/* Intro: the four investor levels we assess --------------------------------- */
.tier-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: clamp(10px, 2vw, 18px); margin-top: 14px; }
.tier-chip { display: flex; flex-direction: column; align-items: center; gap: 9px; flex: 1; min-width: 74px; text-align: center; }
.tier-mini { width: clamp(54px, 8vw, 74px); height: auto; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--bronze-2); }
.tier-chip-label { font-family: var(--mono); font-size: clamp(11px, 1.5vw, 13px); color: var(--sand); text-transform: uppercase; letter-spacing: .05em; line-height: 1.25; }

/* Q2 reveal: least-correlated example pairs --------------------------------- */
.corr-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.corr-row .emblem { width: 38px; height: 38px; }
.corr-name { font-family: var(--serif); font-size: clamp(15px, 2vw, 20px); }
.corr-amp { color: var(--taupe); font-family: var(--mono); }
.corr-val { margin-left: auto; font-size: clamp(18px, 2.6vw, 24px); }

/* Q3 reveal: return/volatility figures per point ---------------------------- */
.fig-row { align-items: center; padding: 9px 0; border-bottom: 1px solid #3d342a; }
.fig-row:last-child { border-bottom: none; }
.fig-label { display: flex; align-items: center; gap: 10px; font-size: clamp(14px, 1.9vw, 18px); }
.fig-label .dot { width: 13px; height: 13px; border-radius: 50%; display: inline-block; flex: none; }

/* Final: the investor level is now the focal point -------------------------- */
.tier-label { font-size: clamp(34px, 6.5vw, 56px); margin-top: 8px; line-height: 1.05; }
.tier-sub { max-width: 32em; margin: 12px auto 0; }
