:root {
  color-scheme: dark;
  --bg: #090a0d;
  --bg-soft: #111319;
  --surface: #171a20;
  --surface-strong: #20242d;
  --line: rgba(255, 255, 255, 0.13);
  --line-strong: rgba(255, 255, 255, 0.24);
  --text: #f5f7fa;
  --muted: #a8b0bd;
  --muted-strong: #cbd1da;
  --red: #ff1d12;
  --red-dark: #a70f0b;
  --green: #42d981;
  --yellow: #ffd166;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 8px;
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(120deg, rgba(255, 29, 18, 0.12), transparent 28%),
    radial-gradient(circle at 50% -10%, rgba(255, 255, 255, 0.08), transparent 28%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 72px),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 100% 22px, 22px 100%;
  opacity: 0.34;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 10px 0;
  background: rgba(9, 10, 13, 0.82);
  backdrop-filter: blur(16px);
}

.brand,
.nav-links,
.header-action {
  display: inline-flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  width: 30px;
  height: 18px;
  background:
    linear-gradient(135deg, transparent 0 28%, var(--red) 28% 54%, transparent 54%),
    linear-gradient(90deg, #fff 0 48%, transparent 48%);
  clip-path: polygon(0 0, 100% 0, 78% 100%, 0 100%);
}

.nav-links {
  gap: 22px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.nav-links a:hover {
  color: var(--text);
}

.header-action,
.action-grid button,
.name-row button,
.tabs button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  font-size: 14px;
  font-weight: 760;
}

.header-action {
  padding: 0 18px;
  border-color: rgba(255, 29, 18, 0.62);
  background: linear-gradient(180deg, #ff382e, #bd120c);
  box-shadow: 0 14px 34px rgba(255, 29, 18, 0.24);
}

.hero {
  width: min(var(--max), calc(100% - 32px));
  min-height: auto;
  margin: 0 auto;
  padding: 16px 0 0;
}

.hero-copy {
  max-width: 780px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: 42px;
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: 0;
}

.hero-subtitle {
  max-width: 640px;
  margin-bottom: 12px;
  color: var(--muted-strong);
  font-size: 18px;
}

.play-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 22px;
  align-items: stretch;
}

.game-panel,
.result-panel,
.leaderboard-shell,
.challenge-banner,
.content-band {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.028));
  box-shadow: var(--shadow);
}

.game-panel,
.result-panel {
  padding: 20px;
}

.game-topline {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.panel-label {
  margin-bottom: 7px;
  color: var(--red);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.game-topline h2,
.result-panel h2,
.section-heading h2,
.content-band h2,
.challenge-banner h2 {
  margin-bottom: 0;
  font-size: 26px;
  line-height: 1.1;
  letter-spacing: 0;
}

.attempt-counter {
  flex: 0 0 auto;
  min-width: 114px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted-strong);
  background: rgba(0, 0, 0, 0.18);
  font-size: 13px;
  font-weight: 760;
  text-align: center;
}

.light-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 244px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 12px),
    #0c0e12;
}

.light-stage::after {
  position: absolute;
  right: -12%;
  bottom: 28px;
  width: 124%;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: rotate(-3deg);
}

.light-stage:focus-visible,
button:focus-visible,
input:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(255, 209, 102, 0.75);
  outline-offset: 3px;
}

.gantry {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, 42px);
  gap: 8px;
  justify-content: center;
  width: min(100%, 330px);
  padding-top: 22px;
}

.gantry-line {
  position: absolute;
  top: 56px;
  left: 6%;
  width: 88%;
  height: 9px;
  border-radius: 999px;
  background: #020203;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.light-column {
  position: relative;
  display: grid;
  grid-template-rows: repeat(4, 1fr);
  gap: 5px;
  aspect-ratio: 0.52;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 10px;
  background: linear-gradient(180deg, #17191d, #030405);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 16px 30px rgba(0, 0, 0, 0.35);
}

.bulb {
  display: block;
  aspect-ratio: 1;
  border-radius: 999px;
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 255, 255, 0.25), transparent 20%),
    #30333a;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.78);
}

.light-column.is-on .race-bulb {
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 255, 255, 0.74), transparent 18%),
    var(--red);
  box-shadow:
    0 0 22px rgba(255, 29, 18, 0.82),
    0 0 42px rgba(255, 29, 18, 0.38),
    inset 0 -8px 16px rgba(102, 0, 0, 0.38);
}

.light-stage.is-go .light-column .race-bulb {
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 255, 255, 0.2), transparent 18%),
    #15181f;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.86);
}

.stage-message {
  position: relative;
  z-index: 1;
  display: block;
  width: min(100%, 520px);
  min-height: 32px;
  margin-top: 14px;
  color: var(--muted-strong);
  font-size: 18px;
  font-weight: 780;
  text-align: center;
}

.stage-message.is-hot {
  color: var(--green);
}

.stage-message.is-warning {
  color: var(--yellow);
}

.attempt-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.attempt-slot {
  min-height: 60px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.18);
}

.attempt-slot span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.attempt-slot strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
}

.attempt-slot.is-current {
  border-color: rgba(255, 209, 102, 0.6);
}

.attempt-slot.is-valid strong {
  color: var(--green);
}

.attempt-slot.is-false strong {
  color: var(--yellow);
}

.result-panel {
  display: flex;
  flex-direction: column;
}

.best-time {
  min-height: 66px;
  margin: 14px 0 8px;
  font-size: 48px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.result-note {
  min-height: 44px;
  margin-bottom: 14px;
  color: var(--muted);
}

.save-form {
  margin-top: auto;
}

.result-panel:not(.is-complete) .save-form,
.result-panel:not(.is-complete) .action-grid,
.result-panel:not(.is-complete) .social-row {
  display: none;
}

.result-panel.is-complete .save-form {
  margin-top: auto;
}

.save-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 760;
}

.name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.name-row input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.28);
  font-size: 15px;
}

.name-row button,
.action-grid button {
  width: 100%;
  padding: 0 12px;
}

.name-row button {
  border-color: rgba(255, 29, 18, 0.62);
  background: linear-gradient(180deg, #ff382e, #bd120c);
}

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

.social-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.social-row a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted-strong);
  background: rgba(0, 0, 0, 0.18);
  font-size: 12px;
  font-weight: 820;
  text-align: center;
}

.social-row a:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.social-row a[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.45;
}

.feedback {
  min-height: 34px;
  margin-top: 14px;
  color: var(--muted-strong);
  font-size: 14px;
}

.feedback.is-error {
  color: var(--yellow);
}

.feedback.is-success {
  color: var(--green);
}

.challenge-banner,
.leaderboard-section,
.content-band,
.site-footer {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto 22px;
}

.challenge-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
}

.challenge-target {
  text-align: right;
}

.challenge-target span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.challenge-target strong {
  display: block;
  margin-top: 4px;
  color: var(--green);
  font-size: 36px;
  line-height: 1;
}

.leaderboard-section {
  padding-top: 24px;
}

.section-heading {
  max-width: 720px;
  margin-bottom: 18px;
}

.section-heading p:not(.panel-label),
.content-band p,
.faq-list p,
.text-page p,
.text-page li {
  color: var(--muted);
}

.leaderboard-shell {
  overflow: hidden;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.tabs button {
  padding: 0 14px;
}

.tabs button.is-active {
  border-color: rgba(255, 29, 18, 0.72);
  background: rgba(255, 29, 18, 0.16);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

th,
td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

td {
  color: var(--muted-strong);
}

td strong {
  color: var(--text);
}

.content-band {
  padding: 34px;
}

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

.explain-grid article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.18);
}

.explain-grid h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.explain-grid p {
  margin-bottom: 0;
}

.seo-copy {
  display: grid;
  gap: 18px;
}

.copy-columns,
.guide-grid,
.link-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.copy-columns h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.copy-columns p {
  margin-bottom: 0;
}

.guide-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.guide-grid a,
.link-grid a {
  display: block;
  min-height: 168px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.18);
}

.guide-grid a:hover,
.link-grid a:hover {
  border-color: rgba(255, 29, 18, 0.62);
  background: rgba(255, 29, 18, 0.08);
}

.guide-grid span,
.link-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--red);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.guide-grid strong,
.link-grid strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.2;
}

.guide-grid p,
.link-grid p {
  margin-bottom: 0;
}

.split-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 0.75fr);
  gap: 30px;
  align-items: center;
}

.benchmark-list {
  display: grid;
  gap: 10px;
}

.benchmark-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.2);
}

.benchmark-list span {
  color: var(--muted);
  font-weight: 760;
}

.benchmark-list strong {
  text-align: right;
}

.faq-list {
  display: grid;
  gap: 10px;
}

details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.18);
}

summary {
  cursor: pointer;
  padding: 16px 18px;
  font-weight: 820;
}

details p {
  padding: 0 18px 18px;
  margin-bottom: 0;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 0 34px;
  color: var(--muted);
  font-size: 14px;
}

.site-footer div {
  display: grid;
  gap: 4px;
  max-width: 620px;
}

.site-footer span:first-child {
  color: var(--text);
  font-weight: 820;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: start;
  justify-content: flex-end;
}

.site-footer a {
  color: var(--muted-strong);
  font-weight: 720;
}

.site-footer a:hover {
  color: var(--text);
}

.page-main {
  width: min(860px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 22px;
}

.text-page {
  display: grid;
  gap: 22px;
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.028));
  box-shadow: var(--shadow);
}

.text-page h1 {
  margin-bottom: 0;
  font-size: 42px;
  line-height: 1;
}

.text-page h2 {
  margin-bottom: 10px;
  font-size: 24px;
  line-height: 1.15;
}

.text-page h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.text-page p {
  margin-bottom: 0;
}

.text-page ul,
.text-page ol {
  display: grid;
  gap: 8px;
  padding-left: 20px;
  margin: 0;
}

.text-page .page-eyebrow {
  margin-bottom: -12px;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.page-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  font-size: 14px;
  font-weight: 760;
}

.page-actions a:first-child {
  border-color: rgba(255, 29, 18, 0.62);
  background: linear-gradient(180deg, #ff382e, #bd120c);
}

@media (max-width: 980px) {
  .play-layout,
  .split-section,
  .guide-grid {
    grid-template-columns: 1fr;
  }

  .copy-columns,
  .link-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero {
    min-height: auto;
    padding-top: 34px;
  }

  .result-panel {
    min-height: 0;
  }
}

@media (max-width: 760px) {
  .site-header {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .nav-links {
    flex-wrap: wrap;
    gap: 14px;
  }

  .header-action {
    justify-content: center;
  }

  h1 {
    font-size: 46px;
  }

  .hero-subtitle {
    font-size: 18px;
  }

  .game-panel,
  .result-panel,
  .content-band {
    padding: 18px;
  }

  .game-topline,
  .challenge-banner {
    flex-direction: column;
  }

  .challenge-target {
    text-align: left;
  }

  .light-stage {
    min-height: 330px;
    padding: 22px 12px;
  }

  .gantry {
    grid-template-columns: repeat(5, minmax(40px, 58px));
    gap: 8px;
  }

  .light-column {
    gap: 6px;
    padding: 7px;
    border-radius: 10px;
  }

  .attempt-strip,
  .explain-grid,
  .copy-columns,
  .link-grid,
  .action-grid,
  .social-row {
    grid-template-columns: 1fr;
  }

  .best-time {
    font-size: 48px;
  }

  .site-footer {
    flex-direction: column;
  }

  .site-footer nav {
    justify-content: flex-start;
  }
}

@media (max-width: 430px) {
  h1 {
    font-size: 38px;
  }

  .hero,
  .page-main,
  .challenge-banner,
  .leaderboard-section,
  .content-band,
  .site-footer,
  .site-header {
    width: min(var(--max), calc(100% - 20px));
  }

  .gantry {
    grid-template-columns: repeat(5, minmax(34px, 46px));
    gap: 5px;
  }

  .stage-message {
    font-size: 16px;
  }

  .text-page {
    padding: 22px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .light-column.is-on .race-bulb {
    animation: pulse-red 0.9s ease-in-out infinite alternate;
  }

  .light-stage.is-go {
    animation: launch-flash 0.28s ease-out;
  }
}

@keyframes pulse-red {
  from {
    filter: brightness(0.92);
  }
  to {
    filter: brightness(1.16);
  }
}

@keyframes launch-flash {
  from {
    border-color: rgba(66, 217, 129, 0.85);
    box-shadow: 0 0 0 6px rgba(66, 217, 129, 0.16);
  }
  to {
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: none;
  }
}
