:root {
  --ink: #f5f1ea;
  --muted: #9c98a8;
  --bg: #0b0a12;
  --panel: #14121d;
  --line: #302d3c;
  --acid: #d9ff45;
  --pink: #ff4da6;
  --red: #ff5c61;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-height: 100%; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 72% 18%, rgba(130, 58, 168, .18), transparent 26%),
    radial-gradient(circle at 12% 82%, rgba(217, 255, 69, .06), transparent 22%),
    var(--bg);
  font-family: "Manrope", sans-serif;
  overflow-x: hidden;
}

.noise {
  position: fixed; inset: 0; opacity: .055; pointer-events: none; z-index: 20;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

.topbar {
  width: min(1380px, calc(100% - 72px)); margin: 0 auto; height: 88px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  border-bottom: 1px solid var(--line);
}

.brand { color: var(--ink); text-decoration: none; display: flex; gap: 12px; align-items: center; font-weight: 800; letter-spacing: .12em; }
.brand-mark { width: 35px; height: 35px; display: grid; place-items: center; background: var(--acid); color: #0b0a12; font-size: 20px; transform: rotate(-4deg); }
.progress-meta { display: flex; gap: 16px; align-items: center; font: 500 10px "DM Mono", monospace; letter-spacing: .12em; color: var(--muted); }
.progress-meta strong { color: var(--ink); }
.progress-track { width: 138px; height: 3px; background: #282532; }
.progress-bar { width: 12.5%; height: 100%; background: var(--acid); transition: width .4s ease; }
.icon-button { justify-self: end; border: 0; background: transparent; color: var(--ink); width: 40px; height: 40px; cursor: pointer; padding: 9px; }
.icon-button svg { fill: none; stroke: currentColor; stroke-width: 1.7; width: 100%; }
.icon-button.muted { color: #686473; }

.game-shell { width: min(1380px, calc(100% - 72px)); margin: 52px auto 44px; }
.game-shell:has(.result-card:not([hidden])) .intro { display: none; }
.game-shell:not(:has(.result-card:not([hidden]))) { display: grid; grid-template-columns: 31% 69%; align-items: center; }

.intro { padding-right: 50px; }
.eyebrow { display: flex; gap: 11px; align-items: center; color: var(--acid); font: 500 10px "DM Mono", monospace; letter-spacing: .18em; }
.eyebrow span { width: 24px; height: 1px; background: var(--acid); }
h1 { font-size: clamp(48px, 5vw, 78px); line-height: .95; letter-spacing: -.065em; margin: 28px 0 22px; }
h1 em { font-family: Georgia, serif; font-weight: 400; color: var(--pink); }
.intro > p { color: var(--muted); font-size: 13px; line-height: 1.8; }
.score-card { margin-top: 44px; width: 190px; border-left: 1px solid var(--line); padding-left: 18px; display: grid; }
.score-label { font: 500 9px "DM Mono", monospace; color: var(--muted); letter-spacing: .13em; }
.score-value { font-size: 38px; font-weight: 800; line-height: 1.25; }
.streak { color: var(--acid); font: 500 9px "DM Mono", monospace; letter-spacing: .1em; }

.quiz-card { min-height: 600px; display: grid; grid-template-columns: 47% 53%; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 26px 90px rgba(0,0,0,.32); }
.portrait-panel { padding: 24px; border-right: 1px solid var(--line); background: #100f17; }
.portrait-frame { height: 445px; position: relative; overflow: hidden; background: #26222f; }
.portrait-frame::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 60%, rgba(8,7,12,.45)); pointer-events: none; }
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; object-position: center top; filter: saturate(.86) contrast(1.06); transition: opacity .2s, transform .55s ease; }
.portrait-frame:hover img { transform: scale(1.025); }
.scan-line { position: absolute; z-index: 2; top: 0; left: 0; right: 0; height: 1px; background: rgba(217,255,69,.5); box-shadow: 0 0 14px var(--acid); animation: scan 5s linear infinite; }
@keyframes scan { 0% { transform: translateY(0); opacity: 0; } 5% { opacity: 1; } 85% { opacity: .5; } 100% { transform: translateY(445px); opacity: 0; } }
.corner { position: absolute; z-index: 3; width: 22px; height: 22px; border-color: var(--acid); }
.corner-a { left: 12px; top: 12px; border-left: 1px solid; border-top: 1px solid; }
.corner-b { right: 12px; bottom: 12px; border-right: 1px solid; border-bottom: 1px solid; }
.image-count { position: absolute; right: 16px; top: 15px; z-index: 3; color: #fff; font: 500 9px "DM Mono", monospace; letter-spacing: .12em; text-shadow: 0 1px 4px #000; }
.character-meta { display: flex; justify-content: space-between; gap: 20px; align-items: end; padding: 18px 4px 2px; }
.meta-label { font: 500 8px "DM Mono", monospace; color: #777282; letter-spacing: .14em; }
.character-meta h2 { font-size: 20px; margin: 4px 0 0; letter-spacing: -.02em; }
.series-block { text-align: right; max-width: 45%; }
.series-block p { color: var(--muted); font-size: 11px; margin: 6px 0 0; }

.answer-panel { padding: 36px 36px 22px; display: flex; flex-direction: column; }
.prompt-row { display: flex; justify-content: space-between; color: var(--muted); font: 500 9px "DM Mono", monospace; letter-spacing: .12em; margin-bottom: 18px; }
.kbd-hint { color: #625e6d; }
.answers { display: grid; gap: 10px; }
.answer-button { min-height: 72px; padding: 14px 17px; color: var(--ink); background: #191721; border: 1px solid #34313f; cursor: pointer; display: grid; grid-template-columns: 32px 1fr 20px; align-items: center; gap: 12px; text-align: left; transition: border-color .18s, background .18s, transform .18s; }
.answer-button:hover:not(:disabled), .answer-button:focus-visible { outline: none; border-color: #757080; background: #201e29; transform: translateX(3px); }
.answer-button:disabled { cursor: default; }
.answer-num { font: 500 10px "DM Mono", monospace; color: #6e697a; }
.answer-name { display: block; font-weight: 700; font-size: 14px; letter-spacing: .01em; }
.answer-sub { display: block; color: #777282; font-size: 9px; margin-top: 4px; }
.answer-arrow { color: #615c6c; font-size: 17px; }
.answer-button.correct { border-color: var(--acid); background: rgba(217,255,69,.08); }
.answer-button.correct .answer-num, .answer-button.correct .answer-arrow { color: var(--acid); }
.answer-button.wrong { border-color: var(--red); background: rgba(255,92,97,.07); }
.answer-button.wrong .answer-num, .answer-button.wrong .answer-arrow { color: var(--red); }

.feedback { margin-top: 16px; min-height: 88px; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 12px; padding: 13px 14px; background: var(--acid); color: #10100d; animation: reveal .25s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(6px); } }
.feedback.is-wrong { background: var(--red); }
.feedback-icon { border: 1px solid rgba(0,0,0,.35); width: 34px; height: 34px; display: grid; place-items: center; font-weight: 800; }
.feedback-copy strong { font: 700 10px "DM Mono", monospace; letter-spacing: .08em; }
.feedback-copy p { margin: 5px 0 0; font-size: 10px; line-height: 1.4; max-width: 265px; }
.next-button { border: 0; background: #10100d; color: #fff; padding: 11px 13px; cursor: pointer; font: 600 9px "DM Mono", monospace; letter-spacing: .08em; }
.next-button span { color: var(--acid); margin-left: 8px; }
.bottom-note { margin-top: auto; display: flex; align-items: center; justify-content: space-between; color: #5d5968; font: 500 8px "DM Mono", monospace; letter-spacing: .1em; padding-top: 18px; }
.bottom-note i { width: 3px; height: 3px; background: #4d4958; border-radius: 50%; }

.result-card { width: min(760px, 100%); margin: 7vh auto 10vh; text-align: center; border: 1px solid var(--line); background: var(--panel); padding: 48px; position: relative; overflow: hidden; }
.result-card::before { content: ""; position: absolute; width: 320px; height: 320px; left: 50%; top: 90px; transform: translateX(-50%); background: var(--pink); filter: blur(120px); opacity: .12; }
.result-kicker { color: var(--acid); font: 500 10px "DM Mono", monospace; letter-spacing: .2em; }
.result-grade { font-size: 145px; line-height: 1; font-weight: 800; letter-spacing: -.08em; color: var(--acid); margin-top: 18px; position: relative; }
.result-card h2 { font-size: 34px; margin: 0 0 10px; }
.result-card > p { color: var(--muted); font-size: 13px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); margin: 32px 0; }
.result-stats div { padding: 20px 10px; display: grid; gap: 5px; }
.result-stats div + div { border-left: 1px solid var(--line); }
.result-stats strong { font-size: 22px; }
.result-stats span { color: var(--muted); font: 500 8px "DM Mono", monospace; letter-spacing: .13em; }
.restart-button { padding: 15px 22px; border: 0; background: var(--acid); color: #10100d; cursor: pointer; font: 700 10px "DM Mono", monospace; letter-spacing: .1em; }
.restart-button span { margin-left: 10px; }

footer { width: min(1380px, calc(100% - 72px)); margin: 0 auto; border-top: 1px solid var(--line); height: 62px; display: flex; justify-content: space-between; align-items: center; color: #5e5a67; font: 500 8px "DM Mono", monospace; letter-spacing: .14em; }
.footer-mark { color: var(--pink); }

@media (max-width: 1000px) {
  .game-shell:not(:has(.result-card:not([hidden]))) { grid-template-columns: 1fr; }
  .intro { display: grid; grid-template-columns: 1fr auto; padding: 0; margin-bottom: 30px; }
  .intro h1 { grid-column: 1; font-size: 52px; }
  .intro > p { grid-column: 1; }
  .score-card { grid-column: 2; grid-row: 1 / 4; align-self: center; }
}

@media (max-width: 700px) {
  .topbar, .game-shell, footer { width: min(100% - 28px, 1380px); }
  .topbar { height: 70px; grid-template-columns: 1fr auto; }
  .progress-meta { display: none; }
  .intro { display: block; }
  .intro h1 { font-size: 48px; }
  .score-card { margin: 25px 0; }
  .quiz-card { grid-template-columns: 1fr; }
  .portrait-panel { border-right: 0; border-bottom: 1px solid var(--line); padding: 14px; }
  .portrait-frame { height: 390px; }
  .answer-panel { padding: 25px 16px 18px; }
  .answer-button { min-height: 65px; }
  .feedback { grid-template-columns: 34px 1fr; }
  .next-button { grid-column: 1 / -1; }
  .bottom-note { display: none; }
  .result-card { padding: 36px 18px; }
  .result-grade { font-size: 110px; }
  footer span:first-child, .footer-mark { display: none; }
  footer { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
