:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #14141f;
  --bg-tertiary: #1e1e2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #00d4ff;
  --accent-secondary: #00ff88;
  --warn: #ffb33d;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.45);
  --radius-md: 12px;
  --radius-lg: 16px;
}

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

html, body {
  width: 600px;
  height: 600px;
  overflow: hidden;
  background: #000;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
}

#app { width: 100%; height: 100%; position: relative; }

.screen {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  padding: 26px;
}

.screen.hidden { display: none; }

.focusable {
  transition: all 0.15s ease;
  border: 2px solid transparent;
  cursor: pointer;
  outline: none;
}

.focusable:focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 20px var(--focus-glow);
}

.hidden { display: none !important; }

/* ====== HERO / TITLES ====== */
.hero {
  text-align: center;
  padding: 4px 0 14px 0;
}

.hero h1 {
  font-size: 36px;
  letter-spacing: 5px;
  font-weight: 300;
  color: var(--text-primary);
}

.tagline {
  color: var(--text-secondary);
  margin-top: 8px;
  font-size: 12px;
  letter-spacing: 3px;
}

/* ====== HOME ====== */
.home-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 18px;
}

.best-display {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.best-label {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 3px;
}

.best-value {
  color: var(--accent);
  font-size: 56px;
  font-weight: 200;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  text-shadow: 0 0 18px rgba(0, 212, 255, 0.35);
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  justify-content: center;
}

.menu.compact { flex: 0 0 auto; padding-top: 8px; }

.menu-btn {
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 17px;
  padding: 22px;
  border-radius: var(--radius-md);
  font-weight: 500;
  letter-spacing: 3px;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-btn.split {
  justify-content: space-between;
  padding: 22px 28px;
}

.menu-btn.primary {
  background: var(--accent);
  color: #000;
  font-weight: 700;
}

.menu-btn.primary.focusable:focus {
  border-color: #ffffff;
  box-shadow: 0 0 26px var(--focus-glow);
}

.menu-btn .btn-label {
  color: var(--text-secondary);
  font-size: 13px;
  letter-spacing: 2px;
}

.menu-btn .btn-value {
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
}

/* ====== GAME ====== */
.game-hud {
  display: flex;
  justify-content: space-around;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  margin-bottom: 14px;
  border: 1px solid var(--bg-tertiary);
}

.hud-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 100px;
}

.hud-label {
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 2px;
}

.hud-value {
  color: var(--text-primary);
  font-size: 30px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.hud-value.time { color: var(--accent); }
.hud-value.time.warn { color: var(--warn); }
.hud-value.time.danger { color: var(--danger); animation: pulse 0.7s ease-in-out infinite; }

#combo.active { color: var(--accent-secondary); text-shadow: 0 0 10px rgba(0, 255, 136, 0.6); }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 12px;
  flex: 1;
}

.cell {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  border: 3px solid transparent;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition: border-color 0.1s ease, box-shadow 0.1s ease, background 0.15s ease;
}

.cell.focusable:focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 22px var(--focus-glow);
}

.cell .hole-bg {
  position: absolute;
  bottom: 10%;
  left: 14%;
  right: 14%;
  height: 28%;
  background: radial-gradient(ellipse at center 30%, #1a0e07 0%, #000 100%);
  border-radius: 50%;
  box-shadow:
    inset 0 10px 14px rgba(0, 0, 0, 0.95),
    inset 0 -2px 6px rgba(255, 150, 80, 0.06);
}

.cell .mole-wrap {
  position: absolute;
  bottom: -55%;
  left: 18%;
  right: 18%;
  aspect-ratio: 1;
  transition: bottom 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.12s ease;
  pointer-events: none;
}

.cell.up .mole-wrap {
  bottom: 16%;
}

.cell.whacked .mole-wrap {
  transform: scale(0.85) translateY(10%);
}

.cell.whacked .mole .body {
  fill: var(--danger);
}

.cell.miss {
  background: rgba(255, 68, 102, 0.18);
}

.mole {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.7));
}

.float-score {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  color: var(--accent-secondary);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 1px;
  pointer-events: none;
  text-shadow: 0 0 10px rgba(0, 255, 136, 0.7);
  animation: floatUp 0.6s ease-out forwards;
}

.float-score.miss {
  color: var(--danger);
  text-shadow: 0 0 10px rgba(255, 68, 102, 0.7);
}

@keyframes floatUp {
  0%   { transform: translateX(-50%) translateY(0);     opacity: 1; }
  100% { transform: translateX(-50%) translateY(-32px); opacity: 0; }
}

.game-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 2px;
  padding-top: 12px;
}

/* ====== GAME OVER ====== */
.over-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 14px;
}

.results {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

.result-row.big {
  padding: 8px 0 14px 0;
  border-bottom: 1px solid var(--bg-tertiary);
  margin-bottom: 4px;
}

.result-label {
  color: var(--text-secondary);
  font-size: 13px;
  letter-spacing: 2px;
}

.result-value {
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
}

.result-value.primary {
  font-size: 44px;
  color: var(--accent);
  font-weight: 200;
  text-shadow: 0 0 16px rgba(0, 212, 255, 0.4);
}

.new-best-tag {
  align-self: center;
  background: var(--accent-secondary);
  color: #000;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 4px;
  padding: 8px 18px;
  border-radius: 999px;
  margin-top: 6px;
  animation: pulse 1.4s ease-in-out infinite;
}

/* ====== HOW TO PLAY ====== */
.howto-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 14px;
}

.howto-list {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.howto-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 4px 0;
}

.howto-key {
  background: var(--bg-tertiary);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 7px 12px;
  border-radius: 8px;
  min-width: 88px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.howto-key.hit   { color: var(--accent-secondary); }
.howto-key.miss  { color: var(--danger); }
.howto-key.combo { color: var(--warn); }

.howto-desc {
  color: var(--text-primary);
  font-size: 14px;
  letter-spacing: 1px;
  flex: 1;
}
