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

/*
  Background: dark trans pride flag (blue / pink / neutral / pink / blue)
  Card letters & title: rainbow pride (red → orange → yellow → green → violet)
  Daub: hot pink
  CALL BINGO: animated rainbow
*/

body {
  background:
    radial-gradient(ellipse 170% 140% at -5% -5%,  #0055e8 0%, transparent 62%),
    radial-gradient(ellipse 140% 120% at 110% 18%, #e0005a 0%, transparent 62%),
    #04000e;
  min-height: 100vh;
  font-family: 'Nunito', 'Segoe UI', sans-serif;
  color: #fff;
  overflow-x: hidden;
}

/* ── Toast notifications ──────────────────────────────────────── */
#toasts {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  width: min(480px, 95vw);
}

.toast {
  padding: 14px 22px;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  transform: translateY(-20px) scale(0.95);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: auto;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.toast.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.toast-info { background: rgba(12, 74, 110, 0.95); color: #fff; }
.toast-winner { background: rgba(233, 30, 140, 0.95); color: #fff; font-size: 1.2rem; }
.toast-you-win { background: rgba(0, 128, 38, 0.97); color: #fff; font-size: 1.3rem; }
.toast-number {
  background: linear-gradient(135deg, rgba(228,3,3,0.85), rgba(117,7,135,0.85));
  color: #fff;
}
.toast-error { background: rgba(153, 27, 27, 0.95); color: #fff; }

.corner-badge {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.7);
  padding: 4px 0 0;
}

/* ── Header ───────────────────────────────────────────────────── */
.app-header {
  padding: 16px 24px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(6px);
}

.title-block {
  display: flex;
  gap: 4px;
}

.title-letter {
  font-family: 'Fredoka One', cursive;
  font-size: 3rem;
  line-height: 1;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 2px 6px rgba(0,0,0,0.35);
  box-shadow: 0 3px 12px rgba(0,0,0,0.3);
  color: white;
}
/* Rainbow: red, orange, yellow (dark text), green, violet */
.tl-B { background: #E40303; }
.tl-I { background: #FF8C00; }
.tl-N { background: #FFED00; color: #222; text-shadow: none; }
.tl-G { background: #008026; }
.tl-O { background: #750787; }

.header-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.name-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.name-group label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.55);
}
#nameInput {
  padding: 8px 14px;
  font-size: 0.95rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
  color: white;
  outline: none;
  transition: border-color 0.2s;
  width: 200px;
}
#nameInput:focus { border-color: #F7A8B8; }
#nameInput::placeholder { color: rgba(255,255,255,0.35); }

.btn-popout {
  padding: 9px 16px;
  font-size: 0.9rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  background: rgba(255,255,255,0.12);
  color: white;
  border: 1.5px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}
.btn-popout:hover { background: rgba(255,255,255,0.22); transform: translateY(-1px); }
.btn-popout:active { transform: translateY(0); }

.conn-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239,68,68,0.5);
  transition: background 0.3s, box-shadow 0.3s;
  flex-shrink: 0;
}
.conn-indicator.connected {
  background: #55CDFC;
  box-shadow: 0 0 8px rgba(85,205,252,0.6);
}

/* ── Main layout ──────────────────────────────────────────────── */
.game-layout {
  display: grid;
  grid-template-columns: 270px 1fr 280px;
  grid-template-areas: "left card right";
  gap: 20px;
  padding: 20px 24px;
  max-width: 1440px;
  margin: 0 auto;
}

/* Medium: left sidebar drops below */
@media (max-width: 1120px) {
  .game-layout {
    grid-template-columns: 1fr 280px;
    grid-template-areas:
      "card  right"
      "left  left";
  }
  .left-sidebar {
    flex-direction: row !important;
    flex-wrap: wrap;
  }
  .left-box {
    flex: 1 1 300px;
  }
  .newsreel-viewport { height: 260px !important; }
  .donate-viewport   { height: 200px !important; }
}

/* ── Left sidebar ─────────────────────────────────────────────── */
.left-sidebar {
  grid-area: left;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.left-box { padding: 14px; }

/* Newsreel */
.newsreel-viewport {
  height: 420px;
  overflow: hidden;
  position: relative;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
  mask-image:         linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
}

@keyframes scroll-news {
  from { transform: translateY(0); }
  to   { transform: translateY(-50%); }
}

.newsreel-track {
  animation: scroll-news 40s linear infinite;
}

.newsreel-viewport:hover .newsreel-track {
  animation-play-state: paused;
}

.news-card {
  display: flex;
  gap: 10px;
  padding: 11px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  margin-bottom: 8px;
  transition: background 0.2s;
}

.news-card:hover { background: rgba(255,255,255,0.13); }

.news-thumb {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

.news-body { flex: 1; min-width: 0; }

.news-title {
  display: block;
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  line-height: 1.3;
  margin-bottom: 5px;
}

.news-title:hover { color: #F7A8B8; text-decoration: underline; }

.news-blurb {
  font-size: 0.76rem;
  color: rgba(255,255,255,0.62);
  line-height: 1.45;
}

/* Donation scroller */
.donate-viewport {
  height: 190px;
  overflow: hidden;
  position: relative;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 12%, black 88%, transparent 100%);
  mask-image:         linear-gradient(to bottom, transparent 0%, black 12%, black 88%, transparent 100%);
}

@keyframes scroll-donate {
  from { transform: translateY(0); }
  to   { transform: translateY(-50%); }
}

.donate-track {
  animation: scroll-donate 14s linear infinite;
}

.donate-viewport:hover .donate-track {
  animation-play-state: paused;
}

.donate-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.07);
  text-decoration: none;
  color: white;
  margin-bottom: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  transition: background 0.2s, transform 0.15s;
}

.donate-card:hover {
  background: rgba(255,255,255,0.18);
  transform: translateX(4px);
  border-color: rgba(247,168,184,0.4);
}

.donate-icon { font-size: 1.7rem; flex-shrink: 0; }

.donate-body { flex: 1; min-width: 0; }

.donate-name {
  font-weight: 800;
  font-size: 0.88rem;
  line-height: 1.2;
}

.donate-desc {
  font-size: 0.74rem;
  color: rgba(255,255,255,0.58);
  margin-top: 2px;
  line-height: 1.3;
}

.donate-arrow {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.4);
  flex-shrink: 0;
  transition: color 0.2s;
}
.donate-card:hover .donate-arrow { color: #F7A8B8; }

/* ── Card section ─────────────────────────────────────────────── */
.card-section {
  grid-area: card;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.bingo-card {
  width: 100%;
  max-width: 500px;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 0 0 4px rgba(255,255,255,0.1),
    0 8px 40px rgba(0,0,0,0.5),
    0 0 80px rgba(233,30,140,0.2);
}

.card-header {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.card-letter {
  padding: 18px 0;
  text-align: center;
  font-family: 'Fredoka One', cursive;
  font-size: 2.6rem;
  color: white;
  text-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
/* Rainbow column headers */
.letter-B { background: #E40303; }
.letter-I { background: #FF8C00; }
.letter-N { background: #FFED00; color: #222; text-shadow: none; }
.letter-G { background: #008026; }
.letter-O { background: #750787; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  background: #d4d4d4;
  padding: 3px;
}

.card-cell {
  background: #fff;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, transform 0.1s;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.card-cell:hover:not(.free) {
  background: #fff0f6;
  transform: scale(0.95);
}
.card-cell:active:not(.free) {
  transform: scale(0.9);
}

/* Called but not yet daubed — subtle yellow hint */
.card-cell.called:not(.checked) {
  background: #fffbeb;
}
.card-cell.called:not(.checked) .cell-num {
  color: #b45309;
}

/* Lipstick kiss mark */
.card-cell.checked:not(.free)::before {
  content: '💋';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 2.4rem;
  transform: rotate(-10deg);
  z-index: 2;
  animation: kiss-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes kiss-pop {
  from { transform: rotate(-10deg) scale(0.2); opacity: 0; }
  to   { transform: rotate(-10deg) scale(1);   opacity: 1; }
}

.card-cell.checked:not(.free) .cell-num {
  opacity: 0.15;
  color: #222;
}

/* FREE square — trans pride daub */
.card-cell.free {
  background: #f0f4ff;
  cursor: default;
}
.card-cell.free::before {
  content: '';
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, #55CDFC 0%, #F7A8B8 40%, #ffffff 55%, #F7A8B8 70%, #55CDFC 100%);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
  z-index: 1;
}
.card-cell.free .cell-num {
  position: relative;
  z-index: 2;
  color: #333;
  font-size: 0.85rem !important;
  font-weight: 900;
  font-family: 'Nunito', sans-serif !important;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 2px rgba(255,255,255,0.7);
}

/* Winning cell highlight */
.card-cell.winning::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  border: 3px solid #ffd700;
  box-shadow: inset 0 0 12px rgba(255,215,0,0.4);
  z-index: 3;
  pointer-events: none;
}

.cell-num {
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  color: #222;
  line-height: 1;
}

/* ── CALL BINGO button ────────────────────────────────────────── */
.call-bingo-btn {
  width: 100%;
  max-width: 500px;
  padding: 22px 0;
  font-family: 'Fredoka One', cursive;
  font-size: 2.4rem;
  letter-spacing: 3px;
  color: white;
  text-shadow: 0 2px 6px rgba(0,0,0,0.35);
  background: linear-gradient(135deg,
    #E40303 0%,
    #FF8C00 25%,
    #FFED00 50%,
    #008026 75%,
    #750787 100%
  );
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3), 0 2px 0 rgba(0,0,0,0.2);
  position: relative;
  overflow: hidden;
}

.call-bingo-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.4), 0 2px 0 rgba(0,0,0,0.2);
}
.call-bingo-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Rainbow shift + scale pulse when bingo is possible */
@keyframes rainbow-shift {
  0%   { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}
@keyframes bingo-scale {
  0%   { transform: scale(1);    box-shadow: 0 4px 20px rgba(0,0,0,0.3); }
  100% { transform: scale(1.04); box-shadow: 0 10px 50px rgba(233,30,140,0.6), 0 0 80px rgba(228,3,3,0.3); }
}

.call-bingo-btn.has-bingo {
  background: linear-gradient(135deg,
    #E40303, #FF8C00, #FFED00, #008026, #004DFF, #750787, #E40303
  );
  background-size: 400% 100%;
  animation: rainbow-shift 1.2s linear infinite, bingo-scale 0.65s ease-in-out infinite alternate;
}

@keyframes invalid-flash {
  0%, 100% { background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%); }
  50%       { background: linear-gradient(135deg, #ff7070 0%, #ef4444 100%); }
}
.call-bingo-btn.invalid {
  animation: invalid-flash 0.25s ease-in-out 5;
  color: white;
}

/* ── Right sidebar ────────────────────────────────────────────── */
.sidebar {
  grid-area: right;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar-box {
  background: rgba(4, 0, 14, 0.28);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  padding: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.sidebar-title {
  font-family: 'Fredoka One', cursive;
  font-size: 1.15rem;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.9);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

/* Called numbers columns */
.called-columns {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.called-col { display: flex; flex-direction: column; gap: 3px; }

.called-col-hdr {
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  text-align: center;
  padding: 4px 2px;
  border-radius: 6px;
  color: white;
  margin-bottom: 2px;
}
/* Rainbow column headers in sidebar */
.hdr-B { background: #E40303; }
.hdr-I { background: #FF8C00; }
.hdr-N { background: #FFED00; color: #222; }
.hdr-G { background: #008026; }
.hdr-O { background: #750787; }

.called-nums { display: flex; flex-direction: column; gap: 2px; }

.num-chip {
  font-family: 'Fredoka One', cursive;
  font-size: 0.85rem;
  text-align: center;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 2px 0;
  color: rgba(255,255,255,0.85);
}

@keyframes chip-pop {
  0%   { transform: scale(1.4); background: rgba(233,30,140,0.6); color: white; }
  100% { transform: scale(1);   background: rgba(255,255,255,0.1); }
}
.num-chip.new-chip {
  animation: chip-pop 0.6s ease-out forwards;
  color: white;
}

/* Winners */
.winners-list {
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.winners-list em { color: rgba(255,255,255,0.4); font-style: italic; }
.winner-name {
  padding: 4px 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 6px;
  font-weight: 700;
}
.winner-name small { opacity: 0.6; font-size: 0.8em; }

/* ── Tip the Queens ──────────────────────────────────────────── */
.tip-box {
  background: linear-gradient(135deg,
    rgba(124, 26, 74, 0.5) 0%,
    rgba(12, 74, 110, 0.5) 100%
  );
  border-color: rgba(247,168,184,0.3);
}

.tip-title {
  background: linear-gradient(90deg, #F7A8B8, #55CDFC, #F7A8B8);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer-title 4s linear infinite;
  border-bottom-color: rgba(247,168,184,0.2);
}

@keyframes shimmer-title {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.venmo-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.venmo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  text-decoration: none;
  color: white;
  font-weight: 800;
  font-size: 1rem;
  transition: background 0.2s, transform 0.15s;
}

.venmo-link:hover {
  background: rgba(255,255,255,0.18);
  transform: translateX(3px);
  border-color: rgba(247,168,184,0.4);
}

.venmo-icon { font-size: 1.4rem; flex-shrink: 0; }

.venmo-handle {
  color: #55CDFC;
  font-weight: 900;
}

/* ── Win celebration overlay ──────────────────────────────────── */
#winOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 500;
  align-items: center;
  justify-content: center;
}
#winOverlay.show { display: flex; }

.win-box {
  background: linear-gradient(135deg,
    #55CDFC 0%, #F7A8B8 35%, #ffffff 50%, #F7A8B8 65%, #55CDFC 100%
  );
  border-radius: 24px;
  padding: 48px 56px;
  text-align: center;
  box-shadow: 0 0 100px rgba(85,205,252,0.5), 0 0 60px rgba(247,168,184,0.4);
}
.win-box h1 {
  font-family: 'Fredoka One', cursive;
  font-size: 5rem;
  background: linear-gradient(135deg, #E40303, #FF8C00, #008026, #750787);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}
.win-box p {
  font-size: 1.5rem;
  margin-top: 12px;
  font-weight: 700;
  color: #333;
}
.win-box button {
  margin-top: 24px;
  padding: 12px 32px;
  font-size: 1rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  background: rgba(0,0,0,0.15);
  color: #333;
  cursor: pointer;
}
.win-box button:hover { background: rgba(0,0,0,0.25); }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 700px) {
  .game-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "card"
      "right"
      "left";
    padding: 12px;
  }
  .card-section { align-items: stretch; }
  .title-letter { font-size: 2.2rem; width: 40px; height: 40px; }
  .newsreel-viewport { height: 320px !important; }
  .donate-viewport   { height: 190px !important; }
}
