/* ==========================================================================
   app.css — «Живое занятие в колледже» (Кэрин / KerinClass)
   Все цвета и шрифты — из tokens.css. Системные шрифты, ноль внешних CDN.
   Экраны: student (index.html), tv (tv.html), host (host.html), demo (demo.html).
   ========================================================================== */

/* ---------- 1. Сброс ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

::selection { background: var(--accent); color: var(--accent-text); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 2. Утилиты ---------- */
.mono  { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.dim   { color: var(--soft); }
.mute  { color: var(--mute-text); }
.mini  { font-size: 14px; }
.nowrap { white-space: nowrap; }
.hide  { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.grow  { flex: 1 1 auto; min-width: 0; }
.row   { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap  { flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.center { text-align: center; }

.s-gap-top-xs { margin-top: 6px; }
.s-gap-top-sm { margin-top: 10px; }
.s-gap-top { margin-top: 14px; }
.s-gap-top-lg { margin-top: 24px; }
.s-gap-bot { margin-bottom: 12px; }

/* ---------- 3. Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--raise);
  color: var(--text);
  font-size: 16px;
  font-weight: 650;
  text-align: center;
  transition: background .12s ease, border-color .12s ease, transform .06s ease;
  -webkit-user-select: none;
  user-select: none;
}
.btn:hover:not(:disabled) { background: var(--sel); text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.btn--primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }

.btn--go {
  background: var(--success);
  border-color: var(--success);
  color: var(--accent-text);
}
.btn--go:hover:not(:disabled) { background: var(--success); filter: brightness(1.08); }

.btn--cut {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger-text);
}
.btn--cut:hover:not(:disabled) { background: var(--danger-bg); }

.btn--ghost { background: transparent; }
.btn--ghost:hover:not(:disabled) { background: var(--raise); }

.btn--xs { min-height: 32px; padding: 4px 10px; font-size: 12.5px; border-radius: 8px; }
.btn--sm { min-height: 40px; padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn--lg { min-height: 60px; font-size: 19px; border-radius: 16px; }
.btn--xl {
  min-height: 74px;
  font-size: 22px;
  letter-spacing: .04em;
  border-radius: 18px;
}
.btn--block { display: flex; width: 100%; }

.btn:disabled {
  opacity: .48;
  cursor: not-allowed;
  transform: none;
}

.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border: 3px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: var(--text);
  animation: spin .7s linear infinite;
}
.btn--primary.is-busy::after { color: var(--accent-text); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 4. Поля ---------- */
.label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--mute-text);
}

.inp, .area, .sel {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  color: var(--text);
  background: var(--sunken);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  font-size: 16px;
}
.inp::placeholder, .area::placeholder { color: var(--mute-text); }
.inp:focus, .area:focus, .sel:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 26%, transparent);
}

.area {
  min-height: 116px;
  resize: vertical;
  line-height: 1.45;
}
.area--sm { min-height: 74px; font-size: 15px; }

.sel {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 38px;
  background-image: linear-gradient(45deg, transparent 50%, var(--soft) 50%),
                    linear-gradient(135deg, var(--soft) 50%, transparent 50%);
  background-position: calc(100% - 20px) 19px, calc(100% - 13px) 19px;
  background-size: 7px 7px, 7px 7px;
  background-repeat: no-repeat;
}
.sel option { background: var(--panel); color: var(--text); }

/* ---------- 5. Карточки, чипы, плашки ---------- */
.card {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
}

.panel {
  padding: 14px 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
}
.panel-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-2);
}
.panel-h h2 {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--soft);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--sel);
  color: var(--soft);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}
button.chip { cursor: pointer; }
button.chip:hover { filter: brightness(1.08); }
.chip--ok   { background: var(--success-bg); color: var(--success-text); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.chip--warn { background: var(--warning-bg); color: var(--warning-text); border-color: color-mix(in srgb, var(--warning) 40%, transparent); }
.chip--bad  { background: var(--danger-bg); color: var(--danger-text); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 15px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 600;
  background: var(--warning-bg);
  border: 1px solid var(--warning);
  color: var(--warning-text);
}
.notice--bad {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger-text);
}
.notice--ok {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success-text);
}

/* Полоса связи сверху */
.netbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 90;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent-text);
  background: var(--warning);
  transform: translateY(-100%);
  transition: transform .25s ease;
}
.netbar.on { transform: translateY(0); }
.netbar.ok { background: var(--success); color: var(--accent-text); }

/* Тосты */
.toasts {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 460px);
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  padding: 13px 16px;
  border-radius: var(--r-md);
  background: var(--bg);
  background-image: linear-gradient(var(--sel), var(--sel));
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-float);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  animation: toast-in .18s ease;
}
.toast--ok  { background: var(--bg); background-image: linear-gradient(var(--success-bg), var(--success-bg)); border-color: var(--success); color: var(--success-text); }
.toast--err { background: var(--bg); background-image: linear-gradient(var(--danger-bg), var(--danger-bg)); border-color: var(--danger); color: var(--danger-text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.empty {
  padding: 18px 6px;
  color: var(--mute-text);
  font-size: 15px;
  text-align: center;
}

/* ---------- 6. Модальные окна (Host & Student) ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal.hide { display: none; }
.modal-scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(4px);
}
.modal-card {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px 22px;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-float);
}
.modal-card--lg { width: min(720px, 100%); }
.modal-title { font-size: 19px; font-weight: 800; line-height: 1.25; }
.modal-text { margin-top: 10px; font-size: 15px; color: var(--soft); line-height: 1.45; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.modal-sep { margin: 16px 0; height: 1px; background: var(--line-2); }

/* ==========================================================================
   ЭКРАН 1 — СТУДЕНТ (телефон 390px)
   ========================================================================== */
.s-body {
  padding: 26px 14px 44px;
  max-width: 520px;
  margin: 0 auto;
}

.s-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}
.s-head .eyebrow {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--soft);
}
.s-title {
  font-size: 27px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.01em;
}
.s-sub {
  margin-top: 8px;
  font-size: 15px;
  color: var(--soft);
}

/* Шаг 1 — курс + быстрый поиск */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 96px;
  padding: 12px 8px;
  border: 2px solid var(--line-2);
  border-radius: var(--r-lg);
  background: var(--panel);
  font-size: 15px;
  font-weight: 700;
  color: var(--soft);
}
.tile b {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}
.tile:hover { border-color: var(--sel); }
.tile[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--text);
}

.s-quick-search { margin: 14px 0 8px; }

/* Шаг 2 — список фамилий */
.search-wrap { position: relative; margin: 14px 0 10px; }
.search-wrap .inp { padding-left: 44px; min-height: 54px; font-size: 17px; }
.search-wrap::before {
  content: "⌕";
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-54%);
  font-size: 22px;
  color: var(--soft);
  pointer-events: none;
}
.sortline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--soft);
}

.name-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 12px 14px;
  text-align: left;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--panel);
  font-size: 17px;
  font-weight: 650;
}
.name-row .nm { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.name-row .cs { flex: 0 0 auto; font-size: 13px; color: var(--soft); }
.name-row:hover:not(:disabled) { border-color: var(--accent); background: var(--raise); }
.name-row:disabled,
.name-row.is-taken {
  opacity: .5;
  cursor: not-allowed;
  border-style: dashed;
}
.name-row.is-taken .nm { text-decoration: line-through; }

/* Карточка участника */
.member-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.member-name {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.2;
  min-width: 0;
}
.member-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.member-course {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--sel);
  font-size: 13px;
  font-weight: 700;
  color: var(--soft);
  white-space: nowrap;
}

/* Плашка команды */
.banner {
  position: relative;
  padding: 20px 18px 18px;
  border-radius: var(--r-lg);
  background: var(--c, var(--accent));
  color: var(--on-team);
  box-shadow: var(--shadow-float);
  overflow: hidden;
}
.banner::after {
  content: "";
  position: absolute;
  inset: auto -30px -60px auto;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--on-team) 12%, transparent);
}
.banner .b-kicker {
  position: relative;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: .75;
}
.banner .b-main {
  position: relative;
  margin-top: 6px;
  font-size: 25px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -.015em;
  text-transform: uppercase;
}
.banner .b-seat {
  position: relative;
  margin-top: 7px;
  font-size: 16px;
  font-weight: 700;
  opacity: .84;
}

.role-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 13px 16px;
  border-radius: var(--r-md);
  background: var(--raise);
  border: 1px solid var(--line-2);
  font-size: 17px;
  font-weight: 700;
}
.role-line-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.role-line .r-role {
  color: var(--warning-text);
  font-weight: 900;
  letter-spacing: .04em;
}
#xferOpen {
  min-height: 30px;
  padding: 3px 10px;
  font-size: 12.5px;
  border-radius: 8px;
  width: auto;
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Объявления и объяснения на телефоне */
.announce-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--panel);
  border: 1px solid var(--accent-line);
}
.announce-box h3 {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent-strong);
}
.announce-list { display: flex; flex-direction: column; gap: 8px; }
.ann-card {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--raise);
  border: 1px solid var(--line-2);
}
.ann-card.is-pinned { border-color: var(--accent-line); }
.ann-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.ann-kind {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent-strong);
}
.ann-tgt {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent-strong);
}
.ann-time { margin-left: auto; font-size: 11px; color: var(--mute-text); }
.ann-title { font-size: 15px; font-weight: 800; margin-bottom: 2px; }
.ann-body { font-size: 14.5px; color: var(--soft); line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.ann-link { margin-top: 8px; }

.round-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--raise);
  border: 1px solid var(--line-2);
}
.round-line .r-num {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--mute-text);
}
.round-line .r-name { font-size: 16px; font-weight: 800; text-align: right; min-width: 0; }

/* Состав команды (без обрезания по высоте) */
.mates {
  margin-top: 14px;
  border-radius: var(--r-md);
  background: var(--panel);
  border: 1px solid var(--line-2);
  overflow: hidden;
}
.mates h3 {
  padding: 11px 14px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--soft);
  border-bottom: 1px solid var(--line-2);
}
.mate {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 15px;
  border-bottom: 1px solid var(--line-2);
}
.mate:last-child { border-bottom: 0; }
.mate .m-nm { flex: 1 1 auto; min-width: 0; }
.mate .m-cs { font-size: 13px; color: var(--soft); flex: 0 0 auto; }
.mate .m-role {
  flex: 0 0 auto;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--warning-text);
}
.mate.me { background: var(--accent-bg); font-weight: 800; }
.mate.me .m-nm::after {
  content: " · это ты";
  font-weight: 800;
  color: var(--accent-strong);
}

/* Задание и таймер */
.task-box {
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--r-md);
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-left: 5px solid var(--c, var(--accent));
}
.task-box h3 {
  margin-bottom: 8px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--soft);
}
.task-box .t-text { font-size: 17.5px; font-weight: 600; line-height: 1.45; white-space: pre-wrap; }
.task-box .t-wait { font-size: 17px; font-weight: 700; color: var(--soft); }

.timer-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--raise);
  border: 1px solid var(--line-2);
}
.timer {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
}
.timer.warn { color: var(--danger-text); }
.timer.paused { color: var(--soft); }
.timer-cap {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--soft);
  text-align: right;
}

.timer-bar {
  height: 9px;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--sel);
  overflow: hidden;
}
.timer-bar i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: var(--success);
  transition: width .5s linear;
}
.timer-bar.low i { background: linear-gradient(90deg, var(--danger), var(--warning)); }

.sent-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  background: var(--panel);
  border: 1px solid var(--line-2);
  font-size: 15px;
  font-weight: 700;
  color: var(--soft);
}
.sent-line b { color: var(--text); font-size: 16px; }

.todo { display: none; }

/* Вход на занятие (Discord, код входа, регистрация) */
.s-entry-card {
  margin-bottom: 14px;
  padding: 14px;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1px solid var(--line-2);
}
.btn--discord {
  background: #5865f2;
  border-color: #5865f2;
  color: #ffffff;
}
.btn--discord:hover:not(:disabled) {
  background: #4752c4;
  border-color: #4752c4;
}
.inp--code {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .16em;
  text-align: center;
  text-transform: uppercase;
}
.chip--discord {
  background: rgba(88, 101, 242, 0.16);
  color: #8ea1ff;
  border-color: rgba(88, 101, 242, 0.35);
}
[data-theme='light'] .chip--discord {
  color: #4752c4;
}
.btn--discord .chip--discord,
[data-theme='light'] .btn--discord .chip--discord {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}
.name-row.is-discord-bound .nm { text-decoration: none; }

/* Карточка роли и ответа */
.role-card {
  margin-top: 12px;
  padding: 13px 16px;
  border-radius: var(--r-md);
  background: var(--raise);
  border: 1px solid var(--line-2);
}
.role-card .role-line {
  margin-top: 0;
  padding: 0;
  background: transparent;
  border: 0;
}
.role-desc {
  margin-top: 6px;
  font-size: 14.5px;
  color: var(--soft);
  line-height: 1.4;
}
.role-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.round-card { margin-top: 12px; }
.answer-card {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1px solid var(--line-2);
}

/* Ответ */
.answer { margin-top: 12px; }
.answer .area { min-height: 150px; font-size: 17px; }
.counter {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--mute-text);
}
.counter .c-num { font-family: var(--font-mono); }
.send-status { margin-top: 8px; font-size: 14px; font-weight: 700; }
.sent-note { margin-top: 8px; font-size: 14.5px; font-weight: 700; color: var(--success-text); }

/* Просмотр ответа без права отправки */
.waiting-box {
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--r-md);
  background: var(--panel);
  border: 1px dashed var(--line-2);
  text-align: center;
}
.waiting-box .w-big { font-size: 18px; font-weight: 800; color: var(--warning-text); }
.waiting-box .w-small { margin-top: 5px; font-size: 14.5px; color: var(--soft); }

.team-answer-box {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--panel);
  border: 1px solid var(--success);
}
.team-answer-box h4 {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--success-text);
  margin-bottom: 6px;
}
.team-answer-box .ta-text {
  font-size: 15px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Передача роли */
.s-xfer-box {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-2);
}
.s-xfer-hint { margin-top: 0; line-height: 1.35; }
.xfer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.xfer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  text-align: left;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--sunken);
  font-size: 16px;
}
.xfer-row:hover:not(:disabled) { border-color: var(--accent); background: var(--raise); }
.xfer-row .xfer-nm { flex: 1 1 auto; min-width: 0; }
.xfer-row .xfer-role { font-size: 12px; font-weight: 700; color: var(--mute-text); text-transform: uppercase; }
.xfer-row .go { color: var(--accent-strong); font-weight: 800; }

.past { margin-top: 16px; }
.past h3 { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--mute-text); }
.past .past-row {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  font-size: 13.5px;
  color: var(--soft);
  line-height: 1.4;
}
.past .past-row b { color: var(--text); }
.past .past-ans {
  margin-top: 6px;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ==========================================================================
   ЭКРАН 2 — ОБЩИЙ ТЕЛЕВИЗОР (1920×1080 и 1280×720, читаемость с 10 м)
   ========================================================================== */
body.tv-body {
  height: 100vh;
  overflow: hidden;
  cursor: none;
  background:
    radial-gradient(1200px 620px at 50% -10%, var(--raise) 0%, transparent 70%),
    var(--bg);
  font-size: 1rem;
  -webkit-user-select: none;
  user-select: none;
}

.tv-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.tv-announce-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: .75rem 2.2rem;
  background: var(--panel);
  border-bottom: .18rem solid var(--accent);
}
.tv-ann-kind {
  flex: 0 0 auto;
  padding: .28rem .75rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: .95rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.tv-ann-content {
  display: flex;
  align-items: baseline;
  gap: .8rem;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.tv-ann-title { font-size: 1.35rem; font-weight: 900; color: var(--text); flex: 0 0 auto; }
.tv-ann-body { font-size: 1.3rem; font-weight: 600; color: var(--soft); overflow: hidden; text-overflow: ellipsis; }

.tv-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 1.4rem 2.2rem 1.6rem;
  gap: 1rem;
}

.tv-kicker {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--soft);
}
.tv-h1 {
  font-size: 3.1rem;
  font-weight: 900;
  line-height: 1.04;
  letter-spacing: -.015em;
}

/* --- лобби: 2 колонки, помещаются все 62-80 человек --- */
.tv-lobby-cols {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(21rem, 29rem) minmax(0, 1fr);
  gap: 2rem;
  align-items: stretch;
}
.tv-lobby-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.35rem;
  padding: 1.2rem 1.4rem;
  border-radius: 1.2rem;
  background: var(--panel);
  border: .1rem solid var(--line-2);
}
.tv-lobby-right {
  min-width: 0;
  min-height: 0;
  display: flex;
}

.tv-qr-row {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}
.tv-qr {
  background: #fff;
  padding: .65rem;
  border-radius: 1rem;
  width: clamp(9.5rem, 13.5rem, 15rem);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .38);
  flex: none;
  line-height: 0;
}
.tv-qr img, .tv-qr svg { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; image-rendering: pixelated; }
.tv-qr-side { display: flex; flex-direction: column; gap: .45rem; }
.tv-qr-hint { font-size: 1.25rem; color: var(--soft); font-weight: 700; line-height: 1.25; }
.tv-qr-hint--sm { font-size: 1rem; color: var(--mute-text); font-weight: 600; }

.tv-link-row {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.tv-link {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  padding: .45rem 1rem;
  border-radius: .85rem;
  background: var(--raise);
  border: .14rem solid var(--accent);
  font-size: 1.85rem;
  font-weight: 900;
  color: var(--text);
  overflow-wrap: anywhere;
}
.tv-counter {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .55rem;
  font-family: var(--font-mono);
  font-size: 4.8rem;
  font-weight: 900;
  line-height: .95;
  color: var(--text);
}
.tv-counter .cnt-sub {
  font-family: var(--font-sans);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--soft);
}
.tv-counter .cnt-cap {
  flex-basis: 100%;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--mute-text);
}

.tv-teams {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(var(--tv-cols, 4), minmax(0, 1fr));
  grid-template-rows: repeat(var(--tv-rows, 2), minmax(0, 1fr));
  gap: .75rem;
  min-height: 0;
}
.tv-teams.is-arena {
  display: flex;
  flex-direction: column;
}
.tv-bounce-arena {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 1.2rem;
  background: var(--panel);
  border: .1rem solid var(--line-2);
  overflow: hidden;
}
.tv-bounce-head {
  flex: 0 0 auto;
  padding: .95rem 1.4rem;
  border-bottom: .1rem solid var(--line-2);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--soft);
}
.tv-bounce-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.tv-bounce-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--mute-text);
  text-align: center;
}
.tv-bounce-pill {
  position: absolute;
  top: 0;
  left: 0;
  padding: .55rem 1.05rem;
  border-radius: 999px;
  background: var(--raise);
  border: .12rem solid var(--c, var(--accent));
  border-left-width: .45rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .24);
  will-change: transform;
}
.tv-team {
  display: flex;
  flex-direction: column;
  padding: .7rem .85rem .65rem;
  border-radius: .9rem;
  background: var(--panel);
  border: .1rem solid var(--line-2);
  border-top: .45rem solid var(--c, var(--accent));
  min-height: 0;
  overflow: hidden;
}
.tv-team .tm-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .45rem;
  margin-bottom: .45rem;
  flex: 0 0 auto;
}
.tv-team .tm-name { font-size: 1.35rem; font-weight: 900; color: var(--c, var(--accent-strong)); line-height: 1.1; }
.tv-team .tm-seat { font-size: .95rem; font-weight: 800; color: var(--soft); white-space: nowrap; }
.tv-team .tm-list {
  display: flex;
  flex-direction: column;
  gap: .22rem;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--soft);
  min-height: 0;
}
.tv-team.is-dense .tm-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .24rem .6rem;
  align-content: start;
  font-size: .94rem;
}
.tv-team .tm-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .35rem;
  min-width: 0;
}
.tv-team .tm-item.is-unclaimed { opacity: .62; }
.tv-team .tm-item.is-claimed { color: var(--text); font-weight: 700; }
.tv-team .tm-item.is-claimed .tm-stu-nm::before {
  content: '';
  display: inline-block;
  width: .46rem;
  height: .46rem;
  margin-right: .4rem;
  border-radius: 50%;
  background: var(--success);
  vertical-align: middle;
}
.tv-team .tm-stu-nm {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.tv-team .tm-list .cs {
  flex: 0 0 auto;
  font-size: .76rem;
  color: var(--mute-text);
}

/* --- раунд --- */
.tv-round { gap: .9rem; }
.tv-topbar {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex: 0 0 auto;
}
.tv-timer {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11.5rem;
  font-weight: 900;
  line-height: .92;
  letter-spacing: -.02em;
  flex: 0 0 auto;
}
.tv-timer--sm { font-size: 4.2rem; }
.tv-timer.warn {
  color: var(--danger-text);
  text-shadow: 0 0 3rem color-mix(in srgb, var(--danger) 45%, transparent);
}
.tv-timer.paused { color: var(--soft); }
.tv-round-label {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding-left: 2rem;
  border-left: .3rem solid var(--line-2);
  min-width: 0;
}
.tv-round-label .rl-main { font-size: 2.35rem; font-weight: 900; line-height: 1.1; }
.tv-round-label .rl-task {
  margin-top: .2rem;
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--soft);
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tv-grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(var(--tv-cols, 4), minmax(0, 1fr));
  grid-template-rows: repeat(var(--tv-rows, 2), minmax(0, 1fr));
  gap: .8rem;
  min-height: 0;
}
.tv-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: .9rem 1.1rem;
  border-radius: .9rem;
  background: var(--panel);
  border: .12rem solid var(--line-2);
  border-left: .7rem solid var(--c, var(--accent));
  transition: background .3s ease, box-shadow .3s ease;
  min-height: 0;
  overflow: hidden;
}
.tv-card.is-compact { padding: .6rem .9rem; }
.tv-card.is-compact .tc-name { font-size: 1.65rem; }
.tv-card.is-done {
  background: var(--success-bg);
  border-color: var(--success);
  box-shadow: inset 0 0 0 .12rem var(--success);
}
.tv-card .tc-top { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; }
.tv-card .tc-name { font-size: 2rem; font-weight: 900; color: var(--c, var(--accent-strong)); line-height: 1.05; }
.tv-card .tc-seat { font-size: 1.1rem; font-weight: 800; color: var(--soft); white-space: nowrap; }
.tv-card .tc-people { font-size: 1.35rem; font-weight: 700; color: var(--soft); }
.tv-card .tc-status { font-size: 1.25rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; color: var(--soft); }
.tv-card .tc-status.done { color: var(--success-text); }

.tv-progress {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 1.4rem;
  padding: .4rem 0 0;
}
.tv-progress .pg-text { font-size: 1.55rem; font-weight: 800; color: var(--soft); white-space: nowrap; }
.tv-bar { flex: 1 1 auto; height: 1.1rem; border-radius: 999px; background: var(--sel); overflow: hidden; }
.tv-bar i { display: block; width: 0%; height: 100%; border-radius: 999px; background: var(--success); transition: width .4s ease; }

/* --- результаты --- */
.tv-results { gap: 1rem; }
.tv-results-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
}
.tv-results-title { min-width: 0; }
.tv-res-task {
  margin-top: .35rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--mute-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tv-spotlight {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}
.tv-answer.is-spotlight {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.2rem 2.6rem;
  border-left-width: 1rem;
}
.tv-answer.is-spotlight .a-team { font-size: 2.6rem; }
.tv-answer.is-spotlight .a-who { font-size: 1.35rem; }
.tv-answer.is-spotlight .a-text { font-size: 2.35rem; line-height: 1.38; margin-top: 1rem; }

.tv-answers {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: max-content;
  gap: .9rem;
  align-content: start;
  min-height: 0;
  overflow: hidden;
}
.tv-answer {
  padding: .85rem 1.15rem 1rem;
  border-radius: .9rem;
  background: var(--panel);
  border: .1rem solid var(--line-2);
  border-left: .6rem solid var(--c, var(--accent));
}
.tv-answers .tv-answer {
  min-height: auto;
  overflow: visible;
}
.tv-answer .a-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .8rem;
  margin-bottom: .35rem;
}
.tv-answer .a-team { font-size: 1.5rem; font-weight: 900; color: var(--c, var(--accent-strong)); }
.tv-answer .a-who { font-size: 1rem; font-weight: 700; color: var(--soft); text-align: right; }
.tv-answer .a-text { font-size: 1.35rem; font-weight: 600; line-height: 1.32; color: var(--text); white-space: pre-wrap; word-break: break-word; }

.tv-pager {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--soft);
}
.tv-dot {
  width: .85rem;
  height: .85rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--line-strong);
  cursor: pointer;
}
.tv-dot.on { background: var(--accent); transform: scale(1.2); }

/* --- крупное объяснение на ТВ --- */
.tv-explain { justify-content: center; gap: 1.4rem; }
.tv-exp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
}
.tv-exp-badge {
  padding: .45rem 1.2rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: .12em;
}
.tv-exp-target {
  padding: .4rem 1rem;
  border-radius: 999px;
  background: var(--raise);
  border: .1rem solid var(--line-2);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--soft);
}
.tv-exp-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.6rem 3rem;
  border-radius: 1.4rem;
  background: var(--panel);
  border: .12rem solid var(--line-2);
  border-left: .9rem solid var(--accent);
}
.tv-exp-title { font-size: 3.4rem; font-weight: 900; line-height: 1.12; color: var(--text); }
.tv-exp-body {
  margin-top: 1.2rem;
  font-size: 2.15rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.tv-exp-url {
  margin-top: 1.8rem;
  display: flex;
  align-items: center;
  gap: 1.4rem;
  padding: 1rem 1.3rem;
  border-radius: 1rem;
  background: var(--raise);
  border: .1rem solid var(--line-2);
}
.tv-exp-qr { background: #fff; padding: .5rem; border-radius: .7rem; width: 7.5rem; flex: none; line-height: 0; }
.tv-exp-url-text { margin-top: .3rem; font-size: 1.45rem; font-weight: 800; color: var(--accent-strong); overflow-wrap: anywhere; }

.tv-empty { font-size: 2rem; font-weight: 700; color: var(--soft); }
.tv-offline {
  position: fixed;
  left: 0; right: 0; top: 0;
  z-index: 90;
  padding: .5rem 1rem;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent-text);
  background: var(--warning);
  transform: translateY(-110%);
  transition: transform .25s ease;
}
.tv-offline.on { transform: translateY(0); }

.tv-toasts {
  position: fixed;
  right: 2rem;
  bottom: 2rem;
  z-index: 92;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  max-width: 34rem;
}
.tv-toast {
  padding: 1rem 1.4rem;
  border-radius: 1rem;
  background: var(--panel);
  border: .14rem solid var(--accent);
  box-shadow: var(--shadow-float);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
}
.tv-toast.is-warn { border-color: var(--warning); color: var(--warning-text); }

/* ==========================================================================
   ЭКРАН 3 — ПАНЕЛЬ ВЕДУЩЕЙ (host.html)
   ========================================================================== */
body.host-body { background: var(--sunken); font-size: 15px; overflow-x: clip; }

.h-app {
  width: 100%;
  max-width: 1440px;
  min-width: 0;
  margin: 0 auto;
  padding: 12px 16px 32px;
}
.h-app.hide { display: none; }

/* Вход по PIN */
.pin-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.pin-card {
  width: min(440px, 100%);
  padding: 26px 24px 28px;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-float);
}
.pin-card h1 { font-size: 24px; font-weight: 800; }
.pin-card p { margin-top: 8px; font-size: 15px; color: var(--soft); }
.pin-card .inp {
  margin: 14px 0 12px;
  min-height: 54px;
  font-size: 26px;
  letter-spacing: .35em;
  text-align: center;
  font-family: var(--font-mono);
}

/* Шапка */
.h-head {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
  padding: 10px 0 12px;
  background: linear-gradient(var(--sunken) 82%, transparent);
  border-bottom: 1px solid var(--line-2);
}
.h-brand { display: flex; flex-direction: column; gap: 1px; margin-right: 4px; min-width: 0; }
.h-brand b { font-size: 17px; font-weight: 800; white-space: nowrap; }
.h-brand span { font-size: 12px; color: var(--mute-text); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }

.h-tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  flex-shrink: 0;
}
.h-tabs button {
  min-height: 38px;
  padding: 6px 18px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--soft);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}
.h-tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-text); }
.h-tabs button:not([aria-selected="true"]):hover { background: var(--raise); color: var(--text); }

.h-head-actions { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; align-items: center; min-width: 0; max-width: 100%; }
.h-head-actions .btn { white-space: nowrap; flex-shrink: 0; }
.dot-ind {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--mute-text);
  display: inline-block;
}
.dot-ind.is-live { background: var(--success); box-shadow: 0 0 8px var(--success); }

/* Переключатель оформления */
.h-theme { position: relative; display: flex; align-items: center; }
.h-theme-btn { gap: 6px; }
.h-theme-btn .ico { font-size: 15px; line-height: 1; color: var(--accent-strong); }

.theme-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: min(344px, 92vw);
  padding: 12px;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-float);
}
.theme-pop.hide { display: none; }
.tp-head { margin-bottom: 8px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.tp-themes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.tp-card {
  display: flex; flex-direction: column; gap: 4px; padding: 5px;
  border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--raise); color: var(--soft); font-size: 10.5px; font-weight: 700; line-height: 1.2;
}
.tp-card:hover { border-color: var(--accent-line); color: var(--text); }
.tp-card[aria-pressed="true"] {
  border-color: var(--accent); background: var(--accent-bg); color: var(--text);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.tp-sw { position: relative; display: block; height: 34px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line-2); }
.tp-sw-a { position: absolute; inset: 0; display: block; }
.tp-sw-b { position: absolute; left: 5px; right: 5px; top: 12px; bottom: 5px; display: block; border-radius: 3px; }
.tp-sw-c { position: absolute; right: 5px; top: 4px; width: 7px; height: 7px; display: block; border-radius: 50%; }
.tp-lab { display: block; text-align: center; }
.tp-sec { margin: 11px 0 6px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.tp-accents { display: flex; gap: 8px; }
.tp-acc {
  width: 31px; height: 31px; padding: 3px; display: grid; place-items: center;
  border: 1px solid var(--line-2); border-radius: 50%; background: transparent;
}
.tp-acc-dot { width: 100%; height: 100%; display: block; border-radius: 50%; }
.tp-acc[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.tp-dens { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--sunken); border: 1px solid var(--line-2); }
.tp-den { flex: 1 1 0; min-height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--soft); font-size: 12px; font-weight: 700; }
.tp-den[aria-pressed="true"] { background: var(--sel); color: var(--text); }

/* Шаги «Подготовки» */
.tabpane { margin-top: 12px; }
.tabpane.hide { display: none; }

.steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 980px;
  margin: 0 auto;
}
.step {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  padding: 18px 20px 20px;
}
.step-h { display: flex; align-items: center; gap: 12px; }
.step-n {
  flex: none;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: var(--r-pill);
  background: var(--accent-bg);
  color: var(--accent-strong);
  border: 1px solid var(--accent-line);
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 900;
}
.step-t { font-size: 21px; font-weight: 900; letter-spacing: -.01em; color: var(--text); }
.step-b { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }

#tabPrepare .step .attend { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
#tabPrepare .step .attend .a-num {
  font-family: var(--font-mono);
  font-size: 60px; font-weight: 900; line-height: .9; letter-spacing: -.03em; color: var(--text);
}
#tabPrepare .step .attend .a-cap { font-size: 15px; font-weight: 600; color: var(--soft); }
.course-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.course-pill {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--raise);
  border: 1px solid var(--line-2);
  font-size: 13px;
  color: var(--soft);
}
.course-pill b { color: var(--text); }

.step-act { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.step-act .btn--lg { min-height: 54px; font-size: 17px; padding: 0 24px; }

.inline-box {
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--raise);
  border: 1px solid var(--line-2);
}
.inline-sel-sm { width: 105px; flex: 0 0 auto; }
.inline-sel-md { width: 175px; flex: 0 0 auto; }
.notes-fix-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; max-height: 280px; overflow-y: auto; }
.nf-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nf-name { flex: 1 1 200px; min-height: 38px; padding: 6px 10px; font-size: 14px; }
.nf-course { width: 78px; min-height: 38px; padding: 6px 8px; font-size: 14px; }
.nf-note { min-width: 90px; }

.file-btn { cursor: pointer; }
.csv-box { margin-top: 6px; }
.csv-box .area { min-height: 110px; font-family: var(--font-mono); font-size: 13px; }

.link-btn {
  appearance: none; background: none; border: 0; padding: 2px 0;
  font: inherit; font-size: 14px; color: var(--mute-text);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; border-radius: var(--r-sm);
}
.link-btn:hover { color: var(--text); }

.more,
.adv-box { border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--raise); }
.more > summary,
.adv-box > summary,
.foot-more > summary {
  cursor: pointer; padding: 10px 14px; font-size: 14px; font-weight: 700;
  color: var(--mute-text); list-style: none; border-radius: var(--r-md); user-select: none;
}
.more > summary::-webkit-details-marker,
.adv-box > summary::-webkit-details-marker,
.foot-more > summary::-webkit-details-marker { display: none; }
.more > summary::before,
.adv-box > summary::before,
.foot-more > summary::before { content: '▸'; display: inline-block; width: 16px; color: var(--mute-text); }
.more[open] > summary::before,
.adv-box[open] > summary::before,
.foot-more[open] > summary::before { content: '▾'; }
.more > summary:hover,
.adv-box > summary:hover,
.foot-more > summary:hover { color: var(--text); }
.more-b { display: flex; flex-direction: column; gap: 12px; padding: 4px 14px 14px; }

.prep-teams-wrap {
  padding-top: 8px;
  border-top: 1px solid var(--line-2);
}

/* Конструктор ролей и перетасовка */
.prep-roles-summary { margin-top: 2px; }
.reshuffle-body { display: flex; flex-direction: column; gap: 12px; }
.reshuffle-hint { margin-top: 6px; line-height: 1.4; }
.reshuffle-callout {
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--sunken);
  border: 1px solid var(--line-2);
  color: var(--soft);
  line-height: 1.4;
}
.role-builder { display: flex; flex-direction: column; gap: 10px; }
.rb-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rb-opts { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.rb-field { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rb-filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rb-filter-row .sel { flex: 1 1 260px; max-width: 100%; }
.rb-list { display: flex; flex-direction: column; gap: 8px; max-height: 44vh; overflow-y: auto; padding-right: 2px; }
.rb-role-row {
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--sunken);
  border: 1px solid var(--line-2);
}
.rb-role-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rb-name { flex: 1 1 160px; min-height: 36px; padding: 6px 10px; font-size: 14px; font-weight: 700; }
.rb-cnt-wrap { display: inline-flex; align-items: center; gap: 6px; }
.rb-cnt { width: 66px; min-height: 36px; padding: 5px 8px; font-size: 14px; text-align: center; }
.rb-sub-chk { font-size: 13px; }
.rb-desc-wrap { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.rb-desc-label { font-size: 12px; color: var(--soft); font-weight: 600; }
.rb-desc { min-height: 36px; padding: 6px 10px; font-size: 13.5px; }
.rb-save-btn { margin-left: auto; }

/* Список студентов в модалке */
.roster-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 44vh;
  overflow-y: auto;
  padding-right: 2px;
}
.roster-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--sunken);
  border: 1px solid var(--line-2);
  font-size: 14px;
}
.roster-info { min-width: 0; flex: 1 1 220px; }

.seg {
  display: flex; gap: 0; padding: 3px; border-radius: 12px;
  background: var(--sunken); border: 1px solid var(--line-2);
}
.seg button {
  flex: 1 1 0; min-height: 36px; padding: 6px 10px; border: 0; border-radius: 9px;
  background: transparent; color: var(--soft); font-size: 13px; font-weight: 700; white-space: nowrap;
}
.seg--sm button { min-height: 30px; padding: 4px 10px; font-size: 12.5px; }
.seg button[aria-pressed="true"] { background: var(--sel); color: var(--text); }

.checks { display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 28px; font-size: 14px; font-weight: 600; color: var(--soft); cursor: pointer; }
.check input {
  -webkit-appearance: none; appearance: none; width: 20px; height: 20px; flex: 0 0 auto;
  border: 2px solid var(--line-2); border-radius: 6px; background: var(--sunken); cursor: pointer;
}
.check input:checked { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--sunken); }

.big-stepper { display: flex; align-items: center; justify-content: center; gap: 18px; }
.big-stepper .stp {
  width: 54px; height: 54px; border-radius: var(--r-md); border: 1px solid var(--line-2);
  background: var(--raise); color: var(--text); font-size: 26px; font-weight: 900; line-height: 1;
}
.big-stepper .stp:hover { background: var(--sel); }
.big-stepper .stp-val {
  min-width: 90px; text-align: center; font-family: var(--font-mono);
  font-size: 54px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums;
}

.preview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin-top: 8px; }
.pv-team { padding: 8px 10px 9px; border-radius: 10px; background: var(--sunken); border: 1px solid var(--line-2); border-top: 3px solid var(--c, var(--accent)); min-width: 0; }
.pv-team .p-h { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; margin-bottom: 4px; }
.pv-team .p-name { font-size: 12px; font-weight: 900; color: var(--c, var(--accent-strong)); }
.pv-team .p-seat { font-size: 10px; font-weight: 700; color: var(--mute-text); white-space: nowrap; }
.pv-team .p-list { font-size: 12px; line-height: 1.45; color: var(--soft); columns: 1; }
.pv-team .p-list span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; break-inside: avoid; }
.pv-team .p-list i { font-style: normal; color: var(--mute-text); font-size: 10px; margin-left: 3px; }
.pv-note { margin-top: 8px; font-size: 12px; color: var(--mute-text); }

.inp--lg { min-height: 52px; font-size: 17px; font-weight: 600; }
.area--lg { min-height: 130px; font-size: 16px; line-height: 1.5; }

/* Блок времени */
.time-block {
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 16px;
  border-radius: var(--r-lg); background: var(--raise); border: 1px solid var(--accent-line);
}
.tb-h { font-size: 12px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--mute-text); text-align: center; }
.time-big {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 62px;
  font-weight: 900; line-height: 1; letter-spacing: -.03em; color: var(--text);
  padding: 6px 18px; border-radius: var(--r-md); border: 1px dashed transparent; cursor: pointer;
}
.time-big:hover { border-color: var(--accent-line); background: var(--accent-bg); }
.time-big.is-editing { border-color: var(--accent); background: var(--input-bg); cursor: text; }
.time-big .time-edit { width: 5.5ch; font: inherit; font-family: var(--font-mono); color: var(--text); background: transparent; border: 0; outline: none; text-align: center; }
.presets { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.presets button {
  min-height: 38px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--line-2);
  background: var(--panel); color: var(--soft); font-size: 14px; font-weight: 700;
}
.presets button:hover { background: var(--accent-bg); color: var(--text); border-color: var(--accent-line); }
.mini-actions { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }

/* План занятия */
.plan { display: flex; flex-direction: column; gap: 6px; }
.plan-row {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 8px 10px; border-radius: 10px; background: var(--sunken); border: 1px solid var(--line-2);
}
.plan-row.done { opacity: .55; }
.plan-row .pl-num {
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; border: 0;
  background: var(--sel); font-family: var(--font-mono); font-size: 12px; font-weight: 800; color: var(--soft);
}
.plan-row.cur { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.plan-row.cur .pl-num { background: var(--accent); color: var(--accent-text); }
.plan-row .pl-main { min-width: 0; }
.plan-row .pl-title { font-size: 14px; font-weight: 700; }
.plan-row .pl-sub { font-size: 12px; color: var(--mute-text); }
.plan-row .pl-tools { display: flex; gap: 4px; }
.plan-row .pl-tools button {
  width: 28px; height: 28px; display: grid; place-items: center;
  border: 1px solid var(--line-2); border-radius: 7px; background: transparent; color: var(--soft); font-size: 13px;
}
.plan-row .pl-tools button:hover { background: var(--sel); color: var(--text); }
.add-row { display: flex; gap: 6px; flex-wrap: wrap; }
.add-row .btn { min-height: 36px; padding: 5px 12px; font-size: 13px; }

/* ==========================================================================
   ВЕДЕНИЕ (#tabLive)
   ========================================================================== */
.live-head {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  padding: 16px 20px;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1px solid var(--line-2);
}
.live-clock { display: flex; flex-direction: column; gap: 5px; min-width: 240px; }
.live-timer {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 76px; font-weight: 900; line-height: .88; letter-spacing: -.035em;
  color: var(--text); cursor: pointer; border-radius: var(--r-sm);
}
.live-timer.low, .live-timer.over { color: var(--danger-text); animation: clock-pulse 1s ease-in-out infinite; }
.live-timer.paused { color: var(--soft); animation: none; }
.live-timer .time-edit { width: 5.5ch; font: inherit; background: var(--input-bg); border: 1px solid var(--accent); border-radius: var(--r-sm); text-align: center; outline: none; }
@keyframes clock-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

.live-timer-bar { height: 8px; border-radius: 999px; background: var(--sel); overflow: hidden; }
.live-timer-bar i { display: block; width: 100%; height: 100%; border-radius: 999px; background: var(--success); transition: width .45s linear; }
.live-timer-bar.low i { background: var(--danger); }
.live-timer-sub { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--mute-text); }
.live-timer-sub #liveTimerState.over { color: var(--danger-text); }

.live-ctrls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.live-ctrls .btn { min-height: 46px; font-size: 14.5px; }
.live-ctrls .btn--lg { min-height: 50px; }

.live-taskbox {
  margin-top: 12px;
  padding: 15px 18px;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1px solid var(--line-2);
}
.live-round-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.live-round { font-size: 13px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; color: var(--accent-strong); }
.live-round-sep { color: var(--mute-text); }
.live-title-inline { font-size: 19px; font-weight: 900; line-height: 1.2; color: var(--text); }
.live-title { margin-top: 4px; font-size: 21px; font-weight: 900; line-height: 1.18; }
.live-tasktext { margin-top: 6px; font-size: 15.5px; line-height: 1.48; color: var(--soft); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Компактные пилюли объявлений и модалка композера */
.ann-composer { display: flex; flex-direction: column; gap: 8px; }
.ann-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ann-target-sel { width: auto; min-width: 220px; min-height: 36px; padding: 6px 34px 6px 12px; font-size: 13.5px; }
.ann-pills-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.ann-pills-list:empty { display: none; }
.ann-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--sunken);
  border: 1px solid var(--line-2);
  min-width: 0;
}
.ann-pill.is-tv { border-color: var(--accent); background: var(--accent-bg); }
.ann-pill-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.ann-pill-acts { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }

.sel--compact {
  width: auto;
  min-width: 150px;
  min-height: 34px;
  padding: 4px 30px 4px 10px;
  font-size: 13px;
  background-position: calc(100% - 16px) 14px, calc(100% - 10px) 14px;
}

.empty-teams-card {
  grid-column: 1 / -1;
  padding: 26px 16px;
  border-radius: var(--r-md);
  background: var(--sunken);
  border: 1px dashed var(--line-strong);
  text-align: center;
}
.empty-teams-card .et-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.live-adv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.live-adv-group { display: flex; flex-direction: column; gap: 6px; }

/* Строка статусов */
.live-status {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 12px; padding: 10px 16px;
  border-radius: var(--r-pill); background: var(--panel); border: 1px solid var(--line-2);
  font-size: 14.5px; font-weight: 600; color: var(--soft);
}
.live-status .ls-dot { color: var(--mute-text); }
.live-status .ls-link { display: inline-flex; align-items: center; gap: 6px; }
.live-status #stLink.is-bad { color: var(--danger-text); }
.live-status .link-btn { margin-left: auto; }
.link-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px var(--success); }
.link-dot.off { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

.offline-list {
  margin-top: 8px; padding: 10px 12px; border-radius: var(--r-md);
  background: var(--panel); border: 1px solid var(--line-2);
}
.offline-list .of-h { font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--mute-text); margin-bottom: 6px; }
.offline-list .of-items { display: flex; flex-wrap: wrap; gap: 6px; }

/* Сетка команд и ответов */
.live-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 12px;
  margin-top: 12px;
  align-items: start;
}
.matrix { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mteam {
  padding: 9px 10px 10px; border-radius: var(--r-md);
  background: var(--sunken); border: 1px solid var(--line-2);
  border-top: 4px solid var(--c, var(--accent)); min-width: 0;
}
.mteam.is-done { background: var(--success-bg); border-color: var(--success); }
.mteam .mt-h { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 4px; }
.mteam .mt-name { font-size: 14.5px; font-weight: 900; color: var(--c, var(--accent-strong)); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-h-r { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.mteam .mt-seat { font-size: 11.5px; font-weight: 700; color: var(--mute-text); white-space: nowrap; }
.mt-edit-btn {
  width: 22px; height: 22px; padding: 0; border: 0; border-radius: 5px;
  background: transparent; color: var(--mute-text); font-size: 12px;
}
.mt-edit-btn:hover { background: var(--sel); color: var(--text); }
.mteam .mt-people { font-size: 11.5px; color: var(--soft); margin-bottom: 4px; }
.mteam .mt-list { display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; line-height: 1.32; color: var(--soft); }
.mteam .mt-stu {
  display: flex; align-items: baseline; gap: 4px; border-radius: 5px;
  padding: 1.5px 4px; min-width: 0; cursor: pointer;
}
.mteam .mt-stu:hover, .mteam .mt-stu.is-open { background: var(--sel); }
.mteam .mt-stu .s-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mteam .mt-stu .s-cs { font-size: 10.5px; color: var(--mute-text); flex: 0 0 auto; }
.mteam .mt-stu .s-note-dot { font-size: 10px; font-weight: 900; color: var(--warning-text); flex: 0 0 auto; }
.mteam .mt-stu .s-role { margin-left: auto; font-size: 10.5px; font-weight: 800; color: var(--warning-text); flex: 0 0 auto; }
.mteam .mt-stu .s-role--dim { color: var(--mute-text); font-weight: 700; }
.mteam .mt-stu.is-lead .s-nm { color: var(--text); font-weight: 800; }
.mteam .mt-stu.is-off .s-nm { color: var(--mute-text); }
.mteam .mt-stu.is-off .s-nm::after { content: " ·"; color: var(--warning-text); }
.mt-stu .s-lock { flex: 0 0 auto; font-size: 10px; color: var(--warning-text); }

/* Меню правки студента — все строки с переносом, ничего не вылезает */
.stu-menu {
  display: flex; flex-direction: column; gap: 5px;
  margin: 4px 0 6px; padding: 7px; border-radius: 9px;
  background: var(--raise); border: 1px solid var(--line-strong);
  min-width: 0;
}
.stu-menu .sm-row { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.stu-menu select, .stu-menu .sm-inp {
  flex: 1 1 95px; min-width: 0; min-height: 28px; padding: 3px 6px;
  border-radius: 6px; border: 1px solid var(--line-2);
  background: var(--bg); color: var(--text); font-size: 11.5px;
}
.stu-menu .sm-inp-seat { flex: 0 0 60px; }
.stu-menu .sm-sel-cs { flex: 0 0 54px; }
.stu-menu button {
  flex: 1 1 auto; min-height: 28px; padding: 3px 8px; border-radius: 6px;
  border: 1px solid var(--line-2); background: var(--sel); color: var(--text);
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.stu-menu button:hover:not(:disabled) { background: var(--raise-2); border-color: var(--accent-line); }
.stu-menu button.sm-cut { border-color: var(--danger); color: var(--danger-text); background: transparent; }
.stu-menu button.sm-cut:hover:not(:disabled) { background: var(--danger-bg); }
.stu-menu .sm-cap { font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--mute-text); }

.add-stu {
  margin-top: 6px; width: 100%; min-height: 28px; padding: 3px 6px;
  border-radius: 6px; border: 1px dashed var(--line-2); background: transparent;
  color: var(--soft); font-size: 11.5px; font-weight: 700;
}
.add-stu:hover { background: var(--raise); color: var(--text); }
.mteam .mt-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; padding-top: 5px; border-top: 1px solid var(--line-2); font-size: 11.5px; font-weight: 800; }
.mteam .mt-foot .st { color: var(--mute-text); text-transform: uppercase; letter-spacing: .05em; }
.mteam .mt-foot .st.done { color: var(--success-text); }
.mteam .mt-foot .st.pending { color: var(--warning-text); }

/* Ответы команд */
.answers { display: flex; flex-direction: column; gap: 8px; max-height: 58vh; overflow: auto; }
.ans-row {
  padding: 9px 11px; border-radius: 10px; background: var(--sunken);
  border: 1px solid var(--line-2); border-left: 4px solid var(--c, var(--accent));
}
.ans-row.is-spot { border-color: var(--accent); background: var(--accent-bg); }
.ans-row .a-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 800; color: var(--mute-text); }
.ans-row .a-h b { color: var(--c, var(--accent-strong)); font-size: 13px; }
.ans-row .a-t { margin-top: 4px; font-size: 13.5px; line-height: 1.38; white-space: pre-wrap; word-break: break-word; }
.ans-foot { display: flex; justify-content: flex-end; margin-top: 6px; }

/* Нижняя полоса действий */
.live-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 14px; padding: 12px 16px; border-radius: var(--r-lg);
  background: var(--panel); border: 1px solid var(--line-2);
}
.live-foot > .btn { min-height: 40px; font-size: 14px; }
.foot-more { border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--raise); }
.foot-more > summary { padding: 9px 14px; font-size: 13.5px; }
.foot-more .fm-b { display: flex; flex-direction: column; gap: 7px; padding: 0 12px 12px; }

.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: var(--soft); cursor: pointer; }
.switch input {
  -webkit-appearance: none; appearance: none; width: 34px; height: 20px; border-radius: 999px;
  background: var(--sel); border: 1px solid var(--line-2); position: relative; cursor: pointer;
}
.switch input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--soft); transition: transform .15s ease, background .15s ease;
}
.switch input:checked { background: var(--success-bg); border-color: var(--success); }
.switch input:checked::after { transform: translateX(14px); background: var(--success); }

/* Выезжающая панель превью (z-index выше шапки) */
.h-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 92vw);
  display: flex; flex-direction: column;
  background: var(--panel); border-left: 1px solid var(--line-strong);
  box-shadow: var(--shadow-float);
  transform: translateX(102%); transition: transform .28s var(--ease);
  z-index: 50; overflow: hidden;
}
.h-drawer.is-open { transform: translateX(0); }
.dw-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); font-size: 16px; }
.dw-b { padding: 14px 16px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.drawer-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 49; border: 0; }

.shot { border-radius: 12px; overflow: hidden; border: 1px solid var(--line-2); background: var(--bg); }
.shot .s-cap {
  padding: 6px 10px; font-size: 11px; font-weight: 800; letter-spacing: .07em;
  text-transform: uppercase; color: var(--mute-text); background: var(--panel); border-bottom: 1px solid var(--line-2);
}
.mini-phone { padding: 10px; zoom: .68; }
.mini-phone .mp-banner { padding: 10px 12px; border-radius: 12px; background: var(--c, var(--accent)); color: var(--on-team); }
.mini-phone .mp-team { font-size: 19px; font-weight: 900; line-height: 1.05; text-transform: uppercase; }
.mini-phone .mp-role { margin-top: 6px; font-size: 13px; font-weight: 800; }
.mini-phone .mp-round { margin-top: 8px; font-size: 12px; font-weight: 800; color: var(--warning-text); }
.mini-phone .mp-task { margin-top: 6px; padding: 8px 10px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line-2); font-size: 12px; line-height: 1.35; color: var(--soft); max-height: 76px; overflow: hidden; }
.mini-phone .mp-timer { margin-top: 8px; display: flex; align-items: center; justify-content: space-between; font-family: var(--font-mono); font-size: 24px; font-weight: 900; }
.mini-phone .mp-timer.warn { color: var(--danger-text); }
.mini-phone .mp-bar { margin-top: 6px; height: 7px; border-radius: 999px; background: var(--sel); overflow: hidden; }
.mini-phone .mp-bar i { display: block; width: 100%; height: 100%; background: var(--success); }

.mini-tv { padding: 10px; background: linear-gradient(var(--sunken), var(--bg)); }
.mini-tv .mt-title { font-size: 13px; font-weight: 900; text-align: center; color: var(--text); }
.mini-tv .mt-link { margin: 7px auto 0; width: fit-content; padding: 2px 9px; border-radius: 7px; border: 1px solid var(--accent); font-size: 11px; font-weight: 900; color: var(--text); }
.mini-tv .mt-count { margin-top: 7px; text-align: center; font-family: var(--font-mono); font-size: 21px; font-weight: 900; color: var(--text); }
.mini-tv .mt-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: 9px; }
.mini-tv .mt-cell { padding: 4px 5px; min-height: 34px; border-radius: 6px; background: var(--panel); border-top: 3px solid var(--c, var(--accent)); font-size: 10px; font-weight: 800; color: var(--soft); }
.mini-tv .mt-cell b { display: block; color: var(--c, var(--accent-strong)); font-size: 10px; }

/* Модалка доступа и справки */
.access-grid { display: grid; grid-template-columns: 185px minmax(0, 1fr); gap: 18px; align-items: start; }
.access-qr { background: #fff; padding: 10px; border-radius: 14px; width: 180px; margin: 0 auto; line-height: 0; }
.access-qr img, .access-qr svg { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; image-rendering: pixelated; }
.tv-exp-qr img, .tv-exp-qr svg { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; image-rendering: pixelated; }
.access-bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.help-list { list-style: decimal; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14.5px; color: var(--soft); line-height: 1.45; }
.help-list b { color: var(--text); }

/* Плотность compact для панели ведущей */
[data-density='compact'] .h-app { padding: 8px 12px 18px; }
[data-density='compact'] .h-head { padding: 7px 0 8px; }
[data-density='compact'] .panel { padding: 10px 12px 12px; }
[data-density='compact'] .panel-h { margin-bottom: 8px; padding-bottom: 7px; }
[data-density='compact'] .mteam { padding: 6px 7px 7px; }
[data-density='compact'] .matrix { gap: 6px; }
[data-density='compact'] .plan-row { padding: 5px 8px; }

/* Адаптив для ноутбуков и узких окон (1024px–1180px и <= 940px) */
@media (max-width: 1240px) {
  .live-grid { grid-template-columns: 1fr; }
  .matrix { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .h-head { gap: 8px; }
  .h-brand b { font-size: 15px; }
  .h-tabs button { min-height: 36px; padding: 5px 12px; font-size: 13px; }
  .h-head-actions { gap: 4px; }
  .h-head-actions .btn--sm { min-height: 36px; padding: 5px 10px; font-size: 13px; }
}
@media (max-width: 960px) {
  .h-head-actions { flex: 1 1 100%; margin-left: 0; }
}
@media (max-width: 1100px) {
  .live-head { grid-template-columns: 1fr; }
  .live-ctrls { justify-content: flex-start; }
}
@media (max-width: 760px) {
  .steps { max-width: 100%; }
  .time-big { font-size: 50px; }
  .big-stepper .stp-val { font-size: 46px; min-width: 74px; }
  .live-status .link-btn { margin-left: 0; }
  .ann-fields, .access-grid, .access-bottom-grid { grid-template-columns: 1fr; }
  .matrix { grid-template-columns: 1fr; }
  .tv-lobby-cols { grid-template-columns: 1fr; }
  .tv-answers { grid-template-columns: 1fr; }
  .tv-timer { font-size: 5.5rem; }
  .tv-h1 { font-size: 2rem; }
}

/* ==========================================================================
   ЭКРАН 4 — ДЕМО-СТЕНД (demo.html)
   ========================================================================== */
body.demo-body { background: var(--bg); color: var(--text); font-size: 15.5px; }
.demo-wrap { max-width: 960px; margin: 0 auto; padding: 22px 18px 60px; }
.demo-h1 { font-size: 26px; font-weight: 900; letter-spacing: .02em; }
.demo-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
  margin: 16px 0;
}
.demo-stat {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 10px 12px;
}
.demo-stat .k { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute-text); font-weight: 700; }
.demo-stat .v { font-size: 22px; font-weight: 800; margin-top: 2px; font-family: var(--font-mono); }
.demo-ctrl-row { gap: 8px; }
.demo-lbl { font-size: 13px; font-weight: 700; color: var(--mute-text); }
.demo-pin { width: 185px; min-height: 40px; }
.demo-cnt { width: 78px; min-height: 40px; }
.demo-table-wrap { overflow-x: auto; }
.demo-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.demo-table th, .demo-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-2); }
.demo-table th { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--mute-text); font-weight: 700; }
.demo-role { font-size: 13px; font-weight: 700; }
.demo-role.is-lead { color: var(--accent-strong); }
.demo-log {
  margin: 0; padding: 12px; background: var(--sunken); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); font-family: var(--font-mono); font-size: 13px;
  color: var(--soft); max-height: 200px; overflow: auto; white-space: pre-wrap;
}

/* ==========================================================================
   ROUND 4 — ДЖЕМ (ЧЕКПОИНТЫ), PC-ПОРТАЛ СТУДЕНТА, ДИСКОРД-СИМУЛЯТОР
   ========================================================================== */

/* Переключатель режима в Подготовке */
.event-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 780px;
  margin: 0 auto 14px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--panel);
  border: 1px solid var(--line-2);
}

/* Подготовка чекпоинтов (Host) */
.jam-prep-box { display: flex; flex-direction: column; gap: 12px; }
.jam-cp-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--sunken);
  border: 1px solid var(--line-2);
}
.jam-cp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.jam-cp-grid-sub { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.jam-prep-list { display: flex; flex-direction: column; gap: 8px; }
.jam-prep-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--sunken);
  border: 1px solid var(--line-2);
}
.jam-prep-info { flex: 1 1 260px; min-width: 0; }
.jam-prep-title { font-weight: 800; font-size: 15px; }
.jam-prep-meta { font-size: 13px; color: var(--soft); margin-top: 2px; }

/* Ведение Джема (Host) */
.live-jam-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  margin-bottom: 14px;
}
.live-jam-next { flex: 1 1 260px; min-width: 0; }
.live-jam-title { font-size: 20px; font-weight: 900; margin-top: 2px; }
.live-jam-meta { font-size: 13.5px; color: var(--soft); margin-top: 2px; }
.live-jam-countdown-wrap { text-align: center; min-width: 170px; }
.live-jam-countdown {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 900;
  color: var(--accent-strong);
  line-height: 1.1;
}
.live-jam-countdown.is-overdue { color: var(--danger-text); }

.jam-live-list { display: flex; flex-direction: column; gap: 12px; }
.jam-live-card {
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--sunken);
  border: 1px solid var(--line-2);
}
.jam-live-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.jam-live-teams {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.jam-team-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  font-size: 13px;
}
.jam-team-row.is-done { border-color: var(--success); }
.jam-team-row.is-pending { border-color: var(--warning); background: var(--raise); }
.jam-team-sub { color: var(--soft); font-size: 12.5px; overflow-wrap: anywhere; }

/* Сворачиваемые блоки состава и раундов (все экраны) */
details.s-collapse {
  margin-top: 12px;
  border-radius: var(--r-md);
  background: var(--panel);
  border: 1px solid var(--line-2);
  overflow: hidden;
}
details.s-collapse[open] > .mates-summary {
  border-bottom: 1px solid var(--line-2);
}
.mates-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.mates-summary::-webkit-details-marker { display: none; }
.mates-summary::marker { content: ''; }
.mates-summary::before {
  content: '▸';
  font-size: 11px;
  color: var(--mute-text);
  flex: 0 0 auto;
}
details.s-collapse[open] > .mates-summary::before { content: '▾'; }
.mates-summary h3 {
  margin: 0;
  margin-bottom: 0;
  padding: 0;
  border-bottom: none;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--soft);
}
details.s-collapse.mates { margin-top: 12px; border: 1px solid var(--line-2); }
details.s-collapse.past { margin-top: 12px; }

/* PC-дружелюбный макет студента (>= 860px) */
@media (min-width: 860px) {
  .s-body.s-body--wide {
    max-width: 1060px;
    padding: 28px 24px 52px;
  }
  .s-body.s-body--wide .s-dash-grid {
    display: grid;
    grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
  }
  .s-body.s-body--wide .s-dash-left {
    position: sticky;
    top: 18px;
  }
  .s-body.s-body--wide .s-dash-right > *:first-child { margin-top: 0; }
}

/* ===== МОБИЛЬНЫЙ КОМПАКТ (< 860px) ===== */
@media (max-width: 859px) {
  /* Уменьшаем отступы основного тела */
  .s-body { padding: 14px 12px 32px; }
  .s-entry-card { margin-bottom: 10px; padding: 11px 12px; }

  /* Компактный баннер команды */
  .banner { padding: 12px 14px 11px; }
  .banner .b-kicker { font-size: 11px; margin-bottom: 2px; }
  .banner .b-main { font-size: 20px; margin-top: 3px; }
  .banner .b-seat { font-size: 14px; margin-top: 4px; }

  details.s-collapse,
  details.s-collapse.mates,
  details.s-collapse.past { margin-top: 10px; }

  /* Компактный roundCard */
  .round-card { margin-top: 10px; }
  .round-line { margin-top: 8px; padding: 8px 12px; }
  .task-box { margin-top: 10px; padding: 12px; }
  .task-box h3 { margin-bottom: 5px; font-size: 11px; }
  .timer-box { margin-top: 10px; padding: 9px 12px; }
  .timer { font-size: 34px; }
  .sent-line { margin-top: 8px; padding: 8px 12px; }
  .answer-card { margin-top: 10px; padding: 11px; }
  /* Скрываем лейбл «Задание» в round-card на мобиле (сам блок говорит за себя) */
  .task-box > h3 { display: none; }
  /* Скрываем «Таймер» caption */
  .timer-cap { font-size: 11px; }
}

/* Чеки джема на экране студента */
.jam-student-box {
  padding: 14px 16px;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1px solid var(--line-2);
}
.jam-stu-heading { font-size: 15px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--soft); }
.jam-stu-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.jam-stu-card {
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--sunken);
  border: 1px solid var(--line-2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.jam-stu-card.is-done { border-color: var(--success); }
.jam-stu-card.is-overdue { border-color: var(--danger); }
.jam-stu-title { font-size: 16.5px; font-weight: 800; }
.jam-stu-meta { font-size: 13.5px; color: var(--soft); }
.jam-stu-form { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

/* Симулятор Discord и быстрая регистрация на #viewPick */
.discord-badge { display: flex; align-items: center; gap: 8px; }
.discord-avatar { width: 28px; height: 28px; border-radius: 999px; object-fit: cover; border: 1px solid var(--line-strong); flex: none; }
.discord-quick-box { padding-top: 10px; border-top: 1px solid var(--line-2); }
.mock-discord-box { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.mock-discord-box--solo { border-top: 0; padding-top: 0; margin-top: 0; }
.mock-discord-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* ТВ Джем-таймлайн */
.tv-jam { gap: 1rem; }
.tv-jam-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.2rem 1.8rem;
  border-radius: 1.4rem;
  background: var(--panel);
  border: .15rem solid var(--line-strong);
}
.tv-jam-hero-main { flex: 1 1 auto; min-width: 0; }
.tv-jam-next-title { font-size: 2.7rem; font-weight: 900; line-height: 1.1; margin-top: .25rem; }
.tv-jam-next-meta { font-size: 1.45rem; font-weight: 600; color: var(--soft); margin-top: .35rem; }
.tv-jam-hero-right { flex: 0 0 auto; text-align: right; min-width: 24rem; }
.tv-jam-timer { font-size: 4.5rem; line-height: 1; }
.tv-jam-timer.is-overdue { color: var(--danger-text); }
.tv-jam-prog { margin-top: .5rem; }
.tv-jam-strip {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
}
.tv-jam-pill {
  padding: .45rem .95rem;
  border-radius: 999px;
  background: var(--panel);
  border: .12rem solid var(--line-2);
  font-size: 1.15rem;
  font-weight: 800;
}
.tv-jam-pill.is-active { border-color: var(--accent); color: var(--accent-strong); }
.tv-jam-pill.is-done { border-color: var(--success); color: var(--success-text); }
.tv-jam-teams {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(var(--tv-cols, 4), minmax(0, 1fr));
  grid-template-rows: repeat(var(--tv-rows, 2), minmax(0, 1fr));
  gap: .9rem;
}
.tv-jam-team {
  padding: .9rem 1.1rem;
  border-radius: 1.1rem;
  background: var(--panel);
  border: .14rem solid var(--line-2);
  border-top: .45rem solid var(--c, var(--accent));
  display: flex;
  flex-direction: column;
  gap: .55rem;
  overflow: hidden;
}
.tv-jam-cp-pills { display: flex; flex-wrap: wrap; gap: .4rem; }
.tv-cp-tag {
  padding: .22rem .6rem;
  border-radius: .55rem;
  font-size: .95rem;
  font-weight: 800;
  background: var(--sunken);
  border: 1px solid var(--line-2);
  color: var(--soft);
}
.tv-cp-tag.done { border-color: var(--success); color: var(--success-text); }
.tv-cp-tag.overdue { border-color: var(--danger); color: var(--danger-text); }

@media (max-width: 720px) {
  .jam-cp-grid, .jam-cp-grid-sub { grid-template-columns: 1fr; }
}
