* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #1a1033;
  color: #fff;
  touch-action: manipulation;
}
h1, h2, h3 { margin: 0.3em 0; }
button, select, input {
  font: inherit;
  font-size: 1rem;
  border-radius: 8px;
  border: none;
  padding: 0.6em 1em;
}
button { background: #ffcc33; color: #1a1033; font-weight: 700; cursor: pointer; }
button:disabled { background: #666; color: #ccc; cursor: default; }
button.secondary { background: #3b2d66; color: #fff; }
input { width: 100%; margin: 0.5em 0; }
.muted { color: #b8aee0; }
.hidden { display: none !important; }

/* ---- Host ---- */
.host { padding: 1rem 2rem; }
.host header { display: flex; justify-content: space-between; align-items: center; }
.lobby-top { display: flex; gap: 2rem; align-items: center; margin: 1rem 0; }
.lobby-top img { background: #fff; padding: 8px; border-radius: 8px; width: 220px; }
.code { font-size: 4rem; font-weight: 800; letter-spacing: 0.15em; color: #ffcc33; }
.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin: 0.8rem 0; }
.teams { display: flex; gap: 1rem; flex-wrap: wrap; }
.team { flex: 1; min-width: 200px; background: #2a1d52; border-radius: 10px; padding: 0.8rem; border-top: 8px solid var(--c); }
.team li { margin: 0.3em 0; }
.team select { padding: 0.2em; font-size: 0.85rem; margin-left: 0.4em; }
.chip { display: inline-block; background: #3b2d66; padding: 0.3em 0.7em; border-radius: 999px; margin: 0.2em; }
.off { opacity: 0.45; }
.panel { background: #2a1d52; border-radius: 10px; padding: 1rem; margin-top: 1.5rem; }
.order { font-size: 2rem; padding-left: 1.5em; }
.order li { margin: 0.3em 0; }
.order .locked { text-decoration: line-through; opacity: 0.5; }
.badge { padding: 0.2em 0.6em; border-radius: 6px; font-weight: 700; }
.badge.open { background: #2e7d32; }
.badge.closed { background: #555; }

/* ---- Player ---- */
.player { min-height: 100vh; display: flex; flex-direction: column; text-align: center; user-select: none; -webkit-user-select: none; }
.player .top { padding: 1rem; background: var(--c, #3b2d66); font-size: 1.4rem; font-weight: 800; }
.player main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; gap: 1rem; }
.player form { width: 100%; max-width: 320px; }
#buzz {
  width: 75vw; height: 75vw; max-width: 340px; max-height: 340px;
  border-radius: 50%;
  font-size: 3rem; font-weight: 900;
  background: #e53935; color: #fff;
  box-shadow: 0 8px 0 #8e1c1a;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
#buzz:disabled { background: #555; color: #999; box-shadow: 0 8px 0 #333; }
#buzz:active:not(:disabled) { transform: translateY(6px); box-shadow: 0 2px 0 #8e1c1a; }
.status { font-size: 1.6rem; font-weight: 700; min-height: 2em; }

/* ---- Board ---- */
.host { padding-bottom: 9rem; }
.grid { display: grid; gap: 0.6rem; margin-top: 1rem; }
.cat { background: #3b2d66; border-radius: 8px; padding: 0.5rem 0.4rem; text-align: center; font-weight: 800; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; }
.tile { font-size: clamp(1.4rem, 4.5vh, 2.6rem); padding: 1.8vh 0; background: #ffcc33; }
.tile:disabled { background: #3a3a3a; color: #3a3a3a; }

/* ---- Question ---- */
#qCategory { font-size: 1.4rem; font-weight: 700; margin-top: 1rem; }
.qtext { font-size: clamp(1.8rem, 4vw, 3.5rem); font-weight: 800; line-height: 1.25; margin: 1.5rem 0; }
.qanswer { font-size: 2.4rem; font-weight: 800; color: #7CFC9A; margin-bottom: 1rem; }
.order .turn { font-weight: 800; background: #3b2d66; border-radius: 8px; padding: 0 0.4em; }

/* ---- Scores ---- */
.scores { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 0.6rem; padding: 0.6rem 1rem; background: #120a26; }
.score { flex: 1; text-align: center; border-top: 6px solid var(--c); background: #2a1d52; border-radius: 8px; padding: 0.4rem; }
.score-name { font-weight: 700; }
.score-pts { font-size: 1.6rem; font-weight: 900; }
.score button { padding: 0.2em 0.9em; }

/* ---- Sparkle Round ---- */
.pick { background: #3b2d66; color: #fff; border-bottom: 5px solid var(--c, #3b2d66); font-size: 1.2rem; }
.pick.selected { background: var(--c, #ffcc33); color: #1a1033; }
.card-type { font-size: 1.6rem; font-weight: 800; color: #ffcc33; margin-top: 1rem; }
.timer { font-size: 4rem; font-weight: 900; }
.timer.up { color: #ff6b6b; }
.secret { font-size: 2.6rem; font-weight: 900; color: #ffcc33; line-height: 1.2; }

/* ---- Update 2 ---- */
.funny { background: #3b2d66; color: #fff; border-left: 6px solid var(--c); }
.flash { position: fixed; font-size: 2rem; font-weight: 900; color: #ffcc33; pointer-events: none; animation: flashUp 1.2s ease-out forwards; z-index: 10; }
@keyframes flashUp { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-50px); } }
.pick small { opacity: 0.7; font-weight: 400; }
.qtext.long { font-size: clamp(1.3rem, 2.6vw, 2.4rem); }
.qtext.xlong { font-size: clamp(1.1rem, 2.1vw, 2rem); line-height: 1.3; margin: 1rem 0; }

/* ---- Polish ---- */
/* A solid dark colour on the page itself, so nothing ever flashes white while the gradient repaints
   (e.g. jumping from the long Make your own page to the short lobby). No 'fixed': it repaints badly. */
html { background: #110a24; }
body { min-height: 100vh; background: radial-gradient(ellipse at top, #34206b 0%, #1a1033 55%, #110a24 100%) no-repeat; background-color: #110a24; }
button { box-shadow: 0 3px 0 rgba(0,0,0,0.35); transition: filter 0.15s; }
button:hover:not(:disabled) { filter: brightness(1.08); }
button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.35); }
button.secondary { background: #3b2d66; border: 1px solid #5a4796; }
input, select { background: #fff; color: #1a1033; }
.host header { border-bottom: 1px solid #3b2d66; padding-bottom: 0.6rem; }
.logo { font-size: 1.6rem; font-weight: 900; letter-spacing: 0.01em; }
.logo span, .hero-title span { color: #ffcc33; }
.hero { text-align: center; padding-top: 14vh; }
.hero-title { font-size: clamp(3rem, 8vw, 6rem); font-weight: 900; line-height: 1; text-shadow: 0 4px 0 #0c0619; }
.hero p { font-size: 1.4rem; margin: 1rem 0 2rem; }
button.big { font-size: 1.5rem; padding: 0.8em 1.6em; border-radius: 14px; }
.lobby-top { background: #2a1d52; border: 1px solid #3b2d66; border-radius: 16px; padding: 1.2rem 1.6rem; }
.code { text-shadow: 0 3px 0 #0c0619; }
.team, .panel, .score { border: 1px solid #3b2d66; }
.team { border-top: 8px solid var(--c); border-radius: 14px; }
.cat {
  background: linear-gradient(#45348a, #33256a);
  border-bottom: 3px solid #ffcc33;
  border-radius: 10px; min-height: 3.6rem; line-height: 1.15; font-size: 1.15rem;
}
.tile {
  background: linear-gradient(#ffd95a, #f5b819);
  color: #3a1d00; border-radius: 10px; font-weight: 900;
  box-shadow: 0 4px 0 #b07d00, inset 0 1px 0 rgba(255,255,255,0.5);
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}
.tile:disabled { background: #241a45; color: transparent; box-shadow: inset 0 0 0 2px #33285c; text-shadow: none; }
#qCategory { color: #ffcc33; text-transform: uppercase; letter-spacing: 0.06em; font-size: 1.1rem; }
.qtext { text-shadow: 0 3px 0 #0c0619; }
.qanswer { background: rgba(124,252,154,0.1); border: 1px solid #2e7d32; border-radius: 12px; padding: 0.4em 0.7em; display: inline-block; }
.scores { background: rgba(12,6,25,0.92); border-top: 1px solid #3b2d66; }
.score { border-top: 6px solid var(--c); border-radius: 12px; background: #221747; }
.score-pts { font-size: 2rem; color: #fff; }
.chip { border: 1px solid #5a4796; }
.player .top { box-shadow: 0 3px 10px rgba(0,0,0,0.35); }
.player form h2 { font-size: 1.8rem; }
.player input { font-size: 1.2rem; padding: 0.8em 1em; border-radius: 12px; }
.player form button { font-size: 1.3rem; padding: 0.8em; border-radius: 12px; }
#buzz { background: radial-gradient(circle at 35% 30%, #ff6b5e, #e53935 55%, #b71c1c); border: 6px solid rgba(255,255,255,0.15); }
#buzz:disabled { background: #4a4560; border-color: transparent; }

/* ---- Animations ---- */
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 50; }

/* Screens slide in */
section.enter { animation: rise 0.45s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* The board deals its tiles in, then they lift on hover */
#board.enter { animation: none; }
#board.enter .cat { animation: drop 0.4s ease-out both; }
#board.enter .tile { animation: deal 0.45s cubic-bezier(.2,1.4,.4,1) both; animation-delay: calc(var(--i) * 45ms + 120ms); }
@keyframes drop { from { opacity: 0; transform: translateY(-20px); } }
@keyframes deal { from { opacity: 0; transform: scale(0.4) rotate(-8deg); } }
.tile { transition: transform 0.15s, filter 0.15s; }
.tile:hover:not(:disabled) { transform: translateY(-4px) scale(1.03); box-shadow: 0 8px 0 #b07d00, 0 0 24px #ffcc3366; }

/* Question appears with a zoom; the answer flips in */
#question.enter .qtext { animation: zoomIn 0.5s cubic-bezier(.2,1.3,.4,1) both; animation-delay: 0.1s; }
@keyframes zoomIn { from { opacity: 0; transform: scale(0.85); } }
.qanswer:not(.hidden) { animation: flipIn 0.5s cubic-bezier(.2,1.3,.4,1) both; transform-origin: top; }
@keyframes flipIn { from { opacity: 0; transform: rotateX(-90deg); } }
.badge.open { animation: pulseGreen 1s ease-in-out infinite; }
@keyframes pulseGreen { 50% { box-shadow: 0 0 0 6px #2e7d3255, 0 0 18px #4caf50; } }
.order li.pop { animation: slideIn 0.4s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-40px) scale(0.9); } }
.order .turn { box-shadow: 0 0 0 2px #ffcc33, 0 0 20px #ffcc3355; }

/* Wrong answer: shake and a red flash */
.shake { animation: shake 0.45s ease-in-out; }
@keyframes shake { 20%, 60% { transform: translateX(-12px); } 40%, 80% { transform: translateX(12px); } }
body::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 40; background: radial-gradient(transparent 40%, #ff1744aa); opacity: 0; }
body.redflash::after { animation: redflash 0.6s ease-out; }
@keyframes redflash { 0% { opacity: 1; } 100% { opacity: 0; } }

/* Scores bump up (green) or down (red) */
.score.gain .score-pts { animation: gain 0.7s ease-out; }
.score.lose .score-pts { animation: lose 0.6s ease-out; }
@keyframes gain { 30% { transform: scale(1.5); color: #7CFC9A; text-shadow: 0 0 18px #7CFC9A; } }
@keyframes lose { 30% { transform: scale(0.8); color: #ff6b6b; } }
.score.gain { animation: boxGlow 0.9s ease-out; }
@keyframes boxGlow { 30% { box-shadow: 0 0 30px var(--c); } }

/* Bonus: a spinning star and a glowing card */
#bonus.enter { animation: popIn 0.5s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes popIn { from { opacity: 0; transform: scale(0.7); } }
#bonus .qtext { background: linear-gradient(#2a1d52, #22174a); border: 2px solid #ffcc33; border-radius: 20px; padding: 1.2rem 1.6rem; box-shadow: 0 0 40px #ffcc3333; }
#bonusFor { font-size: 2rem; animation: wiggle 2s ease-in-out infinite; display: inline-block; }
@keyframes wiggle { 0%, 100% { transform: rotate(-1.5deg); } 50% { transform: rotate(1.5deg); } }

/* Sparkle Round: shimmering title, glowing timer */
.sparkle-title {
  font-size: 2.4rem;
  background: linear-gradient(90deg, #ffcc33, #ff6b9a, #c77dff, #6bd5ff, #ffcc33);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 4s linear infinite;
}
@keyframes shimmer { to { background-position: 300% 0; } }
#spCard.enter { animation: popIn 0.5s cubic-bezier(.2,1.4,.4,1) both; }
.timer { text-shadow: 0 0 20px #ffffff44; }
.timer.up { animation: heartbeat 1s ease-in-out infinite; text-shadow: 0 0 24px #ff6b6b; }
@keyframes heartbeat { 15% { transform: scale(1.15); } 30% { transform: scale(1); } }
.pick { transition: transform 0.15s; }
.pick.selected { transform: scale(1.06); box-shadow: 0 0 20px var(--c, #ffcc33); }

/* Lobby: new players pop in; the room code glows */
.chip.pop, .team li.pop { animation: popIn 0.45s cubic-bezier(.2,1.6,.4,1) both; }
.code { animation: glow 2.4s ease-in-out infinite alternate; }
.lobby-top img { box-shadow: 0 0 30px #ffcc3344; }

/* ---- Phone ---- */
.player main > * { animation: rise 0.4s ease-out both; }
#buzz:not(:disabled) { animation: buzzReady 1.1s ease-in-out infinite; }
@keyframes buzzReady {
  0%, 100% { box-shadow: 0 8px 0 #8e1c1a, 0 0 0 0 #ff525299; }
  50% { box-shadow: 0 8px 0 #8e1c1a, 0 0 0 22px #ff525200; transform: scale(1.03); }
}
.player.first { animation: firstFlash 0.9s ease-out; }
@keyframes firstFlash { 0% { background: var(--c, #ffcc33); } 100% { background: transparent; } }
.status.big { font-size: 2.2rem; color: #ffcc33; animation: bounce 0.6s cubic-bezier(.2,1.6,.4,1); }
@keyframes bounce { from { transform: scale(0.5); opacity: 0; } }
.status.sad { animation: shake 0.45s ease-in-out; }
.secret { animation: popIn 0.5s cubic-bezier(.2,1.4,.4,1) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Host PIN (only when HOST_PIN is set on the server) */
.pin { max-width: 320px; margin: 1.5rem auto 0; display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.pin p { width: 100%; margin: 0; }
.pin input { flex: 1; margin: 0; }
.pin-error { width: 100%; color: #ff6b6b; font-weight: 700; min-height: 1.2em; }

/* ---- Setup screen ---- */
.themes { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.9rem; margin: 0.6rem 0 1rem; }
.theme { background: linear-gradient(#34266e, #271b55); color: #fff; border: 2px solid #4a3a8a; border-radius: 16px; padding: 1rem 0.6rem; display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.theme:hover:not(:disabled) { transform: translateY(-3px); border-color: #ffcc33; }
.theme.selected { border-color: #ffcc33; box-shadow: 0 0 24px #ffcc3355; background: linear-gradient(#45348a, #33256a); }
.theme.soon { opacity: 0.5; }
.theme:disabled { background: #241a45; color: #aaa; }
.theme-emoji { font-size: 2.6rem; line-height: 1; }
.theme-name { font-weight: 800; font-size: 1.1rem; }
.theme small { font-weight: 400; opacity: 0.8; }
.setup-panel { margin-top: 0; }
.setup-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.theme-title { font-size: 1.8rem; font-weight: 900; }
#customise { margin-top: 1rem; }
#customise summary { cursor: pointer; font-weight: 700; color: #ffcc33; padding: 0.4rem 0; }
#customise summary::after { content: ' ▾'; }
#customise[open] summary::after { content: ' ▴'; }
.opt { display: flex; align-items: flex-start; gap: 1rem; margin: 0.7rem 0; flex-wrap: wrap; }
.opt-label { width: 11rem; font-weight: 700; padding-top: 0.4rem; }
.opt-label small { display: block; font-weight: 400; }
.opt-label small.ok { color: #7CFC9A; }
.opt-label small.bad { color: #ff6b6b; font-weight: 700; }
.seg { display: flex; flex-wrap: wrap; gap: 0.4rem; flex: 1; }
.segbtn { background: #241a45; color: #ccc; border: 1px solid #4a3a8a; box-shadow: none; padding: 0.4em 0.9em; }
.segbtn.on { background: #ffcc33; color: #1a1033; border-color: #ffcc33; }
.pin { margin: 1rem 0 0; max-width: none; justify-content: flex-start; }

/* ---- Board extras ---- */
.board-title { color: #b8aee0; font-weight: 700; margin-top: 0.4rem; }
.board-done { display: flex; align-items: center; gap: 1rem; justify-content: center; background: #2a1d52; border: 2px solid #ffcc33; border-radius: 14px; padding: 0.6rem 1rem; margin-top: 0.6rem; font-size: 1.3rem; font-weight: 800; animation: popIn 0.5s cubic-bezier(.2,1.4,.4,1) both; }

/* ---- Double, fun fact, peek ---- */
.double-banner { display: inline-block; margin-top: 0.4rem; padding: 0.3em 0.8em; border-radius: 999px; font-weight: 900; color: #1a1033; background: linear-gradient(90deg, #ffcc33, #ff6b9a, #ffcc33); background-size: 200% 100%; animation: shimmer 2s linear infinite; }
.qfact { font-size: 1.3rem; background: rgba(255,204,51,0.08); border-left: 4px solid #ffcc33; border-radius: 8px; padding: 0.5em 0.8em; margin-bottom: 0.8rem; max-width: 60rem; animation: rise 0.5s ease-out both; }
.peek { background: #120a26; border: 1px dashed #5a4796; border-radius: 10px; padding: 0.4em 0.8em; display: inline-block; }
.big-banner {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 60;
  font-size: clamp(4rem, 14vw, 11rem); font-weight: 900; color: #ffcc33;
  text-shadow: 0 0 40px #ff6b9a, 0 8px 0 #0c0619;
  animation: bannerPop 1.8s cubic-bezier(.2,1.4,.4,1) forwards;
}
@keyframes bannerPop { 0% { opacity: 0; transform: scale(0.3) rotate(-8deg); } 20% { opacity: 1; transform: scale(1.1) rotate(2deg); } 35% { transform: scale(1) rotate(0); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.2); } }

/* ---- Winner ---- */
.trophy { font-size: 6rem; animation: wiggle 1.6s ease-in-out infinite; }
.ranking { list-style: none; padding: 0; margin: 1.5rem auto; max-width: 34rem; font-size: 1.6rem; }
.ranking li { display: flex; justify-content: space-between; background: #2a1d52; border: 1px solid #3b2d66; border-radius: 12px; padding: 0.5em 1em; margin: 0.4rem 0; animation: popIn 0.5s cubic-bezier(.2,1.4,.4,1) both; }
.ranking li.first { border: 2px solid #ffcc33; box-shadow: 0 0 24px #ffcc3355; font-size: 1.15em; }
.row.center { justify-content: center; }
.emoji-rain { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 45; }
.emoji-rain span { position: absolute; top: -3rem; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

/* ---- Phone: Double notice ---- */
.double-note { font-size: 1.6rem; font-weight: 900; color: #ffcc33; animation: bounce 0.6s cubic-bezier(.2,1.6,.4,1); }
#customise summary { list-style: none; }
#customise summary::-webkit-details-marker { display: none; }

/* ---- Make your own ---- */
.make-own { margin-bottom: 1rem; }
.make-own .opt input { flex: 1; width: auto; margin: 0; }
.mo-step { margin: 1.1rem 0 0.4rem; }
.mo-box { width: 100%; box-sizing: border-box; font: 0.85rem/1.4 ui-monospace, Menlo, monospace; background: #160f2e; color: #e8e2ff; border: 1px solid #4a3a8a; border-radius: 10px; padding: 0.7rem; resize: vertical; }
.make-own .row { display: flex; gap: 0.6rem; align-items: center; margin-top: 0.6rem; flex-wrap: wrap; }
.filebtn { display: inline-block; font-weight: 700; padding: 0.6em 1em; border-radius: 8px; cursor: pointer; background: #3b2d66; border: 1px solid #5a4796; color: #fff; box-shadow: 0 3px 0 rgba(0,0,0,0.35); }
.mo-errors { margin-top: 0.8rem; background: #3a1630; border: 1px solid #ff6b6b; border-radius: 10px; padding: 0.6rem 1rem; }
.mo-errors li { margin: 0.2rem 0; }
.mo-preview { margin-top: 0.8rem; background: #1f1640; border: 1px solid #7CFC9A; border-radius: 10px; padding: 0.8rem 1rem; }
.mo-preview h3 { margin-top: 0; }
.mo-preview .cats { color: #b8aee0; margin: 0.2rem 0 0.6rem; }
.mo-checks { margin: 0.4rem 0; padding-left: 1.2rem; }
.mo-checks li { margin: 0.35rem 0; }
.mo-checks .where { color: #b8aee0; font-size: 0.85rem; }

/* How-to-play line for each category */
.qnote { display: inline-block; margin: 0.4rem 0 0.2rem; padding: 0.35rem 0.8rem; border-radius: 999px; background: #2a1d52; border: 1px solid #4a3a8a; color: #e8e2ff; font-size: 1.05rem; }
.qnote b { color: #ffcc33; font-weight: 700; }

/* ================================================================
   BuzzIn clean look: flat surfaces, one accent, calmer motion.
   (Later rules win, so this layer overrides the older styles above.)
   ================================================================ */
:root {
  --bg: #0f0b1f; --surface: #1b1533; --surface-2: #241d42; --line: #2f2756; --line-2: #3d3470;
  --text: #f4f1ff; --muted: #a79fcb; --accent: #ffc933; --accent-ink: #1a1300;
  --good: #22c55e; --bad: #ef4444; --radius: 14px;
}
html, body { background: var(--bg); }
body { background: radial-gradient(1200px 500px at 50% -10%, #241a4a 0%, var(--bg) 70%) no-repeat, var(--bg); color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
.muted { color: var(--muted); }
h2 { font-weight: 800; letter-spacing: -0.01em; }

/* Buttons: flat, one accent colour, quiet secondary */
button { background: var(--accent); color: var(--accent-ink); font-weight: 700; border-radius: 10px; box-shadow: none; transition: filter .15s, background .15s, border-color .15s; }
button:hover:not(:disabled) { filter: brightness(1.06); }
button:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
button:disabled { background: var(--surface-2); color: #6f6894; }
button.secondary, .filebtn { background: transparent; color: var(--text); border: 1px solid var(--line-2); box-shadow: none; }
button.secondary:hover:not(:disabled), .filebtn:hover { background: var(--surface-2); filter: none; }
button.good { background: var(--good); color: #fff; }
button.bad { background: var(--bad); color: #fff; }
button.big { font-size: 1.25rem; padding: 0.75em 1.6em; border-radius: 12px; animation: none; }
input, select, textarea { border-radius: 10px; }
input, select { background: var(--surface-2); color: var(--text); border: 1px solid var(--line-2); }
input::placeholder { color: #7d75a6; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Header and logo */
.host { padding: 1rem clamp(1rem, 3vw, 2.5rem) 9rem; max-width: 1500px; margin: 0 auto; }
.host header { border-bottom: 1px solid var(--line); padding-bottom: 0.7rem; margin-bottom: 0.4rem; }
.logo { display: flex; align-items: center; gap: 0.55rem; font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.logo-mark { width: 2rem; height: 2rem; }
.logo span, .hero-title span { color: var(--accent); }
.header-actions { gap: 0.4rem; }
.header-actions button { font-size: 0.9rem; padding: 0.45em 0.85em; }

/* Start screen */
.hero { padding-top: 16vh; }
.hero-mark { width: 104px; height: 104px; display: block; margin: 0 auto 1rem; }
.hero-mark.small { width: 64px; height: 64px; margin-bottom: 0.4rem; }
.hero-title { font-size: clamp(3rem, 9vw, 5.5rem); font-weight: 900; letter-spacing: -0.04em; line-height: 1; text-shadow: none; }
.hero-title span { animation: none; }
.hero p { font-size: 1.2rem; margin: 0.8rem 0 2rem; }

/* Cards and panels */
.panel, .lobby-top, .team, .theme, .score, .ranking li, .board-done, .mo-preview, .qnote, .peek { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; }
.panel { padding: 1.2rem 1.4rem; }
.chip { background: var(--surface-2); border: 1px solid var(--line-2); }

/* Theme picker */
.theme { background: var(--surface); padding: 1.1rem 0.6rem; transition: border-color .15s, background .15s; }
.theme:hover:not(:disabled) { transform: none; border-color: var(--line-2); background: var(--surface-2); }
.theme.selected { border-color: var(--accent); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--accent); }
.theme-emoji { font-size: 2.2rem; }
.theme-name { font-weight: 700; font-size: 1rem; }
.theme-title { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.01em; }
.segbtn { background: transparent; color: var(--muted); border: 1px solid var(--line-2); font-weight: 600; }
.segbtn:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.segbtn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
#customise summary { color: var(--accent); font-weight: 600; }
.opt-label { color: var(--text); font-weight: 600; }
.mo-box { background: var(--bg); border-color: var(--line-2); }
.mo-preview { border-color: #2f7a4b; }
.mo-errors { background: #2a1220; border-color: #7a2a3a; }

/* Lobby */
.lobby-top { padding: 1.4rem 1.8rem; }
.lobby-top img { box-shadow: none; border-radius: 12px; }
.code { color: var(--accent); text-shadow: none; animation: none; font-size: 4.2rem; letter-spacing: 0.18em; }
.team { border-top: 4px solid var(--c); }

/* Board */
.board-title { color: var(--muted); font-weight: 600; }
.grid { gap: 0.55rem; }
.cat { background: var(--surface); border: 1px solid var(--line); border-bottom: 3px solid var(--accent); border-radius: 12px; font-weight: 700; font-size: 1.05rem; }
.tile { background: var(--accent); color: var(--accent-ink); border-radius: 12px; box-shadow: none; text-shadow: none; font-weight: 800; }
.tile:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 18px #ffc93333; filter: brightness(1.05); }
.tile:disabled { background: var(--surface); color: transparent; box-shadow: inset 0 0 0 1px var(--line); }

/* Question */
.controls { gap: 0.5rem; }
.controls .spacer { flex: 1; }
.badge { border-radius: 999px; padding: 0.3em 0.8em; font-size: 0.85rem; letter-spacing: 0.02em; }
.badge.closed { background: var(--surface-2); color: var(--muted); }
.badge.open { background: var(--good); color: #fff; }
.funny-row { gap: 0.4rem; }
.funny { background: transparent; color: var(--muted); border: 1px solid var(--line-2); border-left: 4px solid var(--c); font-size: 0.85rem; padding: 0.35em 0.75em; font-weight: 600; }
.funny:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
#qCategory { color: var(--accent); font-weight: 700; font-size: 1rem; letter-spacing: 0.08em; }
.qnote { border-radius: 999px; }
.qnote b { color: var(--accent); }
.qtext { text-shadow: none; letter-spacing: -0.01em; }
.qanswer { color: #4ade80; background: #0f2a1a; border: 1px solid #1f5a35; }
.qfact { background: var(--surface); border-left-color: var(--accent); }
.order .turn { background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--accent); }
.double-banner { animation: none; background: var(--accent); }

/* Scores bar */
.scores { background: rgba(15, 11, 31, 0.94); border-top: 1px solid var(--line); backdrop-filter: blur(8px); }
.score { border-top: 4px solid var(--c); background: var(--surface); }
.score-name { font-weight: 600; color: var(--muted); }
.score-pts { font-size: 1.9rem; }
.score button { background: transparent; color: var(--muted); border: 1px solid var(--line-2); padding: 0.1em 0.8em; }

/* Bonus, Sparkle, Winner: less wobble */
#bonus .qtext { background: var(--surface); border: 1px solid var(--accent); box-shadow: none; }
#bonusFor { animation: none; color: var(--accent); }
.sparkle-title { animation: none; background-position: 0 0; }
.pick { background: var(--surface); border: 1px solid var(--line-2); border-bottom: 4px solid var(--c, var(--line-2)); }
.pick.selected { transform: none; box-shadow: none; }
.timer { text-shadow: none; }
.ranking li.first { border-color: var(--accent); box-shadow: none; }

/* Phone */
.player .top { font-size: 1.2rem; font-weight: 800; box-shadow: none; }
.player input { background: var(--surface-2); }
#buzz { border: 0; box-shadow: 0 8px 0 #9b1c1c; }
#buzz:disabled { background: var(--surface-2); color: #6f6894; box-shadow: 0 8px 0 #120d26; }
.logo .logo-word { color: var(--text); }
.logo .logo-word span { color: var(--accent); }

/* ---- Header: join info, ⋯ menu ---- */
.host header { gap: 1rem; }
.join-info { flex: 1; text-align: center; color: var(--muted); font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 11rem; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; padding: 0.3rem; z-index: 70; box-shadow: 0 12px 30px #0008; }
.menu-item { display: block; width: 100%; text-align: left; background: transparent; color: var(--text); font-weight: 600; padding: 0.55em 0.8em; border-radius: 8px; }
.menu-item:hover { background: var(--surface-2); filter: none; }
button.attention { border-color: var(--accent); color: var(--accent); }

/* ---- How to play ---- */
.howto { position: fixed; inset: 0; z-index: 80; background: rgba(8, 5, 18, 0.75); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.howto-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; padding: 1.4rem 1.8rem; width: min(760px, 100%); max-height: 100%; overflow: auto; }
.howto-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.4rem; }
.howto-head h2 { margin: 0; }
.howto-list { list-style: none; padding: 0; margin: 0; }
.howto-list li { display: flex; gap: 0.9rem; align-items: baseline; padding: 0.6rem 0; border-top: 1px solid var(--line); line-height: 1.4; }
.howto-list li:first-child { border-top: 0; }
.howto-list li > span { font-size: 1.4rem; width: 2rem; text-align: center; flex: none; }
.howto-list b { display: block; color: var(--accent); }
/* Big version for the TV */
.howto.tv { padding: 0; background: var(--bg); }
.howto.tv .howto-card { width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; padding: 3vh 5vw; display: flex; flex-direction: column; }
.howto.tv .howto-head h2 { font-size: clamp(2rem, 5vh, 3.4rem); }
.howto.tv .howto-list { flex: 1; display: flex; flex-direction: column; justify-content: space-evenly; }
.howto.tv .howto-list li { font-size: clamp(1.2rem, 3.3vh, 2.2rem); padding: 1.2vh 0; }
.howto.tv .howto-list li > span { font-size: 1.4em; width: 2.2em; }

/* ---- Customise hints, first-time explainers ---- */
.explain { display: inline-block; margin: 0.5rem 0 0; padding: 0.35rem 0.85rem; border-radius: 10px; background: #2a2210; border: 1px solid #6b5313; color: #ffe08a; font-weight: 600; }
.explain { display: table; } /* its own line, under the heading */

/* ---- Reveal ---- */
#reveal { text-align: center; padding-top: 6vh; }
.reveal-head { font-size: clamp(1.4rem, 3vw, 2.2rem); font-weight: 800; }
.reveal-label { color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.9rem; margin-top: 2rem; }
.reveal-answer { font-size: clamp(2.6rem, 7vw, 5.5rem); font-weight: 900; color: #4ade80; line-height: 1.1; margin: 0.4rem 0 1.4rem; letter-spacing: -0.02em; }
#reveal .qfact { display: inline-block; text-align: left; max-width: 52rem; font-size: 1.3rem; }
#reveal .row { justify-content: center; margin-top: 1.6rem; }
#reveal.enter .reveal-answer { animation: zoomIn 0.5s cubic-bezier(.2,1.3,.4,1) both; }

/* ---- Lobby: team picker on waiting players ---- */
#unassigned .chip select { margin-left: 0.4rem; padding: 0.15em 0.3em; font-size: 0.85rem; }

/* ---- Phone ---- */
.player .top { padding: 0.7rem 1rem; }
.top-name { font-size: 1.2rem; font-weight: 800; }
.top-team { font-size: 0.9rem; font-weight: 600; opacity: 0.9; }
.top-team:empty { display: none; }
.joining { color: var(--muted); font-weight: 600; margin-bottom: 0.4rem; }
.join-info { display: flex; justify-content: center; align-items: baseline; min-width: 0; text-overflow: clip; }
.join-url { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.join-code { flex: none; white-space: nowrap; }
.join-code b { color: var(--accent); letter-spacing: 0.08em; }
.header-actions { flex-wrap: nowrap; }

/* ---- Setup: compact Customise rows, ⓘ tooltips ---- */
#themeDetail { padding: 1rem 1.3rem; }
#themeBoards { font-size: 0.95rem; line-height: 1.5; }
#setupNote { color: #ff8a8a; font-weight: 600; margin-top: 0.4rem; }
#customise { margin-top: 0.8rem; border-top: 1px solid var(--line); padding-top: 0.3rem; }
#customise .opt { display: grid; grid-template-columns: 13rem 1fr; align-items: center; gap: 0.8rem; margin: 0; padding: 0.4rem 0; border-top: 1px solid var(--line); }
#customise .opt:first-of-type { border-top: 0; }
#customise .opt-label { width: auto; padding: 0; display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
#customise .opt-label small { display: block; flex-basis: 100%; }
#customise .seg { gap: 0.35rem; }
#customise .segbtn { padding: 0.35em 0.8em; font-size: 0.92rem; }
#resetSetup { margin-top: 0.5rem; font-size: 0.85rem; padding: 0.4em 0.8em; }
@media (max-width: 700px) { #customise .opt { grid-template-columns: 1fr; gap: 0.4rem; } }

/* A tooltip from data-tip: on hover, and on focus (keyboard, or a tap) */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after, .info[data-tip]:focus::after, .cat-chip[data-tip]:focus::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  width: max-content; max-width: 18rem; white-space: normal; text-align: left;
  background: #0b0818; color: var(--text); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 0.45em 0.7em; font-size: 0.85rem; font-weight: 500; line-height: 1.35; z-index: 90; pointer-events: none;
  box-shadow: 0 8px 24px #0009;
}
.info { background: transparent; color: var(--muted); border: 0; padding: 0 0.2em; font-size: 0.95rem; line-height: 1; cursor: help; font-weight: 400; box-shadow: none; }
.info:hover:not(:disabled), .info:focus { color: var(--accent); filter: none; }
.info[data-tip]::after { left: 0; transform: none; }
/* The space under the page is only for the scores bar; without it, no extra scrolling. */
.host:has(> #scores.hidden) { padding-bottom: 1.5rem; }
/* Read-only category chips (a board with exactly 5 categories) */
.cat-chip { display: inline-block; padding: 0.35em 0.8em; font-size: 0.92rem; font-weight: 600; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); cursor: default; }
.cat-chip[data-tip] { cursor: help; }
.cat-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Tighter setup so it fits a laptop screen with the category lists showing */
#setup > .row:first-child { margin: 0.4rem 0 0.2rem; }
#setup h2 { font-size: 1.3rem; margin: 0.2rem 0; }
.themes { gap: 0.7rem; margin: 0.4rem 0 0.8rem; }
.theme { flex-direction: row; justify-content: center; gap: 0.55rem; padding: 0.75rem 0.6rem; flex-wrap: wrap; }
.theme-emoji { font-size: 1.6rem; }
.theme small { flex-basis: 100%; text-align: center; }
.theme-title { font-size: 1.4rem; }
#customise .opt { padding: 0.3rem 0; }
#customise .segbtn, .cat-chip { padding: 0.3em 0.7em; font-size: 0.88rem; }

/* ---- Host remote: TV "show mode" and pairing ---- */
.show-only { display: none; }
body.show-mode .show-only { display: block; }
body.show-mode .host-only { display: none !important; }
body.show-mode .tile { pointer-events: none; }
.sp-show { font-size: clamp(1.4rem, 3vw, 2.2rem); font-weight: 800; color: var(--muted); margin-top: 2rem; }
.remote-badge { flex: none; font-size: 0.85rem; font-weight: 600; color: #4ade80; background: #0f2a1a; border: 1px solid #1f5a35; border-radius: 999px; padding: 0.25em 0.75em; white-space: nowrap; }
.show-controls { position: fixed; left: 0.6rem; bottom: 0.6rem; z-index: 75; font-size: 0.75rem; padding: 0.3em 0.7em; background: transparent; color: var(--muted); border: 1px solid var(--line); opacity: 0.5; }
.show-controls:hover { opacity: 1; filter: none; }
body:has(#scores:not(.hidden)) .show-controls { bottom: 7.4rem; } /* sit above the scores bar */
.pair-card { width: min(460px, 100%); text-align: center; }
.pair-card .howto-head { text-align: left; }
#pairQr { width: 240px; height: 240px; background: #fff; border-radius: 12px; padding: 8px; margin: 0.6rem auto 0; display: block; }
.pair-big { font-size: 1.4rem; font-weight: 800; margin: 0.8rem 0 0.3rem; }
#pairAsk .row { margin-top: 1rem; }

/* ---- Host remote (phone) ---- */
body.remote { padding: 0 0 2rem; min-height: 100vh; }
.r-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.9rem; background: rgba(15, 11, 31, 0.95); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.r-top .logo { font-size: 1.15rem; }
.r-top .logo-mark { width: 1.6rem; height: 1.6rem; }
.r-room { flex: 1; text-align: right; color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.r-message { text-align: center; padding: 22vh 1.5rem 0; font-size: 1.2rem; line-height: 1.4; }
.r-msg-big { font-size: 3rem; margin-bottom: 0.6rem; }
body.remote main { padding: 0.8rem 0.9rem; max-width: 640px; margin: 0 auto; }
.r-scores { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.3rem; }
.r-score { flex: 1; min-width: 7.5rem; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--c); border-radius: 12px; padding: 0.35rem 0.5rem; text-align: center; }
.r-score-name { font-size: 0.8rem; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-score-row { display: flex; align-items: center; justify-content: space-between; gap: 0.3rem; }
.r-score-row b { font-size: 1.3rem; }
.r-score-row button { padding: 0.2em 0.75em; font-size: 1.1rem; }
#rStage { margin-top: 0.8rem; display: flex; flex-direction: column; gap: 0.7rem; }
#rStage h2, #rStage h3 { margin: 0.2rem 0 0; }
#rStage button { font-size: 1.05rem; padding: 0.8em 1em; border-radius: 12px; }
#rStage .r-big { width: 100%; font-size: 1.15rem; padding: 0.95em 1em; }
.r-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.r-row select, .r-row input { width: auto; flex: 1; margin: 0; padding: 0.75em; font-size: 1rem; }
.r-two { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
body.remote button:disabled { opacity: 0.35; filter: grayscale(0.6); }
.r-sub { color: var(--muted); }
.r-sub b { color: var(--text); }
.r-q { font-size: 1.1rem; line-height: 1.4; margin: 0; }
.r-answer { background: #0f2a1a; border: 1px solid #1f5a35; border-radius: 14px; padding: 0.7rem 0.9rem; }
.r-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: #86c79c; }
.r-answer-text { font-size: 1.7rem; font-weight: 900; color: #4ade80; line-height: 1.15; margin-top: 0.15rem; }
.r-fact { margin-top: 0.4rem; color: #cfe9d7; font-size: 0.95rem; }
.r-order { margin: 0; padding-left: 1.4rem; font-size: 1.15rem; }
.r-order li { margin: 0.2rem 0; }
.r-order .locked { text-decoration: line-through; opacity: 0.5; }
.r-order .turn { font-weight: 800; }
#rStage .badge.open { text-align: center; padding: 0.7em; font-size: 1rem; }
#rStage .r-funny button { flex: 1; font-size: 0.9rem; padding: 0.6em 0.7em; }
.r-grid { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 0.3rem; }
.r-cat { font-size: 0.68rem; font-weight: 700; text-align: center; color: var(--muted); line-height: 1.15; padding: 0.2rem 0.1rem; display: flex; align-items: flex-end; justify-content: center; min-height: 2.4rem; overflow: hidden; }
#rStage .r-tile { padding: 0.75em 0; font-size: 1rem; font-weight: 800; border-radius: 9px; }
#rStage .r-tile:disabled { background: var(--surface); color: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.r-wait { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0.6rem; display: flex; flex-direction: column; gap: 0.4rem; }
.r-team { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 10px; padding: 0.5rem 0.7rem; }
#rStage .timer { font-size: 2.6rem; text-align: center; }
#rStage .pick { font-size: 1rem; }

/* ---- 🌐 Share with community (Make your own, after Check pack) ---- */
.share { margin-top: 0.9rem; border-top: 1px solid var(--line, #33285c); padding-top: 0.6rem; }
.share summary { cursor: pointer; font-weight: 700; color: var(--text, #fff); list-style: none; padding: 0.3rem 0; }
.share summary::-webkit-details-marker { display: none; }
.share summary::after { content: ' ▾'; color: var(--muted, #b8aee0); }
.share[open] summary::after { content: ' ▴'; }
.share label { display: block; margin: 0.6rem 0 0.2rem; font-weight: 600; }
.share input:not([type="checkbox"]) { max-width: 22rem; }
.share .share-hint { font-size: 0.85rem; margin-top: 0.2rem; }
.share .share-label { margin: 0.8rem 0 0.3rem; font-weight: 600; }
.share-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.share label.share-tag { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; font-weight: 500; padding: 0.3rem 0.65rem; border: 1px solid var(--line, #33285c); border-radius: 999px; cursor: pointer; }
.share label.share-tag:has(input:checked) { border-color: var(--accent, #ffcc33); background: rgba(255, 204, 51, 0.12); }
.share label.share-tag:has(input:disabled) { opacity: 0.45; cursor: default; }
.share label.share-kid { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; margin-top: 0.9rem; }
.share input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--accent, #ffcc33); }
.share-done { color: #7CFC9A; font-weight: 600; }

/* ---- /admin ---- */
body.admin { padding: 0 0 3rem; }
.a-top { display: flex; align-items: center; justify-content: space-between; padding: 0.8rem 1.2rem; border-bottom: 1px solid #2a2150; }
.a-title { margin-left: 0.4rem; color: var(--muted); font-weight: 600; }
.a-main { max-width: 960px; margin: 0 auto; padding: 1rem; }
.a-card { background: #1a1338; border: 1px solid #2f2560; border-radius: 14px; padding: 1rem 1.1rem; margin-bottom: 1rem; }
.a-login { max-width: 360px; margin: 3rem auto; display: grid; gap: 0.5rem; }
.a-login h2 { margin: 0 0 0.4rem; }
.a-error { color: #ff8a8a; min-height: 1.2em; }
.a-notice { background: #3a1630; border: 1px solid #ff6b6b; border-radius: 10px; padding: 0.7rem 1rem; margin-bottom: 1rem; }
.a-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.a-tabs button { background: transparent; color: var(--text); border: 1px solid #3a2f6e; box-shadow: none; }
.a-tabs button.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.a-msg { position: sticky; top: 0.5rem; z-index: 5; background: #143524; border: 1px solid #7CFC9A; border-radius: 10px; padding: 0.6rem 1rem; margin-bottom: 1rem; }
.a-msg.bad { background: #3a1630; border-color: #ff6b6b; }
.a-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.a-row input, .a-row select { width: auto; flex: 1; min-width: 8rem; margin: 0; }
.a-spread { justify-content: space-between; }
.a-board h3, .a-listed h3 { margin: 0 0 0.2rem; }
.a-grid { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 0.8rem; align-items: center; margin: 0.8rem 0; max-width: 32rem; }
.a-grid input { margin: 0; }
.a-label { font-weight: 600; margin: 0.6rem 0 0.3rem; }
.a-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.a-tag, .a-check { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.6rem; border: 1px solid #3a2f6e; border-radius: 999px; cursor: pointer; font-weight: 500; }
.a-check { border: 0; padding: 0; }
.a-tag:has(input:checked) { border-color: var(--accent); background: rgba(255, 201, 51, 0.12); }
.a-tag:has(input:disabled) { opacity: 0.45; cursor: default; }
.admin input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--accent); }
.a-suggest { margin-top: 0.8rem; padding: 0.7rem 0.9rem; border: 1px dashed var(--accent); border-radius: 10px; display: grid; gap: 0.5rem; justify-items: start; }
.a-suggest .a-row { width: 100%; }
.a-emoji { max-width: 4.5rem; min-width: 4.5rem !important; flex: 0 0 4.5rem !important; text-align: center; }
.a-preview { margin: 1rem 0; background: #140e2c; border-radius: 10px; padding: 0.6rem 0.9rem; }
.a-preview summary { cursor: pointer; font-weight: 600; }
.a-preview h4 { margin: 1rem 0 0.4rem; color: var(--accent); }
.a-cat { margin: 0.6rem 0 0.9rem; }
.a-cat-name { font-weight: 700; }
.a-cat ol { margin: 0.3rem 0 0; padding-left: 1.3rem; }
.a-cat li { margin: 0.3rem 0; }
.a-flag { background: rgba(255, 107, 107, 0.12); border-left: 3px solid #ff6b6b; border-radius: 6px; padding: 0.4rem 0.6rem; margin: 0.4rem 0; }
.a-verify { background: rgba(255, 201, 51, 0.12); border-left: 3px solid var(--accent); padding-left: 0.4rem; }
.a-actions { margin-top: 0.8rem; }
.a-featured { margin: 0.8rem 0; padding: 0.6rem 0.9rem; border: 1px dashed var(--line-2); border-radius: 10px; }
.a-featured summary { cursor: pointer; font-weight: 600; }
.a-featured p { margin: 0.4rem 0 0.6rem; }
.a-featured .a-row { margin-top: 0.6rem; }
.a-featured select { flex: 1 1 16rem; min-width: 0; margin: 0; }
.a-fboard { margin-top: 0.6rem; }
.a-extras { list-style: none; margin: 0.2rem 0 0; padding: 0; display: grid; gap: 0.3rem; }
.a-extras li { padding: 0.35rem 0.6rem; background: #140e2c; border-radius: 8px; gap: 0.6rem; }
.admin button.danger { background: #5a1f33; color: #ffd6dc; border-color: #ff6b6b; }
.a-badge { display: inline-block; margin-left: 0.5rem; font-size: 0.75rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: #3a2f6e; color: var(--muted); vertical-align: middle; }
.a-archived { opacity: 0.65; }
.a-tagrow { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; padding: 0.5rem 0; border-bottom: 1px solid #2a2150; }
.a-tagrow:last-child { border-bottom: 0; }
.a-tagrow input, .a-tagrow select { width: auto; margin: 0; }
.a-tagrow input:not(.a-emoji) { flex: 1; min-width: 9rem; }
.a-count { min-width: 9rem; }
.admin button:disabled { opacity: 0.4; cursor: default; }

/* ---- Setup tabs and 🌐 Community ---- */
.setup-tabs { display: flex; gap: 0.3rem; flex-wrap: wrap; margin: 0.2rem 0 0.4rem; border-bottom: 1px solid #2f2560; }
.setup-tab { background: transparent; color: var(--muted); border: 0; border-bottom: 3px solid transparent; border-radius: 0; box-shadow: none; padding: 0.55rem 0.9rem; font-weight: 700; }
.setup-tab:hover:not(:disabled) { color: var(--text); filter: none; }
.setup-tab.on { color: var(--text); border-bottom-color: var(--accent); }
.community { margin: 0.6rem 0 1rem; }
.comm-tools { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.comm-tools input[type="search"] { flex: 1; min-width: 12rem; margin: 0; }
.comm-kid { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; cursor: pointer; }
.comm-kid input { width: auto; margin: 0; accent-color: var(--accent); }
.comm-surprise { margin: 0.8rem 0 0.2rem; }
.comm-h { margin: 1.1rem 0 0.2rem; font-size: 1.05rem; }
/* Tag tiles */
.comm-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.7rem; margin-top: 0.8rem; }
.comm-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 0.7rem 0.7rem; display: grid; justify-items: center; gap: 0.15rem; text-align: center; }
.comm-tile-emoji { font-size: 2rem; line-height: 1.1; }
.comm-tile-name { font-weight: 800; overflow-wrap: anywhere; }
.comm-tile-count { font-size: 0.82rem; color: var(--muted); }
.comm-tile-actions { display: flex; gap: 0.35rem; margin-top: 0.45rem; }
.comm-tile-actions button { padding: 0.35em 0.8em; font-size: 0.9rem; }
@media (max-width: 480px) { .comm-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; } .comm-tile { padding: 0.65rem 0.4rem 0.55rem; } }
/* One tag's boards / search results: a compact list */
.comm-listhead { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; margin-top: 0.8rem; }
.comm-listhead .comm-h { margin: 0; }
.comm-list { display: grid; gap: 0.4rem; margin: 0.7rem 0; }
.theme.comm-card.compact { padding: 0.5rem 0.8rem; border-radius: 12px; }
.comm-card.compact .theme-emoji { font-size: 1.6rem; }
.comm-card.compact .theme-name { font-size: 1rem; }
/* Small labels on cards */
.pill { display: inline-block; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; line-height: 1; padding: 0.25em 0.5em; border-radius: 999px; margin-left: 0.4rem; vertical-align: 0.15em; }
.pills { display: inline-flex; gap: 0.3rem; margin-left: 0.4rem; white-space: nowrap; vertical-align: 0.15em; }
.pills .pill { margin-left: 0; vertical-align: 0; }
.pill-new { background: var(--accent); color: var(--accent-ink); }
.pill-kids { background: #2b6b4a; color: #e6fff1; }
.comm-detail .pill { margin-left: 0.5rem; }
/* Community board details: a side panel; a full-screen sheet on phones */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(5, 3, 15, 0.55); z-index: 40; }
#themeDetail.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); margin: 0; z-index: 41; overflow-y: auto; overscroll-behavior: contain; border-radius: var(--radius) 0 0 var(--radius); box-shadow: -12px 0 40px rgba(0, 0, 0, 0.45); }
#themeDetail.drawer .setup-head { flex-wrap: wrap; align-items: flex-start; }
#themeDetail.drawer #customise .opt { grid-template-columns: 1fr; gap: 0.4rem; }
.drawer-close { position: absolute; top: 0.7rem; right: 0.7rem; padding: 0.35em 0.7em; }
#themeDetail.drawer .setup-head > div:first-child { padding-right: 3rem; }
@media (max-width: 700px) {
  #themeDetail.drawer { width: 100vw; border-radius: 0; }
  body.drawer-open { overflow: hidden; }
}
.comm-cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.theme.comm-card { flex-wrap: nowrap; justify-content: flex-start; text-align: left; align-items: center; gap: 0.75rem; padding: 0.75rem 0.9rem; }
.comm-card .theme-emoji { flex: 0 0 auto; }
.comm-info { display: grid; gap: 0.15rem; min-width: 0; }
.comm-card .theme-name { overflow-wrap: anywhere; }
.comm-tagline, .comm-meta { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.comm-note { grid-column: 1 / -1; }
.comm-detail { margin-top: 0.2rem; }
