.timing-shell {
  width: min(1080px, calc(100% - 32px));
}

.game-card {
  overflow: hidden;
  border: 3px solid var(--ink);
  background: var(--panel);
  box-shadow: 10px 10px 0 var(--shadow);
}

.game-heading {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: end;
  padding: 30px 34px;
  border-bottom: 3px solid var(--ink);
}

.game-heading .eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-weight: 800;
  letter-spacing: 0.12em;
}

.game-heading h1 {
  max-width: 800px;
  margin: 0;
  font-size: clamp(2.35rem, 7vw, 4.9rem);
  line-height: 0.95;
}

.lede {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.progress-box {
  min-width: 150px;
  padding: 16px;
  border: 2px solid var(--line);
  background: #171220;
  text-align: center;
}

.progress-box > span,
.stat > span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.progress-box strong {
  color: var(--gold);
  font-size: 1.6rem;
}

.mode-panel {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 2px solid var(--line);
  background: #171220;
}

.mode-switch {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.mode-switch button {
  padding: 10px 14px;
  border: 2px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.mode-switch button[aria-pressed="true"] {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--night);
}

.mode-description {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
  text-align: right;
}

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

.stat {
  min-width: 0;
  padding: 18px 12px;
  border-right: 2px solid var(--line);
  text-align: center;
}

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

.stat strong {
  font-size: clamp(1.05rem, 3vw, 1.55rem);
}

.timing-stage {
  display: flex;
  min-height: 590px;
  flex-direction: column;
  align-items: center;
  padding: 26px 28px 32px;
  background:
    linear-gradient(rgba(88, 199, 215, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 199, 215, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 50% 34%, #312342 0, transparent 58%);
  background-size: 24px 24px, 24px 24px, auto;
}

.speed-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.speed-row strong { color: var(--blue); }

.stage-copy {
  min-height: 150px;
  padding-top: 24px;
  text-align: center;
}

.stage-kicker {
  margin: 0 0 9px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.stage-copy h2 {
  margin: 0;
  font-size: clamp(1.55rem, 5vw, 2.5rem);
}

.stage-copy > p:not(.stage-kicker) {
  max-width: 620px;
  margin: 10px auto 0;
  color: var(--muted);
  line-height: 1.5;
}

.result-flash {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: center;
  margin-top: 12px;
}

.result-flash[hidden] { display: none; }
.result-flash strong { font-size: 1.35rem; }
.result-flash span { color: var(--muted); font-size: 0.8rem; }

.timing-bar {
  position: relative;
  width: min(820px, 100%);
  height: 112px;
  padding: 0;
  overflow: hidden;
  border: 4px solid var(--ink);
  background: #171220;
  box-shadow: 7px 7px 0 var(--shadow);
  cursor: pointer;
  touch-action: manipulation;
}

.timing-bar:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.timing-bar:focus-visible,
.stop-button:focus-visible,
.mode-switch button:focus-visible,
.primary-button:focus-visible {
  outline: 4px solid var(--blue);
  outline-offset: 4px;
}

.bar-grid {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 9.8%, rgba(88, 199, 215, 0.13) 9.8% 10%),
    linear-gradient(180deg, transparent 45%, var(--line) 45% 55%, transparent 55%);
}

.target-zone {
  position: absolute;
  top: 13px;
  bottom: 13px;
  left: calc(var(--target-left, 40) * 1%);
  width: calc(var(--target-width, 18) * 1%);
  border: 3px solid var(--green);
  background: rgba(83, 221, 131, 0.23);
  box-shadow: inset 0 0 0 3px rgba(18, 15, 29, 0.42);
}

.target-zone i {
  position: absolute;
  top: -7px;
  bottom: -7px;
  left: 50%;
  width: 3px;
  background: var(--green);
  transform: translateX(-50%);
}

.moving-pointer {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: calc(var(--pointer-position, 0) * 1%);
  width: 7px;
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--night), 0 0 12px rgba(247, 201, 72, 0.75);
  transform: translateX(-50%);
  will-change: left;
}

.moving-pointer i {
  position: absolute;
  top: 5px;
  left: 50%;
  width: 17px;
  height: 17px;
  background: var(--gold);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform: translateX(-50%);
}

.timing-stage[data-state="feedback-hit"] .target-zone {
  background: rgba(83, 221, 131, 0.58);
}

.timing-stage[data-state="feedback-miss"] .moving-pointer {
  background: var(--red);
  box-shadow: 0 0 0 2px var(--night), 0 0 12px rgba(237, 78, 92, 0.75);
}

.bar-status {
  min-height: 1.4em;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
  text-align: center;
}

.stop-button {
  display: flex;
  width: min(480px, 100%);
  min-height: 92px;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  justify-content: center;
  margin-top: 22px;
  border: 4px solid var(--ink);
  border-bottom-width: 9px;
  background: var(--blue);
  color: var(--night);
  cursor: pointer;
  touch-action: manipulation;
}

.stop-button strong {
  font-size: clamp(1.8rem, 6vw, 2.7rem);
  letter-spacing: 0.12em;
}

.stop-button span {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.stop-button kbd {
  width: auto;
  height: auto;
  padding: 2px 7px;
  border-color: var(--blue-dark);
  background: var(--blue-dark);
  color: var(--ink);
}

.stop-button:not(:disabled):active,
.stop-button.is-pressed {
  border-bottom-width: 4px;
  transform: translateY(5px);
}

.stop-button:disabled {
  border-color: var(--line);
  background: #241d33;
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.65;
}

.primary-button {
  min-width: min(380px, 100%);
  margin-top: 16px;
}

.control-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
  text-align: center;
}

.content-section,
.faq-section,
.related-section { margin-top: 48px; }

.content-heading h2,
.faq-section h2,
.related-section h2,
.info-panel h2 { margin: 8px 0 0; }

.steps-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 0;
  list-style: none;
}

.steps-list li,
.info-panel,
.faq-list details,
.related-links a {
  border: 2px solid var(--line);
  background: var(--panel);
}

.steps-list li {
  display: flex;
  gap: 14px;
  padding: 20px;
}

.steps-list li > span {
  color: var(--gold);
  font-size: 1.25rem;
  font-weight: 900;
}

.steps-list p,
.info-panel p,
.faq-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.reading-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-top: 32px;
}

.info-panel { padding: 26px; }
.info-panel .section-kicker { margin: 0; color: var(--gold); }
.info-panel h2 { margin-bottom: 16px; }
.info-panel p + p { margin-top: 12px; }

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

.faq-list details { padding: 18px 20px; }
.faq-list summary { color: var(--ink); font-weight: 800; cursor: pointer; }
.faq-list p { margin-top: 12px; }

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

.related-links a {
  display: flex;
  gap: 5px;
  flex-direction: column;
  padding: 18px;
  color: var(--ink);
  text-decoration: none;
}

.related-links a:hover { border-color: var(--gold); }
.related-links small { color: var(--muted); }

@media (max-width: 720px) {
  .timing-shell { width: min(100% - 20px, 1080px); }
  .topbar { align-items: flex-start; }
  .topbar-meta { flex-wrap: wrap; justify-content: flex-end; }
  .game-heading { grid-template-columns: 1fr; gap: 18px; padding: 24px 20px; }
  .progress-box { min-width: 0; }
  .mode-panel { align-items: stretch; flex-direction: column; }
  .mode-switch button { flex: 1; }
  .mode-description { text-align: left; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n + 2) { border-bottom: 2px solid var(--line); }
  .timing-stage { min-height: 550px; padding: 22px 14px 28px; }
  .timing-bar { height: 100px; }
  .steps-list,
  .reading-grid,
  .related-links { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .topbar-meta { max-width: 210px; }
  .topbar-link { font-size: 0.63rem; }
  .game-heading h1 { font-size: clamp(2rem, 12vw, 3rem); }
  .timing-stage { min-height: 530px; }
  .timing-bar { height: 88px; }
  .target-zone { top: 10px; bottom: 10px; }
  .stage-copy { min-height: 165px; }
}

@media (prefers-reduced-motion: reduce) {
  .stop-button { transition: none; }
  .moving-pointer { will-change: auto; box-shadow: 0 0 0 2px var(--night); }
}
