/* ============================================================
   IMMACULATE GRID BASEBALL — MODERN REDESIGN
   Style: Clean sports editorial with bold typography
   Fonts: Bebas Neue (display) + DM Sans (body)
   ============================================================ */

:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #f0ede6;
  --border: #e2ddd4;
  --text: #1a1714;
  --text-muted: #7a756e;
  --text-light: #b0a99e;
  --accent: #d44000;
  --accent-hover: #b33500;
  --green: #2d8c5a;
  --green-light: #e8f5ee;
  --red-light: #fdeaea;
  --red: #c0392b;
  --cell-empty: #ffffff;
  --cell-hover: #faf8f5;
  --cell-active: #fff8f4;
  --cell-correct: #e8f5ee;
  --header-bg: #1a1714;
  --header-text: #ffffff;
  --shadow-sm: 0 1px 3px rgba(26,23,20,0.08);
  --shadow-md: 0 4px 16px rgba(26,23,20,0.12);
  --shadow-lg: 0 16px 48px rgba(26,23,20,0.18);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --nav-h: 60px;
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}

[data-theme="dark"] {
  --bg: #141210;
  --surface: #1e1c19;
  --surface-2: #252220;
  --border: #2e2b27;
  --text: #f0ede6;
  --text-muted: #8a847c;
  --text-light: #5a5550;
  --cell-empty: #1e1c19;
  --cell-hover: #252220;
  --cell-active: #2a1e18;
  --cell-correct: #1a2e24;
  --header-bg: #0e0d0b;
  --header-text: #f0ede6;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.6);
}

[data-contrast="high"] {
  --accent: #ff4500;
  --green: #00c060;
  --text: #000000;
  --border: #000000;
}

[data-animations="off"] * {
  transition: none !important;
  animation: none !important;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── NAVBAR ─────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--header-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: var(--shadow-md);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.nav-logo-icon {
  font-size: 24px;
  line-height: 1;
}

.nav-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 26px;
  letter-spacing: 1px;
  color: var(--header-text);
  line-height: 1;
}

.nav-title .accent { color: var(--accent); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--header-text);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background var(--transition), border-color var(--transition);
}

.nav-btn:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.24);
}

.mode-toggle {
  background: var(--accent);
  border-color: transparent;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.mode-toggle:hover { background: var(--accent-hover); }

/* ── MAIN CONTENT ─────────────────────────── */
.main-content {
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 16px 40px;
}

.game-wrapper {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* ── MODE BANNER ──────────────────────────── */
.mode-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: center;
}

.mode-badge {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 15px;
  letter-spacing: 1.5px;
  color: var(--accent);
  background: rgba(212,64,0,0.1);
  padding: 3px 12px;
  border-radius: 20px;
  border: 1px solid rgba(212,64,0,0.2);
}

.mode-date {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── GRID ─────────────────────────────────── */
.grid-outer {
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 12px;
  border: 1px solid var(--border);
}

.grid-layout {
  display: grid;
  grid-template-columns: 90px repeat(3, 1fr);
  grid-template-rows: 90px repeat(3, 1fr);
  gap: 6px;
  aspect-ratio: 1;
}

/* ── HEADER CELLS ─────────────────────────── */
.header-cell {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.corner-cell {
  border-radius: var(--radius-sm);
  background: var(--header-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.header-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
}

.header-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 50%;
}

.header-name {
  font-size: 10px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.2;
  text-align: center;
}

.header-sub {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
}

/* ── GAME CELLS ───────────────────────────── */
.game-cell {
  background: var(--cell-empty);
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.game-cell:hover:not(.filled):not(.wrong) {
  background: var(--cell-hover);
  border-color: var(--accent);
  transform: scale(1.02);
}

.game-cell:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.game-cell.selected {
  background: var(--cell-active);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212,64,0,0.15);
}

.game-cell.filled {
  background: var(--cell-correct);
  border-color: var(--green);
  cursor: default;
}

.game-cell.wrong {
  background: var(--red-light);
  border-color: var(--red);
  cursor: default;
}

.game-cell.wrong .cell-player-name {
  color: var(--red);
}

.cell-plus-icon {
  color: var(--text-light);
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
  user-select: none;
  transition: color var(--transition);
}

.game-cell:hover .cell-plus-icon { color: var(--accent); }

/* Player fill */
.cell-player-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.cell-player-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  padding: 16px 6px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cell-player-name {
  font-size: 10px;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  line-height: 1.2;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.cell-correct-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--green);
  color: white;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}

/* Flip animation */
@keyframes cellFlip {
  0% { transform: rotateY(0); }
  50% { transform: rotateY(90deg); }
  100% { transform: rotateY(0); }
}
.cell-flip { animation: cellFlip 0.4s ease; }

/* Shake animation for wrong */
@keyframes cellShake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.cell-shake { animation: cellShake 0.4s ease; }

/* ── CONTROLS BAR ─────────────────────────── */
.controls-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.guess-display {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.guess-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.guess-count {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 42px;
  line-height: 1;
  color: var(--text);
  transition: color var(--transition);
}

.guess-count.low { color: var(--accent); }
.guess-count.critical { color: var(--red); }

.action-btns {
  display: flex;
  gap: 8px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid;
  transition: all var(--transition);
}

.hint-btn {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.hint-btn:hover { background: var(--surface-2); border-color: var(--text-muted); color: var(--text); }

.giveup-btn {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.giveup-btn:hover { background: var(--red-light); border-color: var(--red); color: var(--red); }

.restart-btn {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.restart-btn:hover { background: var(--surface-2); border-color: var(--text-muted); color: var(--text); }

/* ── MODAL OVERLAY ────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,23,20,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: overlayIn 0.2s ease;
}

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

@media (min-width: 600px) {
  .modal-overlay { align-items: center; padding: 20px; }
}

/* ── SEARCH PANEL ─────────────────────────── */
.search-panel {
  background: var(--surface);
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp 0.28s cubic-bezier(0.34,1.2,0.64,1);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

@media (min-width: 600px) {
  .search-panel {
    border-radius: var(--radius-lg);
    animation: popIn 0.25s cubic-bezier(0.34,1.2,0.64,1);
    max-height: 75vh;
  }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

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

.search-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 0;
}

.search-criteria {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.close-search {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color var(--transition);
}
.close-search:hover { color: var(--text); }

.search-input-wrap {
  position: relative;
  padding: 10px 16px 0;
}

.search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-20%);
  color: var(--text-muted);
  pointer-events: none;
}

#searchInput {
  width: 100%;
  padding: 12px 12px 12px 40px;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
#searchInput:focus { border-color: var(--accent); }
#searchInput::placeholder { color: var(--text-light); }

.search-hint-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px 0;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  background: rgba(212,64,0,0.06);
  margin: 10px 16px 0;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 16px;
  min-height: 120px;
}

.search-results::-webkit-scrollbar { width: 4px; }
.search-results::-webkit-scrollbar-track { background: transparent; }
.search-results::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background var(--transition);
  border-radius: 0;
}

.result-item:hover { background: var(--surface-2); }

.result-item.used {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.result-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  background: var(--surface-2);
  flex-shrink: 0;
  border: 2px solid var(--border);
}

.result-info {
  flex: 1;
  min-width: 0;
}

.result-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-seasons {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.result-used-badge {
  font-size: 10px;
  color: var(--text-light);
  font-weight: 600;
  padding: 2px 8px;
  background: var(--surface-2);
  border-radius: 10px;
  flex-shrink: 0;
}

.search-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 14px;
}

.search-empty svg { margin: 0 auto 10px; display: block; opacity: 0.4; }

/* ── RESULT MODAL ─────────────────────────── */
.result-panel {
  background: var(--surface);
  width: 100%;
  max-width: 440px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  animation: slideUp 0.28s cubic-bezier(0.34,1.2,0.64,1);
  max-height: 90vh;
  position: relative;
  padding: 24px 20px 32px;
}

@media (min-width: 600px) {
  .result-panel {
    border-radius: var(--radius-lg);
    animation: popIn 0.25s cubic-bezier(0.34,1.2,0.64,1);
  }
}

.close-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.close-btn:hover { background: var(--border); color: var(--text); }

.result-header {
  text-align: center;
  margin-bottom: 16px;
}

.result-trophy {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 8px;
  animation: trophyBounce 0.6s cubic-bezier(0.34,1.5,0.64,1) 0.1s both;
}

@keyframes trophyBounce {
  from { transform: scale(0) rotate(-15deg); opacity: 0; }
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}

.result-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 36px;
  letter-spacing: 2px;
  color: var(--text);
  margin-bottom: 4px;
}

.result-sub {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.result-score-row {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.score-pill {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  letter-spacing: 2px;
  background: var(--header-bg);
  color: var(--header-text);
  padding: 4px 24px;
  border-radius: 30px;
}

.result-grid-display {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 20px;
}

.result-cell {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border: 2px solid;
}

.result-cell.correct { background: var(--cell-correct); border-color: var(--green); }
.result-cell.wrong { background: var(--red-light); border-color: var(--red); }
.result-cell.empty { background: var(--surface-2); border-color: var(--border); }

.result-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.result-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}

.share-btn {
  background: var(--accent);
  color: white;
}
.share-btn:hover { background: var(--accent-hover); }

.stats-link-btn {
  background: var(--header-bg);
  color: var(--header-text);
}
.stats-link-btn:hover { opacity: 0.85; }

.result-tomorrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── GENERIC MODAL PANEL ──────────────────── */
.modal-panel {
  background: var(--surface);
  width: 100%;
  max-width: 460px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp 0.28s cubic-bezier(0.34,1.2,0.64,1);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

@media (min-width: 600px) {
  .modal-panel {
    border-radius: var(--radius-lg);
    animation: popIn 0.25s cubic-bezier(0.34,1.2,0.64,1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 24px;
  letter-spacing: 1.5px;
  color: var(--text);
}

/* ── STATS CONTENT ────────────────────────── */
.stats-grid-display {
  overflow-y: auto;
  padding: 20px;
  flex: 1;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-box {
  text-align: center;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  border: 1px solid var(--border);
}

.stat-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 32px;
  letter-spacing: 1px;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.stats-section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 16px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
}

.score-dist {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 24px;
}

.score-dist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.score-dist-label {
  width: 20px;
  text-align: right;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}

.score-dist-bar-wrap {
  flex: 1;
  background: var(--surface-2);
  border-radius: 4px;
  height: 24px;
  overflow: hidden;
}

.score-dist-bar {
  height: 100%;
  background: var(--green);
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding-left: 8px;
  font-size: 12px;
  font-weight: 700;
  color: white;
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
  min-width: 30px;
}

.score-dist-bar.highlight { background: var(--accent); }

/* ── SETTINGS ─────────────────────────────── */
.settings-body {
  overflow-y: auto;
  flex: 1;
  padding: 16px 20px 24px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

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

.setting-info { flex: 1; }

.setting-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: block;
}

.setting-desc {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.toggle-switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 13px;
  transition: background var(--transition);
}

.toggle-track::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  left: 3px;
  top: 3px;
  transition: transform var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-track { background: var(--green); }
.toggle-switch input:checked + .toggle-track::before { transform: translateX(20px); }

.setting-select {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
}

.setting-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.danger-btn {
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1.5px solid var(--red);
  color: var(--red);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 8px;
}
.danger-btn:hover { background: var(--red-light); }

/* ── HOW TO PLAY ──────────────────────────── */
.help-panel { max-height: 90vh; }

.help-body {
  overflow-y: auto;
  flex: 1;
  padding: 20px;
}

.help-intro {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.6;
}

.help-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.help-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

.step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--header-bg);
  color: var(--header-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 16px;
  letter-spacing: 0;
  margin-top: 1px;
}

.help-rules {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.help-rules h3 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 16px;
  letter-spacing: 1px;
  color: var(--text);
  margin-bottom: 10px;
}

.help-rules ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.help-rules ul li {
  font-size: 13px;
  color: var(--text-muted);
  padding-left: 16px;
  position: relative;
  line-height: 1.4;
}

.help-rules ul li::before {
  content: '⚾';
  position: absolute;
  left: 0;
  font-size: 10px;
  top: 2px;
}

.primary-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: background var(--transition);
}
.primary-btn:hover { background: var(--accent-hover); }

/* ── TOAST ────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--header-bg);
  color: var(--header-text);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 30px;
  z-index: 9999;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34,1.2,0.64,1), opacity 0.3s ease;
  box-shadow: var(--shadow-md);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── SCROLLBAR ────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }

/* ── RESPONSIVE ───────────────────────────── */
@media (max-width: 480px) {
  .nav-title { font-size: 20px; }
  .nav-btn { padding: 6px 8px; }
  .mode-toggle span:first-child { display: none; }
  
  .main-content { padding: 12px 10px 80px; }
  
  .grid-layout {
    grid-template-columns: 70px repeat(3, 1fr);
    grid-template-rows: 70px repeat(3, 1fr);
    gap: 4px;
  }

  .header-logo { width: 32px; height: 32px; }
  .header-name { font-size: 8px; }
  
  .controls-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: none;
    z-index: 50;
    padding: 10px 12px;
  }

  .guess-count { font-size: 32px; }
  
  .action-btn {
    padding: 8px 10px;
    font-size: 12px;
    gap: 4px;
  }

  .action-btn svg { width: 14px; height: 14px; }
}

@media (max-width: 360px) {
  .grid-layout {
    grid-template-columns: 56px repeat(3, 1fr);
    grid-template-rows: 56px repeat(3, 1fr);
    gap: 3px;
  }
  .action-btn span { display: none; }
}

/* ── LOADING STATE ────────────────────────── */
.loading-cell {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
