/* ─── Custom Properties ──────────────────────────────────────────────────── */
:root {
  --green-deepest: #091f14;
  --green-dark:    #0d2b1e;
  --green-primary: #006747;
  --green-mid:     #1a5c3a;
  --gold:          #c9a84c;
  --gold-light:    #e8d48a;
  --gold-pale:     #f5edc8;
  --cream:         #faf7f0;
  --cream-mid:     #f0ebe0;
  --text-dark:     #1c1c1c;
  --text-mid:      #4a4540;
  --text-light:    #f5f0e8;
  --border-card:   #c9a84c;
  --border-grid:   #ddd7c8;
  --card-max:      580px;
  --radius:        3px;
}

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

/* ─── Base ───────────────────────────────────────────────────────────────── */
html { font-size: 16px; }

body {
  font-family: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
  background: var(--green-deepest);
  color: var(--text-dark);
  min-height: 100vh;
}

/* ─── Page Wrapper ───────────────────────────────────────────────────────── */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */
.site-header {
  width: 100%;
  background: linear-gradient(170deg, var(--green-dark) 0%, var(--green-mid) 100%);
  border-bottom: 1px solid rgba(201,168,76,0.5);
  text-align: center;
  padding: 2.25rem 1rem 2rem;
  position: relative;
}

.site-header::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: var(--gold);
}

.header-flourish {
  color: var(--gold);
  font-size: 0.7rem;
  letter-spacing: 0.6em;
  opacity: 0.6;
  margin-bottom: 0.75rem;
}

.site-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 3rem);
  color: var(--text-light);
  line-height: 1.05;
  letter-spacing: 0.02em;
}

.title-bingo {
  color: var(--gold);
  font-size: clamp(2.6rem, 8vw, 4rem);
  letter-spacing: 0.12em;
}

.site-subtitle {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--gold-light);
  margin-top: 0.6rem;
  letter-spacing: 0.06em;
  opacity: 0.85;
}

/* ─── Main ───────────────────────────────────────────────────────────────── */
.main-content {
  width: 100%;
  max-width: var(--card-max);
  padding: 1.75rem 1rem 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

/* ─── Card Meta ──────────────────────────────────────────────────────────── */
.card-meta {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-id-label {
  font-size: 0.72rem;
  color: var(--gold-light);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.7;
}

.meta-buttons {
  display: flex;
  gap: 0.5rem;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.5rem 1.1rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
}

.btn-gold {
  background: var(--gold);
  color: var(--green-deepest);
}
.btn-gold:hover { background: var(--gold-light); }

.btn-ghost {
  background: transparent;
  color: var(--text-light);
  border: 1px solid rgba(255,255,255,0.2);
}
.btn-ghost:hover {
  border-color: var(--gold);
  color: var(--gold-light);
}

.btn-outline {
  background: transparent;
  color: var(--gold-light);
  border: 1px solid rgba(201,168,76,0.5);
}
.btn-outline:hover {
  border-color: var(--gold);
  background: rgba(201,168,76,0.08);
}

.btn-sm {
  font-size: 0.72rem;
  padding: 0.4rem 0.85rem;
}

/* ─── Card Actions ───────────────────────────────────────────────────────── */
.card-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

/* ─── Bingo Card ─────────────────────────────────────────────────────────── */
.bingo-card {
  width: 100%;
  background: var(--cream);
  border: 2px solid var(--border-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(201,168,76,0.2),
    0 12px 50px rgba(0,0,0,0.5),
    0 4px 16px rgba(0,0,0,0.3);
}

/* B I N G O header */
.card-header {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--green-primary);
  border-bottom: 2px solid var(--gold);
}

.card-header span {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: clamp(1.4rem, 4vw, 2rem);
  color: var(--gold);
  text-align: center;
  padding: 0.55rem 0;
  letter-spacing: 0.04em;
  border-right: 1px solid rgba(201,168,76,0.2);
}
.card-header span:last-child { border-right: none; }

/* ─── Card Grid ──────────────────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
}

/* ─── Individual Square ──────────────────────────────────────────────────── */
.bingo-square {
  position: relative;
  min-height: 88px;
  padding: 0.45rem 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  border-right: 1px solid var(--border-grid);
  border-bottom: 1px solid var(--border-grid);
  background: var(--cream);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.1s;
}

.bingo-square:nth-child(5n)   { border-right: none; }
.bingo-square:nth-last-child(-n+5) { border-bottom: none; }

.bingo-square:hover:not(.daubed):not(.free-square) {
  background: var(--gold-pale);
}

.square-text {
  position: relative;
  z-index: 1;
  font-size: clamp(0.58rem, 1.5vw, 0.7rem);
  line-height: 1.35;
  color: var(--text-dark);
  font-weight: 400;
  pointer-events: none;
}

/* ─── Daubed State ───────────────────────────────────────────────────────── */
.bingo-square.daubed .square-text { color: var(--text-light); }

.bingo-square.daubed::before {
  content: '';
  position: absolute;
  inset: 7px;
  background: var(--green-primary);
  border-radius: 50%;
  z-index: 0;
  animation: stamp-in 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes stamp-in {
  from { transform: scale(0.2); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ─── Winner Highlight ───────────────────────────────────────────────────── */
.bingo-square.winner .square-text { color: var(--green-deepest); }

.bingo-square.winner::before {
  background: var(--gold) !important;
  animation: none;
}

/* ─── FREE Square ────────────────────────────────────────────────────────── */
.bingo-square.free-square {
  background: var(--green-primary);
  cursor: default;
}

.bingo-square.free-square:hover { background: var(--green-primary); }

.free-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  z-index: 1;
  position: relative;
}

.free-icon {
  width: 22px;
  height: 26px;
  color: var(--gold);
  display: block;
}

.free-label {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--gold);
  text-transform: uppercase;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
  margin-top: auto;
  padding: 1.25rem 1rem 1.75rem;
  text-align: center;
}

.site-footer p {
  font-size: 0.72rem;
  color: rgba(245,240,232,0.35);
  letter-spacing: 0.04em;
}

/* ─── Bingo Overlay ──────────────────────────────────────────────────────── */
.bingo-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 31, 20, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.bingo-overlay.hidden { display: none; }

.bingo-modal {
  background: var(--cream);
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: 2.75rem 4rem;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}

.bingo-word {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 5.5rem;
  color: var(--green-primary);
  letter-spacing: 0.1em;
  line-height: 1;
  animation: bingo-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.bingo-sub {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  color: var(--text-mid);
  font-size: 1.05rem;
  margin: 0.6rem 0 1.5rem;
}

@keyframes bingo-pop {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ─── Toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--green-mid);
  color: var(--text-light);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 0.55rem 1.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  box-shadow: 0 6px 24px rgba(0,0,0,0.35);
  z-index: 200;
  animation: toast-rise 0.2s ease forwards;
}

.toast.hidden { display: none; }

@keyframes toast-rise {
  from { transform: translateX(-50%) translateY(8px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);   opacity: 1; }
}

/* ─── Print ──────────────────────────────────────────────────────────────── */
@media print {
  @page {
    size: letter portrait;
    margin: 0.4in;
  }

  body { background: white; }

  .page-wrapper { min-height: 0; background: white; }

  .site-header,
  .card-meta,
  .card-actions,
  .site-footer,
  .bingo-overlay,
  .toast { display: none !important; }

  .main-content {
    padding: 0;
    max-width: 100%;
    gap: 0;
  }

  .bingo-card {
    width: 100%;
    border: 2px solid #000;
    box-shadow: none;
  }

  .card-header {
    background: #006747 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .card-header span {
    color: #c9a84c !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .bingo-square {
    min-height: 1.1in;
    border-color: #ccc;
  }

  .bingo-square.daubed::before {
    background: #006747 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .bingo-square.free-square {
    background: #006747 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .free-icon,
  .free-label {
    color: #c9a84c !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .bingo-square { min-height: 68px; }
  .bingo-modal  { padding: 2rem 2rem; }
  .bingo-word   { font-size: 4rem; }
}
