/* ======================================
   Schulte Table — Styles
   ====================================== */

:root {
  --bg: #0d1117;
  --card: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --gold: #f0b429;
  --gold-glow: rgba(240, 180, 41, 0.4);
  --green: #6aaa64;
  --success: #2ea043;
  --danger: #f85149;
  --overlay-bg: rgba(0,0,0,0.85);
  --radius-sm: 6px;
  --radius-md: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 70px;
}

/* ========== GAME CONTAINER ========== */
.game-container {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px;
}

/* ========== HEADER ========== */
.schulte-header {
  text-align: center;
  width: 100%;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.schulte-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.back-btn {
  position: absolute;
  left: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.back-btn:hover {
  border-color: var(--text);
  color: var(--text);
}

/* ========== CONFIG SCREEN ========== */
.config-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 30px 0;
}

.config-section {
  text-align: center;
}

.config-section h2 {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.size-selector,
.mode-selector {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.size-btn,
.mode-btn {
  padding: 8px 20px;
  border: 2px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 60px;
}

.size-btn:hover,
.mode-btn:hover {
  border-color: var(--gold);
  color: var(--text);
}

.size-btn.active,
.mode-btn.active {
  border-color: var(--gold);
  background: rgba(240, 180, 41, 0.15);
  color: var(--gold);
}

.start-btn {
  padding: 14px 40px;
  border: none;
  border-radius: 20px;
  background: var(--gold);
  color: #000;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 10px;
}

.start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(240, 180, 41, 0.3);
}

/* ========== STATS BAR ========== */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 24px;
  width: 100%;
  margin: 4px 0 12px;
  font-size: 0.8rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.stat-value {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.stat-value.timer {
  color: var(--green);
  font-variant-numeric: tabular-nums;
  min-width: 60px;
}

.stat-value.found-count {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ========== BOARD ========== */
.board-wrapper {
  max-width: min(90vw, 420px);
  margin: 0 auto;
}

.grid-board {
  display: grid;
  gap: clamp(4px, 1vw, 8px);
  justify-content: center;
}

.cell {
  aspect-ratio: 1;
  min-width: clamp(44px, 12vw, 72px);
  min-height: clamp(44px, 12vw, 72px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.cell:hover {
  border-color: var(--text-muted);
}

.cell:active {
  transform: scale(0.95);
}

.cell-number {
  font-size: clamp(1rem, 4vw, 1.6rem);
  font-weight: 700;
  color: var(--text);
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* Cell states */
.cell.found {
  background: hsla(160, 80%, 45%, 0.2);
  border-color: var(--success);
}

.cell.found .cell-number {
  color: var(--success);
}

.cell.wrong-flash {
  animation: wrongFlash 0.4s ease;
}

@keyframes wrongFlash {
  0%, 100% { background: var(--card); }
  50%      { background: hsla(0, 75%, 55%, 0.3); }
}

/* Preview mode: hidden numbers */
.grid-board.numbers-hidden .cell-number {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.grid-board:not(.numbers-hidden) .cell-number {
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* ========== MESSAGE ========== */
.message {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 24px;
  font-weight: 600;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  text-align: center;
}

.message.show {
  opacity: 1;
}

.message.hidden {
  display: none;
}

/* ========== GAME AREA ========== */
.game-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-area.hidden {
  display: none;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 480px) {
  .game-container { padding: 6px; gap: 4px; }
  .schulte-header h1 { font-size: 1.4rem; }
  .back-btn { width: 32px; height: 32px; font-size: 1rem; }
  .stats-bar { gap: 16px; }
  .config-screen { padding: 20px 0; gap: 16px; }
  .size-btn, .mode-btn { padding: 6px 14px; font-size: 0.8rem; }
  .start-btn { padding: 12px 30px; font-size: 1rem; }
  .board-wrapper { max-width: 90vw; }
}
