.editor-topbar {
  position: sticky;
}

.editor-shell {
  --left-panel-width: 304px;
  --right-panel-width: 324px;
  display: grid;
  height: calc(100svh - var(--header-height));
  min-height: 0;
  background: var(--bg);
}

.video-shell {
  grid-template-columns: var(--left-panel-width) minmax(0, 1fr) var(--right-panel-width);
  grid-template-rows: minmax(0, 1fr) 236px;
}

.photo-shell {
  grid-template-columns: 104px minmax(0, 1fr) 354px;
  grid-template-rows: minmax(0, 1fr);
}

.editor-sidebar {
  min-height: 0;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 0.85rem;
}

.right-panel {
  border-right: 0;
  border-left: 1px solid var(--line);
}

.panel-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.panel-tabs button,
.vertical-tools button,
.editing-controls button,
.mobile-editor-bar button {
  padding: 0.55rem;
  min-width: 0;
}

.panel-tabs button.active,
.vertical-tools button.active,
.editing-controls button.active,
.mobile-editor-bar button.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-2));
}

.panel-section {
  display: none;
}

.panel-section.active {
  display: block;
}

.library-list {
  display: grid;
  gap: 0.55rem;
}

.button-row,
.button-grid {
  display: grid;
  gap: 0.5rem;
}

.button-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.audio-actions {
  margin: 0.75rem 0;
}

.button-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 820;
}

.library-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 0.55rem;
}

.library-list.dense .library-item {
  grid-template-columns: 42px minmax(0, 1fr);
}

.library-swatch {
  height: 40px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.library-item strong,
.library-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-item small {
  color: var(--muted);
  font-size: 0.74rem;
}

.editor-stage,
.photo-stage {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(70, 217, 166, 0.04), transparent 22rem),
    var(--bg);
  padding: 1rem;
}

.preview-header {
  min-height: 66px;
  margin-bottom: 0.75rem;
}

.preview-header h1 {
  margin: 0;
  max-width: min(60vw, 720px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(1.2rem, 2vw, 2rem);
}

.video-preview-surface,
.photo-canvas-shell {
  position: relative;
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25% 75%, rgba(255, 255, 255, 0.035) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25% 75%, rgba(255, 255, 255, 0.035) 75%),
    #0b0c0f;
  background-position: 0 0, 16px 16px;
  background-size: 32px 32px;
}

.video-preview-surface {
  height: calc(100% - 142px);
  min-height: 260px;
}

.video-preview-surface canvas {
  width: min(100%, calc((100vh - 420px) * 1.777));
  max-height: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #111318;
}

.safe-guides {
  position: absolute;
  inset: 12%;
  border: 1px dashed rgba(246, 242, 232, 0.32);
  pointer-events: none;
}

.editing-controls {
  display: flex;
  gap: 0.5rem;
  min-height: 58px;
  overflow-x: auto;
  padding-top: 0.75rem;
}

.editing-controls button {
  flex: 0 0 auto;
}

.panel-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.9rem;
  margin-bottom: 0.85rem;
}

.transition-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.marker-list,
.keyframe-list {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.marker-item,
.keyframe-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 0.55rem;
}

.marker-item strong,
.keyframe-item strong,
.marker-item small,
.keyframe-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.marker-item small,
.keyframe-item small {
  color: var(--muted);
  font-size: 0.72rem;
}

.marker-pin {
  position: absolute;
  top: 0;
  z-index: 5;
  width: 2px;
  height: 100%;
  background: var(--accent-2);
  pointer-events: auto;
}

.marker-pin::before {
  position: absolute;
  top: 0;
  left: 50%;
  width: 12px;
  height: 12px;
  transform: translateX(-50%) rotate(45deg);
  border: 1px solid rgba(0, 0, 0, 0.22);
  background: var(--accent-2);
  content: "";
}

.transition-tile {
  display: grid;
  min-height: 72px;
  align-content: end;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(70, 217, 166, 0.34) 0 48%, rgba(237, 106, 90, 0.34) 48%),
    var(--surface-2);
  padding: 0.5rem;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 850;
}

.timeline-panel {
  grid-column: 1 / -1;
  min-height: 0;
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 0.8rem 1rem 1rem;
}

.timeline-toolbar {
  height: 42px;
}

.timeline-toolbar output {
  min-width: 96px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 0.4rem 0.6rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.timeline-scroll {
  position: relative;
  height: calc(100% - 48px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  touch-action: pan-x pan-y;
}

.timeline-ruler {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  min-width: calc(var(--timeline-width, 1800px));
  height: 30px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.ruler-tick {
  width: calc(var(--timeline-zoom, 100) * 1px);
  border-right: 1px solid var(--line);
  color: var(--muted);
  padding-left: 0.35rem;
  font-size: 0.72rem;
}

.timeline-tracks {
  display: grid;
  min-width: calc(var(--timeline-width, 1800px));
}

.track {
  display: grid;
  grid-template-columns: 118px minmax(1200px, 1fr);
  min-height: 42px;
  border-bottom: 1px solid var(--line);
}

.track-label {
  position: sticky;
  left: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  padding-inline: 0.6rem;
  font-size: 0.8rem;
  font-weight: 850;
}

.track-lane {
  position: relative;
  min-height: 42px;
}

.clip {
  position: absolute;
  top: 6px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  align-items: center;
  gap: 0.35rem;
  height: 30px;
  min-width: 52px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  color: #07110d;
  padding: 0.35rem 0.5rem;
  font-size: 0.74rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: none;
  touch-action: none;
}

.clip-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clip-delete {
  width: 20px;
  height: 20px;
  min-height: 20px;
  border: 1px solid rgba(0, 0, 0, 0.22);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.18);
  color: inherit;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
}

.clip-delete:hover {
  background: rgba(0, 0, 0, 0.32);
}

.clip.video {
  background: var(--accent);
}

.clip.audio {
  background: var(--accent-2);
}

.clip.text {
  background: var(--info);
  color: white;
}

.clip.overlay {
  background: var(--danger);
  color: white;
}

.clip.is-selected {
  outline: 3px solid color-mix(in srgb, var(--text) 78%, transparent);
  outline-offset: 1px;
}

.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 118px;
  z-index: 6;
  width: 2px;
  background: var(--danger);
  pointer-events: none;
}

.tool-rail {
  padding: 0.65rem;
}

.vertical-tools {
  display: grid;
  gap: 0.45rem;
}

.photo-stage {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.photo-canvas-shell {
  min-height: 0;
  padding: 1rem;
}

.photo-canvas-shell.show-grid {
  background:
    linear-gradient(rgba(70, 217, 166, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(70, 217, 166, 0.14) 1px, transparent 1px),
    #0b0c0f;
  background-size: 40px 40px;
}

.photo-canvas-shell.show-rulers::before,
.photo-canvas-shell.show-rulers::after {
  position: absolute;
  z-index: 2;
  border-color: var(--line-strong);
  background:
    repeating-linear-gradient(90deg, var(--surface-2) 0 28px, var(--surface-3) 28px 30px);
  content: "";
  pointer-events: none;
}

.photo-canvas-shell.show-rulers::before {
  top: 0;
  left: 0;
  right: 0;
  height: 24px;
  border-bottom: 1px solid var(--line-strong);
}

.photo-canvas-shell.show-rulers::after {
  top: 0;
  bottom: 0;
  left: 0;
  width: 24px;
  border-right: 1px solid var(--line-strong);
  background:
    repeating-linear-gradient(180deg, var(--surface-2) 0 28px, var(--surface-3) 28px 30px);
}

.photo-canvas-shell canvas {
  width: min(100%, 1400px);
  height: auto;
  max-height: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow);
  cursor: crosshair;
}

.layer-list {
  display: grid;
  gap: 0.5rem;
}

.layer-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(5, auto);
  gap: 0.35rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 0.55rem;
}

.layer-item.is-active {
  border-color: var(--accent);
}

.layer-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.84rem;
}

.layer-item button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.35rem;
}

.swatch {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--swatch-color);
}

.mobile-editor-bar.photo-mobile-tools {
  position: static;
  display: none;
}
