/* Cop Sloop Bingo - Modern dark, lightweight, pure CSS */

:root {
  --bg: #0b0c10;
  --surface: #15171e;
  --border: #2a2d3a;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --accent: #00e5ff;       /* cyan neon */
  --accent-dim: #00b8d4;
  --danger: #ff3d71;       /* hot pink/red for marks */
  --success: #00e676;
  --gold: #ffd600;
  --free-bg: #1a237e;
  --marked-bg: #b71c1c;
  --radius: 10px;
  --shadow: 0 8px 32px rgba(0,0,0,0.45);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.4;
  overflow-x: hidden;
}

body {
  display: flex;
  justify-content: center;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 229, 255, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(255, 61, 113, 0.08), transparent);
}

.app {
  width: 100%;
  max-width: 720px;
  padding: 1.25rem 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Header */
header {
  text-align: center;
  padding: 0.5rem 0 0.25rem;
}

h1 {
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, var(--accent), #fff 40%, var(--danger));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(0, 229, 255, 0.3);
  margin-bottom: 0.15rem;
}

.tagline {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

a {
  color: var(--accent);
}
/* Controls */
.controls {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s;
  font-family: inherit;
  letter-spacing: 0.02em;
}

.btn:active {
  transform: scale(0.97);
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #000;
  box-shadow: 0 4px 20px rgba(0, 229, 255, 0.35);
}

.btn.primary:hover {
  box-shadow: 0 6px 28px rgba(0, 229, 255, 0.5);
  transform: translateY(-1px);
}

.btn.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn.small {
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
}

.btn.large {
  padding: 0.9rem 2rem;
  font-size: 1.1rem;
}

/* How to */
.how-to {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  font-size: 0.95rem;
  box-shadow: var(--shadow);
}

.how-to.hidden {
  display: none;
}

.how-to h3 {
  margin-bottom: 0.75rem;
  color: var(--accent);
  font-size: 1.1rem;
}

.how-to ol {
  margin: 0 0 0.75rem 1.2rem;
  color: var(--text);
}

.how-to li {
  margin-bottom: 0.35rem;
}

.how-to .tip {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  font-style: italic;
}

/* Bingo Board */
.bingo-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  background: var(--surface);
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  user-select: none;
}

.cell {
  aspect-ratio: 1;
  background: #1c1f2a;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px 4px;
  font-size: clamp(0.58rem, 2.1vw, 0.78rem);
  font-weight: 600;
  line-height: 1.15;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.12s, box-shadow 0.18s;
  position: relative;
  overflow: hidden;
  color: var(--text);
  word-break: break-word;
  hyphens: auto;
}

.cell:hover:not(.free):not(.marked) {
  border-color: var(--accent);
  background: #22253a;
  transform: scale(1.03);
  z-index: 1;
}

.cell:active:not(.free) {
  transform: scale(0.96);
}

/* FREE center */
.cell.free {
  background: linear-gradient(145deg, #1a237e, #283593);
  border-color: #3f51b5;
  color: var(--gold);
  font-weight: 800;
  font-size: clamp(0.75rem, 2.4vw, 0.95rem);
  letter-spacing: 0.05em;
  cursor: default;
}

.cell.free::after {
  content: "★";
  position: absolute;
  font-size: 1.6em;
  opacity: 0.15;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Marked */
.cell.marked {
  background: linear-gradient(145deg, #b71c1c, #c62828);
  border-color: #ef5350;
  color: #fff;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.15), 0 0 12px rgba(255, 61, 113, 0.4);
}

.cell.marked::before {
  content: "✕";
  position: absolute;
  font-size: 2.4em;
  font-weight: 900;
  color: rgba(255,255,255,0.22);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
}

.cell.marked span {
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Header row labels B I N G O */
.bingo-headers {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 6px;
  padding: 0 10px;
}

.bingo-headers span {
  text-align: center;
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.4);
}

/* Footer */
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  padding-top: 0.5rem;
  opacity: 0.8;
}

/* Overlay + Confetti */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(6px);
  animation: fadeIn 0.3s ease;
}

.overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.bingo-message {
  text-align: center;
  z-index: 2;
  padding: 2rem;
}

.bingo-text {
  font-size: clamp(4rem, 18vw, 8rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  background: linear-gradient(90deg, var(--gold), #fff, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 60px rgba(255, 214, 0, 0.5);
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  line-height: 1;
  margin-bottom: 0.5rem;
}

@keyframes popIn {
  0% { transform: scale(0.3); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.bingo-sub {
  font-size: 1.25rem;
  color: var(--muted);
  margin-bottom: 1.75rem;
  font-weight: 500;
}

/* Confetti particles (pure CSS) */
.confetti-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -20px;
  opacity: 0.9;
  animation: fall linear forwards;
}

@keyframes fall {
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

/* Responsive tweaks */
@media (max-width: 480px) {
  .app {
    padding: 1rem 0.6rem 1.5rem;
  }
  .cell {
    font-size: 0.55rem;
    padding: 4px 2px;
  }
  .bingo-board {
    gap: 4px;
    padding: 6px;
  }
  h1 {
    font-size: 1.7rem;
  }
}

/* Disable interaction after win until new card */
.bingo-board.won .cell:not(.free) {
  pointer-events: none;
  opacity: 0.85;
}
