/* ═══════════════════════════════════════════════════════════════════════════
   TriviaBlitz — Dark Arcade Theme
   Fonts: 'Bebas Neue' (display) + 'DM Mono' (body/code)
   Palette: Near-black base + Electric cyan + Hot pink accents
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Mono:ital,wght@0,300;0,400;0,500;1,400&display=swap');

/* ── Custom properties ──────────────────────────────────────────────────── */
.tb-app {
  --bg-0:       #0a0a0f;
  --bg-1:       #12121a;
  --bg-2:       #1a1a26;
  --bg-3:       #22223a;
  --border:     #2e2e4a;
  --cyan:        #00e5ff;
  --cyan-dim:   #00b8cc;
  --pink:        #ff2d78;
  --pink-dim:   #cc2460;
  --green:       #00ff88;
  --green-dim:  #00cc6e;
  --yellow:      #ffd600;
  --red:         #ff3d3d;
  --text-1:     #f0f0ff;
  --text-2:     #9090b8;
  --text-3:     #5050a0;
  --font-display: 'Bebas Neue', 'Impact', sans-serif;
  --font-body:    'DM Mono', 'Fira Code', monospace;
  --radius:      8px;
  --radius-lg:   14px;
  --shadow:      0 4px 24px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px rgba(0,229,255,0.15);

  font-family: var(--font-body);
  background: var(--bg-0);
  color: var(--text-1);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  box-sizing: border-box;
}

.tb-app *, .tb-app *::before, .tb-app *::after { box-sizing: border-box; }

/* ── Screens ─────────────────────────────────────────────────────────────── */
.tb-screen {
  display: none;
  animation: tb-fadein 0.25s ease;
}
.tb-screen--active { display: block; }

@keyframes tb-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── LOBBY ───────────────────────────────────────────────────────────────── */
.tb-lobby {
  max-width: 700px;
  margin: 0 auto;
  padding: 48px 20px 100px;
}

.tb-logo {
  text-align: center;
  margin-bottom: 48px;
}
.tb-logo__bolt {
  font-size: 56px;
  line-height: 1;
  filter: drop-shadow(0 0 18px var(--cyan));
  animation: tb-pulse-bolt 2.5s ease-in-out infinite;
}
@keyframes tb-pulse-bolt {
  0%, 100% { filter: drop-shadow(0 0 18px var(--cyan)); }
  50%       { filter: drop-shadow(0 0 36px var(--cyan)); }
}
.tb-logo__title {
  font-family: var(--font-display);
  font-size: clamp(52px, 12vw, 88px);
  letter-spacing: 4px;
  margin: 0;
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.tb-logo__tagline {
  color: var(--text-2);
  font-size: 13px;
  margin-top: 8px;
  letter-spacing: 0.5px;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.tb-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: border-color 0.2s;
}
.tb-card--action {
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: default;
}
.tb-card--action:hover { border-color: var(--cyan); }
.tb-card__icon { font-size: 32px; }
.tb-card h3 { margin: 0; font-family: var(--font-display); font-size: 22px; letter-spacing: 1px; }
.tb-card p  { margin: 0; font-size: 12px; color: var(--text-2); }

.tb-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}
@media (max-width: 480px) { .tb-two-col { grid-template-columns: 1fr; } }

/* ── Inputs ──────────────────────────────────────────────────────────────── */
.tb-input {
  width: 100%;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 12px 16px;
  outline: none;
  touch-action: manipulation;
  transition: border-color 0.1s, box-shadow 0.1s;
}
.tb-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0,229,255,0.12);
}
.tb-input--large { font-size: 18px; padding: 16px 20px; text-align: center; }
.tb-input--code  {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 8px;
  text-align: center;
  text-transform: uppercase;
}
.tb-input--correct { border-color: var(--green) !important; background: rgba(0,255,136,0.05); }
.tb-input--wrong   { border-color: var(--red)   !important; background: rgba(255,61,61,0.05); }

.tb-select {
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
}
.tb-select:focus { border-color: var(--cyan); }

.tb-create-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12px;
  color: var(--text-2);
}
.tb-create-options label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.tb-create-options input[type="checkbox"] { accent-color: var(--cyan); width: 14px; height: 14px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 1.5px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: transform 0.1s, box-shadow 0.15s, opacity 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.tb-btn:active { transform: scale(0.97); }
.tb-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.tb-btn--primary {
  background: linear-gradient(135deg, var(--cyan-dim), var(--cyan));
  color: #000;
  box-shadow: 0 4px 16px rgba(0,229,255,0.25);
}
.tb-btn--primary:hover:not(:disabled) { box-shadow: 0 6px 24px rgba(0,229,255,0.4); }

.tb-btn--secondary {
  background: linear-gradient(135deg, var(--pink-dim), var(--pink));
  color: #fff;
  box-shadow: 0 4px 16px rgba(255,45,120,0.25);
}
.tb-btn--secondary:hover:not(:disabled) { box-shadow: 0 6px 24px rgba(255,45,120,0.4); }

.tb-btn--ghost {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-2);
}
.tb-btn--ghost:hover:not(:disabled) { border-color: var(--cyan); color: var(--cyan); }

.tb-btn--lg { font-size: 20px; padding: 16px 40px; }
.tb-btn--sm { font-size: 12px; padding: 6px 12px; }
.tb-btn--full { width: 100%; }

/* ── Nickname setup ──────────────────────────────────────────────────────── */
.tb-nickname-setup .tb-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 400px;
  margin: 0 auto;
}
.tb-nickname-setup h2 { margin: 0; font-family: var(--font-display); font-size: 24px; letter-spacing: 1px; }

/* ── Join/Create ─────────────────────────────────────────────────────────── */
.tb-join-create { animation: tb-fadein 0.3s ease; }
.tb-join-create__avatar {
  width: 48px; height: 48px; margin: 0 auto 8px;
}
.tb-join-create__welcome {
  text-align: center;
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 4px;
}

/* ── Public lobby ────────────────────────────────────────────────────────── */
.tb-public-lobby {
  margin-top: 32px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.tb-public-lobby h3 { margin: 0 0 12px; font-family: var(--font-display); font-size: 18px; }
.tb-public-room {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.tb-public-room:last-child { border-bottom: none; }
.tb-public-room__code { font-family: var(--font-display); font-size: 20px; color: var(--cyan); letter-spacing: 2px; }
.tb-public-room__info { font-size: 12px; color: var(--text-2); flex: 1; }

/* ── Waiting Room ────────────────────────────────────────────────────────── */
.tb-waiting {
  max-width: 600px;
  margin: 0 auto;
  padding: 48px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.tb-waiting__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.tb-waiting__header h2 { font-family: var(--font-display); font-size: 32px; letter-spacing: 2px; margin: 0; }
.tb-room-code-display {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-2);
}
.tb-code-badge {
  font-family: var(--font-display);
  font-size: 32px;
  letter-spacing: 6px;
  color: var(--cyan);
  text-shadow: 0 0 16px rgba(0,229,255,0.5);
}
.tb-player-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.tb-waiting-player {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 6px 14px 6px 8px;
  font-size: 13px;
  animation: tb-fadein 0.2s ease;
}
.tb-host-badge {
  font-size: 9px;
  background: var(--cyan);
  color: #000;
  border-radius: 4px;
  padding: 2px 5px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.tb-waiting__footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.tb-hint { color: var(--text-2); font-size: 12px; margin: 0; }

/* ── Game layout ─────────────────────────────────────────────────────────── */
.tb-game-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 16px;
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px 16px 100px;
  min-height: 100vh;
}
@media (max-width: 680px) {
  .tb-game-layout {
    grid-template-columns: 1fr;
  }
  .tb-sidebar { order: -1; }
}

/* ── Timer ───────────────────────────────────────────────────────────────── */
.tb-timer-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.tb-timer-bar {
  flex: 1;
  height: 10px;
  background: var(--bg-3);
  border-radius: 10px;
  overflow: hidden;
}
.tb-timer-fill {
  height: 100%;
  width: 100%;
  border-radius: 10px;
  transition: width 0.1s linear, background-color 0.3s;
}
.tb-timer-fill--green  { background: var(--green); box-shadow: 0 0 8px rgba(0,255,136,0.4); }
.tb-timer-fill--yellow { background: var(--yellow); box-shadow: 0 0 8px rgba(255,214,0,0.4); }
.tb-timer-fill--red    { background: var(--red); box-shadow: 0 0 8px rgba(255,61,61,0.4); }
.tb-timer-count {
  font-family: var(--font-display);
  font-size: 28px;
  width: 36px;
  text-align: center;
  color: var(--text-1);
}

/* ── Feed ────────────────────────────────────────────────────────────────── */
.tb-feed {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  min-height: 260px;
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}
.tb-feed::-webkit-scrollbar { width: 4px; }
.tb-feed::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.tb-feed-msg {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  font-size: 13px;
  line-height: 1.5;
}
.tb-feed-msg--visible { opacity: 1; transform: translateY(0); }

.tb-feed-msg--bot span,
.tb-feed-msg--reveal span {
  display: inline-block;
  background: var(--bg-2);
  border-left: 3px solid var(--cyan);
  padding: 8px 12px;
  border-radius: 0 8px 8px 0;
  color: var(--text-2);
}
.tb-feed-msg--question .tb-feed-question {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--pink);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  font-size: 15px;
  color: var(--text-1);
  line-height: 1.5;
}
.tb-q-num {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--pink);
  display: block;
  margin-bottom: 4px;
}
.tb-feed-first  span { border-color: var(--green) !important; color: var(--green) !important; }
.tb-feed-streak span { border-color: var(--pink) !important; }
.tb-feed-start  { color: var(--cyan); font-family: var(--font-display); font-size: 16px; letter-spacing: 1px; }
.tb-feed-end    { color: var(--pink); font-family: var(--font-display); font-size: 15px; }
.tb-feed-category { font-size: 11px !important; color: var(--text-3) !important; border-color: var(--border) !important; }
.tb-fun-fact {
  display: block;
  margin-top: 6px;
  font-style: italic;
  color: var(--yellow);
  font-size: 12px;
}
.tb-feed-timeout { color: var(--red) !important; }

/* ── Answer input ────────────────────────────────────────────────────────── */
.tb-answer-wrap {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tb-answer-row {
  display: flex;
  gap: 8px;
}
.tb-answer-input {
  flex: 1;
  font-size: 16px;
  padding: 14px 18px;
  border-radius: 10px;
}
.tb-answer-input:focus {
  box-shadow: 0 0 0 3px rgba(0,229,255,0.2);
}
.tb-answer-status {
  font-size: 13px;
  padding: 6px 0;
  min-height: 24px;
  transition: color 0.2s;
}
.tb-answer-status--correct { color: var(--green); }
.tb-answer-status--wrong   { color: var(--red); }

.tb-progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}
.tb-q-progress { font-size: 12px; color: var(--text-3); }
.tb-my-score   { font-family: var(--font-display); font-size: 22px; color: var(--cyan); letter-spacing: 1px; }

/* ── Sidebar / Leaderboard ───────────────────────────────────────────────── */
.tb-sidebar {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  height: fit-content;
  position: sticky;
  top: 16px;
}
.tb-sidebar__title {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 1px;
  margin: 0 0 12px;
  color: var(--text-2);
}
.tb-leaderboard { display: flex; flex-direction: column; gap: 6px; }
.tb-lb-row {
  display: grid;
  grid-template-columns: 24px 28px 1fr auto auto;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  background: var(--bg-2);
  transition: background 0.15s;
}
.tb-lb-row--me { background: rgba(0,229,255,0.08); border: 1px solid rgba(0,229,255,0.2); }
.tb-lb-rank { font-family: var(--font-display); font-size: 14px; color: var(--text-3); }
.tb-lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-lb-score { font-family: var(--font-display); font-size: 16px; color: var(--cyan); }
.tb-lb-score small { font-size: 10px; color: var(--text-3); margin-left: 1px; }
.tb-lb-streak { font-size: 11px; color: var(--pink); }

/* ── Game over ───────────────────────────────────────────────────────────── */
.tb-gameover {
  max-width: 600px;
  margin: 0 auto;
  padding: 48px 20px 120px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}
.tb-gameover__title {
  font-family: var(--font-display);
  font-size: clamp(40px, 10vw, 72px);
  letter-spacing: 4px;
  margin: 0;
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.tb-gameover__final-board { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.tb-final-row {
  display: grid;
  grid-template-columns: 32px 36px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  font-size: 14px;
  animation: tb-fadein 0.3s ease both;
}
.tb-final-row:nth-child(1) { animation-delay: 0.0s; }
.tb-final-row:nth-child(2) { animation-delay: 0.1s; }
.tb-final-row:nth-child(3) { animation-delay: 0.2s; }
.tb-final-row:nth-child(n+4) { animation-delay: 0.3s; }

.tb-final-row--winner {
  background: rgba(0,229,255,0.08);
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(0,229,255,0.1);
}
.tb-final-row--me {
  background: rgba(255,45,120,0.08);
  border-color: var(--pink);
}
.tb-final-rank { font-family: var(--font-display); font-size: 18px; }
.tb-final-name { font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.tb-final-score {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--cyan);
}

.tb-share-card {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.tb-share-card p {
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
  white-space: pre-line;
  line-height: 1.6;
}
.tb-gameover__actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ── Global leaderboard ──────────────────────────────────────────────────── */
.tb-global-lb {
  max-width: 600px;
  margin: 0 auto;
  padding: 32px 20px 120px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.tb-global-lb h2 { font-family: var(--font-display); font-size: 32px; letter-spacing: 2px; margin: 0; }
.tb-lb-tabs { display: flex; gap: 8px; }
.tb-lb-tab {
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 20px;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
}
.tb-lb-tab--active {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(0,229,255,0.08);
}
.tb-lb-list { display: flex; flex-direction: column; gap: 6px; }
.tb-your-rank {
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}
.tb-back-btn { align-self: flex-start; margin-bottom: 8px; }
.tb-empty { color: var(--text-3); font-size: 13px; text-align: center; padding: 24px; }

/* ── Nav bar ─────────────────────────────────────────────────────────────── */
.tb-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.95);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(12px);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.tb-nav__btn {
  font-family: var(--font-body);
  font-size: 12px;
  background: none;
  border: 1.5px solid var(--border);
  color: var(--text-2);
  border-radius: 6px;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.tb-nav__btn:hover { border-color: var(--cyan); color: var(--cyan); }
.tb-nav__center {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
}
.tb-nav__avatar { width: 28px; height: 28px; flex-shrink: 0; }
.tb-nav__name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Loading ─────────────────────────────────────────────────────────────── */
.tb-loading {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.tb-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: tb-spin 0.8s linear infinite;
}
@keyframes tb-spin { to { transform: rotate(360deg); } }
.tb-loading p { color: var(--text-2); font-size: 14px; }

/* ── Toasts ──────────────────────────────────────────────────────────────── */
.tb-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.tb-toast {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-1);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.2s, transform 0.2s;
  max-width: 300px;
}
.tb-toast--show { opacity: 1; transform: translateX(0); }
.tb-toast--success { border-color: var(--green); color: var(--green); }
.tb-toast--error   { border-color: var(--red);   color: var(--red); }
.tb-toast--info    { border-color: var(--cyan);  color: var(--cyan); }

/* ── Point pop animation ─────────────────────────────────────────────────── */
.tb-point-pop {
  position: fixed;
  left: 50%;
  top: 40%;
  transform: translate(-50%, 0);
  font-family: var(--font-display);
  font-size: 48px;
  color: var(--green);
  text-shadow: 0 0 20px rgba(0,255,136,0.8);
  pointer-events: none;
  z-index: 300;
  animation: tb-point-fly 1.2s ease-out forwards;
}
@keyframes tb-point-fly {
  0%   { opacity: 1; transform: translate(-50%, 0) scale(0.8); }
  40%  { opacity: 1; transform: translate(-50%, -40px) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -80px) scale(1); }
}

/* ── Shake animation ─────────────────────────────────────────────────────── */
.tb-shake {
  animation: tb-shake 0.5s ease;
}
@keyframes tb-shake {
  0%, 100% { transform: translateX(0); }
  15%       { transform: translateX(-6px); }
  30%       { transform: translateX(6px); }
  45%       { transform: translateX(-4px); }
  60%       { transform: translateX(4px); }
  75%       { transform: translateX(-2px); }
  90%       { transform: translateX(2px); }
}

/* ── Scrollbar (feed) ────────────────────────────────────────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ── Reveal ──────────────────────────────────────────────────────────────── */
.tb-feed-reveal .tb-reveal-msg {
  border-color: var(--yellow) !important;
  color: var(--yellow) !important;
}

/* ── Mobile refinements ──────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .tb-game-layout { padding: 12px 12px 80px; }
  .tb-feed { min-height: 180px; max-height: 240px; }
  .tb-answer-input { font-size: 16px; }
  .tb-gameover { padding: 24px 16px 100px; }
  .tb-lobby { padding: 32px 16px 100px; }
}

/* ═══════════════════════════════════════════════════════════════════
   TriviaBlitz v1.2 additions — Credits, AI toggle, Modal, Packages
   ═══════════════════════════════════════════════════════════════════ */

/* ── Credits badge (lobby) ─────────────────────────────────────── */
.tb-credits-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,229,255,0.08);
  border: 1px solid rgba(0,229,255,0.25);
  border-radius: 50px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--cyan);
  margin: 4px auto 12px;
  width: fit-content;
}
.tb-join-create__top {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 8px;
}

/* ── Nav credits ───────────────────────────────────────────────── */
.tb-nav__credits {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--cyan);
  letter-spacing: 0.5px;
  background: rgba(0,229,255,0.08);
  border: 1px solid rgba(0,229,255,0.2);
  border-radius: 50px;
  padding: 4px 12px;
}

/* ── AI toggle in create card ──────────────────────────────────── */
.tb-ai-toggle {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 4px;
}
.tb-ai-toggle__inner { display: flex; flex-direction: column; gap: 6px; }
.tb-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.tb-toggle-label input[type="checkbox"] { display: none; }
.tb-toggle-switch {
  width: 38px; height: 22px;
  background: var(--bg-3);
  border: 1.5px solid var(--border);
  border-radius: 22px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
}
.tb-toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 14px; height: 14px;
  background: var(--text-3);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.tb-toggle-label input:checked + .tb-toggle-switch {
  background: rgba(0,229,255,0.15);
  border-color: var(--cyan);
}
.tb-toggle-label input:checked + .tb-toggle-switch::after {
  transform: translateX(16px);
  background: var(--cyan);
}
.tb-toggle-text {
  font-size: 13px;
  color: var(--text-1);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tb-toggle-text small { font-size: 11px; color: var(--text-3); }
.tb-ai-cost {
  font-size: 11px;
  color: var(--text-3);
  padding-left: 48px;
}
.tb-ai-cost strong { color: var(--cyan); }

/* ── Room type badges ──────────────────────────────────────────── */
.tb-room-type-badge { margin-top: 4px; }
.tb-ai-badge, .tb-free-badge {
  font-size: 12px;
  border-radius: 50px;
  padding: 3px 12px;
  letter-spacing: 0.5px;
}
.tb-ai-badge   { background: rgba(0,229,255,0.1); border: 1px solid var(--cyan); color: var(--cyan); }
.tb-free-badge { background: rgba(0,255,136,0.08); border: 1px solid var(--green-dim); color: var(--green); }

/* ── Modal ─────────────────────────────────────────────────────── */
.tb-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.tb-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
}
.tb-modal__box {
  position: relative;
  z-index: 1;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 420px;
  animation: tb-fadein 0.2s ease;
}
.tb-modal__close {
  position: absolute;
  top: 16px; right: 16px;
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s;
}
.tb-modal__close:hover { color: var(--text-1); }
.tb-modal__header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.tb-modal__icon { font-size: 28px; }
.tb-modal__header h3 { margin: 0; font-family: var(--font-display); font-size: 22px; letter-spacing: 1px; }
.tb-modal__header p  { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.tb-modal__small { font-size: 11px; color: var(--text-3); margin: 12px 0 0; line-height: 1.5; }

.tb-credits-balance-row {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.tb-credits-balance-row strong { color: var(--cyan); font-size: 18px; }

/* ── Credit packages ───────────────────────────────────────────── */
.tb-packages { display: flex; flex-direction: column; gap: 10px; }
.tb-package {
  position: relative;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color 0.15s;
}
.tb-package--popular { border-color: var(--cyan); background: rgba(0,229,255,0.04); }
.tb-package__badge {
  position: absolute;
  top: -10px; right: 12px;
  background: var(--cyan);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 50px;
  text-transform: uppercase;
}
.tb-package__label { font-family: var(--font-display); font-size: 17px; letter-spacing: 1px; margin-bottom: 2px; }
.tb-package__price { font-size: 22px; color: var(--cyan); font-family: var(--font-display); }
.tb-package__sub   { font-size: 11px; color: var(--text-3); margin-bottom: 12px; }

.tb-answer-status--timeout { color: var(--yellow); }

/* ── Multiple choice buttons ───────────────────────────────────── */
.tb-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}
@media (max-width: 480px) {
  .tb-choices { grid-template-columns: 1fr; }
}

.tb-choice-btn {
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  /* touch-action: manipulation removes the 300ms tap delay on iOS/Android
     without disabling zoom on the rest of the page */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: border-color 0.1s, background 0.1s, transform 0.08s;
  line-height: 1.4;
}
.tb-choice-btn:hover:not(:disabled) {
  border-color: var(--cyan);
  background: rgba(0,229,255,0.06);
}
.tb-choice-btn:active:not(:disabled) { transform: scale(0.98); }
.tb-choice-btn:disabled { cursor: default; }

.tb-choice--selected {
  border-color: var(--cyan) !important;
  background: rgba(0,229,255,0.1) !important;
}
.tb-choice--correct {
  border-color: var(--green) !important;
  background: rgba(0,255,136,0.1) !important;
  color: var(--green) !important;
}
.tb-choice--wrong {
  border-color: var(--red) !important;
  background: rgba(255,61,61,0.08) !important;
  color: var(--red) !important;
  text-decoration: line-through;
  opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════════
   v1.5 — PWA install banners + prominent leaderboard button
   ═══════════════════════════════════════════════════════════════ */

/* ── Lobby leaderboard button ──────────────────────────────────── */
.tb-lobby-lb-btn {
  margin-top: 12px;
  font-size: 13px;
  letter-spacing: 0.5px;
  border-color: rgba(0,229,255,0.3);
  color: var(--cyan);
}
.tb-lobby-lb-btn:hover { border-color: var(--cyan); }

/* ── PWA install banner ────────────────────────────────────────── */
.tb-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 600;
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
  backdrop-filter: blur(12px);
  animation: tb-slide-up 0.3s ease;
}
@keyframes tb-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.tb-install-banner__content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.tb-install-banner__icon { font-size: 24px; flex-shrink: 0; }
.tb-install-banner__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.tb-install-banner__text strong {
  font-size: 14px;
  color: var(--text-1);
  white-space: nowrap;
}
.tb-install-banner__text small {
  font-size: 11px;
  color: var(--text-2);
}
.tb-install-banner__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.tb-install-banner--ios .tb-install-banner__text small strong {
  color: var(--cyan);
}

/* ── Floating install button (FAB) ─────────────────────────────── */
.tb-fab-install {
  position: fixed;
  bottom: 80px;   /* above nav bar */
  right: 16px;
  z-index: 350;
  display: none;  /* shown by JS once beforeinstallprompt fires */
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #00b8cc, #00e5ff);
  color: #000;
  border: none;
  border-radius: 50px;
  padding: 10px 18px 10px 14px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,229,255,0.35);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.15s;
}
.tb-fab-install.tb-fab--visible {
  opacity: 1;
  transform: translateY(0);
}
.tb-fab-install:hover {
  box-shadow: 0 6px 28px rgba(0,229,255,0.5);
}
.tb-fab-install__icon { font-size: 16px; }
.tb-fab-install__label { white-space: nowrap; }

@media (max-width: 480px) {
  .tb-fab-install {
    bottom: 72px;
    right: 12px;
    padding: 10px 14px;
  }
  .tb-fab-install__label { display: none; }
  .tb-fab-install__icon  { font-size: 20px; }
  .tb-fab-install { border-radius: 50%; width: 44px; height: 44px; justify-content: center; }
}
