:root {
  color-scheme: dark;
  --bg: #0b1016;
  --panel: #111923;
  --panel-raised: #162231;
  --ink: #e8f1fa;
  --muted: #a2b2c4;
  --line: #344457;
  --accent: #ffb84d;
  --tech: #39c5f3;
  --green: #65e6a0;
  --red: #ff7f88;
  --cut: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% 12%, rgb(57 197 243 / 8%), transparent 32rem),
    radial-gradient(circle at 8% 82%, rgb(255 184 77 / 6%), transparent 30rem),
    linear-gradient(145deg, #0b1016, #0e151e 60%, #0a0f15);
}
button { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
button:disabled { cursor: not-allowed; }
[hidden] { display: none !important; }
p, h1, h2, h3 { overflow-wrap: anywhere; }

.grid-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.backdrop-lines {
  position: absolute;
  top: 2%;
  left: 50%;
  width: max(100%, 1000px);
  height: 100%;
  opacity: 0.1;
  stroke: var(--tech);
  stroke-width: 1;
  transform: translateX(-50%);
}
.backdrop-lines path:nth-child(3) { stroke: var(--accent); opacity: 0.65; }
.scanline {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background: repeating-linear-gradient(0deg, transparent 0 5px, rgb(255 255 255 / 3%) 5px 6px, transparent 6px 10px);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 40px, 1100px);
  min-height: 70px;
  margin: 0 auto;
  color: var(--muted);
  border-bottom: 1px solid rgb(57 197 243 / 16%);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
}
.brand-code { display: inline-flex; align-items: center; gap: 10px; }
.brand-diamond {
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent);
  transform: rotate(45deg);
  box-shadow: 0 0 10px rgb(255 184 77 / 35%);
}
.header-status { color: #8db7c9; }

.app-shell {
  display: grid;
  width: min(100% - 32px, 780px);
  min-height: calc(100svh - 156px);
  margin: 0 auto;
  padding: 40px 0 34px;
  place-items: center;
}
.view { width: 100%; animation: view-in 0.35s ease-out both; }
.cut-card {
  position: relative;
  border: 1px solid rgb(255 184 77 / 28%);
  clip-path: var(--cut);
  background: linear-gradient(145deg, rgb(22 34 49 / 96%), rgb(13 20 29 / 97%));
  box-shadow: 0 24px 70px rgb(0 0 0 / 36%);
}
.cut-card::before {
  position: absolute;
  top: 0;
  left: 24px;
  width: 120px;
  height: 2px;
  content: "";
  background: var(--accent);
  box-shadow: 0 0 14px rgb(255 184 77 / 40%);
}
.corner-tag {
  position: absolute;
  top: 18px;
  right: 24px;
  color: #91a8bb;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
}
.hero-card, .result-card, .error-card {
  padding: clamp(34px, 5vw, 50px);
  text-align: center;
}
.hero-emblem {
  position: relative;
  display: grid;
  width: 78px;
  height: 78px;
  margin: 0 auto 26px;
  border: 1px solid rgb(255 184 77 / 55%);
  transform: rotate(45deg);
  place-items: center;
}
.hero-emblem::before, .hero-emblem::after {
  position: absolute;
  content: "";
  border: 1px solid rgb(57 197 243 / 35%);
  inset: 9px;
}
.hero-emblem::after { inset: 20px; border-color: rgb(255 184 77 / 45%); }
.hero-emblem span { width: 12px; height: 12px; background: var(--accent); box-shadow: 0 0 16px rgb(255 184 77 / 60%); }
.eyebrow {
  margin: 0 0 14px;
  color: #9cb2c6;
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}
h1 {
  margin: 0;
  font-size: clamp(2.3rem, 7vw, 4rem);
  font-weight: 850;
  letter-spacing: 0.09em;
  line-height: 1.25;
}
h1 span { color: var(--accent); text-shadow: 0 0 24px rgb(255 184 77 / 18%); }
.hero-copy { margin: 20px 0 28px; color: #b7c6d6; font-size: 0.94rem; line-height: 1.9; }
.best-panel {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 0.75rem;
}
.best-panel strong { color: var(--ink); font-size: 2rem; font-variant-numeric: tabular-nums; }
.best-unit { color: #8fa5ba; font-size: 0.62rem; letter-spacing: 0.1em; }
.primary-button, .secondary-button {
  min-height: 50px;
  padding: 12px 24px;
  cursor: pointer;
  font-weight: 750;
  letter-spacing: 0.04em;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  min-width: min(100%, 280px);
  color: #181007;
  border: 1px solid var(--accent);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  background: var(--accent);
  box-shadow: 0 0 22px rgb(255 184 77 / 12%);
}
.primary-button:hover:not(:disabled) { box-shadow: 0 0 28px rgb(255 184 77 / 25%); transform: translateY(-2px); }
.primary-button:active:not(:disabled), .secondary-button:active:not(:disabled) { transform: translateY(1px); }
.primary-button:disabled { color: #9aa5b1; border-color: #46505b; background: #28313c; box-shadow: none; }
.secondary-button {
  color: var(--ink);
  border: 1px solid var(--line);
  background: #121c28;
}
.secondary-button:hover:not(:disabled) { border-color: var(--tech); transform: translateY(-2px); }
.missing-note {
  max-width: 520px;
  margin: 18px auto -6px;
  padding: 10px 14px;
  color: #f3d09a;
  border-left: 2px solid var(--accent);
  background: rgb(255 184 77 / 6%);
  font-size: 0.74rem;
  line-height: 1.7;
  text-align: left;
}
.missing-note code { overflow-wrap: anywhere; color: #ffe0ae; font-family: ui-monospace, monospace; }
.storage-note { color: #d9c493; font-size: 0.72rem; }
.how-to { max-width: 500px; margin: 24px auto 18px; color: var(--muted); font-size: 0.8rem; line-height: 1.8; }
.feature-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.feature-list li { padding: 5px 10px; color: #b0c0d0; border: 1px solid rgb(162 178 196 / 20%); font-size: 0.67rem; }
.feature-list strong { color: var(--accent); }
.site-footer { width: min(100% - 32px, 960px); margin: 0 auto; padding: 0 0 24px; color: #96a8bb; text-align: center; font-size: 0.67rem; line-height: 1.75; }
.site-footer p { margin: 3px 0; }

.quiz-shell { width: 100%; }
.quiz-topline { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.question-counter { margin: 0; font-size: 0.82rem; font-weight: 750; letter-spacing: 0.07em; }
.clue-type { margin: 0; padding: 4px 10px; color: #b9d9e7; border: 1px solid rgb(57 197 243 / 35%); font-size: 0.65rem; letter-spacing: 0.06em; }
.progress-track { height: 4px; margin-bottom: 24px; overflow: hidden; background: #273443; }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--tech), var(--accent)); box-shadow: 0 0 12px rgb(57 197 243 / 40%); transition: width 0.3s ease; }
.player-card { min-height: 280px; padding: 28px clamp(20px, 5vw, 40px) 24px; text-align: center; border-color: rgb(57 197 243 / 35%); }
.player-card::before { background: var(--tech); box-shadow: 0 0 14px rgb(57 197 243 / 40%); }
.player-disc {
  position: relative;
  display: grid;
  width: 62px;
  height: 62px;
  margin: 0 auto 14px;
  color: var(--tech);
  border: 1px solid rgb(57 197 243 / 55%);
  background: rgb(57 197 243 / 6%);
  font-size: 1.8rem;
  transform: rotate(45deg);
  place-items: center;
}
.player-disc span { transform: rotate(-45deg); }
.player-disc::before { position: absolute; inset: -8px; content: ""; border: 1px solid rgb(255 184 77 / 18%); animation: breathe 2.6s ease-in-out infinite; }
.player-kicker { margin: 0 0 7px; color: var(--muted); font-size: 0.62rem; font-weight: 750; letter-spacing: 0.16em; }
.player-card h2 { margin: 0 0 8px; font-size: 1.25rem; }
.player-status { min-height: 1.5em; margin: 0 0 14px; color: var(--muted); font-size: 0.76rem; }
.player-play-button {
  min-width: 220px;
  min-height: 64px;
  padding: 14px 26px;
  cursor: pointer;
  color: var(--ink);
  border: 1px solid var(--tech);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  background: #153444;
  box-shadow: 0 0 22px rgb(57 197 243 / 10%);
  font-size: 1rem;
  font-weight: 750;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.player-play-button:hover:not(:disabled) { box-shadow: 0 0 28px rgb(57 197 243 / 24%); transform: translateY(-2px); }
.player-play-button:disabled { cursor: default; opacity: 0.72; }
.player-progress { width: min(100%, 420px); height: 6px; margin: 22px auto 8px; overflow: hidden; background: #29394a; }
.player-progress span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--tech), var(--accent)); box-shadow: 0 0 12px rgb(57 197 243 / 40%); transition: width 0.15s linear; }
.player-time { margin: 0 0 16px; color: #b7c8d8; font-family: ui-monospace, "Cascadia Mono", monospace; font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.player-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.player-controls .secondary-button { min-height: 44px; padding: 9px 18px; font-size: 0.78rem; }
.player-controls .secondary-button:disabled { cursor: default; opacity: 0.45; }
.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.option-button {
  display: flex;
  min-width: 0;
  min-height: 68px;
  padding: 13px 16px;
  cursor: pointer;
  align-items: center;
  gap: 13px;
  color: var(--ink);
  text-align: left;
  border: 1px solid var(--line);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
  background: rgb(19 29 41 / 96%);
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}
.option-button:hover:not(:disabled) { border-color: var(--option-color); background: #1a2a3a; transform: translateY(-2px); }
.option-color-1, .option-color-3 { --option-color: var(--tech); }
.option-color-2, .option-color-4 { --option-color: var(--accent); }
.option-number { flex: 0 0 auto; color: #93a7ba; font-family: ui-monospace, monospace; font-size: 0.67rem; }
.option-title { min-width: 0; overflow-wrap: anywhere; font-size: 0.94rem; font-weight: 650; line-height: 1.5; }
.option-button:disabled { opacity: 0.62; }
.option-button.is-correct, .option-button.is-correct:disabled { opacity: 1; border-color: var(--green); background: rgb(37 94 65 / 42%); }
.option-button.is-correct::after { margin-left: auto; content: "✓"; color: var(--green); font-weight: 900; }
.option-button.is-wrong, .option-button.is-wrong:disabled { opacity: 1; border-color: var(--red); background: rgb(104 43 51 / 42%); }
.option-button.is-wrong::after { margin-left: auto; content: "×"; color: var(--red); font-weight: 900; }
.score-strip { display: flex; align-items: center; justify-content: center; gap: clamp(32px, 10vw, 70px); margin-top: 18px; padding: 14px 20px; border-top: 1px solid rgb(162 178 196 / 15%); border-bottom: 1px solid rgb(162 178 196 / 15%); }
.score-strip > div { display: flex; align-items: baseline; gap: 12px; }
.score-label { color: var(--muted); font-size: 0.72rem; }
.score-strip strong { font-size: 1.45rem; font-variant-numeric: tabular-nums; }
.score-strip small { color: var(--muted); font-size: 0.55rem; }
.score-divider { width: 1px; height: 26px; background: var(--line); }
.feedback { margin-top: 16px; padding: 17px 20px; border: 1px solid var(--line); background: rgb(17 25 35 / 96%); animation: feedback-in 0.18s ease-out both; }
.feedback-result { margin: 0 0 10px; font-size: 0.94rem; font-weight: 800; }
.correct-text { color: #a3f5c4; }
.wrong-text { color: #ffb0b7; }
.answer-details p { margin: 6px 0; color: #bdc9d8; font-size: 0.76rem; line-height: 1.65; }
.answer-details span { color: #91a5b9; }
.result-card h2, .error-card h2 { margin: 8px 0 12px; font-size: clamp(1.55rem, 5vw, 2.2rem); }
.result-subtitle { margin: 0 0 26px; color: var(--muted); font-size: 0.84rem; }
.record-badge { width: fit-content; margin: 0 auto 20px; padding: 8px 18px; color: #ffe0a0; border: 1px solid var(--accent); background: rgb(255 184 77 / 7%); font-size: 0.84rem; font-weight: 750; animation: breathe 1.8s ease-in-out infinite; }
.total-panel { display: flex; align-items: baseline; justify-content: center; gap: 12px; padding: 24px 12px; border-top: 1px solid rgb(162 178 196 / 15%); border-bottom: 1px solid rgb(162 178 196 / 15%); color: var(--muted); font-size: 0.75rem; }
.total-panel strong { color: var(--accent); font-size: clamp(3rem, 10vw, 4.3rem); font-variant-numeric: tabular-nums; line-height: 1; text-shadow: 0 0 26px rgb(255 184 77 / 18%); }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 24px 0 30px; }
.result-stats > div { display: flex; min-width: 0; padding: 0 8px; flex-direction: column; gap: 8px; }
.result-stats > div + div { border-left: 1px solid var(--line); }
.result-stats span { color: var(--muted); font-size: 0.7rem; }
.result-stats strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.error-card p:not(.eyebrow) { color: var(--muted); line-height: 1.8; }
.error-card .primary-button { margin-top: 18px; }
.noscript { position: fixed; right: 16px; bottom: 16px; left: 16px; padding: 16px; color: var(--ink); text-align: center; border: 1px solid var(--red); background: var(--panel); }

@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes feedback-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes breathe { 0%, 100% { opacity: 0.65; transform: scale(0.96); } 50% { opacity: 1; transform: scale(1.04); } }

@media (max-width: 767px) {
  .site-header { width: calc(100% - 32px); min-height: 58px; }
  .header-status { display: none; }
  .app-shell { width: calc(100% - 28px); min-height: calc(100svh - 138px); padding: 24px 0 28px; }
  .hero-card, .result-card, .error-card { padding: 30px 20px; }
  .hero-emblem { width: 64px; height: 64px; margin-bottom: 22px; }
  .corner-tag { right: 18px; font-size: 0.56rem; }
  .options { grid-template-columns: 1fr; gap: 10px; }
  .option-button { min-height: 56px; }
  .player-card { min-height: 270px; padding: 24px 18px 20px; }
  .player-play-button { width: min(100%, 280px); }
  .score-strip { gap: 26px; }
  .score-strip > div { flex-direction: column; align-items: center; gap: 3px; }
}
@media (max-width: 380px) {
  .app-shell { width: calc(100% - 24px); }
  .hero-card, .result-card, .error-card { padding-right: 16px; padding-left: 16px; }
  .score-strip { gap: 20px; padding-right: 8px; padding-left: 8px; }
  .result-actions { flex-direction: column; }
  .result-actions button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
