/* Light sunburst themes. Loaded last on every page. The page sets <html data-theme="..."> (see setTheme in js/ui.js):
   sunshine = home + podium, sky = lobby + joining, mint = puzzle games, lilac = party games, peach = results, pink = host controls.
   Each theme: background colours, the text colour, and the main button colour (a deeper shade of the background).
   Gold stays the second button everywhere. */
html[data-theme] {
  --ray: rgba(255, 255, 255, 0.55);
  --t-yellow: #B86E00; --t-coral: #D03A4E; --t-mint: #0B7A5E; --t-sky: var(--accent);
  --white: var(--ink);
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-hi: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.12));
  --edge-gold: inset 0 0 0 1.5px rgba(232, 154, 28, 0.55);
  --soft: 0 6px 14px rgba(60, 30, 100, 0.16);
}
html[data-theme="sunshine"] { --bg1: #FFF0B8; --bg2: #FFC966; --ink: #5E3000; --t-muted: #8A5A1E; --accent: #C25E00; --main: #FF9A2E; --main-edge: #B05A00; }
html[data-theme="sky"] { --bg1: #E2F3FF; --bg2: #9ACEFF; --ink: #10357E; --t-muted: #3D63A8; --accent: #1E6FD0; --main: #2E8FF0; --main-edge: #1656A8; }
html[data-theme="mint"] { --bg1: #E0FBF0; --bg2: #A2E9CC; --ink: #07503C; --t-muted: #2E7A62; --accent: #0B8A66; --main: #14B88A; --main-edge: #0A6E52; }
html[data-theme="lilac"] { --bg1: #F3EDFF; --bg2: #C9B2FF; --ink: #35197E; --t-muted: #6346B0; --accent: #6A3FE0; --main: #8B5CF6; --main-edge: #5232B8; }
html[data-theme="peach"] { --bg1: #FFEADC; --bg2: #FFBF98; --ink: #742A10; --t-muted: #A0522E; --accent: #D0601E; --main: #FF8A3C; --main-edge: #B0501A; }
html[data-theme="pink"] { --bg1: #FFE6F2; --bg2: #FFB1D5; --ink: #7A1548; --t-muted: #A5427A; --accent: #D23C86; --main: #F0559E; --main-edge: #A82466; }

/* Background: sunburst rays from near the top, a soft white glow, the theme gradient */
html[data-theme] body, html[data-theme] #stage {
  color: var(--ink); background-color: var(--bg2);
  background-image:
    radial-gradient(ellipse 70% 45% at 50% 0%, rgba(255, 255, 255, 0.7), transparent 70%),
    repeating-conic-gradient(from 0deg at 50% 18%, var(--ray) 0deg 9deg, transparent 9deg 18deg),
    linear-gradient(180deg, var(--bg1) 0%, var(--bg2) 100%);
  background-size: auto; transition: background-color 0.4s; }
html[data-theme] body { background-attachment: fixed; }
html[data-theme] body::before, html[data-theme] #stage::before { display: none; }
html[data-theme] { background: var(--bg2); }

/* Main buttons take the page colour; gold (the default .btn) is the second button */
html[data-theme] .btn.mint, html[data-theme] .btn.sky, html[data-theme] .btn.coral { --edge: var(--main-edge); background-color: var(--main); color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); }
html[data-theme] .ctacard.join { --edge: var(--main-edge); background-color: var(--main); color: #fff; }
html[data-theme] .ctacard.join .ctatext b { text-shadow: 0 2px 0 rgba(0, 0, 0, 0.2); }
html[data-theme] .btn.ghost { --edge: rgba(80, 50, 140, 0.35); background-color: rgba(255, 255, 255, 0.75); color: var(--ink); text-shadow: none; }
html[data-theme] .btn.ghost::before { opacity: 0.9; }

/* Glass boxes on the background become frosted white with a gold hairline */
html[data-theme] :is(.panel, .ptile:not(.empty), .res-row, .srow, .wf-word, .wf-chip, .imp-pl, .imp-clue, .imp-bar, .votebtn, .dd-guess, .minimedals,
  .steps li, .tip, .gamecard, .prow, .toggle, .others .pchip, .endnote, .res-summary, .lr-chip, .cs-total, .wg-board, .cc-pl, .bp-card, .bp-mark,
  .qz-topic, .qz-pl, .ch-pl, .ch-w, .ml-pl, .c4-game, .c4-bm, .roomtag, .gsettings, .helpbtn, .tjoin, .groupname, .chip, .ch-got .skip) {
  background-color: var(--glass-bg); background-image: var(--glass-hi);
  box-shadow: var(--edge-gold), inset 0 2px 0 rgba(255, 255, 255, 0.8), var(--soft); }
html[data-theme] .gamecard.on, html[data-theme] .chip.on { background-color: var(--yellow); }
html[data-theme] .srow.done, html[data-theme] .imp-pl.ok, html[data-theme] .cc-pl.done, html[data-theme] .qz-pl.ok { background-color: rgba(31, 199, 164, 0.35); }
html[data-theme] .ptile:not(.empty) { background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.45)); }
html[data-theme] .ptile.empty { color: rgba(30, 60, 120, 0.35); }
html[data-theme] .ptile .slot { color: rgba(60, 30, 100, 0.25); }
html[data-theme] .race-board .srow:first-child, html[data-theme] .res-rows .res-row:first-child { background-color: rgba(255, 201, 60, 0.45); }
html[data-theme] .ml-bar .track { background: rgba(60, 30, 100, 0.12); }

/* Bars along the top */
html[data-theme] .topbar { background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.55)); box-shadow: 0 1px 0 rgba(232, 154, 28, 0.5), 0 8px 20px rgba(60, 30, 100, 0.15); }
html[data-theme] .phbar { background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.8)); box-shadow: 0 1px 0 rgba(232, 154, 28, 0.5), 0 6px 14px rgba(60, 30, 100, 0.15); }
html[data-theme] .phbar .seg, html[data-theme] .segpick, html[data-theme] .hosttabs { background: rgba(60, 30, 100, 0.12); }
html[data-theme] .hosttabs { position: sticky; }
html[data-theme] .roomtag b, html[data-theme] .tjoin b { color: var(--accent); }

/* Headings: theme ink with a white 3D edge instead of dark shadows */
html[data-theme] :is(.block h2, .lobby-head h2) { background: none; -webkit-background-clip: border-box; background-clip: border-box; color: var(--ink); filter: none;
  text-shadow: 0 3px 0 #fff, 0 6px 14px rgba(60, 30, 100, 0.2); }
html[data-theme] :is(.tv h1:not(.logo), .intro-title, .imp-center h1, .imp-result h1, .kick-title, .bigmsg h2, .host h3, h1, h2, h3):not(.logo) { text-shadow: 0 2px 0 rgba(255, 255, 255, 0.85); }
html[data-theme] :is(.card, .board, .modal, .pausebox, .secret-card, .gcard) :is(h1, h2, h3) { text-shadow: none; }
html[data-theme] .herotag { color: var(--accent); }
html[data-theme] .tround { color: var(--ink); }

/* Things that sit on a coloured box keep white text */
html[data-theme] .toast { color: #fff; }
html[data-theme] .toast.good { color: #062F27; } html[data-theme] .toast.warn { color: var(--ink); }
html[data-theme] .modaltabs button.on { color: #fff; }
html[data-theme] .qz-pl.ok small { color: var(--ink); }

/* Game bits drawn for a dark background */
html[data-theme] .wg-t { background: rgba(255, 255, 255, 0.88); border-color: rgba(60, 30, 100, 0.34); box-shadow: inset 0 3px 6px rgba(60, 30, 100, 0.12), 0 2px 0 rgba(60, 30, 100, 0.12); } /* empty squares were nearly invisible on the pale backgrounds */
html[data-theme] .wg-row.now .wg-t:not(:empty) { border-color: var(--accent); }
html[data-theme] .wg-key { background-color: rgba(255, 255, 255, 0.85); color: var(--ink); box-shadow: inset 0 1px 0 #fff, inset 0 -2px 0 rgba(60, 30, 100, 0.12), 0 3px 0 rgba(60, 30, 100, 0.35); }
/* Right/close letters keep their colour on the light themes (the white key colour above was hiding them) */
html[data-theme] .wg-key.g { background-color: #19C48F; background-image: linear-gradient(#5FE3B5, #19C48F); color: #fff; text-shadow: 0 1px 0 rgba(0, 60, 40, 0.35); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 3px 0 #0A7E5A, 0 0 12px rgba(25, 196, 143, 0.35); }
html[data-theme] .wg-key.y { background-color: #FFC93C; background-image: linear-gradient(#FFE27A, #F5B416); color: #5A3300; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 3px 0 #B97F00; }
html[data-theme] .wg-key.x { background-color: rgba(60, 30, 100, 0.25); color: rgba(60, 30, 100, 0.45); }
html[data-theme] .cs-cell.x { background: rgba(60, 30, 100, 0.08); color: rgba(60, 30, 100, 0.35); }
html[data-theme] .timer .tbg { fill: rgba(255, 255, 255, 0.6); stroke: rgba(60, 30, 100, 0.15); }
html[data-theme] .timer text, html[data-theme] .timer .tnum { fill: var(--ink); color: var(--ink); }
html[data-theme] .avcloud { opacity: 0.35; }
html[data-theme] .bp-balloons i::after { background: rgba(60, 30, 100, 0.4); }

/* No red buttons: the quiz's A answer and Would You Rather's first side use bubblegum pink */
html[data-theme] .o0, html[data-theme] .wy-side.s0, html[data-theme] .wy-btn.s0 { background-color: #FF7AB8; }
html[data-theme] .cs-mode { background-color: rgba(255, 255, 255, 0.75); box-shadow: inset 0 2px 0 #fff, 0 5px 0 rgba(60, 30, 100, 0.3); }
html[data-theme] .cs-mode.cross.on { background: #FF7AB8; color: #fff; box-shadow: 0 5px 0 #B83A7A, 0 0 0 3px #fff; }
html[data-theme] .bp-part i { border-bottom-color: rgba(60, 30, 100, 0.45); }
html[data-theme] .cc-pad { opacity: 0.8; filter: saturate(0.9); }
html[data-theme] .cc-pad.lit { opacity: 1; filter: none; }

/* Fonts (owner's pick, mix D): Lilita One for big titles, Fredoka for buttons and scores, Quicksand for text */
h1:not(.logo), h2, .block h2, .lobby-head h2, .intro-title, .kick-title, .board h1, .bigmsg h2, .imp-center h1, .imp-result h1, .wg-title, .qz-q, .cc-head, .c4-h, .herotag {
  font-family: var(--title); font-weight: 400; letter-spacing: 0.5px; }

/* ---------- Centre every game on the big screen and on phones ---------- */
/* Big screen: one-column games sit in the middle of the screen; two-column games centre both columns */
.qz-tv, .wy-tv, .ml-tv, .fa-tv, .c4-tv, .qr-tv, .td-show { justify-content: center; }
.p3-tv, .ch-tv, .race-tv, .wf-tv, .cs-tv, .cc-tv, .dd-tv { align-items: center; }
.p3-main { justify-content: center; }
.qz-who, .wc-lives { margin-top: 18px; }
.p3-side, .wf-side, .ch-side, .cc-side { align-self: center; }
/* Phones: the game sits in the middle of the space under the top bar (long screens still scroll from the top) */
#phgame { flex: 1; display: flex; flex-direction: column; }
#phgame > .phgameview { flex: 1; height: auto; display: flex; flex-direction: column; }
#phgame > .phgameview > * { margin-top: auto; margin-bottom: auto; width: 100%; }

/* On/off switches (profile settings on the front page and phones) */
.pftoggle { display: flex; align-items: center; gap: 12px; margin: 8px 0; font-weight: 700; color: #10357E; cursor: pointer; }
.pftoggle input { position: absolute; opacity: 0; pointer-events: none; }
.pftoggle .sw { width: 52px; height: 30px; flex: 0 0 52px; border-radius: 999px; background: #C9D6E8; position: relative; transition: background 0.15s; box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2); }
.pftoggle .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3); transition: left 0.15s; }
.pftoggle input:checked + .sw { background: #14B88A; }
.pftoggle input:checked + .sw::after { left: 25px; }

/* Drawn game icons next to text (big screen and phones) */
.gi { display: inline-block; width: 1.25em; height: 1.25em; vertical-align: -0.28em; margin-right: 0.12em; }
.gi img.gico { width: 100%; height: 100%; display: block; object-fit: contain; }
.gi svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 0.05em 0.04em rgba(0, 0, 0, 0.25)); }
.big-emoji .gi, .intro-emoji .gi, .bigmsg .emoji .gi { width: 1em; height: 1em; vertical-align: middle; margin: 0; }
.gamecard > span .gi { width: 1.4em; height: 1.4em; margin: 0; }
.c4-tv .qz-who, .hs-tv .qz-who { justify-content: center; }
