:root {
    --fb-bg: #050816;
    --fb-panel-bg: rgba(15, 23, 42, 0.96);
    --fb-panel-border: rgba(148, 163, 184, 0.25);
    --fb-accent: #f97316;
    --fb-accent-soft: rgba(249, 115, 22, 0.18);
    --fb-accent-strong: #fb923c;
    --fb-text: #e5e7eb;
    --fb-muted: #9ca3af;
    --fb-danger: #f97373;
    --fb-success: #4ade80;
    --fb-input-bg: rgba(15, 23, 42, 0.9);
    --fb-input-border: rgba(148, 163, 184, 0.5);
    --fb-radius-xl: 1.25rem;
    --fb-radius-lg: 0.75rem;
    --fb-shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.7);
    --fb-card-shadow: 0 18px 30px rgba(15, 23, 42, 0.85);
    --fb-font: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

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

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

html, body {
  overscroll-behavior: none;
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: touch;
}

body,
body.fb-body {
    font-family: var(--fb-font);
    /* All three stops are themed. With the outer two hardcoded, a theme
       only tinted the middle band and every theme still read navy. */
    background: radial-gradient(circle at top,
                var(--fb-bg-top, #1f2937) 0,
                var(--fb-bg) 35%,
                var(--fb-bg-bottom, #020617) 100%);
    color: var(--fb-text);
    -webkit-font-smoothing: antialiased;
}

/* Compatibility: some templates/scripts still toggle the generic "hidden" class */
.hidden {
    display: none !important;
}

.fb-root {
    min-height: 100vh;
    padding: 1rem;
}

.fb-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.fb-title {
    /* Falls back to the body font for themes with no separate display face. */
    font-family: var(--fb-font-display, var(--fb-font));
    margin: 0;
    font-size: clamp(1.9rem, 3vw, 2.4rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 800;
    background: linear-gradient(120deg, var(--fb-accent), var(--fb-accent-strong), var(--fb-accent-pale, #fde68a));
    -webkit-background-clip: text;
    color: transparent;
}

.fb-beta {
    font-size: 0.55em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(226, 232, 240, 0.85);
    background: none;
}

.fb-tagline {
    margin: 0.4rem 0 0;
    color: rgba(248, 250, 252, 0.92);
    font-size: 1.02rem;
    line-height: 1.35;
    max-width: 52rem;
}

.fb-subtitle {
    margin: 0.15rem 0 0;
    color: var(--fb-muted);
    font-size: 0.95rem;
}

.fb-header-links {
    align-items: center;
    gap: 0.6rem;
}

.fb-header-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.32);
    color: rgba(248, 250, 252, 0.9);
    text-decoration: none;
    font-size: 0.85rem;
    transition: transform 0.08s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.fb-header-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.9);
    background: rgba(15, 23, 42, 0.5);
}

.fb-header-right {
    display: flex;
    align-items: stretch;
    gap: 1rem;
}

.fb-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.fb-header-right-column {
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
}

.fb-game-code-box {
    padding: 0.6rem 0.9rem;
    border-radius: var(--fb-radius-xl);
    border: 1px solid rgba(249, 115, 22, 0.4);
    background: radial-gradient(circle at top, rgba(248, 250, 252, 0.08), rgba(15, 23, 42, 0.95));
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 8rem;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.95), var(--fb-shadow-soft);
}

.fb-game-code-box.small {
    min-width: 6.5rem;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.95), var(--fb-shadow-soft);
}

.fb-game-code {
    font-size: clamp(1.6rem, 3vw, 2rem);
    font-weight: 800;
    letter-spacing: 0.25em;
    text-align: center;
    margin-top: 0.15rem;
}

.fb-game-code-name {
    font-size: 1.15rem;
    letter-spacing: 0.02em;
    text-transform: none;
    line-height: 1.1;
    padding: 0.1rem 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fb-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--fb-muted);
}

.fb-header-stats {
    display: flex;
    gap: 0.75rem;
}

.fb-stat {
    padding: 0.45rem 0.8rem;
    border-radius: var(--fb-radius-lg);
    background: rgba(15, 23, 42, 0.86);
    border: 1px solid rgba(148, 163, 184, 0.35);
    min-width: 6rem;
}

.fb-stat span:last-child {
    display: block;
    margin-top: 0.1rem;
    font-size: 1rem;
}

/* Panels & Layout */

.fb-main {
    display: grid;
    gap: 1rem;
}

.host-layout .fb-main {
    grid-template-columns: minmax(0, 1fr);
}

.player-layout .fb-main {
    grid-template-rows: auto auto 1fr;
}

.fb-panel {
    background: var(--fb-panel-bg);
    border-radius: var(--fb-radius-xl);
    border: 1px solid var(--fb-panel-border);
    box-shadow: var(--fb-card-shadow);
    padding: 1rem 1.1rem;
}

.fb-panel-title {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
    font-weight: 600;
}

.fb-panel-help {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    color: var(--fb-muted);
}

/* Utility */

.fb-hidden {
    display: none !important;
}

/* Fieldsets (group boxes) */

.fb-fieldset {
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 1rem;
    padding: 0.85rem 0.9rem 0.9rem;
    margin: 0;
    background: rgba(15, 23, 42, 0.55);
}

.fb-fieldset > legend {
    padding: 0 0.55rem;
    color: var(--fb-accent-strong);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

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

.fb-details-title {
    font-weight: 700;
    color: rgba(248,250,252,0.95);
    font-size: 0.95rem;
}

.fb-details-content {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.fb-details-card {
    border: 1px solid rgba(148,163,184,0.18);
    border-radius: var(--fb-radius-lg);
    background: rgba(15,23,42,0.35);
    padding: 0.65rem;
}

.fb-details-card h4 {
    margin: 0 0 0.35rem 0;
    font-size: 0.85rem;
    color: rgba(226,232,240,0.95);
}

.fb-details-card .fb-muted {
    color: rgba(226,232,240,0.75);
    font-size: 0.8rem;
}

.fb-yourmove {
    border-color: rgba(249, 115, 22, 0.75);
    background: radial-gradient(circle at top, rgba(249, 115, 22, 0.14), rgba(15, 23, 42, 0.55));
}


/* Inputs & Buttons */

.fb-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.fb-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.fb-input {
    border-radius: var(--fb-radius-lg);
    border: 1px solid var(--fb-input-border);
    background: var(--fb-input-bg);
    color: var(--fb-text);
    padding: 0.45rem 0.7rem;
    font-size: 0.9rem;
    outline: none;
}

.fb-select {
    border-radius: var(--fb-radius-lg);
    border: 1px solid var(--fb-border);
    background: var(--fb-panel);
    color: var(--fb-text);
    padding: 0.45rem 0.7rem;
    font-size: 0.9rem;
    outline: none;
}


.fb-input:focus {
    border-color: var(--fb-accent-strong);
    box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.4);
}

.fb-textarea {
    min-height: 8rem;
    resize: vertical;
  font-size: 1.05rem;
}

.fb-btn {
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.98));
    color: var(--fb-text);
    font-size: 0.9rem;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    white-space: nowrap;
    transition: transform 0.08s ease, box-shadow 0.12s ease, background 0.12s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.fb-btn.primary {
    background: linear-gradient(135deg, var(--fb-accent), var(--fb-accent-strong));
    border-color: rgba(248, 250, 252, 0.05);
    color: #111827;
    font-weight: 600;
    box-shadow: 0 10px 22px rgba(248, 113, 22, 0.45);
}

.fb-btn.secondary {
    background: linear-gradient(135deg, #0f172a, #111827);
    border-color: rgba(148, 163, 184, 0.7);
}

.fb-btn.success {
    background: linear-gradient(135deg, #22c55e, #4ade80);
    border-color: rgba(248, 250, 252, 0.05);
    color: #052e16;
    font-weight: 600;
    box-shadow: 0 10px 22px rgba(34, 197, 94, 0.45);
}

.fb-btn.subtle {
    background: rgba(15, 23, 42, 0.85);
}

/* Backwards-compatible button classes used in templates */
.fb-btn.fb-btn-accent { background: linear-gradient(135deg, var(--fb-accent), var(--fb-accent-strong)); border-color: rgba(248, 250, 252, 0.05); color: #111827; font-weight: 600; }
.fb-btn.fb-btn-secondary { background: linear-gradient(135deg, #0f172a, #111827); border-color: rgba(148, 163, 184, 0.7); }
.fb-btn.ghost { background: rgba(15, 23, 42, 0.35); border-color: rgba(148, 163, 184, 0.45); }

/* Header game code styles */
.fb-code-label { font-size: 0.85rem; color: var(--fb-muted); margin-right: 0.35rem; }
.fb-code { display: inline-flex; align-items: center; justify-content: center; min-width: 6.2rem; padding: 0.25rem 0.6rem; border-radius: 0.65rem; border: 1px solid rgba(148, 163, 184, 0.35); background: rgba(15, 23, 42, 0.65); font-weight: 800; letter-spacing: 0.35rem; text-indent: 0.35rem; }

/* Question labels */
.fb-prefix { color: var(--fb-muted); font-weight: 700; }
.fb-fieldset-accent legend { color: var(--fb-accent2); }

/* Answer cards + meta */
.fb-answer-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.4rem; }

.fb-answer-meta-right { display: inline-flex; gap: 0.35rem; flex-wrap: wrap; margin-left: auto; }
.fb-chip { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.15rem 0.45rem; border-radius: 999px; border: 1px solid rgba(148, 163, 184, 0.35); background: rgba(15, 23, 42, 0.65); font-size: 0.78rem; color: rgba(248, 250, 252, 0.92); }
.fb-chip.success { border-color: rgba(34, 197, 94, 0.55); background: rgba(34, 197, 94, 0.15); }
.fb-chip.warn { border-color: rgba(251, 191, 36, 0.55); background: rgba(251, 191, 36, 0.13); }
.fb-chip-votes { border-color: rgba(251, 191, 36, 0.55); background: rgba(251, 191, 36, 0.13); }


.fb-btn:disabled {
    opacity: 0.5;
    cursor: default;
    box-shadow: none;
}

.fb-btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.9);
}

/* Grids */

.fb-controls-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.fb-answers-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
    margin-top: 0.3rem;
}

.fb-answer-card {
  background: var(--fb-tile-bg, rgba(255,255,255,0.06));
  border: 1px solid var(--fb-tile-border, var(--fb-border));
  border-radius: 14px;
  padding: 0.95rem 1.05rem;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
  color: var(--fb-tile-text, rgba(248,250,252,0.93));
  font: inherit;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  padding-top: 2.2rem;
  padding-bottom: 3.2rem;
  position: relative;
}

/* Reveal-phase highlight: the most recently revealed card */
.fb-answer-card.just-revealed {
  outline: 3px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.18), 0 10px 22px rgba(0, 0, 0, 0.28);
  transform: translateY(-1px);
}

/* Host-only drag reorder affordances for DISPLAYED answers */
.fb-answer-card.draggable {
  cursor: grab;
}

.fb-answer-card.dragging {
  opacity: 0.65;
  cursor: grabbing;
}

.fb-answer-card.selectable {
  cursor: pointer;
}

.fb-answer-card.selectable:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.22);
}

.fb-answer-card.displayed {
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow: 0 10px 28px rgba(34, 197, 94, 0.08);
}

.fb-answer-card.real {
    border-color: rgba(251, 191, 36, 0.9);
    box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.5), 0 18px 35px rgba(15, 23, 42, 0.95);
}

.fb-answer-card.selected {
    border-color: var(--fb-accent-strong);
    box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.7), 0 18px 32px rgba(15, 23, 42, 0.95);
}

.fb-answer-text {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
}

.fb-answer-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: rgba(226,232,240,0.86);
}

.fb-answer-meta > div {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
}

.fb-answer-selectedby {
  margin-top: 0.55rem;
  font-size: 0.78rem;
  color: rgba(226,232,240,0.82);
  border-top: 1px solid rgba(148,163,184,0.18);
  padding-top: 0.45rem;
}

.fb-chip {
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
}

.fb-chip-real {
    background: rgba(250, 204, 21, 0.2);
    color: #facc15;
}

.fb-chip-fake {
    background: rgba(96, 165, 250, 0.18);
    color: #93c5fd;
}

/* Timers & Status */

.fb-timer-row {
    display: flex;
    gap: 1.2rem;
    margin-top: 0.4rem;
}

.fb-timer span:last-child {
    display: block;
    font-size: 1.05rem;
}

.fb-host-status {
    margin-top: 0.6rem;
    font-size: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.fb-status {
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: var(--fb-accent-strong);
}

/* Scoreboard */

.fb-scoreboard {
    margin-top: 0.4rem;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.9), #020617);
    padding: 0.4rem 0.6rem;
    max-height: 260px;
    overflow-y: auto;
}

.fb-scoreboard.small {
    max-height: 200px;
}

.fb-score-row {
    display: grid;
    grid-template-columns: 1.3fr 0.9fr 0.9fr 1fr;
    gap: 0.5rem;
    padding: 0.25rem 0.3rem;
    border-radius: 0.6rem;
    align-items: baseline;
    font-size: 0.85rem;
}

.fb-score-row.header {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--fb-muted);
}

.fb-score-row.header span {
    border-bottom: 1px solid rgba(148, 163, 184, 0.4);
    padding-bottom: 0.15rem;
}

.fb-score-row.winner {
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.18), transparent);
}

.fb-score-row.me {
    border: 1px dashed rgba(251, 191, 36, 0.6);
}

/* Toggle & debug */

.fb-toggle {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    margin-top: 0.3rem;
}

.fb-toggle input {
    transform: scale(1.1);
}

.fb-debug-panel {
    margin-top: 0.4rem;
    max-height: 180px;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.95);
    border-radius: 0.6rem;
    border: 1px solid rgba(148, 163, 184, 0.4);
    padding: 0.45rem 0.55rem;
    font-size: 0.75rem;
    white-space: pre-wrap;
}

/* Player-specific */

.fb-join-grid {
    display: grid;
    grid-template-columns: 1.1fr 1.1fr auto;
    gap: 0.5rem;
}

.fb-topic {
    font-size: 0.9rem;
    color: var(--fb-accent-strong);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.25rem;
}

.fb-question {
    font-size: 1.05rem;
    line-height: 1.3;
}

.fb-phase-hint {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--fb-muted);
}

.fb-answer-section,
.fb-voting-section {
    margin-top: 0.35rem;
}

.fb-player-scoreboard {
    margin-top: 0.75rem;
}

/* Overlay */

.fb-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(18px);
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.25), rgba(15, 23, 42, 0.9));
    z-index: 40;
}

.fb-overlay.hidden {
    display: none;
}

.fb-overlay-content {
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.9), #020617);
    border-radius: 1.2rem;
    border: 1px solid rgba(148, 163, 184, 0.45);
    box-shadow: 0 24px 45px rgba(15, 23, 42, 0.9);
    padding: 1.1rem 1.3rem;
    max-width: 600px;
    width: 100%;
}

.fb-overlay-content h2 {
    margin-top: 0;
    margin-bottom: 0.4rem;
}

#overlayMessage {
    white-space: pre-wrap;
    line-height: 1.4;
}

/* Responsive */

@media (max-width: 960px) {
    .fb-header {
        flex-direction: column;
        align-items: stretch;
    }
    .fb-header-right {
        justify-content: space-between;
    }
    .host-layout .fb-main {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 720px) {
    .fb-root {
        padding: 0.6rem;
    }
    .fb-panel {
        padding: 0.85rem 0.8rem;
    }
    .fb-join-grid {
        grid-template-columns: 1fr;
    }
    .fb-answers-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .fb-score-row {
        grid-template-columns: 1.2fr 0.7fr 0.7fr 0.8fr;
    }
}

@media (max-width: 480px) {
    .fb-answers-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .fb-header-right {
        flex-direction: column;
        align-items: stretch;
    }
}


/* Landing page */
.fb-landing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .fb-landing-grid { grid-template-columns: 1fr; }
}

.fb-steps {
  margin: 0.65rem 0 1rem;
  padding-left: 1.25rem;
  color: rgba(226, 232, 240, 0.86);
  font-size: 0.88rem;
}

.fb-steps li {
  margin: 0.25rem 0;
}

.fb-hint {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.78);
}

.fb-footer {
  margin-top: 1.1rem;
  text-align: center;
}

/* Simple modal (About / Feedback) */
.fb-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(2, 6, 23, 0.75);
  backdrop-filter: blur(2px);
}

.fb-modal-card {
  width: min(720px, 100%);
  background: var(--fb-panel-bg);
  border-radius: var(--fb-radius-xl);
  border: 1px solid var(--fb-panel-border);
  box-shadow: var(--fb-card-shadow);
  padding: 1rem 1.1rem;
}

.fb-modal-title {
  margin: 0 0 0.65rem;
  font-size: 1.15rem;
  font-weight: 750;
}

.fb-modal-text {
  color: rgba(226, 232, 240, 0.9);
  font-size: 0.95rem;
  line-height: 1.45;
}

.fb-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.9rem;
  flex-wrap: wrap;
}

.fb-modal-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

@media (max-width: 680px) {
  .fb-modal-two-col { grid-template-columns: 1fr; }
}

.fb-modal-box {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: var(--fb-radius-lg);
  background: rgba(15, 23, 42, 0.35);
  padding: 0.75rem;
}

.fb-modal-box-title {
  font-weight: 700;
  color: rgba(248, 250, 252, 0.95);
  font-size: 0.95rem;
}

/* Host: use the same accent color for key labels as "Assign Different Host" */
.host-layout .fb-field label,
.host-layout .fb-fieldset legend,
.host-layout .fb-panel-title {
  color: var(--fb-accent2);
}

/* Fun button colors */
#btnCreateGame { background: linear-gradient(135deg, #22c55e, #16a34a); color: #06210f; }
#btnShowQuestion { background: linear-gradient(135deg, #38bdf8, #60a5fa); color: #081826; }
#btnSubmitRealAnswer { background: linear-gradient(135deg, #f472b6, #fb7185); color: #2b0c16; }
#btnStartVoting { background: linear-gradient(135deg, #fbbf24, var(--fb-accent)); color: #231407; }
#btnShuffleAnswers { background: linear-gradient(135deg, #a78bfa, #c084fc); color: #170a2b; }
#btnRevealNext { background: linear-gradient(135deg, #34d399, #10b981); color: #062114; }
#btnFinalizeRound { background: linear-gradient(135deg, #f87171, #ef4444); color: #2a0a0a; }
#btnNextQuestion { background: linear-gradient(135deg, #22c55e, #4ade80); color: #06210f; }
#btnRandomHost { background: linear-gradient(135deg, #94a3b8, #64748b); color: #0b1220; }
#btnSelectHost { background: linear-gradient(135deg, #e879f9, #a78bfa); color: #1d0b2b; }
/* Was a fixed sky-to-pink gradient, which fought both palettes.
   The primary action should wear whatever theme is on. */
#btnJoin { background: var(--fb-accent); color: var(--fb-on-accent, #0b1220); font-weight: 700; }
#btnJoin:hover:not(:disabled) { background: var(--fb-accent-strong); }
#submitAnswerBtn { background: linear-gradient(135deg, #fbbf24, #22c55e); color: #0b1220; }

#submitAnswerBtn:disabled,
#btnJoin:disabled,
.fb-btn:disabled {
  filter: grayscale(0.4);
}


/* --- Reveal coloring --- */
.fb-answer-card.revealed-fake {
  border-color: #ff3b3b !important;
  background: rgba(255, 59, 59, 0.10);
  /* Revealed cards paint their own translucent red/green over a dark
     ground, so they are no longer the theme's paper tile. Without
     this the fax theme kept its near-black tile text and the answer
     became unreadable the moment it was revealed. */
  color: var(--fb-text);
}
.fb-answer-card.revealed-real {
  border-color: #2ecc71 !important;
  background: rgba(46, 204, 113, 0.12);
  /* Revealed cards paint their own translucent red/green over a dark
     ground, so they are no longer the theme's paper tile. Without
     this the fax theme kept its near-black tile text and the answer
     became unreadable the moment it was revealed. */
  color: var(--fb-text);
}
/* Most recently displayed (presentation mode) */
.fb-answer-card.just-displayed {
  box-shadow: 0 0 0 2px rgba(255,255,255,0.85);
}
/* Most recently revealed (reveal phase) */
.fb-answer-card.just-revealed {
  box-shadow: 0 0 0 2px rgba(255,255,255,0.85);
}

/* Overlay action buttons */
.fb-overlay-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.fb-overlay-body {
  max-height: 65vh;
  overflow: auto;
}
.fb-score-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
}
.fb-score-table th, .fb-score-table td {
  border-bottom: 1px solid rgba(255,255,255,0.12);
  padding: 0.5rem 0.4rem;
  text-align: left;
  white-space: nowrap;
}
.fb-score-table th {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fb-score-table-eq th, .fb-score-table-eq td{
  vertical-align: middle;
}
.fb-score-num{
  text-align: right;
}
.fb-score-op{
  width: 34px;
  text-align: center !important;
  font-weight: 900;
  opacity: 0.85;
}
.fb-score-moved{
  text-align: center !important;
  font-weight: 900;
}
.fb-score-table th.fb-score-standout,
.fb-score-table td.fb-score-standout {
  background: rgba(255,255,255,0.08);
  font-weight: 900;
}
.fb-score-table td.fb-score-standout {
  border-right: 1px solid rgba(255,255,255,0.10);
}
.fb-score-title {
  font-weight: 900;
  text-transform: uppercase;
  margin-top: 0.25rem;
}


/* --- Gamble UI --- */
.fb-gamble-box{
  margin-top: 0.75rem;
  padding: 0.75rem;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 16px;
  background: rgba(255,255,255,0.03);
}
.fb-gamble-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:0.75rem;
}
.fb-gamble-title{
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 0.95rem;
}
.fb-gamble-panel{
  margin-top: 0.6rem;
}
.fb-gamble-grid{
  display:flex;
  flex-direction:column;
  gap:0.5rem;
}
.fb-gamble-row{
  display:flex;
  gap:0.5rem;
  align-items:center;
}
.fb-gamble-row .fb-gamble-label{
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.95rem;
}


.fb-gamble-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  font-size:0.78rem;
  line-height:1;
  padding:0.22rem 0.55rem;
  border-radius:999px;
  border:1px solid rgba(34, 197, 94, 0.65);
  background: rgba(34, 197, 94, 0.14);
  color: rgba(34, 197, 94, 0.98);
}

.fb-gamble-badge-plus{
  border-color: rgba(34, 197, 94, 0.65);
  background: rgba(34, 197, 94, 0.14);
  color: rgba(34, 197, 94, 0.98);
}
.fb-gamble-badge-minus{
  border-color: rgba(239, 68, 68, 0.65);
  background: rgba(239, 68, 68, 0.12);
  color: rgba(239, 68, 68, 0.98);
}
.fb-gamble-row select{
  flex: 0 0 12rem;
  max-width: 12rem;
}
@media (max-width: 520px){
  .fb-gamble-row{
    flex-direction: column;
    align-items: stretch;
  }
  .fb-gamble-row select{
    max-width: 100%;
    flex: 1 1 auto;
  }
}

.fb-row-compact{
  gap:0.5rem;
  align-items:center;
  flex-wrap:wrap;
}

.fb-row-tight{
  gap:0.6rem;
  align-items:center;
  flex-wrap:wrap;
}

.fb-radio{
  display:flex;
  align-items:center;
  gap:0.45rem;
  font-weight:600;
  opacity:0.95;
}

.fb-inline-label{
  font-size:0.95rem;
  opacity:0.9;
}
.fb-input-small{
  max-width:5.5rem;
}


.fb-gamble-controls{
  display:flex;
  flex-direction:column;
  gap:0.35rem;
  margin-bottom:0.5rem;
}
.fb-checkbox{
  display:flex;
  align-items:center;
  gap:0.5rem;
  font-size:0.95rem;
  opacity:0.95;
}
.fb-gamble-summary{
  font-size:0.95rem;
  line-height:1.25;
}
.fb-gamble-result{
  font-weight:900;
  margin-left:0.5rem;
}
.fb-gamble-result-pos{ color: var(--fb-success); }
.fb-gamble-result-neg{ color: var(--fb-danger); }
.fb-gamble-own{
  font-weight:900;
  opacity:0.95;
}

/* Ensure Question Bank category dropdown text is readable (native select option lists can inherit low-contrast colors). */
#bankCategory {
    color: #000;
    background: #fff;
}
#bankCategory option {
    color: #000;
}

/* --- Voting switch (players) --- */
.fb-vote-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  user-select: none;
}

.fb-vote-switch input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.fb-vote-switch .fb-switch {
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  border: 1px solid rgba(148, 163, 184, 0.35);
  position: relative;
  flex: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.fb-vote-switch .fb-switch::before {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  background: rgba(248, 250, 252, 0.9);
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
  transition: transform 140ms ease, background 140ms ease;
}

.fb-vote-switch input[type="radio"]:checked + .fb-switch {
  background: rgba(34, 197, 94, 0.22);
  border-color: rgba(34, 197, 94, 0.65);
}

.fb-vote-switch input[type="radio"]:checked + .fb-switch::before {
  transform: translateX(22px);
  background: rgba(34, 197, 94, 0.95);
}

/* --- Toggle switch (GAMBLE) --- */
.fb-toggle-switch{
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  user-select: none;
}
.fb-toggle-switch input[type="checkbox"]{
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.fb-toggle-switch .fb-switch{
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: rgba(250, 204, 21, 0.12);
  border: 1px solid rgba(250, 204, 21, 0.38);
  position: relative;
  flex: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
.fb-toggle-switch .fb-switch::before{
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  background: rgba(248, 250, 252, 0.92);
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
  transition: transform 140ms ease, background 140ms ease;
}
.fb-toggle-switch .fb-toggle-label{
  font-weight: 900;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: rgba(250, 204, 21, 0.96);
}
.fb-toggle-switch input[type="checkbox"]:checked + .fb-switch{
  background: rgba(34, 197, 94, 0.22);
  border-color: rgba(34, 197, 94, 0.65);
}
.fb-toggle-switch input[type="checkbox"]:checked + .fb-switch::before{
  transform: translateX(22px);
  background: rgba(34, 197, 94, 0.95);
}
.fb-toggle-switch input[type="checkbox"]:checked ~ .fb-toggle-label{
  color: rgba(34, 197, 94, 0.96);
}
.fb-toggle-switch input[type="checkbox"]:disabled + .fb-switch,
.fb-toggle-switch input[type="checkbox"]:disabled ~ .fb-toggle-label{
  opacity: 0.6;
}

.fb-vote-label {
  font-weight: 900;
  letter-spacing: 0.04em;
  font-size: 0.78rem;
  color: rgba(250, 204, 21, 0.96);
}


.fb-vote-controls.picked .fb-vote-label {
  color: rgba(34, 197, 94, 0.96);
}

.fb-vote-controls.disabled {
  opacity: 0.72;
}
.fb-vote-label:empty {
  display: none;
}


/* --- Player voting tile overlays --- */
.fb-answer-number{
  position:absolute;
  top:0.45rem;
  left:0.45rem;
  font-weight:800;
  font-size:0.85rem;
  line-height:1;
  padding:0.25rem 0.45rem;
  border-radius:10px;
  border:1px solid var(--line);
  background: rgba(255,255,255,0.06);
}

.fb-vote-controls{
  position:absolute;
  top:0.45rem;
  right:0.45rem;
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:0.25rem;
}

.fb-card-gamble{
  position:absolute;
  left:0.75rem;
  right:0.75rem;
  bottom:0.55rem;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:0.4rem;
  padding-top:0.55rem;
  border-top:1px solid rgba(255,255,255,0.14);
}

.fb-gamble-label{
  font-size:0.75rem;
  opacity:0.85;
}

/* --- Answer submit UX --- */
.fb-answer-section{
  margin-top:0.75rem;
}

.fb-answer-actions{
  margin-top:0.65rem;
  display:flex;
}

.fb-answer-actions .fb-btn{
  width:100%;
  padding:0.9rem 1rem;
  font-size:1rem;
}

.fb-answer-collapsed{
  border:1px dashed var(--line);
  border-radius:14px;
  padding:0.75rem;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:0.75rem;
}

.fb-answer-collapsed-text{
  font-weight:700;
}

@media (min-width: 720px){
  .fb-answer-actions{
    justify-content:flex-start;
  }
  .fb-answer-actions .fb-btn{
    width:auto;
  }
}


/* Player reveal: gamble line at bottom of tile */
.fb-answer-gambleline { margin-top: 0.35rem; font-size: 0.78rem; color: rgba(226,232,240,0.82); display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.fb-answer-gamblepts { font-weight: 900; letter-spacing: 0.02em; }
.fb-answer-gamblepts-plus { color: #22c55e; }
.fb-answer-gamblepts-minus { color: #ef4444; }

/* Player reveal: gamblers list at bottom of tile */
.fb-answer-gamblersline{ margin-top: 0.35rem; font-size: 0.78rem; color: rgba(226,232,240,0.82); display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }
.fb-answer-gamblerslabel{ font-weight: 900; letter-spacing: 0.02em; }
.fb-gambler{ font-weight: 900; letter-spacing: 0.01em; }
.fb-gambler-correct{ color: #22c55e; }
.fb-gambler-wrong{ color: #ef4444; }

/* --- Player header join revamp --- */
.fb-player-header{
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:0.85rem;
}

.fb-player-header-top{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:0.75rem;
}

.fb-player-header-cards{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:0.9rem;
}

@media (max-width: 560px){
  .fb-player-header-cards{ grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .fb-header-input{ font-size: 0.95rem; letter-spacing: 0.08em; }
  .fb-header-card .label{ font-size: 0.68rem; }
  .fb-player-header-top{ align-items:center; }
}

.fb-header-change{
  white-space:nowrap;
}

.fb-header-input{
  width:100%;
  text-align:center;
  font-weight:700;
  letter-spacing:0.1em;
}

.fb-header-join-actions{
  display:flex;
  flex-direction:column;
  gap:0.6rem;
}

.fb-btn-join-fat{
  width:100%;
  padding:0.95rem 1rem;
  font-size:1.05rem;
  font-weight:800;
}

.fb-lock-row{
  display:flex;
  flex-direction:column;
  gap:0.5rem;
  margin-top:0.25rem;
}

.fb-gamble-prompt{
  font-size:0.85rem;
  opacity:0.85;
  margin-right:0.5rem;
  white-space:nowrap;
}


/* ---------------------------
   Host floating action button
---------------------------- */
.fb-floatbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  z-index: 9999;
  pointer-events: none;
}

.fb-floatbar-btn {
  pointer-events: auto;
  width: min(560px, calc(100% - 24px));
  font-size: 1.05rem;
  padding: 16px 18px;
  border-radius: 999px;
}

.fb-has-floatbar {
  padding-bottom: 92px;
}



/* Button toggle state */
.fb-btn.is-on{
  filter: brightness(1.12);
}


/* Host Wizard / Invite Bar */

.fb-host-main {
    max-width: 980px;
    margin: 0 auto;
}

.fb-invitebar {
    position: sticky;
    top: 0;
    z-index: 80;
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    border-radius: var(--fb-radius-xl);
    border: 1px solid rgba(249, 115, 22, 0.5);
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(10px);
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.95), var(--fb-shadow-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.fb-invite-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.fb-invite-kicker {
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(248, 250, 252, 0.78);
}

.fb-invite-code-row {
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
}

.fb-invite-code-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(248, 250, 252, 0.86);
}

.fb-invite-code {
    font-size: clamp(1.55rem, 4vw, 2.4rem);
    font-weight: 900;
    letter-spacing: 0.3em;
    text-indent: 0.3em;
    color: rgba(248, 250, 252, 0.98);
    text-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.fb-invite-hint {
    font-size: 0.85rem;
    color: rgba(226, 232, 240, 0.78);
}

.fb-invite-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.55rem;
}

.fb-invite-status {
    min-width: 8rem;
    font-size: 0.82rem;
    color: rgba(226, 232, 240, 0.78);
}

.fb-stepper {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.fb-step {
    background: var(--fb-panel-bg);
    border-radius: var(--fb-radius-xl);
    border: 1px solid var(--fb-panel-border);
    box-shadow: var(--fb-card-shadow);
    overflow: hidden;
}

.fb-step > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
    padding: 1rem 1.1rem;
    user-select: none;
}

.fb-step > summary::-webkit-details-marker {
    display: none;
}

.fb-step-title {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.fb-step-badge {
    width: 2.15rem;
    height: 2.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(249, 115, 22, 0.5);
    background: rgba(249, 115, 22, 0.14);
    font-weight: 900;
    color: rgba(248, 250, 252, 0.95);
}

.fb-step-name {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
}

.fb-step-sub {
    font-size: 0.85rem;
    color: rgba(226, 232, 240, 0.72);
    margin: 0.1rem 0 0;
}

.fb-step-chevron {
    color: rgba(226, 232, 240, 0.7);
}

.fb-step.fb-step-active > summary {
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(249, 115, 22, 0.06);
}

.fb-step-body {
    padding: 0.2rem 1.1rem 1.1rem;
}

.fb-step-note {
    margin: 0.25rem 0 0.85rem;
    font-size: 0.9rem;
    color: rgba(226, 232, 240, 0.76);
}

.fb-step-nav {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.85rem;
}

.fb-panel-sublabel {
    margin: 0.85rem 0 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: rgba(226, 232, 240, 0.88);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.fb-players-list {
    display: grid;
    gap: 0.45rem;
}

.fb-player-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.7rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.35);
}

.fb-player-name {
    font-weight: 600;
    color: rgba(248, 250, 252, 0.92);
}

.fb-player-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: rgba(226, 232, 240, 0.7);
    font-size: 0.85rem;
}

.fb-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.45);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.fb-chip-host {
    border-color: rgba(249, 115, 22, 0.45);
    background: rgba(249, 115, 22, 0.14);
    color: rgba(255, 237, 213, 0.98);
}

@media (max-width: 720px) {
    .fb-invitebar {
        flex-direction: column;
        align-items: stretch;
    }
    .fb-invite-actions {
        justify-content: flex-start;
    }
    .fb-invite-status {
        min-width: 0;
    }
}
