/* Training assessment – same look as the training quiz (phones and trainer screen), plus a light print layout for the record. */
:root {
  --bg: #20262e; --panel: #2b323b; --panel2: #353d47; --line: #46505c;
  --fg: #f3f1ec; --muted: #b5bcc5; --accent: #ec7a2e; --accent2: #f59a5b;
  --good: #3fae6a; --bad: #e0574c; --warn: #d99a09;
  --a: #d9463d; --b: #2f6fd6; --c: #d99a09; --d: #2e9555;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 16px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }
.invisible { visibility: hidden; }
.muted { color: var(--muted); }
.sm { font-size: 14px; }
.brand { font-weight: 700; letter-spacing: .02em; color: var(--accent); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.btn { border: 0; border-radius: 12px; padding: 14px 20px; font-size: 18px; font-weight: 600; background: var(--accent); color: #1b1f24; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: var(--panel2); color: var(--fg); border: 1px solid var(--line); }
.err { color: var(--bad); min-height: 1.4em; margin: 6px 0 0; }
.field { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.field label { font-size: 14px; color: var(--muted); }
.field input { font: inherit; font-size: 20px; padding: 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); }
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- player (phone) */
.play { min-height: 100dvh; display: flex; flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.play header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.play header .who { color: var(--muted); font-size: 14px; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.play main { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.play main > section { display: flex; flex-direction: column; gap: 14px; }
.play main > section.card { display: block; }
.play h1 { font-size: 24px; margin: 0 0 6px; text-wrap: balance; }
.play h2.sub { font-size: 18px; margin: 8px 0 0; color: var(--muted); font-weight: 600; }
.steps { padding-left: 20px; margin: 10px 0 18px; display: grid; gap: 8px; }
.qhead { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; }
.progress { height: 6px; border-radius: 3px; background: var(--panel2); margin: 10px 0 12px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.qtext { font-size: 18px; font-weight: 600; }
.qhint { margin-top: 8px; display: inline-block; background: var(--accent); color: #1b1f24; font-weight: 700; font-size: 14px; border-radius: 999px; padding: 2px 12px; }
.choices { display: grid; gap: 12px; grid-template-columns: 1fr; }
.choice { display: flex; align-items: center; gap: 14px; text-align: left; min-height: 60px; padding: 12px 14px;
  border: 0; border-radius: 12px; color: #fff; font-size: 16px; font-weight: 600; opacity: .9; }
.choice .k { flex: 0 0 auto; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 9px; background: rgba(0, 0, 0, .22); font-size: 20px; }
.choice[data-i="0"] { background: var(--a); } .choice[data-i="1"] { background: var(--b); }
.choice[data-i="2"] { background: var(--c); } .choice[data-i="3"] { background: var(--d); }
.choice.sel { opacity: 1; outline: 4px solid #fff; outline-offset: 2px; }
.nav { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
.qnav { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 10px; margin-top: 12px; }
.qn { height: 52px; border-radius: 10px; border: 2px dashed var(--line); background: transparent; color: var(--muted); font-weight: 700; font-size: 18px; }
.qn.done { border: 2px solid var(--accent); background: var(--panel2); color: var(--fg); }
.big { font-size: 40px; font-weight: 800; line-height: 1.1; }
.result.good { border-color: var(--good); } .result.good .big { color: var(--good); }
.result.bad { border-color: var(--warn); } .result.bad .big { color: var(--warn); }
.stat { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.stat b { font-variant-numeric: tabular-nums; }
.list { display: flex; flex-direction: column; gap: 12px; }
.item .picked { margin: 8px 0 0; color: var(--bad); font-weight: 600; }
.explain { margin-top: 10px; background: var(--bg); border-left: 5px solid var(--accent); border-radius: 8px; padding: 10px 14px; }
.opts { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.opts li { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); }
.opts li .k { flex: 0 0 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; background: var(--panel2); font-weight: 700; font-size: 14px; }
.opts li.right { color: var(--fg); font-weight: 600; }
.opts li.right .k { background: var(--good); color: #fff; }
.qimg { display: block; width: 100%; margin-top: 12px; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: #fff; position: relative; cursor: zoom-in; }
.qimg img { display: block; width: 100%; max-height: 34vh; object-fit: contain; }
.qimg span { position: absolute; right: 8px; bottom: 8px; background: rgba(20, 24, 29, .78); color: #fff; font-size: 13px; padding: 3px 9px; border-radius: 999px; }
.lightbox { position: fixed; inset: 0; z-index: 20; background: rgba(12, 14, 17, .96); overflow: auto; display: grid; place-items: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
.lightbox img { max-width: 100%; max-height: calc(100dvh - 24px); background: #fff; border-radius: 8px; cursor: zoom-in; }
.lightbox.zoom { display: block; }
.lightbox.zoom img { width: 260%; max-width: none; max-height: none; cursor: zoom-out; }
.lbclose { position: fixed; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); width: 48px; height: 48px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--panel2); color: var(--fg); font-size: 28px; line-height: 1; }
@media (min-width: 640px) { .play main { max-width: 720px; width: 100%; margin: 0 auto; } .choices { grid-template-columns: 1fr 1fr; } }

/* ---------- trainer screen */
.host { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.host .top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 28px;
  border-bottom: 3px solid var(--accent); background: var(--panel); }
.host .top .title { font-size: 22px; font-weight: 700; min-width: 0; }
.host .top .meta { color: var(--muted); font-size: 18px; white-space: nowrap; }
.host .stage { padding: 24px clamp(16px, 3vw, 48px); display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.host .bar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 28px; background: var(--panel); border-top: 1px solid var(--line); }
.host .btn { font-size: 16px; padding: 10px 16px; }
.host .btn.tiny { font-size: 13px; padding: 5px 9px; border-radius: 8px; }
.host .bar .sp { flex: 1; }
.host kbd { font: 12px ui-monospace, monospace; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.host h2 { font-size: 20px; margin: 0 0 4px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.setup, .prev { max-width: 860px; display: grid; gap: 14px; }
.setup .opt, .prev .opt { display: flex; gap: 16px; align-items: center; justify-content: space-between; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px 20px; font-size: 20px; }
.setup .opt .muted, .prev .opt .muted { font-size: 15px; }
.setup .chk { justify-content: flex-start; font-size: 17px; cursor: pointer; }
.setup .chk input { width: 22px; height: 22px; accent-color: var(--accent); }
.closedbox { display: grid; gap: 6px; }
.livetop { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.qrbox { background: #fff; border-radius: 16px; padding: 16px; display: grid; place-items: center; border: 0; }
.qrbox svg { width: 100%; height: auto; max-height: 62vh; }
.qrbox.small { width: 180px; cursor: zoom-in; padding: 12px; }
.liveinfo { display: grid; gap: 10px; min-width: 0; }
.joinurl { font-size: clamp(20px, 2.2vw, 32px); font-weight: 700; color: var(--accent2); overflow-wrap: anywhere; }
.nums { display: flex; gap: 14px; flex-wrap: wrap; }
.nums .num { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 16px; display: flex; gap: 8px; align-items: baseline; }
.nums b { font-size: 28px; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.ptable { width: 100%; border-collapse: collapse; font-size: 16px; }
.ptable th, .ptable td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ptable th { background: var(--panel); color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; }
.ptable tr:last-child td { border-bottom: 0; }
.ptable td.nm { font-weight: 600; }
.ptable td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ptable td.acts { white-space: nowrap; text-align: right; }
.ptable td.acts .btn + .btn { margin-left: 6px; }
.pill { display: inline-block; border-radius: 999px; padding: 3px 12px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--good); color: #fff; }
.pill.busy { background: var(--panel2); color: var(--fg); border: 1px solid var(--line); }
.pill.idle { color: var(--muted); border: 1px dashed var(--line); }
.pill.warn { background: var(--warn); color: #1b1f24; }
.mini { display: inline-block; vertical-align: middle; margin-left: 10px; width: 80px; height: 6px; border-radius: 3px; background: var(--panel2); overflow: hidden; }
.mini span { display: block; height: 100%; background: var(--accent); }
.qstats { display: grid; gap: 8px; max-width: 1100px; }
.qs { display: grid; grid-template-columns: 44px minmax(0, 1fr) 160px 56px; gap: 12px; align-items: center; font-size: 15px; }
.qs .qno { color: var(--muted); font-weight: 700; }
.qs .qq { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs .track { height: 10px; border-radius: 5px; background: var(--panel2); overflow: hidden; }
.qs .track span { display: block; height: 100%; background: var(--good); }
.qs.low .track span { background: var(--warn); }
.qs.low .qq { color: var(--accent2); }
.qs .pc { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.qrfull { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: grid; place-items: center; padding: 40px; cursor: zoom-out; }
.qrfull .lobby { display: grid; grid-template-columns: minmax(280px, 44%) 1fr; gap: 48px; align-items: center; width: min(1400px, 100%); }
.qrfull .hq { font-size: clamp(30px, 3.6vw, 56px); font-weight: 700; line-height: 1.2; text-wrap: balance; }
.toast { position: fixed; right: 20px; bottom: 78px; background: var(--bad); color: #fff; padding: 10px 14px; border-radius: 8px; font-size: 16px; z-index: 40; }
.login { max-width: 460px; margin: 12vh auto; }
.print { display: none; }
@media (max-width: 900px) { .qrfull .lobby { grid-template-columns: 1fr; } .qs { grid-template-columns: 36px minmax(0, 1fr) 90px 48px; } }

/* ---------- printed assessment record (light, A4) */
@media print {
  @page { size: A4; margin: 16mm 14mm; }
  body { background: #fff; color: #000; font-size: 11pt; }
  body > *:not(.print) { display: none !important; }
  .print { display: block; width: 100%; }
  .print * { box-sizing: border-box; }
  .print h1 { font-size: 18pt; margin: 0 0 8pt; }
  .print table { border-collapse: collapse; width: 100%; }
  .print .meta { width: auto; margin-bottom: 8pt; }
  .print .meta th { text-align: left; padding: 2pt 14pt 2pt 0; font-weight: 600; }
  .print .meta td { padding: 2pt 0; }
  .print .note { font-size: 9.5pt; color: #333; margin: 6pt 0 10pt; }
  .print .rec { table-layout: fixed; }
  .print .rec th, .print .rec td { border: 0.6pt solid #888; padding: 4pt 6pt; text-align: left; overflow-wrap: anywhere; }
  .print .rec th:first-child { width: 7%; }
  .print .rec th { background: #eee; }
  .print .rec tr { break-inside: avoid; }
  .print .sign { display: grid; grid-template-columns: 2fr 2fr 1fr; gap: 18pt; margin-top: 28pt; }
  .print .sign div { border-top: 0.8pt solid #000; padding-top: 3pt; font-size: 9.5pt; }
}
