:root {
  --bg: #0b0c10;
  --bg-2: #12141c;
  --ink: #eef0f6;
  --muted: #8b93a7;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --panel: rgba(22, 25, 37, 0.92);
  --green: #00a651;
  --green-lit: #3dff9a;
  --red: #c41e3a;
  --red-lit: #ff5a6e;
  --yellow: #d4a017;
  --yellow-lit: #ffe066;
  --blue: #1a5fb4;
  --blue-lit: #5eb1ff;
  --hub: #1a1d28;
  --radius: 16px;
  --sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --display: "Orbitron", system-ui, sans-serif;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(700px 420px at 50% -10%, rgba(94, 177, 255, 0.12), transparent 55%),
    radial-gradient(500px 320px at 10% 80%, rgba(61, 255, 154, 0.06), transparent 50%),
    radial-gradient(480px 300px at 90% 70%, rgba(255, 90, 110, 0.06), transparent 50%),
    var(--bg);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

:focus-visible {
  outline: 2px solid var(--blue-lit);
  outline-offset: 3px;
}

.back-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 50;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  padding: 0 14px;
  border-radius: 8px;
  backdrop-filter: blur(8px);
  transition: color 0.15s, border-color 0.15s;
}
.back-link:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.app {
  width: min(520px, 100%);
  margin: 0 auto;
  padding: 56px 16px 48px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.header {
  text-align: center;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.header h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 2.6rem);
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}
.tagline {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 32ch;
  margin: 0 auto;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}
.stat-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.stat-value {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.stat-value.status {
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.pad-wrap {
  width: min(360px, 88vw);
  aspect-ratio: 1;
  position: relative;
  filter: drop-shadow(var(--shadow));
}

.simon {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
  padding: 14px;
  border-radius: 50%;
  background: linear-gradient(160deg, #1e2230, #0e1016 70%);
  border: 3px solid #2a2f40;
  position: relative;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.06),
    0 0 0 6px #0a0b10;
}

.pad {
  border: none;
  position: relative;
  transition: filter 0.08s ease, transform 0.08s ease, box-shadow 0.08s ease;
  box-shadow: inset 0 -6px 16px rgba(0, 0, 0, 0.35);
}
.pad:disabled {
  cursor: default;
}
.pad:not(:disabled) {
  cursor: pointer;
}
.pad:not(:disabled):active,
.pad.lit {
  filter: brightness(1.55) saturate(1.15);
  box-shadow:
    inset 0 0 24px rgba(255, 255, 255, 0.25),
    0 0 28px currentColor;
  transform: scale(0.98);
}

.pad-green {
  background: radial-gradient(circle at 35% 30%, #1ed46a, var(--green) 55%, #006b34);
  border-radius: 100% 12px 12px 12px;
  color: var(--green-lit);
}
.pad-red {
  background: radial-gradient(circle at 65% 30%, #ff5a6e, var(--red) 55%, #7a0f22);
  border-radius: 12px 100% 12px 12px;
  color: var(--red-lit);
}
.pad-yellow {
  background: radial-gradient(circle at 35% 70%, #ffe066, var(--yellow) 55%, #8a6808);
  border-radius: 12px 12px 12px 100%;
  color: var(--yellow-lit);
}
.pad-blue {
  background: radial-gradient(circle at 65% 70%, #5eb1ff, var(--blue) 55%, #0d3a75);
  border-radius: 12px 12px 100% 12px;
  color: var(--blue-lit);
}

.center-hub {
  position: absolute;
  inset: 32%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 35%, #2a3044, var(--hub) 70%);
  border: 4px solid #3a4158;
  display: grid;
  place-items: center;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.45),
    inset 0 2px 0 rgba(255, 255, 255, 0.08);
  pointer-events: none;
  z-index: 2;
}
.hub-label {
  font-family: var(--display);
  font-size: clamp(0.7rem, 3.2vw, 0.95rem);
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #c8cde0;
}

.simon.wrong {
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--line);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:active {
  transform: scale(0.97);
}
.btn-primary {
  background: linear-gradient(180deg, #5eb1ff, #1a5fb4);
  border-color: transparent;
  color: #fff;
  min-width: 120px;
  box-shadow: 0 8px 24px rgba(26, 95, 180, 0.35);
}
.btn-primary:hover {
  filter: brightness(1.08);
}
.btn-ghost {
  background: var(--panel);
  color: var(--ink);
}
.btn-ghost:hover {
  border-color: var(--line-strong);
}
.btn-ghost[aria-pressed="true"] {
  border-color: rgba(94, 177, 255, 0.45);
  background: rgba(26, 95, 180, 0.2);
}

.help {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-top: 4px;
}
.help h2 {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.help ol {
  padding-left: 1.2rem;
  color: var(--ink);
  font-size: 0.92rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.help li {
  color: #c5cad8;
}
.help strong {
  color: var(--ink);
  font-weight: 600;
}
.keys {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--muted);
}
kbd {
  display: inline-block;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.8em;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.35);
  color: var(--ink);
}

@media (max-width: 400px) {
  .scoreboard {
    gap: 6px;
  }
  .stat-value {
    font-size: 1.05rem;
  }
  .controls {
    flex-direction: column;
  }
  .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pad,
  .btn,
  .simon.wrong {
    transition: none;
    animation: none;
  }
}
