:root {
  color-scheme: dark;
  --bg: #070814;
  --panel: rgba(16, 20, 42, 0.86);
  --panel-strong: #11162f;
  --line: rgba(141, 247, 255, 0.22);
  --text: #f5f7ff;
  --muted: #aab2d7;
  --cyan: #63f6ff;
  --lime: #a8ff5e;
  --pink: #ff4fd8;
  --amber: #ffd166;
  --red: #ff5470;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 10%, rgba(99, 246, 255, 0.16), transparent 30%),
    radial-gradient(circle at 88% 20%, rgba(255, 79, 216, 0.14), transparent 28%),
    linear-gradient(135deg, #070814 0%, #111332 50%, #090a18 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1080px, calc(100% - 32px));
  min-height: calc(100vh - 56px);
  margin: 0 auto;
  display: grid;
  align-items: center;
  padding: 28px 0 16px;
}

.screen {
  display: none;
}

.screen--active {
  display: block;
}

.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 22px;
  margin-bottom: 28px;
}

.brand-mark {
  width: clamp(82px, 18vw, 132px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid var(--cyan);
  border-radius: 18px;
  color: var(--cyan);
  font-size: clamp(28px, 7vw, 52px);
  font-weight: 900;
  box-shadow: 0 0 22px rgba(99, 246, 255, 0.56), inset 0 0 28px rgba(99, 246, 255, 0.12);
  transform: rotate(-4deg);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--lime);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 0.95;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(3.25rem, 11vw, 7.5rem);
  text-shadow: 0 0 28px rgba(255, 79, 216, 0.42);
}

h2 {
  font-size: clamp(2rem, 6vw, 4.5rem);
}

.intro {
  max-width: 720px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.55;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.additional-quizzes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.additional-quizzes > div { min-width: 0; }
.quiz-catalog { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.quiz-catalog .mode-card { min-width: 0; }
.quiz-catalog .car-option { display: block; }
.car-option-title { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px; }
.car-preview { width: 48px; height: 48px; object-fit: contain; background: #ee7816; border-radius: 4px; }
.car-modes { display: flex; gap: 8px; margin-top: 8px; }
.car-modes button { min-height: 40px; padding: 0 12px; font-size: 14px; }
.car-modes button:hover, .car-modes button:focus-visible { border-color: var(--cyan); }
.animal-card { border-color: var(--pink); }
.club-card { border-color: var(--amber); }
.club-preview { object-fit: contain; background: #e7edf2; padding: 6px; }
.logo-stage.club-stage { background: #e7edf2; }
.logo-stage.club-stage img { filter: none; }

.category-title {
  font-size: 1.25rem;
  line-height: 1.3;
  margin: 24px 0 12px;
}

.football-card {
  width: 100%;
  grid-template-columns: 88px 1fr auto;
  border-color: var(--lime);
}

.football-preview {
  width: 88px;
  height: 104px;
  object-fit: cover;
  object-position: center 25%;
  border-radius: 4px;
}

.play-arrow { font-size: 2rem; color: var(--lime); }
.site-note a { color: var(--cyan); }
.photo-credit { color: var(--muted); font-size: 0.75rem; line-height: 1.4; overflow-wrap: anywhere; margin: -12px 0 16px; }
.photo-credit a { color: var(--muted); }
.logo-stage.photo-stage { position: relative; display: block; height: 340px; background: #080a10; overflow: hidden; }
.logo-stage.photo-stage img { position: absolute; inset: 0; width: 100%; height: 100%; max-height: 100%; object-fit: contain; filter: none; }
.sources-shell { max-width: 900px; padding: 32px 20px; margin: auto; }
.sources-shell h1 { font-size: 2rem; line-height: 1.2; }
.sources-shell h2 { font-size: 1.1rem; line-height: 1.3; }
.sources-shell a { color: var(--cyan); overflow-wrap: anywhere; }
.source-entry { border-bottom: 1px solid var(--line); padding: 18px 0; }
.source-entry p { line-height: 1.6; overflow-wrap: anywhere; }

.mode-card {
  min-height: 146px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 22px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  box-shadow: var(--shadow);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.mode-card:hover,
.mode-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--cyan);
  box-shadow: 0 0 34px rgba(99, 246, 255, 0.22), var(--shadow);
  outline: none;
}

.mode-card--hot {
  border-color: rgba(255, 79, 216, 0.52);
}

.mode-icon {
  width: 64px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #07101b;
  background: linear-gradient(135deg, var(--cyan), var(--lime));
  font-weight: 900;
}

.mode-card strong {
  display: block;
  font-size: 1.4rem;
}

.mode-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.35;
}

.quiz-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.quiz-preview div {
  padding: 18px;
  background: rgba(8, 10, 24, 0.74);
}

.quiz-preview strong,
.quiz-preview span {
  display: block;
}

.quiz-preview strong {
  color: var(--cyan);
  font-size: 2rem;
}

.quiz-preview span {
  color: var(--muted);
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.icon-button {
  width: 48px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(16, 20, 42, 0.82);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--pink), var(--lime));
  transition: width 240ms ease;
}

.play-card,
.result-card {
  padding: clamp(18px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.logo-stage {
  position: relative;
  overflow: hidden;
  height: clamp(210px, 38vh, 340px);
  display: grid;
  place-items: center;
  margin: 24px 0;
  border: 1px solid rgba(99, 246, 255, 0.26);
  border-radius: 8px;
  background:
    linear-gradient(rgba(99, 246, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 246, 255, 0.08) 1px, transparent 1px),
    rgba(7, 8, 20, 0.66);
  background-size: 24px 24px;
}

.logo-stage img {
  position: absolute;
  inset: 14% 16%;
  width: 68%;
  height: 72%;
  max-height: none;
  object-fit: contain;
  filter: invert(83%) sepia(76%) saturate(1295%) hue-rotate(143deg) brightness(105%) contrast(102%)
    drop-shadow(0 0 18px rgba(99, 246, 255, 0.6));
  user-select: none;
}

.timing-bar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; margin: 0 0 16px; color: var(--muted); font-size: 0.9rem; }
.timing-bar strong, .result-time { color: var(--cyan); font-variant-numeric: tabular-nums; }
.result-time { font-size: 1.4rem; font-weight: 800; }
.record-copy { color: var(--lime); line-height: 1.5; }

.answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.answer-button,
.primary-button,
.ghost-button {
  min-height: 54px;
  border-radius: 8px;
  font-weight: 850;
}

.answer-button {
  padding: 14px 16px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.answer-button:hover,
.answer-button:focus-visible {
  border-color: var(--cyan);
  outline: none;
}

.answer-button.correct {
  border-color: var(--lime);
  color: #09110a;
  background: var(--lime);
}

.answer-button.wrong {
  border-color: var(--red);
  color: #fff;
  background: rgba(255, 84, 112, 0.72);
}

.type-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.type-panel[hidden],
.answers[hidden],
#next-btn[hidden] {
  display: none;
}

input {
  min-width: 0;
  min-height: 56px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  outline: none;
}

input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(99, 246, 255, 0.16);
}

.primary-button,
.ghost-button {
  padding: 0 22px;
  border: 1px solid transparent;
}

.primary-button {
  color: #07101b;
  background: linear-gradient(135deg, var(--cyan), var(--lime));
}

.primary-button--wide {
  width: 100%;
  margin-top: 14px;
}

.ghost-button {
  color: var(--text);
  background: transparent;
  border-color: var(--line);
}

.feedback {
  min-height: 48px;
  display: grid;
  align-items: center;
  margin-top: 14px;
  color: var(--muted);
  font-weight: 800;
}

.feedback-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; margin-top: 12px; min-height: 54px; }
.feedback-row .feedback { margin: 0; min-height: 44px; }

.feedback.good {
  color: var(--lime);
}

.feedback.bad {
  color: var(--red);
}

.result-card {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.final-score {
  margin: 20px auto;
  width: min(260px, 70vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid var(--pink);
  border-radius: 50%;
  color: var(--cyan);
  font-size: 3.25rem;
  font-weight: 950;
  box-shadow: 0 0 46px rgba(255, 79, 216, 0.34), inset 0 0 36px rgba(99, 246, 255, 0.12);
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.site-note {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto 18px;
  color: rgba(245, 247, 255, 0.62);
  font-size: 0.84rem;
  line-height: 1.45;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#ball-window { display: contents; }
.logo-stage.car-stage { --car-height: 290px; display: grid; place-items: center; }
.car-stage #ball-window { display: block; position: relative; width: min(100%, calc(var(--car-height) * var(--car-aspect))); aspect-ratio: var(--car-aspect); overflow: hidden; }
.logo-stage.car-stage #logo { inset: auto; height: auto; max-height: none; object-fit: initial; filter: none; }
.logo-stage.ball-stage { --ball-height: 290px; display: grid; place-items: center; }
.ball-stage #ball-window { display: block; position: relative; width: min(100%, calc(var(--ball-height) * 4 / 3)); aspect-ratio: 4 / 3; overflow: hidden; }
.logo-stage.ball-stage #logo { inset: auto; height: auto; max-height: none; object-fit: initial; filter: none; }
.logo-stage .zoom-button { position: absolute; top: 8px; right: 8px; z-index: 2; background: #111820; border-color: #63f6ff; }
.logo-stage .zoom-button img { position: static; width: 22px; height: 22px; filter: none; object-fit: contain; }
.zoom-button:disabled { opacity: .55; cursor: default; }
.logo-stage .zoom-button[hidden] { display: none; }
.logo-stage .zoom-button img { filter: invert(1); }
.ball-card { border-color: #ffca57; }
.bird-card { border-color: #63f6ff; }

@media (min-width: 721px) {
  .logo-stage.ball-stage { --ball-height: clamp(100px, calc(100dvh - 430px), 280px); }
  .logo-stage.car-stage { --car-height: clamp(100px, calc(100dvh - 430px), 280px); }
  .quiz-catalog .mode-card { min-height: 96px; }
}
@media (min-width: 1000px) {
  .quiz-catalog { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quiz-catalog .football-card { grid-template-columns: 48px minmax(0, 1fr); padding: 14px; gap: 10px; }
  .quiz-catalog .football-preview { width: 48px; }
  .quiz-catalog .play-arrow { display: none; }
  .quiz-catalog .mode-card strong { font-size: 18px; }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 24px, 520px);
    align-items: start;
    padding-top: 18px;
  }

  .hero,
  .mode-grid,
  .additional-quizzes,
  .quiz-catalog,
  .answers,
  .type-panel {
    grid-template-columns: 1fr;
  }

  .hero {
    gap: 16px;
  }

  .brand-mark {
    width: 86px;
  }

  .quiz-preview {
    grid-template-columns: 1fr;
  }

  .topbar {
    gap: 8px;
  }

  .icon-button {
    width: 42px;
  }

  .logo-stage {
    height: 230px;
  }

  .logo-stage.photo-stage { height: 290px; }
  .football-card { grid-template-columns: 64px 1fr; padding: 16px; gap: 14px; }
  .football-preview { width: 64px; height: 86px; }
  .football-card strong { font-size: 1.15rem; }
  .play-arrow { display: none; }

  .progress-label {
    font-size: 0.78rem;
  }
}

@media (min-width: 721px) {
  body:has(.shell) { display: flex; flex-direction: column; min-height: 100dvh; }
  .shell { min-height: 0; height: calc(100dvh - 52px); padding: 12px 0; flex: 0 0 auto; }
  .screen--active { min-width: 0; width: 100%; }
  .hero { gap: 18px; margin-bottom: 12px; }
  .brand-mark { width: 72px; border-radius: 8px; font-size: 28px; }
  h1 { font-size: 56px; line-height: 1; }
  h2 { font-size: 36px; line-height: 1.1; }
  .intro { font-size: 16px; margin-top: 8px; line-height: 1.4; }
  .category-title { font-size: 18px; margin: 12px 0 8px; }
  .mode-grid { gap: 12px; }
  .mode-card { min-height: 96px; padding: 14px 18px; gap: 14px; }
  .quiz-catalog .mode-card { min-height: 96px; }
  .mode-card strong { font-size: 20px; }
  .mode-card small { font-size: 14px; }
  .mode-icon { width: 48px; }
  .football-card { grid-template-columns: 60px minmax(0, 1fr) auto; }
  .football-preview { width: 60px; height: 66px; }
  .quiz-preview { margin-top: 12px; }
  .quiz-preview div { padding: 10px 16px; }
  .quiz-preview strong { font-size: 24px; }
  .quiz-preview span { font-size: 14px; }
  .topbar { margin-bottom: 6px; }
  .icon-button { width: 40px; }
  .progress-track { height: 8px; }
  .progress-label { margin-bottom: 6px; }
  .timing-bar { margin-bottom: 8px; font-size: 15px; }
  .timing-bar strong { font-size: 19px; }
  .play-card, .result-card { padding: 16px 24px; }
  .play-card .eyebrow { margin-bottom: 6px; }
  .logo-stage, .logo-stage.photo-stage { height: clamp(100px, calc(100dvh - 430px), 280px); margin: 10px 0; }
  .photo-credit { margin: 0 0 8px; }
  .answers { gap: 8px; }
  .answer-button, .primary-button, .ghost-button { min-height: 44px; }
  .answer-button { padding: 10px 16px; }
  input { min-height: 44px; }
  .feedback-row { margin-top: 8px; min-height: 44px; }
  .feedback-row .feedback { min-height: 44px; }
  .final-score { width: 160px; margin: 12px auto; font-size: 38px; }
  .result-time { margin: 8px 0; font-size: 20px; }
  .record-copy { margin: 8px 0; }
  .result-actions { margin-top: 12px; }
  .site-note { margin: 0 auto; height: 52px; min-height: 52px; padding: 8px 0; font-size: 12px; display: block; line-height: 1.4; }
}

@media (min-width: 721px) and (max-height: 650px) {
  #home .hero { margin-bottom: 10px; }
  #home h1 { font-size: 44px; }
  #home .eyebrow { margin-bottom: 4px; }
  #home .intro { margin-top: 4px; }
  #home .quiz-catalog .mode-card { min-height: 86px; padding: 8px 14px; }
  #home .football-preview { height: 54px; }
  #home .mode-icon { width: 32px; }
  #home .car-preview { width: 32px; height: 32px; }
  #home .car-modes { margin-top: 6px; }
  #home .car-modes button { min-height: 32px; }
  #home .quiz-preview div { padding: 6px 12px; }
}
