/* ============================================
   Mini Game Bay - Complete Stylesheet
   ============================================ */

/* --- CSS Variables & Themes --- */
:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: #16213e;
  --bg-sidebar: #0a0a15;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0b8;
  --text-muted: #6c6c80;
  --accent-primary: #6c63ff;
  --accent-secondary: #f72585;
  --accent-success: #00c853;
  --accent-warning: #ff9800;
  --accent-danger: #ef4444;
  --accent-info: #0ea5e9;
  --border-color: #2a2a40;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --gradient-primary: linear-gradient(135deg, #6c63ff, #f72585);
}

[data-theme="dark"] {
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-card: #1a1a22;
  --bg-sidebar: #060608;
  --text-primary: #e8e8e8;
  --text-secondary: #9999a8;
  --text-muted: #5a5a6e;
  --accent-primary: #7c3aed;
  --accent-secondary: #ec4899;
  --border-color: #1f1f2b;
}

[data-theme="neon"] {
  --bg-primary: #0d0221;
  --bg-secondary: #150535;
  --bg-card: #1a0840;
  --bg-sidebar: #080115;
  --text-primary: #f0e6ff;
  --text-secondary: #c4b5fd;
  --text-muted: #7c6fa0;
  --accent-primary: #00ff88;
  --accent-secondary: #ff00ff;
  --accent-success: #00ff88;
  --accent-warning: #ffcc00;
  --accent-danger: #ff3366;
  --accent-info: #00ccff;
  --border-color: #2d1b69;
  --gradient-primary: linear-gradient(135deg, #00ff88, #ff00ff);
  --shadow: 0 4px 20px rgba(0,255,136,0.15);
}

[data-theme="nature"] {
  --bg-primary: #0a1f0a;
  --bg-secondary: #142b14;
  --bg-card: #1a3a1a;
  --bg-sidebar: #050f05;
  --text-primary: #e0f0e0;
  --text-secondary: #a0c8a0;
  --text-muted: #5a8a5a;
  --accent-primary: #4caf50;
  --accent-secondary: #8bc34a;
  --accent-success: #4caf50;
  --accent-warning: #cddc39;
  --accent-danger: #f44336;
  --accent-info: #00bcd4;
  --border-color: #1e3a1e;
  --gradient-primary: linear-gradient(135deg, #4caf50, #8bc34a);
}

[data-theme="sunset"] {
  --bg-primary: #1a0f0a;
  --bg-secondary: #2b1a12;
  --bg-card: #3a2018;
  --bg-sidebar: #0d0705;
  --text-primary: #f0e0d0;
  --text-secondary: #d0a890;
  --text-muted: #8a6a50;
  --accent-primary: #ff6b35;
  --accent-secondary: #f7931e;
  --accent-success: #ffb347;
  --accent-warning: #ffcc00;
  --accent-danger: #e74c3c;
  --accent-info: #e67e22;
  --border-color: #3a2518;
  --gradient-primary: linear-gradient(135deg, #ff6b35, #f7931e);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
html, body { overscroll-behavior: none; -webkit-overflow-scrolling: touch; }
body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  min-height: calc(var(--vh, 1vh) * 100);
  overflow-x: hidden;
  transition: var(--transition);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent-primary); text-decoration: none; }
a:hover { color: var(--accent-secondary); }
h2 { color: var(--text-primary); margin-bottom: 0.5rem; }
h3 { color: var(--text-primary); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-primary); }

/* ============ NAVBAR ============ */
.navbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  padding-top: max(0.75rem, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(12px);
  flex-wrap: wrap;
  gap: 0.5rem;
}
.nav-brand { display: flex; align-items: center; gap: 0.75rem; font-size: 1.25rem; font-weight: 700; color: var(--accent-primary); }
.nav-links { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.nav-links .nav-item {
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-size: 0.9rem;
}
.nav-links .nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-links .nav-item.active { background: var(--accent-primary); color: #fff; }
.nav-timer { display: flex; align-items: center; gap: 0.5rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.nav-powerups { display: flex; gap: 0.25rem; }

/* ============ MAIN CONTENT ============ */
.main-content { flex: 1; padding: 2rem; max-width: 1100px; margin: 0 auto; min-height: calc(100vh - 60px); min-height: calc(var(--vh, 1vh) * 100 - 60px); }
.page-section { display: none; }
.page-section.active { display: block; }

/* ============ CARDS ============ */
.card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 1.5rem; transition: var(--transition); }

/* ============ GAMES GRID ============ */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.game-card {
  cursor: pointer; position: relative; overflow: hidden;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius); padding: 1rem 1.25rem; transition: var(--transition);
}
.game-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent-primary); }
.game-card-row { display: flex; align-items: center; gap: 0.75rem; }
.game-card-icon { font-size: 2.5rem; flex-shrink: 0; margin-bottom: 0; }
.game-card-body { flex: 1; min-width: 0; }
.game-card-header { display: flex; align-items: center; gap: 0.35rem; margin-bottom: 0.2rem; }
.game-card-title { font-size: 1.1rem; font-weight: 600; }
.game-card-info-btn {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--border-color); background: var(--bg-secondary);
  color: var(--text-muted); cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; padding: 0; line-height: 1;
  transition: var(--transition); touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.game-card-info-btn:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.game-card-info-btn .material-symbols-outlined { font-size: 16px; }
.game-card-desc { color: var(--text-secondary); font-size: 0.8rem; margin: 0.4rem 0 0; }
.game-card-levels { color: var(--text-muted); font-size: 0.78rem; }
.game-card-badge { position: absolute; top: 10px; right: 10px; font-size: 1.1rem; }

/* ============ LEVEL SELECTION ============ */
.levels-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-top: 1rem; }
.level-card {
  cursor: pointer; text-align: center; position: relative;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius); padding: 1.5rem; transition: var(--transition);
}
.level-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.level-card.locked { opacity: 0.5; cursor: not-allowed; }
.level-card.completed { border-color: var(--accent-success); }
.level-number { font-size: 2rem; font-weight: 700; color: var(--accent-primary); }
.level-name { font-size: 0.95rem; margin: 0.25rem 0; }
.best-record { font-size: 0.75rem; color: var(--text-muted); }
.stars { color: var(--accent-warning); font-size: 1.2rem; margin-top: 0.25rem; }

/* ============ STATS ============ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { text-align: center; padding: 1.25rem; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); }
.stat-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ============ BUTTONS ============ */
.btn {
  padding: 0.6rem 1.25rem; border-radius: var(--radius-sm); border: none;
  cursor: pointer; font-size: 0.9rem; font-weight: 600;
  transition: var(--transition); display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn-primary { background: var(--accent-primary); color: #fff; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-success { background: var(--accent-success); color: #fff; }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--accent-danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-warning { background: var(--accent-warning); color: #000; }
.btn-warning:hover { opacity: 0.9; }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-outline:hover { background: var(--bg-secondary); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.modal-buttons { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }

/* ============ POWER UPS ============ */
.powerups-bar { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.powerup-btn {
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  color: var(--text-primary); padding: 0.5rem 1rem; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 0.85rem; transition: var(--transition);
  display: flex; align-items: center; gap: 0.3rem;
}
.powerup-btn:hover { background: var(--bg-card); }
.powerup-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.powerup-count {
  background: var(--accent-primary); color: #fff; border-radius: 50%;
  width: 20px; height: 20px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700;
}

/* ============ HINT HISTORY ============ */
.hint-history-btn {
  padding: 0.5rem 0.65rem !important;
  font-size: 0.9rem !important;
  background: rgba(108,99,255,0.15) !important;
  border-color: var(--accent-primary) !important;
}
.hint-history-btn:hover {
  background: rgba(108,99,255,0.3) !important;
}
.hint-history-card {
  max-width: 480px !important;
  max-height: 80vh;
  overflow-y: auto;
}
.hint-history-overlay {
  z-index: 2100;
}
.hint-history-list {
  text-align: left;
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 4px;
}
.hint-history-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  border: 1px solid var(--border-color);
}
.hint-history-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
}
.hint-history-text {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.5;
  padding-top: 3px;
}

/* ============ SETTINGS ============ */
.settings-section { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border-color); }
.settings-section h3 { margin-bottom: 1rem; }
.setting-row { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 0; }
.setting-label { font-weight: 600; }
.setting-desc { font-size: 0.8rem; color: var(--text-muted); }
.theme-selector { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.theme-option {
  padding: 0.6rem 1rem; border-radius: var(--radius-sm); cursor: pointer;
  border: 2px solid var(--border-color); background: var(--bg-card);
  color: var(--text-primary); transition: var(--transition); font-size: 0.85rem; font-weight: 600;
}
.theme-option:hover { border-color: var(--accent-primary); }
.theme-option.selected { border-color: var(--accent-primary); background: var(--accent-primary); color: #fff; }

/* ============ TOGGLE SWITCH ============ */
.toggle-switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border-color); transition: 0.3s; border-radius: 26px;
}
.toggle-slider:before {
  position: absolute; content: ""; height: 20px; width: 20px;
  left: 3px; bottom: 3px; background: #fff; transition: 0.3s; border-radius: 50%;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent-success); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(22px); }

/* ============ PROGRESS BAR ============ */
.progress-bar { height: 6px; background: var(--border-color); border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--gradient-primary); border-radius: 3px; transition: width 0.5s ease; }

/* ============ RESULT MODAL ============ */
.result-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7); display: flex; align-items: center;
  justify-content: center; z-index: 2000; backdrop-filter: blur(4px);
}
.result-card {
  background: var(--bg-card); border: 2px solid var(--border-color);
  border-radius: var(--radius-lg); padding: 2rem; text-align: center;
  max-width: 400px; width: 90%; box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s ease;
}
.result-card.win { border-color: var(--accent-success); }
.result-card.lose { border-color: var(--accent-danger); }
.result-icon { font-size: 4rem; margin-bottom: 0.5rem; }
.result-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 1rem; }
.result-details { margin: 1rem 0; }
.result-details p { margin: 0.3rem 0; color: var(--text-secondary); }
.result-details span { color: var(--text-primary); font-weight: 600; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.8) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ============ CONFETTI ============ */
.confetti-container {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 2001; overflow: hidden;
}
.confetti-piece { position: absolute; top: -10px; animation: confettiFall linear forwards; }
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ============ NOTIFICATIONS ============ */
.notification {
  position: fixed; top: 80px; right: 20px; padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm); color: #fff; font-weight: 600;
  z-index: 3000; animation: slideIn 0.3s ease; box-shadow: var(--shadow);
  max-width: calc(100vw - 40px);
  word-break: break-word;
}
@media (max-width: 768px) {
  .notification {
    top: auto; bottom: 20px; right: 10px; left: 10px;
    text-align: center; font-size: 0.85rem; padding: 0.6rem 1rem;
  }
}
.notification.info { background: var(--accent-info); }
.notification.success { background: var(--accent-success); }
.notification.warning { background: var(--accent-warning); color: #000; }
.notification.error { background: var(--accent-danger); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slideInUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@media (max-width: 768px) {
  .notification { animation-name: slideInUp; }
}

/* ============ GAME INFO ============ */
.game-info { display: flex; gap: 1rem; align-items: center; color: var(--text-secondary); font-size: 0.85rem; }

/* ============ GAME-SPECIFIC STYLES ============ */

/* Minesweeper */
.minesweeper-grid-scroll {
  overflow: auto; -webkit-overflow-scrolling: touch;
  max-width: 100%; max-height: 70vh; border-radius: var(--radius-sm);
  scrollbar-width: thin; scrollbar-color: var(--border-color) transparent;
}
.minesweeper-grid-scroll::-webkit-scrollbar { height: 6px; width: 6px; }
.minesweeper-grid-scroll::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
.minesweeper-info {
  margin-bottom: 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  justify-content: center; padding: 0 4px;
}
.ms-info-stat {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); padding: 6px 12px; font-weight: 600;
  font-size: 0.9rem; white-space: nowrap;
}
.ms-flag-toggle {
  cursor: pointer; user-select: none; border-radius: var(--radius-sm);
  padding: 6px 14px; font-weight: 700; font-size: 0.85rem; border: 2px solid var(--border-color);
  background: var(--bg-card); color: var(--text-primary); transition: var(--transition);
  white-space: nowrap; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.ms-flag-toggle:hover { border-color: var(--accent-primary); }
.ms-flag-toggle.active { background: var(--accent-warning); color: #000; border-color: var(--accent-warning); }
.ms-cell {
  cursor: pointer; user-select: none; -webkit-user-select: none;
  border-radius: 4px; font-weight: bold; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card); border: 1px solid var(--border-color);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
.ms-cell:hover { background: var(--bg-secondary); }
.ms-cell:active:not(.revealed):not(.flagged) {
  background: var(--bg-secondary); transform: scale(0.92);
}
.ms-cell.flagged:active { transform: scale(0.92); }
.ms-cell.revealed { background: var(--bg-secondary); }
.ms-cell.mine { background: var(--accent-danger); }
.ms-cell.flagged { background: var(--accent-warning); }
.ms-bomb-wrapper { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 1.8em; }
.ms-shield-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.8em;
  pointer-events: none;
}

/* Chess */
.chess-square { transition: background 0.15s; }
.chess-square.light { background: #ebecd0; }
.chess-square.dark { background: #739552; }
.chess-square.selected { background: var(--accent-success) !important; }
.chess-square.highlight { background: rgba(108,99,255,0.45) !important; }

/* Chess pieces — distinct colors per side with shadow for depth */
.chess-piece { user-select: none; pointer-events: none; line-height: 1; }
.chess-piece.white { color: #ffffff; text-shadow: -1px -1px 0 #1a110b, 1px -1px 0 #1a110b, -1px 1px 0 #1a110b, 1px 1px 0 #1a110b, 0 2px 4px rgba(0,0,0,0.45); }
.chess-piece.black { color: #1a110b; text-shadow: 0 1px 2px rgba(255,255,255,0.18); }

/* Pipes */
.pipe-cell { transition: filter 0.2s; }
.pipe-cell:hover { filter: brightness(1.15); }
.pipe-cell.pipe-start { background: rgba(0,200,83,0.15) !important; }
.pipe-cell.pipe-end { background: rgba(239,68,68,0.15) !important; }
.pipe-cell.pipe-connected { background: rgba(0,200,83,0.12) !important; box-shadow: inset 0 0 12px rgba(0,200,83,0.25); }

/* Matching */
.match-card { transition: all 0.3s; }
.match-card.flipped { background: var(--bg-secondary) !important; }
.match-card.matched { background: rgba(0,200,83,0.2) !important; border-color: var(--accent-success) !important; }

/* Sudoku (9x9) */
.sudoku-cell { transition: all 0.15s; color: var(--text-primary); }
.sudoku-cell.initial { font-weight: 700; color: #ffb347; }
.sudoku-cell.user-input { color: #4dc9f6; }
.sudoku-cell.selected { background: rgba(108,99,255,0.3) !important; }
.sudoku-cell.highlighted { background: rgba(108,99,255,0.1) !important; }
.sudoku-cell.same-value { background: rgba(108,99,255,0.05) !important; }
.sudoku-cell.error { color: var(--accent-danger) !important; }
.sudoku-cell.border-right { border-right: 2px solid var(--accent-primary) !important; }
.sudoku-cell.border-bottom { border-bottom: 2px solid var(--accent-primary) !important; }
.sudoku-notes { color: #a5b4fc; }
.notes-toggle.active { background: var(--accent-primary); color: #fff; border-color: var(--accent-primary); }

/* Word Search */
.ws-cell { transition: all 0.15s; }
.ws-cell.ws-highlight { background: rgba(108,99,255,0.3) !important; }
.ws-cell.ws-found { background: rgba(0,200,83,0.3) !important; }

/* Sliding Puzzle */
.sliding-tile { transition: transform 0.15s, background 0.2s; }
.sliding-tile:hover { opacity: 0.85; }
.sliding-tile.empty { cursor: default; }
.sliding-tile.correct { background: var(--accent-success) !important; }

/* Hanoi */
.hanoi-peg { transition: background 0.2s; padding: 8px; border-radius: var(--radius-sm); }
.hanoi-peg.selected { background: rgba(108,99,255,0.15); }
.hanoi-disk { transition: all 0.2s; }

/* ============ ANIMATIONS ============ */
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.pulse { animation: pulse 0.3s ease; }
.shake { animation: shake 0.3s ease; }

/* ============ GOOGLE MATERIAL SYMBOLS ============ */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
}

/* Filled variant (for selected/active states, badges, etc.) */
.material-symbols-filled {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Icon size utilities */
.gicon-sm { font-size: 18px; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20; }
.gicon-md { font-size: 24px; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.gicon-lg { font-size: 32px; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 40; }
.gicon-xl { font-size: 48px; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 48; }
.gicon-2xl { font-size: 64px; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 48; }

/* Theme-colored icon variants — automatically inherit theme colors */
.gicon-text { color: var(--text-primary); }
.gicon-muted { color: var(--text-muted); }
.gicon-accent { color: var(--accent-primary); }
.gicon-success { color: var(--accent-success); }
.gicon-warning { color: var(--accent-warning); }
.gicon-danger { color: var(--accent-danger); }
.gicon-info { color: var(--accent-info); }
.gicon-secondary { color: var(--text-secondary); }

/* ============ REPLACE EMOJIS IN NAVBAR WITH ICONS ============ */
.nav-brand .gicon { font-size: 1.5rem; margin-right: 0.25rem; }
.nav-links .nav-item .gicon { font-size: 1.1rem; margin-right: 0.25rem; vertical-align: -0.15em; }
.nav-timer .gicon { font-size: 1.1rem; vertical-align: -0.15em; }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .main-content { padding: 0.75rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .games-grid { grid-template-columns: 1fr; }
  .navbar { flex-direction: column; padding: 0.5rem 0.75rem; }
  .nav-brand { font-size: 1rem; }
  .nav-links { justify-content: center; width: 100%; gap: 0.25rem; }
  .nav-links .nav-item { padding: 0.4rem 0.5rem; font-size: 0.75rem; }
  .levels-grid { grid-template-columns: repeat(2, 1fr); }
  h2 { font-size: 1.25rem; }
  .game-header-buttons { gap: 0.25rem; }
  .game-header-buttons .btn { padding: 6px 10px; font-size: 0.75rem; }
}

@media (max-width: 480px) {
  .main-content { padding: 0.5rem; }
  .stats-grid { grid-template-columns: 1fr; }
  .btn { padding: 8px 12px; font-size: 0.8rem; }
  .levels-grid { grid-template-columns: 1fr; }
  .nav-brand { font-size: 0.9rem; }
  .nav-links .nav-item { padding: 0.35rem 0.4rem; font-size: 0.7rem; }
  .card { padding: 12px; }
}

/* ============ GLOBAL MOBILE GAME-AREA RULES ============ */
#page-game {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

/* Prevent pull-to-refresh and overscroll on game boards */
#game-content {
  overscroll-behavior: contain;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* All game grid cells — prevent accidental text selection & zoom */
[class*="-cell"],
[class*="-tile"],
.blocks-cell, .light-cell, .connect-cell, .sumix-cell,
.cm-cell, .tile-btn, .num-cell, .crown-cell, .ws-cell,
.sudoku-cell, .sliding-tile, .pipe-cell, .match-card,
.chess-square, .ring-peg, .hanoi-disk, .ol-node,
.family-item, .hw-letter, .mc-cell, .block-piece,
.ol-edge, .family-category {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ============ NEW GAME STYLES ============ */

/* Blocks */
.blocks-cell { border-radius: 4px; transition: all 0.2s; user-select: none; }
.blocks-cell.wall { background: var(--border-color); }
.blocks-cell.empty { background: transparent; }
.blocks-cell.block { cursor: pointer; }
.blocks-cell.goal { background: rgba(0,200,83,0.2); border: 2px dashed var(--accent-success); }
.blocks-cell.selected { box-shadow: 0 0 0 3px var(--accent-primary); }

/* Rings */
.ring-peg { cursor: pointer; transition: all 0.2s; min-width: 70px; }
.ring-peg.selected { background: rgba(108,99,255,0.2); border-radius: var(--radius-sm); }
.ring-disk { transition: all 0.2s; border-radius: 12px; }

/* Lights */
.light-cell { cursor: pointer; border-radius: 50%; transition: all 0.15s; }
.light-cell.on { background: #fbbf24; box-shadow: 0 0 12px rgba(251,191,36,0.6); }
.light-cell.off { background: #1e293b; }

/* Connect */
.connect-cell { transition: all 0.2s; }
.connect-cell.dot { border-radius: 50%; }
.connect-cell.path { background: var(--accent-primary); }
.connect-cell.empty { background: var(--bg-card); }

/* Sumix */
.sumix-cell { transition: all 0.15s; }
.sumix-cell.fixed { font-weight: 700; color: var(--accent-primary); }
.sumix-cell.drag-over { background: rgba(108,99,255,0.2); }

/* Rise */
.rise-canvas { display: block; margin: 0 auto; background: var(--bg-secondary); border: 2px solid var(--border-color); border-radius: var(--radius-sm); }

/* Hidden Word */
.hw-letter { transition: all 0.2s; cursor: pointer; user-select: none; }
.hw-letter.selected { background: var(--accent-primary) !important; color: #fff !important; }
.hw-letter.used { opacity: 0.3; cursor: default; }

/* Families */
.family-category { min-height: 80px; transition: all 0.2s; }
.family-item { cursor: pointer; transition: all 0.2s; user-select: none; }
.family-item.wrong { animation: shake 0.4s; }

/* Color Maze */
.cm-cell { transition: all 0.15s; cursor: pointer; }
.cm-cell.player { transform: scale(1.1); border: 3px solid #fff !important; }

/* Tiles */
.tile-btn { transition: all 0.2s; cursor: pointer; }
.tile-btn.matched { opacity: 0; pointer-events: none; }

/* Math Cross */
.mc-cell { transition: all 0.15s; }
.mc-cell.selected { border-color: var(--accent-primary) !important; }
.mc-cell.fixed { background: var(--bg-secondary); font-weight: 700; }

/* Numbers */
.num-cell { transition: all 0.15s; }
.num-cell.selected { border-color: var(--accent-primary) !important; }
.num-cell.error { color: var(--accent-danger) !important; }

/* Crowns */
.crown-cell { transition: all 0.15s; cursor: pointer; }
.crown-cell.placed { background: var(--accent-warning); }
.crown-cell.conflict { background: var(--accent-danger); }

/* Word Flow */
.wf-input { width: 100%; padding: 10px; border-radius: var(--radius-sm); background: var(--bg-secondary); color: var(--text-primary); border: 2px solid var(--border-color); text-align: center; font-size: 1.2rem; letter-spacing: 0.3em; }
.wf-input:focus { border-color: var(--accent-primary); outline: none; }
.wf-chain-word { transition: all 0.2s; }

/* One Line */
.ol-node { cursor: pointer; transition: all 0.15s; border-radius: 50%; }
.ol-node.visited { background: var(--accent-primary); }
.ol-edge { background: var(--border-color); }
.ol-edge.drawn { background: var(--accent-success); }

/* Universe */
.uv-cell { transition: all 0.15s; }
.uv-cell.planet { border-radius: 50%; box-shadow: 0 0 10px rgba(108,99,255,0.4); }
.uv-cell.target { border: 3px solid var(--accent-success); }
.uv-cell.probe { border-radius: 50%; }

/* Rise (Number Click Ascending) */
.rise-cell {
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

@keyframes rise-shield-pop {
  0%   { transform: scale(0.3); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* Word Chain */
.wc-slot {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.wc-slot-locked {
  background: var(--bg-card);
  border: 2px solid var(--accent-primary);
  color: var(--accent-primary);
}
.wc-input {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  min-height: 44px;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.wc-input:focus {
  border-color: var(--accent-primary);
  outline: none;
  box-shadow: 0 0 8px rgba(108,99,255,0.3);
}
.wc-arrow {
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  user-select: none;
}
