.sound-game {
  overflow: hidden;
}

.test-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  min-height: 98px;
  border-bottom: 3px solid var(--ink);
}

.stat {
  display: grid;
  gap: 8px;
  place-content: center;
  padding: 18px;
  border-right: 2px solid var(--line);
  text-align: center;
}

.stat:last-child {
  border-right: 0;
}

.stat span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.stat strong {
  color: var(--ink);
  font-size: clamp(1.35rem, 3vw, 2.25rem);
  line-height: 1;
}

.stat-best strong {
  color: var(--gold);
}

.sound-arena {
  position: relative;
  display: grid;
  min-height: 520px;
  place-items: center;
  overflow: hidden;
  padding: 58px 24px 74px;
  background:
    linear-gradient(180deg, transparent 68%, rgba(0, 0, 0, 0.22) 68%),
    repeating-linear-gradient(90deg, transparent 0 44px, rgba(255, 255, 255, 0.018) 44px 46px);
  cursor: default;
  isolation: isolate;
  touch-action: manipulation;
  user-select: none;
}

.sound-arena::after {
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: -1;
  width: 100%;
  height: 13%;
  background: repeating-linear-gradient(90deg, #271d34 0 52px, #21192e 52px 104px);
  content: "";
}

.sound-copy {
  display: flex;
  z-index: 1;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.sound-copy h1 {
  font-size: clamp(3rem, 8vw, 6.2rem);
}

.sound-copy .status-copy {
  max-width: 610px;
  min-height: 52px;
}

.sound-meter {
  position: absolute;
  top: 42px;
  display: flex;
  gap: 8px;
  height: 30px;
  align-items: end;
}

.sound-meter span {
  width: 12px;
  height: 10px;
  border: 2px solid var(--line);
  background: #30283d;
}

.sound-meter span:nth-child(2),
.sound-meter span:nth-child(4) {
  height: 18px;
}

.sound-meter span:nth-child(3) {
  height: 28px;
}

.live-result {
  display: grid;
  gap: 8px;
  min-height: 84px;
  margin: -6px 0 20px;
  place-items: center;
}

.live-result[hidden] {
  display: none;
}

.live-result span {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.live-result strong {
  font-size: clamp(2.5rem, 7vw, 4.8rem);
  line-height: 1;
}

.response-hint {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.response-hint kbd {
  width: auto;
  min-width: 86px;
  padding: 0 10px;
}

.sound-status {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.status-pixel {
  width: 10px;
  height: 10px;
  border: 2px solid var(--muted);
  background: transparent;
}

.sound-arena[data-state="waiting"],
.sound-arena[data-state="ready"] {
  cursor: crosshair;
}

.sound-arena[data-state="waiting"] .primary-button,
.sound-arena[data-state="ready"] .primary-button {
  visibility: hidden;
}

.sound-arena[data-state="waiting"] .sound-meter span {
  animation: quiet-pulse 950ms steps(1, end) infinite;
}

.sound-arena[data-state="waiting"] .sound-meter span:nth-child(2) {
  animation-delay: 190ms;
}

.sound-arena[data-state="waiting"] .sound-meter span:nth-child(3) {
  animation-delay: 380ms;
}

.sound-arena[data-state="waiting"] .sound-meter span:nth-child(4) {
  animation-delay: 570ms;
}

.sound-arena[data-state="waiting"] .sound-meter span:nth-child(5) {
  animation-delay: 760ms;
}

.sound-arena[data-state="ready"] {
  background-color: #163825;
}

.sound-arena[data-state="ready"] h1 {
  color: var(--green);
  text-shadow: 5px 5px 0 #163120;
}

.sound-arena[data-state="ready"] .sound-meter span {
  border-color: var(--green);
  background: var(--green);
  box-shadow: 0 0 14px rgba(83, 221, 131, 0.68);
}

.sound-arena[data-state="false-start"] {
  background-color: #3d1724;
}

.sound-arena[data-state="complete"] {
  background-color: #322617;
}

.sound-arena:not([data-state="locked"]) .status-pixel {
  border-color: var(--green);
  background: var(--green);
}

.guide-grid,
.latency-note,
.faq,
.related-tests {
  margin: 0 18px;
}

.guide-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.6fr;
  gap: 70px;
  padding: 76px 0 64px;
}

.guide-heading h2,
.latency-note h2,
.faq h2,
.related-tests h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3.35rem);
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.guide-heading > p:last-child,
.latency-note p,
.faq-list p {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1rem;
  line-height: 1.7;
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 2px solid var(--line);
}

.steps li {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 20px;
  padding: 22px 0;
  border-bottom: 2px solid var(--line);
}

.steps > li > span {
  color: var(--gold);
  font-weight: 800;
}

.steps h3 {
  margin: 0 0 7px;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.steps p {
  margin: 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.95rem;
  line-height: 1.6;
}

.latency-note {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 34px;
  padding: 42px;
  border: 3px solid var(--ink);
  background: var(--panel);
  box-shadow: 8px 8px 0 var(--shadow);
}

.latency-badge {
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
  border: 3px solid var(--gold);
  color: var(--gold);
  font-size: 1.65rem;
  font-weight: 900;
  box-shadow: 5px 5px 0 var(--shadow);
}

.latency-note p:last-child {
  margin-bottom: 0;
}

.faq {
  padding: 76px 0 30px;
}

.faq-list {
  margin-top: 34px;
  border-top: 2px solid var(--line);
}

.faq details {
  border-bottom: 2px solid var(--line);
}

.faq summary {
  padding: 22px 38px 22px 0;
  color: var(--ink);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.5;
}

.faq summary::marker {
  color: var(--gold);
}

.faq-list p {
  max-width: 860px;
  margin: 0 0 24px;
}

.related-tests {
  display: grid;
  grid-template-columns: 0.8fr 1.4fr;
  gap: 60px;
  padding: 58px 0 34px;
}

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

.related-links a {
  display: flex;
  min-height: 54px;
  align-items: center;
  padding: 13px 16px;
  border: 2px solid var(--line);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.35;
  text-decoration: none;
}

.related-links a:hover,
.related-links a:focus-visible {
  border-color: var(--gold);
  color: var(--gold);
  outline: none;
}

@keyframes quiet-pulse {
  0%, 26% { border-color: var(--gold); background: var(--gold); }
  27%, 100% { border-color: var(--line); background: #30283d; }
}

@media (max-width: 720px) {
  .language-chip {
    display: inline-block;
    margin-left: 0;
  }

  .test-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat {
    min-height: 76px;
    padding: 12px 8px;
    border-bottom: 2px solid var(--line);
  }

  .stat:nth-child(2) {
    border-right: 0;
  }

  .stat:nth-child(3),
  .stat:nth-child(4) {
    border-bottom: 0;
  }

  .stat span {
    font-size: 0.62rem;
  }

  .sound-arena {
    min-height: min(540px, calc(100svh - 190px));
    padding: 72px 16px 82px;
  }

  .sound-meter {
    top: 28px;
  }

  .sound-copy h1 {
    font-size: clamp(2.5rem, 15vw, 4.4rem);
  }

  .response-hint {
    flex-direction: column;
    gap: 10px;
    max-width: 230px;
    line-height: 1.45;
  }

  .sound-status {
    right: 12px;
    bottom: 12px;
  }

  .guide-grid,
  .related-tests {
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .guide-grid {
    padding: 58px 0 48px;
  }

  .latency-note {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 28px 22px;
    box-shadow: 5px 5px 0 var(--shadow);
  }

  .latency-badge {
    width: 72px;
    height: 72px;
  }

  .faq {
    padding-top: 60px;
  }

  .related-tests {
    padding-top: 48px;
  }

  .related-links {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sound-arena[data-state="waiting"] .sound-meter span {
    animation: none;
  }
}
