:root {
  /* Default Theme: Dark with neon accents */
  --bg-color: #0f172a; 
  --text-color: #f8fafc; 
  --grid-bg: #1e293b; 
  --grid-border: #334155; 
  --accent-color: #8b5cf6; 
  --accent-hover: #7c3aed; 
  --win-color: #ef4444; 
  --marked-bg: #3b82f6; 
  --marked-text: #ffffff;
  --disabled-text: #64748b; 
  --shadow-color: rgba(0, 0, 0, 0.5);
  --glass-bg: rgba(30, 41, 59, 0.7);
  --font-family: 'Outfit', sans-serif;
  --letter-inactive: #475569;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
  padding: 2rem 0;
}

.game-container {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 2rem;
  padding: 2.5rem;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 20px;
  box-shadow: 0 10px 40px var(--shadow-color);
  max-width: 95vw;
}

.bingo-header {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  width: 100%;
  padding: 0;
  margin-bottom: 0.5rem;
}

.bingo-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 900;
  color: var(--letter-inactive);
  background-color: var(--grid-bg);
  border: 2px solid var(--grid-border);
  border-radius: 12px;
  aspect-ratio: 1; 
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  user-select: none;
}

.bingo-letter.active {
  color: var(--win-color);
  background-color: rgba(239, 68, 68, 0.1); 
  border-color: var(--win-color);
  text-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

.game-container.playing .bingo-letter {
  font-size: 4rem;
}

.board-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 0.5rem;
  width: 450px;
  height: 450px;
}

.grid-cell {
  background-color: var(--grid-bg);
  border: 2px solid var(--grid-border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.grid-cell input {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--text-color);
  text-align: center;
  font-size: 2rem;
  font-family: inherit;
  font-weight: 800;
  outline: none;
  cursor: grab;
}

.grid-cell input:focus {
  background: rgba(139, 92, 246, 0.1); 
  border-radius: 8px; /* Inner focus styling */
}

.grid-cell.drag-over {
  border-color: var(--accent-color);
  background-color: rgba(139, 92, 246, 0.2);
  transform: scale(1.05);
}

.grid-cell.marked {
  background-color: var(--marked-bg);
  border-color: var(--marked-bg);
  box-shadow: inset 0 0 15px rgba(255,255,255,0.2), 0 0 10px var(--marked-bg);
  transform: scale(0.95);
}

.grid-cell.marked input {
  color: var(--marked-text);
  pointer-events: none; 
}

.grid-cell.disabled {
  opacity: 0.4;
  filter: grayscale(1);
  pointer-events: none;
}
.grid-cell.disabled input {
  color: var(--disabled-text);
}

.controls {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn.primary {
  background-color: var(--accent-color);
  color: #fff;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}
.btn.primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.btn.secondary {
  background-color: transparent;
  border: 2px solid var(--accent-color);
  color: var(--text-color);
}
.btn.secondary:hover {
  background-color: var(--accent-color);
  color: #fff;
  transform: translateY(-2px);
}

.btn.outline {
  background-color: transparent;
  border: 2px solid var(--win-color);
  color: var(--win-color);
}
.btn.outline:hover {
  background-color: var(--win-color);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.btn:active {
  transform: translateY(0);
}

.hidden {
  display: none !important;
}

/* Sidebar Numbers Checklist */
.sidebar {
  width: 330px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 0;
  background: transparent;
  transition: opacity 0.3s ease;
  text-align: center;
}

.game-container.playing .sidebar {
  display: none;
}

.game-container.playing .grid {
  width: 600px;
  height: 600px;
}

.game-container.playing .grid-cell input {
  font-size: 3rem;
}

.sidebar h2 {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text-color);
}
.sidebar .subtitle {
  font-size: 0.95rem;
  color: var(--disabled-text);
  margin-top: -1rem;
}

.numbers-checklist {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  column-gap: 0.75rem;
  row-gap: 0.35rem;
  flex: 1;
}

.checklist-item {
  background-color: var(--grid-bg);
  border: 2px solid var(--grid-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.5rem;
  cursor: grab;
  user-select: none;
  transition: all 0.2s;
  aspect-ratio: 1;
  color: var(--text-color);
}

.checklist-item:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  transform: translateY(-2px);
}

.checklist-item:active {
  cursor: grabbing;
}

.checklist-item.used {
  opacity: 0.3;
  pointer-events: none;
  background-color: transparent;
  border-style: dashed;
  transform: scale(0.9);
}

/* Input styles reset */
input[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}
input[type='number']::-webkit-inner-spin-button, 
input[type='number']::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  appearance: none;
  margin: 0; 
}

/* Animations */
@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}
.anim-pop {
  animation: pop 0.3s ease;
}

@keyframes drop {
  0% { transform: translateY(-50px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
.game-container {
  animation: drop 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile Responsive Adjustments */
@media (max-width: 800px) {
  .game-container {
    flex-direction: column;
    padding: 1.5rem;
    gap: 1.5rem;
    align-items: center;
    max-width: 100vw;
  }

  .board-column {
    width: 100%;
    max-width: 450px; /* Constrain grid bounds */
  }

  .grid {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
  }

  .game-container.playing .grid {
    width: 100%;
    height: auto;
    max-width: 500px;
  }

  .grid-cell input {
    font-size: clamp(1.2rem, 5vw, 2rem);
  }

  .game-container.playing .grid-cell input {
    font-size: clamp(1.5rem, 8vw, 3rem);
  }

  .bingo-letter {
    font-size: clamp(1.5rem, 8vw, 2.5rem);
  }

  .game-container.playing .bingo-letter {
    font-size: clamp(2rem, 10vw, 3.5rem);
  }

  .sidebar {
    width: 100%;
    max-width: 450px;
  }

  .checklist-item {
    font-size: clamp(1.1rem, 5vw, 1.5rem);
  }
}
