/* ================================================
   CTRL-ALT-SPEECH BINGO - REFINED EDITION
   ================================================ */

:root {
  /* Brand Colors */
  --color-primary: #5cb998;
  --color-primary-dark: #49a385;
  --color-primary-light: #e8f5f0;

  /* Neutrals */
  --color-white: #ffffff;
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2937;
  --color-gray-900: #111827;

  /* Free Square - darker teal for contrast */
  --color-free: #3d8b74;
  --color-free-light: #d1e8e0;

  /* Typography */
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;

  /* Sizing */
  --cell-size: 120px;
  --grid-gap: 1px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Base */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: linear-gradient(180deg, var(--color-gray-50) 0%, var(--color-white) 100%);
  color: var(--color-gray-700);
  min-height: 100vh;
  line-height: 1.5;
}

/* Container */
.container {
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  padding: 2.5rem 1rem 3rem;
}

@media (min-width: 768px) {
  .container {
    max-width: 620px;
    padding: 3rem 1.5rem;
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: 680px;
    padding: 3.5rem 2rem;
  }
}

/* Header */
.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
  text-align: center;
}

.logo {
  height: 56px;
  width: auto;
}

.title-block {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-gray-900);
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Bingo Card */
.bingo-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  margin-bottom: 2rem;
  width: 100%;
}

/* BINGO Header Row */
.bingo-header {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--color-primary);
}

.bingo-header span {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0.5rem;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--color-white);
  letter-spacing: 0.05em;
}

/* Bingo Grid */
.bingo-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--grid-gap);
  background: var(--color-gray-200);
  padding: var(--grid-gap);
  width: 100%;
}

/* Bingo Cell */
.bingo-cell {
  aspect-ratio: 1;
  min-width: 0;
  background: var(--color-white);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--color-gray-700);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
  overflow: hidden;
  word-break: break-word;
}

.bingo-cell:hover:not(.marked):not(.free-square) {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.bingo-cell:active:not(.free-square) {
  transform: scale(0.97);
}

/* Marked State */
.bingo-cell.marked {
  background: var(--color-primary);
  color: var(--color-white);
  font-weight: 600;
}

.bingo-cell.marked::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
  pointer-events: none;
}

/* Free Square */
.bingo-cell.free-square {
  background: var(--color-free);
  color: var(--color-white);
  font-weight: 600;
  cursor: default;
  flex-direction: column;
  gap: 0.25rem;
}

.bingo-cell.free-square::before {
  content: 'FREE';
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  opacity: 0.85;
}

.bingo-cell.free-square .cell-text {
  font-size: 0.75rem;
}

/* Winning Line Highlight */
.bingo-cell.winning {
  animation: pulse-win 0.6s ease-in-out infinite alternate;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.5);
}

@keyframes pulse-win {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.03);
  }
}

/* Celebration Overlay */
.celebration {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
}

.celebration-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: var(--color-primary);
  color: white;
  padding: 1.5rem 3rem;
  border-radius: var(--radius-lg);
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: pop-in 0.5s ease forwards;
  z-index: 1001;
}

@keyframes pop-in {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  opacity: 0;
}

/* Controls */
.controls {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.btn {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-icon {
  width: 18px;
  height: 18px;
  stroke-width: 2.5;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-white);
  box-shadow: var(--shadow-md), 0 0 0 0 rgba(92, 185, 152, 0.4);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  box-shadow: var(--shadow-lg), 0 0 0 4px rgba(92, 185, 152, 0.15);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background: var(--color-white);
  color: var(--color-gray-700);
  box-shadow: var(--shadow-md), inset 0 0 0 1px var(--color-gray-200);
}

.btn-secondary:hover {
  background: var(--color-gray-50);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--color-gray-300);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--color-gray-200);
}

/* Sponsor Section */
.sponsor {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  padding: 0.875rem 1rem;
  margin-bottom: 1.5rem;
  background: var(--color-gray-50);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-md);
}

.sponsor-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-gray-400);
}

.sponsor-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--color-gray-700);
  transition: color 0.2s ease;
}

.sponsor-link:hover {
  color: var(--color-primary-dark);
}

.sponsor-link img {
  max-height: 32px;
  width: auto;
}

.sponsor-name {
  font-size: 1rem;
  font-weight: 600;
}

/* Footer */
.footer {
  text-align: center;
}

.footer p {
  font-size: 0.875rem;
  color: var(--color-gray-400);
}

/* Responsive Design */
@media (max-width: 680px) {
  .container {
    padding: 1.5rem 1rem 2rem;
  }

  .header {
    margin-bottom: 1.5rem;
  }

  .logo {
    height: 48px;
  }

  .title {
    font-size: 1.625rem;
  }

  .bingo-header span {
    font-size: 1.25rem;
    padding: 0.75rem;
  }

  .bingo-cell {
    font-size: 0.6875rem;
    padding: 0.5rem;
  }

  .bingo-cell.free-square::before {
    font-size: 0.5rem;
  }

  .bingo-cell.free-square .cell-text {
    font-size: 0.625rem;
  }
}

@media (max-width: 400px) {
  .container {
    padding: 1rem 0.5rem 1.5rem;
  }

  .bingo-cell {
    font-size: 0.5625rem;
    padding: 0.375rem;
    line-height: 1.25;
  }

  .btn {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
  }

  .controls {
    gap: 0.5rem;
  }
}

/* Print Styles */
@media print {
  .controls,
  .footer {
    display: none !important;
  }

  .sponsor {
    background: none;
    border: none;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
  }

  body {
    background: white;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }

  .header {
    margin-bottom: 1rem;
  }

  .logo {
    height: 40px;
  }

  .bingo-card {
    box-shadow: none;
    border: 2px solid var(--color-gray-300);
  }

  .bingo-header {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .bingo-cell {
    font-size: 9pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .bingo-cell.marked {
    background: var(--color-primary) !important;
    color: white !important;
  }

  .bingo-cell.free-square {
    background: var(--color-free) !important;
    color: white !important;
  }

  @page {
    margin: 0.5in;
  }
}
