/* =====================================================================
   Gassy Goo's Bingo — Regulation-branded
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* --- Variables & Reset --- */

:root {
  --bg:         #0a0a0a;
  --bg2:        #111111;
  --stream-bg:  #000;
  --accent:     #f97316;   /* warm orange — Sloppy Joe's street lamp */
  --accent2:    #ffffff;
  --hot:        #ef4444;
  --text:       #f0f0f0;
  --text-dim:   #666;
  --border:     #1f1f1f;
  --font-pixel: 'Press Start 2P', monospace;
  --font-ui:    system-ui, -apple-system, 'Helvetica Neue', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* =====================================================================
   Navigation — Regulation site style
   ===================================================================== */

nav {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 24px;
  height: 54px;
  background: #000;
  border-bottom: 1px solid #1a1a1a;
  position: sticky;
  top: 0;
  z-index: 200;
}

.nav-logo {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.nav-logo:hover { text-decoration: none; }

.nav-reg-logo {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 6px;
}

.nav-logo-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1;
}

.nav-logo-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.nav-logo-sub {
  font-size: 9px;
  font-weight: 400;
  color: #555;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  gap: 0;
  list-style: none;
  height: 100%;
}

.nav-links li { display: flex; align-items: stretch; }

.nav-links a {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  padding: 0 16px;
  color: #999;
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  transition: color 0.12s, border-color 0.12s;
}

.nav-links a:hover { color: #fff; text-decoration: none; }

.nav-links a.active {
  color: #fff;
  border-bottom-color: var(--accent);
}

/* =====================================================================
   Stream page
   ===================================================================== */

.stream-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 54px);
}

.stream-wrap {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* The broadcast area */
#stream-area {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: #060608;
}

/* Street scene background SVG */
.street-scene {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.street-scene svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* CCTV scanlines overlay */
#stream-area::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 2px,
    rgba(0, 0, 0, 0.12) 3px
  );
  pointer-events: none;
  z-index: 15;
}

/* Vignette */
#stream-area::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
  z-index: 6;
}

/* --- CCTV overlay chrome --- */
.stream-chrome {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 18;
  font-family: 'Courier New', monospace;
}

/* Top CCTV info bar */
.cctv-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 6px 10px;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: #e0e0e0;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.cctv-station {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cctv-live-dot {
  width: 7px;
  height: 7px;
  background: #ff2222;
  border-radius: 50%;
  animation: blink 1s step-start infinite;
  flex-shrink: 0;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.cctv-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.viewer-badge {
  color: #e0e0e0;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
}

.cctv-timestamp { color: #ccc; }

#period-countdown {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-family: 'Courier New', monospace;
  font-size: 10px;
  color: rgba(180,180,180,0.6);
  pointer-events: none;
  z-index: 19;
  letter-spacing: 0.5px;
}

/* --- Stream objects --- */

.stream-object {
  position: absolute;
  text-align: center;
  pointer-events: none;
  z-index: 20;
  transform: translate(-50%, -50%);
  will-change: transform, left, top;
  filter: drop-shadow(0 0 8px rgba(0,0,0,0.8)) drop-shadow(0 0 14px var(--item-color, #f97316));
}

.obj-icon {
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid;
  background: rgba(0,0,0,0.6);
}

.obj-img {
  width: 66px;
  height: 66px;
  object-fit: contain;
}

.obj-emoji {
  font-size: 52px;
  line-height: 1;
}

.obj-name {
  font-family: 'Courier New', monospace;
  font-size: 10px;
  font-weight: bold;
  margin-top: 4px;
  max-width: 120px;
  word-break: break-word;
  color: #fff;
  text-shadow: 0 1px 3px #000, 0 0 10px var(--item-color, #f97316);
  line-height: 1.4;
  background: rgba(0,0,0,0.5);
  padding: 2px 4px;
}

/* --- Recent sightings sidebar --- */

.stream-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: #0a0a0a;
  border-left: 1px solid #1a1a1a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-heading {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 12px 14px;
  border-bottom: 1px solid #1a1a1a;
}

#recent-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 4px 0;
}

#recent-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-left: 3px solid transparent;
  border-bottom: 1px solid #141414;
  transition: background 0.15s;
}

#recent-list li:first-child {
  animation: slide-in 0.25s ease;
  background: #131313;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: none; }
}

.recent-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
  border: 1px solid #222;
  background: #0a0a0a;
  padding: 2px;
}

.recent-emoji-fallback { font-size: 24px; flex-shrink: 0; display: none; }

.recent-info {
  flex: 1;
  min-width: 0;
}

.recent-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  display: block;
}

.recent-time {
  font-size: 11px;
  color: var(--text-dim);
  font-family: 'Courier New', monospace;
}

/* Stream footer */
.stream-footer {
  background: #000;
  border-top: 1px solid #1a1a1a;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.stream-footer p {
  font-size: 13px;
  color: var(--text-dim);
}

.stream-footer a {
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border: 1px solid var(--accent);
  color: var(--accent);
  transition: background 0.12s;
}

.stream-footer a:hover {
  background: var(--accent);
  color: #000;
  text-decoration: none;
}

/* =====================================================================
   Bingo card
   ===================================================================== */

.bingo-page, .tracker-page {
  max-width: 700px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.page-title {
  font-family: var(--font-pixel);
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 8px;
}

.page-sub {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 24px;
  line-height: 1.6;
}

.card-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: center;
}

.btn {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  border: 1px solid #333;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { border-color: var(--accent); color: var(--accent); }
.btn-primary:hover { background: var(--accent); color: #000; }
.btn-gold { border-color: #fff; color: #fff; }
.btn-gold:hover { background: #fff; color: #000; }
.btn-danger { border-color: var(--hot); color: var(--hot); }
.btn-danger:hover { background: var(--hot); color: #fff; }

.card-seed-display {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
}
.card-seed-display strong { color: var(--accent); font-size: 15px; }

/* --- Bingo table --- */

#bingo-card, #tracker-card { overflow-x: auto; }

.bingo-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.bingo-col-header {
  font-family: var(--font-pixel);
  font-size: 20px;
  text-align: center;
  padding: 12px 4px;
  background: #000;
  border: 1px solid #1a1a1a;
}

.bingo-table thead th:nth-child(1) { color: #ff6b6b; }
.bingo-table thead th:nth-child(2) { color: #ffd700; }
.bingo-table thead th:nth-child(3) { color: #f97316; }
.bingo-table thead th:nth-child(4) { color: #4ade80; }
.bingo-table thead th:nth-child(5) { color: #f472b6; }

.bingo-cell {
  border: 1px solid #1f1f1f;
  padding: 8px 6px;
  vertical-align: middle;
  text-align: center;
  position: relative;
  background: #111;
  transition: background 0.12s;
}

.bingo-cell.clickable { cursor: pointer; }
.bingo-cell.clickable:hover { background: #1a1a1a; }

.cell-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  position: relative;
  gap: 0;
}

/* Text-only cells — no thumbnails on the bingo card */
.cell-emoji { font-size: 28px; line-height: 1; }

.cell-name {
  font-size: 11px;
  line-height: 1.35;
  color: var(--text);
  word-break: break-word;
  hyphens: auto;
  font-weight: 500;
}

/* FREE space */
.bingo-free { background: #0d0d00 !important; border-color: #333 !important; }
.bingo-free .cell-name { color: #ffd700; font-size: 12px; font-weight: 700; }

.free-reg-logo {
  width: 48px;
  height: 48px;
  border-radius: 6px;
}

@media print {
  .free-reg-logo { width: 36px; height: 36px; }
}

/* Marked cell */
.bingo-cell.marked { background: color-mix(in srgb, var(--item-color) 10%, #111); }

.daub {
  position: absolute;
  width: 72%;
  height: 72%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: color-mix(in srgb, var(--item-color) 45%, transparent);
  border: 2px solid var(--item-color);
  animation: daub-pop 0.18s ease;
  pointer-events: none;
}

@keyframes daub-pop {
  from { transform: translate(-50%,-50%) scale(0.2); opacity: 0; }
  to   { transform: translate(-50%,-50%) scale(1);   opacity: 1; }
}

.bingo-winner {
  border-color: #ffd700 !important;
  box-shadow: inset 0 0 0 2px #ffd700;
  animation: winner-pulse 1s ease infinite;
}

@keyframes winner-pulse {
  0%, 100% { box-shadow: inset 0 0 0 2px #ffd700; }
  50%       { box-shadow: inset 0 0 0 2px #ffd700, 0 0 16px #ffd700; }
}

/* =====================================================================
   Bingo / Tracker status
   ===================================================================== */

.bingo-status {
  font-family: var(--font-pixel);
  font-size: 16px;
  text-align: center;
  min-height: 36px;
  margin: 16px 0;
  color: transparent;
}

.bingo-status.has-bingo {
  color: #ffd700;
  text-shadow: 0 0 20px #ffd700;
  animation: bingo-flash 0.5s ease 3;
}

@keyframes bingo-flash {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.7; transform: scale(1.04); }
}

/* =====================================================================
   Tracker extras
   ===================================================================== */

.tracker-intro {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 20px;
}

.seed-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.seed-input-row label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

#seed-input, #switch-seed-input {
  font-family: 'Courier New', monospace;
  font-size: 16px;
  background: #111;
  border: 1px solid #333;
  color: var(--text);
  padding: 8px 12px;
  width: 180px;
  border-radius: 4px;
  outline: none;
}

#seed-input:focus, #switch-seed-input:focus { border-color: var(--accent); }
#seed-input.error, #switch-seed-input.error { border-color: var(--hot); }

.display-seed-row {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.display-seed-row strong { color: var(--accent); }

/* =====================================================================
   Session timer (tracker page) — subtle bottom-right of card
   ===================================================================== */

.timer-row {
  text-align: right;
  margin-top: 6px;
}

.session-timer {
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  color: #2a2a2a;
  letter-spacing: 1px;
  user-select: none;
}

/* =====================================================================
   BINGO popup
   ===================================================================== */

.bingo-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 0.25s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.bingo-popup {
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 36px 32px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: pop-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.bingo-popup-firework {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 12px;
}

.bingo-popup-heading {
  font-family: var(--font-pixel);
  font-size: 22px;
  color: #ffd700;
  text-shadow: 0 0 20px #ffd700;
  margin-bottom: 10px;
}

.bingo-popup-time {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 6px;
}

.bingo-popup-time strong {
  color: var(--accent);
  font-size: 22px;
}

.bingo-popup-sub {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.bingo-popup-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.bingo-popup-name-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.bingo-popup-name-row input {
  font-family: var(--font-ui);
  font-size: 15px;
  background: #0a0a0a;
  border: 1px solid #333;
  color: var(--text);
  padding: 9px 14px;
  border-radius: 4px;
  outline: none;
  width: 200px;
}
.bingo-popup-name-row input:focus { border-color: var(--accent); }

.bingo-popup-rank {
  font-size: 20px;
  font-weight: 700;
  color: #ffd700;
  margin-bottom: 20px;
}

/* Disabled items in admin gallery */
.admin-item-disabled {
  opacity: 0.4;
  filter: grayscale(0.7);
}
.admin-item-disabled:hover { opacity: 0.6; }

/* Hidden admin trigger — bottom centre, nearly invisible */
.admin-trigger {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 10px;
  background: rgba(255, 255, 255, 0.025);
  display: block;
  z-index: 999;
  border: none;
  outline: none;
}
.admin-trigger:hover { background: rgba(255, 255, 255, 0.06); }

/* Admin SVG edit modal */
.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.admin-modal {
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 24px;
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-modal-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.admin-modal-close:hover { color: var(--text); }

.admin-modal-body {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 16px;
  align-items: start;
}

.admin-modal textarea {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  background: #0a0a0a;
  border: 1px solid #333;
  color: #aaa;
  padding: 10px;
  border-radius: 4px;
  width: 100%;
  height: 260px;
  resize: vertical;
  outline: none;
}
.admin-modal textarea:focus { border-color: var(--accent); }

.admin-modal-preview {
  aspect-ratio: 1;
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.admin-modal-preview svg { width: 100%; height: 100%; }

.admin-modal-actions {
  display: flex;
  gap: 10px;
}

/* --- Confetti --- */
.confetti-dot {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 1px;
  pointer-events: none;
  z-index: 9999;
  animation: confetti-fall 2.5s ease-in forwards;
}

@keyframes confetti-fall {
  0%   { transform: translateX(0) rotate(0deg); opacity: 1; }
  100% { transform: translateX(var(--x)) translateY(calc(var(--y) + 120vh)) rotate(720deg); opacity: 0; }
}

/* =====================================================================
   Responsive
   ===================================================================== */

@media (max-width: 640px) {
  .stream-sidebar { display: none; }
  .obj-icon { width: 68px; height: 68px; }
  .obj-img  { width: 50px; height: 50px; }
  .obj-name { font-size: 8px; max-width: 80px; }
}

/* =====================================================================
   Print — text-only bingo card on white
   ===================================================================== */

@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; color: #000; }

  nav, .card-controls, .card-seed-display a,
  .stream-footer, .stream-sidebar, #period-countdown,
  .stream-chrome, .cctv-bar, .btn,
  #no-card, .page-sub, .tracker-intro,
  .seed-input-row, .display-seed-row,
  .bingo-status { display: none !important; }

  .bingo-page, .tracker-page { max-width: 100%; padding: 0; }

  .page-title { color: #000; text-shadow: none; text-align: center; margin-bottom: 12px; font-size: 18px; }

  .bingo-table { page-break-inside: avoid; }

  .bingo-col-header {
    background: #000 !important; color: #fff !important;
    border-color: #000 !important; font-size: 22px; padding: 10px;
  }

  .bingo-cell { border: 1px solid #444 !important; background: #fff !important; }
  .bingo-free { background: #fffde0 !important; border-color: #888 !important; }
  .bingo-free .cell-name { color: #000 !important; }

  .cell-name { font-size: 10px; color: #000 !important; }
  .cell-emoji { font-size: 22px; }
  .daub, .bingo-winner { display: none !important; animation: none !important; }
}
