/* =========================================================
   BAD SCENE BINGO – Styles
   Editorial theme: warm neutrals, charcoal, amber
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Playfair+Display:ital,wght@0,700;0,800;0,900;1,400;1,700&display=swap');

:root {
  --bg:         #F8F7F4;
  --surface:    #FFFFFF;
  --surface2:   #F1F0ED;
  --border:     #E5E3DE;
  --accent:     #1A1A1A;
  --accent2:    #B45309;
  --accent-glow: rgba(26,26,26,0.08);
  --gold:       #B45309;
  --gold-light: #FEF3C7;
  --success:    #166534;
  --text:       #1A1A1A;
  --text-mid:   #44403C;
  --text-dim:   #A8A29E;
  --cell-bg:    #FFFFFF;
  --cell-hover: #F5F4F1;
  --cell-mark:  #1A1A1A;
  --cell-free:  #C2410C;
  --radius:     10px;
  --radius-lg:  14px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 2px 10px rgba(0,0,0,0.04);
  --shadow:     0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg:  0 8px 28px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
}

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

html, body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

/* ---- Screens ---- */
.screen {
  display: none;
  min-height: 100vh;
}
.screen.active {
  display: flex;
  flex-direction: column;
}

/* ---- Hero ---- */
.hero {
  background: linear-gradient(160deg, #111111 0%, #1c1c1c 60%, #2a2218 100%);
  text-align: center;
  padding: 3.5rem 1.5rem 3rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 60%, rgba(180,83,9,0.12) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 20%, rgba(255,255,255,0.03) 0%, transparent 50%);
  pointer-events: none;
}
.hero.small {
  padding: 0.75rem 1.5rem 1rem;
}
.hero.small .logo {
  font-size: 1.4rem;
}
.hero.small .tagline {
  display: none;
}

/* Decorative wavy divider at the bottom of hero */
.hero::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 40px;
  background: var(--bg);
  clip-path: ellipse(55% 100% at 50% 100%);
}

.film-strip { display: none; }

.logo {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 3.4rem;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.05;
  color: #fff;
  text-shadow: 0 2px 24px rgba(0,0,0,0.5);
  margin: 0 0 0.5rem;
  position: relative;
}
.logo::after {
  content: '';
  display: block;
  width: 40px;
  height: 1.5px;
  background: rgba(255,255,255,0.3);
  margin: 0.55rem auto 0.5rem;
}
.logo span {
  display: block;
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 8px;
  font-size: 2.2rem;
  color: rgba(255,255,255,0.75);
  text-indent: 8px;
}
.tagline {
  color: rgba(255,255,255,0.65);
  font-size: 0.9rem;
  font-style: italic;
  font-family: 'Playfair Display', Georgia, serif;
  position: relative;
  letter-spacing: 0.5px;
}

.concept-desc {
  text-align: center;
  color: #555;
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
  font-style: italic;
}

/* ---- Panel ---- */
.panel {
  max-width: 540px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.panel h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}

/* ---- Fields ---- */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-mid);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.optional {
  font-weight: 500;
  color: var(--text-dim);
  font-size: 0.78rem;
  text-transform: none;
  letter-spacing: 0;
}

.hint {
  font-weight: 500;
  color: var(--text-dim);
  font-size: 0.78rem;
  text-transform: none;
  letter-spacing: 0;
}

input[type="text"],
textarea {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  padding: 0.7rem 1rem;
  width: 100%;
  transition: border-color 0.18s, box-shadow 0.18s;
  outline: none;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
}

input[type="text"]:focus,
textarea:focus {
  border-color: var(--text-mid);
  box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-sm);
}

textarea {
  resize: vertical;
  min-height: 210px;
  line-height: 1.7;
}

.item-count {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-align: right;
}

/* ---- Templates ---- */
.templates-panel {
  padding-bottom: 0.5rem;
}

.templates-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.template-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  box-shadow: var(--shadow-sm);
}

.template-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.template-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-count {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.template-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.btn-load {
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 0.82rem;
  padding: 0.4rem 0.8rem;
}
.btn-load:hover {
  background: #333333;
  color: #fff;
  border-color: transparent;
}

.btn-delete {
  color: var(--text-dim);
  font-size: 0.78rem;
  padding: 0.4rem 0.6rem;
}
.btn-delete:hover {
  color: #dc2626;
  border-color: #fca5a5;
  background: #fef2f2;
}

.create-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  width: 100%;
  padding: 0.75rem;
  font-size: 0.95rem;
  border-radius: var(--radius-lg);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface2);
  border-color: var(--text-mid);
}
.btn-secondary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.75rem 1.5rem;
  transition: transform 0.12s, box-shadow 0.15s, opacity 0.2s, background 0.15s;
}

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

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  padding: 0.95rem;
  font-size: 1.05rem;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  border-radius: var(--radius-lg);
  letter-spacing: 0.01em;
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  transform: translateY(-1px);
  background: #333333;
}
.btn-primary:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-sm {
  background: var(--surface);
  color: var(--text-mid);
  border: 1.5px solid var(--border);
  font-size: 0.83rem;
  padding: 0.42rem 0.85rem;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}
.btn-sm:hover {
  background: var(--surface2);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-bingo {
  background: linear-gradient(135deg, #B45309, #C2410C);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 1rem 2rem;
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 24px rgba(180,83,9,0.35);
  animation: bingo-pulse 1.2s ease-in-out infinite;
}

.btn-bingo-called {
  background: var(--gold-light);
  color: #92400e;
  border: 2px solid #fcd34d;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.8rem 2rem;
  width: 100%;
  border-radius: var(--radius-lg);
  cursor: default;
}

@keyframes bingo-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(180,83,9,0.28); transform: scale(1); }
  50%       { box-shadow: 0 6px 32px rgba(180,83,9,0.48); transform: scale(1.01); }
}

.create-note {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
  font-style: italic;
  line-height: 1.6;
}

/* ---- Join screen ---- */
.join-info {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.error-msg {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  color: #b91c1c;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

.hidden { display: none !important; }

/* ---- Play screen ---- */
#screen-play {
  flex-direction: column;
  background: var(--bg);
}

.play-header {
  background: var(--surface);
  border-bottom: 1.5px solid var(--border);
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}

.play-header-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.play-logo {
  font-family: 'Abril Fatface', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 400;
  white-space: nowrap;
  color: var(--text);
}

.play-header-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.play-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.play-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.play-player-name {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Bingo Banner / Alert ---- */
.bingo-banner {
  background: linear-gradient(135deg, #B45309, #C2410C);
  color: #fff;
  text-align: center;
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 6px;
  padding: 1rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.15);
  animation: flash 0.6s ease-in-out infinite alternate;
}

.bingo-alert {
  background: var(--surface2);
  border-left: 4px solid var(--accent);
  padding: 0.6rem 1.1rem;
  font-size: 0.9rem;
  color: var(--text-mid);
  font-weight: 600;
}

@keyframes flash {
  from { opacity: 0.88; }
  to   { opacity: 1; }
}

/* ---- Play layout ---- */
.play-layout {
  display: flex;
  gap: 1.25rem;
  padding: 1.25rem;
  flex: 1;
  align-items: flex-start;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}

/* ---- Bingo Grid ---- */
.card-area {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

.bingo-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  width: 100%;
  aspect-ratio: 1;
}

.bingo-cell {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  font-size: clamp(0.52rem, 1.4vw, 0.72rem);
  font-weight: 600;
  padding: 4px;
  line-height: 1.3;
  user-select: none;
  transition: background 0.15s, border-color 0.15s, transform 0.12s, box-shadow 0.15s;
  word-break: break-word;
  hyphens: auto;
  color: var(--text-mid);
  box-shadow: var(--shadow-sm);
}

.bingo-cell:hover:not(.free) {
  background: var(--cell-hover);
  border-color: var(--text-mid);
  transform: scale(1.04);
  box-shadow: var(--shadow);
  color: var(--text);
}

.bingo-cell.marked {
  background: var(--accent);
  border-color: #333333;
  color: #fff;
  box-shadow: 0 3px 10px rgba(0,0,0,0.22);
}

.bingo-cell.marked:hover {
  background: #333333;
  border-color: #1a1a1a;
  transform: scale(1.04);
}

.bingo-cell.free {
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  border-color: #fdba74;
  color: #c2410c;
  cursor: default;
  font-size: clamp(0.58rem, 1.5vw, 0.76rem);
  font-weight: 900;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 10px rgba(249,115,22,0.15);
}

.bingo-cell.bingo-line {
  box-shadow: 0 0 0 2.5px var(--gold), 0 4px 16px rgba(245,158,11,0.35) !important;
  border-color: var(--gold) !important;
}

/* ---- Sidebar ---- */
.sidebar {
  width: 210px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sidebar h3 {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  padding-bottom: 0.5rem;
  border-bottom: 1.5px solid var(--border);
}

.players-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.players-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--text-mid);
  padding: 0.45rem 0.7rem;
  background: var(--surface);
  border-radius: 8px;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.players-list li .player-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.players-list li.has-bingo .player-dot {
  background: var(--gold);
}

.players-list li.has-bingo {
  border-color: #fcd34d;
  background: var(--gold-light);
  color: #92400e;
}

.players-list li span.me-badge {
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: auto;
}

.bingo-callers {
  background: var(--gold-light);
  border: 1.5px solid #fcd34d;
  border-radius: var(--radius);
  padding: 0.8rem;
}

.bingo-callers h3 {
  color: #92400e;
  border-color: #fde68a;
}

.bingo-callers-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.bingo-callers-list li {
  font-size: 0.88rem;
  font-weight: 700;
  color: #92400e;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  color: #fff;
  font-weight: 700;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  z-index: 999;
  animation: toast-in 0.25s ease;
}

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

/* ---- Install Banner ---- */
.install-banner {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2.5rem);
  max-width: 480px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  z-index: 998;
  animation: toast-in 0.3s ease;
}

.install-banner-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  line-height: 1;
}

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

.install-banner-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.install-banner-sub {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.install-banner-sub .ios-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  vertical-align: middle;
  margin: 0 2px;
  opacity: 0.7;
}

.install-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.btn-install {
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  white-space: nowrap;
}
.btn-install:hover {
  background: #333;
}

.btn-install-dismiss {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.3rem;
  cursor: pointer;
  border-radius: 4px;
}
.btn-install-dismiss:hover {
  color: var(--text);
  background: var(--surface2);
}

/* ---- Home screen: How it works ---- */
.how-it-works {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.how-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.4rem;
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 1rem 0.75rem;
}

.how-icon {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-family: 'DM Sans', sans-serif;
  text-transform: uppercase;
}

.how-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  font-family: 'Playfair Display', Georgia, serif;
}

.how-desc {
  font-size: 0.76rem;
  color: var(--text-dim);
  line-height: 1.45;
}

.how-arrow {
  color: var(--border);
  font-size: 1rem;
  padding-top: 1.4rem;
  flex-shrink: 0;
}

.home-cta-panel {
  padding-top: 0.5rem;
}

.create-back-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.section-header h2 {
  margin: 0;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .logo { font-size: 2.4rem; }
  .logo span { font-size: 2.1rem; }
  .panel { padding: 2rem 1.5rem 2.5rem; }
  .hero { padding: 3rem 1.75rem 2.5rem; }

  /* Play layout: stack card above sidebar, tighter padding */
  .play-layout { flex-direction: column; padding: 0.75rem; }
  .play-header { padding: 0.6rem 0.85rem; }
  .play-header-right { gap: 0.25rem; }
  /* Collapse Share Link and Print to icon-only on small screens */
  #btn-share .btn-label, #btn-print .btn-label { display: none; }
  /* Shrink logo so header doesn't overflow */
  .play-logo { font-size: 1.1rem; }
  .play-title { max-width: 160px; font-size: 0.88rem; }
  .play-player-name { font-size: 0.7rem; }

  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; gap: 0.75rem; }
  .sidebar > * { flex: 1; min-width: 140px; }

  /* Larger gap handled below; cells get a readable font size */
  .bingo-grid { gap: 4px; }
  .bingo-cell { font-size: 0.65rem; padding: 3px; }
}

@media (max-width: 480px) {
  .how-it-works { flex-direction: column; }
  .how-arrow { display: none; }
  .how-step { flex-direction: row; text-align: left; align-items: flex-start; gap: 0.75rem; }
  .how-icon { flex-shrink: 0; }

  /* On very small phones maximise the card */
  .play-layout { padding: 0.5rem; }
  .bingo-grid { gap: 3px; }
  .bingo-cell { font-size: 0.62rem; }
}

/* ---- Account bar (hero) ---- */
.account-bar {
  margin-top: 1.1rem;
  position: relative;
  z-index: 1;
}

.account-info {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 0.35rem 0.8rem 0.35rem 0.5rem;
}

.account-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.5);
}

.account-name {
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
}

.btn-ghost {
  background: transparent;
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.35);
  font-size: 0.78rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.55);
  color: #fff;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: #fff;
  color: #1a1a1a;
  border: none;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.45rem 1.1rem 0.45rem 0.75rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  text-decoration: none;
  transition: box-shadow 0.15s, transform 0.12s;
}
.btn-google:hover {
  box-shadow: 0 4px 18px rgba(0,0,0,0.2);
  transform: translateY(-1px);
}

/* ---- Templates header ---- */
.templates-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sync-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-mid);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}

/* ---- Leaderboard ---- */
.leaderboard-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.9rem;
  box-shadow: var(--shadow-sm);
  font-size: 0.9rem;
}

.lb-rank {
  font-size: 1.15rem;
  min-width: 2rem;
  text-align: center;
  flex-shrink: 0;
}

.lb-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.lb-avatar-placeholder {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface2);
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.lb-name {
  font-weight: 700;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-stats {
  font-size: 0.78rem;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ---- History screen ---- */
.history-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-back {
  flex-shrink: 0;
}

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

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

.history-item.got-bingo {
  border-color: #fcd34d;
  background: var(--gold-light);
}

.history-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.history-meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
}

.history-loading,
.history-empty {
  color: var(--text-dim);
  font-style: italic;
  padding: 0.75rem 0;
  font-size: 0.9rem;
}

/* ---- Collab screen ---- */
.collab-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.collab-participant-badge {
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  color: var(--text-mid);
  white-space: nowrap;
}

.collab-items-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.collab-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
}

.collab-item-own {
  border-color: var(--accent);
  background: var(--surface2);
}

.collab-item-text {
  flex: 1;
  color: var(--text);
  font-weight: 500;
}

.collab-item-by {
  font-size: 0.75rem;
  color: var(--text-dim);
  flex-shrink: 0;
  font-style: italic;
}

.collab-item-input-inline {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  outline: none;
  font-family: inherit;
  padding: 0;
  min-width: 0;
}

.collab-item-input-inline:focus {
  border-bottom: 1.5px solid var(--accent);
}

.collab-item-del {
  flex-shrink: 0;
  padding: 0.25rem 0.5rem;
  font-size: 0.72rem;
}

.collab-add-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.collab-add-row input {
  flex: 1;
}

.collab-add-row .btn {
  white-space: nowrap;
  flex-shrink: 0;
  width: auto;
}

#collab-host-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1rem;
}

.collab-waiting {
  text-align: center;
  color: var(--text-dim);
  font-style: italic;
  font-size: 0.9rem;
  margin-top: 1rem;
}

/* ---- Print styles ---- */
@media print {
  body { background: #fff; }

  /* Hide everything except the play screen */
  #screen-home,
  #screen-create,
  #screen-join,
  #screen-history,
  #toast,
  .play-header,
  .bingo-banner,
  .bingo-alert,
  .sidebar,
  #btn-bingo,
  #btn-bingo-called { display: none !important; }

  #screen-play {
    display: block !important;
    min-height: unset;
  }

  .play-layout {
    display: block;
    padding: 0;
    max-width: 100%;
  }

  .card-area { gap: 0.5rem; }

  /* Print header with title + name */
  .play-layout::before {
    content: attr(data-print-title);
    display: block;
    font-size: 1.4rem;
    font-weight: 900;
    text-align: center;
    margin-bottom: 0.4rem;
    color: #000;
  }

  .bingo-grid {
    gap: 4px;
    width: 100%;
    aspect-ratio: 1;
    page-break-inside: avoid;
  }

  .bingo-cell {
    border: 1.5px solid #aaa;
    border-radius: 6px;
    font-size: 0.6rem;
    color: #000;
    background: #fff;
    box-shadow: none;
  }

  .bingo-cell.marked {
    background: #d1fae5;
    border-color: #059669;
    color: #000;
    box-shadow: none;
  }

  .bingo-cell.free {
    background: #ffedd5;
    border-color: #fb923c;
    color: #000;
  }

  .bingo-cell.bingo-line {
    box-shadow: inset 0 0 0 2px #f59e0b !important;
  }
}

.input-error {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(230,57,80,0.2) !important;
}

/* ---- Built-in Templates ---- */
.builtin-templates {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.builtin-templates h2 {
  font-size: 1.1rem;
  margin: 0 0 0.25rem;
  color: #222;
}

.template-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.template-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-top: 3px solid var(--text);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.template-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.template-card-emoji {
  display: none;
}

.template-card-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.3;
}

.template-card-count {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.template-card-btn {
  margin-top: auto;
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--text);
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  letter-spacing: 0.3px;
  transition: background 0.15s, color 0.15s;
}

.template-card-btn:hover {
  background: var(--text);
  color: #fff;
}
