/* TriviaFeed player UI — adapted from the trivia3 stylesheet. Class prefix:
   tf-. Text-first: layout is designed around a big colorful question card
   and large answer buttons; images are optional garnish.

   THEMES: each .tf-theme-* class only overrides the CSS variables below
   (card / answer / accent / progress colors). No per-quiz layouts. */

:root {
  --ink: #1a1f2b;
  --paper: #f6f5f1;
  --card: #ffffff;
  --line: #d9d5cb;
  --muted: #6d7686;
  --bad: #c0392b;
  --good: #1e8a55;
  /* theme-controlled */
  --accent: #4b5cc4;
  --accent-dark: #37459c;
  --qcard-bg: linear-gradient(135deg, #4b5cc4, #6c7ae0);
  --qcard-ink: #ffffff;
  --option-border: #c9cede;
  --option-key: #4b5cc4;
  --progress: #4b5cc4;
  --kicker: #4b5cc4;
}

/* ---- color themes (general, movies/tv, history, science, sports, cars,
       geography, kids, personality) ---- */

.tf-theme-general {}

.tf-theme-movies-tv {
  --accent: #8e2ec4; --accent-dark: #6a1f96;
  --qcard-bg: linear-gradient(135deg, #431060, #8e2ec4);
  --option-key: #8e2ec4; --progress: #b04ae0; --kicker: #8e2ec4;
  --option-border: #d8c4e8;
}
.tf-theme-history {
  --accent: #9c6b1f; --accent-dark: #7a5318;
  --qcard-bg: linear-gradient(135deg, #5c3d12, #9c6b1f);
  --option-key: #9c6b1f; --progress: #c08a2e; --kicker: #9c6b1f;
  --option-border: #e0d3bb;
}
.tf-theme-science {
  --accent: #0e7c8a; --accent-dark: #0a5c66;
  --qcard-bg: linear-gradient(135deg, #083f46, #0e7c8a);
  --option-key: #0e7c8a; --progress: #16a2b4; --kicker: #0e7c8a;
  --option-border: #bcdce0;
}
.tf-theme-sports {
  --accent: #1e8a3c; --accent-dark: #166a2e;
  --qcard-bg: linear-gradient(135deg, #0f4a20, #1e8a3c);
  --option-key: #1e8a3c; --progress: #27ae4e; --kicker: #1e8a3c;
  --option-border: #c0dfc9;
}
.tf-theme-cars {
  --accent: #c0392b; --accent-dark: #962d22;
  --qcard-bg: linear-gradient(135deg, #611d16, #c0392b);
  --option-key: #c0392b; --progress: #e04836; --kicker: #c0392b;
  --option-border: #e8c6c1;
}
.tf-theme-geography {
  --accent: #1f6bb0; --accent-dark: #175284;
  --qcard-bg: linear-gradient(135deg, #0e3a63, #1f6bb0);
  --option-key: #1f6bb0; --progress: #2e86d4; --kicker: #1f6bb0;
  --option-border: #c1d8ec;
}
.tf-theme-kids {
  --accent: #e67e22; --accent-dark: #b8641b;
  --qcard-bg: linear-gradient(135deg, #e67e22, #f5b041);
  --qcard-ink: #2b1a05;
  --option-key: #e67e22; --progress: #f39c12; --kicker: #e67e22;
  --option-border: #f4d7b8;
}
.tf-theme-personality {
  --accent: #c2337a; --accent-dark: #96275e;
  --qcard-bg: linear-gradient(135deg, #5e1039, #c2337a);
  --option-key: #c2337a; --progress: #e0499a; --kicker: #c2337a;
  --option-border: #ecc4d9;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
}

img { max-width: 100%; height: auto; display: block; }

[hidden] { display: none !important; }

a { color: var(--accent); }

/* Top bar */
.tf-topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: var(--ink);
  color: #fff;
}
.tf-brand {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  text-decoration: none;
}
.tf-brand em { font-style: normal; color: var(--progress); }
.tf-tagline {
  font-size: 0.75rem;
  color: #b9c2d0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

/* Score bar + progress */
.tf-scorebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.tf-scorebar-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}
.tf-scorebar-stats { color: var(--muted); white-space: nowrap; }
.tf-scorebar-stats span { color: var(--ink); font-weight: 700; }
.tf-streak-flame { font-size: 0.85rem; }

.tf-progress {
  height: 6px;
  background: #e4e1d8;
}
.tf-progress-fill {
  height: 100%;
  background: var(--progress);
  transition: width 250ms ease;
}

/* Layout */
.tf-shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 16px;
}
.tf-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
}
.tf-center { text-align: center; }

.tf-title { font-size: 1.7rem; line-height: 1.25; margin: 0 0 6px; }
.tf-facts { color: var(--muted); font-size: 0.9rem; margin: 0 0 16px; }
.tf-desc { margin: 16px 0; }

.tf-cover {
  margin: 0 0 18px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.tf-cover img { width: 100%; object-fit: cover; max-height: 420px; }

/* Buttons */
.tf-btn {
  display: inline-block;
  padding: 10px 26px;
  border: 2px solid var(--accent-dark);
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}
.tf-btn:hover { background: var(--accent-dark); transform: translateY(-1px); }
.tf-btn-big { padding: 14px 42px; font-size: 1.25rem; }
.tf-btn-alt { background: #fff; color: var(--accent-dark); }
.tf-btn-alt:hover { background: #f0f1f8; color: #fff; }
.tf-start-actions { text-align: center; margin: 22px 0; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Ads — reserved heights and sticky behavior are part of the retained
   monetization contract (minimize layout shift). */
.tf-ad-box {
  position: relative;
  margin: 18px 0;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #faf9f5;
  padding: 20px 8px 10px;
  text-align: center;
  min-height: 110px;
}
.tf-ad-label {
  position: absolute;
  top: 4px;
  left: 0;
  right: 0;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.tf-ad-label-under { padding: 10px 8px 20px; }
.tf-ad-label-under .tf-ad-label { top: auto; bottom: 4px; }
.tf-ad-dark { background: #232a35; border-color: #3a4455; }
.tf-ad-tall .tf-ad-slot {
  position: sticky;
  top: 96px;
}
.tf-ad-box > div[id^="ezoic-pub-ad-placeholder"],
.tf-ad-slot > div[id^="ezoic-pub-ad-placeholder"] { margin: 0 auto; }
/* Smart slot sizing: once a creative renders (or a slot reports no-fill),
   JS collapses the reserved box to hug the actual content — the min-height
   reserve only applies while an ad is loading. */
.tf-ad-box.tf-ad-fitted { min-height: 0; }
.tf-ad-box.tf-ad-fitted .tf-ad-slot { min-height: 0; }

/* AJAX transition overlay: honest loading state while the ad-exposure gate
   holds the next question (spinner + text, no fake countdown). */
.tf-qcard { position: relative; }
.tf-qload {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(26, 31, 43, 0.72);
  color: #fff;
  font-weight: 700;
  border-radius: 16px;
  z-index: 5;
}
.tf-spin {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: tf-spin 0.8s linear infinite;
}
@keyframes tf-spin { to { transform: rotate(360deg); } }

/* Question card — the text-first hero of every question page */
.tf-game { padding-top: 10px; }
.tf-qcard {
  background: var(--qcard-bg);
  color: var(--qcard-ink);
  border-radius: 16px;
  padding: 22px 20px;
  box-shadow: 0 6px 18px rgba(26, 31, 43, 0.18);
}
.tf-qimage {
  margin: 0 0 14px;
  border-radius: 10px;
  overflow: hidden;
}
.tf-qimage img { margin: 0 auto; max-height: 300px; object-fit: contain; }
.tf-question {
  font-size: 1.55rem;
  line-height: 1.3;
  margin: 0;
  text-align: center;
  font-weight: 800;
}

/* Answers */
.tf-options {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}
.tf-option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  border: 2px solid var(--option-border);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}
.tf-option:hover { border-color: var(--accent); transform: translateY(-1px); }
.tf-option-key {
  flex: 0 0 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--option-key);
  color: #fff;
  font-weight: 700;
}
.tf-option[disabled] { cursor: default; opacity: 0.92; }
.tf-option.tf-right { border-color: var(--good); background: #e8f4ee; }
.tf-option.tf-right .tf-option-key { background: var(--good); }
.tf-option.tf-wrong { border-color: var(--bad); background: #f9e9e6; }
.tf-option.tf-wrong .tf-option-key { background: var(--bad); }

.tf-extra {
  margin: 14px 0;
  padding: 14px 16px;
  border-left: 4px solid var(--accent);
  background: var(--card);
  border-radius: 0 8px 8px 0;
}

/* Lifelines (Phase 4): fixed-height bar above the answers — reserved space,
   no layout shift; big tap targets. */
.tf-lifelines {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0 4px;
  min-height: 64px;
}
.tf-lifeline {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 64px; /* keeps tap targets well above 44px in every gate state */
  padding: 8px 6px;
  border: 2px solid var(--option-border);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease, opacity 120ms ease;
}
.tf-lifeline:hover:not([disabled]) { border-color: var(--accent); transform: translateY(-1px); }
.tf-lifeline[disabled] { cursor: default; opacity: 0.55; }
.tf-lifeline-icon { font-size: 1.15rem; line-height: 1; }
.tf-lifeline-name { font-size: 0.95rem; }
.tf-lifeline-gate { font-size: 0.72rem; font-weight: 600; color: var(--accent); }
/* Ad-gated state only: smaller italic note; coin-cost style stays as-is. */
.tf-lifeline-gate.tf-lifeline-gate-ad { font-size: 0.62rem; font-weight: 400; font-style: italic; color: var(--muted); }
.tf-lifeline-status {
  margin: 6px 0 0;
  font-size: 0.9rem;
  text-align: center;
  color: var(--ink);
  opacity: 0.85;
}
.tf-hint {
  margin: 10px 0 0;
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  background: var(--card);
  border-radius: 0 8px 8px 0;
  font-weight: 600;
}

/* 50-50: removed options stay in place (no layout shift), just fade out. */
.tf-option.tf-removed { opacity: 0.25; text-decoration: line-through; }

/* Audience poll: real percentage bar inside each option. */
.tf-option { flex-wrap: wrap; }
.tf-poll {
  flex: 1 0 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.tf-poll-track {
  flex: 1;
  height: 10px;
  border-radius: 5px;
  background: var(--option-border);
  overflow: hidden;
}
.tf-poll-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 300ms ease;
}
.tf-poll-pct { font-size: 0.82rem; font-weight: 700; min-width: 34px; text-align: right; }

.tf-continue-top { text-align: center; margin: 14px 0; }

/* Verdict block (answer status + continue) */
.tf-verdict {
  margin: 18px 0;
  border-radius: 12px;
  overflow: hidden;
  background: #232a35;
}
.tf-verdict-banner {
  padding: 14px;
  text-align: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 0.06em;
}
.tf-verdict-banner.tf-right { background: var(--good); }
.tf-verdict-banner.tf-wrong { background: var(--bad); }
.tf-verdict-body { padding: 20px; text-align: center; }
.tf-verdict-hint { color: #b9c2d0; font-size: 0.9rem; margin: 10px 0 0; }
.tf-verdict .tf-ad-box { margin: 0; border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0; }
.tf-verdict .tf-ad-label { color: #8f99a8; }

/* "How others answered" stats */
.tf-stats {
  margin: 0 16px 18px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: #fff;
}
.tf-stats-title { margin: 0 0 12px; font-size: 1rem; }
.tf-stat-row { margin-bottom: 10px; }
.tf-stat-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.85);
}
.tf-stat-row.tf-mine .tf-stat-head { font-weight: 700; color: #fff; }
.tf-stat-track {
  height: 22px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.tf-stat-fill {
  height: 100%;
  background: rgba(255, 255, 255, 0.35);
  transition: width 300ms ease;
}
.tf-stat-row.tf-mine.tf-right .tf-stat-fill { background: var(--good); }
.tf-stat-row.tf-mine.tf-wrong .tf-stat-fill { background: var(--bad); }

/* Results page */
.tf-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.tf-result {
  background: #faf9f5;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.tf-result-num { display: block; font-size: 1.6rem; font-weight: 800; }
.tf-result-cap { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; }

.tf-rank {
  text-align: center;
  margin: 20px 0;
  padding: 18px;
  border-radius: 10px;
  background: var(--qcard-bg);
  color: var(--qcard-ink);
}
.tf-rank-band { font-size: 1.4rem; font-weight: 800; margin: 0; }
.tf-rank-note { margin: 6px 0 0; opacity: 0.85; }

/* Related quizzes (each starts on question 1) */
.tf-related { margin: 26px 0; }
.tf-related-heading {
  font-size: 1.2rem;
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 3px solid var(--accent);
  display: inline-block;
}
.tf-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.tf-related-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--qcard-bg);
  color: var(--qcard-ink);
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.tf-related-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(26, 31, 43, 0.2); }
.tf-related-kicker {
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.85;
  font-weight: 700;
}
.tf-related-title { font-weight: 700; font-size: 1.02rem; line-height: 1.3; }
.tf-related-meta { font-size: 0.8rem; opacity: 0.8; }

/* Slideshow */
.tf-slide { text-align: left; }
.tf-slide .tf-question { text-align: left; }
.tf-slide-highlight {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 10px 0 0;
  opacity: 0.92;
}
.tf-slide-body { margin: 14px 0 0; font-size: 1.05rem; }
.tf-slide .tf-cover { margin: 14px 0 0; border: 0; }
.tf-slide-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  flex-wrap: wrap;
}

/* Homepage — text-first themed tiles (no images required) */
.tf-hero { text-align: center; padding: 26px 0 8px; }
.tf-hero h1 { font-size: 2.2rem; margin: 0 0 6px; letter-spacing: -0.01em; }
.tf-hero p { color: var(--muted); margin: 0; font-size: 1.05rem; }

.tf-home-section { margin: 30px 0; }
.tf-home-heading {
  font-size: 1.3rem;
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 3px solid var(--accent);
  display: inline-block;
}
.tf-tilegrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}
.tf-tile {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 18px;
  border-radius: 14px;
  background: var(--qcard-bg);
  color: var(--qcard-ink);
  text-decoration: none;
  min-height: 120px;
  box-shadow: 0 1px 3px rgba(26, 31, 43, 0.08);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.tf-tile:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(26, 31, 43, 0.2); }
.tf-tile-kicker {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.85;
  font-weight: 700;
}
.tf-tile-title { font-weight: 700; font-size: 1.08rem; line-height: 1.35; }
.tf-tile-meta { font-size: 0.85rem; opacity: 0.8; margin-top: auto; }

/* Footer */
.tf-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 26px 16px 40px;
}
.tf-footer a { color: var(--muted); }

/* Mobile-first tightening: question 1 must sit above the fold at 390px. */
@media (max-width: 640px) {
  .tf-shell { padding: 10px; }
  .tf-panel { padding: 16px; }
  .tf-title { font-size: 1.35rem; }
  .tf-qcard { padding: 16px 14px; }
  .tf-question { font-size: 1.25rem; }
  .tf-option { padding: 13px 14px; font-size: 1.02rem; }
  .tf-btn-big { width: 100%; }
  .tf-slide-nav .tf-btn { flex: 1; text-align: center; }
  .tf-hero h1 { font-size: 1.7rem; }
}

/*
 * Ezoic's fixed outstream player can cover answer/continue controls at both
 * desktop and mobile widths. Suppress it on interactive trivia-question and
 * control-dense results states. The start page retains the supported video
 * surface; results retain their in-content display inventory.
 */
body[data-page="trivia-question"] #ez-video-outstream-wrap,
body[data-page="trivia-question"] #ez-video-container,
body[data-page="trivia-results"] #ez-video-outstream-wrap,
body[data-page="trivia-results"] #ez-video-container,
html:has(> body[data-page="trivia-results"]) > #ez-video-outstream-wrap,
html:has(> body[data-page="trivia-results"]) > #ez-video-container {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/*
 * Ezoic renders the bottom adhesion as a direct child of <html>, outside the
 * page <body>. Hide that injected anchor on control-dense question and
 * results states. The start page retains the verified anchor opportunity.
 */
body[data-page="trivia-results"] [id*="/Adhesion/"][data-anchor-status],
html:has(> body[data-page="trivia-question"])
  > ins[id*="/Adhesion/"][data-anchor-status],
html:has(> body[data-page="trivia-results"])
  > ins[id*="/Adhesion/"][data-anchor-status] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/*
 * Prebid can inject an empty fixed interstitial host over an answer control.
 * Question answers are same-page interactions, not eligible hard-navigation
 * boundaries. Fail closed for both body descendants and direct-html hosts;
 * start/results navigation continues to carry the supported vignette surface.
 */
body[data-page="trivia-question"] [id^="prebid-modal-host-"],
body[data-page="trivia-question"] [id*="/Interstitial/"],
html:has(> body[data-page="trivia-question"])
  > [id^="prebid-modal-host-"],
html:has(> body[data-page="trivia-question"])
  > [id*="/Interstitial/"] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
