/* Пульт докладчика. Своя тема (по системным настройкам), независимо от темы экрана.
   Телефон — одна колонка; планшет/ноутбук в альбомной ориентации — две. */

body.remote {
  --r-bg: #f4f5f7;
  --r-panel: #ffffff;
  --r-ink: #101216;
  --r-ink-2: #4a4f59;
  --r-muted: #80858f;
  --r-line: #e1e3e8;
  --r-accent: #3164af;
  --r-accent-soft: #e8eef8;
  --r-btn: #e9ebef;
  --r-on-accent: #ffffff;
  --r-badge: #101216;
  background: var(--r-bg);
  color: var(--r-ink);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}

@media (prefers-color-scheme: dark) {
  body.remote {
    --r-bg: #0e0f11;
    --r-panel: #17191c;
    --r-ink: #eef0f3;
    --r-ink-2: #c3c6cc;
    --r-muted: #8b9099;
    --r-line: #2a2d33;
    --r-accent: #6f9be0;
    --r-accent-soft: #1b2a42;
    --r-btn: #24272d;
    /* Светлый акцент тёмной темы — с тёмным текстом (белый на нём читается плохо: 2,8:1). */
    --r-on-accent: #0b1220;
    --r-badge: #8f1d1d;
    color-scheme: dark;
  }
}

.remote button {
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  background: var(--r-btn);
  padding: 10px 14px;
  font-size: 15px;
  touch-action: manipulation;
}

.remote button.primary {
  background: var(--r-accent);
  color: var(--r-on-accent);
}

.remote .muted {
  color: var(--r-muted);
}

/* ------------------------------------------------------------ шапка */

.r-top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: var(--r-panel);
  border-bottom: 1px solid var(--r-line);
}

.conn {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--r-muted);
}

.conn.online,
.conn.local {
  background: #0ca30c;
}
.conn.connecting {
  background: #fab219;
}
.conn.offline,
.conn.pin,
.conn.locked {
  background: #d03b3b;
}

.r-where {
  flex: 1;
  min-width: 0;
}

.r-section {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--r-accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.r-title {
  font-size: 16px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timer {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.1;
  padding: 6px 10px !important;
  font-size: 18px !important;
  font-weight: 650;
  min-width: 74px;
}

.timer.paused #timer-v {
  color: var(--r-muted);
}

.timer small {
  font-size: 11px;
  font-weight: 600;
  color: var(--r-muted);
}

.timer small.behind {
  color: #d03b3b;
}

.timer small.ahead {
  color: #0ca30c;
}

.icon-btn {
  flex: none;
  width: 42px;
  height: 42px;
  padding: 0 !important;
  font-size: 20px !important;
}

/* ------------------------------------------------------------ основная часть */

.r-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 12px 96px;
}

.pv {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 0 1px var(--r-line);
}

.pv iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
}

.laser-pad {
  position: absolute;
  inset: 0;
  touch-action: none;
  cursor: crosshair;
}

.laser-pad.off {
  display: none;
}

.pv-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.pv-next-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.pv-next {
  width: 38%;
  flex: none;
  opacity: 0.9;
}

.pv-next-text {
  min-width: 0;
  font-size: 14px;
  color: var(--r-ink-2);
}

.pv-next-text small {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--r-muted);
}

/* ------------------------------------------------------------ варианты на слайде */

.r-controls {
  background: var(--r-panel);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 0 0 1px var(--r-line);
}

.ctl-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--r-muted);
  margin-bottom: 8px;
}

.ctl-opts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

/* Длинные русские слова («Автоматизированные», «Кибербезопасность») не должны вылезать
   за кнопку: переносим по слогам, а где словаря переносов нет — просто по буквам. */
.ctl-opts button {
  min-width: 0;
  min-height: 52px;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  line-height: 1.2;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: anywhere;
}

@media (max-width: 480px) {
  .ctl-opts button {
    padding: 10px;
    font-size: 14px;
  }
}

.ctl-opts button small {
  display: block;
  font-weight: 400;
  font-size: 12px;
  color: var(--r-muted);
  margin-top: 2px;
}

.ctl-opts button.on {
  background: var(--r-accent);
  color: var(--r-on-accent);
}

.ctl-opts button.on small {
  color: var(--r-on-accent);
  opacity: 0.8;
}

.ctl-opts button.overview {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--r-line);
}

.ctl-opts button.overview.on {
  background: var(--r-ink);
  color: var(--r-panel);
}

.ctl-goto {
  margin-top: 10px;
  width: 100%;
  background: var(--r-accent-soft) !important;
  color: var(--r-accent);
  font-weight: 650;
}

/* ------------------------------------------------------------ заметки */

.r-notes {
  background: var(--r-panel);
  border-radius: 14px;
  padding: 14px 16px 18px;
  box-shadow: 0 0 0 1px var(--r-line);
  font-size: var(--notes-size, 18px);
  line-height: 1.5;
}

.notes-meta {
  font-size: 12px;
  color: var(--r-muted);
  margin-bottom: 6px;
}

.notes p,
.opt-notes p {
  margin: 0 0 0.7em;
}

.notes ul,
.opt-notes ul {
  margin: 0 0 0.7em;
  padding-left: 1.2em;
}

.notes li,
.opt-notes li {
  margin: 0.2em 0;
}

.notes h4,
.opt-notes h4 {
  margin: 0.9em 0 0.3em;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--r-accent);
}

.notes blockquote,
.opt-notes blockquote {
  margin: 0.6em 0 0.9em;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--r-accent-soft);
  border-left: 4px solid var(--r-accent);
}

.notes strong,
.opt-notes strong {
  font-weight: 700;
}

.opt-notes {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--r-accent-soft);
}

.opt-notes .opt-name {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--r-accent);
  margin-bottom: 6px;
}

.notes-empty {
  color: var(--r-muted);
  font-style: italic;
}

/* ------------------------------------------------------------ нижняя панель */

.r-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--r-panel);
  border-top: 1px solid var(--r-line);
}

.nav-btn {
  flex: 1;
  min-width: 0;
  min-height: 60px;
  font-size: 20px !important;
  font-weight: 700;
  white-space: nowrap;
}

.nav-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.nav-btn:active,
.skip-btn:active,
.ctl-opts button:active {
  transform: scale(0.98);
}

/* Вторичная кнопка «сразу к следующему слайду»: пропускает оставшиеся шаги и варианты.
   Нарочно неброская и узкая, чтобы не путать с «Далее». */
.remote .skip-btn {
  flex: none;
  width: 54px;
  min-height: 60px;
  padding: 6px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--r-line);
  color: var(--r-accent);
}

.skip-btn svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-btn small {
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.remote .skip-btn:disabled {
  color: var(--r-muted);
  opacity: 0.4;
  cursor: default;
}

.steps {
  flex: none;
  display: flex;
  gap: 5px;
  max-width: 30%;
  flex-wrap: wrap;
  justify-content: center;
}

.steps i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--r-line);
}

.steps i.on {
  background: var(--r-accent);
}

/* ------------------------------------------------------------ меню */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: flex-end;
}

.drawer[hidden] {
  display: none;
}

.drawer-panel {
  width: min(440px, 92vw);
  height: 100%;
  overflow: auto;
  background: var(--r-panel);
  padding: calc(12px + env(safe-area-inset-top)) 14px 24px;
}

.drawer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.drawer-head b {
  font-size: 18px;
}

.drawer-head .muted {
  flex: 1;
  font-size: 13px;
}

.tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.tools button.on {
  background: var(--r-accent);
  color: var(--r-on-accent);
}

.slide-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.slide-list .sec {
  margin: 14px 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--r-accent);
}

.slide-list button {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: baseline;
  text-align: left;
  background: transparent;
  padding: 10px 8px;
  border-radius: 10px;
}

.slide-list button.cur {
  background: var(--r-accent-soft);
  color: var(--r-accent);
  font-weight: 650;
}

.slide-list .n {
  flex: none;
  width: 22px;
  color: var(--r-muted);
  font-size: 13px;
}

.slide-list .t {
  flex: 1;
}

.slide-list .d {
  flex: none;
  font-size: 12px;
  color: var(--r-muted);
}

/* ------------------------------------------------------------ PIN и затемнение */

.pin-dlg {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.5);
  padding: 16px;
}

.pin-dlg[hidden] {
  display: none;
}

.pin-card {
  width: min(360px, 100%);
  background: var(--r-panel);
  border-radius: 16px;
  padding: 18px;
}

.pin-card p {
  font-size: 14px;
  color: var(--r-ink-2);
}

.pin-card input {
  width: 100%;
  font: inherit;
  font-size: 28px;
  letter-spacing: 0.3em;
  text-align: center;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--r-line);
  background: var(--r-bg);
  color: var(--r-ink);
}

.pin-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

.black-badge {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 15;
  padding: 12px;
  border-radius: 12px;
  text-align: center;
  font-weight: 650;
  background: var(--r-badge);
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.black-badge[hidden] {
  display: none;
}

/* ------------------------------------------------------------ широкий экран */

/* Ноутбук/планшет: всё на одном экране без прокрутки страницы. Слева превью,
   справа варианты и под ними заметки (прокручиваются сами): выбранный вариант
   и его заметка оказываются рядом. */
@media (min-width: 900px) and (min-aspect-ratio: 4/3) {
  body.remote {
    height: 100dvh;
    min-height: 0;
  }
  .r-main {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: 'pv ctl' 'pv notes';
    align-items: start;
    gap: 16px;
    padding: 16px 16px 100px;
  }
  .r-previews {
    grid-area: pv;
    align-self: stretch;
    min-height: 0;
    overflow: auto;
  }
  .r-controls {
    grid-area: ctl;
  }
  .r-notes {
    grid-area: notes;
    align-self: stretch;
    min-height: 0;
    overflow: auto;
  }
  .r-controls[hidden] + .r-notes {
    grid-area: ctl / ctl / notes / notes;
  }
  .nav-btn {
    max-width: 320px;
  }
  .r-nav {
    justify-content: center;
  }
  .steps {
    max-width: 240px;
  }
}

/* Справка к варианту: свёрнута, чтобы вслух звучала только ключевая фраза */
.opt-more {
  margin-top: 4px;
  font-size: 0.9em;
  color: var(--r-ink-2);
}

.opt-more summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  color: var(--r-accent);
  padding: 4px 0;
  list-style: none;
}

.opt-more summary::-webkit-details-marker {
  display: none;
}

.opt-more summary::before {
  content: '▸ ';
}

.opt-more[open] summary::before {
  content: '▾ ';
}
