/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --green: #1D9E75;
  --green-light: #E1F5EE;
  --green-dark: #0F6E56;
  --amber: #EF9F27;
  --amber-light: #FAEEDA;
  --coral: #D85A30;
  --blue: #378ADD;
  --blue-light: #E6F1FB;
  --bg: #F7F6F2;
  --card: #FFFFFF;
  --border: #E0DDD6;
  --text: #1C1C1A;
  --muted: #6B6860;
  --radius: 16px;
  --radius-sm: 10px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overscroll-behavior: none; }
body { font-family: 'Nunito', sans-serif; background: var(--bg); color: var(--text); }

/* ── Loading screen ────────────────────────────────────────── */
#loading {
  position: fixed; inset: 0; background: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 9999; transition: opacity 0.5s;
}
#loading.hide { opacity: 0; pointer-events: none; }
.loading-logo { width: 140px; margin-bottom: 20px; }
.loading-title { font-family: 'Fredoka One', cursive; font-size: 28px; color: white; margin-bottom: 6px; }
.loading-sub { font-size: 13px; color: rgba(255,255,255,0.45); margin-bottom: 28px; }
.loading-dots { display: flex; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); animation: bounce 1s infinite; }
.dot:nth-child(2) { animation-delay: 0.15s; }
.dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-9px)} }

/* ── App shell ─────────────────────────────────────────────── */
#app { display: none; flex-direction: column; height: 100%; }
#app.visible { display: flex; }

/* ── Top bar ───────────────────────────────────────────────── */
.topbar {
  background: var(--text); color: white;
  padding: 12px 16px 10px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; position: relative; z-index: 50;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
}
.topbar-left { min-width: 0; }
.topbar-title {
  font-family: 'Fredoka One', cursive; font-size: 20px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-sub { font-size: 11px; opacity: 0.5; margin-top: 1px; }
.sync-wrap { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: 12px; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: #555; transition: background 0.3s; flex-shrink: 0; }
.sync-dot.live { background: var(--green); box-shadow: 0 0 5px var(--green); }
.sync-label { font-size: 11px; opacity: 0.6; white-space: nowrap; }

/* ── Progress bar ──────────────────────────────────────────── */
.progress-wrap { background: var(--text); padding: 0 16px 10px; flex-shrink: 0; }
.progress-top { display: flex; justify-content: space-between; font-size: 11px; color: rgba(255,255,255,0.5); margin-bottom: 5px; font-weight: 700; }
.progress-bg { background: rgba(255,255,255,0.15); border-radius: 999px; height: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--green), var(--amber)); border-radius: 999px; transition: width 0.6s ease; }

/* ── Scrollable content ────────────────────────────────────── */
.content-area {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  position: relative;
}
.panel { display: none; padding: 12px 14px 100px; }
.panel.active { display: block; }

/* ── Bottom nav ────────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--card); border-top: 1.5px solid var(--border);
  display: flex; z-index: 100;
  padding-bottom: var(--safe-bottom);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 8px 4px 7px;
  background: none; border: none; border-radius: 0;
  font-size: 10px; font-weight: 700; font-family: 'Nunito', sans-serif;
  color: var(--muted); cursor: pointer; transition: color 0.15s; white-space: nowrap;
}
.tab .ti { font-size: 18px; line-height: 1; }
.tab.active { color: var(--green); }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--card); border-radius: var(--radius);
  border: 1.5px solid var(--border); padding: 14px; margin-bottom: 12px;
}
.card-title { font-family: 'Fredoka One', cursive; font-size: 15px; margin-bottom: 10px; }
.section-label {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1px; color: var(--muted); margin: 14px 0 7px;
}

/* ── Forms ─────────────────────────────────────────────────── */
label.field-label { font-size: 12px; font-weight: 800; color: var(--muted); display: block; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
select, input[type=text], input[type=email], input[type=date], textarea {
  width: 100%; font-family: 'Nunito', sans-serif; font-size: 15px; font-weight: 600;
  padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); margin-bottom: 10px;
  -webkit-appearance: none; appearance: none;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--green); }
textarea { resize: none; min-height: 60px; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 12px; font-family: 'Fredoka One', cursive; font-size: 16px;
  letter-spacing: 0.4px; background: var(--green); color: white;
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--green-dark); }
.btn:active { transform: scale(0.98); }
.btn.secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); font-size: 14px; padding: 9px; }
.btn.amber { background: var(--amber); }
.btn.amber:hover { background: #c87d0e; }
.btn.danger { background: #c0392b; }
.btn.dark { background: var(--text); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

/* ── Filter chips ──────────────────────────────────────────── */
.chips-row {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 2px 0 10px;
}
.chips-row::-webkit-scrollbar { display: none; }
.chip-btn {
  background: var(--card); border: 1.5px solid var(--border); border-radius: 999px;
  padding: 5px 13px; font-size: 12px; font-weight: 700; font-family: 'Nunito', sans-serif;
  color: var(--muted); cursor: pointer; white-space: nowrap; transition: all 0.12s; flex-shrink: 0;
}
.chip-btn.active { background: var(--text); color: white; border-color: var(--text); }

/* ── Plates grid ───────────────────────────────────────────── */
.plates-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
@media (min-width: 420px) { .plates-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 520px) { .plates-grid { grid-template-columns: repeat(6, 1fr); } }

.plate-cell {
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 4px 6px; text-align: center; cursor: pointer;
  transition: transform 0.12s, opacity 0.12s; position: relative;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.plate-cell:active { transform: scale(0.93); }
.plate-cell.done { opacity: 0.32; filter: grayscale(0.7); cursor: default; pointer-events: none; }
.plate-cell.partial { opacity: 0.72; }
.p-abbr { font-family: 'Fredoka One', cursive; font-size: 17px; display: block; line-height: 1.1; }
.p-name { font-size: 9px; font-weight: 700; display: block; line-height: 1.3; margin-top: 2px; opacity: 0.85; }
.star-badge {
  position: absolute; top: 2px; right: 2px;
  background: #F5C518; color: #1C1C1A; border-radius: 50%;
  width: 13px; height: 13px; font-size: 8px;
  display: flex; align-items: center; justify-content: center; font-weight: 900;
}
.check-badge {
  position: absolute; top: 2px; right: 2px;
  background: rgba(0,0,0,0.3); color: white; border-radius: 50%;
  width: 13px; height: 13px; font-size: 8px;
  display: flex; align-items: center; justify-content: center; font-weight: 900;
}
.grid-divider {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin: 8px 0 2px;
}
.grid-divider span { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); white-space: nowrap; }
.grid-divider hr { flex: 1; border: none; border-top: 1px solid var(--border); }

/* ── Log Sighting panel ────────────────────────────────────── */
.spot-banner {
  border-radius: var(--radius-sm); padding: 10px 14px;
  margin-bottom: 12px; font-size: 13px; font-weight: 700;
}
.spot-banner.new { background: var(--green-light); color: var(--green-dark); }
.spot-banner.dup { background: var(--amber-light); color: #7A4800; }
.spot-plate-label {
  font-family: 'Fredoka One', cursive; font-size: 22px;
  display: inline-block; margin-bottom: 12px;
  background: var(--green-light); color: var(--green-dark);
  border-radius: var(--radius-sm); padding: 6px 14px;
}
.already-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.already-chip {
  background: var(--green-light); color: var(--green-dark);
  border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 700;
}
.spotter-btns { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.spotter-btn {
  font-family: 'Nunito', sans-serif; font-size: 13px; font-weight: 700;
  padding: 8px 16px; border-radius: 999px; cursor: pointer; transition: all 0.12s;
  border: 2px solid var(--border); background: var(--card); color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.spotter-btn.selected { border-color: var(--green); background: var(--green); color: white; }
.spotter-btn.disabled-spotter { opacity: 0.35; cursor: not-allowed; }

/* ── Leaderboard ───────────────────────────────────────────── */
.lb-list { display: flex; flex-direction: column; gap: 7px; }
.lb-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.lb-row.highlight { border-color: var(--green); background: var(--green-light); }
.lb-rank { font-family: 'Fredoka One', cursive; font-size: 18px; width: 26px; text-align: center; color: var(--muted); }
.lb-rank.r1 { color: #B07500; }
.lb-rank.r2 { color: #5F5E5A; }
.lb-rank.r3 { color: #7a4800; }
.lb-name { flex: 1; font-size: 14px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.lb-pts { font-family: 'Fredoka One', cursive; font-size: 16px; color: var(--green-dark); flex-shrink: 0; }
.lb-states { font-size: 11px; color: var(--muted); background: var(--bg); padding: 2px 7px; border-radius: 999px; }

/* ── Score chips (unranked players) ────────────────────────── */
.score-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.score-chip {
  background: var(--card); border: 1.5px solid var(--border); border-radius: 999px;
  padding: 5px 12px; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; transition: all 0.15s; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.score-chip.selected {
  background: var(--text); color: white; border-color: var(--text);
}
.score-chip.selected .score-chip-pts { color: var(--amber); }
.score-chip-pts { color: var(--green-dark); font-family: 'Fredoka One', cursive; font-size: 13px; }
/* Top-3 ranked rows also tappable */
.lb-row { cursor: pointer; transition: background 0.15s; border-radius: var(--radius-sm); }
.lb-row.selected { background: var(--text); color: white; }
.lb-row.selected .lb-name { color: white; }
.lb-row.selected .lb-sub { color: rgba(255,255,255,0.6); }
.lb-row.selected .lb-pts { color: var(--amber); }
/* Combined chip */
#combined-score-chip {
  display: none; align-items: center; gap: 8px;
  background: var(--text); color: white; border-radius: 999px;
  padding: 8px 18px; font-size: 14px; font-weight: 700;
  margin-top: 10px; position: relative; overflow: visible;
}
#combined-score-chip.visible { display: flex; }
#combined-score-chip-pts { font-family: 'Fredoka One', cursive; font-size: 18px; color: var(--amber); }
/* Particles */
.score-particle {
  position: fixed; pointer-events: none; z-index: 999;
  font-size: 12px; animation: score-particle-anim 0.7s ease-out forwards;
}
@keyframes score-particle-anim {
  0%   { opacity: 1; transform: translate(0,0) scale(1); }
  100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(0.3); }
}
.feed-list { display: flex; flex-direction: column; gap: 7px; }
.feed-item {
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
}
.feed-item.undone { opacity: 0.55; }
.feed-abbr {
  font-family: 'Fredoka One', cursive; font-size: 16px;
  background: var(--green-light); color: var(--green-dark);
  border-radius: 7px; padding: 5px 8px; min-width: 46px; text-align: center; flex-shrink: 0;
}
.feed-abbr.dup-abbr { background: var(--amber-light); color: #7A4800; }
.feed-abbr.undo-abbr { background: #f0e8e8; color: #8B2020; text-decoration: line-through; }
.feed-info { flex: 1; min-width: 0; }
.feed-who { font-size: 13px; font-weight: 700; }
.feed-detail { font-size: 11px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-pts { font-family: 'Fredoka One', cursive; font-size: 14px; color: var(--green); flex-shrink: 0; }
.feed-pts.undo-pts { color: #8B2020; font-size: 12px; }
/* ── Plate tap sparkle ─────────────────────────────────────── */
@keyframes plate-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); box-shadow: 0 0 0 4px rgba(29,158,117,0.3); }
  100% { transform: scale(1); }
}
.plate-cell.tapping { animation: plate-pop 0.35s ease-out; }
.plate-sparkle {
  position: fixed; pointer-events: none; z-index: 999;
  font-size: 14px; animation: plate-sparkle-anim 0.6s ease-out forwards;
}
@keyframes plate-sparkle-anim {
  0%   { opacity: 1; transform: translate(0,0) scale(1); }
  100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(0.2); }
}

.undo-btn {
  background: none; border: none; font-size: 16px; cursor: pointer;
  opacity: 0.4; padding: 4px; flex-shrink: 0; transition: opacity 0.15s;
}
.undo-btn:hover { opacity: 1; }

/* ── Map ───────────────────────────────────────────────────── */
#tab-map { padding: 0 !important; }
.map-chips-wrap {
  position: relative; z-index: 10;
  padding: 12px 14px 8px;
}
.map-outer {
  position: relative;
  /* overflow visible lets Canada render above, chips sit on top of it */
}
.map-outer svg {
  width: 100%; height: auto; display: block;
  overflow: visible; /* Canada renders above the SVG box */
}
.map-content-below {
  position: relative; z-index: 10;
  padding: 0 14px;
}
.map-legend { display: flex; gap: 12px; padding: 6px 0 10px; font-size: 11px; color: var(--muted); font-weight: 700; flex-wrap: wrap; }
.map-legend-item { display: flex; align-items: center; gap: 4px; }
.legend-dot { width: 10px; height: 10px; border-radius: 2px; }
.ref-grid { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.ref-cell {
  display: flex; flex-direction: column; align-items: center;
  width: 48px; padding: 5px 3px 4px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--card); cursor: pointer;
}
.ref-cell.spotted-new { background: #FEF3E2; border-color: #E8A020; }
.ref-cell.spotted-old { background: #E6EEF7; border-color: #1B4F8A; }
.ref-abbr { font-family: 'Fredoka One', cursive; font-size: 13px; color: var(--muted); }
.ref-cell.spotted-new .ref-abbr { color: #7A4A00; }
.ref-cell.spotted-old .ref-abbr { color: #1B4F8A; }

/* ── Celebration overlay ───────────────────────────────────── */
#celebration {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  z-index: 800; pointer-events: none; opacity: 0; transition: opacity 0.3s;
}
#celebration.show { opacity: 1; pointer-events: all; cursor: pointer; }
.celebration-card {
  background: var(--text); color: white; border-radius: 20px;
  padding: 24px 28px; max-width: 300px; text-align: center;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  transform: scale(0.85) translateY(20px); transition: transform 0.3s;
  margin: 0 20px;
}
#celebration.show .celebration-card { transform: scale(1) translateY(0); }
.cel-emoji { font-size: 44px; display: block; margin-bottom: 10px; line-height: 1; }
.cel-msg { font-size: 16px; font-weight: 700; line-height: 1.5; }
.cel-pts { font-family: 'Fredoka One', cursive; font-size: 26px; color: var(--amber); margin-top: 8px; }
.cel-nudge { font-size: 12px; color: rgba(255,255,255,0.75); margin-top: 10px; font-weight: 600; display: none; }

/* ── Confetti canvas ───────────────────────────────────────── */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 801; }

/* ── Modal bottom sheet ────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 600; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal-sheet {
  background: var(--card); border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(20px + var(--safe-bottom)); width: 100%; max-width: 500px;
  transform: translateY(40px); transition: transform 0.25s ease;
}
.modal-overlay.show .modal-sheet { transform: translateY(0); }
.modal-title { font-family: 'Fredoka One', cursive; font-size: 18px; margin-bottom: 14px; }
.modal-cancel { width: 100%; background: none; border: none; font-family: 'Nunito', sans-serif; font-size: 14px; font-weight: 700; color: var(--muted); cursor: pointer; padding: 12px; margin-top: 6px; }

/* ── Onboarding screens ────────────────────────────────────── */
#onboarding {
  position: fixed; inset: 0; background: var(--bg);
  z-index: 500; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.onboard-wrap { max-width: 440px; margin: 0 auto; padding: 40px 20px 60px; }
.onboard-logo { display: block; width: 120px; margin: 0 auto 20px; background: var(--bg); border-radius: 8px; padding: 4px; }
.onboard-title { font-family: 'Fredoka One', cursive; font-size: 28px; text-align: center; margin-bottom: 6px; }
.onboard-sub { font-size: 14px; color: var(--muted); text-align: center; margin-bottom: 28px; line-height: 1.6; }
.onboard-step { display: none; }
.onboard-step.active { display: block; }
.honor-box {
  background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 20px; font-size: 14px; line-height: 1.7; color: var(--text);
}
.honor-box p + p { margin-top: 10px; }
.setup-complete-url {
  background: var(--text); color: white; border-radius: var(--radius-sm);
  padding: 12px 14px; font-family: 'Fredoka One', cursive; font-size: 15px;
  word-break: break-all; text-align: center; margin-bottom: 10px; letter-spacing: 0.3px;
}
.qr-wrap { text-align: center; margin: 12px 0; }
.qr-wrap canvas { border-radius: 8px; }
.code-display {
  text-align: center; font-family: 'Fredoka One', cursive; font-size: 32px;
  letter-spacing: 8px; color: var(--green-dark); background: var(--green-light);
  border-radius: var(--radius-sm); padding: 12px; margin-bottom: 14px;
}

/* ── Settings rows ─────────────────────────────────────────── */
.settings-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label { flex: 1; font-size: 14px; font-weight: 700; }
.settings-row-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.settings-row-action { font-size: 13px; font-weight: 700; color: var(--green); cursor: pointer; flex-shrink: 0; }
.settings-row-action.danger { color: var(--coral); }

/* ── Player chips in settings ──────────────────────────────── */
.player-chip-list { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.player-chip {
  background: var(--bg); border: 1.5px solid var(--border); border-radius: 999px;
  padding: 5px 12px; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; gap: 7px;
}
.player-chip-del { cursor: pointer; color: var(--coral); font-size: 15px; font-weight: 900; }

/* ── Help accordion ────────────────────────────────────────── */
.help-item { border-bottom: 1px solid var(--border); }
.help-q {
  width: 100%; text-align: left; background: none; border: none;
  font-family: 'Nunito', sans-serif; font-size: 14px; font-weight: 700;
  color: var(--text); padding: 12px 0; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
}
.help-q .arrow { transition: transform 0.2s; font-size: 12px; color: var(--muted); }
.help-q.open .arrow { transform: rotate(180deg); }
.help-a { font-size: 13px; line-height: 1.7; color: var(--muted); padding: 0 0 12px; display: none; }
.help-a.open { display: block; }

/* ── Install bar ───────────────────────────────────────────── */
.install-bar {
  background: var(--card); border-top: 1.5px solid var(--border);
  padding: 10px 16px; z-index: 200; display: none; position: relative;
}
.install-bar.visible { display: block; }
.install-bar-inner { display: flex; align-items: center; gap: 8px; }
.install-bar-inner .btn { flex: 1; margin: 0; }
.install-dismiss-x { background: none; border: none; font-size: 20px; color: var(--muted); cursor: pointer; padding: 4px 6px; line-height: 1; flex-shrink: 0; font-family: 'Nunito', sans-serif; }
.install-ios { font-size: 13px; color: var(--muted); text-align: center; line-height: 1.6; flex: 1; }

/* ── CRT footer ────────────────────────────────────────────── */
.crt-footer { padding: 20px 14px 8px; text-align: center; }
.crt-footer img { height: 44px; margin-bottom: 8px; opacity: 0.7; }
.crt-footer p { font-size: 11px; color: var(--muted); line-height: 1.6; }
.crt-footer a { color: var(--muted); }
.share-divider { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.share-nudge { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 0 8px; }
.share-nudge span { font-size: 13px; color: var(--muted); }
.share-nudge-btn { background: var(--green); color: #fff; border: none; border-radius: 20px; padding: 8px 20px; font-size: 13px; font-weight: 700; font-family: 'Nunito', sans-serif; cursor: pointer; }
.share-nudge-btn.secondary { background: var(--card); color: var(--text); border: 1.5px solid var(--border); }
.share-nudge-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ── Empty state ───────────────────────────────────────────── */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-icon { font-size: 38px; margin-bottom: 10px; }
.empty p { font-size: 13px; line-height: 1.6; }

/* ── Badge ─────────────────────────────────────────────────── */
.badge { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.badge.first { background: var(--green-light); color: var(--green-dark); }
.badge.jackpot { background: #1C1C1A; color: #FFD700; }

/* ── Rename popup ──────────────────────────────────────────── */
#rename-popup {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 700; opacity: 0; pointer-events: none; transition: opacity 0.2s;
  padding: 20px;
}
#rename-popup.show { opacity: 1; pointer-events: all; }
.rename-card {
  background: var(--card); border-radius: var(--radius);
  padding: 20px; width: 100%; max-width: 320px;
  font-size: 14px; line-height: 1.6; text-align: center;
}
.rename-card strong { font-family: 'Fredoka One', cursive; display: block; font-size: 16px; margin-bottom: 6px; }

/* ── Collapsible settings sections ─────────────────────────── */
.settings-section-header {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--muted);
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  margin: 10px 0 6px; cursor: pointer;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
  .settings-section-header.open {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: none;
  margin-bottom: 0;
}
.settings-section-body:not(.collapsed) {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-top: none;
  border-bottom-left-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
  padding: 2px 14px 10px;
  margin-bottom: 6px;
}
.settings-section-header .sec-arrow { font-size: 12px; transition: transform 0.2s; }
.settings-section-header.open .sec-arrow { transform: rotate(180deg); }
.settings-section-body { }
.settings-section-body.collapsed { display: none; }
#admin-page { display: none; padding: 20px; max-width: 900px; margin: 0 auto; }
#admin-page.visible { display: block; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { background: var(--text); color: white; padding: 8px 10px; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.admin-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.admin-table tr:hover td { background: var(--bg); }
.admin-tab-btn {
  background: none; border: none; border-bottom: 3px solid transparent;
  font-family: 'Nunito', sans-serif; font-size: 14px; font-weight: 700;
  padding: 8px 18px 10px; cursor: pointer; color: var(--muted); transition: all 0.15s;
}
.admin-tab-btn.active { color: var(--green); border-bottom-color: var(--green); }
.msg-pool-card {
  border: 1.5px solid var(--border); border-radius: var(--radius); padding: 16px;
  margin-bottom: 16px; background: var(--card);
}
.msg-pool-title { font-family: 'Fredoka One', cursive; font-size: 16px; margin-bottom: 4px; }
.msg-pool-desc { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.msg-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.msg-row input[type=text] { flex: 1; margin-bottom: 0; font-size: 13px; padding: 7px 10px; }
.msg-row input[type=number] { width: 56px; margin-bottom: 0; font-size: 13px; padding: 7px 8px; text-align: center; flex-shrink: 0; }
.msg-del-btn { background: none; border: none; font-size: 18px; color: var(--coral); cursor: pointer; flex-shrink: 0; padding: 0 4px; line-height: 1; }
.suggest-btn { background: linear-gradient(135deg,#6366f1,#8b5cf6); color: white; border: none; border-radius: var(--radius-sm); padding: 8px 14px; font-family: 'Fredoka One', cursive; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.suggest-result { background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px; margin-top: 10px; display: none; }
.suggest-result.visible { display: block; }
.suggest-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.suggest-item:last-child { border-bottom: none; }
.suggest-add-btn { background: var(--green); color: white; border: none; border-radius: 6px; padding: 3px 10px; font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 12px; cursor: pointer; flex-shrink: 0; }

/* ── Family code license plate badge ──────────────────────── */
.plate-badge {
  display: inline-block;
  background: #F5F0E8;
  border: 2.5px solid #2A2A28;
  border-radius: 6px;
  padding: 4px 14px 4px;
  font-family: 'Fredoka One', cursive;
  font-size: 20px;
  letter-spacing: 4px;
  color: #1C1C1A;
  text-transform: uppercase;
  position: relative;
  box-shadow: inset 0 0 0 1.5px #B8B5AD, 0 1px 3px rgba(0,0,0,0.15);
  line-height: 1.4;
}
.plate-badge::before {
  content: '';
  position: absolute; top: 3px; left: 4px; right: 4px; bottom: 3px;
  border: 1px solid #B8B5AD;
  border-radius: 3px;
  pointer-events: none;
}

/* ── Plate cell cascade-in animation ───────────────────────── */
@keyframes cell-cascade {
  0%   { opacity: 0; transform: translateY(-32px) scale(0.55); }
  60%  { opacity: 1; transform: translateY(5px)   scale(1.08); }
  80%  { transform: translateY(-3px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0)    scale(1); }
}
.plate-cell.cascade {
  animation: cell-cascade 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}
/* ── Today's plates shimmer ────────────────────────────────── */
@keyframes plate-shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}
.plate-cell.shimmer::after {
  content: '';
  position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.55) 50%, transparent 60%);
  background-size: 200% 100%;
  animation: plate-shimmer 0.9s ease-out 1 forwards;
  pointer-events: none;
}

/* ── Past years ────────────────────────────────────────────── */
.past-year-badge {
  display: inline-block; background: #EEE8E0; color: var(--muted);
  font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;
}

/* ── Offline / pending sync ────────────────────────────────── */
.pending-badge {
  position: absolute; top: 2px; right: 2px;
  font-size: 10px; line-height: 1;
  pointer-events: none; z-index: 2;
}
@keyframes pending-resolve {
  0%   { opacity: 1; transform: scale(1); }
  30%  { opacity: 1; transform: scale(1.6); }
  60%  { opacity: 1; transform: scale(1.2); }
  100% { opacity: 0; transform: scale(0.7); }
}
.pending-badge.resolving {
  animation: pending-resolve 1.4s ease-out forwards;
}
/* Offline notice inside spot panel */
.offline-notice {
  background: #FFF8E1; border: 1.5px solid #E8C200; border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 13px; font-weight: 700; color: #6B4A00;
  margin-bottom: 12px; display: none;
}
.offline-notice.show { display: block; }
/* Offline first-spot warning modal */
#offline-warning-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 650; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
#offline-warning-modal.show { opacity: 1; pointer-events: all; }
#offline-warning-modal .modal-sheet {
  background: var(--card); border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(20px + var(--safe-bottom));
  width: 100%; max-width: 500px;
  transform: translateY(40px); transition: transform 0.25s ease;
}
#offline-warning-modal.show .modal-sheet { transform: translateY(0); }
/* Sync toast — appears top-center */
#sync-toast {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 60px);
  left: 50%; transform: translateX(-50%) translateY(-80px);
  background: var(--text); color: white; border-radius: 999px;
  padding: 10px 20px; font-size: 13px; font-weight: 700;
  z-index: 900; white-space: nowrap;
  transition: transform 0.35s ease, opacity 0.35s ease;
  opacity: 0; pointer-events: none;
  max-width: calc(100vw - 32px); text-align: center;
}
#sync-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ── Update available banner ───────────────────────────────── */
#update-banner {
  display: none; background: var(--green); color: #fff;
  text-align: center; padding: 10px 16px; font-size: 13px; font-weight: 700;
  cursor: pointer; position: relative; z-index: 300;
}
#update-banner.visible { display: block; }

/* ═══════════════════════════════════════════════════════════
   BINGO — Switch chip
   ═══════════════════════════════════════════════════════════ */
#bingo-switch-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,0.12); color: white;
  border: 1.5px solid rgba(255,255,255,0.25);
  border-radius: 999px; padding: 5px 12px;
  font-family: 'Fredoka One', cursive; font-size: 13px;
  cursor: pointer; flex-shrink: 0; margin-left: 10px;
  transition: background 0.15s, transform 0.15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
#bingo-switch-chip:active { transform: scale(0.95); }
#bingo-switch-chip.active-game { background: rgba(239,159,39,0.25); border-color: var(--amber); color: var(--amber); }

/* ═══════════════════════════════════════════════════════════
   BINGO — App shell
   ═══════════════════════════════════════════════════════════ */
#bingo-app {
  display: none; flex-direction: column; height: 100%;
  position: absolute; inset: 0; z-index: 10;
}
#bingo-app.visible { display: flex; }
#bingo-app.visible #bingo-nav { display: flex; }

/* Bingo topbar overrides (title text only — reuses .topbar) */
#bingo-topbar-title { font-family: 'Fredoka One', cursive; font-size: 20px; }
#bingo-topbar-sub   { font-size: 11px; opacity: 0.5; margin-top: 1px; }

/* Bingo content area */
#bingo-content {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  position: relative;
}
.bingo-panel { display: none; padding: 10px 10px 100px; }
.bingo-panel.active { display: block; }

/* Bingo bottom nav (mirrors .bottom-nav / .tab exactly) */
#bingo-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--card); border-top: 1.5px solid var(--border);
  display: none; z-index: 100;
  padding-bottom: var(--safe-bottom);
}
#bingo-nav.visible { display: flex; }
#bingo-nav .tab { flex: 1; }

/* Active tab dot indicator */
.tab-dot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--green);
  margin: 2px auto 0; opacity: 0; transition: opacity 0.15s;
}
.tab.active .tab-dot { opacity: 1; }

/* ── Bingo onboarding screen ───────────────────────────────── */
#bingo-onboard {
  position: fixed; inset: 0; background: var(--bg);
  z-index: 510; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: none;
}
#bingo-onboard.visible { display: block; }

/* ── Bingo name-selection screen ───────────────────────────── */
#bingo-namesel {
  position: fixed; inset: 0; background: var(--bg);
  z-index: 510; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: none;
}
#bingo-namesel.visible { display: block; }

/* ── List view item row ────────────────────────────────────── */
.bingo-list-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  margin-bottom: 7px; cursor: pointer;
  transition: background 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.bingo-list-item.spotted {
  background: #D4EDDA; border-color: #4CAF70;
}
.bingo-list-item.spotted .bingo-item-label { text-decoration: line-through; }
.bingo-list-item.bingo-line { border-color: #1B5FA8; background: #D0E8FF; }
.bingo-list-item.free-space { cursor: default; }
.bingo-item-mini-grid {
  display: grid; grid-template-columns: repeat(5, 6px); grid-template-rows: repeat(5, 6px);
  gap: 1px; flex-shrink: 0;
}
.mini-cell {
  width: 6px; height: 6px; border-radius: 1px; background: #D8D5CF;
}
.mini-cell.spotted  { background: var(--green); }
.mini-cell.current  { background: var(--amber); }
.mini-cell.bingo-ln { background: #378ADD; }
.bingo-item-emoji { font-size: 22px; flex-shrink: 0; line-height: 1; }
.bingo-item-label { flex: 1; font-size: 14px; font-weight: 700; line-height: 1.3; }
.bingo-item-check { font-size: 18px; flex-shrink: 0; color: var(--amber); opacity: 0; }
.bingo-list-item.spotted .bingo-item-check { opacity: 1; }
.bingo-list-item.bingo-line .bingo-item-check { opacity: 1; color: #378ADD; }

/* ── 5×5 Grid view ─────────────────────────────────────────── */
.bingo-grid-5x5 {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px;
  max-width: 480px; margin: 0 auto;
}
.bingo-grid-cell {
  aspect-ratio: 1; border-radius: var(--radius);
  border: 1.5px solid var(--border); background: var(--card);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 4px 2px; text-align: center; cursor: pointer; position: relative;
  transition: background 0.12s, border-color 0.12s;
  -webkit-tap-highlight-color: transparent; overflow: hidden;
}
.bingo-grid-cell.spotted { background: #4CAF70; border-color: #2E7D32; }
.bingo-grid-cell.bingo-line { background: #378ADD; border-color: #1B5FA8; }
.bingo-grid-cell.free-space { cursor: default; }
.bingo-grid-cell .g-emoji { font-size: 36px; line-height: 1; }
.bingo-grid-cell .g-emoji[src] { width: 44px; height: 44px; object-fit: contain; }
.bingo-grid-cell .g-label {
  font-size: 9px; font-weight: 700; color: var(--text); margin-top: 4px;
  line-height: 1.2; overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.bingo-grid-cell.spotted .g-label,
.bingo-grid-cell.bingo-line .g-label { color: white; }
.bingo-grid-cell .g-check {
  position: absolute; top: 3px; right: 4px;
  font-size: 11px; color: white; display: none;
}
.bingo-grid-cell.spotted .g-check,
.bingo-grid-cell.bingo-line .g-check { display: block; }

/* ── Confirm overlay (replaces current view) ───────────────── */
#bingo-confirm {
  display: none; padding: 24px 16px 100px;
}
#bingo-confirm.active { display: block; }

/* ── Win banner (below header, auto-dismiss) ───────────────── */
#bingo-win-banner {
  background: var(--green); color: white;
  text-align: center; padding: 10px 16px; font-size: 14px; font-weight: 700;
  display: none; font-family: 'Fredoka One', cursive; letter-spacing: 0.3px;
}
#bingo-win-banner.visible { display: block; }

/* ── Shuffle footer button ─────────────────────────────────── */
.bingo-shuffle-footer {
  padding: 12px 0 4px; text-align: center;
}
.bingo-shuffle-btn {
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 999px; padding: 8px 20px;
  font-family: 'Nunito', sans-serif; font-size: 13px; font-weight: 700;
  color: var(--muted); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.bingo-shuffle-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Game swivel animation ─────────────────────────────────── */
@keyframes swivel-out {
  0%   { transform: perspective(600px) rotateY(0deg); opacity: 1; }
  100% { transform: perspective(600px) rotateY(-90deg); opacity: 0; }
}
@keyframes swivel-in {
  0%   { transform: perspective(600px) rotateY(90deg); opacity: 0; }
  100% { transform: perspective(600px) rotateY(0deg); opacity: 1; }
}
.swivel-out { animation: swivel-out 0.22s ease-in forwards; }
.swivel-in  { animation: swivel-in  0.22s ease-out 0.22s both; }


/* ── Bingo win pulse animation ─────────────────────────────
   Applied momentarily to cells that are part of a newly-completed
   win line. Removed after ~700ms; the bingo-line blue persists. */
@keyframes bingo-pulse {
  0%   { transform: scale(1);    box-shadow: 0 0 0 0 rgba(55,138,221,0.6); }
  40%  { transform: scale(1.06); box-shadow: 0 0 0 8px rgba(55,138,221,0); }
  100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(55,138,221,0); }
}
.bingo-list-item.pulsing,
.bingo-grid-cell.pulsing {
  animation: bingo-pulse 0.65s ease-out forwards;
}
