/* Layout: a single dark "phone card" floating on a lit stage (full-bleed on phones);
   one screen at a time: cover, question, result. Single dark theme by design. */
:root {
  --stage: #0A0B09;
  --card: #111310;          /* green-black, like a forest at dusk */
  --ink: #F0F3F4;           /* SFL Porcelain */
  --muted: rgba(240, 243, 244, .64);
  --faint: rgba(240, 243, 244, .42);
  --line: rgba(240, 243, 244, .14);
  --ring: rgba(240, 243, 244, .72);
  --gold: #F9C70F;          /* SFL Gold */
  --gold-glow: rgba(249, 199, 15, .38);
  --on-gold: #1E1E1E;       /* SFL Charcoal */
  --font: 'Montserrat', ui-sans-serif, system-ui, sans-serif;
  --mono: 'Roboto Mono', ui-monospace, Menlo, monospace;
  --pad: 26px;
  color-scheme: dark;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--stage);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
img { max-width: 100%; display: block; }
html { background: var(--stage); }
body {
  margin: 0; min-height: 100vh;
  background:
    radial-gradient(60% 50% at 30% 0%, rgba(249, 199, 15, .16), transparent 70%),
    radial-gradient(50% 40% at 80% 100%, rgba(98, 116, 105, .18), transparent 70%),
    var(--stage);
  color: var(--ink);
  font-family: var(--font); font-weight: 400; font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 40px;
}

/* ---------- Card ---------- */
/* The library photo sits behind the card too, dimmed and fading out at the edges,
   so the card looks like it floats in front of the scene. */
.backdrop {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: url("images/bg.jpg") center 30% / cover no-repeat;
  filter: brightness(.55) saturate(.9);
  -webkit-mask-image: radial-gradient(48% 62% at 50% 42%, #000 35%, transparent 100%);
          mask-image: radial-gradient(48% 62% at 50% 42%, #000 35%, transparent 100%);
}
/* Gold dust drifting over the backdrop; the card covers the centre, so it shows at the sides. */
.dust { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.card {
  position: relative; z-index: 1; isolation: isolate; overflow: hidden;
  max-width: 440px; margin: 0 auto;
  background: var(--card);
  border-radius: 34px;
  border: 1px solid rgba(255, 255, 255, .07);
  box-shadow: 0 50px 120px -30px rgba(0, 0, 0, .85), 0 0 0 1px rgba(0, 0, 0, .4);
}
@media (max-width: 520px) {
  body { padding-block: 22px; }
  .backdrop {
    -webkit-mask-image: radial-gradient(85% 75% at 50% 35%, #000 45%, transparent 100%);
            mask-image: radial-gradient(85% 75% at 50% 35%, #000 45%, transparent 100%);
  }
  .card { border-radius: 28px; }
  :root { --pad: 20px; }
}
.inner { position: relative; z-index: 1; padding: 0 var(--pad) 30px; }

/* Atmosphere at the top of the card on the cover and the questions: CSS light rays
   and a gold glow fading into the card colour. The library photo lives in .backdrop. */
.sky {
  position: absolute; inset: 0 0 auto 0; height: 520px; z-index: 0; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(17, 19, 16, .15) 0%, rgba(17, 19, 16, .55) 45%, var(--card) 100%),
    radial-gradient(90% 70% at 18% -5%, rgba(249, 199, 15, .55), rgba(228, 124, 55, .12) 45%, transparent 75%),
    linear-gradient(170deg, #2B2914 0%, #161A14 55%, var(--card) 100%);
}
.sky::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(112deg, transparent 0 34px, rgba(255, 226, 120, .07) 34px 58px, transparent 58px 96px);
  -webkit-mask-image: radial-gradient(80% 70% at 15% 0%, #000 0%, transparent 75%);
          mask-image: radial-gradient(80% 70% at 15% 0%, #000 0%, transparent 75%);
}
.quiz-on .sky { height: 300px; opacity: .7; }
.result-on .sky, .result-on .topbar { display: none; }

/* ---------- Shared type ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding-block: 24px 0;
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  white-space: nowrap;
}
.mark { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.mark i { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 12px var(--gold-glow); }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1 { font-weight: 700; font-size: clamp(34px, 9.4vw, 42px); line-height: 1.04; letter-spacing: -0.025em; }
h1 em { font-style: normal; color: var(--gold); }
.cover .head, .topbar { text-shadow: 0 2px 22px rgba(0, 0, 0, .6); }
h2 { font-weight: 600; font-size: 24px; line-height: 1.2; letter-spacing: -0.015em; }
h3 { font-weight: 600; font-size: 18px; line-height: 1.2; letter-spacing: -0.01em; }
p { margin: 0; }
.meta { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.sub { font-weight: 500; font-size: 18px; color: var(--ink); opacity: .92; }

/* ---------- Pills & buttons ---------- */
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 34px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--ring); color: var(--ink);
  font-family: var(--font); font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  height: 54px; padding: 0 26px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--gold); color: var(--on-gold); text-decoration: none;
  font-family: var(--font); font-size: 15px; font-weight: 700; letter-spacing: .01em;
  box-shadow: 0 10px 30px -8px var(--gold-glow);
  transition: transform 160ms cubic-bezier(.2, .8, .2, 1), box-shadow 160ms;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 14px 36px -8px var(--gold-glow); }
.btn:active { transform: translateY(1px); }
.btn .arr { font-size: 18px; line-height: 1; }
.btn.ghost {
  background: transparent; color: var(--ink); box-shadow: none;
  border: 1px solid var(--ring); height: 44px; padding: 0 18px; font-weight: 500; font-size: 13px;
}
.btn:focus-visible, .opt:focus-visible, .back:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ---------- Cover ---------- */
.cover { display: grid; gap: 30px; padding-top: 120px; }
.cover .head { display: grid; gap: 10px; }
.rows { display: grid; gap: 0; }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center;
  padding-block: 16px; border-top: 1px solid var(--line);
}
.row:last-child { border-bottom: 1px solid var(--line); }
.row .txt { display: grid; gap: 4px; min-width: 0; }
.row p { font-size: 13px; color: var(--muted); line-height: 1.5; }
.thumb { display: grid; justify-items: center; gap: 5px; }
.thumb img {
  width: 50px; height: 50px; border-radius: 50%; object-fit: cover; object-position: 50% 28%;
  border: 1px solid var(--ring); padding: 2px; background: var(--card);
  filter: grayscale(.35) contrast(1.05);
}
.thumb span { font-family: var(--mono); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.btn.big {
  width: 100%; height: 66px; font-size: 18px; letter-spacing: .01em;
  box-shadow: 0 14px 44px -6px var(--gold-glow), 0 0 0 6px rgba(249, 199, 15, .12);
}
.btn.big .arr { font-size: 22px; }

/* ---------- Question ---------- */
.question { display: grid; gap: 26px; padding-top: 70px; }
.qtop { display: grid; gap: 14px; }
.qline { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.segs { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.segs i { height: 3px; border-radius: 3px; background: var(--line); transition: background 200ms; }
.segs i.done { background: var(--gold); }
.segs i.now { background: var(--ring); }
.back {
  background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--muted);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
}
.back[disabled] { visibility: hidden; }
#qtext { font-weight: 700; font-size: clamp(26px, 7.4vw, 32px); line-height: 1.12; letter-spacing: -0.02em; outline: none; }
.opts { display: grid; }
.opt {
  display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 16px; align-items: center;
  width: 100%; text-align: left; cursor: pointer; background: none; color: var(--ink);
  border: 0; border-top: 1px solid var(--line); padding: 18px 0;
  font: inherit; font-size: 16px; font-weight: 500; line-height: 1.4;
  transition: color 140ms;
}
.opt:last-child { border-bottom: 1px solid var(--line); }
.opt .k {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--ring); font-size: 14px; font-weight: 500;
  transition: background 140ms, color 140ms, border-color 140ms, box-shadow 140ms;
}
.opt:hover .k { border-color: var(--gold); color: var(--gold); }
.opt.on .k { background: var(--gold); border-color: var(--gold); color: var(--on-gold); box-shadow: 0 0 22px var(--gold-glow); }
.opt.on { color: #fff; }

/* ---------- Result ---------- */
.result { display: grid; gap: 30px; }
.hero { position: relative; margin: 0 calc(var(--pad) * -1); }
.hero img { width: 100%; aspect-ratio: 4 / 3.4; object-fit: cover; object-position: 50% 22%; }
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(17, 19, 16, .1) 0%, rgba(17, 19, 16, .05) 40%, rgba(17, 19, 16, .8) 78%, var(--card) 100%);
}
.hero .over { position: absolute; z-index: 1; left: var(--pad); right: var(--pad); bottom: 4px; display: grid; gap: 12px; justify-items: start; }
.hero .pill { border-color: var(--gold); color: var(--gold); font-size: 13px; height: 30px; }
.prose { display: grid; gap: 14px; font-size: 16px; color: var(--muted); }
.prose p:first-child { color: var(--ink); font-size: 18px; font-weight: 500; line-height: 1.45; }
.stack { display: grid; gap: 4px; }
.stack h2 { margin-bottom: 10px; }
.tip { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; padding-block: 16px; border-top: 1px solid var(--line); align-items: start; }
.tip:last-child { border-bottom: 1px solid var(--line); }
.tip .txt { display: grid; gap: 6px; }
.tip p { font-size: 14px; color: var(--muted); }
.tip .pill { width: 40px; height: 40px; padding: 0; font-size: 13px; }
.next { display: grid; gap: 16px; }
.next .photo { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 22px; border: 1px solid var(--line); }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.checks li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; font-size: 15px; }
.checks li::before {
  content: ""; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%;
  border: 1px solid var(--gold); background: radial-gradient(circle, var(--gold) 0 3px, transparent 3.5px);
}
.small { font-size: 14px; color: var(--muted); }
.actions { display: grid; justify-items: center; gap: 14px; padding-top: 6px; }
.actions .btn.big { width: 100%; }

/* Screen change */
.screen { animation: rise 420ms cubic-bezier(.2, .8, .2, 1) both; }
@keyframes rise { from { opacity: .001; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
