/* Fib Fact – all rules are scoped to .fibfact so the game looks the same in any theme. */

.fibfact {
  --ff-bg: #141a2e;
  --ff-bg-2: #1b2340;
  --ff-panel: #222b4a;
  --ff-ink: #f4f6fb;
  --ff-muted: #a3abc4;
  --ff-line: #0d1020;
  --ff-fib: #ffc21a;
  --ff-fact: #2f7bff;
  --ff-good: #3ddc84;
  --ff-bad: #ff5d6c;
  --ff-radius: 18px;

  position: relative;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 0 8px;
  border-radius: 24px;
  background: radial-gradient(120% 80% at 50% 0%, var(--ff-bg-2), var(--ff-bg));
  color: var(--ff-ink);
  font-family: Rubik, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.4;
  text-align: left;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.fibfact *, .fibfact *::before, .fibfact *::after { box-sizing: border-box; }
.fibfact [hidden] { display: none !important; }
.fibfact p, .fibfact h2, .fibfact ul, .fibfact ol { margin: 0; }
/* Bold text takes its colour from its container, even if the theme colours <b>/<strong>. */
.fibfact.fibfact b, .fibfact.fibfact strong { color: inherit; }
.fibfact h2 { font-family: inherit; color: inherit; }

/* Neutralise theme button/input styles */
.fibfact button {
  -webkit-appearance: none; appearance: none;
  font-family: inherit; font-size: inherit; line-height: 1.2; color: inherit;
  margin: 0; min-height: 0; min-width: 0; width: auto;
  text-transform: none; letter-spacing: normal; text-decoration: none; text-shadow: none;
  background-image: none; cursor: pointer;
}
.fibfact button:focus-visible { outline: 3px solid var(--ff-fact); outline-offset: 3px; }
.fibfact input[type="text"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; min-width: 0; margin: 0; height: auto; box-shadow: none;
  font-family: inherit; font-size: 17px; line-height: 1.2; color: var(--ff-ink);
  background: var(--ff-bg); border: 3px solid var(--ff-line); border-radius: 12px;
  padding: 11px 12px;
}
.fibfact input[type="text"]:focus { outline: 3px solid var(--ff-fact); outline-offset: 1px; border-color: var(--ff-line); }
.fibfact input::placeholder { color: var(--ff-muted); opacity: .7; }

/* ---------- ad banner ---------- */
.ff-ad-band { display: flex; justify-content: center; padding: 12px 16px 0; }
.ff-ad-slot {
  width: 320px; height: 50px; max-width: 100%;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.ff-ad-placeholder {
  width: 100%; height: 100%; padding: 0 8px; text-align: center;
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed rgba(163, 171, 196, .35); border-radius: 8px;
  color: var(--ff-muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
}
@media (min-width: 768px) { .ff-ad-slot { width: 728px; height: 90px; } }

/* ---------- mute button ---------- */
.fibfact .ff-mute {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  width: 42px; height: 42px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--ff-panel); color: var(--ff-ink);
  border: 3px solid var(--ff-line); border-radius: 50%;
  box-shadow: 0 3px 0 var(--ff-line);
  transition: transform .08s, box-shadow .08s, color .15s;
}
.fibfact .ff-mute:hover { color: var(--ff-fib); }
.fibfact .ff-mute:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ff-line); }
.fibfact .ff-mute .ff-ico-off { display: none; }
.fibfact .ff-mute.ff-muted { color: var(--ff-muted); }
.fibfact .ff-mute.ff-muted .ff-ico-on { display: none; }
.fibfact .ff-mute.ff-muted .ff-ico-off { display: block; }
.fibfact .ff-mute svg { width: 22px; height: 22px; }
.fibfact .ff-app:has(.ff-mute:not([hidden])) .ff-hud { padding-right: 50px; }

/* ---------- layout ---------- */
.ff-app { position: relative; width: 100%; max-width: 560px; margin: 0 auto; padding: 18px 16px 28px; }
.ff-screen { display: flex; flex-direction: column; align-items: center; gap: 18px; }

.ff-logo { width: min(280px, 72vw); cursor: pointer; }
.ff-logo-lg { width: min(400px, 88vw); margin-top: 8px; }
.ff-tagline { font-size: 20px; font-weight: 600; color: var(--ff-muted); text-align: center; }
.ff-t-fib { color: var(--ff-fib); } .ff-t-fact { color: var(--ff-fact); }

.fibfact .ff-back {
  align-self: flex-start; background: none; border: 0; padding: 4px 0;
  color: var(--ff-muted); font-weight: 600;
}
.fibfact .ff-link {
  background: none; border: 0; padding: 4px; color: var(--ff-muted);
  text-decoration: underline; font-weight: 600; align-self: center;
}

/* ---------- home ---------- */
.ff-modes { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fibfact .ff-mode {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left;
  padding: 18px; border-radius: var(--ff-radius);
  background: var(--ff-panel); border: 4px solid var(--ff-line); box-shadow: 0 5px 0 var(--ff-line);
  transition: transform .08s, box-shadow .08s;
}
.fibfact .ff-mode:first-child { border-top: 8px solid var(--ff-fib); }
.fibfact .ff-mode:last-child { border-top: 8px solid var(--ff-fact); }
.ff-mode b { font-size: 22px; font-weight: 900; }
.ff-mode small { font-size: 14px; color: var(--ff-muted); }
.fibfact .ff-mode:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ff-line); }
@media (max-width: 460px) { .ff-modes { grid-template-columns: 1fr; } }

/* ---------- panels ---------- */
.ff-panel {
  width: 100%; background: var(--ff-panel); border: 4px solid var(--ff-line); border-radius: var(--ff-radius);
  padding: 18px 18px 20px; display: flex; flex-direction: column; gap: 12px;
}
.fibfact .ff-panel h2 {
  margin: 4px 0 0; font-size: 13px; font-weight: 600; line-height: 1.3;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ff-muted);
}
.ff-seg { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.ff-seg-4 { grid-template-columns: repeat(4, 1fr); }
.ff-diffs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fibfact .ff-seg button, .fibfact .ff-diffs button {
  background: var(--ff-bg); border: 3px solid var(--ff-line); border-radius: 14px;
  padding: 12px 8px; font-weight: 600; color: var(--ff-ink);
}
.fibfact .ff-seg button[aria-pressed="true"], .fibfact .ff-diffs button[aria-pressed="true"] { background: var(--ff-ink); color: var(--ff-bg); }
.fibfact .ff-diffs button { display: flex; flex-direction: column; gap: 2px; align-items: center; }
.ff-diffs b { font-weight: 900; font-size: 18px; }
.ff-diffs small { font-size: 12px; opacity: .75; }
.fibfact .ff-diffs button:disabled { opacity: .35; cursor: not-allowed; }

.ff-names { display: grid; gap: 8px; }
.ff-names label { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ff-muted); white-space: nowrap; }
.ff-hint { text-align: center; color: var(--ff-muted); font-size: 14px; }
.ff-error { text-align: center; color: var(--ff-bad); font-weight: 600; }

.ff-join { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.fibfact .ff-code-input { text-transform: uppercase; font-weight: 900; font-size: 24px; letter-spacing: .3em; text-align: center; }
.fibfact .ff-join .ff-btn { padding: 10px 22px; font-size: 18px; }
.ff-or { display: flex; align-items: center; gap: 10px; color: var(--ff-muted); font-size: 13px; margin: 6px 0 -2px; }
.ff-or::before, .ff-or::after { content: ""; flex: 1; height: 2px; background: var(--ff-line); }

/* ---------- buttons ---------- */
.fibfact .ff-btn {
  border: 4px solid var(--ff-line); border-radius: 999px;
  padding: 14px 26px; font-weight: 900; font-size: 20px;
  box-shadow: 0 5px 0 var(--ff-line);
  transition: transform .08s, box-shadow .08s, filter .15s, opacity .2s;
}
.fibfact .ff-btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--ff-line); }
.fibfact .ff-btn:disabled { cursor: default; }
.fibfact .ff-btn-go { background: var(--ff-ink); color: var(--ff-bg); }
.fibfact .ff-btn-go:disabled { opacity: .45; }
.fibfact .ff-btn-plain { background: transparent; color: var(--ff-ink); box-shadow: none; border-color: var(--ff-muted); font-size: 17px; padding: 10px 20px; align-self: center; }
.fibfact .ff-btn-plain-strong { background: var(--ff-bg); color: var(--ff-ink); }
.fibfact .ff-panel > .ff-btn-go, .fibfact .ff-panel > .ff-btn-plain-strong { margin-top: 6px; }

/* ---------- lobby ---------- */
.ff-code { display: flex; justify-content: center; gap: 8px; }
.ff-code span {
  width: 52px; height: 64px; display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 900; background: var(--ff-ink); color: var(--ff-bg);
  border: 4px solid var(--ff-line); border-radius: 12px; box-shadow: 0 4px 0 var(--ff-line);
}
@media (max-width: 380px) { .ff-code span { width: 44px; height: 56px; font-size: 30px; } }
.ff-player-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.ff-player-list li {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--ff-bg); border: 3px solid var(--ff-line); border-radius: 12px; font-weight: 600;
  animation: ff-rise .3s ease;
}
.ff-player-list .ff-you { color: var(--ff-muted); font-weight: 400; font-size: 14px; }
.ff-player-list .ff-host { margin-left: auto; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--ff-fib); font-weight: 900; }
.ff-player-list li.ff-away { opacity: .45; }
.ff-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ff-good); flex: none; }
.ff-away .ff-dot { background: var(--ff-muted); }

/* ---------- play ---------- */
.ff-hud { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.ff-hud-left { display: flex; align-items: center; gap: 10px; color: var(--ff-muted); font-weight: 600; }
.ff-badge { text-transform: uppercase; font-size: 12px; letter-spacing: .1em; font-weight: 900; padding: 4px 10px; border-radius: 999px; background: var(--ff-ink); color: var(--ff-bg); }
.ff-scores { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ff-score {
  display: flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  background: var(--ff-panel); border: 3px solid var(--ff-line); font-weight: 600; font-size: 15px;
  transition: border-color .2s, transform .2s;
}
.ff-score b { font-weight: 900; font-size: 17px; }
.ff-score.ff-active { border-color: var(--ff-ink); transform: scale(1.05); }
.ff-score.ff-me { border-color: var(--ff-muted); }
.ff-score .ff-tick { color: var(--ff-good); font-weight: 900; }
.ff-score.ff-bump b { animation: ff-bump .45s ease; }
@keyframes ff-bump { 40% { transform: scale(1.5); color: var(--ff-good); } }

.ff-progress-bar { width: 100%; height: 8px; background: var(--ff-panel); border-radius: 99px; overflow: hidden; margin-top: -8px; }
.ff-progress-bar span { display: block; height: 100%; width: 0; background: var(--ff-ink); border-radius: 99px; transition: width .4s ease; }

.ff-turn { font-weight: 900; font-size: 20px; }
.ff-timer { position: relative; width: 100%; height: 28px; background: var(--ff-panel); border: 3px solid var(--ff-line); border-radius: 99px; overflow: hidden; }
.ff-timer span { position: absolute; inset: 0 auto 0 0; width: 100%; background: linear-gradient(90deg, var(--ff-fib), var(--ff-fact)); transition: width .25s linear; }
.ff-timer b { position: relative; display: block; text-align: center; line-height: 22px; font-weight: 900; color: var(--ff-ink); text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.ff-timer.ff-low span { background: var(--ff-bad); }

.ff-card { width: 100%; background: var(--ff-panel); border: 4px solid var(--ff-line); border-radius: var(--ff-radius); padding: 18px 20px; text-align: center; }
.ff-label { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ff-muted); font-weight: 600; }
.fibfact .ff-q-text { margin: 6px 0 16px; font-size: 21px; font-weight: 600; line-height: 1.3; }
.fibfact .ff-a-text { margin: 6px 0 0; font-size: 28px; font-weight: 900; line-height: 1.2; }

.ff-choices { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fibfact .ff-choices .ff-btn { font-size: 30px; padding: 16px 10px; display: flex; justify-content: center; align-items: center; gap: 10px; }
.fibfact .ff-btn-fib  { background: linear-gradient(#ffe066, var(--ff-fib)); color: var(--ff-line); }
.fibfact .ff-btn-fact { background: linear-gradient(#5fb0ff, var(--ff-fact)); color: #fff; }
.ff-btn kbd { font: 600 13px Rubik, system-ui, sans-serif; background: none; color: inherit; box-shadow: none; border: 2px solid currentColor; border-radius: 6px; padding: 0 5px; opacity: .55; }
@media (hover: none) { .ff-btn kbd { display: none; } }
.fibfact .ff-choices .ff-btn:hover:not(:disabled) { filter: brightness(1.08); }
.ff-choices.ff-locked .ff-btn { opacity: .35; }
.fibfact .ff-choices.ff-locked .ff-btn.ff-picked { opacity: 1; outline: 4px solid var(--ff-ink); outline-offset: 3px; }

.ff-waiting { color: var(--ff-muted); font-weight: 600; text-align: center; }

.ff-reveal { width: 100%; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; animation: ff-rise .35s ease; }
@keyframes ff-rise { from { opacity: 0; transform: translateY(10px); } }
.ff-verdict { font-size: 32px; font-weight: 900; line-height: 1.15; }
.ff-verdict.ff-good { color: var(--ff-good); } .ff-verdict.ff-bad { color: var(--ff-bad); } .ff-verdict.ff-neutral { color: var(--ff-ink); }
.ff-truth { font-size: 19px; font-weight: 600; }
.ff-tag { font-weight: 900; padding: 1px 10px; border-radius: 8px; border: 3px solid var(--ff-line); }
.ff-tag.ff-fib { background: var(--ff-fib); color: var(--ff-line); }
.ff-tag.ff-fact { background: var(--ff-fact); color: #fff; }
.ff-real { padding: 8px 16px; border-radius: 14px; background: var(--ff-panel); border: 3px solid var(--ff-fib); font-size: 19px; }
.ff-real b { font-weight: 900; font-size: 22px; }
.ff-note { color: var(--ff-muted); max-width: 440px; }
.ff-who { list-style: none; padding: 0; width: 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.ff-who li { padding: 4px 10px; border-radius: 999px; background: var(--ff-panel); border: 2px solid var(--ff-line); font-size: 14px; font-weight: 600; }
.ff-who .ff-ok { color: var(--ff-good); } .ff-who .ff-no { color: var(--ff-bad); } .ff-who .ff-none { color: var(--ff-muted); }
.fibfact .ff-reveal .ff-btn { margin-top: 8px; }

/* ---------- results ---------- */
.fibfact .ff-headline { font-size: 34px; font-weight: 900; text-align: center; line-height: 1.15; }
.ff-final-scores { width: 100%; display: grid; gap: 10px; }
.ff-final { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--ff-panel); border: 4px solid var(--ff-line); border-radius: var(--ff-radius); padding: 14px 18px; font-size: 20px; font-weight: 600; }
.ff-final b { font-size: 30px; font-weight: 900; }
.ff-final.ff-winner { border-color: var(--ff-fib); }
.ff-final small { display: block; font-size: 14px; color: var(--ff-muted); font-weight: 400; }
.ff-place { color: var(--ff-muted); font-weight: 900; margin-right: 8px; }
.ff-result-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.ff-review { width: 100%; background: var(--ff-panel); border: 4px solid var(--ff-line); border-radius: var(--ff-radius); padding: 12px 18px; }
.ff-review summary { cursor: pointer; font-weight: 600; }
.fibfact .ff-review ol { padding-left: 20px; margin: 12px 0 0; display: grid; gap: 10px; }
.ff-review .ff-r-meta { display: block; font-size: 14px; color: var(--ff-muted); }
.ff-review .ff-ok { color: var(--ff-good); font-weight: 900; } .ff-review .ff-no { color: var(--ff-bad); font-weight: 900; }

/* ---------- toast ---------- */
.ff-toast {
  position: sticky; bottom: 12px; margin: 12px auto 0; width: fit-content; max-width: 90%;
  background: var(--ff-ink); color: var(--ff-bg); font-weight: 600;
  padding: 10px 16px; border-radius: 12px; border: 3px solid var(--ff-line);
  box-shadow: 0 4px 0 var(--ff-line);
}

@media (max-width: 420px) {
  .fibfact .ff-q-text { font-size: 18px; }
  .fibfact .ff-a-text { font-size: 24px; }
  .fibfact .ff-choices .ff-btn { font-size: 26px; }
  .ff-seg-4 { grid-template-columns: repeat(4, 1fr); }
}
