:root {
  color-scheme: dark;
  --bg: #0b0e13;
  --surface: #121720;
  --surface-2: #171d27;
  --line: #28303c;
  --line-bright: #3b4657;
  --text: #f4f6f8;
  --muted: #94a0af;
  --dim: #657181;
  --accent: #c8ff57;
  --accent-ink: #172000;
  --cyan: #62e5d1;
  --danger: #ff8b83;
  --shadow: 0 24px 80px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    var(--bg);
  background-size: 42px 42px;
  color: var(--text);
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", ui-sans-serif, system-ui, sans-serif;
  overflow-x: hidden;
}

button, input { font: inherit; }
button { color: inherit; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 34rem;
  height: 34rem;
  border-radius: 50%;
  filter: blur(110px);
  pointer-events: none;
  opacity: .12;
}

.ambient-one { top: -18rem; left: -10rem; background: var(--accent); }
.ambient-two { right: -16rem; bottom: -20rem; background: #4b6cff; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: 68px;
  padding: 0 clamp(18px, 4vw, 54px);
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(11, 14, 19, .88);
  backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 780;
  letter-spacing: -.02em;
}

.brand-mark {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  color: var(--accent);
  font: 800 16px/1 ui-monospace, monospace;
  transform: rotate(-4deg);
}

.brand-divider { width: 1px; height: 20px; background: var(--line-bright); }
.brand-subtitle { color: var(--muted); font-weight: 550; }

.top-progress {
  min-width: min(300px, 38vw);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font: 700 12px/1 ui-monospace, monospace;
}

.top-track {
  height: 4px;
  flex: 1;
  background: var(--line);
  overflow: hidden;
}

.top-track > span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width .3s ease;
}

main {
  width: min(1260px, 100%);
  margin: 0 auto;
  padding: clamp(30px, 5vw, 72px) clamp(15px, 4vw, 48px) 80px;
}

.panel {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(23,29,39,.96), rgba(14,18,25,.98));
  box-shadow: var(--shadow);
}

.intro-panel {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: clamp(26px, 5vw, 60px);
  position: relative;
  overflow: hidden;
}

.intro-panel::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -130px;
  top: -130px;
  border: 1px solid rgba(200,255,87,.25);
  transform: rotate(45deg);
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .16em;
  font: 750 11px/1.4 ui-monospace, monospace;
  display: flex;
  align-items: center;
  gap: 9px;
}

.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(200,255,87,.08);
}

h1 {
  max-width: 760px;
  margin: 20px 0 16px;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1.07;
  letter-spacing: -.055em;
}

h1 span { color: var(--muted); }

.lede {
  max-width: 730px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.75;
}

.instruction-grid {
  margin: 36px 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.instruction-grid article {
  min-width: 0;
  padding: 22px 18px;
  display: flex;
  gap: 13px;
}

.instruction-grid article + article { border-left: 1px solid var(--line); }

.step {
  color: var(--dim);
  font: 700 11px/1.6 ui-monospace, monospace;
}

.instruction-grid strong { font-size: 14px; }
.instruction-grid p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }

.start-controls { width: min(620px, 100%); }

.field { display: block; color: var(--muted); font-size: 13px; font-weight: 700; }
.field em { color: var(--dim); font-style: normal; font-weight: 500; }

.field input {
  width: 100%;
  margin-top: 8px;
  padding: 13px 14px;
  border: 1px solid var(--line-bright);
  border-radius: 3px;
  outline: none;
  background: #0d1118;
  color: var(--text);
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200,255,87,.10);
}

.consent {
  margin-top: 16px;
  padding: 15px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.018);
  display: flex;
  align-items: flex-start;
  gap: 11px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.consent input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--accent);
  flex: none;
}

.resume-notice {
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 2px solid var(--cyan);
  background: rgba(98,229,209,.06);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.text-button {
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--cyan);
  cursor: pointer;
  text-decoration: underline;
}

.primary-button {
  width: 100%;
  min-height: 56px;
  margin-top: 17px;
  padding: 0 20px;
  border: 0;
  border-radius: 2px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 850;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform .15s ease, background .15s ease;
}

.primary-button:hover:not(:disabled) { background: #d6ff82; transform: translateY(-1px); }
button:disabled { opacity: .45; cursor: wait; }

.privacy-note {
  margin: 18px 0 0;
  color: var(--dim);
  font-size: 11px;
}

.privacy-note span { color: var(--cyan); margin-right: 6px; }
.error { min-height: 22px; margin-top: 9px; color: var(--danger); font-size: 12px; font-weight: 650; }
.centered { text-align: center; }
.hidden { display: none !important; }

.study-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 30px;
  margin-bottom: 20px;
}

.study-heading h2 {
  max-width: 900px;
  margin: 12px 0 0;
  font-size: clamp(26px, 4vw, 48px);
  line-height: 1.15;
  letter-spacing: -.04em;
}

.prompt-english {
  max-width: 900px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: clamp(13px, 1.6vw, 17px);
  line-height: 1.5;
}

.question-number {
  display: flex;
  align-items: baseline;
  color: var(--accent);
  font: 800 clamp(28px, 5vw, 54px)/1 ui-monospace, monospace;
}

.question-number small { color: var(--dim); font-size: 14px; }

.metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  margin-bottom: 14px;
}

.meta-item {
  min-width: 150px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.meta-item small {
  display: block;
  color: var(--dim);
  font: 700 9px/1.5 ui-monospace, monospace;
  letter-spacing: .12em;
}

.meta-item strong { display: block; margin-top: 2px; color: #dce1e7; font-size: 12px; }

.comparison-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr);
  align-items: center;
}

.image-card {
  position: relative;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--line);
  background: #06080c;
  cursor: zoom-in;
  overflow: hidden;
}

.image-card:hover, .image-card:focus-visible { border-color: var(--accent); outline: none; }

.image-card img {
  width: 100%;
  height: clamp(290px, 39vw, 520px);
  display: block;
  object-fit: contain;
  background: #07090d;
}

.image-label {
  position: absolute;
  z-index: 2;
  left: 12px;
  top: 12px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font: 900 17px/1 ui-monospace, monospace;
}

.zoom-hint {
  position: absolute;
  right: 9px;
  bottom: 8px;
  padding: 5px 8px;
  background: rgba(4,6,9,.78);
  color: #b9c1cb;
  font-size: 10px;
  opacity: 0;
  transition: opacity .15s ease;
}

.image-card:hover .zoom-hint, .image-card:focus-visible .zoom-hint { opacity: 1; }

.versus {
  position: relative;
  z-index: 2;
  width: 46px;
  height: 46px;
  margin-left: -6px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-bright);
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  font: 800 11px/1 ui-monospace, monospace;
}

.answer-panel {
  position: sticky;
  z-index: 10;
  bottom: 10px;
  margin-top: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  background: rgba(14, 18, 25, .94);
  box-shadow: 0 -12px 40px rgba(0,0,0,.22);
  backdrop-filter: blur(16px);
}

.answer-panel > p {
  margin: 0 0 11px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.choices { display: grid; grid-template-columns: 1fr 1fr 1fr 1.15fr; gap: 8px; }

.choice {
  min-height: 62px;
  padding: 9px 12px;
  border: 1px solid var(--line-bright);
  border-radius: 2px;
  background: var(--surface-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.choice:hover:not(:disabled), .choice:focus-visible {
  border-color: var(--accent);
  background: #202831;
  transform: translateY(-1px);
  outline: none;
}

.choice kbd {
  min-width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-bright);
  border-radius: 2px;
  color: var(--accent);
  background: #0b0f15;
  font: 800 11px/1 ui-monospace, monospace;
}

.choice span, .choice strong, .choice small { display: block; }
.choice strong { font-size: 13px; }
.choice small { margin-top: 3px; color: var(--dim); font-size: 9px; }

.finish-panel {
  width: min(760px, 100%);
  margin: 6vh auto 0;
  padding: clamp(32px, 6vw, 66px);
  text-align: center;
}

.success-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 25px;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 34px;
}

.finish-panel .eyebrow { justify-content: center; }
.finish-panel h2 { margin: 15px 0 10px; font-size: clamp(28px, 5vw, 44px); }
.finish-panel > p { color: var(--muted); line-height: 1.7; }

.finish-summary {
  margin: 30px 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
}

.finish-summary span { padding: 20px 8px; }
.finish-summary span + span { border-left: 1px solid var(--line); }
.finish-summary strong { display: block; color: var(--accent); font: 800 25px/1 ui-monospace, monospace; }
.finish-summary small { display: block; margin-top: 8px; color: var(--dim); font-size: 10px; }
.session-code code { color: var(--cyan); }

dialog {
  width: min(96vw, 1400px);
  max-width: none;
  max-height: 96vh;
  padding: 0;
  border: 1px solid var(--line-bright);
  background: #05070a;
  overflow: hidden;
}

dialog::backdrop { background: rgba(2,3,5,.92); backdrop-filter: blur(5px); }
dialog img { width: 100%; max-height: 92vh; display: block; object-fit: contain; }
dialog button, dialog > span {
  position: absolute;
  z-index: 2;
  top: 10px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-bright);
  background: rgba(5,7,10,.86);
  display: grid;
  place-items: center;
}
dialog button { right: 10px; cursor: pointer; font-size: 25px; }
dialog > span { left: 10px; color: var(--accent); font-weight: 900; }

.saving-toast {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  padding: 10px 15px;
  border: 1px solid var(--line-bright);
  background: #111720;
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.spinner {
  width: 13px;
  height: 13px;
  border: 2px solid var(--line-bright);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .65s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 780px) {
  .instruction-grid { grid-template-columns: 1fr; }
  .instruction-grid article + article { border-left: 0; border-top: 1px solid var(--line); }
  .comparison-grid { grid-template-columns: 1fr 1fr; gap: 7px; }
  .versus { display: none; }
  .image-card img { height: 46vw; min-height: 185px; }
  .choices { grid-template-columns: 1fr 1fr; }
  .study-heading { align-items: flex-start; }
  .question-number { padding-top: 4px; }
}

@media (max-width: 520px) {
  .topbar { min-height: 58px; padding: 0 14px; }
  .brand-subtitle, .brand-divider { display: none; }
  .top-progress { min-width: 45vw; }
  main { padding: 25px 10px 60px; }
  .intro-panel { padding: 23px 18px; }
  h1 { font-size: 34px; }
  .study-heading h2 { font-size: 25px; }
  .question-number { font-size: 28px; }
  .metadata { flex-wrap: nowrap; overflow-x: auto; }
  .meta-item { min-width: 136px; }
  .image-card img { min-height: 165px; }
  .image-label { width: 32px; height: 32px; left: 7px; top: 7px; }
  .answer-panel { bottom: 4px; padding: 9px; }
  .choices { gap: 6px; }
  .choice { min-height: 58px; padding: 7px; gap: 7px; }
  .choice kbd { min-width: 24px; height: 24px; }
  .finish-summary { grid-template-columns: 1fr; }
  .finish-summary span + span { border-left: 0; border-top: 1px solid var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: .001ms !important; }
}
