:root{font-family:Inter,system-ui,"Segoe UI",sans-serif;color:#20183d;background:#f8f7ff}*{box-sizing:border-box}body{margin:0;min-height:100vh;background:radial-gradient(circle at 10% 5%,#e9ddff,transparent 32%),radial-gradient(circle at 90% 30%,#d8f7ff,transparent 28%),#f8f7ff}.topbar{height:72px;display:flex;align-items:center;justify-content:space-between;padding:0 clamp(20px,6vw,84px);background:#fff9;border-bottom:1px solid #e9e3fa}.brand{display:flex;align-items:center;gap:11px;color:#24164c;text-decoration:none;font-weight:850;font-size:20px}.brand-mark{display:grid;place-items:center;width:38px;height:38px;border-radius:12px;background:linear-gradient(135deg,#6b36e8,#a33eea);color:white}.top-note{font-size:11px;font-weight:800;letter-spacing:1.5px;color:#8a7da9}.shell{width:min(1050px,calc(100% - 36px));margin:auto}.hero{text-align:center;padding:62px 12px 36px}.eyebrow{display:inline-block;padding:8px 13px;border-radius:30px;background:#eee7ff;color:#6535c7;font-size:11px;font-weight:850;letter-spacing:1.5px}.hero h1{font-size:clamp(38px,6vw,65px);line-height:1.06;letter-spacing:-2.5px;margin:22px 0 15px}.hero h1 span{color:#753ce0}.intro{max-width:590px;margin:auto;color:#716985;line-height:1.65}.hero-tags{display:flex;justify-content:center;gap:10px;flex-wrap:wrap;margin-top:24px}.hero-tags span{font-size:12px;font-weight:700;color:#65587d;background:white;padding:9px 13px;border:1px solid #eee9f8;border-radius:30px}.panels{display:grid;grid-template-columns:1fr 1fr;gap:20px;max-width:820px;margin:auto}.panel{background:white;border:1px solid #eee9f7;border-radius:23px;padding:27px;box-shadow:0 16px 45px #30205c0b}.panel-icon{width:48px;height:48px;display:grid;place-items:center;border-radius:15px;background:#f0eaff;font-size:24px}.host-panel .panel-icon{background:#e6f8ff}.panel h2{margin:18px 0 7px;font-size:23px}.panel>p{color:#827991;font-size:13px;line-height:1.5}label{display:block;font-size:12px;font-weight:800;color:#5e5276;margin:14px 0 7px}input{width:100%;height:48px;border:1.5px solid #e8e2f2;border-radius:12px;padding:0 14px;font:inherit;background:#fcfbff}input:focus{outline:2px solid #8555e7}#game-pin{text-align:center;letter-spacing:5px;font-weight:850;font-size:20px}.button{width:100%;height:48px;border:0;border-radius:12px;margin-top:18px;font:inherit;font-weight:800;cursor:pointer}.primary{color:white;background:linear-gradient(100deg,#6435df,#963fe2)}.secondary{color:#5730b6;background:#f0eaff}.host-preview{border:1px dashed #dcd2ef;border-radius:14px;padding:17px;margin:20px 0 3px;background:#fcfaff}.host-preview div{font-size:12px;color:#6d5c8b;font-weight:800}.host-preview strong,.host-preview small{display:block}.host-preview strong{margin-top:17px;font-size:14px}.host-preview small{margin-top:5px;color:#9388a6;font-size:11px}.message{min-height:18px;color:#a13c58;font-size:12px}.capacity-note{max-width:820px;margin:20px auto 50px;padding:17px 20px;border-radius:16px;background:#eaf9f5;border:1px solid #d5f0e8;display:flex;gap:13px}.capacity-note strong{font-size:13px;color:#236b56}.capacity-note p{margin:4px 0 0;font-size:12px;color:#548171}footer{text-align:center;padding:0 15px 28px;color:#a097b1;font-size:11px}@media(max-width:650px){.topbar{height:62px;padding:0 18px}.top-note{font-size:9px}.hero{padding:45px 4px 28px}.hero h1{letter-spacing:-1.8px}.panels{grid-template-columns:1fr}.panel{padding:22px}.capacity-note{margin-bottom:35px}}.game-stage { margin-top: 24px; }
.game-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.game-heading h2 { margin-bottom:4px; }
.live-question { margin:24px 0; font-size:clamp(1.35rem,3vw,2rem); }
.answer-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.answer-option { border:0; border-radius:14px; padding:18px; min-height:70px; color:#fff; background:linear-gradient(135deg,#6c43e8,#3d75d9); font:inherit; font-weight:700; cursor:pointer; }
.answer-option:nth-child(2) { background:linear-gradient(135deg,#e65a78,#d34c9a); }
.answer-option:nth-child(3) { background:linear-gradient(135deg,#159e8a,#28b67a); }
.answer-option:nth-child(4) { background:linear-gradient(135deg,#e49b25,#e36a32); }
.answer-option:disabled { opacity:.55; cursor:default; }
.leaderboard { margin-top:20px; }
.leaderboard p { padding:8px 12px; background:#f2efff; border-radius:9px; }
@media(max-width:560px) { .answer-grid { grid-template-columns:1fr; } .game-heading { align-items:flex-start; flex-direction:column; } }
.host-console { display:grid; gap:12px; }
.host-console input,.host-console textarea { width:100%; border:1px solid #d9d4eb; border-radius:10px; padding:12px; font:inherit; }
.host-console textarea { font-family:Consolas,monospace; font-size:.88rem; }
.pin-display { margin-top:20px; padding:18px; border-radius:14px; background:#f0ebff; font-size:1.2rem; }
.pin-display strong { font-size:2rem; letter-spacing:.12em; color:#5427d8; }
.host-actions { display:flex; flex-wrap:wrap; gap:10px; }

/* Host control-room improvements (v2) */
.host-hero { padding-bottom: 24px; }
.host-console { display: grid; gap: 12px; }
.host-console h2 { margin: 6px 0 0; font-size: 25px; }
.host-section-heading, .dashboard-topline, .live-status-heading {
  display:flex; align-items:center; justify-content:space-between; gap:14px;
}
.step-label { display:block; color:#8065bb; font-size:10px; font-weight:900; letter-spacing:1.35px; }
.host-step { color:#9288a5; font-size:12px; font-weight:700; }
.host-dashboard { gap:18px; }
.host-dashboard[hidden] { display:none; }
#setup-panel[hidden] { display:none; }
.state-badge { display:inline-flex; align-items:center; gap:7px; border-radius:30px; padding:8px 12px; font-size:11px; font-weight:850; white-space:nowrap; }
.state-connected { background:#e4f8ee; color:#197449; }
.state-waiting { background:#f1edff; color:#6740b8; }
.state-live { background:#ffe9ed; color:#b52e52; }
.state-closed { background:#fff3dc; color:#93600c; }
.state-ended { background:#e9e8ef; color:#625b70; }
.state-error { background:#ffe8e8; color:#a42e36; }
.host-dashboard .pin-display { display:flex; flex-direction:column; gap:4px; margin:0; }
.host-dashboard .pin-display span { color:#6e6383; font-size:12px; font-weight:700; }
.host-dashboard .pin-display strong { font-size:clamp(2rem,5vw,2.8rem); }
.host-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.host-metric { display:flex; flex-direction:column; gap:5px; padding:16px; background:#faf9ff; border:1px solid #eee9f7; border-radius:14px; min-width:0; }
.host-metric strong { font-size:clamp(1.15rem,3vw,1.55rem); color:#35205f; overflow-wrap:anywhere; }
.host-metric span { color:#817790; font-size:11px; font-weight:700; }
.live-status-card { padding:20px; border:1px solid #e8e1f5; border-radius:17px; background:linear-gradient(135deg,#fcfaff,#f4faff); }
.live-status-card h3 { margin:17px 0 8px; font-size:clamp(1.1rem,2.5vw,1.45rem); }
.current-question { margin:12px 0; padding:16px; background:white; border-radius:12px; color:#30204f; font-size:clamp(1.05rem,2.4vw,1.45rem); font-weight:800; line-height:1.4; min-height:58px; }
.answer-progress { color:#746985; font-size:12px; margin:10px 0 0; }
.host-actions .button { flex:1 1 150px; margin-top:0; }
.host-actions .button:disabled { opacity:.45; cursor:not-allowed; }
.danger-button { color:white; background:#c83d58; }
.host-leaderboard { padding:16px; border-radius:14px; background:#faf9ff; }
.host-leaderboard h3 { margin:0 0 10px; }
.host-leaderboard ol { margin:0; padding-left:24px; }
.host-leaderboard li { padding:8px 10px; margin:5px 0; background:white; border-radius:8px; color:#45365f; font-weight:650; }
#dashboard-message { margin:0; }
@media(max-width:600px) {
  .dashboard-topline, .live-status-heading { align-items:flex-start; flex-direction:column; }
  .host-metrics { grid-template-columns:1fr 1fr; }
  .host-metric:last-child { grid-column:1 / -1; }
  .host-actions { flex-direction:column; }
}

/* Participant live question and countdown */
.player-question-panel{margin-top:18px;padding:clamp(16px,3vw,28px);border:1px solid #e9e2f6;border-radius:20px;background:linear-gradient(145deg,#fff,#fbfaff);box-shadow:0 14px 38px #30205c0c}
.player-question-top{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}
#question-counter{font-size:11px;font-weight:900;letter-spacing:1.3px;color:#7a65a5}
#countdown{display:grid;place-items:center;min-width:66px;height:54px;padding:0 10px;border-radius:14px;background:#efe9ff;color:#5427d8;font-size:23px;font-weight:950;font-variant-numeric:tabular-nums}
.timer-track{height:9px;border-radius:20px;overflow:hidden;background:#eeeaf5}
.timer-progress{height:100%;width:100%;border-radius:20px;background:linear-gradient(90deg,#20b88a,#e8b52d);transition:width .1s linear}
.timer-progress.urgent{background:#e24c5e}
.player-question-panel .live-question{margin:22px 0 20px;line-height:1.35}
.answer-option{transition:transform .12s ease,filter .12s ease,outline .12s ease}
.answer-option:not(:disabled):active{transform:scale(.985)}
.answer-option.selected{outline:4px solid #24164c;outline-offset:2px;filter:saturate(1.2)}
.answer-option:disabled{opacity:.72}
.waiting-panel{margin-top:18px;padding:35px 20px;text-align:center;border-radius:20px;background:linear-gradient(140deg,#f0eaff,#eaf8ff);border:1px solid #e2d9f5}
.waiting-icon{font-size:38px}.waiting-panel h2{margin:12px 0 6px}.waiting-panel p{margin:0;color:#716985}
@media(max-width:560px){.player-question-panel{padding:16px}.player-question-panel .answer-grid{grid-template-columns:1fr}.answer-option{min-height:62px;text-align:left;padding:16px 18px}.player-question-top{align-items:center}}

/* Participant focus mode: after joining, show only the live game */
body.participant-active .topbar,
body.participant-active .hero,
body.participant-active .panels,
body.participant-active .capacity-note,
body.participant-active footer { display:none !important; }
body.participant-active .shell { width:min(1100px,calc(100% - 28px)); margin:22px auto 40px; }
body.participant-active #game-stage { display:block; margin:0 auto; padding:clamp(18px,4vw,38px); min-height:70vh; }
body.participant-active #game-stage[hidden] { display:none !important; }
body.participant-active .game-heading { margin-bottom:8px; }
body.participant-active #game-title { font-size:clamp(1.2rem,3vw,1.7rem); }
body.participant-active #participant-count { margin:4px 0; }
body.participant-active #game-status { font-size:14px; }
body.participant-active .player-question-panel { margin-top:18px; }
body.participant-active .live-question { font-size:clamp(1.5rem,4vw,2.4rem); }
body.participant-active #countdown { min-width:82px; height:64px; font-size:28px; }
body.participant-active .timer-track { height:12px; }
body.participant-active .answer-option { min-height:86px; font-size:clamp(1rem,2.2vw,1.25rem); }
body.participant-active .waiting-panel { padding:clamp(38px,7vw,70px) 20px; }
@media(max-width:560px) {
 body.participant-active .shell { width:calc(100% - 18px); margin:10px auto 24px; }
 body.participant-active #game-stage { padding:16px; border-radius:18px; }
 body.participant-active .answer-option { min-height:68px; }
}

/* Participant focus mode hardening (v2) */
body.participant-active .topbar,
body.participant-active .hero,
body.participant-active .panels,
body.participant-active .capacity-note,
body.participant-active footer,
body.participant-active #api-settings { display:none !important; }
body.participant-active #game-stage { display:block !important; }
[hidden] { display:none !important; }

/* Live question image support */
.live-question-image {
  display: block;
  width: 100%;
  max-width: min(100%, 760px);
  max-height: 420px;
  object-fit: contain;
  margin: 0 auto 22px;
  border-radius: 14px;
  background: #f7f5fb;
  border: 1px solid #e9e2f6;
}
.live-question-image[hidden] { display: none !important; }

/* Participant session recovery and mobile controls */
.participant-actions{display:flex;gap:10px;align-items:center}
.participant-actions .button{width:auto;min-width:112px;padding:0 16px;margin-top:0}
.leave-button{background:#fff0f1;color:#a3263b;border:1px solid #f2c8ce}
.answer-option.selected{position:relative;outline:4px solid #20183d;outline-offset:3px;filter:brightness(.88) saturate(1.25);box-shadow:0 0 0 7px #fff,0 0 0 10px #20183d;font-weight:900}
.answer-option.selected::after{content:"✓ SELECTED";display:block;margin-top:7px;font-size:.78em;letter-spacing:.04em;text-align:right;color:#fff}
@media(max-width:560px){.game-heading{align-items:stretch}.participant-actions{width:100%;display:grid;grid-template-columns:1fr 1fr}.participant-actions .button{width:100%;min-width:0;padding:0 8px}.answer-option.selected{outline-width:3px;box-shadow:0 0 0 5px #fff,0 0 0 8px #20183d}}
