@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;800&family=Poppins:wght@400;500;600;700&display=swap');

:root {
  /* Curated Dark-Mode True Crime Palette */
  --bg-dark: #121216;
  --bg-gradient: radial-gradient(circle at top, #1e1e28 0%, #111115 100%);
  --surface: rgba(26, 26, 34, 0.75);
  --surface-border: rgba(255, 255, 255, 0.12);
  --surface-hover: rgba(40, 40, 54, 0.85);
  
  --primary-accent: #f84c55;
  --primary-gradient: linear-gradient(135deg, #f84c55 0%, #c42630 100%);
  --primary-glow: 0 0 20px rgba(248, 76, 85, 0.4);
  
  --gold-accent: #ffb703;
  --gold-glow: 0 0 16px rgba(255, 183, 3, 0.6);
  
  --text-main: #f3f3f6;
  --text-muted: #a0a0b2;
  
  --font-main: 'Outfit', 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-dark);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

#wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* Header */
#header {
  background: rgba(18, 18, 22, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--surface-border);
  padding: 1rem;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

#header h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #fff, #ff7a82);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 10px rgba(248, 76, 85, 0.3);
}

/* Main Area */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem 1rem;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

/* Score & Status Top Bar */
#top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 500px;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(10px);
}

.stat-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 10px;
  border-radius: 20px;
  min-width: 40px;
  text-align: center;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--surface-border);
  color: var(--text-main);
  font-size: 1.25rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.08);
}

.icon-btn:active {
  transform: scale(0.94);
}

/* Game Container & Headers */
#game-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 500px;
}

#bingo-header {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 2px;
}

.header-cell {
  background: var(--primary-gradient);
  color: #fff;
  text-align: center;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0.05em;
  padding: 10px 0;
  border-radius: 10px;
  box-shadow: var(--primary-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

/* Card Grid */
#cardHolder {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 8px;
  aspect-ratio: 1 / 1;
}

.bingo-cell {
  background: var(--surface);
  border: 1.5px solid var(--surface-border);
  border-radius: 10px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.25s var(--ease-spring);
  user-select: none;
  overflow: hidden;
  word-wrap: break-word;
  line-height: 1.25;
}

.bingo-cell:hover {
  transform: translateY(-2px);
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.3);
}

.bingo-cell:active {
  transform: scale(0.96);
}

.bingo-cell.picked {
  background: var(--primary-gradient);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: var(--primary-glow);
  font-weight: 600;
}

.bingo-cell.bingo-win {
  border-color: var(--gold-accent);
  box-shadow: var(--gold-glow);
  position: relative;
  animation: pulseGold 2s infinite alternate;
}

@keyframes pulseGold {
  0% {
    box-shadow: 0 0 10px rgba(255, 183, 3, 0.4);
  }
  100% {
    box-shadow: 0 0 22px rgba(255, 183, 3, 0.9);
  }
}

/* Controls */
.controls {
  margin-top: 1.75rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.btn {
  border: none;
  padding: 14px 32px;
  border-radius: 50px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s var(--ease-spring);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.btn.primary {
  background: linear-gradient(135deg, #ffffff 0%, #dcdce6 100%);
  color: #121216;
}

.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.25);
}

.btn.primary:active {
  transform: scale(0.96);
}

/* Celebratory Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  background: rgba(28, 28, 36, 0.95);
  border: 1px solid var(--surface-border);
  border-radius: 20px;
  padding: 2rem;
  text-align: center;
  max-width: 90%;
  width: 360px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
  transform: scale(1);
  transition: transform 0.3s var(--ease-spring);
}

.modal-overlay.hidden .modal-card {
  transform: scale(0.85);
}

.modal-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

#modal-title {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(90deg, #ffb703, #f84c55);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

#modal-message {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.modal-stats {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.75rem;
  font-weight: 700;
  color: var(--gold-accent);
  margin-bottom: 1.5rem;
}

/* Confetti Overlay */
#confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 150;
  overflow: hidden;
}

.confetti-particle {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 16px;
  opacity: 0.9;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

/* Footer */
#footer {
  background: rgba(15, 15, 18, 0.9);
  border-top: 1px solid var(--surface-border);
  color: var(--text-muted);
  text-align: center;
  padding: 1.5rem;
  margin-top: auto;
  font-size: 0.85rem;
}

#footer a {
  color: var(--text-main);
  text-decoration: none;
  border-bottom: 1px dotted rgba(255, 255, 255, 0.4);
}

/* Responsive iOS iPhone Screen Adjustments */
@media (max-width: 500px) {
  #main {
    padding: 0.75rem 0.5rem;
  }

  #top-bar {
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.75rem;
  }

  .stat-label {
    font-size: 0.68rem;
  }

  .stat-value {
    font-size: 1.05rem;
    min-width: 32px;
  }

  #game-container {
    gap: 6px;
  }

  #bingo-header {
    gap: 5px;
  }

  #cardHolder {
    gap: 5px;
    aspect-ratio: auto;
    grid-template-rows: repeat(5, minmax(68px, auto));
  }

  .header-cell {
    font-size: 1.1rem;
    padding: 6px 0;
    border-radius: 8px;
  }

  .bingo-cell {
    font-size: 0.74rem;
    padding: 4px;
    border-radius: 8px;
    line-height: 1.18;
  }
}

@media (max-width: 380px) {
  .bingo-cell {
    font-size: 0.68rem;
  }
}