/* Win or Waffle — editable site styles
   Palette reference: #194350 #FF8882 #FFC2B4 #9DBEB8
   Change genre colours in the THEME PALETTES section below.
*/
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* 1. THEME PALETTES */
:root,
body[data-theme='Football'] {
  --base: #090d0b;
  --surface: #1a4d2e;
  --surface-strong: #23583a;
  --accent: #ff9f29;
  --accent-soft: #ffc77e;
  --mint: #9abb9f;
  --text: #faf3e3;
  --muted: #c3d0bf;
  --border: rgba(177, 210, 178, .2);
  --glow: rgba(255, 159, 41, .13);
}

body[data-theme='anime'] {
  --base: #102a35;
  --surface: #194350;
  --surface-strong: #265462;
  --accent: #ff8882;
  --accent-soft: #ffc2b4;
  --mint: #9dbeb8;
  --text: #fff1ed;
  --muted: #b9d0cc;
  --border: rgba(255, 194, 180, 0.25);
  --glow: rgba(255, 136, 130, 0.20);
  background:
    radial-gradient(ellipse at 85% 15%,rgba(255, 136, 130, 0.22), transparent 45%),
    radial-gradient(ellipse at 12% 85%,rgba(255, 194, 180, 0.13), transparent 50%),
    linear-gradient(155deg,#102a35 0%,#194350 55%,#354c58 100%);
  background-attachment: fixed;
}

body[data-theme='music'] {
  --base: #1c1828;
  --surface: #302743;
  --surface-strong: #3e3354;
  --accent: #e9a3d1;
  --accent-soft: #f3c5e4;
  --mint: #a8a7d5;
  --text: #fff3fb;
  --muted: #d2c5df;
  --border: rgba(209, 192, 225, .22);
  --glow: rgba(233, 163, 209, .14);
}

body[data-theme='general'] {
  --base: #321627;
  --surface: #512333;
  --surface-strong: #743344;
  --accent: #ffad68;
  --accent-soft: #ffd0a1;
  --mint: #f3b6b6;
  --text: #fff2e7;
  --muted: #dcaeb3;
  --border: rgba(255, 173, 104, 0.24);
  --glow: rgba(255, 125, 76, 0.24);
  background:
    radial-gradient(ellipse at 85% 12%,rgba(255, 145, 83, 0.20),transparent 45%),
    radial-gradient(ellipse at 10% 80%,rgba(206, 79, 47, 0.15),transparent 50%),
    linear-gradient(160deg,#321627 0%,#49202f 50%,#693044 100%);

  background-attachment: fixed;
}

/* 2. BASE STYLES */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 83% 16%, var(--glow), transparent 44%),
    radial-gradient(ellipse at 0 90%, var(--surface), transparent 58%),
    var(--base);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  transition: background-color .35s, color .35s;
}
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.container { width: min(100% - 60px, 1160px); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* 3. HEADER AND BUTTONS */
.site-header { display: flex; align-items: center; justify-content: space-between; padding-block: 27px; gap: 16px; }
.logo { text-decoration: none; font: 800 24px 'Space Grotesk', sans-serif; letter-spacing: -1.3px; white-space: nowrap; }
.logo span { color: var(--text); }
.logo b { color: var(--accent); }
.navigation { display: flex; align-items: center; gap: 24px; }
.navigation > a { text-decoration: none; color: var(--muted); font-size: 14px; transition: color .2s; }
.navigation > a:hover, .navigation > a[aria-current] { color: var(--accent-soft); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 20px; border: 1px solid transparent; border-radius: 13px; background: var(--accent); color: #1c2530; font-weight: 800; text-decoration: none; transition: transform .2s, filter .2s; }
.button:hover { transform: translateY(-2px); filter: brightness(1.08); }
.button-secondary { background: rgba(255,255,255,.07); border-color: var(--border); color: var(--text); }

/* 4. HOME HERO AND TRIVIA */
.hero { display: grid; grid-template-columns: 1.05fr .95fr; align-items: center; gap: 55px; padding-block: 55px 70px; min-height: 590px; }
.eyebrow { text-transform: uppercase; letter-spacing: 2.4px; color: var(--accent-soft); font-size: 12px; font-weight: 800; }
h1, h2, h3, p { overflow-wrap: break-word; }
.hero h1, .content-page h1 { font: 700 clamp(52px, 7vw, 94px)/1.01 'Space Grotesk', sans-serif; letter-spacing: -.065em; margin: 18px 0; }
h1 em { color: var(--accent); font-style: normal; }
.intro { color: var(--muted); font-size: 17px; line-height: 1.8; max-width: 510px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 29px; }
.trivia-card { position: relative; padding: 24px; border: 1px solid var(--border); border-radius: 28px; background: linear-gradient(145deg, var(--surface-strong), var(--surface)); box-shadow: 0 25px 75px rgba(0,0,0,.28); transform: rotate(1.6deg); transition: background .3s, transform .2s; }
.trivia-card::before { content: '✦'; position: absolute; right: 18px; top: -39px; font-size: 64px; color: var(--accent); }
.trivia-top, .trivia-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); }
.pill { display: inline-block; padding: 7px 11px; border-radius: 50px; border: 1px solid var(--border); background: var(--glow); color: var(--accent-soft); font-size: 12px; font-weight: 800; }
.trivia-label { letter-spacing: .12em; font-size: 10px; white-space: nowrap; }
.trivia-card h2 { font: 700 clamp(24px, 2.5vw, 32px)/1.22 'Space Grotesk', sans-serif; min-height: 83px; margin: 34px 0 22px; }
.answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.answer { text-align: left; padding: 17px 13px; min-height: 63px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.055); color: var(--text); font-weight: 700; transition: background .2s, border-color .2s, transform .2s; }
.answer:hover:not(:disabled) { transform: translateY(-2px); background: var(--glow); border-color: var(--accent); }
.answer.selected { border-color: var(--accent); background: var(--glow); }
.answer.correct { border-color: var(--mint); background: rgba(157,190,184,.24); }
.answer:disabled { cursor: default; opacity: 1; }
.trivia-footer { margin-top: 23px; min-height: 35px; align-items: flex-start; }
#trivia-feedback { line-height: 1.5; flex: 1; }
.text-button { background: transparent; border: 0; padding: 0; color: var(--accent-soft); font-weight: 800; white-space: nowrap; }
.text-button:hover { text-decoration: underline; }

/* 5. GENRE SELECTOR */
.genre-section { padding-top: 15px; scroll-margin-top: 20px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; margin-bottom: 22px; }
.section-heading h2, .join-panel h2 { font: 700 29px 'Space Grotesk', sans-serif; margin: 0; }
.section-heading p { font-size: 13px; color: var(--muted); margin: 0; }
.genre-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.genre-card { min-height: 177px; padding: 21px; text-align: left; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); color: var(--text); transition: transform .2s, border-color .2s, box-shadow .2s; }
.genre-card:hover { transform: translateY(-3px); }
.genre-card.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent), 0 10px 28px rgba(0,0,0,.12); }
.genre-card:nth-child(2) { background: #1d382c; }
.genre-card:nth-child(3) { background: #342941; }
.genre-card:nth-child(4) { background: #284756; }
.genre-icon { display: block; font-size: 38px; margin-bottom: 21px; }
.genre-card strong { display: block; font: 700 19px 'Space Grotesk', sans-serif; }
.genre-card small { display: block; color: var(--muted); margin-top: 6px; font-size: 12px; }

/* 6. JOIN PANEL + FOOTER */
.join-panel { margin-top: 48px; padding: 29px; border: 1px solid var(--border); border-radius: 22px; background: rgba(255,255,255,.055); display: flex; justify-content: space-between; align-items: center; gap: 20px; scroll-margin-top: 24px; }
.join-panel p { color: var(--muted); margin: 9px 0 0; }
.join-form { display: flex; gap: 10px; }
.join-form input { width: 170px; min-width: 0; border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--base); color: var(--text); text-transform: uppercase; }
.join-form input::placeholder { color: var(--muted); }
.site-footer { display: flex; justify-content: space-between; gap: 16px; padding-block: 38px 43px; color: var(--muted); font-size: 13px; }
.toast { position: fixed; bottom: 23px; left: 50%; transform: translateX(-50%); max-width: min(90vw, 440px); background: var(--text); color: var(--base); padding: 14px 19px; border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.4); z-index: 10; text-align: center; }
.toast[hidden] { display: none; }
.host-dialog { width: min(420px, calc(100% - 30px)); padding: 30px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); color: var(--text); }
.host-dialog::backdrop { background: rgba(0,0,0,.75); }
.host-dialog h2 { font: 700 29px 'Space Grotesk', sans-serif; margin-top: 0; }
.host-dialog p { line-height: 1.7; color: var(--muted); }

/* 7. HOW TO PLAY PAGE — edit text in how-to-play.html */
.content-page { padding-block: 60px 110px; }
.content-page h1 { font-size: clamp(54px, 7vw, 84px); }
.content-page > .intro { margin-bottom: 45px; }
.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-bottom: 35px; }
.info-card { padding: 30px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); }
.step-label { font-size: 11px; font-weight: 800; letter-spacing: 2px; color: var(--accent-soft); }
.info-card h2 { font: 700 25px 'Space Grotesk', sans-serif; margin: 17px 0 12px; }
.info-card p { line-height: 1.8; color: var(--muted); margin: 0; }

/* 8. RESPONSIVE LAYOUT */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: 0; gap: 60px; padding-top: 40px; }
  .trivia-card { width: min(100%, 620px); transform: none; }
  .genre-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .join-panel { align-items: stretch; flex-direction: column; }
}
@media (max-width: 600px) {
  .container { width: min(100% - 36px, 1160px); }
  .site-header { align-items: flex-start; }
  .logo { font-size: 20px; }
  .navigation { gap: 10px; }
  .navigation > a { display: none; }
  .music-button { padding: 11px 12px; font-size: 12px; }
  .hero { padding-block: 27px 55px; gap: 54px; }
  .hero h1 { font-size: clamp(48px, 13vw, 70px); }
  .intro { font-size: 15px; }
  .trivia-card { padding: 18px; }
  .trivia-card h2 { min-height: 0; margin: 25px 0; }
  .answers { grid-template-columns: 1fr; }
  .answer { min-height: 51px; padding: 13px; }
  .trivia-footer { flex-wrap: wrap; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .genre-grid { gap: 10px; }
  .genre-card { padding: 16px; min-height: 155px; }
  .genre-icon { font-size: 31px; }
  .genre-card strong { font-size: 17px; }
  .join-panel { padding: 21px; }
  .join-form { flex-direction: column; }
  .join-form input { width: 100%; }
  .site-footer { flex-direction: column; font-size: 12px; }
  .info-grid { grid-template-columns: 1fr; }
  .content-page { padding-block: 40px 65px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* 9. ROOM CREATION + ROOM LOBBY */
.room-form { display: grid; gap: 12px; }
.room-form label { font-weight: 700; color: var(--accent-soft); font-size: 13px; }
.room-form input, .room-form select { width: 100%; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--base); color: var(--text); }
.room-form select option { background: #194350; color: white; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.form-error { color: #ffaaa3 !important; font-size: 13px; }
.room-main { max-width: 850px; padding-block: 45px 100px; }
.room-main h1 { font: 700 clamp(45px, 8vw, 76px)/1.1 'Space Grotesk', sans-serif; margin: 12px 0; }
.room-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 30px; }
.room-box { padding: 25px; border: 1px solid var(--border); border-radius: 24px; background: var(--surface); }
.room-box h2 { font: 700 24px 'Space Grotesk', sans-serif; margin-top: 0; }
.room-code-display { font: 700 clamp(42px, 7vw, 64px) 'Space Grotesk', sans-serif; letter-spacing: .1em; color: var(--accent); }
.room-players { display: grid; gap: 9px; padding: 0; margin: 16px 0; list-style: none; }
.room-player { display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,.06); border: 1px solid var(--border); border-radius: 13px; padding: 12px; }
.room-player .piece { font-size: 27px; }
.room-player .host-label { color: var(--accent-soft); margin-left: auto; font-size: 12px; }
.room-muted { color: var(--muted); line-height: 1.7; }
.room-status { color: var(--accent-soft); font-size: 13px; }
[hidden] { display: none !important; }
@media (max-width: 650px) { .room-layout { grid-template-columns: 1fr; } }