:root {
  --bg: radial-gradient(circle at 20% 20%, #0f766e 0%, #0b1020 45%, #05070f 100%);
  --card: rgba(10, 16, 30, 0.85);
  --text: #f5f7ff;
  --muted: #9aa5c5;
  --border: rgba(180, 201, 255, 0.18);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--text);
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
  padding: 20px;
}

.game {
  width: min(96vw, 640px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 16px;
}

h1 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  letter-spacing: 0.04em;
}

.sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.score {
  text-align: right;
  font-weight: 700;
}

.score small {
  display: block;
  color: var(--muted);
  font-weight: 500;
}

.board-wrap {
  background: rgba(4, 9, 20, 0.75);
  border-radius: 20px;
  padding: 16px;
  border: 1px solid rgba(198, 215, 255, 0.14);
}

.board {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 480px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pad {
  border: 0;
  border-radius: 22px;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    filter 0.18s ease,
    box-shadow 0.2s ease;
  filter: saturate(0.78) brightness(0.65);
  box-shadow: inset 0 -8px 20px rgba(0, 0, 0, 0.3);
}

.pad:disabled {
  cursor: not-allowed;
}

.pad:active {
  transform: scale(0.985);
}

.pad.active {
  filter: saturate(1) brightness(1.12);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.2),
    0 0 36px rgba(255, 255, 255, 0.25);
}

.green {
  background: linear-gradient(160deg, #4ade80, #16a34a);
}

.red {
  background: linear-gradient(160deg, #f87171, #b91c1c);
}

.yellow {
  background: linear-gradient(160deg, #facc15, #ca8a04);
}

.blue {
  background: linear-gradient(160deg, #60a5fa, #1d4ed8);
}

.panel {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
}

button,
.toggle {
  border: 1px solid rgba(199, 216, 255, 0.25);
  background: rgba(20, 30, 55, 0.8);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
}

#startBtn {
  background: linear-gradient(135deg, #14b8a6, #0ea5e9);
}

#status {
  margin: 14px 0 0;
  min-height: 1.4rem;
  color: #d8e3ff;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.version {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 640px) {
  .panel {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 900px) {
  body {
    min-height: 100svh;
    padding: 16px 24px;
  }

  .game {
    min-height: calc(100svh - 32px);
    display: grid;
    grid-template-rows: auto 1fr auto auto auto;
  }

  .board-wrap {
    display: grid;
    place-items: center;
    min-height: 0;
  }

  .board {
    --board-size: clamp(240px, calc(100svh - 360px), 480px);
    width: min(100%, var(--board-size));
    height: min(100%, var(--board-size));
    max-width: none;
    aspect-ratio: auto;
  }
}
