/* Host pages: auth, dashboard, editor, presenter, reports */

/* ───── Auth ───── */
.auth-alt {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 8px;
  margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--border); color: var(--text-muted);
}
body.game .auth-alt a {
  display: inline-flex; align-items: center; gap: .35em; padding: .3em .8em; border-radius: 999px;
  font-weight: 700; color: var(--link); text-decoration: none;
  background: color-mix(in srgb, var(--link) 10%, transparent);
  transition: background .2s ease;
}
body.game .auth-alt a:hover { background: color-mix(in srgb, var(--link) 18%, transparent); }
.auth-page .form-error { outline: none; }

/* ───── Generic page ───── */
.page { padding-top: 28px; padding-bottom: calc(48px + var(--safe-bottom)); }
.page__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page__head h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin-bottom: 4px; }
.page__head p { margin: 0; }
.section-h { margin: 32px 0 12px; font-size: 1.25rem; }
.empty { text-align: center; padding: 40px 20px; display: grid; justify-items: center; gap: 8px; }
.row--center { justify-content: center; }

/* ───── Dashboard ───── */
.quiz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.quiz-card { display: flex; flex-direction: column; gap: 16px; position: relative; overflow: hidden; }
.quiz-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: linear-gradient(90deg, var(--electric), var(--violet) 55%, var(--volt)); }
.quiz-card__top { flex: 1; }
.quiz-card__title { font-size: 1.3rem; margin: 4px 0 6px; overflow-wrap: anywhere; }
.quiz-card__desc { margin: 0 0 8px; font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.quiz-card__meta { margin: 0; font-size: .85rem; color: var(--text-muted); }
.quiz-card__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.quiz-card__actions .btn--accent { flex: 1 1 100%; }
.quiz-card__actions .btn:not(.btn--icon):not(.btn--accent) { flex: 1; }

.mode-pick { border: 0; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.mode-card { display: flex; gap: 12px; align-items: center; padding: 14px; border: 2px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.mode-card:has(input:checked) { border-color: var(--brand); background: var(--brand-100); }
.mode-card input { width: 1.3em; height: 1.3em; accent-color: var(--brand); }
.mode-card span { display: grid; }
.mode-card small { color: var(--text-muted); }

/* ───── Editor ───── */
.editor-page { background: var(--surface-2); }
.ebar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px;
  padding: calc(8px + var(--safe-top)) calc(var(--gutter) + var(--safe-right)) 8px calc(var(--gutter) + var(--safe-left));
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.ebar__title { flex: 1; min-width: 0; font-weight: 700; font-size: 1.1rem; }
.ebar__status { font-size: .85rem; color: var(--text-muted); white-space: nowrap; min-width: 9ch; text-align: right; }

.editor {
  display: grid; grid-template-columns: 260px minmax(0, 1fr) 260px; gap: 20px;
  max-width: 1400px; margin: 0 auto; padding: 20px var(--gutter) calc(40px + var(--safe-bottom));
  align-items: start;
}
.editor > * { min-width: 0; }
.qlist { position: sticky; top: 84px; max-height: calc(100dvh - 104px); display: flex; flex-direction: column; gap: 12px; }
.qlist__items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; overflow-y: auto; }
.qlist__add { display: grid; gap: 8px; }
.qitem { display: flex; align-items: stretch; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius-sm); }
.qitem--active { border-color: var(--brand); box-shadow: 0 0 0 3px rgb(91 59 245 / .2); }
.qitem__main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 10px; background: none; border: 0; text-align: left; cursor: pointer; }
.qitem__num { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; font-size: .85rem; }
.qitem--active .qitem__num { background: var(--brand); color: #fff; }
.qitem__body { min-width: 0; display: grid; }
.qitem__type { font-size: .75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.qitem__text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .92rem; }
.qitem__warn { flex: none; width: 22px; height: 22px; border-radius: 50%; background: #ffb800; color: var(--midnight); display: grid; place-items: center; font-weight: 900; font-size: .8rem; margin-left: auto; }
.qitem__move { display: flex; flex-direction: column; border-left: 1px solid var(--border); }
.iconbtn { flex: 1; min-width: 36px; border: 0; background: none; cursor: pointer; color: var(--text-muted); font-weight: 700; }
.iconbtn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.iconbtn:disabled { opacity: .3; cursor: default; }

.qedit { background: var(--surface); border-radius: var(--radius); padding: clamp(16px, 3vw, 28px); box-shadow: var(--shadow); display: grid; gap: 16px; }
.qedit .field { margin: 0; }
.qedit__text { font-size: clamp(1.1rem, 2.4vw, 1.5rem); font-weight: 700; text-align: center; min-height: 80px; }
.qedit__media { display: grid; justify-items: center; gap: 8px; }
.dropzone {
  position: relative; width: min(100%, 420px); aspect-ratio: 16 / 9; border: 2px dashed var(--border); border-radius: var(--radius);
  display: grid; place-items: center; overflow: hidden; background: var(--surface-2); transition: border-color .15s ease;
}
.dropzone:focus-within, .dropzone--over { border-color: var(--brand); }
.dropzone--busy { opacity: .6; }
.dropzone img { width: 100%; height: 100%; object-fit: contain; }
.dropzone__empty { display: grid; justify-items: center; gap: 4px; padding: 12px; text-align: center; color: var(--text-muted); font-weight: 600; pointer-events: none; }
svg.dropzone__icon { width: 2.2rem; height: 2.2rem; stroke-width: 1.6; }
.dropzone__input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 72px;
  border-radius: var(--radius-sm); color: #fff;
}
.choice .shape { width: 28px; height: 28px; }
.choice--0 { background: var(--a0); } .choice--1 { background: var(--a1); }
.choice--2 { background: var(--a2); } .choice--3 { background: var(--a3); }
.choice__input {
  flex: 1; min-width: 0; min-height: 44px; border: 0; border-radius: 6px; padding: .4em .6em;
  background: rgb(255 255 255 / .95); color: var(--midnight); font-weight: 600;
}
.choice__input:focus { outline: 3px solid #fff; outline-offset: 1px; }
.choice__correct { display: grid; place-items: center; cursor: pointer; }
.choice__check {
  appearance: none; -webkit-appearance: none; width: 34px; height: 34px; margin: 0; border-radius: 50%;
  border: 3px solid #fff; background: transparent; cursor: pointer; display: grid; place-items: center;
}
.choice__check::after {
  content: ""; width: 18px; height: 18px; background: transparent;
  -webkit-mask: var(--icon-check) center / contain no-repeat; mask: var(--icon-check) center / contain no-repeat;
}
.choice__check:checked { background: #fff; }
.choice__check:checked::after { background: var(--ok); }
.choice__check:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.choices--tf { grid-template-columns: 1fr; }
.tf-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice--tf { cursor: pointer; justify-content: space-between; font-size: 1.25rem; font-weight: 800; }
.choice__tf { flex: 1; }
.hint--ok { color: var(--ok); font-weight: 600; }

.qsettings { position: sticky; top: 84px; background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.quiz-meta { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 14px; }
.quiz-meta summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }

@media (max-width: 1100px) {
  .editor { grid-template-columns: 220px minmax(0, 1fr); }
  .qsettings { grid-column: 2; position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; }
  .qsettings .field { margin: 0; }
  .quiz-meta { grid-column: 1 / -1; margin-top: 0; }
}
@media (max-width: 760px) {
  .editor { grid-template-columns: 1fr; padding-top: 12px; gap: 12px; }
  .qlist { position: static; max-height: none; }
  .qlist__items { display: flex; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x mandatory; }
  .qitem { flex: 0 0 min(78vw, 240px); scroll-snap-align: start; }
  .qlist__add { grid-template-columns: 1fr 1fr; }
  .qsettings { grid-column: auto; }
  .choices, .tf-pick { grid-template-columns: 1fr; }
  .ebar__status { display: none; }
}

/* ───── Tables / reports ───── */
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); background: var(--surface-2); }
.table tbody tr:last-child > * { border-bottom: 0; }
.table tbody th { font-weight: 600; white-space: normal; min-width: 12ch; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table__actions { text-align: right; }
.row--muted { opacity: .55; }
.badge { display: inline-block; padding: .15em .6em; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--surface-2); color: var(--text-muted); text-decoration: none; }
.badge--live { background: var(--volt); color: var(--midnight); }
.dot { display: inline-block; width: .8em; height: .8em; border-radius: 50%; background: var(--c); margin-right: .5em; vertical-align: -.05em; }
.meter { display: inline-block; width: 48px; height: 6px; border-radius: 3px; margin-right: 8px; vertical-align: middle; background: linear-gradient(90deg, var(--ok) var(--v), var(--surface-2) var(--v)); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { display: grid; gap: 2px; padding: 18px; }
.stat__n { font-family: var(--font-display); font-size: 2rem; font-weight: 800; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat__l { color: var(--text-muted); font-size: .9rem; }

.qreport { display: grid; gap: 12px; }
.qreport__head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.qreport__head h3 { flex: 1; margin: 0; font-size: 1.05rem; min-width: 60%; overflow-wrap: anywhere; }
.qreport__num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 700; font-size: .85rem; flex: none; align-self: center; }
.qreport__acc { font-weight: 800; color: var(--ok); }
.qreport__acc--low { color: var(--bad); }
.qreport__meta { margin: 6px 0 12px; font-size: .88rem; }
.qreport__choices { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.qreport__choices li { display: grid; grid-template-columns: 24px minmax(0, 1.2fr) minmax(60px, 1fr) 3ch; gap: 10px; align-items: center; }
.qreport__text { overflow-wrap: anywhere; }
.qreport__shape { display: grid; place-items: center; }
.qreport__shape .shape { width: 1.05em; height: 1.05em; }
.qreport__bar { height: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.qreport__bar span { display: block; height: 100%; border-radius: 6px; }
.qreport__n { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.answer-c0 { color: var(--a0); } .answer-c1 { color: var(--a1); } .answer-c2 { color: var(--a2); } .answer-c3 { color: var(--a3); }
.answer-bg0 { background: var(--a0); } .answer-bg1 { background: var(--a1); } .answer-bg2 { background: var(--a2); } .answer-bg3 { background: var(--a3); }
.ok { color: var(--ok); font-size: .85rem; }
@media (max-width: 560px) {
  .qreport__choices li { grid-template-columns: 20px minmax(0, 1fr) 3ch; }
  .qreport__bar { grid-column: 2 / 4; grid-row: 2; }
}

/* ═════════ Presenter (big screen) ═════════ */
body.present { overflow: hidden; height: 100dvh; font-size: clamp(16px, 1.25vw, 24px); }
.hbar { display: flex; align-items: center; gap: 12px; padding: 8px clamp(12px, 2vw, 28px); background: rgb(20 8 63 / .35); min-height: 56px; }
.hbar .logo { font-size: 1.1rem; flex: none; }
.hbar__pin { flex: none; white-space: nowrap; background: #fff; color: var(--violet); padding: .2em .8em; border-radius: 999px; font-weight: 800; font-family: var(--font-display); }
.hbar__q { flex: none; white-space: nowrap; font-weight: 700; opacity: .9; font-variant-numeric: tabular-nums; }
.hbtn { flex: none; display: inline-grid; place-items: center; min-width: 44px; height: 44px; border: 0; border-radius: 22px; background: rgb(255 255 255 / .14); color: #fff; cursor: pointer; font-size: 1.05rem; padding: 0 12px; white-space: nowrap; }
.hbtn:hover { background: rgb(255 255 255 / .24); }
.hbtn--text { font-weight: 700; font-size: .9rem; }

/* Phones: logo + buttons on the first row; PIN and question count drop to a
   second row (a zero-height line break sits between them via ::after). */
@media (max-width: 640px) {
  .hbar { flex-wrap: wrap; gap: 8px; row-gap: 0; padding: 8px 12px; min-height: 0; }
  .hbar .logo { font-size: .95rem; }
  .hbar .spacer { order: 1; }
  .hbar .hbtn { order: 2; min-width: 40px; height: 40px; padding: 0 10px; }
  .hbar .hbtn--text { padding: 0 14px; font-size: .85rem; }
  .hbar::after { content: ""; order: 3; flex-basis: 100%; }
  .hbar__pin, .hbar__q { order: 4; margin: 8px 0 2px; }
  .hbar__pin { font-size: .95rem; }
}
/* Narrow phones: the icon alone stands in for the full lockup when all four
   buttons are showing (Android has fullscreen; iPhone hides that button) */
@media (max-width: 428px) {
  .hbar:has(#fullscreen:not([hidden])) :is(.logo__word, .logo__pill) { display: none; }
}
@media (max-width: 380px) {
  .hbar .logo__word, .hbar .logo__pill { display: none; }
}

.hscreens { flex: 1; display: flex; min-height: 0; }
.hscreen { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: clamp(12px, 2vw, 32px); animation: screen-in .3s ease; }
.hcenter { align-items: center; justify-content: center; text-align: center; gap: 20px; }

.hcontrols { position: fixed; right: calc(clamp(12px, 2vw, 28px) + var(--safe-right)); bottom: calc(clamp(12px, 2vw, 28px) + var(--safe-bottom)); z-index: 30; }
.hcontrols .btn { box-shadow: 0 6px 20px rgb(0 0 0 / .3); min-width: 140px; }
.btn--on-dark { --btn-fg: #fff; border-color: rgb(255 255 255 / .5); }
.btn--on-dark:hover { background: rgb(255 255 255 / .12); }

/* Launch overlay */
.launch { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgb(20 8 63 / .85); backdrop-filter: blur(6px); padding: 20px; }
.launch__card .logo { font-size: clamp(1.6rem, 3vw, 2.4rem); }
.launch__card { text-align: center; display: grid; justify-items: center; gap: 12px; max-width: 520px; }
.launch__card h1 { font-size: clamp(1.6rem, 4vw, 2.6rem); margin: 8px 0 0; }
.hint--light { color: rgb(255 255 255 / .75); }

/* Lobby */
.hlobby { display: grid; grid-template-columns: minmax(280px, 38%) 1fr; gap: clamp(16px, 3vw, 40px); }
.hlobby__join { background: #fff; color: var(--midnight); border-radius: 20px; padding: clamp(16px, 2.5vw, 32px); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; align-self: start; box-shadow: 0 12px 40px rgb(0 0 0 / .3); }
.hlobby__step { font-size: 1.15em; margin: 0; }
.hlobby__step strong { color: var(--violet); }
.hlobby__label { margin: 12px 0 0; font-weight: 700; color: #5a5485; }
.hlobby__pin { font-family: var(--font-display); font-size: clamp(3rem, 7vw, 6.5rem); font-weight: 800; letter-spacing: .02em; line-height: 1; margin: 0 0 12px; font-variant-numeric: tabular-nums; }
.hlobby__qr { width: min(100%, 240px); aspect-ratio: 1; }
.hlobby__qr svg { width: 100%; height: 100%; }
.hlobby__players { display: flex; flex-direction: column; min-height: 0; gap: 16px; }
.hlobby__head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.hlobby__count { margin: 0; font-size: 1.4em; background: rgb(20 8 63 / .4); padding: .3em .9em; border-radius: 999px; }
.hlobby__teams-ctl { display: flex; align-items: center; gap: 12px; flex: 1; }
.switch--light { color: #fff; }
.select--sm { width: auto; min-height: 40px; padding: .3em .6em; }
.hlobby__waiting { font-size: 1.6em; opacity: .8; text-align: center; margin: auto; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start; overflow-y: auto; }
#players { flex: 1; min-height: 0; }
.pchip {
  --c: rgb(20 8 63 / .4);
  background: var(--c); color: #fff; border: 2px solid rgb(255 255 255 / .25); border-radius: 10px;
  padding: .35em .9em; font-weight: 800; font-size: 1.15em; cursor: pointer; max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pchip:hover { text-decoration: line-through; background: var(--bad); }
.pchip--new { animation: pop .4s cubic-bezier(.2, 1.6, .4, 1); }
.lobby-teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; overflow-y: auto; min-height: 0; }
.lteam { background: rgb(20 8 63 / .35); border-top: 6px solid var(--c); border-radius: 12px; padding: 12px; }
.lteam--loose { --c: rgb(255 255 255 / .4); }
.lteam__name { font-size: 1.05em; margin: 0 0 8px; }
.lteam .pchip { font-size: 1em; }

@media (max-width: 800px) {
  body.present { overflow: auto; height: auto; }
  .hlobby { grid-template-columns: 1fr; }
  .hlobby__join { align-self: stretch; }
}

/* Intro */
.hintro__num { font-size: 1.4em; font-weight: 700; opacity: .85; margin: 0; }
.hintro__text { font-family: var(--font-display); font-size: clamp(2rem, 4.5vw, 4.5rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; max-width: 24ch; margin: 0; overflow-wrap: anywhere; }
.ready-bar--wide { width: min(80vw, 800px); height: 14px; }

/* Question / result */
.hq { gap: clamp(10px, 1.5vw, 20px); }
.hq__text {
  background: #fff; color: var(--midnight); text-align: center; margin: 0; padding: .5em 1em; border-radius: 14px;
  font-family: var(--font-display); font-size: clamp(1.3rem, 2.6vw, 2.6rem); font-weight: 800; letter-spacing: -.015em; box-shadow: 0 6px 20px rgb(0 0 0 / .2); overflow-wrap: anywhere;
}
.hq__mid { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr minmax(0, 3fr) 1fr; align-items: center; gap: 16px; }
.hq__side { display: grid; place-items: center; }
.hq__media { height: 100%; min-height: 0; display: grid; place-items: center; }
.hq__img { max-height: 100%; max-width: 100%; object-fit: contain; border-radius: 12px; box-shadow: 0 8px 30px rgb(0 0 0 / .3); }
.hq__placeholder { font-size: clamp(4rem, 12vw, 10rem); font-weight: 900; opacity: .2; }
.hq__placeholder svg.icon { width: 1em; height: 1em; stroke-width: 1.5; }
.hq__placeholder--double { opacity: 1; display: grid; justify-items: center; gap: .15em; color: var(--volt); font-size: clamp(3rem, 8vw, 7rem); }
.hq__placeholder--double svg.icon { stroke-width: 1.75; filter: drop-shadow(0 0 30px rgb(198 244 50 / .45)); }
.hq__placeholder--double span { font-family: var(--font-display); font-size: .32em; font-weight: 800; letter-spacing: -.01em; color: #fff; }

.countdown {
  --p: 1;
  width: clamp(80px, 9vw, 150px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--volt) calc(var(--p) * 360deg), rgb(255 255 255 / .18) 0);
  font-family: var(--font-display); font-size: clamp(1.8rem, 3.2vw, 3.4rem); font-weight: 800;
}
.countdown span { width: 80%; height: 80%; border-radius: 50%; display: grid; place-items: center; background: var(--electric); font-variant-numeric: tabular-nums; }
.countdown--urgent { background: conic-gradient(#ff5a6a calc(var(--p) * 360deg), rgb(255 255 255 / .18) 0); }
.countdown--urgent span { animation: beat 1s ease-in-out infinite; }
@keyframes beat { 50% { transform: scale(1.08); } }
.answered { display: grid; justify-items: center; font-weight: 700; }
.answered strong { font-size: clamp(2rem, 3.6vw, 3.8rem); line-height: 1; }

.htiles { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(8px, 1vw, 14px); }
.htile {
  display: flex; align-items: center; gap: .7em; padding: .6em 1em; min-height: clamp(64px, 11vh, 120px);
  border-radius: 12px; color: #fff; font-size: clamp(1.1rem, 2vw, 2rem); font-weight: 800;
  box-shadow: inset 0 -6px 0 rgb(0 0 0 / .22); transition: opacity .3s ease, transform .3s ease;
}
.htile .shape { width: 1.5em; height: 1.5em; }
.htile__text { flex: 1; overflow-wrap: anywhere; }
.htile__tick { display: grid; font-size: 1.4em; }
.htile__tick svg.icon { stroke-width: 3; }
.htile--dim { opacity: .3; }
.htile--ok { transform: scale(1.02); }

.chart { height: 100%; width: 100%; max-width: 700px; display: flex; align-items: flex-end; justify-content: center; gap: clamp(10px, 2vw, 30px); padding-top: 12px; }
.chart__col { flex: 1; max-width: 140px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 6px; }
.chart__n { display: flex; align-items: center; justify-content: center; gap: .1em; font-weight: 900; font-size: 1.6em; }
.chart__n svg.icon { width: .9em; height: .9em; stroke-width: 3.5; color: var(--volt); }
.chart__bar { border-radius: 8px 8px 0 0; animation: grow .6s ease-out; transform-origin: bottom; }
.chart__col:not(.chart__col--ok) { opacity: .45; }
.chart__shape { display: grid; place-items: center; padding: 6px; border-radius: 0 0 8px 8px; }
.chart__shape .shape { width: 1.4em; height: 1.4em; }
@keyframes grow { from { transform: scaleY(0); } }

@media (max-width: 800px) {
  .hq__mid { grid-template-columns: 1fr 1fr; }
  .hq__media { grid-column: 1 / -1; grid-row: 1; max-height: 34vh; }
  .htiles { grid-template-columns: 1fr; }
}

/* Leaderboard */
.hboard { align-items: center; }
.hboard__title { background: #fff; color: var(--midnight); padding: .3em 1.2em; border-radius: 14px; font-size: clamp(1.6rem, 3vw, 2.8rem); }
.hboard__wrap { width: min(100%, 1100px); display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.teamboard h2 { margin: 0 0 12px; }
.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.board__row {
  display: grid; grid-template-columns: 2.2em 1fr auto; align-items: center; gap: 12px;
  background: #fff; color: var(--midnight); border-radius: 12px; padding: .7em 1em; font-family: var(--font-display); font-size: clamp(1.1rem, 1.8vw, 1.7rem); font-weight: 800;
  animation: slide-in .4s ease both; animation-delay: calc(var(--i) * 90ms);
  border-left: 8px solid var(--c, transparent);
}
.board__row:first-child { background: var(--volt); }
.board__rank { opacity: .6; }
.board__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board__name small { font-weight: 600; opacity: .6; font-size: .6em; }
.board__team { display: inline-block; margin-left: .6em; font-size: .55em; padding: .15em .6em; border-radius: 999px; background: var(--c); color: #fff; vertical-align: middle; }
.board__streak { margin-left: .5em; font-size: .7em; white-space: nowrap; }
.board__streak svg.icon { color: var(--electric); margin-right: .1em; }
.board__score { font-variant-numeric: tabular-nums; }
@keyframes slide-in { from { opacity: 0; transform: translateX(-30px); } }

/* Podium */
.hpodium { align-items: center; justify-content: flex-end; position: relative; overflow: hidden; }
.hpodium__title { font-size: clamp(1.4rem, 2.6vw, 2.4rem); margin: 0 0 8px; text-align: center; }
.hpodium__team { font-size: 1.4em; margin: 0 0 12px; }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 260px)); align-items: end; gap: clamp(8px, 1.5vw, 24px); height: min(62vh, 560px); width: 100%; justify-content: center; }
.podium__spot { display: flex; flex-direction: column; align-items: stretch; text-align: center; height: 100%; justify-content: flex-end; }
.podium__name { font-family: var(--font-display); font-size: clamp(1.1rem, 2.4vw, 2.4rem); font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0; animation: fade-in .5s ease forwards; }
.podium__score { font-weight: 700; opacity: 0; margin-bottom: 8px; animation: fade-in .5s ease forwards; }
.podium__block {
  background: linear-gradient(180deg, #fff, #d9d2ff); color: var(--violet); border-radius: 12px 12px 0 0;
  display: grid; place-items: start center; padding-top: 12px; font-size: clamp(2rem, 5vw, 4.5rem);
  transform-origin: bottom; animation: rise .8s cubic-bezier(.2, 1.2, .4, 1) both;
}
.podium__spot--1 .podium__block { height: 62%; background: linear-gradient(180deg, #ffe27a, #ffb800); animation-delay: 2.2s; }
.podium__spot--2 .podium__block { height: 45%; animation-delay: 1.2s; }
.podium__spot--3 .podium__block { height: 32%; background: linear-gradient(180deg, #ffd1b0, #e08b52); animation-delay: .3s; }
.podium__spot--1 .podium__name, .podium__spot--1 .podium__score { animation-delay: 2.8s; }
.podium__spot--2 .podium__name, .podium__spot--2 .podium__score { animation-delay: 1.8s; }
.podium__spot--3 .podium__name, .podium__spot--3 .podium__score { animation-delay: .9s; }
@keyframes rise { from { transform: scaleY(0); } }
@keyframes fade-in { to { opacity: 1; } }

.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; opacity: 0; animation: fall linear forwards; }
@keyframes fall {
  0% { opacity: 1; transform: translateY(0) rotate(0); }
  100% { opacity: .9; transform: translateY(110vh) rotate(720deg); }
}
@media (prefers-reduced-motion: reduce) {
  .confetti { display: none; }
  .podium__name, .podium__score { opacity: 1; }
}

/* ───── Host messages: Message button + composer ───── */
.shout-fab {
  position: fixed; z-index: 30; left: calc(clamp(12px, 2vw, 28px) + var(--safe-left)); bottom: calc(clamp(12px, 2vw, 28px) + var(--safe-bottom));
  display: inline-flex; align-items: center; gap: .45em; min-height: 56px; padding: 0 20px; border-radius: 999px;
  font: inherit; font-weight: 800; font-size: 1rem; color: #fff; cursor: pointer;
  background: rgb(255 255 255 / .14); border: 1px solid rgb(255 255 255 / .25);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 6px 20px rgb(0 0 0 / .3);
  transition: background .2s ease, transform .2s ease;
}
.shout-fab:hover { background: rgb(255 255 255 / .24); transform: translateY(-1px); }
.shout-fab svg.icon { width: 1.35em; height: 1.35em; }
@media (max-width: 640px) { .shout-fab { min-height: 52px; padding: 0 16px; } }

dialog.compose { width: min(94vw, 560px); }
.compose h2 { margin-bottom: 4px; }
.compose__hint { margin: 0 0 14px; font-size: .92rem; }
.compose__field { position: relative; }
.compose__text { min-height: 96px; font-size: 1.1rem; resize: none; }
.compose__suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5; list-style: none; margin: 0; padding: 6px;
  max-height: 232px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.compose__pick { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-weight: 700; }
.compose__pick[aria-selected="true"], .compose__pick:hover { background: var(--brand-100); }
.compose__avatar { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--electric); color: #fff; font-size: .8rem; }
.compose__meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.compose__emojis { display: flex; flex-wrap: wrap; gap: 4px; }
.compose__emoji {
  width: 38px; height: 38px; border: 0; border-radius: 10px; background: var(--surface-2); cursor: pointer;
  font-size: 1.25rem; line-height: 1; transition: transform .12s ease, background .12s ease;
}
.compose__emoji:hover { transform: scale(1.12); background: var(--brand-100); }
.compose__count { color: var(--text-muted); font-size: .85rem; font-variant-numeric: tabular-nums; margin-left: auto; }
.compose .form-error { margin: 12px 0 0; }

/* Keep content clear of the floating Next/Skip button */
body.present.has-controls .hscreen { padding-bottom: calc(clamp(12px, 2vw, 28px) + 84px + var(--safe-bottom)); }

.hlobby__warn { margin: 12px 0 0; padding: 8px 12px; border-radius: 8px; background: #fff4d6; color: #6b4400; font-size: .85em; text-align: left; }
