/* ==========================================================================
   Presentació Web Interactiva — SARTI · UPC Vilanova
   Tema oceànic fosc per destacar les diapositives 16:9 i el contingut multimèdia
   ========================================================================== */

:root {
  --bg-deep: #06101b;
  --bg-surface: #0b1929;
  --bg-elevated: #112338;
  --bg-hover: #17304d;
  --border-subtle: rgba(148, 197, 240, 0.14);
  --border-strong: rgba(56, 189, 248, 0.42);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #0ea5e9;
  --accent-light: #38bdf8;
  --accent-glow: rgba(14, 165, 233, 0.28);
  --danger: #ef4444;
  --topbar-h: 56px;
  --bottombar-h: 66px;
  --sidebar-w: 310px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-slide: 0 24px 64px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

button, input {
  font-family: inherit;
  color: inherit;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   App Shell
   ========================================================================== */

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100vw;
  background: radial-gradient(circle at 50% 0%, #0d2238 0%, var(--bg-deep) 65%);
}

/* Fullscreen idle auto-hide chrome */
.app.fs-idle .topbar,
.app.fs-idle .bottombar,
.app.fs-idle .nav-arrow {
  opacity: 0;
  pointer-events: none;
}

.app.fs-idle {
  cursor: none;
}

/* ==========================================================================
   Topbar
   ========================================================================== */

.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  background: rgba(11, 25, 41, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 30;
  transition: opacity 0.25s ease;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.topbar-center {
  flex: 1;
  max-width: 340px;
  display: flex;
  justify-content: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-badge {
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(14, 165, 233, 0.35);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-pill {
  font-size: 11.5px;
  color: var(--accent-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn, .ctrl-btn, .pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-btn {
  width: 36px;
  height: 36px;
}

.ctrl-btn {
  width: 34px;
  height: 34px;
}

.icon-btn:hover, .ctrl-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.icon-btn.active {
  background: rgba(14, 165, 233, 0.16);
  border-color: var(--border-strong);
  color: var(--accent-light);
}

.pill-btn {
  height: 34px;
  padding: 0 11px;
  font-size: 12.5px;
  font-weight: 500;
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(56, 189, 248, 0.25);
  color: var(--accent-light);
}

.pill-btn:hover {
  background: rgba(14, 165, 233, 0.24);
  color: #fff;
}

.search-trigger {
  width: 100%;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: rgba(6, 16, 27, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.search-trigger:hover {
  border-color: var(--border-strong);
  background: rgba(17, 35, 56, 0.9);
  color: var(--text-primary);
}

.search-trigger span {
  flex: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

kbd {
  display: inline-block;
  padding: 2px 6px;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 4px;
  color: var(--text-primary);
}

/* ==========================================================================
   Workspace (Sidebar + Stage)
   ========================================================================== */

.workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  position: relative;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  z-index: 25;
  transition: margin-left 0.22s ease, transform 0.22s ease;
}

.sidebar.collapsed {
  margin-left: calc(var(--sidebar-w) * -1);
}

.sidebar-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 8px;
  gap: 6px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(6, 16, 27, 0.4);
}

.sidebar-tab {
  padding: 7px 6px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-tab.active {
  background: var(--accent);
  color: #fff;
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.28) transparent;
}

.sidebar-body::-webkit-scrollbar {
  width: 6px;
}

.sidebar-body::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.28);
  border-radius: 3px;
}

/* Chapter Accordion */
.chapter-group {
  margin-bottom: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(17, 35, 56, 0.45);
  overflow: hidden;
}

.chapter-group.active-chapter {
  border-color: var(--border-strong);
}

.chapter-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 11px;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  color: var(--text-primary);
  transition: background 0.15s ease;
}

.chapter-header:hover {
  background: rgba(255, 255, 255, 0.04);
}

.chapter-title {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
}

.chapter-range {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.chapter-slides {
  border-top: 1px solid var(--border-subtle);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chapter-group:not(.open) .chapter-slides {
  display: none;
}

.slide-list-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.slide-list-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.slide-list-item.active {
  background: rgba(14, 165, 233, 0.22);
  color: #fff;
  font-weight: 600;
}

.slide-num-pill {
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  min-width: 24px;
  text-align: right;
  color: var(--text-muted);
}

.slide-list-item.active .slide-num-pill {
  color: var(--accent-light);
}

.slide-list-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-vid-tag {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
  flex-shrink: 0;
}

/* Sidebar Thumbnails & Video cards */
.thumb-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px;
  margin-bottom: 8px;
  background: rgba(17, 35, 56, 0.55);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.thumb-item:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.thumb-item.active {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.thumb-img-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 5px;
  overflow: hidden;
  background: #0f172a;
}

.thumb-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-badge-num {
  position: absolute;
  left: 6px;
  bottom: 6px;
  background: rgba(6, 16, 27, 0.85);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.thumb-badge-vid {
  position: absolute;
  right: 6px;
  top: 6px;
  background: rgba(220, 38, 38, 0.92);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.thumb-caption {
  font-size: 11.5px;
  color: var(--text-primary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.thumb-sub {
  font-size: 10.5px;
  color: var(--text-secondary);
}

/* ==========================================================================
   Stage & Slide Frame (Strict 16:9 Coordinate Lock)
   ========================================================================== */

.stage-container {
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 56px;
  overflow: hidden;
}

.slide-viewport {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide-frame {
  position: relative;
  /* Exact 16:9 sizing computed via JS ResizeObserver so overlay percentages always match pixel-for-pixel */
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  background: #ffffff;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow-slide);
}

.slide-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #ffffff;
  transition: opacity 0.16s ease;
}

.slide-image.loading {
  opacity: 0.45;
}

.slide-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 16, 27, 0.25);
  pointer-events: none;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(56, 189, 248, 0.25);
  border-top-color: var(--accent-light);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Interactive Overlay Layer (Videos + Hyperlinks) */
.overlay-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Hyperlink hotspot */
.slide-link-hotspot {
  position: absolute;
  pointer-events: auto;
  display: block;
  border-radius: 4px;
  border: 1.5px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
}

.slide-link-hotspot:hover {
  background: rgba(14, 165, 233, 0.14);
  border-color: rgba(14, 165, 233, 0.75);
}

/* Video Overlay */
.video-overlay {
  position: absolute;
  pointer-events: auto;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(6, 16, 27, 0.15);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.video-poster-btn {
  width: 100%;
  height: 100%;
  position: relative;
  border: none;
  padding: 0;
  background: rgba(6, 16, 27, 0.26);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.2s ease;
}

.video-poster-btn:hover {
  background: rgba(6, 16, 27, 0.42);
}

.video-play-circle {
  width: clamp(54px, 7.5%, 84px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(220, 38, 38, 0.94);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), 0 0 0 6px rgba(255, 255, 255, 0.22);
  transition: transform 0.2s ease, background 0.2s ease;
}

.video-poster-btn:hover .video-play-circle {
  transform: scale(1.09);
  background: #dc2626;
}

.video-play-circle svg {
  width: 44%;
  height: 44%;
  margin-left: 4px;
}

.video-pill-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(6, 16, 27, 0.86);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: clamp(11px, 1.3vw, 14px);
  font-weight: 600;
  max-width: 90%;
  text-align: center;
}

.video-start-tag {
  background: var(--accent);
  color: #fff;
  font-size: 0.82em;
  padding: 2px 7px;
  border-radius: 999px;
}

.video-ext-link {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(6, 16, 27, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f8fafc;
  font-size: 11.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.video-ext-link:hover {
  background: rgba(14, 165, 233, 0.92);
  border-color: #fff;
}

.video-overlay iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000;
}

/* Edge Navigation Arrows */
.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 68px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: rgba(11, 25, 41, 0.72);
  backdrop-filter: blur(8px);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 15;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.25s ease, transform 0.15s ease;
}

.nav-arrow:hover:not(:disabled) {
  background: rgba(14, 165, 233, 0.25);
  border-color: var(--accent-light);
}

.nav-arrow:disabled {
  opacity: 0.2;
  cursor: default;
}

.nav-prev { left: 8px; }
.nav-next { right: 8px; }

/* ==========================================================================
   Bottom Bar & Scrubber
   ========================================================================== */

.bottombar {
  height: var(--bottombar-h);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: rgba(11, 25, 41, 0.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-subtle);
  z-index: 30;
  transition: opacity 0.25s ease;
}

.progress-wrap {
  position: relative;
  height: 14px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  cursor: pointer;
}

.progress-track {
  position: relative;
  width: 100%;
  height: 4px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  transition: height 0.15s ease;
}

.progress-wrap:hover .progress-track {
  height: 7px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  border-radius: 999px;
  transition: width 0.18s ease;
}

.progress-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.chapter-tick {
  position: absolute;
  top: -1px;
  bottom: -1px;
  width: 2px;
  background: rgba(255, 255, 255, 0.45);
}

.video-dot {
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #ef4444;
  border: 1px solid #fff;
}

.progress-tooltip {
  position: absolute;
  bottom: 20px;
  transform: translateX(-50%);
  padding: 5px 10px;
  border-radius: 6px;
  background: #0f172a;
  border: 1px solid var(--border-strong);
  color: #fff;
  font-size: 11.5px;
  white-space: nowrap;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 40;
}

.controls-row {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 14px 4px;
  gap: 12px;
}

.controls-left {
  min-width: 0;
  display: flex;
  align-items: center;
}

.slide-title-footer {
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.controls-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.counter-form {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  margin: 0 4px;
  border-radius: var(--radius-sm);
  background: rgba(6, 16, 27, 0.7);
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

#slide-input {
  width: 42px;
  background: transparent;
  border: none;
  outline: none;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  -moz-appearance: textfield;
}

#slide-input::-webkit-inner-spin-button,
#slide-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.counter-sep, #slide-total {
  color: var(--text-secondary);
}

/* ==========================================================================
   Modals (Grid, Search, Help)
   ========================================================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 8, 16, 0.8);
  backdrop-filter: blur(8px);
}

.modal-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.modal-sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* Grid Overview */
.grid-panel {
  width: min(1240px, 95vw);
  height: min(86vh, 880px);
}

.grid-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(6, 16, 27, 0.35);
}

.filter-chip {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-chip:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.grid-cards {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  align-content: start;
}

.grid-cards .thumb-item {
  margin-bottom: 0;
}

/* Search Modal */
.search-panel {
  width: min(680px, 94vw);
  max-height: 80vh;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

#search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 15px;
  color: #fff;
}

.search-meta {
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.search-results {
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: rgba(17, 35, 56, 0.4);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.search-row:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.search-row img {
  width: 96px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.search-row-info {
  min-width: 0;
  flex: 1;
}

.search-row-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.search-row-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Help Modal */
.help-panel {
  width: min(460px, 92vw);
}

.shortcuts-list {
  padding: 14px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  padding: 9px 16px;
  border-radius: 999px;
  background: #0ea5e9;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 80;
}

/* ==========================================================================
   Responsive (Tablet / Mobile)
   ========================================================================== */

.sidebar-backdrop {
  position: fixed;
  inset: var(--topbar-h) 0 var(--bottombar-h) 0;
  background: rgba(2, 8, 16, 0.6);
  z-index: 22;
}

@media (max-width: 960px) {
  .sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    margin-left: 0 !important;
    transform: translateX(0);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.65);
  }
  .sidebar.collapsed {
    transform: translateX(-100%);
  }
  .stage-container {
    padding: 12px 14px;
  }
  .nav-arrow {
    width: 36px;
    height: 52px;
  }
  .brand-text h1 {
    font-size: 13px;
  }
  .topbar-center {
    max-width: 180px;
  }
  .controls-row {
    grid-template-columns: auto 1fr auto;
  }
  .controls-left {
    display: none;
  }
}

@media (max-width: 600px) {
  .topbar-center, .brand-badge, #btn-help {
    display: none;
  }
  .pill-btn span {
    display: none;
  }
  .nav-arrow {
    opacity: 0.55;
  }
}
