:root {
  color-scheme: dark;
  --bg: #091018;
  --surface: #111b27;
  --surface-2: #172536;
  --text: #eef7ff;
  --muted: #91a6b9;
  --line: #2a4054;
  --cyan: #65e6d2;
  --cyan-dark: #082f32;
  --amber: #ffcb69;
  --red: #ff7b7b;
  --green: #79e59b;
  --shadow: 0 28px 70px rgba(0, 0, 0, .34);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef3f5;
  --surface: #ffffff;
  --surface-2: #e9f0f3;
  --text: #14212c;
  --muted: #536979;
  --line: #cad7de;
  --cyan: #007f78;
  --cyan-dark: #d7f4f0;
  --amber: #a56000;
  --red: #b43131;
  --green: #16733b;
  --shadow: 0 24px 60px rgba(31, 54, 67, .14);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 5%, color-mix(in srgb, var(--cyan) 15%, transparent), transparent 30rem),
    linear-gradient(145deg, var(--bg), color-mix(in srgb, var(--bg) 84%, #18334b));
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
button { font: inherit; }
.shell { width: min(1020px, calc(100% - 32px)); margin: 0 auto; padding: 40px 0 28px; }
.masthead { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; color: var(--cyan); font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; }
h1 { margin: 0; font-family: ui-sans-serif, system-ui, sans-serif; font-size: clamp(2.2rem, 7vw, 4.6rem); line-height: .92; letter-spacing: -.06em; }
.subtitle { margin: 13px 0 0; color: var(--muted); line-height: 1.6; }
.panel { position: relative; padding: clamp(22px, 4vw, 44px); border: 1px solid var(--line); border-radius: 22px; background: color-mix(in srgb, var(--surface) 95%, transparent); box-shadow: var(--shadow); }
.hidden { display: none !important; }
.intro { overflow: hidden; }
.intro::after { content: "?"; position: absolute; right: 2%; bottom: -28%; color: color-mix(in srgb, var(--cyan) 8%, transparent); font: 700 24rem/1 ui-sans-serif; pointer-events: none; }
.intro > * { position: relative; z-index: 1; }
.intro h2, .result h2 { max-width: 720px; margin: 10px 0 14px; font: 700 clamp(1.8rem, 5vw, 3rem)/1.1 ui-sans-serif, system-ui; letter-spacing: -.035em; }
.intro > p { max-width: 690px; color: var(--muted); line-height: 1.75; }
.case-stamp { display: inline-block; padding: 6px 10px; border: 1px solid var(--cyan); border-radius: 999px; color: var(--cyan); font-size: .74rem; text-transform: uppercase; }
.feature-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 26px 0; }
.feature-row span, .category { padding: 6px 10px; border-radius: 6px; background: var(--cyan-dark); color: var(--cyan); font-size: .78rem; text-transform: capitalize; }
.primary, .secondary, .answers button, .segmented button, .icon-button { border: 1px solid transparent; border-radius: 10px; cursor: pointer; transition: transform .15s, border-color .15s, background .15s; }
.primary { padding: 13px 18px; background: var(--cyan); color: #041412; font-weight: 800; }
.primary:hover, .secondary:hover, .answers button:hover { transform: translateY(-2px); }
.secondary { padding: 13px 18px; border-color: var(--line); background: var(--surface-2); color: var(--text); }
.icon-button { min-width: 44px; height: 44px; border-color: var(--line); background: var(--surface); color: var(--text); }
.best { min-height: 1.3em; margin-top: 18px !important; font-size: .82rem; }
.status-row { display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: .82rem; }
.status-row div:first-child { display: flex; gap: 16px; }
.status-row strong { color: var(--text); }
.streak strong { color: var(--amber); }
.progress { height: 5px; margin: 13px 0 28px; overflow: hidden; border-radius: 99px; background: var(--surface-2); }
.progress span { display: block; width: 0; height: 100%; background: var(--cyan); transition: width .25s; }
.code-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.segmented { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.segmented button { padding: 6px 10px; background: transparent; color: var(--muted); }
.segmented button.active { background: var(--surface); color: var(--text); }
pre { min-height: 310px; max-height: 56vh; margin: 0; padding: 22px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: #071018; color: #d9edf6; line-height: 1.55; tab-size: 2; white-space: pre; }
.prompt { margin: 24px 0 12px; font-weight: 800; }
.answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.answers button { min-height: 54px; padding: 10px 14px; border-color: var(--line); background: var(--surface-2); color: var(--text); text-align: left; }
.answers button.correct { border-color: var(--green); background: color-mix(in srgb, var(--green) 16%, var(--surface)); }
.answers button.wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 14%, var(--surface)); }
.answers button:disabled { cursor: default; transform: none; }
.explanation { margin-top: 22px; padding: 20px; border-left: 3px solid var(--cyan); background: var(--surface-2); }
.explanation h2 { margin: 4px 0 8px; font-family: ui-sans-serif, system-ui; }
.explanation p { line-height: 1.65; }
.verdict { margin: 0; color: var(--cyan); font-weight: 800; }
.when { color: var(--muted); }
.result { text-align: center; }
.result-score { margin: 22px auto; color: var(--cyan); font: 800 clamp(3.5rem, 13vw, 7rem)/1 ui-sans-serif; letter-spacing: -.07em; }
.result > p:not(.eyebrow) { color: var(--muted); line-height: 1.7; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; }
.review-list { display: grid; gap: 10px; margin-top: 28px; text-align: left; }
.review-list article { padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.review-list h3 { margin: 0 0 8px; }
.review-list p { margin: 0; color: var(--muted); line-height: 1.55; }
footer { padding: 24px 4px 0; color: var(--muted); font-size: .72rem; line-height: 1.5; text-align: center; }

@media (max-width: 680px) {
  .shell { width: min(100% - 20px, 1020px); padding-top: 24px; }
  .answers { grid-template-columns: 1fr; }
  .panel { border-radius: 16px; }
  pre { min-height: 260px; font-size: .76rem; }
  .status-row div:first-child { flex-direction: column; gap: 3px; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
