:root {
  font-family: "DM Sans", "Segoe UI", sans-serif;
  color: #eef3fa;
  background: #101827;
  font-synthesis: none;
  --panel: #192438;
  --panel-light: #ca0a0a;
  --muted: #92a0b4;
  --red: #ff6b61;
  --blue: #5ba8ff;
  --line: rgba(171, 192, 221, .14);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 50% -20%, #263755 0, #101827 60%); }
.topbar { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 clamp(20px, 4vw, 58px); border-bottom: 1px solid var(--line); background: rgba(13, 21, 34, .82); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; width: 39px; height: 39px; place-items: center; color: #151d2a; background: #ffc857; border-radius: 11px; font: 700 23px "Space Grotesk", sans-serif; }
.brand strong, .brand span { display: block; }
.brand strong { font: 700 13px "Space Grotesk", sans-serif; letter-spacing: .14em; }
.brand div span { margin-top: 2px; color: var(--muted); font: 500 9px "DM Mono", monospace; letter-spacing: .12em; }
.topbar-actions { display: flex; align-items: center; gap: 24px; }
.save-indicator, .host-live { display: inline-flex; align-items: center; gap: 8px; color: #a8b4c6; font: 500 11px "DM Mono", monospace; }
.save-indicator i, .host-live i { width: 7px; height: 7px; border-radius: 50%; background: #4fc5a6; box-shadow: 0 0 10px #4fc5a6; }
.save-indicator.save-error i { background: var(--red); box-shadow: 0 0 10px var(--red); }
.tab-button, .button-primary, .button-outline, .button-quiet, .button-correct, .button-wrong { border: 0; border-radius: 9px; padding: 11px 15px; font-size: 12px; font-weight: 700; transition: transform .15s ease, filter .15s ease, border-color .15s ease; }
.tab-button:hover, .button-primary:hover, .button-outline:hover, .button-quiet:hover, .button-correct:hover, .button-wrong:hover { transform: translateY(-1px); filter: brightness(1.08); }
.tab-button { color: #e9eff8; background: #25334a; }
.workspace { width: min(1460px, 100%); margin: 0 auto; padding: 30px clamp(18px, 4vw, 58px) 46px; flex: 1; }
.score-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 0 auto 24px; max-width: 780px; }
.score-card { min-height: 96px; position: relative; display: flex; align-items: center; gap: 14px; padding: 16px 22px; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(135deg, rgba(255,255,255,.04), rgba(255,255,255,.01)), var(--panel); overflow: hidden; }
.score-card::after { content: ""; position: absolute; right: -28px; top: -36px; width: 125px; height: 125px; border: 1px solid currentColor; border-radius: 50%; opacity: .09; box-shadow: 0 0 0 13px currentColor, 0 0 0 27px currentColor; }
.score-red { color: var(--red); }
.score-blue { color: var(--blue); }
.score-team { color: #d7dfeb; font-size: 12px; font-weight: 700; }
.score-card strong { margin-left: auto; color: #fff; font: 700 40px "Space Grotesk", sans-serif; }
.score-caption { align-self: flex-end; margin: 0 24px 8px -8px; color: var(--muted); font: 10px "DM Mono", monospace; letter-spacing: .1em; }
.round-layout { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 16px; }
.board-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 20px; }
.board, .stage-card, .control-card { border: 1px solid var(--line); border-radius: 16px; background: rgba(25, 36, 56, .9); box-shadow: 0 16px 50px rgba(0,0,0,.13); }
.board { padding: 18px; }
.board-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 15px; color: #f1f4f8; font: 700 12px "Space Grotesk", sans-serif; letter-spacing: .1em; }
.board-heading small { margin-left: auto; color: #8997ac; font: 10px "DM Mono", monospace; letter-spacing: .02em; }
.team-dot { width: 8px; height: 8px; background: var(--red); border-radius: 50%; box-shadow: 0 0 12px currentColor; }
.board-blue .team-dot { background: var(--blue); }
.question-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.category-row, .question-row { display: contents; }
.category-row > div { min-width: 0; padding: 9px 2px; color: #99a8bc; text-align: center; font: 500 10px "DM Mono", monospace; text-transform: uppercase; letter-spacing: .1em; }
.question-cell { min-width: 0; padding: 4px; border-top: 1px solid rgba(170,190,218,.09); }
.question-tile { width: 100%; min-height: 55px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; border: 1px solid rgba(255,255,255,.05); border-radius: 9px; color: #ffd36f; background: #202f46; font: 700 16px "Space Grotesk", sans-serif; transition: background .15s ease, transform .15s ease; }
.question-tile small { color: #8897ad; font: 9px "DM Mono", monospace; letter-spacing: .08em; }
.board-red .question-tile:not(.is-used):hover { background: #3b3340; outline: 1px solid rgba(255,107,97,.55); transform: translateY(-1px); }
.board-blue .question-tile:not(.is-used):hover { background: #263a50; outline: 1px solid rgba(91,168,255,.6); transform: translateY(-1px); }
.question-tile.is-used { color: #8290a3; background: #182337; }
.used-mark { color: #66758b; font-size: 18px; }
.empty-cell { display: block; padding: 19px; color: #4e5b6d; text-align: center; }
.stage-card { position: static; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 22px; padding: 16px 22px; overflow: hidden; }
.stage-kicker, .section-eyebrow { color: #a4b1c4; font: 500 10px "DM Mono", monospace; letter-spacing: .14em; }
.timer-ring { grid-column: 2; grid-row: 1 / span 2; width: 78px; height: 78px; display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 0; border: 3px solid #ffc857; border-radius: 50%; box-shadow: 0 0 26px rgba(255,200,87,.16), inset 0 0 22px rgba(255,200,87,.06); }
.timer-ring strong { font: 700 34px "Space Grotesk", sans-serif; line-height: 1; }
.timer-ring span { margin-top: 4px; color: #a1adbd; font: 8px "DM Mono", monospace; letter-spacing: .12em; }
.question-content { width: 100%; min-height: 64px; text-align: left; }
.question-team { display: inline-block; padding: 5px 8px; border-radius: 5px; background: rgba(255,107,97,.11); color: #ff9185; font: 10px "DM Mono", monospace; letter-spacing: .07em; }
.question-team.team-blue { background: rgba(91,168,255,.11); color: #82beff; }
.question-content h1 { margin: 7px 0; font: 600 clamp(19px, 2vw, 25px) "Space Grotesk", sans-serif; line-height: 1.35; }
.empty-question { display: flex; align-items: center; gap: 13px; }
.empty-question > span { color: #51637c; font: 400 30px "Space Grotesk", sans-serif; }
.empty-question h1 { margin: 0; color: #d0d9e5; font-size: 17px; }
.empty-question p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.answer-reveal { display: grid; gap: 5px; margin: 8px 0 12px; padding: 12px; border: 1px solid rgba(79,197,166,.2); border-radius: 9px; background: rgba(79,197,166,.07); color: #81e0c6; font-weight: 600; }
.answer-reveal span { color: #7cae9f; font: 9px "DM Mono", monospace; letter-spacing: .12em; }
.result-message { margin: 12px 0; font: 700 22px "Space Grotesk", sans-serif; }
.result-message.correct { color: #5ed3ae; }
.result-message.wrong { color: #ff8177; }
.stage-picture { grid-column: 1 / -1; max-width: 100%; max-height: 150px; object-fit: contain; margin: 12px auto 0; border-radius: 9px; }
.stage-actions { width: 100%; display: grid; gap: 9px; }
.button-primary { color: #17202d; background: #ffc857; }
.button-correct { flex: 1; color: #15271f; background: #5ed3ae; }
.button-wrong { flex: 1; color: #2b1716; background: #ff8177; }
.answer-actions, .button-pair { display: flex; gap: 9px; }
.button-quiet { color: #9aa8bb; background: transparent; }
.app-footer { display: flex; justify-content: space-between; padding: 17px clamp(20px, 4vw, 58px); border-top: 1px solid var(--line); color: #64738a; font: 9px "DM Mono", monospace; letter-spacing: .1em; }
.error-banner { display: flex; justify-content: space-between; gap: 15px; padding: 12px clamp(20px, 4vw, 58px); color: #ffd4cf; background: #572e34; font-size: 13px; }
.error-banner button { border: 0; color: inherit; background: transparent; text-decoration: underline; }
.status-screen { min-height: 100vh; display: grid; place-items: center; padding: 30px; color: #eaf0f8; font: 600 20px "Space Grotesk", sans-serif; }
.error-card { color: #ffd4cf; }

.host-console { max-width: 1200px; margin: 0 auto; }
.host-heading { display: flex; align-items: end; justify-content: space-between; margin: 3px 0 22px; }
.host-heading h1 { margin: 7px 0 0; font: 700 30px "Space Grotesk", sans-serif; }
.host-live { padding: 8px 11px; border: 1px solid rgba(79,197,166,.22); border-radius: 20px; color: #83dfc4; background: rgba(79,197,166,.07); font-size: 9px; }
.host-live i { width: 6px; height: 6px; }
.host-question-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 20px; margin-bottom: 16px; padding: 20px; border: 1px solid rgba(255,200,87,.18); border-radius: 15px; background: linear-gradient(120deg, rgba(255,200,87,.07), transparent 55%), var(--panel); }
.host-question-main { min-width: 0; }
.board-connection { display: inline-flex; align-items: center; gap: 6px; margin: 8px 0 0 10px; color: #c5a968; font: 500 8px "DM Mono", monospace; letter-spacing: .08em; vertical-align: middle; }
.board-connection i { width: 6px; height: 6px; border-radius: 50%; background: #c5a968; }
.board-connection.is-connected { color: #83dfc4; }
.board-connection.is-connected i { background: #4fc5a6; box-shadow: 0 0 8px #4fc5a6; }
.host-question-main > .question-team { display: table; margin-top: 9px; }
.host-question-main h2 { margin: 10px 0; font: 600 21px "Space Grotesk", sans-serif; line-height: 1.35; }
.host-question-empty h2 { color: #c9d3e1; font-size: 17px; }
.host-question-empty p { margin: 0; color: var(--muted); font-size: 12px; }
.host-question-timer { width: 74px; height: 74px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 2px solid #ffc857; border-radius: 50%; }
.host-question-timer strong { font: 700 27px "Space Grotesk", sans-serif; line-height: 1; }
.host-question-timer span { margin-top: 4px; color: #a1adbd; font: 8px "DM Mono", monospace; letter-spacing: .08em; }
.host-question-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 9px; }
.host-question-actions > button { flex: 1; min-width: 110px; }
.host-grid { display: grid; grid-template-columns: 1.15fr .9fr .9fr; align-items: start; gap: 16px; }
.control-card { padding: 19px; }
.control-stack { display: grid; gap: 16px; }
.card-title { display: flex; align-items: center; gap: 11px; margin-bottom: 18px; }
.card-icon { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px; color: #ffd16a; background: rgba(255,200,87,.1); font: 700 17px "Space Grotesk", sans-serif; }
.card-title h2 { margin: 0; font: 600 15px "Space Grotesk", sans-serif; }
.card-title p { margin: 4px 0 0; color: #95a3b7; font-size: 11px; line-height: 1.45; }
.control-card form, .control-card { display: grid; gap: 12px; }
.question-bank-status { margin: 0; color: #83dfc4; font-size: 10px; line-height: 1.5; }
.control-card button:disabled { opacity: .5; cursor: not-allowed; }
.control-card .card-title { margin-bottom: 4px; }
.control-card label { display: grid; gap: 6px; color: #9eacc0; font: 500 9px "DM Mono", monospace; letter-spacing: .08em; }
.control-card input:not([type="file"]), .control-card select { width: 100%; min-width: 0; height: 38px; padding: 0 10px; border: 1px solid rgba(177,195,221,.16); border-radius: 7px; outline: none; color: #edf2f8; background: #131e30; font: 500 11px "DM Sans", sans-serif; letter-spacing: 0; }
.control-card input:focus, .control-card select:focus { border-color: #ffc857; }
.control-card select option { color: #edf2f8; background: #131e30; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wide-button { width: 100%; }
.button-outline { border: 1px solid rgba(177,195,221,.2); color: #d9e2ef; background: #202d42; }
.red-outline { border-color: rgba(255,107,97,.32); color: #ff978e; background: rgba(255,107,97,.06); }
.blue-outline { border-color: rgba(91,168,255,.32); color: #93c8ff; background: rgba(91,168,255,.06); }
.danger-outline { color: #ff948b; }
.wheel-controls .compact-pair { flex-wrap: wrap; }
.compact-pair button { flex: 1; padding: 9px 7px; font-size: 10px; }
.upload-button { display: flex !important; min-height: 39px; align-items: center; justify-content: center; border: 1px dashed rgba(177,195,221,.27); border-radius: 8px; color: #e2eaf4 !important; background: #202d42; cursor: pointer; font: 600 11px "DM Sans", sans-serif !important; letter-spacing: 0 !important; }
.upload-button input { display: none; }
.modal-backdrop { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; padding: 20px; background: rgba(5,10,18,.82); backdrop-filter: blur(8px); }
.wheel-modal { --wheel-accent: #ef7168; position: relative; width: min(520px, 100%); display: flex; flex-direction: column; align-items: center; padding: 27px 22px 25px; overflow: hidden; border: 1px solid rgba(177,195,221,.19); border-radius: 22px; background: radial-gradient(ellipse at 50% 36%, #28364d 0, #182438 60%); box-shadow: 0 25px 90px rgba(0,0,0,.55); }
.wheel-modal.wheel-blue { --wheel-accent: #62a9ff; }
.wheel-title { text-align: center; }
.wheel-title .section-eyebrow { color: var(--wheel-accent); }
.wheel-modal h2 { margin: 5px 0 3px; font: 700 26px "Space Grotesk", sans-serif; }
.wheel-title p { margin: 0 0 13px; color: #9cabc0; font: 11px "DM Sans", sans-serif; }
.modal-close { position: absolute; z-index: 3; top: 13px; right: 15px; width: 31px; height: 31px; border: 0; border-radius: 8px; color: #a9b7ca; background: #26354b; font-size: 21px; }
.modal-close:disabled { opacity: .45; }
.wheel-stage { position: relative; display: grid; width: min(350px, 100%); aspect-ratio: 1; place-items: center; margin: 0 auto; }
.wheel-stage::before { position: absolute; inset: 3px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; background: repeating-conic-gradient(from -1deg, rgba(255,255,255,.36) 0deg 1deg, transparent 1deg 15deg); content: ""; mask: radial-gradient(circle, transparent 0 46%, #000 47% 50%, transparent 51%); }
.wheel-pointer { position: absolute; z-index: 2; top: 3px; left: 50%; width: 34px; height: 44px; transform: translateX(-50%); filter: drop-shadow(0 3px 4px rgba(0,0,0,.55)); }
.wheel-pointer::before { position: absolute; inset: 0; clip-path: polygon(50% 100%, 0 0, 100% 0); border-radius: 4px; background: linear-gradient(90deg, #d7dde8, #fff 48%, #c6cfdd); content: ""; }
.wheel-pointer span { position: absolute; top: 1px; left: 50%; width: 11px; height: 11px; transform: translateX(-50%); border: 2px solid #fff; border-radius: 50%; background: var(--wheel-accent); }
.wheel-disc { position: relative; width: min(320px, calc(100% - 20px)); aspect-ratio: 1; flex: 0 0 auto; overflow: hidden; border: 8px solid #e7eaf0; border-radius: 50%; background-color: #273348; box-shadow: 0 0 0 4px #101a2a, 0 0 0 6px rgba(255,255,255,.15), 0 12px 32px rgba(0,0,0,.45), inset 0 0 0 2px rgba(17,27,43,.5); transition: transform var(--spin-duration, 6200ms) cubic-bezier(.08,.72,.08,1); }
.wheel-disc::before { position: absolute; z-index: 1; inset: 0; border-radius: inherit; background: repeating-conic-gradient(rgba(255,255,255,.78) 0deg 1.2deg, transparent 1.2deg var(--slice-angle)); content: ""; pointer-events: none; }
.wheel-disc.is-spinning { will-change: transform; }
.wheel-label { position: absolute; top: 50%; left: 50%; width: 84px; transform: translate(-50%, -50%) rotate(var(--label-angle)) translateY(-119px) rotate(var(--label-counter-angle)); overflow: hidden; color: #fff; text-align: center; text-overflow: ellipsis; text-shadow: 0 1px 4px rgba(0,0,0,.65); font: 700 11px "DM Sans", sans-serif; white-space: nowrap; }
.wheel-label > span { display: inline-block; max-width: 100%; padding: 4px 7px; overflow: hidden; border: 1px solid rgba(255,255,255,.2); border-radius: 99px; background: rgba(15,25,41,.28); text-overflow: ellipsis; }
.wheel-label-used { color: rgba(255,255,255,.62); }
.wheel-label-used > span { text-decoration: line-through; background: rgba(15,25,41,.56); }
.wheel-hub { position: absolute; z-index: 2; top: 50%; left: 50%; display: grid; width: 57px; height: 57px; place-items: center; transform: translate(-50%, -50%); border: 4px solid #f6f0df; border-radius: 50%; color: #26334a; background: radial-gradient(circle at 35% 28%, #ffe49a, #ffc857 72%); box-shadow: 0 2px 6px rgba(0,0,0,.48), inset 0 1px 2px rgba(255,255,255,.75); font: 700 10px "Space Grotesk", sans-serif; }
.wheel-hub > span { display: grid; width: 39px; height: 39px; place-items: center; border: 1px solid rgba(102,72,18,.24); border-radius: 50%; }
.wheel-outcome { min-height: 57px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 10px 0 5px; color: #a6b3c6; text-align: center; font: 10px "DM Mono", monospace; letter-spacing: .1em; }
.wheel-outcome.has-winner strong { color: var(--wheel-accent); }
.wheel-outcome strong { margin-top: 3px; font: 700 23px "Space Grotesk", sans-serif; letter-spacing: 0; }
.wheel-spin-button { min-width: 190px; box-shadow: 0 5px 18px rgba(0,0,0,.22); }
.wheel-spin-button:disabled { cursor: not-allowed; opacity: .6; }

@media (max-width: 1050px) {
  .host-grid { grid-template-columns: 1fr 1fr; }
  .question-editor { grid-row: span 2; }
}
@media (max-width: 760px) {
  .topbar { min-height: 65px; padding: 0 16px; }
  .topbar-actions { gap: 11px; }
  .save-indicator { font-size: 9px; }
  .workspace { padding: 20px 14px 32px; }
  .score-strip { gap: 10px; }
  .score-card { min-height: 75px; gap: 7px; padding: 12px; }
  .score-card strong { font-size: 30px; }
  .score-caption { margin-right: 0; font-size: 8px; }
  .score-team { font-size: 10px; }
  .board-column { grid-template-columns: 1fr; gap: 14px; }
  .stage-card { grid-template-columns: minmax(0, 1fr) auto; padding: 14px; }
  .empty-question { align-items: flex-start; flex-direction: column; gap: 4px; }
  .board { padding: 14px 10px; }
  .board-heading { font-size: 10px; }
  .board-heading small { font-size: 8px; }
  .question-tile { min-height: 49px; font-size: 14px; }
  .host-grid { grid-template-columns: 1fr; }
  .question-editor { grid-row: auto; }
  .host-heading h1 { font-size: 25px; }
  .host-question-card { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 15px; }
  .host-question-main h2 { font-size: 17px; }
  .host-question-actions > button { min-width: 90px; padding: 10px 8px; font-size: 10px; }
  .app-footer { gap: 10px; font-size: 8px; }
}
@media (max-width: 390px) {
  .brand-mark { width: 33px; height: 33px; }
  .brand strong { font-size: 11px; }
  .brand div span { font-size: 7px; }
  .tab-button { padding: 9px; font-size: 10px; }
  .save-indicator { display: none; }
  .category-row > div { font-size: 8px; }
  .wheel-modal { padding-right: 12px; padding-left: 12px; }
  .wheel-label { width: 70px; transform: translate(-50%, -50%) rotate(var(--label-angle)) translateY(-100px) rotate(var(--label-counter-angle)); font-size: 9px; }
}

/* Team colours: red board is clearly red, blue board clearly blue */
:root { --red: #ff4d4d; --blue: #4d9bff; }
.board-red { border-color: rgba(255,77,77,.55); background: linear-gradient(180deg, rgba(120,24,30,.55), rgba(48,18,26,.92)); box-shadow: 0 16px 50px rgba(120,0,0,.25), inset 0 3px 0 #ff4d4d; }
.board-blue { border-color: rgba(77,155,255,.55); background: linear-gradient(180deg, rgba(22,58,120,.55), rgba(16,28,56,.92)); box-shadow: 0 16px 50px rgba(0,40,120,.25), inset 0 3px 0 #4d9bff; }
.board-red .board-heading { color: #ff8a84; }
.board-blue .board-heading { color: #8cc0ff; }
.board-heading .team-dot { width: 12px; height: 12px; }
.board-red .team-dot { background: #ff4d4d; box-shadow: 0 0 14px #ff4d4d; }
.board-blue .team-dot { background: #4d9bff; box-shadow: 0 0 14px #4d9bff; }
.board-red .question-tile { background: #5a2229; border-color: rgba(255,120,110,.3); color: #ffd8a0; }
.board-blue .question-tile { background: #1f3f78; border-color: rgba(120,175,255,.3); color: #ffd36f; }
.board-red .question-tile:not(.is-used):hover { background: #7a2c35; outline: 1px solid rgba(255,107,97,.8); }
.board-blue .question-tile:not(.is-used):hover { background: #2b5299; outline: 1px solid rgba(91,168,255,.85); }
.board-red .question-tile.is-used, .board-blue .question-tile.is-used { color: #8290a3; background: #182337; border-color: transparent; }
.board-red .category-row > div { color: #ff9e98; }
.board-blue .category-row > div { color: #9fc9ff; }
.score-red { border-color: rgba(255,77,77,.5); background: linear-gradient(135deg, rgba(150,30,36,.45), rgba(40,18,26,.9)); }
.score-blue { border-color: rgba(77,155,255,.5); background: linear-gradient(135deg, rgba(30,70,150,.45), rgba(16,28,56,.9)); }
.question-team { background: rgba(255,77,77,.18); color: #ff9a94; }
.question-team.team-blue { background: rgba(77,155,255,.18); color: #8cc0ff; }.online-note { color: #a8b4c6; font: 500 11px "DM Mono", monospace; }
.board-column.single-board { grid-template-columns: minmax(0, 860px); justify-content: center; }
.single-board .board-red { background: transparent; border-color: rgba(255,255,255,.12); box-shadow: none; }
.single-board .board-red .board-heading { color: #d8e0ee; justify-content: center; }
.single-board .board-red .team-dot { background: #ffd76a; box-shadow: 0 0 14px #ffd76a; }
.single-board .board-red .question-tile { background: #1b2740; border-color: rgba(255,255,255,.14); color: #ffd36f; }
.single-board .board-red .question-tile:not(.is-used):hover { background: #26365a; outline: 1px solid rgba(255,215,106,.8); }
.single-board .board-red .question-tile.is-used { color: #8290a3; background: #182337; border-color: transparent; }
.single-board .board-red .category-row > div { color: #c9d4e6; }
.online-note strong { color: #ffc857; letter-spacing: .12em; }

.auth-card{max-width:360px;margin:12vh auto;padding:28px;background:#18233a;border-radius:14px;color:#fff;display:flex;flex-direction:column;gap:14px;font-family:inherit}
.auth-card h1{margin:0;text-align:center}
.auth-lead{margin:0;text-align:center;opacity:.8}
.auth-card label{display:flex;flex-direction:column;gap:6px;font-weight:600}
.auth-card input{padding:10px;border-radius:8px;border:1px solid #3a4a6b;background:#0f172a;color:#fff;font-size:1rem}
.auth-submit{padding:12px;border:0;border-radius:8px;background:#2f7cf6;color:#fff;font-size:1rem;font-weight:700;cursor:pointer}
.auth-submit:disabled{opacity:.6}
.auth-switch{background:none;border:0;color:#9db7ff;cursor:pointer;text-decoration:underline}
.auth-error{min-height:1.2em;margin:0;color:#ff8a8a}

.auth-card [hidden]{display:none !important}
.auth-forgot{background:none;border:0;color:#9db7ff;cursor:pointer;font-size:.9rem}

.account-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.6);display:grid;place-items:center;z-index:50;padding:16px}
.account-panel{background:#1b2133;color:#fff;border-radius:14px;padding:22px;max-width:440px;width:100%;max-height:90vh;overflow:auto;display:grid;gap:8px}
.account-panel input{padding:10px;border-radius:8px;border:1px solid #556;background:#0f1424;color:#fff}
.account-panel h2,.account-panel h3{margin:6px 0 0}
.history-list{margin:0;padding-left:18px}
.account-note{color:#ffd76a}
.tab-button.danger{background:#9b2c2c}

.final-backdrop{position:fixed;inset:0;background:rgba(5,8,20,.85);display:grid;place-items:center;z-index:60;overflow:hidden}
.final-card{background:#1b2133;color:#fff;border-radius:18px;padding:32px;text-align:center;display:grid;gap:14px;min-width:min(480px,90vw);z-index:2}
.final-card h1{font-size:2.4rem;margin:0}
.final-scores{display:flex;gap:16px;justify-content:center}
.confetti{position:absolute;top:-20px;width:10px;height:16px;animation:confetti-fall 3.5s linear infinite}
@keyframes confetti-fall{to{transform:translateY(110vh) rotate(720deg)}}
.tab-button.active{outline:2px solid #ffd76a}

.buzz-banner{margin:14px auto 0;padding:12px 20px;border-radius:12px;font-weight:800;font-size:1.3rem;display:inline-block;animation:buzz-pop .35s ease-out}
.buzz-red{background:#b3243a}
.buzz-blue{background:#2459c9}
@keyframes buzz-pop{from{transform:scale(.6);opacity:0}to{transform:scale(1);opacity:1}}
.buzz-answer{margin:10px auto 0;padding:10px 16px;border-radius:10px;background:rgba(255,255,255,.1);font-size:1.2rem;font-weight:700;max-width:90%}
.buzz-answer span{display:block;font-size:.7rem;letter-spacing:.12em;opacity:.7;margin-bottom:2px}
.chat-panel{position:fixed;right:16px;bottom:16px;width:min(340px,92vw);height:min(420px,70vh);z-index:60;display:flex;flex-direction:column;background:#111827;border:1px solid #3b4660;border-radius:14px;box-shadow:0 10px 30px rgba(0,0,0,.5);color:#fff}
.chat-title{display:flex;justify-content:space-between;align-items:center;padding:10px 12px;border-bottom:1px solid #2a3350}
.chat-list{flex:1;overflow-y:auto;padding:10px 12px;display:grid;align-content:start;gap:6px}
.chat-message{font-size:.95rem;word-break:break-word}
.chat-name{font-weight:800}
.chat-red{color:#ff7b8f}.chat-blue{color:#79a8ff}.chat-host{color:#ffd76a}
.chat-empty{opacity:.6;margin:0}
.chat-form{display:flex;gap:8px;padding:10px;border-top:1px solid #2a3350}
.chat-form input{flex:1;min-width:0;padding:8px 10px;border-radius:8px;border:1px solid #3b4660;background:#0b1220;color:#fff}

.buzz-answer{margin-top:6px;font-size:1.05rem;font-weight:600;opacity:.95}
.waiting-buzz{opacity:.75;font-weight:600;margin:12px 0 0}
.chat-panel{position:fixed;right:16px;bottom:16px;width:min(320px,calc(100vw - 32px));z-index:40;display:flex;flex-direction:column;border-radius:14px;overflow:hidden;background:#0b1220;border:1px solid #2c3750;box-shadow:0 10px 30px rgba(0,0,0,.45)}
.chat-toggle{background:#1d2a45;color:#fff;border:0;padding:11px 14px;font-weight:700;text-align:left;cursor:pointer}
.chat-unread{margin-left:8px;background:#d62839;border-radius:999px;padding:1px 8px;font-size:.8rem}
.chat-list{height:240px;overflow-y:auto;padding:10px;display:grid;align-content:start;gap:6px;font-size:.92rem}
.chat-list p{margin:0;word-break:break-word}
.chat-empty{opacity:.6}
.chat-host strong{color:#ffd76a}
.chat-red strong{color:#ff8b9b}
.chat-blue strong{color:#8bb2ff}
.chat-panel form{display:flex;gap:6px;padding:8px;border-top:1px solid #2c3750}
.chat-panel input{flex:1;min-width:0;padding:9px;border-radius:8px;border:1px solid #3b4660;background:#111a2e;color:#fff}
.chat-panel{height:auto;width:min(320px,calc(100vw - 32px))}
.chat-panel:not(.is-open){width:auto;background:transparent;border:0;box-shadow:none;overflow:visible}
.chat-panel:not(.is-open) .chat-toggle{position:relative;width:52px;height:52px;padding:0;border-radius:50%;font-size:1.5rem;text-align:center;background:#2f7bf5;box-shadow:0 6px 18px rgba(0,0,0,.5)}
.chat-panel:not(.is-open) .chat-unread{position:absolute;top:-4px;right:-4px;margin:0}
.chat-panel.is-open .chat-list{flex:none;height:220px}
.chat-min{float:right;font-size:1.2rem}
.chat-panel form button{border:0;border-radius:8px;background:#2f7bf5;color:#fff;font-weight:700;padding:0 14px}
.player-list li{display:flex;align-items:center;gap:10px;justify-content:space-between}.player-team{font-weight:800;font-size:.8rem;padding:2px 8px;border-radius:8px;background:#7f1d2b}.player-team.team-blue{background:#1e3a8a}
.install-bar{position:fixed;left:50%;bottom:16px;transform:translateX(-50%);z-index:60;display:flex;align-items:center;gap:12px;padding:10px 14px;border-radius:12px;background:#1b2740;color:#fff;border:1px solid #ffd76a;box-shadow:0 8px 30px rgba(0,0,0,.4);max-width:92vw;font-size:14px}.install-bar[hidden]{display:none}.install-bar button{border:0;border-radius:8px;padding:8px 12px;font-weight:700;background:#ffd76a;color:#101827;cursor:pointer}.install-bar button:last-child{background:transparent;color:#fff;font-size:18px;padding:2px 8px}

/* Half-screen / narrow windows: keep every control reachable */
.topbar { flex-wrap: wrap; row-gap: 8px; padding-top: 8px; padding-bottom: 8px; }
.topbar-actions { flex-wrap: wrap; justify-content: flex-end; gap: 8px 10px; min-width: 0; }
.topbar-actions > * { flex: 0 0 auto; }
.topbar-actions .tab-button { padding: 9px 12px; }
html, body { overflow-x: hidden; }
@media (max-width: 1100px) {
  .topbar { justify-content: flex-start; }
  .topbar-actions { flex: 1 1 100%; justify-content: flex-start; }
  .host-grid { grid-template-columns: 1fr 1fr; }
  .host-question-actions > button { min-width: 90px; }
}
@media (max-width: 760px) { .host-grid { grid-template-columns: 1fr; } }
.editor-panel{max-width:min(1000px,100%)}
.editor-panel textarea{padding:10px;border-radius:8px;border:1px solid #556;background:#0f1424;color:#fff;font:inherit;width:100%;box-sizing:border-box}
.editor-form{display:grid;gap:8px;padding:12px;border:1px solid #ffc857;border-radius:12px;background:#141b2e}
.editor-form label{display:grid;gap:4px;font-size:11px;letter-spacing:.08em}

.spin-overlay{position:fixed;inset:0;z-index:70;display:grid;place-items:center;background:rgba(5,8,20,.8)}
.spin-card{display:grid;justify-items:center;gap:10px;padding:22px 28px;border:1px solid #ffc857;border-radius:20px;background:#141b2e;text-align:center}
.spin-card h2{margin:0;color:#ffc857;letter-spacing:.12em}
.spin-wheel-wrap{position:relative;width:320px;height:320px}
.spin-pointer{position:absolute;top:-18px;left:50%;transform:translateX(-50%);z-index:2;font-size:30px;color:#fff;text-shadow:0 2px 4px #000}
.spin-wheel{position:relative;width:320px;height:320px;border-radius:50%;border:6px solid #e7eaf0;box-sizing:border-box;overflow:hidden}
.spin-name{position:absolute;top:50%;left:50%;width:100px;margin:-10px 0 0 -50px;text-align:center;font:700 13px sans-serif;color:#fff;text-shadow:0 1px 3px #000;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.spin-result{margin:0;font:700 28px sans-serif;color:#fff}

/* Host controls: equal columns and even stacking at every width */
.host-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
.control-stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.control-stack > .control-card { flex: 1 1 auto; align-content: start; }
.host-grid > .control-card { align-content: start; }
.host-question-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 9px; }
.host-question-actions > button { min-width: 0; width: 100%; }
.host-question-actions > .spin-button { grid-column: 1 / -1; }
.button-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.compact-pair { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.button-pair > button { width: 100%; min-width: 0; }
@media (max-width: 1100px) {
  .host-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .question-editor { grid-row: auto; }
}
@media (max-width: 700px) {
  .host-grid { grid-template-columns: minmax(0, 1fr); }
  .host-question-actions { grid-template-columns: 1fr 1fr; }
}
.spin-button{border:1px solid #ffc857;color:#ffc857}
.button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.button-grid > button { width: 100%; min-width: 0; }
.control-stack > .control-card.question-editor { flex: 0 0 auto; }
.control-stack > .game-card { flex: 1 1 auto; }
.control-card.game-card { grid-template-rows: auto 1fr auto; }
.game-card .button-grid { grid-auto-rows: minmax(40px, 1fr); }
