/* ════════════════════════════════════════════════════════════
   Teacher portal — hosted game setup screens (teacher/panel-<game>.php)
   ════════════════════════════════════════════════════════════
   Every game panel is laid out the same way:

     <div class="portal-panel" id="panel-<game>">
       <header class="gh-hero" style="--gh:#…">…</header>   the solo game's
            banner (css/game-hero.css), kicker reads "Host · …"
       <div class="host-layout">
         <div class="host-main">                 numbered setting cards
           <section class="host-card">
             <div class="host-card-head"><span class="host-step">1</span>
               <div><h2>Choose …</h2><p>One line of help.</p></div></div>
             … fields …
           </section>
         </div>
         <aside class="host-launch">             sticky launch card:
           … .host-toggle rows, .host-go (primary), .host-alt (secondary),
           .settings-msg, .host-note …
         </aside>
       </div>
     </div>

   Short <select>s become tappable cards/pills via js/host-setup.js:
     <select data-host-pick="cards">  name + meta cards (split on " — ", " · ", " (")
     <select data-host-pick="pills">  compact pills
   The select stays in the page (hidden) and keeps its value, so each
   game's own script reads it exactly as before.

   .host-seg = segmented buttons (toggle .is-on), .host-chip = multi-select
   chips (toggle .is-on). Form controls inside .host-card / .host-launch are
   styled here, so panels need no inline styles. */

/* ── Layout ─────────────────────────────────────────────── */
.host-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 18px;
  align-items: start;
}
.host-layout--single { grid-template-columns: minmax(0, 1fr); }
.host-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.host-wide { grid-column: 1 / -1; }
@media (max-width: 1050px) {
  .host-layout { grid-template-columns: minmax(0, 1fr); }
}

/* Game banners in the portal: same banner as the solo game, sized for the portal */
.portal-panel > .gh-hero { margin-bottom: 18px; border-radius: 20px; box-shadow: 0 8px 26px rgba(0,0,0,.12); }
.portal-panel > .gh-hero .gh-sub { max-width: 460px; }
.portal-panel > .gh-hero .gh-kicker i { font-size: 14px; line-height: 1; }
.host-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.host-fact {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface); border: 1.5px solid color-mix(in srgb, var(--gh) 22%, var(--btn-border));
  font-size: 12px; font-weight: 700; color: var(--gh-ink);
}
.host-fact i { font-size: 12px; }

/* ── Cards ──────────────────────────────────────────────── */
.host-card,
.host-launch {
  box-sizing: border-box;
  padding: 20px 22px 22px;
  background: var(--surface);
  border: 1.5px solid var(--btn-border);
  border-radius: 18px;
  box-shadow: 0 4px 18px rgba(0,0,0,.06);
  min-width: 0;
}
.host-card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.host-card-head h2 { margin: 1px 0 2px; font-size: 17px; font-weight: 800; color: var(--btn-text); }
.host-card-head p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.host-card-head .host-card-tools { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-self: center; }
.host-step {
  flex-shrink: 0;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 900;
  color: #fff; background: var(--purple);
  box-shadow: 0 3px 8px color-mix(in srgb, var(--purple) 30%, transparent);
}
.host-step i { font-size: 15px; }
.host-step--soft { color: var(--purple); background: color-mix(in srgb, var(--purple) 14%, var(--surface)); box-shadow: none; }

/* Fields */
.host-field { margin: 0 0 16px; min-width: 0; }
.host-field:last-child { margin-bottom: 0; }
.host-field > label,
.host-label {
  display: block; margin-bottom: 8px;
  font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-muted);
}
.host-label small { font-weight: 600; text-transform: none; letter-spacing: 0; }
.host-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.host-row > .host-field { margin: 0; }
.host-row + .host-field, .host-field + .host-row { margin-top: 16px; }
.host-help { margin: 8px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--text-muted); }
.host-help a { color: color-mix(in srgb, var(--purple) 80%, var(--btn-text)); font-weight: 700; text-decoration: none; }
.host-help a:hover { text-decoration: underline; }
.host-subpanel {
  margin-top: 12px; padding: 14px;
  border-radius: 12px; background: var(--surface-2); border: 1.5px solid var(--btn-border);
}

.host-card select,
.host-card input[type="text"],
.host-card input[type="number"],
.host-card input[type="search"],
.host-card textarea,
.host-launch select {
  box-sizing: border-box; width: 100%;
  padding: 10px 12px; border-radius: 10px;
  border: 1.5px solid var(--btn-border); background: var(--surface);
  font: inherit; font-size: 14px; color: var(--btn-text);
}
.host-card textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
.host-card select:focus,
.host-card input:focus,
.host-card textarea:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px color-mix(in srgb, var(--purple) 18%, transparent); }

/* ── Segmented buttons (Blitz / Race, grid size …) ──────── */
.host-seg { display: flex; flex-wrap: wrap; gap: 8px; }
.host-seg > button {
  flex: 1 1 120px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 14px; border-radius: 12px;
  border: 1.5px solid var(--btn-border); background: var(--surface);
  font: inherit; font-size: 14px; font-weight: 800; color: var(--btn-text);
  cursor: pointer; transition: border-color .12s, background .12s, color .12s;
}
.host-seg > button:hover { border-color: var(--purple); background: color-mix(in srgb, var(--purple) 6%, var(--surface)); }
.host-seg > button.is-on,
.host-seg > button.active { border-color: var(--purple); background: var(--purple); color: #fff; }

/* ── Multi-select chips (times tables, % values …) ──────── */
.host-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 8px; }
.host-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 6px 10px; border-radius: 12px;
  border: 1.5px solid var(--btn-border); background: var(--surface);
  font: inherit; font-size: 15px; font-weight: 800; color: var(--btn-text);
  cursor: pointer; transition: border-color .12s, background .12s, color .12s;
}
.host-chip:hover { border-color: var(--purple); }
.host-chip.is-on { border-color: var(--purple); background: var(--purple); color: #fff; }
.host-chips--pill { display: flex; flex-wrap: wrap; }
.host-chips--pill .host-chip { min-height: 0; padding: 6px 13px; border-radius: 999px; font-size: 13px; }
.host-link-btn {
  margin-top: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  border: 1.5px solid var(--btn-border); background: var(--surface-2);
  font: inherit; font-size: 12.5px; font-weight: 700; color: var(--btn-text); cursor: pointer;
}
.host-link-btn:hover { border-color: var(--purple); color: var(--purple); }
.host-link-btn.is-on { border-color: var(--purple); background: var(--purple); color: #fff; }

/* ── Select → cards / pills (js/host-setup.js) ──────────── */
select.host-picked { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.host-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.host-pick--pills { display: flex; flex-wrap: wrap; gap: 8px; }
.host-pick-opt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  min-width: 0; padding: 12px 14px; border-radius: 14px;
  border: 1.5px solid var(--btn-border); background: var(--surface);
  font: inherit; color: var(--btn-text); text-align: left; white-space: normal;
  cursor: pointer; transition: border-color .12s, background .12s, box-shadow .12s, transform .12s;
}
.host-pick-opt:hover { border-color: var(--purple); transform: translateY(-1px); box-shadow: 0 4px 12px color-mix(in srgb, var(--purple) 14%, transparent); }
.host-pick-opt:focus-visible { outline: 3px solid color-mix(in srgb, var(--purple) 40%, transparent); outline-offset: 2px; }
.host-pick-name { font-size: 14.5px; font-weight: 800; line-height: 1.25; }
.host-pick-meta { font-size: 12px; font-weight: 600; line-height: 1.35; color: var(--text-muted); }
.host-pick-opt.is-on {
  border-color: var(--purple);
  background: color-mix(in srgb, var(--purple) 10%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--purple);
}
.host-pick-opt.is-on .host-pick-name { color: color-mix(in srgb, var(--purple) 85%, var(--btn-text)); }
.host-pick--pills .host-pick-opt { flex-direction: row; padding: 8px 14px; border-radius: 999px; }
.host-pick--pills .host-pick-name { font-size: 13.5px; font-weight: 700; }
.host-pick--pills .host-pick-opt.is-on { background: var(--purple); box-shadow: none; }
.host-pick--pills .host-pick-opt.is-on .host-pick-name { color: #fff; }
html[data-reduce-motion] .host-pick-opt { transition: none; transform: none !important; }

/* ── Launch card ────────────────────────────────────────── */
.host-launch {
  position: sticky; top: 0;
  display: flex; flex-direction: column; gap: 4px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--purple) 7%, var(--surface)), var(--surface) 140px);
}
.host-launch-title { margin: 0 0 6px; font-size: 17px; font-weight: 800; color: var(--btn-text); display: flex; align-items: center; gap: 8px; }
.host-launch-title i { color: var(--purple); }
.host-toggle {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--toolbar-border);
}
.host-toggle:first-of-type { border-top: 0; }
.host-toggle-info { flex: 1; min-width: 0; }
.host-toggle-title { font-size: 14px; font-weight: 700; color: var(--btn-text); }
.host-toggle-desc { margin-top: 3px; font-size: 12px; line-height: 1.45; color: var(--text-muted); }
.host-toggle .toggle-switch { margin-top: 2px; }
.host-go,
.host-launch .btn-launch {
  margin-top: 10px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 16px; border: 0; border-radius: 12px;
  background: var(--purple); color: #fff;
  font: inherit; font-size: 15.5px; font-weight: 800; cursor: pointer;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--purple) 30%, transparent);
  transition: filter .12s, transform .12s;
}
.host-go:hover,
.host-launch .btn-launch:hover:not(:disabled) { background: var(--purple); filter: brightness(1.08); transform: translateY(-1px); }
.host-go:disabled,
.host-launch .btn-launch:disabled { background: var(--btn-border); color: var(--text-muted); box-shadow: none; cursor: not-allowed; transform: none; }
.host-alt {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 8px; padding: 11px 16px; border-radius: 12px;
  border: 1.5px solid color-mix(in srgb, var(--purple) 45%, var(--btn-border)); background: var(--surface);
  font: inherit; font-size: 14px; font-weight: 800; color: color-mix(in srgb, var(--purple) 85%, var(--btn-text));
  cursor: pointer;
}
.host-alt:hover { background: color-mix(in srgb, var(--purple) 8%, var(--surface)); border-color: var(--purple); }
.host-alt-desc { margin: 6px 2px 0; font-size: 12px; line-height: 1.45; color: var(--text-muted); text-align: center; }
.host-launch .settings-msg { margin-top: 8px; min-height: 0; text-align: center; }
.host-launch .settings-msg:empty { display: none; }
.host-launch .lobby-err:empty { display: none; }
.host-note {
  margin: 12px 0 0; padding: 10px 12px; border-radius: 10px;
  background: var(--surface-2);
  font-size: 12px; line-height: 1.5; color: var(--text-muted);
}
.host-note i { color: var(--purple); }
.host-selected {
  margin: 0 0 6px; padding: 10px 12px; border-radius: 12px;
  background: var(--surface-2); border: 1.5px dashed var(--btn-border);
  font-size: 14px; font-weight: 800; color: var(--btn-text);
}
.host-selected-label { display: block; margin-bottom: 2px; font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
@media (max-width: 1050px) {
  .host-launch { position: static; }
}

.host-alt:disabled { opacity: .5; cursor: not-allowed; background: var(--surface); }
.host-card-head p a { color: color-mix(in srgb, var(--purple) 80%, var(--btn-text)); font-weight: 700; text-decoration: none; white-space: nowrap; }
.host-card-head p a:hover { text-decoration: underline; }

/* "How it works" cards (Magic Square, Bubble Float) */
.host-levels { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; color: var(--text-muted); }
.host-levels span {
  padding: 8px 12px; border-radius: 10px;
  background: color-mix(in srgb, var(--purple) 10%, var(--surface)); border: 1.5px solid color-mix(in srgb, var(--purple) 25%, var(--btn-border));
  font-size: 15px; font-weight: 900; color: color-mix(in srgb, var(--purple) 80%, var(--btn-text));
}
.host-points { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; line-height: 1.5; color: var(--btn-text); }
.host-points li::marker { color: var(--purple); }

/* Globle: country search + Random side by side (autocomplete hangs off the input) */
.host-country-row { display: flex; gap: 8px; align-items: stretch; }
.host-country-input { position: relative; flex: 1; min-width: 0; }
.host-country-row .host-btn { flex-shrink: 0; }
/* Globle banner picture: cold → hot (copy of games/globle's .glb-heat) */
.gh-tiles.host-heat span:nth-child(1) { background: #b3e5fc; }
.gh-tiles.host-heat span:nth-child(2) { background: #81d4fa; }
.gh-tiles.host-heat span:nth-child(3) { background: #aed581; }
.gh-tiles.host-heat span:nth-child(4) { background: #fff176; }
.gh-tiles.host-heat span:nth-child(5) { background: #ffb74d; }
.gh-tiles.host-heat span:nth-child(6) { background: #ef5350; }

/* Quiz */
#panel-quiz .community-search { margin-bottom: 12px; }
#panel-quiz .quiz-pack-tabs { margin-bottom: 14px; }
#panel-quiz .quiz-mode-btn { border-radius: 14px; }
#panel-quiz .host-help.hidden { display: none; }
#panel-quiz .host-selected #qz-config-name { display: block; overflow-wrap: anywhere; }

/* Poll banner picture: three result bars */
.host-poll-art { display: grid; gap: 5px; width: 130px; }
.host-poll-art span {
  position: relative; padding: 4px 8px; border-radius: 6px; overflow: hidden;
  font-size: 11px; font-weight: 800; color: var(--btn-text);
  background: linear-gradient(90deg, color-mix(in srgb, var(--gh) 30%, var(--surface)) var(--w), var(--surface-2) var(--w));
}
#panel-poll textarea { min-height: 80px; }

/* Word Search preview */
.host-ws-preview { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.host-ws-summary { min-width: 180px; flex: 1; }
.host-ws-summary p { margin: 0 0 6px; font-size: 13px; }
#ws-placed-summary { font-weight: 800; color: var(--btn-text); }
#ws-dropped-summary { color: #A32D2D; }
.host-ws-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; margin-top: 16px; }
.host-ws-actions .host-go { flex: 1; min-width: 200px; width: auto; margin-top: 0; }
.host-launch .lobby-err { margin: 8px 0 0; min-height: 0; text-align: center; }

/* ── Lists under a game (recent games, polls, puzzles) ──── */
.host-list-title { margin: 0; font-size: 17px; font-weight: 800; color: var(--btn-text); }

/* ── Word list manager (Spelling Blitz, Type Ninja) ─────── */
.host-wordlists > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 12px;
}
.host-wordlists > summary::-webkit-details-marker { display: none; }
.host-wordlists > summary .host-card-head { margin: 0; flex: 1; }
.host-wordlists > summary::after {
  content: '\F282';            /* bi-chevron-down */
  font-family: 'bootstrap-icons'; font-size: 16px; color: var(--text-muted);
  transition: transform .15s;
}
.host-wordlists[open] > summary::after { transform: rotate(180deg); }
.host-wordlists[open] > summary { margin-bottom: 14px; }
.host-wl-count { font-weight: 600; color: var(--text-muted); }
.host-wl-editor {
  margin-top: 12px; padding: 16px;
  border-radius: 14px; background: var(--surface-2); border: 1.5px solid var(--btn-border);
}
.host-wl-editor .host-field > label { margin-bottom: 6px; }
.host-wl-table-wrap { overflow-x: auto; margin: 0 0 12px; }
.host-wl-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.host-wl-table--4 { min-width: 500px; }
.host-wl-table th { text-align: left; padding: 4px 8px; color: var(--text-muted); font-weight: 700; border-bottom: 1.5px solid var(--btn-border); }
.host-wl-table th.is-tiny { width: 32px; }
.host-wl-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.host-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px;
  border: 1.5px solid var(--btn-border); background: var(--surface);
  font: inherit; font-size: 13px; font-weight: 700; color: var(--btn-text); cursor: pointer;
}
.host-btn:hover { border-color: var(--purple); color: var(--purple); }
.host-btn--primary { border-color: var(--purple); background: var(--purple); color: #fff; }
.host-btn--primary:hover { color: #fff; filter: brightness(1.08); }
.host-btn--quiet { color: var(--text-muted); }
.host-btn--dashed {
  width: 100%; justify-content: center; margin-top: 12px;
  border-style: dashed; border-color: color-mix(in srgb, var(--purple) 55%, var(--btn-border));
  background: transparent; color: color-mix(in srgb, var(--purple) 85%, var(--btn-text));
}
.host-wl-msg { font-size: 12px; }
.host-wl-empty { margin: 0 0 4px; font-size: 13px; color: var(--text-muted); }
.host-wl-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 10px 12px; margin-bottom: 8px; border-radius: 12px;
  background: var(--surface-2); border: 1.5px solid var(--btn-border);
}
.host-wl-name { flex: 1; min-width: 120px; font-size: 14px; font-weight: 700; color: var(--btn-text); }
.host-wl-meta { flex-shrink: 0; font-size: 12px; color: var(--text-muted); }
.host-btn--sm { padding: 5px 11px; border-radius: 8px; font-size: 12px; }
.host-btn--danger { border-color: #fca5a5; color: #dc2626; }
.host-btn--danger:hover { border-color: #dc2626; color: #dc2626; background: color-mix(in srgb, #dc2626 8%, var(--surface)); }
.host-wl-format { margin: 10px 0 0; font-size: 11.5px; color: var(--text-muted); }

/* ── Phones ─────────────────────────────────────────────── */
@media (max-width: 700px) {
  .host-card, .host-launch { padding: 16px 14px 18px; }
  .host-pick { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* A picture above the card name (js/host-setup.js data-art, e.g. Pattern
   Builder's world strips), drawn in the option's data-color */
.host-pick-art { display: block; margin-bottom: 6px; color: var(--pick-art, var(--purple)); }
.host-pick-art svg { display: block; width: 100%; max-width: 130px; height: auto; }
