:root {
  --bg-primary: #000000;   /* transparent on additive display */
  --bg-secondary: #0a0a0f;
  --bg-tertiary: #14141f;
  --bg-card: #1a1a2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent-primary: #00d4ff;
  --perfect: #00ff88;
  --good: #00d4ff;
  --miss: #ff4466;
  --warm: #ff9f43;
  --pink: #ff5cdb;
  --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; }

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

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

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

/* --- Header --- */
.header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-secondary);
  gap: 12px;
  flex-shrink: 0;
}
.header h1 { font-size: 26px; font-weight: 700; flex: 1; letter-spacing: 0.5px; }
.header-meta { font-size: 14px; color: var(--text-secondary); }

/* --- Content --- */
.content {
  flex: 1;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
}

/* --- Focus --- */
.focusable {
  transition: all 0.15s ease;
  border: 2px solid transparent;
  cursor: pointer;
}
.focusable:focus {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 22px var(--focus-glow);
}

/* --- Nav bar --- */
.nav-bar { display: flex; gap: 10px; padding: 14px 20px; background: var(--bg-secondary); flex-shrink: 0; }
.nav-item {
  flex: 1;
  min-height: 64px;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-item.primary { background: var(--accent-primary); color: #04121a; }
.nav-item.primary:focus { background: #33ddff; }

/* --- Home --- */
.home-content { align-items: stretch; }
.hero { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 0 4px; }
.hero-pulse {
  font-size: 64px;
  color: var(--perfect);
  text-shadow: 0 0 28px rgba(0,255,136,0.6);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 0.9; } 50% { transform: scale(1.18); opacity: 1; } }
.hero-tag { font-size: 16px; color: var(--text-secondary); text-align: center; }

.how { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.how li {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 15px;
  color: var(--text-secondary);
}
.key {
  font-weight: 800; font-size: 13px; letter-spacing: 1px;
  background: var(--bg-card); color: var(--text-primary);
  padding: 6px 10px; border-radius: 8px; flex-shrink: 0;
}
.pill { font-weight: 800; font-size: 12px; letter-spacing: 1px; padding: 6px 10px; border-radius: 8px; flex-shrink: 0; }
.pill.perfect { background: rgba(0,255,136,0.18); color: var(--perfect); }
.pill.good { background: rgba(0,212,255,0.18); color: var(--good); }
.pill.miss { background: rgba(255,68,102,0.18); color: var(--miss); }

/* --- Game canvas --- */
#board { display: block; width: 600px; height: 600px; }

/* --- Results --- */
.results-content { align-items: center; justify-content: center; gap: 14px; }
.rank-badge {
  font-size: 88px; font-weight: 900; line-height: 1;
  color: var(--perfect);
  text-shadow: 0 0 36px rgba(0,255,136,0.55);
}
.score-big { font-size: 52px; font-weight: 800; color: var(--text-primary); }
.stat-row { display: flex; gap: 28px; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 84px; }
.stat-num { font-size: 26px; font-weight: 700; }
.stat-lbl { font-size: 12px; color: var(--text-muted); letter-spacing: 0.5px; text-transform: uppercase; }
.text-perfect { color: var(--perfect); }
.text-good { color: var(--good); }
.text-miss { color: var(--miss); }
.newbest {
  margin-top: 4px; font-size: 18px; font-weight: 800; color: var(--warm);
  text-shadow: 0 0 18px rgba(255,159,67,0.6);
}

.hidden { display: none !important; }
