: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', sans-serif;
}

#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; }

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

/* ---------- shared ---------- */
.hint-bar {
  flex: 0 0 auto;
  padding: 14px 24px;
  text-align: center;
  font-size: 17px;
  color: var(--text-muted);
  border-top: 1px solid var(--bg-tertiary);
  background: var(--bg-primary);
}

.screen-header {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 14px;
  padding: 22px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--bg-tertiary);
}
.screen-title { font-size: 28px; font-weight: 700; }

.icon-back {
  width: 52px; height: 52px; flex: 0 0 auto;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 34px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}

.btn, .btn-primary, .btn-got, .btn-missed {
  width: 100%;
  min-height: 88px;
  border-radius: var(--radius-md);
  font-size: 24px; font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  display: flex; align-items: center; justify-content: center;
}
.btn-primary {
  background: linear-gradient(135deg, #0a3a44, #103a52);
  color: var(--accent);
}
.btn-got {
  background: linear-gradient(135deg, #0a3a28, #0f4a30);
  color: var(--accent-secondary);
}
.btn-missed {
  background: linear-gradient(135deg, #3a0a18, #4a0f22);
  color: var(--danger);
}

/* ---------- home ---------- */
.app-header {
  flex: 0 0 auto;
  padding: 40px 28px 20px;
  text-align: center;
}
.app-title {
  font-size: 38px; font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff, var(--accent));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.app-subtitle {
  margin-top: 8px;
  font-size: 20px; color: var(--text-secondary);
}

.home-stats {
  flex: 0 0 auto;
  display: flex; gap: 12px;
  padding: 8px 28px 24px;
}
.stat {
  flex: 1;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 18px 8px;
  text-align: center;
}
.stat-num {
  display: block;
  font-size: 30px; font-weight: 700; color: var(--accent);
}
.stat-label {
  display: block; margin-top: 4px;
  font-size: 15px; color: var(--text-secondary);
}

.home-nav {
  flex: 1 1 auto;
  display: flex; flex-direction: column; gap: 16px;
  padding: 8px 28px;
  justify-content: center;
}

/* ---------- region ---------- */
.region-grid {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
  padding: 22px 24px;
}
.region-btn {
  width: 100%; min-height: 80px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 24px; font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
}
.region-count {
  font-size: 17px; font-weight: 500; color: var(--text-secondary);
}

/* ---------- drill ---------- */
.drill-header {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 26px;
  font-size: 22px; font-weight: 700;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--bg-tertiary);
}
.drill-progress { color: var(--text-secondary); }
.score-got { color: var(--accent-secondary); }
.score-missed { color: var(--danger); }
.score-sep { color: var(--text-muted); margin: 0 6px; }

.card-area {
  flex: 1 1 auto;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
  padding: 20px 28px;
  text-align: center;
}
.region-tag {
  font-size: 17px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 2px;
  color: var(--accent);
}
.country-flag { font-size: 84px; line-height: 1; }
.country-name {
  font-size: 46px; font-weight: 800; line-height: 1.1;
}
.capital-reveal {
  margin-top: 10px;
  display: flex; flex-direction: column; gap: 6px;
  animation: fadeUp 0.2s ease;
}
.capital-label {
  font-size: 16px; text-transform: uppercase; letter-spacing: 2px;
  color: var(--text-secondary);
}
.capital-value {
  font-size: 40px; font-weight: 700; color: var(--accent-secondary);
  line-height: 1.1;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.drill-actions {
  flex: 0 0 auto;
  padding: 16px 28px 22px;
}
.answer-buttons {
  display: flex; gap: 14px;
}
.answer-buttons .btn-got,
.answer-buttons .btn-missed { width: 50%; }

/* ---------- results ---------- */
.results-body {
  flex: 1 1 auto;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px; padding: 24px;
}
.results-ring {
  width: 220px; height: 220px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-secondary);
}
.results-ring::before {
  content: ''; position: absolute;
  width: 168px; height: 168px; border-radius: 50%;
  background: var(--bg-primary);
}
.results-pct {
  position: relative;
  font-size: 52px; font-weight: 800; color: var(--text-primary);
}
.results-detail { font-size: 24px; color: var(--text-secondary); }
.results-streak { font-size: 20px; color: var(--accent); }
.results-nav {
  flex: 0 0 auto;
  display: flex; flex-direction: column; gap: 14px;
  padding: 8px 28px 22px;
}

/* ---------- browse ---------- */
.browse-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 22px;
}
.browse-group {
  font-size: 16px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 2px; color: var(--accent);
  padding: 16px 6px 8px;
}
.browse-row {
  width: 100%; min-height: 64px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  margin-bottom: 10px;
  padding: 12px 18px;
  display: flex; align-items: center; gap: 14px;
}
.browse-flag { font-size: 30px; flex: 0 0 auto; }
.browse-text {
  flex: 1 1 auto; display: flex; flex-direction: column;
  align-items: flex-start; gap: 2px; text-align: left;
}
.browse-country { font-size: 21px; font-weight: 600; }
.browse-capital { font-size: 17px; color: var(--text-secondary); }
