/* ============================================================
   55 QUIZ — data: categories + quiz catalog
   ============================================================ */

const CATEGORIES = [
  { id: 'history',  label: 'History',     color: 'var(--c-amber)',  icon: 'landmark' },
  { id: 'science',  label: 'Science',     color: 'var(--c-cyan)',   icon: 'flask-conical' },
  { id: 'film',     label: 'Film & TV',   color: 'var(--c-coral)',  icon: 'clapperboard' },
  { id: 'geo',      label: 'Geography',   color: 'var(--c-green)',  icon: 'globe' },
  { id: 'music',    label: 'Music',       color: 'var(--c-pink)',   icon: 'music' },
  { id: 'art',      label: 'Art',         color: 'var(--c-violet)', icon: 'palette' },
  { id: 'mind',     label: 'Psychology',  color: 'var(--c-blue)',   icon: 'brain' },
  { id: 'sport',    label: 'Sport',       color: 'var(--c-lime)',   icon: 'trophy' },
  { id: 'tech',     label: 'Tech',        color: 'var(--brand)',    icon: 'cpu' },
  { id: 'food',     label: 'Food',        color: 'var(--c-coral)',  icon: 'utensils' },
];

const catById = (id) => CATEGORIES.find(c => c.id === id) || CATEGORIES[0];

/* difficulty -> dots */
const DIFF = { easy: 1, medium: 2, hard: 3 };

const QUIZZES = [
  { id: 'q1', title: 'Empires That Vanished', cat: 'history', q: 20, rounds: 3, diff: 'medium',
    mins: 9, plays: 48210, rating: 4.8, free: true, premium: false, video: false,
    blurb: 'From Carthage to the Khmer — civilisations that ruled, then dissolved.', hue: 'var(--c-amber)' },

  { id: 'q2', title: 'The Quantum Lab', cat: 'science', q: 25, rounds: 4, diff: 'hard',
    mins: 12, plays: 31980, rating: 4.7, free: false, premium: true, video: true,
    blurb: 'Superposition, entanglement and the cat that is both ways at once.', hue: 'var(--c-cyan)' },

  { id: 'q3', title: 'Oscar Night Decoded', cat: 'film', q: 30, rounds: 5, diff: 'medium',
    mins: 14, plays: 92140, rating: 4.9, free: false, premium: true, video: true,
    blurb: 'Best Picture upsets, snubs and the speeches everyone still quotes.', hue: 'var(--c-coral)' },

  { id: 'q4', title: 'Capitals & Curveballs', cat: 'geo', q: 20, rounds: 3, diff: 'easy',
    mins: 8, plays: 67430, rating: 4.6, free: true, premium: false, video: false,
    blurb: 'You know Paris. Do you know Palikir? A world tour with a twist.', hue: 'var(--c-green)' },

  { id: 'q5', title: 'One-Hit Wonders', cat: 'music', q: 18, rounds: 3, diff: 'easy',
    mins: 7, plays: 54300, rating: 4.5, free: false, premium: false, video: false,
    blurb: 'The songs that owned a summer and then politely disappeared.', hue: 'var(--c-pink)' },

  { id: 'q6', title: 'Brushstrokes & Forgeries', cat: 'art', q: 22, rounds: 4, diff: 'hard',
    mins: 11, plays: 18760, rating: 4.8, free: false, premium: true, video: true,
    blurb: 'Real masterpiece or clever fake? Train your eye, then prove it.', hue: 'var(--c-violet)' },

  { id: 'q7', title: 'What Your Brain Hides', cat: 'mind', q: 16, rounds: 2, diff: 'medium',
    mins: 6, plays: 120400, rating: 4.9, free: true, premium: false, video: false,
    blurb: 'Cognitive biases you fall for daily — find out which is yours.', hue: 'var(--c-blue)' },

  { id: 'q8', title: 'Trophy Room', cat: 'sport', q: 24, rounds: 4, diff: 'medium',
    mins: 10, plays: 40120, rating: 4.4, free: false, premium: false, video: false,
    blurb: 'Comebacks, records and the goals replayed for a generation.', hue: 'var(--c-lime)' },

  { id: 'q9', title: 'Ships of Silicon', cat: 'tech', q: 28, rounds: 5, diff: 'hard',
    mins: 13, plays: 27650, rating: 4.7, free: false, premium: true, video: true,
    blurb: 'The chips, founders and flops that wired the modern world.', hue: 'var(--brand)' },

  { id: 'q10', title: 'A Taste of Everywhere', cat: 'food', q: 20, rounds: 3, diff: 'easy',
    mins: 8, plays: 73900, rating: 4.6, free: true, premium: false, video: false,
    blurb: 'Street food to haute cuisine — match the dish to its homeland.', hue: 'var(--c-coral)' },

  { id: 'q11', title: 'Revolutions in 60 Years', cat: 'history', q: 26, rounds: 4, diff: 'hard',
    mins: 12, plays: 21340, rating: 4.7, free: false, premium: true, video: false,
    blurb: 'Barricades, manifestos and the leaders who lit the fuse.', hue: 'var(--c-amber)' },

  { id: 'q12', title: 'Deep Space, Deeper Trivia', cat: 'science', q: 22, rounds: 3, diff: 'medium',
    mins: 10, plays: 58800, rating: 4.8, free: false, premium: false, video: false,
    blurb: 'Black holes, rovers and the probes still phoning home.', hue: 'var(--c-cyan)' },
];

/* sample questions for the play flow (one represented quiz) */
const SAMPLE_QUESTIONS = [
  { q: 'Which ancient city was destroyed and "salted" by Rome at the end of the Third Punic War?',
    options: ['Carthage', 'Alexandria', 'Corinth', 'Numantia'], correct: 0,
    fact: 'Carthage fell in 146 BC. The salting story is likely a 19th-century embellishment.' },
  { q: 'The Khmer Empire built which vast temple complex, now on a national flag?',
    options: ['Borobudur', 'Angkor Wat', 'Bagan', 'Prambanan'], correct: 1,
    fact: 'Angkor Wat appears on the flag of Cambodia — the only flag to feature a building.' },
  { q: 'Great Zimbabwe, a medieval stone city, traded gold with which coastal network?',
    options: ['The Hanseatic League', 'The Swahili Coast', 'The Silk Road', 'The Vikings'], correct: 1,
    fact: 'Swahili city-states linked the African interior to the Indian Ocean trade.' },
  { q: 'The Hittite Empire was rediscovered largely through tablets written in which script?',
    options: ['Hieroglyphics', 'Linear B', 'Cuneiform', 'Runes'], correct: 2,
    fact: 'Cuneiform archives at Hattusa unlocked a "lost" Bronze Age superpower.' },
  { q: 'Which empire’s collapse is tied to the mysterious "Sea Peoples" around 1177 BC?',
    options: ['Roman', 'Mongol', 'Bronze Age Mediterranean', 'Ottoman'], correct: 2,
    fact: 'A systems collapse ended several Bronze Age states almost at once.' },
];

const PLANS = {
  oneTime: { base: 4, perRound: 1, video: 3, brand: 2 },
};

if (typeof window !== 'undefined') {
  Object.assign(window, { CATEGORIES, catById, DIFF, QUIZZES, SAMPLE_QUESTIONS, PLANS });
}
