/* Host app: home, console, editor */
.page { max-width: 1280px; margin: 0 auto; padding: 24px; }
.empty { color: var(--muted); padding: 40px; text-align: center; border: 2px dashed var(--line); border-radius: var(--radius); }
.hint { color: var(--muted); margin: 0 0 12px; }

/* ---------- home ---------- */
.home-head { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.brand { display: flex; gap: 16px; align-items: center; }
.brand h1 { font-size: 34px; margin: 0; letter-spacing: 0.02em; }
.brand p { margin: 2px 0 0; color: var(--muted); max-width: 520px; }
.brand-mark { flex-shrink: 0; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; font-size: 30px; font-weight: 900; background: linear-gradient(135deg, var(--pink), var(--orange)); box-shadow: 0 10px 26px rgba(255, 79, 163, 0.4); transform: rotate(-6deg); }
.home-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.resume { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; padding: 16px 20px; margin-bottom: 20px; border-radius: var(--radius); background: linear-gradient(90deg, rgba(255, 210, 63, 0.18), rgba(255, 79, 163, 0.12)); border: 1px solid rgba(255, 210, 63, 0.4); }
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 18px; }
.pack-card { background: linear-gradient(160deg, var(--card), var(--bg2)); border: 1px solid var(--line); border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 12px; transition: transform 0.15s, box-shadow 0.15s; }
.pack-card:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35); }
.pc-title { font-size: 22px; font-weight: 800; }
.pc-meta { color: var(--muted); font-size: 14px; }
.pc-rounds { display: flex; flex-wrap: wrap; gap: 6px; }
.pc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pc-actions.secondary { border-top: 1px solid var(--line); padding-top: 10px; }
.home-foot { margin-top: 30px; color: var(--muted); font-size: 14px; text-align: center; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; background: var(--bg2); border-bottom: 1px solid var(--line); }
.top-title { font-weight: 800; font-size: 18px; flex: 1; min-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aud-status { font-size: 13px; color: var(--muted); padding: 6px 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.05); }
.aud-status.on { color: var(--lime); background: rgba(124, 240, 106, 0.12); }

/* ---------- host console ---------- */
body.host { overflow: hidden; }
.console { height: 100vh; display: flex; flex-direction: column; }
.console-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, 1fr); gap: 14px; padding: 12px 14px; }
.left-col { min-height: 0; display: flex; flex-direction: column; gap: 10px; overflow: auto; }
.preview-frame { width: 100%; aspect-ratio: 16 / 9; max-height: 58vh; border-radius: 14px; overflow: hidden; border: 2px solid var(--line); background: #000; align-self: center; flex: 0 0 auto; }
.preview-frame:has(.stage-host) { max-width: calc(58vh * 16 / 9); }
.stage-host { width: 100%; height: 100%; }
.ctl-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.timer-ctl { display: flex; flex-wrap: wrap; gap: 8px; }
.extra-ctl:empty { display: none; }
.break-ctl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; border-radius: 12px; background: rgba(62, 230, 255, 0.08); }
.hint-line { color: var(--muted); font-size: 14px; }
.now-next { display: grid; gap: 4px; font-size: 14px; color: var(--muted); background: rgba(255, 255, 255, 0.04); padding: 10px 12px; border-radius: 12px; }
.now-next b { color: var(--text); }
.now-next div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kbd-hint { font-size: 12px; color: var(--muted); opacity: 0.8; }
.right-col { min-height: 0; display: flex; flex-direction: column; background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); }
.tab { flex: 1; font: 700 14px var(--font); color: var(--muted); background: transparent; border: 0; border-radius: 10px; padding: 9px 6px; cursor: pointer; }
.tab.on { background: var(--card2); color: var(--text); }
.panel-body { flex: 1; min-height: 0; overflow: auto; padding: 14px; }

.host-info { display: flex; flex-direction: column; gap: 10px; }
.hi-round { color: var(--muted); font-size: 14px; }
.hi-q { font-size: 18px; font-weight: 700; white-space: pre-line; }
.hi-answer { background: rgba(124, 240, 106, 0.12); border: 1px solid rgba(124, 240, 106, 0.4); border-radius: 12px; padding: 10px 14px; }
.hi-answer small { color: var(--lime); font-weight: 700; display: block; }
.hi-answer > div { font-size: 26px; font-weight: 900; }
.hi-small { font-size: 13px; color: var(--muted); }
.media-note { font-size: 13px; color: var(--cyan); }
.hi-list-title { font-weight: 800; margin-top: 8px; display: flex; align-items: center; }
.hi-list { margin: 0; padding-left: 22px; display: grid; gap: 6px; font-size: 14px; }
.hi-list li span { color: var(--muted); }
.hi-list li b { display: block; color: var(--lime); }

.score-table, .bet-table { border-collapse: separate; border-spacing: 0 4px; width: 100%; font-size: 14px; }
.score-table th, .bet-table th { color: var(--muted); font-weight: 700; padding: 4px; text-align: center; }
.score-table th.cur, .score-table td.cur { background: rgba(255, 210, 63, 0.1); }
.score-table td, .bet-table td { padding: 2px 3px; text-align: center; background: rgba(255, 255, 255, 0.03); }
td.tn { text-align: left; font-weight: 700; padding-left: 8px; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
td.total { font-weight: 900; color: var(--yellow); font-size: 16px; }
.score-in { width: 48px; font: 700 15px var(--font); text-align: center; color: var(--text); background: #16123a; border: 1px solid var(--line); border-radius: 8px; padding: 6px 2px; }
.score-in:focus { border-color: var(--cyan); outline: none; }
.bet-total { font: 800 15px var(--font); color: var(--yellow); background: rgba(255, 210, 63, 0.12); border: 1px dashed rgba(255, 210, 63, 0.5); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.bet-grid { margin-top: 12px; padding: 12px; border-radius: 12px; background: rgba(255, 210, 63, 0.06); border: 1px solid rgba(255, 210, 63, 0.25); overflow-x: auto; }
.bet-table th small { display: block; color: var(--lime); font-weight: 600; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bet-cell { min-width: 96px; }
.bc-row { display: flex; gap: 3px; justify-content: center; margin: 2px 0; }
.yn, .betb { font: 800 14px var(--font); color: var(--muted); background: #16123a; border: 1px solid var(--line); border-radius: 7px; min-width: 28px; height: 26px; cursor: pointer; }
.yn.yes.on { background: var(--lime); color: #0d2a06; border-color: transparent; }
.yn.no.on { background: var(--red); color: #fff; border-color: transparent; }
.betb.on { background: var(--yellow); color: #221c00; border-color: transparent; }
.bc-pts { font-weight: 800; font-size: 13px; }
.mini-standings { margin-top: 14px; }
ol.mini { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
ol.mini li { display: flex; gap: 10px; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.04); }
ol.mini li span:nth-child(2) { flex: 1; }
.mp { width: 22px; color: var(--muted); font-weight: 800; }

.team-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.team-row { display: flex; gap: 8px; align-items: center; }
.team-row .field { flex: 1; margin: 0; }
.team-row .field > span:empty { display: none; }
.ti { width: 22px; color: var(--muted); font-weight: 800; text-align: right; }
.add-team { display: flex; gap: 8px; margin-bottom: 8px; }

ol.plan { margin: 0; padding-left: 34px; font-size: 14px; display: grid; gap: 2px; }
ol.plan li { padding: 5px 8px; border-radius: 8px; cursor: pointer; color: var(--muted); }
ol.plan li:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
ol.plan li.cur { background: var(--pink); color: #fff; font-weight: 700; }

/* single-window mode: the stage fills the screen, console hidden */
body.single .console > .topbar, body.single .console .left-col > :not(.preview-frame), body.single .right-col { display: none; }
body.single .preview-frame { position: fixed; inset: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; border: 0; border-radius: 0; z-index: 100; aspect-ratio: auto; }

@media (max-width: 1100px) {
  body.host { overflow: auto; }
  .console { height: auto; min-height: 100vh; }
  .console-main { grid-template-columns: 1fr; }
  .right-col { min-height: 60vh; }
}

/* ---------- editor ---------- */
.page.editor { max-width: none; padding: 0; }
.editor .topbar { position: sticky; top: 0; z-index: 20; }
.saved { font-size: 13px; color: var(--lime); }
.saved.dirty { color: var(--yellow); }
.editor-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; max-width: 1280px; margin: 0 auto; padding: 20px; }
.editor-nav { position: sticky; top: 74px; align-self: start; display: flex; flex-direction: column; gap: 4px; max-height: calc(100vh - 90px); overflow: auto; }
.editor-nav a { color: var(--text); text-decoration: none; padding: 8px 10px; border-radius: 10px; font-weight: 700; }
.editor-nav a:hover { background: var(--card); }
.nav-rounds { display: flex; flex-direction: column; gap: 2px; }
.editor-nav a.sub { display: block; font-weight: 500; font-size: 14px; color: var(--muted); padding: 5px 10px 5px 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.warnings { margin-bottom: 18px; padding: 12px 16px; border-radius: 14px; background: rgba(255, 210, 63, 0.1); border: 1px solid rgba(255, 210, 63, 0.4); color: #ffe9a3; }
.warnings.ok { background: rgba(124, 240, 106, 0.1); border-color: rgba(124, 240, 106, 0.4); color: var(--lime); }
.warnings summary { cursor: pointer; font-weight: 800; }
.warnings ul { margin: 8px 0 0; padding-left: 20px; }
.ed-sec { background: var(--bg2); border: 1px solid var(--line); border-radius: 20px; padding: 20px; margin-bottom: 20px; }
.ed-sec h3 { margin: 18px 0 10px; font-size: 17px; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; flex: 1; }
.field > span { font-size: 13px; font-weight: 700; color: var(--muted); }
.field.short { flex: 0 0 auto; }
.field small { color: var(--muted); font-size: 12px; }
.grid-fields { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.checks { display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--pink); }
.cards { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; flex-wrap: wrap; }
.card-body { padding: 4px 16px 16px; }
.card-body.two { display: grid; grid-template-columns: 1fr 260px; gap: 16px; }
.handle { cursor: grab; color: var(--muted); font-size: 20px; padding: 0 4px; user-select: none; }
.dragging { opacity: 0.45; }
.drop-target { outline: 2px dashed var(--cyan); outline-offset: 2px; }
.round-card { border-left: 6px solid var(--pink); }
.round-card.t-music { border-left-color: var(--cyan); }
.round-card.t-betting { border-left-color: var(--yellow); }
.round-title { flex: 1; min-width: 180px; font-weight: 800; font-size: 17px; }
.qcount { color: var(--muted); font-size: 13px; }
.media-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.media-field { background: rgba(0, 0, 0, 0.18); border: 1px dashed var(--line); border-radius: 12px; padding: 10px; width: 240px; display: flex; flex-direction: column; gap: 6px; }
.mf-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.mf-img { max-width: 100%; max-height: 130px; object-fit: contain; border-radius: 8px; align-self: flex-start; background: rgba(255, 255, 255, 0.05); }
.mf-video { width: 100%; max-height: 140px; border-radius: 8px; background: #000; }
.media-field audio { width: 100%; height: 36px; }
.mf-name { font-size: 12px; color: var(--muted); word-break: break-all; }
.mf-missing { font-size: 13px; color: var(--red); }
.mf-actions { display: flex; gap: 6px; }
.upload { align-self: flex-start; }
.questions { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.q-card { display: flex; gap: 10px; background: rgba(0, 0, 0, 0.18); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.q-side { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.qn { font-size: 20px; color: var(--yellow); }
.q-main { flex: 1; min-width: 0; }
.q-row { display: flex; gap: 12px; flex-wrap: wrap; }
.q-media { margin-bottom: 8px; }
.q-media summary { cursor: pointer; color: var(--cyan); font-weight: 700; font-size: 14px; margin-bottom: 8px; }

@media (max-width: 900px) {
  .editor-layout { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .media-field, .media-field.wide { width: 100%; }
  .q-card { flex-direction: column; }
  .q-side { flex-direction: row; }
  .ed-sec { padding: 14px; }
  .editor-nav { position: static; flex-direction: row; flex-wrap: wrap; max-height: none; }
  .editor-nav .nav-rounds { display: none; }
  .card-body.two { grid-template-columns: 1fr; }
}

/* ---------- v2: home sections ---------- */
.home-sec { margin-bottom: 30px; }
.sec-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.sec-head h2 { margin: 0; font-size: 26px; }
.sec-head .hint { margin: 0; }
.pack-card.template { background: linear-gradient(160deg, #1f2a55, var(--bg2)); border-style: dashed; }

/* ---------- v2: editor ---------- */
.tpl-note { margin-bottom: 14px; padding: 12px 16px; border-radius: 14px; background: rgba(62, 230, 255, 0.08); border: 1px solid rgba(62, 230, 255, 0.35); color: #c8f7ff; }
.estimate { margin-bottom: 18px; padding: 10px 16px; border-radius: 14px; background: rgba(139, 108, 255, 0.1); border: 1px solid rgba(139, 108, 255, 0.35); }
.est-total b { font-size: 18px; color: var(--yellow); }
.est-parts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); margin-top: 4px; }
.round-est { font-size: 13px; color: var(--violet); font-weight: 700; background: rgba(139, 108, 255, 0.14); padding: 3px 9px; border-radius: 99px; }
.round-card.t-multiple_choice { border-left-color: var(--violet); }
.round-card.t-captains { border-left-color: var(--orange); }
.round-card.t-jeopardy { border-left-color: var(--lime); }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.media-field.wide { width: 320px; }
.trim { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 10px; background: rgba(62, 230, 255, 0.06); border: 1px solid rgba(62, 230, 255, 0.2); }
.trim-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.trim-row label { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); font-weight: 700; }
.trim-row .input.num { width: 78px; padding: 6px 8px; }
.trim-info { font-size: 12px; color: var(--cyan); }
.trim-info.bad { color: var(--red); }
.options { display: grid; gap: 6px; margin-bottom: 8px; }
.opt-row { display: flex; gap: 8px; align-items: center; }
.opt-correct { display: flex; gap: 6px; align-items: center; cursor: pointer; min-width: 44px; }
.options.cap .opt-correct { min-width: 92px; }
.opt-correct input { width: 18px; height: 18px; accent-color: var(--lime); }
.opt-in { flex: 1; }
.themes { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.theme-card { background: rgba(124, 240, 106, 0.05); border: 1px solid rgba(124, 240, 106, 0.25); border-radius: 14px; padding-bottom: 8px; }
.theme-card .questions { padding: 0 10px; margin: 0; }
.theme-name { flex: 1; min-width: 160px; font-weight: 800; }
.q-card.cell .qn { font-size: 15px; color: var(--lime); }
.values-in { width: 170px; }
.tb-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.tb-edit { display: flex; gap: 8px; align-items: center; }
.tb-edit .field { margin: 0; }
.tb-edit .field > span:empty { display: none; }
.add-q:disabled { opacity: 0.4; }

/* ---------- v2: host console ---------- */
ol.hi-opts { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
ol.hi-opts li { padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.04); }
ol.hi-opts li.ok { background: rgba(124, 240, 106, 0.18); color: var(--lime); font-weight: 800; }
.hi-warn { padding: 8px 12px; border-radius: 10px; background: rgba(255, 210, 63, 0.14); color: var(--yellow); font-weight: 700; }
.cap-panel, .jp-panel, .tb-panel { display: flex; flex-direction: column; gap: 8px; }
.check-list { display: grid; gap: 6px; }
.cap-check { padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); }
.cap-check input { accent-color: var(--red); }
.jp-host-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.jp-th { white-space: normal; text-align: left; justify-content: flex-start; }
.jp-th.struck { text-decoration: line-through; opacity: 0.5; }
.jp-th small { font-weight: 500; color: var(--muted); }
table.jp-host-board { border-collapse: separate; border-spacing: 4px; width: 100%; }
table.jp-host-board th { text-align: left; font-size: 13px; color: var(--muted); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jp-hcell { width: 100%; font: 800 16px var(--font); color: var(--yellow); background: #2a2380; border: 1px solid var(--line); border-radius: 8px; padding: 9px 4px; cursor: pointer; }
.jp-hcell:hover:not(:disabled) { background: #3b31a8; }
.jp-hcell.used { color: var(--muted); background: rgba(255, 255, 255, 0.03); cursor: default; }
.jp-marks { display: grid; gap: 6px; }
.jp-mark { display: flex; gap: 6px; align-items: center; padding: 4px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.04); }
.jp-mark span { flex: 1; font-weight: 700; }
.jp-mark .yn { min-width: 40px; height: 32px; font-size: 16px; }
.auto-total { display: inline-block; font-weight: 800; color: var(--lime); padding: 6px 8px; }
.tb-inputs { display: grid; gap: 6px; }
.tb-in { display: flex; gap: 8px; align-items: center; }
.tb-in span { flex: 1; font-weight: 700; }
.tb-group { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 12px; background: rgba(255, 210, 63, 0.07); border: 1px solid rgba(255, 210, 63, 0.3); }
.tb-row-in { display: flex; gap: 6px; }
.tb-mini { color: var(--yellow); font-size: 11px; }
ol.plan li.skipped { opacity: 0.4; text-decoration: line-through; }
.nav-inner { display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 900px) { .nav-inner { flex-direction: row; flex-wrap: wrap; } }
