/* Modified for SyncDesk (2026). */
/* =========================================================
   SyncDesk — Global Styles
   Aesthetic: dark cinema / editorial with warm amber accents
   ========================================================= */

@import url("/css/fonts.css");

/* ── Base ──────────────────────────────────────────────── */
/* The `hidden` attribute must win over component display rules. */
[hidden] {
  display: none !important;
}

/* ── CSS Variables ──────────────────────────────────────── */
:root {
  --bg: #0e0e12;
  --bg-2: #16161d;
  --bg-3: #1e1e28;
  --bg-card: #1a1a24;
  --border: #2a2a38;
  --border-2: #363650;
  --accent: #f0a500;
  --accent-2: #ffbe3d;
  --accent-glow: rgba(240, 165, 0, 0.2);
  --text: #e8e8f0;
  --text-2: #9090b0;
  --text-3: #5a5a78;
  --danger: #e05555;
  --success: #4caf82;
  --radius: 12px;
  --radius-sm: 6px;
  --shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.3);
  --font-head: "Syne", sans-serif;
  --font-body: "DM Sans", sans-serif;
  --font-mono: "DM Mono", monospace;
  --topbar-h: 56px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg: #f4f3f0;
  --bg-2: #eae9e4;
  --bg-3: #e0dfd9;
  --bg-card: #ffffff;
  --border: #d8d7d0;
  --border-2: #c5c4bc;
  --accent: #d4860a;
  --accent-2: #e8990f;
  --accent-glow: rgba(212, 134, 10, 0.15);
  --text: #1a1a24;
  --text-2: #5a5a72;
  --text-3: #9090a8;
  --shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* ── Reset ──────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-2);
}
::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 3px;
}

/* ── Typography ─────────────────────────────────────────── */
h1,
h2 {
  font-family: var(--font-head);
}
h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}
h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

/* ── Buttons ────────────────────────────────────────────── */
button {
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  font-size: 0.875rem;
  transition: var(--transition);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  letter-spacing: 0.02em;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  text-align: center;
}
.btn:hover {
  border-color: var(--border-2);
  background: var(--bg-2);
}

.btn-primary {
  background: var(--accent);
  color: #0a0a0a;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-copy {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
}
.btn-copy:hover {
  background: var(--bg-2);
}

.btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  border: 1px solid transparent;
  font-size: 1rem;
}
.btn-icon:hover {
  background: var(--bg-3);
  border-color: var(--border);
  color: var(--text);
}

/* ── Change PDF Button ──────────────────────────────────── */
.btn-change-pdf {
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  color: var(--text-2);
  font-size: 0.8rem;
  padding: 6px 14px;
}
.btn-change-pdf:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

/* ── Swap Cancel Button ─────────────────────────────────── */
.swap-cancel-btn {
  margin-top: 20px;
  width: 100%;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--text-3);
  font-size: 0.875rem;
}
.swap-cancel-btn:hover {
  background: var(--bg-3);
  color: var(--text);
  border-color: var(--border-2);
}

/* ── PDF Swap Banner (Viewer & Remote) ──────────────────── */
.pdf-swap-banner,
.rc-pdf-swap-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--bg-3), var(--bg-2));
  border-left: 3px solid var(--accent);
  color: var(--text);
  font-size: 0.875rem;
  opacity: 0;
  transform: translateY(-8px);
  transition:
    opacity 0.35s ease,
    transform 0.35s ease;
  z-index: 60;
}
.pdf-swap-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
}
.rc-pdf-swap-banner {
  position: relative;
  border-radius: 0;
}
.pdf-swap-banner.show,
.rc-pdf-swap-banner.show {
  opacity: 1;
  transform: translateY(0);
}
.pdf-swap-banner strong,
.rc-pdf-swap-banner strong {
  color: var(--accent);
}

/* ══════════════════════════════════════════════════════════
   PRESENTER PAGE
   ══════════════════════════════════════════════════════════ */

.presenter-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ── Top Bar ────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  /* Three real columns: the counter gets its own space and can never be
     overlapped. The right column never shrinks below its content, the left one
     (logo, session name) gives way first. */
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(max-content, 1fr);
  align-items: center;
  column-gap: 16px;
  padding: 0 20px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  z-index: 50;
  flex-shrink: 0;
  flex-wrap: nowrap;
  overflow: hidden;
  transition:
    opacity 0.3s,
    transform 0.3s;
}

.topbar.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-100%);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-left {
  grid-column: 1;
  min-width: 0;
  overflow: hidden;
}
.topbar-center {
  grid-column: 2;
  justify-self: center;
  white-space: nowrap;
}
.topbar-right {
  grid-column: 3;
  justify-self: end;
  flex-wrap: nowrap;
}

.logo {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.session-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--bg-3);
  color: var(--text-2);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.slide-counter {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-2);
  letter-spacing: 0.05em;
}

/* ── Setup Overlay ──────────────────────────────────────── */
.setup-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition:
    opacity 0.4s,
    transform 0.4s;
}

.setup-overlay.hide {
  opacity: 0;
  transform: scale(1.02);
  pointer-events: none;
}

.setup-card {
  width: 100%;
  max-width: 480px;
  text-align: center;
}

.setup-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

.setup-logo svg {
  display: block;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.setup-sub {
  color: var(--text-2);
  margin: 10px 0 32px;
  font-size: 0.95rem;
  line-height: 1.6;
}

.setup-footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-3);
}

.footer-license {
  display: inline-flex;
  align-items: center;
}

.footer-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-3);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.vs-fullscreen-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 8px;
}

.vs-fullscreen-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.vs-share-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 8px;
}

.vs-share-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Upload Zone ────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius);
  padding: 40px 20px;
  background: var(--bg-2);
  transition: var(--transition);
  cursor: pointer;
}

.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.upload-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.upload-zone p {
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 6px;
}

.upload-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.upload-hint {
  color: var(--text-3);
  font-size: 0.8rem;
}

/* ── Progress Bar ───────────────────────────────────────── */
.upload-progress {
  margin-top: 20px;
}
.progress-bar {
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}
#progressLabel {
  font-size: 0.85rem;
  color: var(--text-2);
}

/* ── Slide Area ─────────────────────────────────────────── */
.slide-area {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg);
}

.slide-wrapper {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
  box-shadow:
    0 0 0 1px var(--border),
    var(--shadow);
  overflow: hidden;
  transition: transform 0.3s ease;
}

#slideCanvas {
  display: block;
  background: #fff;
  cursor: pointer;
}

/* ── PDF link annotations ───────────────────────────────── */
.link-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.pdf-link {
  position: absolute;
  pointer-events: auto;
  border-radius: 2px;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.pdf-link:hover,
.pdf-link:focus-visible {
  background: rgba(59, 130, 246, 0.2);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.7);
  outline: none;
}

/* ── Slide Transition ───────────────────────────────────── */
.transition-overlay {
  position: absolute;
  inset: 0;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 2;
}
.transition-overlay.flash {
  opacity: 0.6;
}

/* ── Navigation Buttons ─────────────────────────────────── */
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 80px;
  background: rgba(0, 0, 0, 0.5);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 10;
  backdrop-filter: blur(4px);
}

.slide-area:hover .nav-btn {
  opacity: 1;
}
.nav-prev {
  left: 8px;
}
.nav-next {
  right: 8px;
}
.nav-btn:hover {
  background: rgba(240, 165, 0, 0.2);
  border-color: var(--accent);
  color: var(--accent);
}
.nav-btn:disabled {
  opacity: 0.2 !important;
  cursor: not-allowed;
}

/* ── Artificial Cursor ─────────────────────────────────── */
.artificial-cursor {
  position: absolute;
  width: 24px;
  height: 24px;
  background: radial-gradient(
    circle,
    rgba(255, 0, 0, 0.9) 0%,
    rgba(255, 0, 0, 0.5) 40%,
    rgba(255, 0, 0, 0.2) 70%,
    transparent 100%
  );
  border-radius: 50%;
  pointer-events: none;
  z-index: 15;
  transform: translate(-50%, -50%);
  transition: none;
  opacity: 0;
  box-shadow:
    0 0 20px rgba(255, 0, 0, 0.8),
    0 0 40px rgba(255, 0, 0, 0.4),
    inset 0 0 10px rgba(255, 0, 0, 0.3);
}

.artificial-cursor.active {
  opacity: 1;
  animation: cursorPulse 2s infinite;
}

@keyframes cursorPulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
  }
}

.artificial-cursor::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  background: #ff0000;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
}

/* ── Slide Strip ─────────────────────────────────────────── */
.slide-strip {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.slide-area:hover .slide-strip {
  opacity: 1;
}

/* Images and videos have no thumbnails: an empty strip must not lie over the
   bottom of the stage, where a video has its transport bar. */
.slide-strip:empty {
  display: none;
}

.slide-strip.fs-hidden {
  display: none !important;
}

.slide-wrapper.fs-mode {
  border-radius: 0;
  box-shadow: none;
}

.strip-thumb {
  height: 52px;
  min-width: 80px;
  flex-shrink: 0;
  border-radius: 4px;
  border: 2px solid var(--border);
  cursor: pointer;
  overflow: hidden;
  transition: var(--transition);
  background: var(--bg-3);
}
.strip-thumb.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.strip-thumb:hover {
  border-color: var(--text-2);
}
.strip-thumb canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ══════════════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════════════ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 360px;
  position: relative;
  box-shadow: var(--shadow);
  text-align: center;
  animation: slideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-wide {
  max-width: 600px;
  text-align: left;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--bg-3);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 30px;
  height: 30px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover {
  color: var(--text);
  border-color: var(--border-2);
}

.modal-sub {
  color: var(--text-2);
  font-size: 0.875rem;
  margin: 8px 0 20px;
}

/* ── IP Input Row ───────────────────────────────────────── */
.ip-row {
  margin-bottom: 16px;
  text-align: left;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.ip-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.ip-hint {
  font-weight: 400;
  color: var(--text-3);
  text-transform: none;
  letter-spacing: 0;
}

.ip-input-group {
  display: flex;
  gap: 6px;
}

.ip-input-group input {
  flex: 1;
  min-width: 0; /* lets the field give way to a longer button label ("Применить") */
  padding: 8px 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  outline: none;
}
.ip-input-group input:focus {
  border-color: var(--accent);
}

.ip-note {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 8px;
  transition: color 0.2s;
}
.ip-note code {
  font-family: var(--font-mono);
  background: var(--bg-3);
  padding: 1px 5px;
  border-radius: 3px;
}

#qrCanvas {
  border-radius: var(--radius-sm);
  width: 200px !important;
  height: 200px !important;
  margin: 0 auto;
  display: block;
  border: 6px solid white;
}

.remote-url {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-3);
  margin-top: 12px;
  word-break: break-all;
  line-height: 1.5;
}

.remote-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-2);
  margin: 16px 0 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════════
   REMOTE PAGE
   ══════════════════════════════════════════════════════════ */

.remote-page {
  height: 100vh;
  overflow-y: auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.remote-pad {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  flex: 1;
}

.remote-pad .rc-tab-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.rc-notes-section {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.rc-notes-area {
  width: 100%;
  flex: 1;
  min-height: 200px;
  resize: none;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-top: 8px;
}

.rc-notes-area:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.rc-notes-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.notes-label {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

/* ── Header Fullscreen Button ─────────────────────────── */
.rc-fullscreen-btn {
  width: 40px !important;
  height: 40px !important;
  font-size: 1.1rem !important;
  padding: 0 !important;
  margin: 0 !important;
  min-width: 44px !important;
  min-height: 44px !important;
  background: var(--bg-3) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
}

.rc-cursor-btn {
  width: 40px !important;
  height: 40px !important;
  font-size: 1.1rem !important;
  padding: 0 !important;
  margin: 0 !important;
  min-width: 44px !important;
  min-height: 44px !important;
  background: var(--bg-3) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
}

.rc-cursor-btn.active {
  background: var(--accent-glow) !important;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}

/* rc button sizes handled in main mobile media block */

/* ── Connect Screen ─────────────────────────────────────── */
.remote-connect {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 24px;
  text-align: center;
  gap: 12px;
}

.rc-logo {
  font-size: 3rem;
  color: var(--accent);
  margin-bottom: 8px;
  animation: float 3s ease-in-out infinite;
}

.remote-connect h1 {
  font-size: 2rem;
  margin-bottom: 4px;
}
.remote-connect p {
  color: var(--text-2);
  margin-bottom: 20px;
}

.rc-input-row {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 320px;
}

.rc-input-row input {
  flex: 1;
  min-width: 0; /* gives way to a longer button label ("Подключиться") */
  padding: 12px 16px;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  outline: none;
}

.rc-input-row input:focus {
  border-color: var(--accent);
}
.rc-hint {
  font-size: 0.8rem;
  color: var(--text-3);
  margin-top: 8px;
}

/* ── Remote Pad ─────────────────────────────────────────── */
.remote-pad {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 0 0 40px;
}

.rc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}

.rc-session-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--bg-3);
  color: var(--text-2);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.rc-status {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.rc-status.connected {
  color: var(--success);
}
.rc-status.disconnected {
  color: var(--danger);
}

/* ── Slide Preview ──────────────────────────────────────── */
.rc-slide-preview {
  text-align: center;
  padding: 12px 20px 8px;
}

.rc-slide-box {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.rc-slide-divider {
  color: var(--text-3);
  font-size: 1.2rem;
}

.rc-slide-label {
  color: var(--text-3);
  font-size: 0.7rem;
  margin-top: 4px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── Navigation Buttons ─────────────────────────────────── */
.rc-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 20px;
  margin-top: 8px;
}

.rc-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  background: var(--bg-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: var(--transition);
}

.rc-arrow {
  font-size: 1.8rem;
  line-height: 1;
  color: var(--text-2);
}

.rc-btn:hover,
.rc-btn:active {
  background: var(--accent-glow);
  border-color: var(--accent);
  transform: scale(0.98);
}
.rc-btn:active .rc-arrow {
  color: var(--accent);
}

.rc-btn-next {
  border-color: var(--accent);
}
.rc-btn-next .rc-arrow {
  color: var(--accent);
}

/* ── Jump Input ─────────────────────────────────────────── */
.rc-jump {
  padding: 8px 20px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.rc-jump label {
  display: block;
  font-size: 0.65rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.rc-jump-row {
  display: flex;
  gap: 4px;
}

.rc-jump-row input {
  flex: 1;
  padding: 4px 8px;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  outline: none;
  font-family: var(--font-mono);
}

.rc-swipe-hint {
  text-align: center;
  color: var(--text-3);
  font-size: 0.62rem;
  margin-top: 8px;
  padding: 0 20px;
}

/* ── Tab Bar ─────────────────────────────────────────────── */
.rc-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}

.rc-tab {
  flex: 1;
  padding: 12px 8px;
  background: none;
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}

.rc-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.rc-tab:hover:not(.active) {
  color: var(--text);
}

/* ── Notes Tab ───────────────────────────────────────────── */
#tabNotes {
  flex-direction: column;
  flex: 1;
  padding: 0;
  overflow: hidden;
}

.rc-notes-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  gap: 8px;
  flex-shrink: 0;
}

.notes-label {
  font-size: 0.8rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.notes-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.notes-font-btn {
  width: 30px;
  height: 30px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-3);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.notes-font-btn:hover {
  color: var(--text);
  border-color: var(--border-2);
}

.rc-notes-area {
  flex: 1;
  width: 100%;
  padding: 16px;
  background: var(--bg);
  color: var(--text);
  border: none;
  resize: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  caret-color: var(--accent);
}
.rc-notes-area::placeholder {
  color: var(--text-3);
}

/* ── Teleprompter Overlay ────────────────────────────────── */
.teleprompter-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: #000;
  display: flex;
  flex-direction: column;
}

.tp-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.tp-title {
  font-family: var(--font-head);
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.5);
  flex: 1;
}

.tp-speed-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.5);
}

.tp-speed-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.tp-speed-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

.tp-speed-btn:active {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0.95);
}

.tp-text-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 40px 32px 120px;
  scrollbar-width: none;
}
.tp-text-wrap::-webkit-scrollbar {
  display: none;
}

.tp-text {
  font-family: var(--font-body);
  font-size: clamp(1.4rem, 5vw, 2.2rem);
  line-height: 1.8;
  color: #fff;
  max-width: 800px;
  margin: 0 auto;
}

.tp-text p {
  margin-bottom: 2em;
}

.tp-text-wrap::before,
.tp-text-wrap::after {
  content: "";
  position: sticky;
  display: block;
  height: 60px;
  z-index: 2;
  pointer-events: none;
}
.tp-text-wrap::before {
  top: 0;
  background: linear-gradient(to bottom, #000, transparent);
  margin-bottom: -60px;
}
.tp-text-wrap::after {
  bottom: 0;
  background: linear-gradient(to top, #000, transparent);
  margin-top: -60px;
}

.tp-speed-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  min-width: 36px;
  text-align: center;
  padding: 0 4px;
}

/* ── Teleprompter Slide Controls ────────────────────────── */
.tp-slide-controls {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 510;
  backdrop-filter: blur(8px);
}

.tp-slide-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.tp-slide-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

.tp-slide-btn:active {
  transform: scale(0.95);
}

.tp-slide-indicator {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
  min-width: 60px;
  text-align: center;
}

/* ── Fullscreen Remote Pad ───────────────────────────────── */
.rc-fs-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
}

.rfs-counter {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(3rem, 18vw, 8rem);
  color: var(--accent);
  letter-spacing: -0.03em;
}

.rfs-nav {
  display: flex;
  gap: 24px;
  width: 100%;
  max-width: 500px;
  padding: 0 24px;
}

.rfs-btn {
  flex: 1;
  padding: 40px 20px;
  font-size: 3rem;
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text);
  border: 2px solid var(--border-2);
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.rfs-btn:active {
  transform: scale(0.95);
}

.rfs-btn.rfs-next {
  border-color: var(--accent);
  color: var(--accent);
}

.rfs-exit {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 8px 16px;
  font-size: 0.8rem;
  background: var(--bg-3);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ══════════════════════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════════════════════ */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-3);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 20px;
  border: 1px solid var(--border-2);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.25s,
    transform 0.25s;
  z-index: 999;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ══════════════════════════════════════════════════════════
   FULLSCREEN
   ══════════════════════════════════════════════════════════ */

:fullscreen .topbar,
:-webkit-full-screen .topbar,
:-moz-full-screen .topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
}

:fullscreen .slide-area,
:-webkit-full-screen .slide-area {
  height: 100vh;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE FIRST
   ══════════════════════════════════════════════════════════ */

/* ─── Topbar: single-row on all screen sizes ─────────────── */
@media (max-width: 768px) {
  /* Force single row, never wrap. The counter is hidden, so its column and
     both column gaps go; the right group may shrink instead of pushing the
     bar wider than a narrow phone. */
  .topbar {
    padding: 0 8px;
    height: 48px;
    grid-template-columns: minmax(0, 1fr) 0 minmax(0, max-content);
    column-gap: 0;
    flex-wrap: nowrap;
    overflow: visible;
  }
  .topbar-left {
    gap: 5px;
    padding-inline-end: 6px;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
  }
  .topbar-right {
    gap: 2px;
    min-width: 0;
    flex-wrap: nowrap;
    align-items: center;
  }
  .topbar-center {
    display: none;
  }

  /* Shrink logo */
  .topbar-left .logo {
    font-size: 0.8rem;
    white-space: nowrap;
  }
  .topbar-left .logo svg {
    width: 14px;
    height: 14px;
  }

  /* Hide session name to save space; badge is enough */
  .session-name-display {
    display: none !important;
  }
  .session-badge {
    font-size: 0.62rem;
    padding: 2px 5px;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* All topbar action buttons → icon-only (hide text, keep SVG) */
  #addFileBtn,
  #playlistBtn,
  #pollBtn,
  #showRemoteBtn,
  #showViewerBtn,
  #endSessionBtn {
    padding: 5px 7px;
    min-width: 30px;
    width: auto;
    gap: 0;
    font-size: 0 !important; /* hides text content */
    line-height: 1;
  }
  #addFileBtn svg,
  #playlistBtn svg,
  #pollBtn svg,
  #showRemoteBtn svg,
  #showViewerBtn svg,
  #endSessionBtn svg {
    width: 15px !important;
    height: 15px !important;
    margin: 0 !important;
    flex-shrink: 0;
  }

  #playlistBtn .playlist-count:not(:empty) {
    margin-inline-start: 4px;
    padding: 0 5px;
  }

  /* Small icon-buttons */
  .topbar-right .btn-icon {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
  }

  /* Nav */
  .nav-btn {
    width: 36px;
    height: 56px;
    opacity: 0.8;
    font-size: 1.5rem;
  }
  .slide-strip {
    height: 58px;
    padding: 6px 10px;
  }
  .strip-thumb {
    height: 42px;
    min-width: 56px;
  }
}

/* ─── Modals: bottom sheet on mobile ─────────────────────── */
@media (max-width: 768px) {
  .modal-backdrop {
    padding: 0 !important;
    align-items: flex-end !important;
  }
  .modal-card {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    border-radius: 16px 16px 0 0 !important;
    padding: 20px 18px 32px !important;
    /* Slide up animation */
    animation: mobileSheetUp 0.28s cubic-bezier(0.32, 0.72, 0, 1) !important;
  }
  @keyframes mobileSheetUp {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }
  .modal-wide {
    max-width: 100% !important;
  }
  /* IP input row: stack vertically */
  .ip-input-group {
    flex-direction: column;
  }
  .ip-input-group .btn {
    width: 100%;
  }
  /* QR: slightly smaller on narrow screens */
  #qrCanvas,
  #viewerQrCanvas {
    width: 170px !important;
    height: 170px !important;
  }
  /* Modal close: bigger tap target */
  .modal-close {
    width: 36px;
    height: 36px;
  }
}

/* ─── Setup overlay ──────────────────────────────────────── */
@media (max-width: 768px) {
  .setup-overlay {
    padding: 16px;
    align-items: flex-start;
    overflow-y: auto;
  }
  .setup-card {
    max-width: 100%;
  }
}

/* ─── Touch: nav + strip always visible ──────────────────── */
@media (hover: none) {
  .nav-btn,
  .slide-area .nav-btn,
  .slide-area:hover .nav-btn {
    opacity: 0.75;
  }
  .slide-strip,
  .slide-area .slide-strip,
  .slide-area:hover .slide-strip {
    opacity: 0.9;
  }
}

/* ─── Remote page ────────────────────────────────────────── */
@media (max-width: 600px) {
  .rc-header {
    padding: 10px 12px;
    gap: 6px;
  }
  .rc-session-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
  }
  .rc-btn {
    padding: 18px 10px;
  }
  .rc-arrow {
    font-size: 2rem;
  }
  .rc-notes-area {
    min-height: 120px;
  }
  .tp-toolbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }
  .rc-jump-row {
    flex-direction: column;
  }
  .rc-jump-row input {
    width: 100%;
  }
  .rc-fullscreen-btn,
  .rc-cursor-btn {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    font-size: 1rem !important;
  }
  .rc-cursor-btn {
    color: var(--text) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .rc-cursor-btn.active {
    background: var(--accent-glow) !important;
    color: var(--accent) !important;
  }
}

/* ─── Viewer page ────────────────────────────────────────── */
@media (max-width: 600px) {
  .vs-header {
    padding: 8px 12px;
    gap: 6px;
  }
  .viewer-connect {
    padding: 32px 16px;
  }
  .vc-input-row,
  .vc-password-row {
    max-width: 100%;
  }
}

/* ─── Access page ────────────────────────────────────────── */
@media (max-width: 600px) {
  .access-card {
    padding: 20px 14px;
  }
  .action-buttons {
    grid-template-columns: 1fr;
  }
  .filter-row {
    flex-wrap: wrap;
  }
}

/* ══════════════════════════════════════════════════════════
   QR SECTIONS (Dual QR layout)
   ══════════════════════════════════════════════════════════ */

.qr-sections {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin: 16px 0;
}

.qr-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.qr-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-2);
  margin: 0;
}

.qr-desc {
  font-size: 0.75rem;
  color: var(--text-3);
  margin: 0;
}

@media (max-width: 600px) {
  .qr-sections {
    flex-direction: column;
    gap: 16px;
  }
}

/* ══════════════════════════════════════════════════════════
   VIEWER PAGE
   ══════════════════════════════════════════════════════════ */

.viewer-page {
  background: var(--bg);
  min-height: 100vh;
}

.viewer-connect {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  text-align: center;
}

.vc-logo {
  font-size: 3rem;
  margin-bottom: 16px;
}

.viewer-connect h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.viewer-connect > p {
  color: var(--text-2);
  margin-bottom: 24px;
  font-size: 0.95rem;
}

.vc-input-row {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 320px;
}

.vc-input-row input {
  flex: 1;
  min-width: 0; /* gives way to a longer button label ("Подключиться") */
  padding: 12px 16px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.vc-input-row input:focus {
  outline: none;
  border-color: var(--accent);
}

/* The Russian button label ("Подключиться") is twice as wide as "Connect":
   the row grows so the field still shows the whole 16-character code, and on
   a phone the button goes under the field. English keeps its layout. */
:lang(ru) :is(.rc-input-row, .vc-input-row) {
  max-width: 380px;
}
@media (max-width: 480px) {
  :lang(ru) :is(.rc-input-row, .vc-input-row) {
    flex-direction: column;
  }
}

.vc-password-row {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 320px;
}

.vc-password-row input {
  flex: 1;
  padding: 12px 16px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-1);
  color: var(--text);
}

.vc-password-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.vc-hint {
  margin-top: 12px;
  font-size: 0.875rem;
  min-height: 1.2em;
}

.viewer-slide {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.vs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}

/* On a phone the name, the code, the counters and the buttons do not fit one
   row (Russian labels are longer still): they wrap, so the language button
   and the ones after it stay on the screen. */
@media (max-width: 600px) {
  .vs-header {
    flex-wrap: wrap;
    row-gap: 6px;
  }
  .vs-session-name,
  .vs-viewer-count,
  .vs-status {
    white-space: nowrap;
  }
}

.vs-session-badge {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-2);
  background: var(--bg-3);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.vs-viewer-count {
  font-size: 0.75rem;
  color: var(--text-3);
  background: var(--bg-2);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  margin-left: 8px;
  border: 1px solid var(--border);
}

.vs-status {
  font-size: 0.8rem;
  font-weight: 500;
}

.vs-status.connected {
  color: var(--success);
}

.vs-status.disconnected {
  color: var(--danger);
}

.vs-canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  padding: 16px;
}

/* Positions the canvas and the remote cursor in the same box. */
.vs-stage {
  position: relative;
  flex-shrink: 0;
  line-height: 0;
}

#viewerCanvas {
  display: block;
  box-shadow: var(--shadow);
  background: white;
}

.vs-waiting {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
  color: var(--text-2);
  font-size: 0.95rem;
}

.vs-waiting-icon {
  font-size: 3rem;
}

.vs-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font-size: 0.875rem;
}

.vs-error {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--bg);
  color: var(--danger);
  font-size: 0.9rem;
  text-align: center;
  padding: 20px;
}

.vs-error-icon {
  font-size: 2.5rem;
}

.vs-waiting-hint {
  font-size: 0.8rem;
  color: var(--text-3);
  max-width: 280px;
  text-align: center;
  margin-top: 8px;
  line-height: 1.4;
}

.vs-waiting-btn {
  margin-top: 16px;
  padding: 10px 20px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
}

.vs-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.vs-counter {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--text);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  backdrop-filter: blur(4px);
}

.vs-reconnecting {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(14, 14, 18, 0.9);
  color: var(--text);
  z-index: 1000;
}

.vs-fullscreen-btn {
  background: transparent;
  border: none;
  color: var(--text-2);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.vs-fullscreen-btn:hover {
  background: var(--bg-3);
  color: var(--accent);
}

.viewer-slide.fs-mode {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
}

.viewer-slide.fs-mode .vs-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.viewer-slide.fs-mode .vs-header:hover {
  opacity: 1;
}

.viewer-slide.fs-mode .vs-canvas-wrap {
  height: 100vh;
  background: black;
}

.orient-portrait .vs-canvas-wrap {
  max-width: 100%;
}

.orient-landscape .vs-canvas-wrap {
  max-height: 100%;
}

/* Portrait documents fill the width and scroll vertically. */
.orient-portrait .vs-canvas-wrap {
  overflow-y: auto;
  align-items: flex-start;
}

/* ══════════════════════════════════════════════════════════
   ORIENTATION TOGGLE (Viewer Modal)
   ══════════════════════════════════════════════════════════ */

.orientation-row {
  margin: 16px 0;
  padding: 16px;
  background: var(--bg-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.orientation-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.orientation-toggle {
  display: flex;
  gap: 8px;
}

.orientation-btn {
  flex: 1;
  padding: 10px 16px;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.2s ease;
}

.orientation-btn:hover {
  background: var(--bg-3);
  border-color: var(--accent);
}

.orientation-btn.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.orientation-hint {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-3);
}

/* ══════════════════════════════════════════════════════════
   QR SINGLE (Single QR layout for separate modals)
   ══════════════════════════════════════════════════════════ */

.qr-single {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}

.qr-single canvas {
  max-width: 200px;
  max-height: 200px;
}

/* ══════════════════════════════════════════════════════════
   REMOTE APPROVAL DIALOG
   ══════════════════════════════════════════════════════════ */

.remote-approval-dialog {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 300;
  /* Wide enough for the three Russian button labels in one row. */
  max-width: min(400px, calc(100vw - 40px));
}

.remote-approval-content {
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.remote-approval-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.remote-approval-content h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text);
}

.remote-approval-header .btn-close {
  background: transparent;
  border: none;
  color: var(--text-3);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.remote-approval-header .btn-icon:hover {
  background: var(--bg-2);
  color: var(--text);
}

/* ── Unified Button Container ─────────────────────────── */
.btn-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.btn-group .btn {
  width: 100%;
  justify-content: center;
  display: inline-flex;
  align-items: center;
}

.remote-approval-content p {
  margin: 0 0 8px;
  color: var(--text-2);
  font-size: 0.95rem;
}

.remote-approval-content .remote-id {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-3);
  margin: 12px 0;
  padding: 8px 12px;
  background: var(--bg-2);
  border-radius: 6px;
}

.remote-approval-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
  justify-content: center;
}

.remote-approval-buttons button {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
}

.btn-approve {
  background: var(--accent);
  color: white;
}

.btn-approve:hover {
  background: var(--accent-hover);
}

.btn-reject {
  background: var(--bg-2);
  color: var(--text-2);
  border: 1px solid var(--border-2);
}

.btn-reject:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.btn-block {
  background: var(--bg-2);
  color: var(--text-3);
  border: 1px solid var(--border-2);
  font-size: 0.85rem;
  padding: 10px 16px;
}

.btn-block:hover {
  background: #1a1a2e;
  color: var(--danger);
  border-color: var(--danger);
}

/* ══════════════════════════════════════════════════════════
   REMOTE CURSOR (for Viewers) - Exact match to presenter
   ══════════════════════════════════════════════════════════ */

.remote-cursor {
  position: absolute;
  width: 24px;
  height: 24px;
  background: radial-gradient(
    circle,
    rgba(255, 0, 0, 0.9) 0%,
    rgba(255, 0, 0, 0.5) 40%,
    rgba(255, 0, 0, 0.2) 70%,
    transparent 100%
  );
  border-radius: 50%;
  pointer-events: none;
  z-index: 100;
  transform: translate(-50%, -50%);
  transition: none;
  opacity: 0;
  box-shadow:
    0 0 20px rgba(255, 0, 0, 0.8),
    0 0 40px rgba(255, 0, 0, 0.4),
    inset 0 0 10px rgba(255, 0, 0, 0.3);
}

.remote-cursor.active {
  opacity: 1;
  animation: cursorPulse 2s infinite;
}

@keyframes cursorPulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
  }
}

.remote-cursor::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  background: #ff0000;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
}

/* ─── Arabic typeface ────────────────────────────────────────────────────────── */
@font-face {
  font-family: "Amiri";
  src: url("/fonts/Amiri-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ══════════════════════════════════════════════════════════
   ADDITIONS
   ══════════════════════════════════════════════════════════ */

/* Session name in the presenter top bar (click to rename). */
.session-name-display {
  background: none;
  border: 1px dashed transparent;
  border-radius: var(--radius-sm);
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  margin-left: 12px;
  max-width: 220px;
  overflow: hidden;
  padding: 2px 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-name-display:hover,
.session-name-display:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.upload-zone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.upload-zone.busy {
  pointer-events: none;
  opacity: 0.6;
}

/* Thumbnails are buttons for keyboard access; reset button chrome. */
.strip-thumb {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.strip-thumb canvas {
  width: auto;
  height: 100%;
}

/* Viewer "presenter offline" notice. */
.vs-presenter-offline {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--warning);
  font-size: 0.8rem;
  pointer-events: none;
}

.vs-reconnecting button {
  margin-top: 12px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ══════════════════════════════════════════════════════════
   ACCESS PAGE (/access)
   ══════════════════════════════════════════════════════════ */

.access-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  text-align: center;
}
.access-card {
  background: var(--bg-2);
  padding: 40px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.access-card h1 {
  margin-bottom: 12px;
  font-size: 1.8rem;
  color: var(--text);
}
.access-card p {
  color: var(--text-2);
  margin-bottom: 30px;
  font-size: 0.95rem;
}
.session-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-right: 4px;
}
.session-list::-webkit-scrollbar {
  width: 6px;
}
.session-list::-webkit-scrollbar-track {
  background: transparent;
}
.session-list::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 3px;
}
.search-wrapper {
  position: relative;
  margin-top: 20px;
}
.search-wrapper svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-1);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease;
}
.search-input:focus {
  border-color: var(--accent);
}
.search-input::placeholder {
  color: var(--text-3);
}
.session-hidden {
  display: none !important;
}
.session-item {
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 20px;
  text-align: left;
  transition:
    transform 0.2s,
    border-color 0.2s;
}
.session-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}
.session-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.session-id {
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--accent);
  font-size: 1.2rem;
}
.session-filename {
  font-size: 0.85rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.session-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.session-time {
  font-size: 0.75rem;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.session-viewers {
  font-size: 0.75rem;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.filter-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  align-items: center;
}
.filter-row label {
  font-size: 0.8rem;
  color: var(--text-3);
  white-space: nowrap;
}
.sort-select, .time-filter-select {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  outline: none;
}
.sort-select:focus, .time-filter-select:focus {
  border-color: var(--accent);
}
.action-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.action-buttons .btn {
  justify-content: center;
  text-decoration: none;
}
.no-sessions {
  padding: 30px;
  color: var(--text-3);
  font-style: italic;
}
.refresh-btn {
  margin-top: 20px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
}
.refresh-btn:hover {
  background: var(--bg-3);
  color: var(--text);
}
.session-state {
  font-size: 0.75rem;
  font-weight: 600;
}
.session-state.online {
  color: var(--success);
}
.session-state.offline {
  color: var(--text-3);
}
.session-lock svg {
  vertical-align: middle;
}

/* ══════════════════════════════════════════════════════════
   SMALL ANIMATIONS & STATES
   ══════════════════════════════════════════════════════════ */

/* Viewer: brief amber flash when the slide changes. */
.vs-canvas-wrap.vs-flash::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(240, 165, 0, 0.1);
  pointer-events: none;
  animation: vsFlash 0.25s ease forwards;
}
@keyframes vsFlash {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Remote: the slide number pops when the slide changes. */
.rc-slide-box.pulse {
  animation: rcPulse 0.25s ease;
}
@keyframes rcPulse {
  from {
    transform: scale(1.18);
    color: var(--accent-2);
  }
  to {
    transform: scale(1);
  }
}

/* ══════════════════════════════════════════════════════════
   v2.1 — annotations, zoom & spotlight, polls, library,
   remote previews, free browsing, language toggle
   ══════════════════════════════════════════════════════════ */

/* ── Language toggle & shared form fields ─────────────────── */
.lang-toggle {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.rc-connect-tools {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  margin-bottom: 8px;
}
.field-label {
  display: block;
  text-align: start;
  color: var(--text-2);
  font-size: 0.85rem;
  margin-bottom: 6px;
}
.field-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font-body);
}
.field-input:focus {
  outline: none;
  border-color: var(--accent);
}
textarea.field-input {
  resize: vertical;
}
.install-btn {
  margin-top: 16px;
}

/* Arabic: a typeface with the glyphs, and no letter spacing (it breaks joined letters). */
[dir="rtl"] body {
  font-family: "Amiri", var(--font-body);
}
[dir="rtl"] * {
  letter-spacing: 0 !important;
}
[dir="rtl"] .rc-preview-label,
[dir="rtl"] .rc-slide-label,
[dir="rtl"] .notes-label {
  text-transform: none;
}

/* ── Slide stage layers ───────────────────────────────────── */
.zoom-layer {
  position: relative;
  line-height: 0;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}
.vs-stage {
  overflow: hidden;
}
.annotation-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
  touch-action: none;
}
.annotation-layer.drawing {
  pointer-events: auto;
  cursor: crosshair;
}
.spotlight-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.spotlight-layer.active {
  opacity: 1;
}

/* ── Drawing toolbar (presenter) ──────────────────────────── */
.draw-toolbar {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 6px;
  background: rgba(14, 14, 18, 0.75);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
  z-index: 12;
  opacity: 0.35;
  transition: opacity 0.2s;
}
.draw-toolbar:hover,
.draw-toolbar:focus-within,
.slide-area:has(.slide-wrapper.drawing) .draw-toolbar {
  opacity: 1;
}
.draw-tool {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #e8e8f0;
  border: 1px solid transparent;
}
.draw-tool:hover {
  background: rgba(255, 255, 255, 0.08);
}
.draw-tool.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}
.slide-area .nav-prev {
  left: 64px;
}

/* ── Colour swatches ──────────────────────────────────────── */
.color-swatches {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.color-swatches.vertical {
  flex-direction: column;
  padding: 4px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  padding: 0;
  flex-shrink: 0;
}
.color-swatch.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
  transform: scale(1.15);
}

/* ── Polls ────────────────────────────────────────────────── */
.poll-overlay {
  position: absolute;
  z-index: 20;
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.presenter-poll {
  right: 16px;
  bottom: 80px;
  width: min(380px, calc(100% - 32px));
}
.viewer-poll {
  left: 12px;
  right: 12px;
  bottom: 60px;
  max-width: 460px;
  margin-inline: auto;
  max-height: 60vh;
  overflow-y: auto;
}
.poll-minimize {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--text-2);
  font-size: 1.1rem;
}
.poll-reopen {
  position: absolute;
  bottom: 60px;
  inset-inline-start: 16px;
  z-index: 20;
  padding: 8px 14px;
  border-radius: 20px;
  background: var(--accent);
  color: #0a0a0a;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.poll-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.poll-status {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.poll-status.open {
  color: var(--success);
}
.poll-status.open::before {
  content: "● ";
}
.poll-status.closed {
  color: var(--text-3);
}
.poll-question {
  font-family: var(--font-head);
  font-size: 1.1rem;
  line-height: 1.35;
  color: var(--text);
  padding-inline-end: 24px;
}
.poll-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.poll-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  text-align: start;
  overflow: hidden;
  font-size: 0.9rem;
  width: 100%;
}
button.poll-option:hover {
  border-color: var(--accent);
}
.poll-option.chosen {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.poll-bar {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  background: var(--accent-glow);
  transition: width 0.4s ease;
  pointer-events: none;
}
.poll-option-label {
  position: relative;
  flex: 1;
}
.poll-option-value {
  position: relative;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-2);
}
.poll-total {
  font-size: 0.75rem;
  color: var(--text-3);
}
.poll-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.poll-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: start;
}
.poll-form input,
.poll-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
}
#pollBtn.active {
  border-color: var(--success);
  color: var(--success);
}

/* ── Toggle row (viewer modal) ────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: start;
  cursor: pointer;
}
.toggle-row input {
  margin-top: 3px;
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
}
.toggle-row strong {
  display: block;
  font-size: 0.9rem;
  color: var(--text);
}
.toggle-row small {
  color: var(--text-3);
  font-size: 0.75rem;
}

/* ── Library ──────────────────────────────────────────────── */
.library {
  margin-top: 20px;
  text-align: start;
}
.library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.library-head h2 {
  font-size: 0.85rem;
  color: var(--text-2);
  font-family: var(--font-body);
  font-weight: 600;
}
.library-remember {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-3);
  cursor: pointer;
}
.library-remember input {
  accent-color: var(--accent);
}
.library-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}
.library-item {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  overflow: hidden;
}
.library-open {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 12px;
  background: transparent;
  color: var(--text);
  text-align: start;
}
.library-open:hover {
  background: var(--accent-glow);
}
.library-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
}
.library-meta {
  font-size: 0.7rem;
  color: var(--text-3);
}
.library-remove {
  width: 36px;
  background: transparent;
  color: var(--text-3);
  border-inline-start: 1px solid var(--border);
}
.library-remove:hover {
  color: var(--danger);
}
.library-note {
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--text-3);
}

/* Conversion has no measurable progress: animate the bar instead. */
.progress-fill.indeterminate {
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 50%, var(--accent) 100%);
  background-size: 200% 100%;
  animation: progressSlide 1.2s linear infinite;
}
@keyframes progressSlide {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: 0 0;
  }
}

/* ── Remote: header, previews, tools ──────────────────────── */
.rc-header {
  gap: 8px;
}
.rc-header-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.rc-session-name {
  font-weight: 600;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rc-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.rc-previews {
  max-width: 960px;
  margin-inline: auto;
  width: 100%;
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 10px;
  padding: 12px 16px 4px;
  align-items: start;
}
.rc-preview-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  color: var(--text-3);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.rc-preview-label .rc-slide-box {
  font-size: 1rem;
}
.rc-stage-box {
  position: relative;
  display: flex;
  justify-content: center;
  min-height: 80px;
}
.rc-stage {
  position: relative;
  line-height: 0;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--border-2);
}
.rc-stage #rcCanvas {
  display: block;
  background: #fff;
}
.rc-touch-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  touch-action: pan-y;
}
.rc-stage:not([data-tool="none"]) .rc-touch-layer {
  touch-action: none;
  cursor: crosshair;
}
.rc-stage[data-tool="pen"] .rc-touch-layer,
.rc-stage[data-tool="highlighter"] .rc-touch-layer {
  display: none;
}
.zoom-indicator {
  position: absolute;
  z-index: 7;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  transition: all 0.2s ease;
}
.rc-stage-empty {
  color: var(--text-3);
  font-size: 0.8rem;
  text-align: center;
  padding: 24px 8px;
  border: 1px dashed var(--border-2);
  border-radius: var(--radius-sm);
  width: 100%;
}
.rc-next-box {
  position: relative;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.rc-next-box canvas {
  display: block;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 0 0 1px var(--border-2);
  opacity: 0.85;
}
.rc-next-end {
  color: var(--text-3);
  font-size: 0.7rem;
  text-align: center;
  padding-top: 12px;
}
.rc-tools {
  padding: 8px 16px 0;
}
.rc-tool-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}
.rc-tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 2px;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.62rem;
  -webkit-tap-highlight-color: transparent;
}
.rc-tool-icon {
  display: flex;
  line-height: 0;
}
.rc-tool.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}
.rc-tool-hint {
  min-height: 1.2em;
  margin: 6px 0 0;
  font-size: 0.72rem;
  color: var(--text-3);
  text-align: center;
}
.rc-tool-options {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.zoom-levels {
  display: flex;
  gap: 4px;
}
.zoom-levels .btn.active {
  border-color: var(--accent);
  color: var(--accent);
}
.rc-notes-section {
  margin: 16px 16px 0;
  padding-top: 12px;
}
.rc-notes-area:disabled {
  opacity: 0.5;
}
.rc-notes-footer {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
}
.rc-notes-footer label {
  cursor: pointer;
}
.rc-poll {
  margin: 16px 16px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}
.rc-poll summary {
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
}
.rc-poll-badge {
  margin-inline-start: 6px;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--success);
  color: #0a0a0a;
  font-size: 0.65rem;
}
.rc-poll-body {
  padding: 0 14px 14px;
}
.tp-slide-heading {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 0.6em;
  opacity: 0.7;
}
.tp-text section {
  opacity: 0.55;
  transition: opacity 0.3s;
}
.tp-text section.current {
  opacity: 1;
}

@media (max-width: 420px) {
  .rc-previews {
    grid-template-columns: 1fr;
  }
  .rc-next {
    display: grid;
    grid-template-columns: auto 90px;
    align-items: center;
    gap: 8px;
  }
  .rc-next-box {
    aspect-ratio: auto;
  }
}

/* ── Viewer: free browsing ────────────────────────────────── */
.vs-browse {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 15;
}
.vs-browse .vs-counter {
  position: static;
}
.vs-browse-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.7);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  backdrop-filter: blur(4px);
}
.vs-browse-btn:disabled {
  opacity: 0.3;
  cursor: default;
}
.vs-live-btn {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  padding: 8px 16px;
  border-radius: 20px;
  background: var(--danger);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  animation: livePulse 2s infinite;
}
@keyframes livePulse {
  50% {
    box-shadow: 0 0 0 6px rgba(224, 85, 85, 0.25);
  }
}
a.vs-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}

/* ══════════════════════════════════════════════════════════
   Playlist — video items, playlist panel, remote list
   ══════════════════════════════════════════════════════════ */

.media-video {
  /* Fill the stage, keep the aspect ratio. Same margins as the slide
     (see fit() in presenter.js): 60px / 40px, none in fullscreen. */
  width: calc(100% - 60px);
  height: calc(100% - 40px);
  max-width: calc(100% - 60px);
  max-height: calc(100% - 40px);
  object-fit: contain;
  background: #000;
  border-radius: 4px;
  box-shadow: var(--shadow);
  outline: none;
}
.vs-canvas-wrap > .media-video {
  /* the wrap already has its own padding */
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}
:fullscreen .slide-area > .media-video,
:-webkit-full-screen .slide-area > .media-video {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border-radius: 0;
  box-shadow: none;
}
/* The poll results sit just above the slide strip; a video has its transport
   bar (.video-bar) there, and it is taller than the strip. */
.slide-area:has(> .media-video:not([hidden])) .presenter-poll {
  bottom: 120px;
}
.viewer-slide.fs-mode .vs-canvas-wrap:has(> .media-video:not([hidden])) {
  padding: 0;
}
.viewer-slide.fs-mode .vs-canvas-wrap > .media-video {
  border-radius: 0;
  box-shadow: none;
}

/* Presenter top bar: with every label shown the right group needs about
   920px, the counter about 210px and the left group at least 200px, so
   below ~1400px the secondary buttons drop their labels (icon, title and
   accessible name stay). The <=768px rule below takes over on phones. */
@media (max-width: 1400px) {
  .topbar-right .btn > span:not(.playlist-count) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .topbar-right .btn svg {
    margin: 0 !important;
  }
  .topbar-right .btn {
    padding: 6px 9px;
    gap: 0;
  }
  .topbar-right #endSessionBtn {
    margin-inline-start: 4px !important;
  }
}

.playlist-count:not(:empty) {
  margin-inline-start: 6px;
  padding: 0 7px;
  border-radius: 10px;
  background: var(--accent);
  color: #0a0a0a;
  font-size: 0.7rem;
  font-weight: 700;
}

.playlist-panel {
  position: absolute;
  top: 12px;
  bottom: 12px;
  inset-inline-end: 12px;
  width: min(320px, calc(100% - 24px));
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.playlist-panel[hidden] {
  display: none;
}
.playlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.playlist-header h2 {
  margin: 0;
  font-size: 0.95rem;
}
.playlist-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.playlist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
}
.playlist-item:hover,
.playlist-item.active {
  border-color: var(--accent);
}
.playlist-item.active {
  background: var(--accent-glow);
}
.playlist-item.dragging {
  opacity: 0.4;
}
.playlist-item.drop-target {
  box-shadow: 0 -2px 0 var(--accent);
}
.playlist-thumb {
  flex: 0 0 64px;
  height: 40px;
  border-radius: 3px;
  overflow: hidden;
  background: #000;
}
.playlist-thumb img,
.playlist-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.playlist-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.playlist-name {
  font-size: 0.82rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.playlist-sub {
  font-size: 0.7rem;
  color: var(--text-3);
}
.playlist-remove {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-3);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.playlist-remove:hover {
  border-color: #e5484d;
  color: #e5484d;
}
.playlist-hint {
  margin: 0;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--text-3);
}

.rc-playlist-list {
  list-style: none;
  margin: 0;
  padding: 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rc-playlist-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.rc-playlist-item.active {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.rc-playlist-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-kind {
  flex: none;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--border);
  color: var(--text-2);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* ── Synced video ───────────────────────────────────────── */
.vs-unlock {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  background: rgba(14, 14, 18, 0.94);
  text-align: center;
}
.vs-unlock[hidden] {
  display: none;
}
.vs-unlock-btn {
  min-width: min(320px, 80vw);
  padding: 18px 28px;
  font-size: 1.2rem;
}
.vs-unlock-hint {
  margin: 0;
  max-width: 420px;
  color: var(--text-3);
  font-size: 0.85rem;
}
#vsMuteBtn[aria-pressed="true"] .vs-sound-waves {
  display: none;
}
#vsMuteBtn[aria-pressed="true"] {
  color: var(--text-3);
}

/* ── Presenter: transport bar of the video on screen ─────── */
.video-bar {
  position: absolute;
  inset-inline: 30px;
  bottom: 20px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px;
  /* Dark in both themes: it lies on the picture. */
  background: rgba(14, 14, 18, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  color: #e8e8f0;
  /* This is the room's projected screen: the bar is out of the picture until
     someone reaches for it. While it is invisible it takes no clicks or taps:
     a press on a button nobody can see would pause the room. Tab still
     reaches it (:focus-within shows it). */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.video-bar[hidden] {
  display: none;
}
/* Set by the script (see barVisible in lib/transport.js):
   .awake  — the pointer was moved or pressed over the stage a moment ago, or
             the room is not playing. Not :hover: a mouse left where it
             pressed Play would keep the bar on the picture for the whole
             video. Touch screens follow the same rule: a tap shows the bar.
   .pinned — the room is paused, or this screen waits for a press. */
.video-bar.awake,
.video-bar:focus-within,
.video-bar.pinned {
  opacity: 1;
  pointer-events: auto;
}
/* With the bar goes the mouse cursor: it would lie on the picture just the same. */
.slide-area.video-idle,
.slide-area.video-idle * {
  cursor: none;
}
.video-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
/* Above the controls it points to, wrapping inside the bar. */
.video-hint {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.35;
  color: #ffbe3d;
  overflow-wrap: anywhere;
}
.video-btn {
  flex: none;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.video-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.video-btn .icon-pause,
.video-btn.playing .icon-play {
  display: none;
}
.video-btn.playing .icon-pause {
  display: block;
}
/* The room plays but this screen waits for a press. */
.video-btn.held {
  border-color: var(--accent);
  color: var(--accent);
}
.video-btn[aria-pressed="true"] .vs-sound-waves {
  display: none;
}
.video-btn[aria-pressed="true"] {
  opacity: 0.6;
}
.video-time {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  white-space: nowrap;
}
.video-seek {
  flex: 1;
  min-width: 80px;
  accent-color: var(--accent);
}
.video-seek:disabled {
  opacity: 0.4;
}
.video-audience {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.75rem;
  color: #b4b4c8;
  white-space: nowrap;
}
.video-audience:empty {
  display: none;
}
:fullscreen .video-bar,
:-webkit-full-screen .video-bar {
  inset-inline: 12px;
  bottom: 12px;
}

/* ── Remote: transport of the video on screen ────────────── */
.rc-video-bar {
  /* Under both previews, the full width of the pad. */
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  color: var(--text);
}
.rc-video-bar[hidden] {
  display: none;
}
.rc-video-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.rc-video-meta {
  justify-content: space-between;
  min-height: 1.2em;
}
.rc-video-btn {
  min-width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.rc-video-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.rc-video-play {
  min-width: 84px;
  border-color: var(--accent);
  color: var(--accent);
}
.rc-video-btn .icon-pause,
.rc-video-btn.playing .icon-play {
  display: none;
}
.rc-video-btn.playing .icon-pause {
  display: block;
}
/* The shared slider and audience line are styled for the presenter's bar, a row on a dark panel. */
.rc-video-bar .video-seek {
  flex: none;
  width: 100%;
  min-height: 32px;
}
.rc-video-bar .video-audience {
  color: var(--text-2);
}
/* One column on a phone: the block stays right under the current item, above the "next" preview. */
@media (max-width: 420px) {
  .rc-next {
    order: 1;
  }
}

/* ─── Server library ─── */
/* The administrator's page (/library): files and playlists kept on the server. */
.library-page {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.lib-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  min-height: var(--topbar-h);
  padding: 8px 20px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.lib-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.lib-header-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.lib-header-tools a.btn,
.lib-state a.btn {
  text-decoration: none;
}
.library-page :is(button, a, select, summary):focus-visible,
.library-page input[type="checkbox"]:focus-visible,
.lib-pick :is(button, a):focus-visible,
.lib-pick input[type="checkbox"]:focus-visible,
.from-library-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.lib-main {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px;
}

/* Loading, switched off, sign-in: one centred card. */
.lib-state {
  max-width: 420px;
  margin: 8vh auto 0;
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  color: var(--text-2);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.lib-signin {
  align-items: stretch;
  gap: 0;
}
.lib-signin h1 {
  font-size: 1.6rem;
  color: var(--text);
}
.lib-intro {
  margin: 8px 0 24px;
  font-size: 0.9rem;
}
.lib-wide-btn {
  width: 100%;
}
/* A line under a form field: empty until there is something to say. */
.lib-form-note {
  min-height: 1.4em;
  margin: 8px 0;
  font-size: 0.85rem;
  color: var(--danger);
  text-align: start;
  overflow-wrap: anywhere;
}
.lib-field-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-3);
  text-align: start;
}

.lib-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.lib-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
@media (min-width: 1100px) {
  .lib-columns {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }
}
.lib-panel {
  min-width: 0;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.lib-panel-title {
  font-size: 1.1rem;
  margin-bottom: 4px;
}
.lib-empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--text-3);
  font-style: italic;
}

/* ── Upload and storage use ── */
.lib-upload {
  border-style: dashed;
  border-color: var(--border-2);
  transition: var(--transition);
}
.lib-upload.drag-over {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.lib-upload-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 24px;
}
.lib-upload-copy {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  min-width: 0;
}
.lib-usage {
  flex: 1 1 220px;
  max-width: 360px;
  text-align: end;
}
.lib-usage-text,
.lib-upload-status {
  font-size: 0.8rem;
  color: var(--text-2);
}
.lib-usage .progress-bar.nearly-full .progress-fill {
  background: var(--danger);
}
.lib-upload-progress {
  margin-top: 16px;
}
.lib-upload-status {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.lib-upload-status > :first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
.lib-upload-count {
  flex: none;
}
.lib-warning {
  padding: 12px 14px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.lib-upload-errors {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.lib-upload-errors ul {
  flex: 1;
  min-width: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-wrap: anywhere;
}
.lib-upload-errors .btn-icon {
  flex: none;
  width: 28px;
  height: 28px;
}

/* ── Filters and the selection ── */
.lib-search {
  margin-top: 12px;
}
.library-page .search-input,
.library-page .sort-select,
.lib-pick .search-input {
  background: var(--bg-2);
}
[dir="rtl"] :is(.library-page, .lib-pick) .search-wrapper svg {
  left: auto;
  right: 12px;
}
[dir="rtl"] :is(.library-page, .lib-pick) .search-input {
  padding: 10px 38px 10px 14px;
}
.lib-filters {
  margin-top: 10px;
  flex-wrap: wrap;
}
.lib-filters .sort-select {
  flex: 1 1 140px;
  min-width: 0;
  padding: 8px 10px;
}
/* Stays in reach while a long list of files scrolls under it. */
.lib-selection {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.lib-selection-count {
  margin-inline-end: auto;
  font-size: 0.85rem;
  color: var(--text-2);
}

/* ── Files ── */
.lib-files,
.lib-playlists,
.lib-draft {
  list-style: none;
}
.lib-file {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.lib-file:last-child {
  border-bottom: none;
}
.lib-file.selected {
  background: var(--accent-glow);
}
.lib-check {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
}
.lib-file .item-kind,
.lib-draft-row .item-kind {
  margin-top: 3px;
}
.lib-file-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lib-file-name {
  font-size: 0.95rem;
  overflow-wrap: anywhere;
  text-align: start;
}
.lib-file-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  font-size: 0.75rem;
  color: var(--text-3);
}
.lib-file-note {
  font-size: 0.75rem;
  color: var(--accent);
}
/* Something is under way for this file (a download). */
.lib-file-busy {
  color: var(--text-2);
}
.btn-icon[aria-disabled="true"] {
  opacity: 0.5;
  cursor: progress;
}
/* For screen readers only. */
.lib-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.lib-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.lib-tag {
  max-width: 100%;
  padding: 2px 10px;
  border: 1px solid var(--border-2);
  border-radius: 20px;
  background: var(--bg-3);
  color: var(--text-2);
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}
.lib-tag:hover,
.lib-tag[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}
.lib-file-actions,
.lib-row-actions {
  flex: none;
  display: flex;
  gap: 4px;
}
.lib-file-actions .btn-icon,
.lib-row-actions .btn-icon,
.lib-playlist-head .btn-icon {
  border-color: var(--border);
}
.btn-icon.lib-danger:hover:not(:disabled) {
  color: var(--danger);
  border-color: var(--danger);
}

/* ── Saved playlists ── */
.lib-playlist {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}
.lib-playlist-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
}
.lib-playlist-toggle {
  flex: 1 1 110px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: start;
}
.lib-playlist-toggle:hover {
  background: var(--bg-3);
}
.lib-playlist-name {
  max-width: 100%;
  font-size: 0.95rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.lib-playlist-name::before {
  content: "▸";
  display: inline-block;
  margin-inline-end: 6px;
  color: var(--text-3);
}
[dir="rtl"] .lib-playlist-name::before {
  content: "◂";
}
.lib-playlist-toggle[aria-expanded="true"] .lib-playlist-name::before {
  content: "▾";
}
.lib-playlist-count {
  font-size: 0.75rem;
  color: var(--text-3);
}
.lib-editor {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.lib-editor .field-input {
  background: var(--bg-card);
}
.lib-draft {
  margin: 12px 0;
}
.lib-draft-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.lib-draft-position {
  flex: none;
  min-width: 1.6em;
  margin-top: 1px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-3);
  text-align: end;
}
.lib-draft-name {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
  text-align: start;
}
.lib-row-actions .btn-icon {
  width: 30px;
  height: 30px;
}
.lib-editor .lib-empty {
  padding: 16px 8px;
}

/* ── Dialogs and toasts ── */
.modal-card.lib-dialog {
  max-width: 440px;
  text-align: start;
}
.lib-dialog h2 {
  margin-bottom: 16px;
  font-size: 1.2rem;
}
.lib-dialog .field-label:not(:first-of-type) {
  margin-top: 14px;
}
.lib-confirm-text {
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.lib-dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
/* ── "From the library" on the presenter page ── */
.from-library-btn {
  width: 100%;
  margin-top: 12px;
}
/* The card keeps its height on the screen: the list scrolls inside it, the Add button stays in reach. */
.modal-card.lib-pick {
  display: flex;
  flex-direction: column;
  max-height: min(86vh, 760px);
  padding: 28px 24px 20px;
  text-align: start;
}
.lib-pick .modal-close {
  right: auto;
  inset-inline-end: 14px;
}
.lib-pick-title {
  margin-bottom: 16px;
  padding-inline-end: 36px;
  font-size: 1.2rem;
  outline: none;
}
.lib-pick-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 28px 12px;
  text-align: center;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.lib-pick-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.lib-pick-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px;
}
.lib-pick .lib-search {
  margin: 0 0 8px;
}
.lib-pick-file {
  border-bottom: 1px solid var(--border);
}
.lib-pick-file:last-child {
  border-bottom: none;
}
.lib-pick-file.selected {
  background: var(--accent-glow);
}
/* The row is a label: all of it ticks the file. */
.lib-pick-file .lib-file {
  border-bottom: none;
  cursor: pointer;
}
.lib-pick-subtitle {
  margin-top: 16px;
  font-size: 0.95rem;
  color: var(--text-2);
}
.lib-pick-playlist {
  width: 100%;
  padding: 8px 10px;
}
/* Not an editor that opens, as on the library page: a press adds the playlist. */
.lib-pick-playlist .lib-playlist-name::before {
  content: "+";
}
.lib-pick-playlist:disabled:hover {
  background: transparent;
}
.lib-pick-hint {
  min-height: 0;
  margin: 0;
  text-align: end;
}
.lib-pick-hint:not(:empty) {
  margin-top: 8px;
}
.lib-pick-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.lib-pick-manage {
  color: var(--accent);
  font-size: 0.85rem;
  text-underline-offset: 3px;
}

/* Messages here carry file names: they wrap instead of leaving the screen. */
.library-page .toast {
  width: max-content;
  max-width: calc(100vw - 32px);
  white-space: normal;
  text-align: center;
  overflow-wrap: anywhere;
}

/* Phones and small tablets: a file's actions move under its name and stay visible. */
@media (max-width: 720px) {
  .lib-main {
    padding: 12px;
  }
  .lib-panel {
    padding: 14px;
  }
  .lib-state {
    padding: 24px 18px;
  }
  .lib-file {
    flex-wrap: wrap;
  }
  .lib-file-main {
    flex-basis: calc(100% - 90px);
  }
  .lib-file-actions {
    flex-basis: 100%;
    justify-content: flex-end;
  }
  .lib-file-actions .btn-icon {
    width: 40px;
    height: 40px;
  }
  .lib-usage {
    max-width: none;
    text-align: start;
  }
  .lib-selection .btn {
    flex: 1 1 auto;
  }
  .lib-draft-row {
    flex-wrap: wrap;
  }
  .lib-draft-name {
    flex-basis: calc(100% - 90px);
  }
  .lib-row-actions {
    flex-basis: 100%;
    justify-content: flex-end;
  }
}
