:root {
  --bg: #ffffff;
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --accent: #2f6fde;
  --accent-fg: #ffffff;
  --surface: #f2f2f5;
  --border: #d2d2d7;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161618;
    --fg: #f5f5f7;
    --muted: #a1a1a6;
    --accent: #5b8ff0;
    --surface: #26262a;
    --border: #3a3a3f;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
}

[hidden] {
  display: none !important;
}

.container {
  max-width: 32rem;
  margin: 0 auto;
  padding: 1rem;
}

h1 {
  margin: 0.5rem 0 1rem;
  font-size: 1.75rem;
}

a {
  color: var(--accent);
}

/* --- Top bar with back link and lives ------------------------------------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
}

.back-link {
  text-decoration: none;
}

.lives {
  font-size: 1.75rem;
  letter-spacing: 0.15em;
  white-space: nowrap;
}

/* --- Buttons --------------------------------------------------------------- */

button {
  display: block;
  width: 100%;
  min-height: 3rem;
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-fg);
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.button-row {
  display: flex;
  gap: 0.75rem;
}

.button-row button {
  flex: 1;
  min-height: 4rem;
  font-size: 1.25rem;
}

/* --- Game screen ----------------------------------------------------------- */

.hud {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}

.status {
  min-height: 1.5em;
  text-align: center;
  font-size: 1.125rem;
}

.feedback {
  text-align: center;
  font-size: 1.125rem;
}

.results {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 1rem;
}

.results dt {
  color: var(--muted);
}

.results dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

/* --- Exercise menu --------------------------------------------------------- */

.exercise-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.exercise-list a {
  display: block;
  margin-bottom: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}

.exercise-list a span {
  display: block;
  color: var(--muted);
}
