/* ==========================================================================
   Host – màn hình máy chiếu (tối ưu 1280×720 → 1920×1080, chữ lớn)
   ========================================================================== */
.page-host { font-size: 18px; }
.page-host .mute-btn { top: auto; bottom: 14px; right: auto; left: 14px; }

.host-layout {
  display: grid; height: 100vh; height: 100dvh; padding: 14px; gap: 14px;
  grid-template-columns: minmax(0, 1fr) 320px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "top top" "stage side" "controls side";
}
.host-topbar { grid-area: top; display: flex; align-items: center; gap: 18px; padding: 10px 18px; flex-wrap: wrap; }
.host-stage { grid-area: stage; position: relative; min-height: 0; overflow: auto; border-radius: var(--radius); }
.host-side { grid-area: side; padding: 16px; display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.host-controls { grid-area: controls; display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 14px 16px 20px; }
.host-controls .btn-game { font-size: 1.1rem; padding: 10px 18px; }
.controls-extra { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.host-controls .btn-game.suggested { animation: suggest 1.4s ease-in-out infinite; }
@keyframes suggest { 50% { box-shadow: 0 7px 0 var(--btn-shadow), 0 0 0 6px rgba(253,224,71,.55), 0 0 30px rgba(253,224,71,.6); } }

.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.5rem; }
.brand-rocket { font-size: 1.8rem; animation: rocketBob 2.4s ease-in-out infinite; }
.brand-text { background: linear-gradient(90deg, #a5f3fc, #f9a8d4, #fde68a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.round-track { margin-left: auto; display: flex; gap: 8px; }
.round-dot { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 1.3rem; background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.2); opacity: .55; transition: all .3s; }
.round-dot.done { opacity: .9; background: rgba(34,197,94,.25); border-color: #4ade80; }
.round-dot.active { opacity: 1; transform: scale(1.15); background: linear-gradient(135deg, var(--violet), var(--pink)); border-color: #fff; box-shadow: 0 0 20px rgba(236,72,153,.7); }

.side-title { font-size: 1.4rem; margin: 0; }
.side-progress { margin-top: auto; }

.conn-banner { position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 90; padding: 8px 22px; border-radius: 0 0 16px 16px; background: #f59e0b; color: #1E1B4B; font-weight: 900; }

/* ---------- Khung pha ---------- */
.stage-center { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 24px; text-align: center; }
.stage-loading { height: 100%; display: grid; place-items: center; align-content: center; gap: 14px; }
.spinner-orbit { width: 70px; height: 70px; border-radius: 50%; border: 6px solid rgba(255,255,255,.15); border-top-color: var(--cyan); border-right-color: var(--pink); animation: spin 1s linear infinite; }

/* Lobby */
.lobby { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 18px; height: 100%; }
.lobby-join { padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.qr-box { width: 100%; max-width: min(300px, 42vh); padding: 6px; margin: 0 auto; background: #fff; border-radius: 20px; box-shadow: 0 0 0 6px rgba(165,180,252,.5), 0 0 40px rgba(6,182,212,.5); }
.qr-box svg { width: 100%; height: auto; aspect-ratio: 1 / 1; display: block; }
.room-code { font-family: var(--font-display); font-size: 4.2rem; line-height: 1; letter-spacing: 10px; color: #FDE68A; text-shadow: 0 5px 0 #b45309, 0 0 30px rgba(245,158,11,.6); }
.join-url { font-size: 1.05rem; color: var(--muted); word-break: break-all; }
.join-url b { color: #fff; }
.lobby-teams { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-content: start; overflow: auto; }
.team-col { --team: var(--primary); padding: 14px; border-radius: 20px; background: linear-gradient(160deg, color-mix(in srgb, var(--team) 45%, transparent), rgba(30,27,75,.8)); border: 3px solid color-mix(in srgb, var(--team) 80%, #fff); min-height: 180px; }
.team-col-head { display: flex; align-items: center; justify-content: space-between; font-family: var(--font-display); font-size: 1.5rem; margin-bottom: 8px; }
.team-members { display: flex; flex-wrap: wrap; gap: 8px; }
.member { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.14); font-size: 1rem; animation: zoomIn .4s cubic-bezier(.34,1.56,.64,1); }
.member.offline { opacity: .45; }
.member .kick { border: 0; background: transparent; color: #fca5a5; font-size: .9rem; padding: 0 2px; cursor: pointer; opacity: 0; transition: opacity .2s; }
.member:hover .kick { opacity: 1; }

/* Round intro */
.round-intro .round-icon { font-size: clamp(5rem, 14vh, 9rem); animation: zoomIn .7s cubic-bezier(.34,1.56,.64,1), float 3s ease-in-out .7s infinite; filter: drop-shadow(0 0 30px rgba(236,72,153,.8)); }
.round-intro .round-label { font-size: 1.6rem; color: var(--cyan); letter-spacing: 6px; }
.round-intro h1 { font-size: clamp(3rem, 8vh, 5.5rem); margin: 0; background: linear-gradient(90deg, #a5f3fc, #f9a8d4, #fde68a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.round-intro p { font-size: 1.7rem; max-width: 900px; }
@keyframes float { 50% { transform: translateY(-14px); } }

/* Câu hỏi */
.q-wrap { min-height: 100%; display: flex; flex-direction: column; gap: 18px; padding: 18px; }
.q-head { display: flex; align-items: center; gap: 18px; }
.q-meta { display: flex; flex-direction: column; gap: 6px; }
.q-prompt { flex: 1; padding: 22px 26px; font-size: clamp(1.6rem, 3.6vh, 2.5rem); line-height: 1.3; text-align: center; font-family: var(--font-display); }
.q-wrap .options-grid { flex: 1; align-content: center; }
.q-wrap .option-tile { font-size: clamp(1.3rem, 2.8vh, 1.9rem); min-height: 110px; }
.q-wrap .radar-btn { min-height: 220px; font-size: 2.6rem; }
.answer-progress { display: flex; align-items: center; gap: 14px; font-size: 1.2rem; }
.answer-progress .progress-energy { flex: 1; }
.explain { padding: 14px 20px; border-radius: 18px; background: rgba(34,197,94,.18); border: 2px solid #4ade80; font-size: 1.35rem; }

.q-detective { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.q-detective .scene { max-width: none; font-size: 1.15rem; }
.detective-legend { padding: 16px; font-size: 1.1rem; }

/* Thảo luận nhóm */
.team-answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.team-answer { --team: var(--primary); padding: 16px; border-radius: 20px; border: 3px solid color-mix(in srgb, var(--team) 80%, #fff); background: linear-gradient(160deg, color-mix(in srgb, var(--team) 35%, transparent), rgba(30,27,75,.85)); display: flex; flex-direction: column; gap: 10px; }
.team-answer .ta-head { display: flex; justify-content: space-between; align-items: center; font-family: var(--font-display); font-size: 1.4rem; }
.team-answer .ta-text { flex: 1; min-height: 80px; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.95); color: #1E1B4B; font-size: 1.25rem; white-space: pre-wrap; word-break: break-word; }
.team-answer .ta-text.empty { color: #9ca3af; font-style: italic; }
.team-answer .ta-text.typing::after { content: "▍"; animation: blink 1s steps(2) infinite; }
.grade-row { display: flex; gap: 8px; flex-wrap: wrap; }
.grade-row .btn-game { flex: 1; min-width: 60px; }
.grade-row .btn-game.chosen { --btn-bg: linear-gradient(135deg, #16a34a, #22C55E); outline: 4px solid #fde68a; }
.suggested-box { padding: 12px 18px; border-radius: 16px; border: 2px dashed #fde68a; background: rgba(245,158,11,.12); font-size: 1.1rem; }

/* Boss arena */
.boss-arena { position: relative; min-height: 100%; display: grid; grid-template-rows: auto auto 1fr auto; gap: 12px; padding: 16px; }
.boss-top { display: flex; align-items: center; gap: 16px; }
.boss-name { font-family: var(--font-display); font-size: 2rem; color: #f9a8d4; text-shadow: 0 0 20px #EC4899; white-space: nowrap; }
.boss-top .boss-hp { flex: 1; }
.boss-center { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; }
.boss-stage { display: grid; place-items: center; }
.boss-question { font-size: 1.45rem; }
.boss-question .q-prompt { font-size: 1.7rem; padding: 16px; }
.boss-question .options-grid { grid-template-columns: 1fr; gap: 10px; }
.boss-question .option-tile { min-height: 64px; font-size: 1.2rem; padding: 10px 14px; }
.boss-question .option-tile .opt-shape { width: 40px; height: 40px; }
.cannons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.cannon { --team: var(--primary); position: relative; text-align: center; padding: 10px; border-radius: 18px; background: linear-gradient(180deg, color-mix(in srgb, var(--team) 40%, transparent), rgba(30,27,75,.85)); border: 3px solid color-mix(in srgb, var(--team) 80%, #fff); }
.cannon .cannon-gun { font-size: 2.4rem; display: block; }
.cannon .cannon-name { font-family: var(--font-display); font-size: 1.2rem; }
.cannon.fire { animation: recoil .4s ease-out; }
.cannon.hurt { animation: shake .5s; background: linear-gradient(180deg, rgba(239,68,68,.6), rgba(30,27,75,.85)); }
.cannon .cannon-status { font-size: .95rem; min-height: 1.3em; }
@keyframes recoil { 30% { transform: translateY(10px) scale(.95); } }

.victory { position: relative; }
.victory h1 { font-size: clamp(3rem, 9vh, 6rem); margin: 0; color: #fde68a; text-shadow: 0 6px 0 #b45309, 0 0 40px rgba(253,224,71,.8); }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 16px; width: 100%; max-width: 980px; }
.podium-step { --team: var(--primary); flex: 1; text-align: center; padding: 14px 10px; border-radius: 20px 20px 8px 8px; background: linear-gradient(180deg, color-mix(in srgb, var(--team) 70%, #fff 0%), rgba(30,27,75,.9)); border: 3px solid #fff; animation: slideUp .8s cubic-bezier(.22,1,.36,1) both; }
.podium-step .p-medal { font-size: 3.4rem; }
.podium-step .p-name { font-family: var(--font-display); font-size: 1.6rem; }
.podium-step.p1 { min-height: 280px; animation-delay: .6s; }
.podium-step.p2 { min-height: 220px; animation-delay: .3s; }
.podium-step.p3 { min-height: 180px; animation-delay: .1s; }
.podium-step.p4 { min-height: 140px; }
.top-players { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 1100px; }
.top-player { padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.25); font-size: 1.1rem; }

.result-wrap { max-width: 1100px; margin: 0 auto; padding: 18px; width: 100%; }
.result-wrap .leaderboard .lb-row { padding: 16px 22px; }
.result-wrap .lb-name { font-size: 2rem; }
.result-wrap .lb-energy { font-size: 2.6rem; }

/* Màn hình nhỏ (laptop 1366×768 hoặc nhỏ hơn) */
@media (max-width: 1200px) {
  .host-layout { grid-template-columns: minmax(0, 1fr) 250px; }
  .q-detective { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .host-layout { height: auto; grid-template-columns: 1fr; grid-template-areas: "top" "stage" "controls" "side"; }
  .host-stage { min-height: 70vh; }
  .lobby { grid-template-columns: 1fr; }
  .boss-center { grid-template-columns: 1fr; }
  .cannons, .team-answers, .lobby-teams { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .round-track { margin-left: 0; }
}

/* Boss arena phải vừa khung 16:9 (máy chiếu 1366×768): boss nhỏ lại, khẩu pháo gọn */
.boss-arena .boss-img { width: min(27vh, 300px); }
.boss-arena .q-prompt { padding: 10px 16px; font-size: clamp(1.3rem, 3vh, 2rem); }
.boss-arena .cannon { padding: 6px; }
.boss-arena .cannon .cannon-gun { font-size: 1.8rem; }
.boss-arena .explain, .boss-arena .answer-progress { font-size: 1.1rem; }
.boss-arena { gap: 8px; padding: 10px 14px; }
.boss-arena .countdown { width: 72px; height: 72px; }
.boss-arena .countdown .num { font-size: 1.7rem; }
.boss-arena .cannon { display: flex; align-items: center; gap: 8px; text-align: left; }
.boss-arena .cannon .cannon-gun { font-size: 1.6rem; }
.boss-arena .cannon .cannon-name { font-size: 1.05rem; }
.boss-arena .cannon .cannon-status { font-size: .85rem; }
.boss-arena .explain { padding: 8px 14px; }
