:root {
  --bg: #090d18; --bg2: #0d1322;
  --ink: #f2f5fa; --ink2: #c3cbd9; --muted: #8a95a9; --faint: #5c6679;
  --line: rgba(255,255,255,.08); --line2: rgba(255,255,255,.14);
  --glass: rgba(255,255,255,.04); --glass2: rgba(255,255,255,.07);
  --green: #3ecf6e; --green2: #22a853; --greenDeep: #166a35; --greenS: rgba(62,207,110,.14);
  --sky: #5bb8e8; --amber: #f5b547; --amberS: rgba(245,181,71,.14); --red: #ff6b6b; --redS: rgba(255,107,107,.14);
  --radius: 16px; --radius-s: 12px;
  --shadow: 0 20px 60px rgba(0,0,0,.45), 0 1px 0 rgba(255,255,255,.06) inset;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Inter", "Instrument Sans", "Helvetica Neue", Arial, sans-serif; font-feature-settings: "cv11", "ss01", "tnum";
  color: var(--ink); background: var(--bg); line-height: 1.5; font-size: 16px; min-height: 100vh; -webkit-font-smoothing: antialiased;
}
/* ambient light + grain */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(1200px 700px at 50% -10%, #121a2e 0%, var(--bg) 60%); }
.bg .glow { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55; will-change: transform; }
.bg .g1 { width: 640px; height: 640px; left: -200px; top: -220px; background: radial-gradient(circle, rgba(46,125,59,.9), rgba(46,125,59,0) 65%); }
.bg .g2 { width: 560px; height: 560px; right: -180px; top: 10%; background: radial-gradient(circle, rgba(91,184,232,.7), rgba(91,184,232,0) 65%); }
.bg .g3 { width: 700px; height: 500px; left: 30%; bottom: -300px; background: radial-gradient(circle, rgba(62,207,110,.35), rgba(62,207,110,0) 65%); }
.bg .grain { position: absolute; inset: 0; opacity: .06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 20px; }

/* header */
.top { position: sticky; top: 0; z-index: 5; backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); background: rgba(9,13,24,.55); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; justify-content: space-between; align-items: center; height: 60px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 13.5px; font-weight: 600; color: var(--ink2); letter-spacing: -.005em; }
.brand img { height: 26px; width: auto; display: block; }
.brand b { color: var(--ink); font-weight: 700; }
.brand .sep { width: 1px; height: 16px; background: var(--line2); }
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: transparent; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--green2), var(--green), var(--sky)); transition: width .35s cubic-bezier(.2,.8,.2,1); box-shadow: 0 0 12px rgba(62,207,110,.6); }
.timer { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; padding: 7px 12px 7px 10px; border-radius: 999px; border: 1px solid var(--line2); background: var(--glass2); color: var(--ink); }
.timer::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
.timer.low { border-color: rgba(245,181,71,.4); color: var(--amber); } .timer.low::before { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.timer.crit { border-color: rgba(255,107,107,.5); color: var(--red); animation: pulse 1s infinite; } .timer.crit::before { background: var(--red); box-shadow: 0 0 10px var(--red); }
@keyframes pulse { 50% { opacity: .6; } }

main { padding: 56px 0 80px; }
.view { animation: rise .5s cubic-bezier(.2,.8,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--green); margin-bottom: 14px; display: inline-flex; align-items: center; gap: 10px; }
.eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--green); opacity: .7; }
h1 { font-size: 40px; font-weight: 600; letter-spacing: -.035em; line-height: 1.08; margin-bottom: 12px; }
h1 .dim { color: var(--muted); font-weight: 500; }
h2 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; margin-bottom: 8px; }
.lead { color: var(--ink2); font-size: 17px; margin-bottom: 28px; max-width: 560px; }
.muted { color: var(--muted); font-size: 14px; }

.card { background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03)); border: 1px solid var(--line2); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); position: relative; }
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent); border-radius: var(--radius) var(--radius) 0 0; pointer-events: none; }

label { display: block; font-size: 13px; font-weight: 600; color: var(--ink2); margin-bottom: 16px; }
input { display: block; width: 100%; margin-top: 7px; font: inherit; font-size: 16px; padding: 13px 15px; border: 1px solid var(--line2); border-radius: var(--radius-s); color: var(--ink); background: rgba(0,0,0,.25); transition: border-color .15s, box-shadow .15s, background .15s; }
input::placeholder { color: var(--faint); }
input:focus { outline: none; border-color: rgba(62,207,110,.7); box-shadow: 0 0 0 4px rgba(62,207,110,.15); background: rgba(0,0,0,.35); }
input.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .12em; text-transform: uppercase; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; font-size: 15.5px; padding: 0 22px; min-height: 50px; border-radius: var(--radius-s); border: 1px solid rgba(255,255,255,.12); cursor: pointer; color: #fff; letter-spacing: -.005em;
  background: linear-gradient(180deg, #34b45f 0%, #22964a 55%, #1b7d3e 100%); box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 10px 30px rgba(34,168,83,.35), 0 2px 6px rgba(0,0,0,.4); transition: transform .12s, box-shadow .2s, filter .2s; }
.btn:hover { filter: brightness(1.08); box-shadow: 0 1px 0 rgba(255,255,255,.3) inset, 0 14px 36px rgba(34,168,83,.45), 0 2px 6px rgba(0,0,0,.4); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn.ghost { background: var(--glass2); color: var(--ink); border-color: var(--line2); box-shadow: 0 1px 0 rgba(255,255,255,.08) inset; }
.btn.ghost:hover { background: rgba(255,255,255,.11); }
.btn.danger { background: linear-gradient(180deg, #f7f9fc, #dfe5ee); color: #0b1020; border-color: rgba(255,255,255,.6); box-shadow: 0 10px 30px rgba(255,255,255,.08), 0 2px 6px rgba(0,0,0,.4); }
.btn.danger:hover { filter: brightness(1.02); }
#f-login .btn { width: 100%; margin-top: 6px; }
.err { background: var(--redS); border: 1px solid rgba(255,107,107,.35); color: #ffb3b3; padding: 11px 13px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; }

/* sign-in hero on wide screens */
.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center; min-height: calc(100vh - 240px); }
.hero .copy p.lead { margin-bottom: 22px; }
.facts { display: grid; grid-template-columns: repeat(3, auto); gap: 22px; justify-content: start; margin-top: 8px; }
.facts div { font-size: 13px; color: var(--muted); }
.facts b { display: block; font-size: 22px; color: var(--ink); font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }

/* briefing */
.rules { list-style: none; margin-bottom: 22px; counter-reset: r; }
.rules li { position: relative; padding-left: 40px; margin-bottom: 14px; color: var(--ink2); counter-increment: r; }
.rules li::before { content: counter(r, decimal-leading-zero); position: absolute; left: 0; top: 2px; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--green); background: var(--greenS); border: 1px solid rgba(62,207,110,.25); border-radius: 6px; padding: 2px 6px; }
.rules b { color: var(--ink); font-weight: 600; }
.sections { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.sections span { font-size: 12.5px; font-weight: 600; background: var(--glass2); border: 1px solid var(--line); color: var(--ink2); padding: 6px 11px; border-radius: 999px; }
.sections span::first-letter { color: var(--green); }
#btn-start { width: 100%; }

/* quiz */
.qhead { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.qsec { font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--green); }
.qnum { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.qnum b { color: var(--ink); font-size: 18px; font-weight: 600; }
.card.q { padding: 28px 26px 22px; }
.qtext { font-size: 20px; font-weight: 500; line-height: 1.4; letter-spacing: -.012em; margin-bottom: 18px; }
.qcode { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 14px; background: rgba(0,0,0,.35); border: 1px solid var(--line); color: #d7e3f4; padding: 14px 16px; border-radius: 12px; margin-bottom: 18px; white-space: pre; overflow-x: auto; line-height: 1.55; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line2); border-radius: 14px; cursor: pointer; font-size: 16px; line-height: 1.45; min-height: 54px; background: var(--glass); color: var(--ink2); transition: transform .15s cubic-bezier(.2,.8,.2,1), background .15s, border-color .15s, box-shadow .2s; user-select: none; }
.opt:hover { background: var(--glass2); border-color: rgba(255,255,255,.22); transform: translateY(-1px); }
.opt .l { flex: 0 0 28px; height: 28px; border-radius: 9px; border: 1px solid var(--line2); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; color: var(--muted); background: rgba(0,0,0,.25); transition: all .15s; }
.opt.on { border-color: rgba(62,207,110,.7); background: var(--greenS); color: var(--ink); box-shadow: 0 0 0 4px rgba(62,207,110,.12), 0 10px 30px rgba(62,207,110,.12); }
.opt.on .l { background: linear-gradient(180deg, #3ecf6e, #22964a); border-color: transparent; color: #04120a; box-shadow: 0 0 14px rgba(62,207,110,.6); }
.opt.on .l::after { content: "✓"; }
.opt.on .l span { display: none; }
.nav { display: flex; justify-content: space-between; align-items: center; margin: 16px 0 6px; gap: 10px; }
.save { font-size: 12.5px; color: var(--faint); }
.save.ok { color: var(--green); }
.palette { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; margin: 14px 0 22px; }
.palette button { font: inherit; font-size: 12px; font-weight: 600; min-height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--glass); color: var(--muted); cursor: pointer; transition: all .15s; }
.palette button:hover { background: var(--glass2); color: var(--ink); }
.palette button.done { background: var(--greenS); border-color: rgba(62,207,110,.35); color: var(--green); }
.palette button.cur { box-shadow: 0 0 0 2px var(--ink); color: var(--ink); }
.submit-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 18px; border-top: 1px solid var(--line); }

/* done */
.done-mark { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 22px; font-size: 30px; color: #04120a; background: linear-gradient(180deg, #3ecf6e, #22964a); box-shadow: 0 0 40px rgba(62,207,110,.5), 0 1px 0 rgba(255,255,255,.4) inset; }

.modal { position: fixed; inset: 0; background: rgba(5,8,16,.6); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.modal-card { background: linear-gradient(180deg, #161e31, #0f1626); border: 1px solid var(--line2); border-radius: 18px; padding: 26px; max-width: 440px; width: 100%; box-shadow: 0 30px 80px rgba(0,0,0,.6); animation: rise .25s both; }
.modal-card p { color: var(--ink2); margin-bottom: 20px; }
.row { display: flex; gap: 10px; justify-content: flex-end; }

@media (max-width: 860px) { .hero { grid-template-columns: 1fr; gap: 30px; } h1 { font-size: 34px; } }
@media (max-width: 520px) {
  .brand span.t { display: none; } .brand .sep { display: none; }
  main { padding: 32px 0 60px; } h1 { font-size: 30px; }
  .card { padding: 20px; } .card.q { padding: 22px 18px 18px; }
  .palette { grid-template-columns: repeat(6, 1fr); }
  .submit-row { flex-direction: column; align-items: stretch; }
  .nav .btn { flex: 1; }
  .facts { gap: 16px; }
}
