@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;700&display=swap');
/* assets/style.css — modern, mobile-first, child-friendly UI */
:root {
  /* playful, high-contrast pastel palette */
  --bg: #fffaf6;
  --card: #ffffff;
  --primary: #7c3aed; /* purple */
  --accent: #ffb703;  /* cheerful yellow */
  --muted: #64748b;
  --text: #0f172a;
  --surface-shadow: rgba(12, 12, 12, 0.08);
  --radius-lg: 18px;
  --radius-sm: 10px;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: 'Baloo 2', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #e0f2fe;
  color: var(--text);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
/* Skip link */
.skip-link {
  position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden;
}
.skip-link:focus {
  left: 16px; top: 12px; width: auto; height: auto; padding: 8px 12px; background: var(--primary); color: #fff; border-radius: 8px; z-index: 9999;
}
/* Layout container — mobile-first */
.container { max-width: 100%; margin: 0 auto; padding: 8px; }
@media (min-width: 720px){ .container { max-width: 900px; padding: 16px; } }
/* Card */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: 0 10px 30px var(--surface-shadow);
  border: 0;
}
h1, h2 { margin: 0 0 12px; line-height: 1.1; }
h1 { font-size: 1.6rem; display:flex; align-items:center; gap:10px; }
.badge { display:inline-block; background: #f3e8ff; color: var(--primary); padding: 6px 10px; border-radius: 999px; font-weight:700; font-size:0.9rem; }
.p-muted { color: var(--muted); font-size:0.95rem; margin: 8px 0 12px; }
/* Buttons — big, tappable */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap:8px;
  background: var(--primary); color: #fff; border: none; border-radius: 14px;
  padding: 10px 12px; font-weight: 700; font-size: 1rem; cursor: pointer; min-height:40px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:active{ transform: translateY(1px); }
.btn:focus{ outline: 3px solid rgba(124,58,237,0.18); }
.btn.secondary{ background: var(--accent); color: rgba(0,0,0,0.85); }

.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* sound toggle small button */
.sound-toggle { padding: 10px 12px; font-size: 0.95rem; border-radius: 12px; }
.sound-toggle[aria-pressed="false"] { opacity: 0.85; }


/* answer feedback animations */
@keyframes cp-pulse { 0% { transform: scale(1); box-shadow: 0 6px 16px rgba(22,163,74,0.08); }
  50% { transform: scale(1.04); box-shadow: 0 12px 28px rgba(22,163,74,0.14); }
  100% { transform: scale(1); box-shadow: 0 8px 20px rgba(22,163,74,0.12); } }
@keyframes cp-shake { 0% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
  100% { transform: translateX(0); } }

.btn.correct{ background: #16a34a !important; color: #fff; box-shadow: 0 8px 20px rgba(22,163,74,0.12); animation: cp-pulse 700ms cubic-bezier(.2,.9,.3,1); }
.btn.wrong{ background: #ef4444 !important; color: #fff; box-shadow: 0 8px 20px rgba(239,68,68,0.12); animation: cp-shake 560ms cubic-bezier(.36,.07,.19,.97); }

/* Apply the same clear green/red feedback to any element using .correct/.wrong */
.correct, .is-correct { background: #16a34a !important; color: #fff !important; border-color: #16a34a !important; box-shadow: 0 8px 20px rgba(22,163,74,0.12); }
.wrong, .is-wrong { background: #ef4444 !important; color: #fff !important; border-color: #ef4444 !important; box-shadow: 0 8px 20px rgba(239,68,68,0.12); }

.btn:disabled{ opacity: 0.65; cursor: default; }

@media (prefers-reduced-motion: reduce) {
  .btn.correct, .btn.wrong { animation: none !important; transform: none !important; }
}

/* CONFETTI */
/* Make the container full viewport so confetti is never clipped and sits above headers */
.confetti-container{ position: fixed; left: 0; top: 0; right: 0; bottom: 0; width: 100%; height: 100vh; pointer-events: none; overflow: visible; z-index: 999999; -webkit-overflow-scrolling: touch; }
.confetti{ position: absolute; top: 0; width: 10px; height: 14px; border-radius: 3px; transform-origin: center; opacity: 1; will-change: transform, opacity; animation: confetti-fall 1200ms linear forwards, confetti-rotate 1200ms linear forwards; }
@keyframes confetti-fall { 0% { transform: translateY(-6vh) rotate(0deg); opacity: 1; } 60% { opacity: 1; } 100% { transform: translateY(110vh) rotate(540deg); opacity: 0.95; } }
@keyframes confetti-rotate { 0% { transform: rotate(0deg); } 100% { transform: rotate(540deg); } }

/* Make grid items stack on mobile */
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
@media (min-width: 640px){ .grid-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 640px){ .grid-2 { grid-template-columns: repeat(2, 1fr); } }
/* Make buttons inside grids full-width for easy taps */
.grid .btn { width: 100%; }
.input {
  width: 100%; padding: 12px; border: 2px solid #f1f5f9; border-radius: 12px; font-size: 1rem; background:#fff;
}
.footer { margin-top: 14px; color: var(--muted); font-size: 0.95rem; }
/* Ads: keep for larger screens, hide on small for child-friendly experience */
.ad-slot { width: 100%; min-height: 56px; border-radius: 12px; display:flex; align-items:center; justify-content:center; color:var(--muted); margin: 14px 0; background: linear-gradient(180deg,#fff,#fffbf2); border: 1px dashed #fde68a; }
@media (max-width: 639px){ .ad-slot { display: none; } }
/* Header */
.site-header { padding: 14px 16px; background: linear-gradient(90deg,#fff,#fff); position: sticky; top:0; z-index:50; }
.header-inner { display:flex; align-items:center; justify-content:space-between; gap:12px; max-width:1100px; margin:0 auto; }
.logo { display:flex; align-items:center; gap:8px; font-weight:800; color:var(--primary); text-decoration:none; }
.logo .brand-emoji { font-size:1.3rem; }
.nav .nav-btn { background: transparent; border: 2px solid transparent; color:var(--primary); padding: 8px 12px; border-radius: 8px; font-weight:700; }
.nav .nav-btn:focus{ outline: 3px solid rgba(124,58,237,0.12); }
/* Tiny helpers */
.grid .badge { justify-self:start; }
/* Cards & game specific components */
.maze { display:grid; grid-template-columns: repeat(6, 48px); gap:8px; margin:12px 0; justify-content:center; }
@media (max-width: 639px){ .maze { grid-template-columns: repeat(6, 42px); gap:10px; } }
.cell { width:48px; height:48px; border-radius:10px; background:#eaeef6; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:18px; }
.start { background:#dbeafe; }
.goal { background:#dcfce7; }
.block { background:#fecaca; }
.cmds { display:flex; gap:8px; flex-wrap:wrap; margin:12px 0; }
.chip { padding:8px 12px; border-radius:999px; background:#eef2ff; color:var(--primary); cursor:grab; user-select:none; font-weight:700; }
.program { min-height:64px; border:2px dashed #cbd5e1; border-radius:14px; padding:8px; display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
/* Memory card board */
.board { display:grid; grid-template-columns: repeat(4, 1fr); gap:8px; margin:12px auto; max-width:360px; background: #f8f9fa; border-radius:12px; padding:8px; }
.card-tile { background:#e2e8f0; border-radius:12px; aspect-ratio:1; display:flex; align-items:center; justify-content:center; font-size:24px; font-weight:800; cursor:pointer; user-select:none; transition: transform .18s ease, background .12s ease; }
.card-tile.flipped { background:#fff; border:2px solid #94a3b8; transform: scale(1.02); }
.card-tile.matched { background:#16a34a; color: #fff; border: 0; cursor:default; box-shadow: 0 8px 20px rgba(22,163,74,0.12); }
@media (min-width: 640px) and (max-width: 1023px){ .board { max-width:400px; } .card-tile { font-size:22px; } }
@media (max-width: 639px){ .board { grid-template-columns: repeat(3, 1fr); gap:2px; width:100%; margin:12px auto; padding:1px; } .card-tile{ font-size:20px; } }
@media (max-width: 480px){ .board { grid-template-columns: repeat(2, 1fr); gap:4px; width:100%; margin:12px auto; padding:6px; } .card-tile{ font-size:18px; } }
/* Helpful small utilities */
.small { font-size:0.9rem; color:var(--muted); }
.center { text-align:center; }

/* Settings panel */
.settings-btn{ border: 0; background: transparent; font-weight:700; color:var(--primary); padding:8px 10px; border-radius:8px; }
.settings-panel{ position: fixed; right: 14px; top: 64px; background: #fff; border-radius: 12px; box-shadow: 0 12px 40px rgba(12,12,12,0.12); padding: 12px; width: 220px; transform-origin: top right; opacity: 0; transform: translateY(-6px) scale(.98); transition: opacity .18s ease, transform .18s ease; z-index:9999; pointer-events: none; }
.settings-panel.open{ opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.settings-panel .settings-row{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:6px 4px; }
.settings-panel .sound-toggle{ min-width: 84px; }
@media (max-width: 640px){ .settings-panel{ right: auto; left: 14px; width: calc(100% - 28px); top: 60px; } }

/* Toasts */
.toast-container{ position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; display:flex; gap:8px; flex-direction:column; align-items:center; z-index:99999; }
.toast{ background: rgba(15,23,42,0.95); color: #fff; padding: 10px 14px; border-radius: 12px; box-shadow: 0 8px 24px rgba(2,6,23,0.45); transition: transform .2s ease, opacity .2s ease; transform: translateY(0); opacity: 1; }
.toast.hide{ opacity: 0; transform: translateY(8px); }

/* Screen-reader only helper */
.sr-only{ position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (prefers-reduced-motion: reduce) { .toast{ transition: none !important; } }

/* Game figure & choice tweaks */
.game-figure { font-size:72px; line-height:1; text-align:center; padding: 10px 0; }
.game-figure img { width: 140px; height: 140px; object-fit: cover; border-radius: 12px; box-shadow: 0 10px 24px rgba(12,12,12,0.08); }
#choices { margin-top: 12px; }
#choices .btn { padding: 12px; font-size: 1rem; }

/* Chess Game Styles */
.chess-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.captured-section {
  width: 100px;
  text-align: center;
}

.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 2px;
  width: 100%;
  max-width: 400px;
  margin: 20px auto;
}

.chess-square {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  cursor: pointer;
  background-color: #eeeeee;
}

.chess-square.dark {
  background-color: #aaaaaa;
}

.chess-square.selected {
  background-color: #ffff00;
}

.chess-square.highlight {
  background-color: #3ca458;
}

.chess-piece {
  user-select: none;
}

/* Mobile responsiveness for chess */
@media (max-width: 768px) {
  .chess-layout {
    flex-direction: column;
    gap: 10px;
  }

  .captured-section {
    width: 100%;
    order: -1; /* White captured on top */
  }

  #blackCaptured {
    order: 1; /* Black captured at bottom */
  }

  .chess-board {
    max-width: 90vw;
    margin: 10px auto;
    gap: 1px;
  }

  .chess-square {
    font-size: 1.5rem;
    min-height: 40px;
    min-width: 40px;
  }
}

@media (max-width: 480px) {
  .chess-board {
    max-width: 95vw;
    gap: 0.5px;
  }

  .chess-square {
    font-size: 1.2rem;
    min-height: 35px;
    min-width: 35px;
  }

  .captured-section h3 {
    font-size: 1rem;
  }
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(5px);
}

.modal-content {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modal-appear 0.3s ease-out;
}

@keyframes modal-appear {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
  margin: 0;
  color: var(--primary);
  font-size: 1.5rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: #f3f4f6;
  color: var(--text);
}

.modal-body {
  padding: 24px;
  text-align: center;
}

.modal-body p {
  font-size: 1.1rem;
  margin-bottom: 20px;
  color: var(--text);
}

.modal-games-preview {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.preview-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, #a855f7 100%);
  color: white;
  border-radius: 12px;
  min-width: 80px;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
}

.preview-emoji {
  font-size: 1.5rem;
}

.preview-item span:last-child {
  font-size: 0.9rem;
  font-weight: 600;
}

.modal-cta {
  background: linear-gradient(135deg, var(--primary) 0%, #a855f7 100%);
  color: white;
  border: none;
  font-size: 1.1rem;
  padding: 14px 28px;
  animation: pulse-cta 2s infinite;
}

@keyframes pulse-cta {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);
  }
}

/* Game Card Animations */
@keyframes slide-in-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.game-card.animate-in {
  animation: slide-in-up 0.6s ease-out forwards;
  opacity: 0;
}

/* Enhanced hover effects */
.game-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 20px 40px rgba(124, 58, 237, 0.15);
}

.game-card:hover .game-image img {
  transform: scale(1.08);
}

/* Respect user's reduced motion setting */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .modal-content { animation: none; }
  .modal-cta { animation: none; }
  .game-card.animate-in { animation: none; opacity: 1; }
}
/* Footer */
.site-footer { padding: 14px 16px; text-align:center; color:var(--muted); font-size:0.9rem; }

/* Chess Game Enhancements */
#difficultySelect:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  transform: translateY(-1px);
}

#difficultySelect:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
  outline: none;
}

/* Homepage styles - Poki.com inspired */


.games-section {
  margin-bottom: 20px;
}
.games-section h2 {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 15px;
  color: var(--text);
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
  justify-items: center;
}

.game-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 12px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: 0 8px 24px var(--surface-shadow);
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  width: 100%;
  max-width: 200px;
}
.game-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(124,58,237,0.05) 0%, rgba(251,146,60,0.05) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.game-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px var(--surface-shadow);
  border-color: var(--primary);
}
.game-card:hover::before {
  opacity: 1;
}

.game-image {
  width: 100%;
  height: 70%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 8px;
}
.game-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.game-card:hover .game-image img {
  transform: scale(1.05);
}

.game-card h3 {
  font-size: 1rem;
  margin: 0;
  color: var(--primary);
  font-weight: 600;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2rem;
  }
  .hero p {
    font-size: 1rem;
  }
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  .game-card {
    padding: 20px;
  }
  .game-icon {
    font-size: 3rem;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 30px 16px;
  }
  .hero h1 {
    font-size: 1.8rem;
  }
  .games-section h2 {
    font-size: 1.5rem;
  }
}

/* Tic Tac Toe Board Styles */
.tic-tac-toe-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 300px;
  margin: 0 auto;
  justify-items: center;
}

.tic-cell {
  width: 80px;
  height: 80px;
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  user-select: none;
}

.tic-cell:hover {
  background: #f8fafc;
  border-color: var(--primary);
}

.tic-cell:focus {
  outline: 3px solid rgba(124, 58, 237, 0.18);
}

.tic-cell.x::before {
  content: 'X';
  color: var(--primary);
}

.tic-cell.o::before {
  content: 'O';
  color: var(--accent);
}

.tic-cell.winning {
  background: #dcfce7;
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2);
}

/* Mobile adjustments */
@media (max-width: 639px) {
  .tic-cell {
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
  }
}

/* Hint and Achievement Styles */
.tic-cell.hint {
  background: #fef3c7;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3);
  animation: hint-pulse 1s ease-in-out infinite;
}

@keyframes hint-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.achievement-locked {
  opacity: 0.5;
  filter: grayscale(100%);
  position: relative;
}

.achievement-locked::before {
  content: '🔒';
  position: absolute;
  top: -2px;
  left: -2px;
  font-size: 0.8em;
}

.achievement-unlocked {
  opacity: 1;
  filter: none;
  animation: achievement-unlock 0.6s ease-out;
}

@keyframes achievement-unlock {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
/* Sliding Puzzle Styles */
.sliding-board {
  display: grid;
  gap: 3px;
  max-width: 320px;
  margin: 12px auto;
  background: #ddd;
  padding: 8px;
  border-radius: 6px;
}

.sliding-tile {
  aspect-ratio: 1;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  border-radius: 3px;
  transition: transform 0.15s ease, background 0.15s ease;
  user-select: none;
}

.sliding-tile:hover {
  transform: scale(1.03);
}

.sliding-tile.empty {
  background: #f9f9f9;
  cursor: default;
}

.sliding-tile.empty:hover {
  transform: none;
}

.sliding-tile.moving {
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.sliding-tile.hint {
  background: #fbbf24 !important;
  animation: hint-pulse 1s ease-in-out infinite;
}

.sliding-tile.invalid-move {
  background: #ef4444 !important;
  animation: shake 0.3s ease-in-out;
}

@keyframes hint-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Compact button styles */
.btn.small {
  padding: 6px 8px;
  font-size: 0.85rem;
  min-height: 32px;
}

/* Responsive adjustments for sliding puzzle */
@media (max-width: 768px) {
  .sliding-board {
    max-width: 280px;
  }

  .sliding-tile {
    font-size: 1rem;
  }
}


/* Sudoku Game Styles */
.sudoku-board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  gap: 1px;
  max-width: 450px;
  margin: 20px auto;
  background: #000;
  border: 3px solid #000;
  border-radius: 8px;
  padding: 8px;
}

.sudoku-cell {
  aspect-ratio: 1;
  background: #fff;
  border: 1px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  user-select: none;
}

.sudoku-cell:hover {
  background: #f8f9fa;
}

.sudoku-cell.selected {
  background: #e3f2fd;
  border-color: #2196f3;
  box-shadow: inset 0 0 0 2px #2196f3;
}

.sudoku-cell.initial {
  background: #f5f5f5;
  color: #333;
  font-weight: bold;
  cursor: default;
}

.sudoku-cell.initial:hover {
  background: #f5f5f5;
}

/* Thick borders for 3x3 boxes */
.sudoku-cell:nth-child(3n+3):not(:nth-child(9n)) {
  border-right: 3px solid #000;
}

.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54),
.sudoku-cell:nth-child(n+73):nth-child(-n+81) {
  border-bottom: 3px solid #000;
}

.sudoku-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}

.number-buttons {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 4px;
  max-width: 400px;
  margin: 0 auto;
}

.number-btn {
  aspect-ratio: 1;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.1s ease;
}

.number-btn:hover {
  transform: scale(1.05);
  background: #5b21b6;
}

.number-btn:active {
  transform: scale(0.95);
}

.control-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.control-buttons .input {
  min-width: 120px;
}

/* Mobile responsiveness for sudoku */
@media (max-width: 639px) {
  .sudoku-board {
    max-width: 320px;
    padding: 4px;
  }

  .sudoku-cell {
    font-size: 1rem;
  }

  .number-buttons {
    max-width: 280px;
    grid-template-columns: repeat(9, 1fr);
    gap: 2px;
  }

  .number-btn {
    font-size: 1rem;
  }

  .control-buttons {
    flex-direction: column;
    gap: 12px;
  }
}

/* Word Search Game Styles */
.word-search-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 20px 0;
  align-items: center;
}

.word-search-board {
  display: grid;
  gap: 2px;
  background: #000;
  padding: 8px;
  border-radius: 8px;
  width: 400px;
  height: 400px;
}

.word-cell {
  background: #fff;
  border: 1px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  aspect-ratio: 1;
  user-select: none;
  transition: background 0.2s ease;
}

.word-cell:hover {
  background: #f8f9fa;
}

.word-cell.selected {
  background: #e3f2fd;
  border-color: #2196f3;
}

.word-cell.found {
  background: #d4edda;
  color: #155724;
  border-color: #c3e6cb;
  animation: found-highlight 0.6s ease-out;
}

@keyframes found-highlight {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); }
  50% { transform: scale(1.1); box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.3); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

.word-cell.hint {
  background: #fff3cd;
  border-color: #ffeaa7;
  animation: hint-pulse 1s ease-in-out infinite;
}

.word-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  max-width: 500px;
  width: 100%;
}

.word-item {
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 6px;
  font-weight: bold;
  text-align: center;
  border: 1px solid #dee2e6;
}

.word-item.found {
  background: #d4edda;
  color: #155724;
  text-decoration: line-through;
  border-color: #c3e6cb;
}

.word-search-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 20px;
}

.word-search-controls .input {
  min-width: 120px;
}

/* Mobile responsiveness for word search */
@media (max-width: 768px) {
  .word-search-container {
    flex-direction: column;
    gap: 15px;
  }

  .word-search-board {
    width: 100%;
    max-width: 90vw;
    height: auto;
    padding: 4px;
    margin: 0 auto;
  }

  .word-cell {
    font-size: 0.9rem;
    min-height: 30px;
    min-width: 30px;
  }

  .word-list {
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 4px;
  }

  .word-search-controls {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
}

/* Hide scrollbars on mobile for better word selection */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  * {
    -webkit-overflow-scrolling: touch;
  }

  .word-search-board {
    overflow: hidden;
    touch-action: none;
    max-height: 60vh;
  }

  .word-cell {
    touch-action: none;
  }
}

