/* ============================================================
   Sudoku | jcorp.app
   Clean, minimal design with cream/maroon color scheme
   ============================================================ */

/* --- Reset & Variables --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #F5E6D3;
  --bg-light: #FAF0E6;
  --bg-dark: #E8D5BF;
  --text: #4A0404;
  --text-light: #7A3434;
  --text-muted: #9A6464;
  --accent: #4A0404;
  --accent-light: #6B1A1A;
  --border: #C4A882;
  --border-dark: #4A0404;
  --cell-selected: #D4B896;
  --cell-related: #E8D5BF;
  --cell-conflict: #F5C6C6;
  --cell-given: #4A0404;
  --cell-user: #6B3A3A;
  --cell-correct: #2D6A2D;
  --white: #FFFDF8;
  --shadow: rgba(74, 4, 4, 0.1);
  --shadow-md: rgba(74, 4, 4, 0.15);
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --max-board: 450px;
  --nav-height: 56px;
  --radius: 6px;
  --transition: 0.2s ease;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* App-like touch behaviour: no double-tap zoom, no rubber-banding. */
  touch-action: manipulation;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

@media (display-mode: standalone) {
  body {
    -webkit-touch-callout: none;
  }
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
  color: inherit;
}

input {
  font-family: var(--font-body);
  font-size: inherit;
  color: var(--text);
}

/* --- App Container --- */
#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* --- Loading Spinner --- */
.spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
}

.spinner::after {
  content: '';
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Navigation Bar --- */
.nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  height: var(--nav-height);
  gap: 0.25rem;
}

.nav-brand {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  margin-right: auto;
  letter-spacing: 0.02em;
}

.nav-link {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg);
  text-decoration: none;
}

.nav-link.active {
  color: var(--accent);
  background: var(--bg);
}

/* Mobile bottom nav */
@media (max-width: 599px) {
  .nav {
    position: fixed;
    bottom: 0;
    top: auto;
    left: 0;
    right: 0;
    border-bottom: none;
    border-top: 1px solid var(--border);
    box-shadow: 0 -1px 3px var(--shadow);
  }

  .nav-inner {
    justify-content: space-around;
    padding: 0;
  }

  .nav-brand {
    display: none;
  }

  .nav-inner {
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  }

  .nav-link {
    flex: 1;
    text-align: center;
    padding: 0.6rem 0.25rem;
    font-size: 0.75rem;
  }

  #app {
    padding-bottom: calc(var(--nav-height) + 8px + env(safe-area-inset-bottom));
  }
}

/* --- Page Content --- */
.page {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.page-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--accent);
}

/* --- Landing Page --- */
.landing {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 100dvh;
  padding: 2rem;
}

.landing-title {
  font-family: var(--font-heading);
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.landing-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  font-style: italic;
}

.landing-actions {
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius);
  transition: all var(--transition);
  letter-spacing: 0.02em;
}

.btn-primary {
  background: var(--accent);
  color: var(--white);
  box-shadow: 0 2px 6px var(--shadow-md);
}

.btn-primary:hover {
  background: var(--accent-light);
  box-shadow: 0 4px 12px var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--white);
  color: var(--accent);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  background: var(--bg-light);
}

.btn-ghost {
  color: var(--text-muted);
  padding: 0.5rem 1rem;
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--bg-dark);
}

.btn-danger {
  color: #a33;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.btn-danger:hover {
  background: #fde8e8;
}

.btn-sm {
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
}

.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* --- Difficulty Selector --- */
.difficulty-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  max-width: 360px;
  margin: 0 auto;
}

.difficulty-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  transition: all var(--transition);
  cursor: pointer;
}

.difficulty-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--shadow);
  transform: translateY(-2px);
}

.difficulty-card-label {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.difficulty-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* --- Play Generator Panels --- */
.play-tabs {
  display: flex;
  gap: 0.4rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.9rem;
  overflow-x: auto;
}

.play-tab {
  background: var(--white);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.play-tab.active {
  color: var(--accent);
  font-weight: 600;
  background: var(--bg-light);
}

.play-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem;
}

.play-panel.hidden {
  display: none;
}

.play-panel-copy {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}

.play-form-row {
  margin-bottom: 0.8rem;
}

.play-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.play-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
  font-size: 0.9rem;
}

.play-status {
  min-height: 1.2em;
  font-size: 0.85rem;
  color: var(--text-light);
}

.play-status.error {
  color: #8b2020;
}

/* --- Sudoku Board --- */
.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--max-board);
}

.game-title {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
}

.game-difficulty {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: capitalize;
}

.game-code {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.game-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  min-width: 36px;
  height: 36px;
  padding: 0 0.6rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition), background var(--transition);
}

.icon-btn:hover {
  border-color: var(--accent);
  background: var(--bg-light);
}

.game-timer {
  font-size: 1.1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  letter-spacing: 0.05em;
}

.board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  width: 100%;
  max-width: var(--max-board);
  aspect-ratio: 1 / 1;
  border: 2.5px solid var(--border-dark);
  background: var(--border-dark);
  gap: 0;
  user-select: none;
  border-radius: 2px;
  overflow: hidden;
}

.cell {
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.1rem, 4vw, 1.6rem);
  cursor: pointer;
  position: relative;
  transition: background 0.1s ease;
  /* Grid borders: thin inner, thick on box boundaries */
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* Thick borders for 3x3 box boundaries */
.cell[data-col="2"],
.cell[data-col="5"] {
  border-right: 2.5px solid var(--border-dark);
}

.cell[data-row="2"],
.cell[data-row="5"] {
  border-bottom: 2.5px solid var(--border-dark);
}

/* Remove right/bottom border on last col/row (outer border handles it) */
.cell[data-col="8"] {
  border-right: none;
}

.cell[data-row="8"] {
  border-bottom: none;
}

/* Cell states */
.cell.given {
  font-weight: 700;
  color: var(--cell-given);
}

.cell.user-value {
  font-weight: 400;
  color: var(--cell-user);
}

.cell.selected {
  background: var(--cell-selected);
}

.cell.related {
  background: var(--cell-related);
}

.cell.conflict {
  background: var(--cell-conflict);
}

.cell.same-digit {
  background: var(--bg-dark);
}

.cell.selected.conflict {
  background: #E8A8A8;
}

.cell.practice-target {
  box-shadow: inset 0 0 0 2px #4a0404;
}

.cell.practice-affected {
  background: #f0e3cf;
}

.cell.auto-single-flash {
  animation: autoSingleFlash 700ms ease-out;
}

.auto-single-ripple {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  transform: translate(-50%, -50%) scale(0.15);
  background: rgba(180, 104, 22, 0.34);
  pointer-events: none;
  animation: autoSingleRipple 700ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Pencil marks */
.pencil-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  padding: 2px;
}

.pencil-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(0.45rem, 1.4vw, 0.6rem);
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1;
}

.pencil-mark[data-candidate="1"] {
  cursor: pointer;
}

.pencil-mark.empty {
  color: transparent;
}

.pencil-mark.eliminated {
  color: #b22222;
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  font-weight: 700;
}

/* Candidates the selected technique removes: highlighter yellow, softened so
   it still sits inside the cream palette. */
.pencil-mark.answer-elim {
  color: #3f2a00;
  background: #FFF176;
  box-shadow: inset 0 0 0 1px #F5D93A;
  border-radius: 4px;
  font-weight: 700;
}

.pencil-mark.answer-elim.eliminated {
  color: #7a1111;
  background: #f7d7d7;
  box-shadow: none;
}

.practice-banner {
  max-width: var(--max-board);
  width: 100%;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.6rem;
  font-size: 0.8rem;
  color: var(--text-light);
}

@keyframes autoSingleFlash {
  0% {
    background: #f0e0c4;
  }
  45% {
    background: #f7e9d0;
  }
  100% {
    background: var(--white);
  }
}

@keyframes autoSingleRipple {
  0% {
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(0.15);
  }
  70% {
    opacity: 0.3;
    transform: translate(-50%, -50%) scale(5.6);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(7.2);
  }
}

/* --- Number Pad --- */
.numpad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
  max-width: var(--max-board);
  width: 100%;
}

.numpad-btn {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  transition: all var(--transition);
  text-align: center;
}

.numpad-btn:hover {
  border-color: var(--accent);
  background: var(--bg-light);
}

.numpad-btn:active {
  transform: scale(0.95);
}

.numpad-btn.active {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}

.numpad-btn.exhausted {
  opacity: 0.35;
}

/* --- Game Controls --- */
.game-controls {
  display: flex;
  gap: 0.5rem;
  max-width: var(--max-board);
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.control-btn {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.control-btn:hover {
  border-color: var(--accent);
}

.control-btn.active {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}

.hint-technique-select {
  width: auto;
  min-width: 170px;
  height: 36px;
  padding: 0.35rem 0.55rem;
  font-size: 0.85rem;
}

.technique-panel {
  width: 100%;
  max-width: var(--max-board);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border);
}

/* --- Settings --- */
.settings-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.settings-heading {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.settings-list {
  display: flex;
  flex-direction: column;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--bg-dark);
  cursor: pointer;
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-align: left;
}

.setting-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.setting-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.setting-switch {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: var(--bg-dark);
  border: 1.5px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.setting-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 2px var(--shadow-md);
  transition: transform var(--transition);
}

.setting-switch:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.setting-switch:checked::after {
  transform: translateX(18px);
}

.setting-switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.settings-sheet {
  text-align: left;
  padding: 1.25rem 1.25rem 1rem;
  max-width: 440px;
}

.settings-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.settings-sheet-header .modal-title {
  margin-bottom: 0;
  font-size: 1.35rem;
}

.settings-sheet-header .icon-btn {
  font-size: 1.3rem;
}

.settings-sheet-footer {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
}

.modal-note {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --- Play by code --- */
.play-code-form {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.play-code-input {
  max-width: 130px;
  font-size: 1.2rem;
  letter-spacing: 0.25em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.leaderboard-help {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.btn-xs {
  padding: 0.25rem 0.55rem;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

/* --- Games List --- */
.games-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.game-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition);
  cursor: pointer;
}

.game-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--shadow);
}

.game-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.game-card-difficulty {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--accent);
  text-transform: capitalize;
}

.game-card-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.game-card-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* --- Stats --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* --- Tables (Leaderboard, Best Times) --- */
.table-container {
  overflow-x: auto;
  margin-top: 0.5rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--bg-dark);
}

.data-table tr:hover td {
  background: var(--bg-light);
}

.data-table tr.highlight td {
  background: var(--cell-selected);
  font-weight: 600;
}

/* --- Difficulty Tabs --- */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}

.tab {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* --- Profile Form --- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.form-input {
  width: 100%;
  max-width: 400px;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  transition: border-color var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 4, 4, 0.08);
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(74, 4, 4, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
  padding: 1rem;
}

.modal {
  background: var(--white);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 16px 48px rgba(74, 4, 4, 0.2);
  animation: scaleIn 0.3s ease;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.modal-body {
  color: var(--text-light);
  font-size: 1rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* --- Toast / Flash Message --- */
.toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--white);
  padding: 0.6rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 2000;
  animation: slideDown 0.3s ease, fadeOut 0.3s ease 2.7s;
  box-shadow: 0 4px 16px var(--shadow-md);
}

.toast.error {
  background: #8B2020;
}

@keyframes slideDown {
  from { transform: translateX(-50%) translateY(-1rem); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

/* --- Utility --- */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-sm { gap: 0.5rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* --- Responsive --- */
@media (min-width: 600px) {
  .page {
    padding: 2rem 1.5rem;
  }

  .page-title {
    font-size: 1.75rem;
  }

  :root {
    --nav-height: 52px;
  }
}

@media (min-width: 768px) {
  .numpad {
    gap: 0.5rem;
  }

  .numpad-btn {
    padding: 0.75rem 0;
    font-size: 1.3rem;
  }
}

@media (max-width: 599px) {
  /* Phones: the leaderboard keeps its playable columns and drops the date. */
  .data-table .col-date {
    display: none;
  }

  .play-tabs {
    padding-bottom: 0.1rem;
  }

  .play-tab {
    font-size: 0.8rem;
    padding: 0.45rem 0.65rem;
  }
}
