:root {
  color-scheme: dark;
  --bg: #081020;
  --bg-deep: #050916;
  --panel: rgba(18, 29, 55, 0.88);
  --panel-strong: #121d37;
  --line: rgba(180, 205, 255, 0.17);
  --text: #f7f9ff;
  --muted: #aab7d4;
  --accent: #b5f13b;
  --accent-strong: #d2ff73;
  --purple: #a879ff;
  --cyan: #55d9ff;
  --danger: #ff7183;
  --success: #8ef06a;
  --shadow: 0 26px 90px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

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

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 17% 18%, rgba(168, 121, 255, 0.17), transparent 31rem),
    radial-gradient(circle at 88% 9%, rgba(85, 217, 255, 0.13), transparent 29rem),
    linear-gradient(145deg, #0b1730 0%, var(--bg-deep) 68%);
}

button { font: inherit; }
button:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }

.background-orbit {
  position: fixed;
  z-index: 0;
  border: 1px solid rgba(181, 241, 59, 0.12);
  border-radius: 50%;
  pointer-events: none;
}
.orbit-one { width: 42rem; height: 15rem; left: -12rem; bottom: 6rem; transform: rotate(24deg); }
.orbit-two { width: 32rem; height: 10rem; right: -9rem; top: 12rem; transform: rotate(-34deg); }

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1500px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 21px;
  background: linear-gradient(145deg, rgba(181,241,59,.18), rgba(168,121,255,.18));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
  font-size: 1.38rem;
  font-weight: 900;
  letter-spacing: -.06em;
}
.brand-mark span { color: var(--accent); }

.eyebrow, .section-kicker {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.55rem, 2.5vw, 2.65rem);
  line-height: 1;
  letter-spacing: -.045em;
}

.games-played {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .01em;
}

.header-score {
  min-width: 155px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(8,16,32,.62);
  text-align: right;
}
.header-score span { display: block; color: var(--muted); font-size: .72rem; }
.header-score strong { color: var(--accent-strong); font-size: 1.55rem; }
.header-score strong span { display: inline; color: inherit; font-size: inherit; }

.game-layout {
  display: grid;
  grid-template-columns: minmax(390px, .84fr) minmax(560px, 1.16fr);
  gap: 22px;
  min-height: min(780px, calc(100vh - 145px));
}

.play-column, .award-column {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.play-column { display: grid; }
.panel { align-self: stretch; padding: clamp(28px, 4vw, 58px); }
.panel.is-hidden, .is-hidden { display: none !important; }

.intro-panel, .end-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.panel h2 {
  max-width: 16ch;
  margin: 8px 0 16px;
  font-size: clamp(2.15rem, 4.6vw, 4.45rem);
  line-height: .98;
  letter-spacing: -.06em;
}
.panel > p:not(.section-kicker, .status-message, .hint-text) {
  max-width: 56ch;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.65;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 28px 0;
}
.rules-grid div {
  min-height: 106px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(5,9,22,.4);
}
.rules-grid strong { display: block; color: var(--accent-strong); font-size: 1.8rem; }
.rules-grid span { display: block; margin-top: 5px; color: var(--muted); font-size: .78rem; line-height: 1.3; }

.primary-button {
  width: fit-content;
  min-width: 210px;
  min-height: 54px;
  padding: 13px 22px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #10180a;
  box-shadow: 0 12px 32px rgba(181,241,59,.22);
  cursor: pointer;
  font-weight: 850;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.primary-button:hover:not(:disabled) { transform: translateY(-2px); background: var(--accent-strong); box-shadow: 0 17px 38px rgba(181,241,59,.28); }
.primary-button:disabled { opacity: .55; cursor: wait; }

.quiz-panel { display: flex; flex-direction: column; justify-content: center; }
.quiz-meta { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: .84rem; font-weight: 750; }
.progress-track { flex: 1; height: 6px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.09); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--purple), var(--accent)); transition: width 450ms ease; }
.quiz-panel h2 { max-width: 22ch; margin-top: 30px; font-size: clamp(1.75rem, 3vw, 2.85rem); line-height: 1.14; letter-spacing: -.04em; }

.choices { display: grid; gap: 11px; margin-top: 18px; }
.choice-button {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 10px 16px 10px 11px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(5,9,22,.48);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}
.choice-button:hover:not(:disabled) { transform: translateX(4px); border-color: rgba(181,241,59,.52); background: rgba(181,241,59,.07); }
.choice-button:disabled { cursor: default; }
.choice-key { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: rgba(168,121,255,.16); color: #d9c7ff; font-weight: 900; }
.choice-button.is-selected { border-color: var(--cyan); }
.choice-button.is-correct { border-color: var(--success); background: rgba(142,240,106,.14); }
.choice-button.is-wrong { border-color: var(--danger); background: rgba(255,113,131,.14); }

.text-button { width: fit-content; margin-top: 18px; padding: 7px 0; border: 0; background: transparent; color: var(--cyan); cursor: pointer; font-weight: 750; }
.hint-text { margin: 5px 0 0; padding: 12px 14px; border-left: 3px solid var(--cyan); background: rgba(85,217,255,.07); color: #d7e9f2; line-height: 1.5; }
.status-message { min-height: 26px; margin: 15px 0 0; color: var(--muted); font-weight: 750; }
.status-message.is-success { color: var(--success); }
.status-message.is-error { color: var(--danger); }

.answer-reveal { display: grid; gap: 5px; margin: 22px 0 28px; padding: 16px 18px; border: 1px solid rgba(255,113,131,.3); border-radius: 14px; background: rgba(255,113,131,.08); }
.answer-reveal span { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; }
.answer-reveal strong { font-size: 1.2rem; }
.answer-reveal small { color: var(--muted); line-height: 1.45; }

.keyboard-note { margin: 12px 0 0; color: var(--muted); font-size: .78rem; }
kbd { display: inline-grid; place-items: center; min-width: 26px; height: 24px; margin-left: 4px; padding: 0 6px; border: 1px solid var(--line); border-bottom-color: rgba(255,255,255,.35); border-radius: 6px; background: rgba(255,255,255,.07); color: var(--text); font-family: inherit; font-size: .72rem; font-weight: 850; box-shadow: 0 2px 0 rgba(0,0,0,.28); }

.end-panel { justify-content: flex-start; overflow-y: auto; }
.end-panel h2 { margin-bottom: 10px; }
.result-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 18px; margin: 18px 0 2px; padding: 16px 18px; border: 1px solid rgba(181,241,59,.25); border-radius: 14px; background: rgba(181,241,59,.07); }
.result-summary strong { color: var(--accent-strong); font-size: clamp(1.25rem, 2vw, 1.7rem); }
.result-summary span { color: var(--cyan); font-weight: 800; }

.leaderboard-card { margin: 24px 0 22px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: rgba(5,9,22,.42); }
.leaderboard-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.leaderboard-header h3 { margin: 1px 0 0; font-size: 1.45rem; }
.leaderboard-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.leaderboard-position { padding: 8px 11px; border: 1px solid rgba(85,217,255,.25); border-radius: 999px; background: rgba(85,217,255,.07); color: var(--cyan); font-size: .82rem; white-space: nowrap; }

.initials-form { margin: 0 0 16px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); }
.initials-form > label { display: block; margin-bottom: 7px; color: var(--muted); font-size: .76rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.initials-controls { display: grid; grid-template-columns: 92px minmax(150px, max-content); gap: 9px; align-items: stretch; }
.initials-controls input { width: 92px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 11px; outline: 0; background: rgba(5,9,22,.65); color: var(--text); font: 900 1.25rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .18em; text-align: center; text-transform: uppercase; }
.initials-controls input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(85,217,255,.12); }
.initials-form small { display: block; margin-top: 8px; color: var(--muted); line-height: 1.4; }
.initials-form small strong { color: var(--text); }
.secondary-button { min-height: 44px; padding: 9px 14px; border: 1px solid rgba(168,121,255,.36); border-radius: 11px; background: rgba(168,121,255,.12); color: #e3d8ff; cursor: pointer; font-weight: 800; }
.secondary-button:hover:not(:disabled) { border-color: rgba(181,241,59,.48); background: rgba(181,241,59,.08); color: var(--accent-strong); }
.secondary-button:disabled { opacity: .55; cursor: wait; }
.status-message.compact { min-height: 20px; margin: 8px 0 0; font-size: .8rem; }

.leaderboard-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; }
.leaderboard-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.leaderboard-table th, .leaderboard-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.leaderboard-table th { background: rgba(255,255,255,.045); color: var(--muted); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; }
.leaderboard-table tr:last-child td { border-bottom: 0; }
.leaderboard-table td:nth-child(1) { width: 42px; color: var(--muted); }
.leaderboard-table td:nth-child(2) { font-weight: 900; letter-spacing: .08em; }
.leaderboard-table tr.is-current td { background: rgba(181,241,59,.1); color: var(--accent-strong); }
.restart-button { width: auto; min-height: 42px; margin-top: 0; padding: 10px 14px; white-space: nowrap; }
.restart-button kbd { min-width: 23px; height: 21px; margin-left: 7px; border-color: rgba(5,9,22,.35); border-bottom-color: rgba(5,9,22,.65); background: rgba(5,9,22,.2); color: inherit; box-shadow: 0 2px 0 rgba(5,9,22,.35); }

.award-column { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; padding: 22px; overflow: hidden; }
.award-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 4px 4px 14px; }
.award-heading h2 { margin: 0; font-size: 1.38rem; letter-spacing: -.035em; }
.award-badge { padding: 8px 12px; border: 1px solid rgba(181,241,59,.24); border-radius: 999px; background: rgba(181,241,59,.08); color: var(--accent-strong); font-size: .78rem; font-weight: 850; }

.model-frame {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 34%, rgba(255,255,255,.08), transparent 38%),
    rgba(238,244,255,.96);
  transition: box-shadow 600ms ease, border-color 600ms ease;
}
.model-frame.is-complete { border-color: rgba(181,241,59,.72); box-shadow: 0 0 0 1px rgba(181,241,59,.3), 0 0 48px rgba(181,241,59,.22); }
.model-frame object { display: block; width: 100%; height: 100%; max-height: calc(100vh - 300px); min-height: 520px; }
.model-loader { position: absolute; color: #34405a; font-size: .85rem; }

.latest-award { display: flex; align-items: center; gap: 13px; min-height: 74px; padding: 13px 5px 0; }
.latest-award > span { display: grid; place-items: center; width: 52px; height: 52px; border: 1px solid rgba(168,121,255,.38); border-radius: 15px; background: rgba(168,121,255,.13); color: #dacbff; font-family: Georgia, serif; font-size: 1.65rem; }
.latest-award small { display: block; color: var(--muted); }
.latest-award strong { display: block; margin-top: 2px; }

.celebration { position: fixed; inset: 0; z-index: 10; overflow: hidden; pointer-events: none; }
.celebration span { position: absolute; left: var(--x); top: -4rem; color: var(--accent-strong); font-family: Georgia, serif; font-size: 1.3rem; font-weight: 800; opacity: 0; }
.celebration.is-active span { animation: particle-fall var(--duration) var(--delay) cubic-bezier(.2,.7,.3,1) forwards; }
@keyframes particle-fall { 0% { opacity: 0; transform: translateY(-5vh) rotate(0); } 12% { opacity: 1; } 100% { opacity: 0; transform: translateY(112vh) rotate(var(--rotation)); } }

noscript { position: fixed; inset: auto 20px 20px; padding: 12px 16px; border-radius: 10px; background: var(--danger); color: #17090c; font-weight: 800; }

@media (max-width: 1050px) {
  .game-layout { grid-template-columns: 1fr; }
  .model-frame object { min-height: 620px; max-height: none; }
  .award-column { min-height: 760px; }
}

@media (max-width: 650px) {
  .app-shell { width: min(100% - 20px, 1500px); padding-top: 14px; }
  .site-header { grid-template-columns: auto 1fr; }
  .brand-mark { width: 56px; height: 56px; border-radius: 16px; }
  .header-score { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; text-align: left; }
  .game-layout { min-height: auto; }
  .play-column, .award-column { border-radius: 19px; }
  .panel { padding: 26px 20px; }
  .panel h2 { font-size: 2.4rem; }
  .rules-grid { grid-template-columns: 1fr; }
  .rules-grid div { min-height: auto; }
  .primary-button { width: 100%; }
  .award-column { min-height: 600px; padding: 13px; }
  .award-heading { align-items: flex-start; }
  .model-frame object { min-height: 460px; }
  .leaderboard-header { align-items: flex-start; flex-direction: column; }
  .leaderboard-actions { width: 100%; justify-content: space-between; }
  .restart-button { width: auto; }
  .initials-controls { grid-template-columns: 88px 1fr; }
  .secondary-button { min-width: 0; }
}

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