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

* { 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', Roboto, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

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

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

.screen.hidden { display: none; }
.hidden { display: none !important; }

.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);
}

/* ---------- Home ---------- */
.home-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px 56px;
}

.title-block { text-align: center; }

.title {
  font-size: 46px;
  font-weight: 700;
  background: linear-gradient(135deg, #00d4ff, #00ff88);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.5px;
  line-height: 1.05;
}

.subtitle {
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 16px;
  letter-spacing: 0.5px;
}

.best-block {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 22px;
  text-align: center;
  border: 1px solid var(--bg-tertiary);
}

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

.best-value {
  font-size: 56px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin: 8px 0 4px;
}

.best-sub {
  color: var(--text-secondary);
  font-size: 13px;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.menu-btn {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 0 24px;
  height: 60px;
  font-size: 18px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.3px;
}

.menu-btn.primary {
  background: linear-gradient(135deg, #0a4a6a, #0a2540);
  color: var(--accent);
}

.menu-btn.primary:focus {
  background: linear-gradient(135deg, #00d4ff, #008fb3);
  color: #001018;
  box-shadow: 0 0 24px rgba(0,212,255,0.55);
}

/* ---------- Game ---------- */
.game-header {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 14px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--bg-tertiary);
  flex-shrink: 0;
}

.stat { text-align: center; }

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.stat-label {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 600;
}

.board-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

.board {
  width: 456px;
  height: 456px;
  display: grid;
  grid-template-columns: repeat(7, 60px);
  grid-template-rows: repeat(7, 60px);
  gap: 6px;
}

.cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 60px;
  height: 60px;
}

.cell.invalid { visibility: hidden; }

.cell.hole {
  background: rgba(20, 20, 31, 0.65);
}

.cell.peg {
  background: rgba(30, 30, 46, 0.5);
}

.peg-dot {
  width: 78%;
  height: 78%;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #f6f6fb 0%, #c0c0d0 42%, #6e6e84 100%);
  box-shadow:
    inset -2px -3px 6px rgba(0, 0, 0, 0.4),
    0 3px 5px rgba(0, 0, 0, 0.55);
}

.cell.selected .peg-dot {
  background: radial-gradient(circle at 32% 28%, #c2faff 0%, #00d4ff 50%, #006a8a 100%);
  box-shadow:
    inset -2px -3px 6px rgba(0, 0, 0, 0.3),
    0 0 22px rgba(0, 212, 255, 0.95);
}

.hole-dot {
  width: 38%;
  height: 38%;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.75);
  box-shadow: inset 1px 2px 4px rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.cell.valid-target {
  background: rgba(0, 255, 136, 0.08);
}

.cell.valid-target .hole-dot {
  background: rgba(0, 255, 136, 0.55);
  border-color: rgba(0, 255, 136, 0.9);
  box-shadow:
    inset 0 0 6px rgba(0, 255, 136, 0.7),
    0 0 10px rgba(0, 255, 136, 0.55);
}

.cell.cursor::before {
  content: '';
  position: absolute;
  inset: -2px;
  border: 3px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 14px rgba(0, 212, 255, 0.7);
  pointer-events: none;
  animation: cursor-pulse 1.5s ease-in-out infinite;
}

.cell.cursor.valid-target::before {
  border-color: var(--accent-secondary);
  box-shadow: 0 0 16px rgba(0, 255, 136, 0.85);
  animation-name: cursor-pulse-green;
}

@keyframes cursor-pulse {
  0%, 100% { box-shadow: 0 0 14px rgba(0, 212, 255, 0.55); }
  50%      { box-shadow: 0 0 22px rgba(0, 212, 255, 0.95); }
}

@keyframes cursor-pulse-green {
  0%, 100% { box-shadow: 0 0 14px rgba(0, 255, 136, 0.55); }
  50%      { box-shadow: 0 0 22px rgba(0, 255, 136, 0.95); }
}

.game-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 12px;
  border-top: 1px solid var(--bg-tertiary);
  background: var(--bg-secondary);
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

/* ---------- Pause ---------- */
.menu-box {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  padding: 40px 56px;
  gap: 16px;
}

.menu-title {
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
}

.pause-stats {
  color: var(--text-secondary);
  font-size: 14px;
  text-align: center;
  margin-bottom: 8px;
}

/* ---------- Game Over ---------- */
.over-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  padding: 36px 56px;
  gap: 16px;
}

.over-title {
  font-size: 42px;
  font-weight: 700;
  background: linear-gradient(135deg, #00d4ff, #00ff88);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-align: center;
  line-height: 1.05;
}

.over-result {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 18px 40px;
  text-align: center;
  border: 1px solid var(--bg-tertiary);
}

.over-big {
  font-size: 72px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.over-sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
  letter-spacing: 0.5px;
}

.best-msg {
  font-size: 16px;
  color: var(--accent-secondary);
  font-weight: 700;
  letter-spacing: 2px;
  text-align: center;
  text-shadow: 0 0 12px rgba(0, 255, 136, 0.6);
}

/* ---------- How to Play ---------- */
.how-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 30px 50px;
  gap: 18px;
}

.title-sm {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
}

.how-text {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.5;
}

.how-text strong {
  color: var(--text-primary);
}

.how-controls {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ctrl-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.ctrl-key {
  color: var(--accent);
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.5px;
}

.ctrl-desc {
  color: var(--text-secondary);
}

.how-content > .menu-btn {
  margin-top: auto;
}
