/* ==========================================================================
   ZEVYR CREATIVE COURSE: STUDIO PANEL
   One calm dark theme for both tracks.
   - Neutrals: Radix Colors "slate" dark scale (no pure black, no pure white text)
   - Depth: lighter surface = closer to the user (no shadows, no glow, no blur)
   - Accent: one small colour per track (data-track on <html>), used only on
     thin bars, tab underlines and small badges
   ========================================================================== */

:root {
  /* Surfaces: each step is lighter than the one before */
  --bg-stage: #0C0C0E;      /* slide well, darker than the page */
  --bg: #111113;            /* page, header, transport bar (slate 1) */
  --bg-raised: #18191B;     /* sidebar, inspector (slate 2) */
  --bg-control: #212225;    /* inputs, modal card (slate 3) */
  --bg-hover: #272A2D;      /* hover (slate 4) */
  --bg-selected: #2E3135;   /* active / pressed (slate 5) */

  /* Lines */
  --rule-soft: #2E3135;     /* panel dividers (slate 5) */
  --rule: #43484E;          /* control borders, slide frame (slate 7) */
  --seg: #363A3F;           /* idle scrubber segments (slate 6) */

  /* Text */
  --ink: #EDEEF0;           /* primary (slate 12) */
  --ink-soft: #B0B4BA;      /* secondary (slate 11) */
  --ink-faint: #979BA3;     /* hints, counts (>= 4.5:1 on every surface) */

  --overlay: rgba(8, 8, 10, 0.82);

  --font-body: 'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;

  /* Layout Dimensions */
  --header-height: 52px;
  --sidebar-width: 300px;
  --inspector-width: 330px;
  --transport-height: 72px;

  /* Transitions: colour only */
  --transition-fast: 120ms ease;
  --transition-medium: 200ms ease;
}

/* Track accents: the only difference between the two tracks */
:root,
:root[data-track="hbrd"] {
  --accent: #BDE56C;            /* lime 11: bars and underlines */
  --accent-text: #BDE56C;
  --done: #577538;              /* lime 8: completed marks */
  --done-btn-bg: #577538;       /* 'Completed' button fill */
  --done-btn-fg: #EDEEF0;       /* 4.5:1 on the fill */
  --done-badge-bg: #29371D;
  --done-badge-fg: #BDE56C;
}

:root[data-track="tiktok"] {
  --accent: #3B9EFF;            /* blue 10: bars and underlines */
  --accent-text: #70B8FF;
  --done: #2870BD;              /* blue 8: completed marks */
  --done-btn-bg: #205D9E;       /* blue 7: darker so text stays readable */
  --done-btn-fg: #EDEEF0;       /* 5.8:1 on the fill */
  --done-badge-bg: #003362;
  --done-badge-fg: #70B8FF;
}

/* ==========================================================================
   RESET & GLOBAL BASE
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color-scheme: dark;
}

input, button, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}

button {
  cursor: pointer;
  user-select: none;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 1px;
}

::selection {
  background-color: var(--bg-selected);
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
}

/* Tabular numerals for indices and counters */
.tabular-num {
  font-variant-numeric: tabular-nums;
}

/* Headings share one weight; hierarchy comes from size */
.wordmark,
.panel-title,
.module-header,
.card-heading,
.grid-heading,
.kbd-legend-title {
  font-weight: 600;
  letter-spacing: -0.005em;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--seg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--rule);
}

/* ==========================================================================
   APP WORKSPACE SHELL
   ========================================================================== */
.studio-shell {
  display: grid;
  grid-template-rows: var(--header-height) 1fr;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg);
}

/* ==========================================================================
   TOP COMMAND BAR
   ========================================================================== */
.command-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background-color: var(--bg);
  border-bottom: 1px solid var(--rule-soft);
  z-index: 50;
  gap: 16px;
}

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

.brand-logo {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.wordmark {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* Course Track Switcher */
.track-switcher {
  display: flex;
  align-self: stretch;
  align-items: stretch;
  gap: 24px;
}

.track-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-faint);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.track-btn:hover {
  color: var(--ink-soft);
}

.track-btn.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.track-btn .track-count {
  font-size: 12px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
}

/* Header Right Utility Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.progress-pill {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-label {
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.progress-bar-mini {
  width: 72px;
  height: 3px;
  background-color: var(--seg);
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background-color: var(--accent-text);
  transition: width var(--transition-medium);
}

.view-mode-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.text-btn {
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-faint);
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.text-btn:hover {
  color: var(--ink-soft);
}

.text-btn.active {
  color: var(--ink);
  border-bottom-color: var(--ink-faint);
}

/* ==========================================================================
   WORKSPACE 3-COLUMN LAYOUT
   ========================================================================== */
.studio-workspace {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr var(--inspector-width);
  height: calc(100vh - var(--header-height));
  height: calc(100dvh - var(--header-height));
  overflow: hidden;
  transition: grid-template-columns var(--transition-medium);
}

/* Collapsed States */
.studio-workspace.left-collapsed {
  grid-template-columns: 0px 1fr var(--inspector-width);
}

.studio-workspace.right-collapsed {
  grid-template-columns: var(--sidebar-width) 1fr 0px;
}

.studio-workspace.theater-mode {
  grid-template-columns: 0px 1fr 0px;
}

/* ==========================================================================
   LEFT CURRICULUM RAIL
   ========================================================================== */
.curriculum-panel {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-raised);
  border-right: 1px solid var(--rule-soft);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
}

.panel-title {
  font-size: 16px;
  color: var(--ink);
}

.search-box {
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--rule-soft);
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  background-color: var(--bg-control);
  border: 1px solid var(--rule-soft);
  padding: 7px 10px;
  transition: border-color var(--transition-fast);
}

.search-input-wrapper:focus-within {
  border-color: var(--ink-faint);
}

.search-input {
  width: 100%;
  font-size: 13px;
  color: var(--ink);
}

.search-input::placeholder {
  color: var(--ink-faint);
}

.kbd-badge {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  background-color: var(--bg-control);
  border: 1px solid var(--rule);
  padding: 1px 6px;
}

/* Scrollable Lessons Tree */
.curriculum-tree {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 8px;
}

.module-group {
  margin-bottom: 4px;
}

.module-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px 6px;
  font-size: 13px;
  color: var(--ink);
  border-top: 1px solid var(--rule-soft);
  user-select: none;
}

.module-group:first-child .module-header {
  border-top: 0;
}

.module-title-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
}

.module-title-wrap span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-count {
  font-weight: 400;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
}

.lesson-list {
  display: flex;
  flex-direction: column;
}

.lesson-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--ink-soft);
  border-left: 3px solid transparent;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  cursor: pointer;
}

.lesson-item:hover {
  background-color: var(--bg-hover);
  color: var(--ink);
}

.lesson-item.active {
  background-color: var(--bg-selected);
  color: var(--ink);
  border-left-color: var(--accent);
}

.lesson-check-btn {
  width: 14px;
  height: 14px;
  border: 1px solid var(--ink-faint);
  background-color: transparent;
  flex-shrink: 0;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.lesson-check-btn:hover {
  border-color: var(--ink-soft);
}

.lesson-item.completed .lesson-check-btn {
  background-color: var(--done);
  border-color: var(--done);
}

.lesson-index {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
  width: 20px;
  flex-shrink: 0;
}

.lesson-item.active .lesson-index {
  color: var(--ink-soft);
}

.lesson-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
}

.lesson-item.active .lesson-title {
  font-weight: 500;
}

/* ==========================================================================
   CENTER PRESENTATION STAGE
   ========================================================================== */
.presentation-stage {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-stage);
  overflow: hidden;
  position: relative;
}

/* Stage Context Toolbar */
.stage-context-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  background-color: var(--bg);
  border-bottom: 1px solid var(--rule-soft);
  min-height: 42px;
}

.breadcrumb-trail {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.breadcrumb-item {
  color: var(--ink-faint);
}

.breadcrumb-item.active {
  color: var(--ink);
  font-weight: 500;
}

.breadcrumb-sep {
  color: var(--ink-faint);
}

.stage-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Shared flat button */
.stage-btn,
.transport-nav-btn,
.mark-done-btn,
.btn-secondary {
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  border: 1px solid var(--rule);
  background-color: transparent;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.stage-btn:hover,
.transport-nav-btn:hover:not(:disabled),
.btn-secondary:hover {
  background-color: var(--bg-hover);
  border-color: var(--ink-faint);
}

.stage-btn.active {
  background-color: var(--bg-selected);
}

/* Slide Viewport / Canvas */
.slide-canvas-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.slide-frame {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-stage);
  border: 1px solid var(--rule);
  overflow: hidden;
  transition: transform var(--transition-medium);
}

.slide-frame.zoomed {
  transform: scale(1.4);
  cursor: grab;
  z-index: 40;
}

/* Slightly dimmed so light slides don't glare against the dark UI */
.slide-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: brightness(0.92);
  transition: opacity 120ms ease;
}

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

/* Slide navigation buttons overlaid on the canvas */
.stage-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 56px;
  display: grid;
  place-items: center;
  background-color: var(--bg);
  border: 1px solid var(--rule);
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
  transition: background-color var(--transition-fast);
  z-index: 20;
  opacity: 0.55;
}

.slide-canvas-container:hover .stage-nav-arrow {
  opacity: 1;
}

.stage-nav-arrow:hover {
  background-color: var(--bg-hover);
}

.stage-nav-arrow.prev {
  left: 0;
  border-left: 0;
}

.stage-nav-arrow.next {
  right: 0;
  border-right: 0;
}

/* ==========================================================================
   GRID OVERVIEW / CONTACT SHEET (Overlay on Stage)
   ========================================================================== */
.grid-overview-overlay {
  position: absolute;
  inset: 42px 0 0 0;
  background-color: var(--bg);
  z-index: 35;
  overflow-y: auto;
  padding: 24px;
  display: none;
}

.grid-overview-overlay.active {
  display: block;
}

.grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule-soft);
}

.grid-heading {
  font-size: 18px;
  color: var(--ink);
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.grid-card {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-raised);
  border: 1px solid var(--rule-soft);
  cursor: pointer;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.grid-card:hover {
  background-color: var(--bg-hover);
  border-color: var(--rule);
}

.grid-card.current {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.grid-thumb-wrap {
  aspect-ratio: 16 / 9;
  background-color: var(--bg-stage);
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--rule-soft);
}

.grid-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.92);
}

.grid-card-meta {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.grid-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.grid-card-num {
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
}

.grid-card-done {
  font-size: 12px;
  font-weight: 500;
  background-color: var(--done-badge-bg);
  color: var(--done-badge-fg);
  padding: 0 6px;
}

.grid-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   BOTTOM TRANSPORT & SCRUBBER BAR
   ========================================================================== */
.transport-bar {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 12px 20px;
  background-color: var(--bg);
  border-top: 1px solid var(--rule-soft);
  gap: 10px;
  min-height: var(--transport-height);
  z-index: 25;
}

/* Segmented Scrubber */
.scrubber-track {
  display: flex;
  width: 100%;
  height: 8px;
  gap: 3px;
  cursor: pointer;
}

.scrubber-segment {
  flex: 1;
  height: 100%;
  background-color: var(--seg);
  transition: background-color var(--transition-fast);
}

.scrubber-segment:hover {
  background-color: var(--ink-faint);
}

.scrubber-segment.completed {
  background-color: var(--done);
}

.scrubber-segment.active {
  background-color: var(--ink-soft);
}

/* Transport Controls Row */
.transport-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.transport-left, .transport-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.transport-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.transport-counter {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-left: 8px;
  font-variant-numeric: tabular-nums;
}

.transport-counter .curr-slide {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.transport-counter .sep,
.transport-counter .total-slides {
  font-size: 13px;
  color: var(--ink-faint);
}

.mark-done-btn:hover {
  background-color: var(--done-badge-bg);
  border-color: var(--done);
  color: var(--done-badge-fg);
}

.mark-done-btn.active {
  background-color: var(--done-btn-bg);
  border-color: var(--done-btn-bg);
  color: var(--done-btn-fg);
}

/* ==========================================================================
   RIGHT INSPECTOR
   ========================================================================== */
.inspector-panel {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-raised);
  border-left: 1px solid var(--rule-soft);
  overflow: hidden;
}

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--rule-soft);
  padding: 0 12px 0 16px;
}

.inspector-header .inspector-tabs {
  border-bottom: none;
  padding: 0;
}

.panel-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 20px;
  line-height: 1;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--rule-soft);
  border-radius: 4px;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.panel-close-btn:hover {
  background-color: var(--bg-hover);
  color: var(--ink);
}

.inspector-tabs {
  display: flex;
  align-items: stretch;
  gap: 20px;
  border-bottom: 1px solid var(--rule-soft);
  padding: 0 16px;
}

.inspector-tab-btn {
  padding: 12px 0 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-faint);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.inspector-tab-btn:hover {
  color: var(--ink-soft);
}

.inspector-tab-btn.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.inspector-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Sections: plain, no card-in-card */
.inspector-card {
  display: flex;
  flex-direction: column;
}

.card-heading {
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule-soft);
}

.inspector-empty {
  font-size: 13px;
  color: var(--ink-faint);
}

.takeaway-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.takeaway-item {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.6;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule-soft);
}

.takeaway-item:last-child {
  border-bottom: 0;
}

/* Resource Links List */
.resource-section {
  margin-top: 20px;
}

.resource-list {
  display: flex;
  flex-direction: column;
}

.resource-link-item {
  display: block;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--transition-fast);
}

.resource-link-item:hover {
  text-decoration-color: var(--accent-text);
}

.resource-desc {
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-faint);
  text-decoration: none;
}

/* Checklist Items */
.checklist-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}

.checklist-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin-top: 3px;
  accent-color: var(--done);
  cursor: pointer;
}

.checklist-item.checked {
  color: var(--ink-faint);
  text-decoration: line-through;
}

/* Notes Textarea */
.scratchpad-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scratchpad-area {
  width: 100%;
  height: 160px;
  padding: 10px;
  background-color: var(--bg-control);
  border: 1px solid var(--rule-soft);
  font-size: 13px;
  color: var(--ink);
  line-height: 1.6;
  resize: vertical;
  transition: border-color var(--transition-fast);
}

.scratchpad-area::placeholder {
  color: var(--ink-faint);
}

.scratchpad-area:focus {
  border-color: var(--ink-faint);
}

.scratchpad-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.scratchpad-status {
  font-size: 12px;
  color: var(--ink-faint);
}

.btn-secondary {
  padding: 4px 10px;
  font-size: 12px;
}

/* ==========================================================================
   KEYBOARD SHORTCUTS MODAL
   ========================================================================== */
.kbd-legend-modal {
  position: fixed;
  inset: 0;
  background-color: var(--overlay);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.kbd-legend-modal.active {
  display: flex;
}

.kbd-legend-card {
  width: 100%;
  max-width: 500px;
  background-color: var(--bg-raised);
  border: 1px solid var(--rule);
  padding: 20px;
}

.kbd-legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule-soft);
}

.kbd-legend-title {
  font-size: 18px;
  color: var(--ink);
}

.kbd-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
}

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

/* ==========================================================================
   MOBILE & TABLET RESPONSIVENESS
   ========================================================================== */

/* Tablet & Intermediate Desktop (<= 1100px) */
@media (max-width: 1100px) {
  .studio-workspace {
    grid-template-columns: var(--sidebar-width) 1fr 0px;
  }
}

/* Mobile & Small Tablet (<= 768px) */
@media (max-width: 768px) {
  :root {
    --header-height: 80px;
  }

  .studio-shell {
    width: 100vw;
    max-width: 100%;
    overflow-x: hidden;
  }

  /* 1. Command Header: 2-Tier Mobile Grid */
  .command-header {
    height: var(--header-height);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 4px 12px 0 12px;
    gap: 0;
    overflow: hidden;
  }

  /* Row 1: Brand (left) and View Toggles (right) */
  .brand-section {
    order: 1;
    min-width: 0;
    gap: 8px;
    height: 38px;
    flex: 1;
    display: flex;
    align-items: center;
  }

  .brand-logo {
    width: 20px;
    height: 20px;
  }

  .wordmark {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-actions {
    order: 2;
    height: 38px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }

  .view-mode-group {
    display: flex;
    align-items: center;
    gap: 2px;
  }

  .text-btn {
    padding: 5px 8px;
    font-size: 12px;
    font-weight: 500;
  }

  .track-count,
  .progress-pill,
  .hide-on-mobile {
    display: none !important;
  }

  /* Row 2: Full-width Track Switcher */
  .track-switcher {
    order: 3;
    width: 100%;
    height: 38px;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    gap: 0;
    border-top: 1px solid var(--rule-soft);
  }

  .track-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    padding: 0 4px;
    text-align: center;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
  }

  .track-btn.active {
    border-bottom-color: var(--accent);
  }

  /* 2. Workspace & Drawers Architecture */
  .studio-workspace {
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    height: calc(100vh - var(--header-height));
    height: calc(100dvh - var(--header-height));
    overflow: hidden;
  }

  .presentation-stage {
    flex: 1;
    width: 100%;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  /* Side Panels As Off-Canvas Drawers */
  .curriculum-panel,
  .inspector-panel {
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    width: 86%;
    max-width: 320px;
    z-index: 100;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.7);
    transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  .curriculum-panel {
    left: 0;
    transform: translateX(-100%);
    border-right: 1px solid var(--rule);
  }

  .inspector-panel {
    right: 0;
    transform: translateX(100%);
    border-left: 1px solid var(--rule);
  }

  .studio-workspace.mobile-drawer-left .curriculum-panel {
    transform: translateX(0);
  }

  .studio-workspace.mobile-drawer-right .inspector-panel {
    transform: translateX(0);
  }

  /* Mobile Dark Scrim Backdrop */
  .mobile-scrim {
    position: fixed;
    inset: var(--header-height) 0 0 0;
    background-color: rgba(0, 0, 0, 0.65);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
  }

  .studio-workspace.mobile-drawer-left .mobile-scrim,
  .studio-workspace.mobile-drawer-right .mobile-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .panel-close-btn {
    display: flex;
  }

  /* 3. Stage & Canvas Adaptations */
  .stage-context-bar {
    padding: 6px 10px;
    min-height: 36px;
    gap: 8px;
  }

  .breadcrumb-trail {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 11px;
  }

  .breadcrumb-item {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .stage-tools {
    gap: 4px;
    flex-shrink: 0;
  }

  .stage-btn {
    padding: 3px 8px;
    font-size: 11px;
  }

  .slide-canvas-container {
    padding: 8px 6px;
    touch-action: pan-y;
  }

  .slide-frame {
    width: 100%;
    max-width: 100%;
  }

  .stage-nav-arrow {
    width: 26px;
    height: 44px;
    font-size: 20px;
    opacity: 0.7;
  }

  /* 4. Transport Bar */
  .transport-bar {
    padding: 8px 10px;
    gap: 6px;
    min-height: 48px;
  }

  .scrubber-track {
    height: 6px;
    gap: 2px;
  }

  .transport-controls {
    gap: 6px;
  }

  .transport-left,
  .transport-right {
    gap: 6px;
  }

  .transport-nav-btn {
    padding: 4px 8px;
    font-size: 12px;
  }

  .transport-counter .curr-slide {
    font-size: 14px;
  }

  .transport-counter .total-slides {
    font-size: 12px;
  }

  .mark-done-btn {
    padding: 4px 8px;
    font-size: 12px;
  }

  /* 5. Contact Sheet Overlay */
  .grid-overview-overlay {
    padding: 12px 10px;
    inset: var(--header-height) 0 0 0;
  }

  .grid-header {
    margin-bottom: 12px;
    padding-bottom: 8px;
  }

  .grid-heading {
    font-size: 15px;
  }

  .grid-cards {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
  }

  .grid-card-meta {
    padding: 6px 8px;
  }

  .grid-card-title {
    font-size: 11px;
  }
}

/* Extra Small Phones (<= 380px) */
@media (max-width: 380px) {
  .wordmark {
    max-width: 80px;
  }

  .track-switcher {
    gap: 6px;
  }

  .track-btn {
    font-size: 12px;
    padding: 0 2px;
  }
}
