:root {
  --bg-base: #070b14;
  --bg-panel: rgba(15, 23, 42, 0.92);
  --bg-panel-elevated: #1e293b;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-gold: #f59e0b;
  --accent-gold-light: #fde047;
  --accent-cyan: #38bdf8;
  --accent-green: #10b981;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background-color: var(--bg-base);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

/* Top Nav Bar */
.top-header {
  height: 54px;
  background: rgba(10, 15, 30, 0.98);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-back-btn {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
}
.brand-back-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}
.brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.4);
}
.brand-title {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold-light);
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.project-pill {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
}
.project-pill strong { color: var(--text-main); }

.project-name-wrapper {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 4px 10px;
  transition: all 0.2s ease;
  margin-left: 6px;
}
.project-name-wrapper:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
}
.project-name-wrapper:focus-within {
  border-color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.08);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.2);
}
.project-name-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-right: 6px;
  white-space: nowrap;
}
.project-name-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 12.5px;
  font-weight: 600;
  width: 220px;
}
.project-name-input::placeholder {
  color: var(--text-dim);
}
.project-name-ext {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-gold);
  margin-left: 4px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}
.btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  color: #000;
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.4);
  transition: all 0.2s ease;
}
.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

/* Workspace 3-Zone Grid */
.studio-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 570px 1fr 340px;
  gap: 10px;
  padding: 10px;
  overflow: hidden;
}

/* Left Dual Workbench: Track List + Image Gallery */
.left-dual-bench {
  display: grid;
  grid-template-columns: 300px 260px;
  gap: 10px;
  overflow: hidden;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(14px);
}

.panel-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  min-height: 42px;
}
.panel-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}
.panel-title span { color: var(--accent-gold); }
.panel-count {
  font-size: 10.5px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 10px;
}

.add-btn {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-gold-light);
  border-color: rgba(245,158,11,0.3);
}

/* Audio Track List */
.track-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Global Drop Zone */
.global-drop-zone {
  background: rgba(245, 158, 11, 0.04);
  border: 1px dashed rgba(245, 158, 11, 0.3);
  border-radius: 8px;
  min-height: 38px;
  padding: 8px 10px;
  text-align: center;
  font-size: 11px;
  color: var(--accent-gold-light);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.global-drop-zone:hover {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.5);
}
.global-drop-zone.drag-over {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--accent-gold);
  transform: scale(1.02);
}

/* Track Card */
.track-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.track-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
}
.track-card.active {
  background: rgba(245, 158, 11, 0.08);
  border-color: var(--accent-gold);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.2);
}
.track-card.drag-over {
  background: rgba(56, 189, 248, 0.15) !important;
  border: 2px dashed var(--accent-cyan) !important;
  transform: scale(1.02);
}
.track-card.reorder-dragging {
  opacity: 0.35;
  border: 2px dashed var(--accent-gold);
}

.track-main-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reorder-control-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.reorder-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.reorder-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}
.reorder-handle {
  cursor: grab;
  color: var(--text-dim);
  font-size: 11px;
  padding: 1px 4px;
}
.reorder-handle:hover {
  color: var(--accent-gold-light);
}

.track-order-num {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-gold);
  width: 20px;
  text-align: center;
}

.track-drop-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: visible;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.track-drop-thumb img {
  width: 100%;
  height: 100%;
  border-radius: 5px;
  object-fit: cover;
}

.track-details {
  flex: 1;
  min-width: 0;
}
.track-name {
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.track-time {
  font-size: 10px;
  color: var(--text-dim);
  font-family: monospace;
}

.track-fx-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.fx-pill {
  font-size: 9px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.fx-pill.active {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border-color: rgba(56, 189, 248, 0.4);
}

/* Image Gallery */
.gallery-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.gallery-hint {
  padding: 6px 10px;
  font-size: 10.5px;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.06);
  border-bottom: 1px solid var(--border-subtle);
}
.gallery-grid {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.draggable-img-card {
  aspect-ratio: 1;
  background: #111827;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
}
.draggable-img-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-gold);
}
.draggable-img-card.selected {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.28);
}
.draggable-img-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.img-label {
  position: absolute;
  bottom: 4px;
  left: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 9px;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drag-chip {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(245, 158, 11, 0.85);
  color: #000;
  font-size: 8px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  pointer-events: none;
}

/* Center Stage */
.center-stage {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.preview-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  position: relative;
}
.preview-header {
  height: 38px;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.viewport-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: radial-gradient(circle at center, #111827 0%, #030712 100%);
  overflow: hidden;
}
.viewport-16-9 {
  width: 92%;
  max-width: 800px;
  aspect-ratio: 16/9;
  background: #050505;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(245, 158, 11, 0.15);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.viewport-bg-blur {
  position: absolute;
  inset: -20px;
  background-size: cover;
  background-position: center;
  filter: blur(28px) brightness(0.4);
  transform: scale(1.1);
  transition: background-image 0.4s ease;
}
.viewport-image {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
  transition: all 0.4s ease;
}
.viewport-image.ken-burns {
  animation: kenBurnsMotion 20s infinite alternate ease-in-out;
}
@keyframes kenBurnsMotion {
  0% { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.09) translate(-1%, -1%); }
}

.viewport-overlay {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 10;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 8px 14px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.player-controls {
  min-height: 58px;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 6px 16px;
  gap: 12px;
}
.player-controls .btn-secondary {
  min-width: 38px;
  min-height: 38px;
  justify-content: center;
}
.play-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  color: #000;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.timeline-scrubber {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.timeline-bar {
  height: 32px;
  padding: 12px 0;
  background: rgba(255, 255, 255, 0.12);
  background-clip: content-box;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
}
.timeline-fill {
  height: 100%;
  width: 35%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

/* Right Inspector */
.right-inspector {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}
.section-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-gold);
}

.opt-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.opt-label {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}
.opt-select {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 6px 9px;
  border-radius: 6px;
  font-size: 11px;
  outline: none;
}
.pill-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px;
  border-radius: 6px;
}
.pill-item {
  font-size: 10.5px;
  font-weight: 600;
  text-align: center;
  padding: 5px 0;
  border-radius: 5px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
}
.pill-item.active {
  background: var(--bg-panel-elevated);
  color: var(--accent-gold-light);
}

/* Save Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  padding: 12px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.save-modal {
  width: min(520px, calc(100vw - 24px));
  max-height: 90vh;
  max-height: 90dvh;
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 30px rgba(245, 158, 11, 0.2);
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.modal-head {
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head button {
  min-width: 38px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.modal-body {
  padding: 16px 18px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.schema-preview {
  background: #070b14;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: monospace;
  font-size: 11px;
  color: var(--accent-cyan);
  max-height: 150px;
  overflow-y: auto;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.modal-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
}
.modal-foot button {
  min-height: 38px;
}

.toast-box {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  right: 16px;
  max-width: calc(100vw - 32px);
  word-break: break-word;
  background: rgba(16, 185, 129, 0.95);
  color: #000;
  font-weight: 700;
  font-size: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 1000;
}

/* Empty State Drop Zones */
.empty-drop-area {
  border: 2px dashed rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 36px 16px;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  margin: 12px 8px;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.empty-drop-area:hover, .empty-drop-area.drag-over {
  border-color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.08);
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.18);
  transform: translateY(-2px);
}
.empty-drop-area .empty-icon {
  font-size: 34px;
  filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.35));
}
.empty-drop-area .empty-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}
.empty-drop-area .empty-desc {
  font-size: 11px;
  color: var(--text-muted);
}
.btn-primary-sm {
  background: linear-gradient(135deg, var(--accent-gold), #ea580c);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
  transition: all 0.2s ease;
}
.btn-primary-sm:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.5);
}

/* Viewport Empty State */
.viewport-empty-state {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.6) 0%, rgba(7, 11, 20, 0.95) 100%);
  text-align: center;
  padding: 24px;
}
.viewport-empty-state .vp-empty-icon {
  font-size: 50px;
  opacity: 0.85;
  filter: drop-shadow(0 0 20px rgba(56, 189, 248, 0.35));
}
.viewport-empty-state .vp-empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}
.viewport-empty-state .vp-empty-desc {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 380px;
  line-height: 1.5;
}
.viewport-empty-state .vp-empty-hints {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.viewport-empty-state .vp-empty-hints span {
  font-size: 11px;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

/* Track Card Delete Button & Empty Thumbnail */
.track-del-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
  margin-left: auto;
}
.track-del-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}
.track-drop-thumb.empty-thumb {
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  border-radius: 6px;
}
.gallery-del-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 11px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: all 0.2s ease;
}
.draggable-img-card:hover .gallery-del-btn {
  display: flex;
}
.gallery-del-btn:hover {
  background: #ef4444;
  border-color: #ef4444;
}

/* Track Thumbnail Remove Button */
.track-drop-thumb {
  position: relative;
}
.thumb-remove-btn {
  position: absolute;
  top: -4px;
  right: -4px;
  background: rgba(239, 68, 68, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  font-size: 10px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 6;
  line-height: 1;
  transition: transform 0.15s ease;
}
.track-drop-thumb:hover .thumb-remove-btn {
  display: flex;
}
.thumb-remove-btn:hover {
  transform: scale(1.15);
  background: #dc2626;
}

/* Viewport No-Image State */
.viewport-no-image-hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.8) 0%, rgba(7, 11, 20, 0.95) 100%);
  z-index: 3;
}

/* Touch Device Action Visibility */
@media (hover: none), (pointer: coarse) {
  .gallery-del-btn,
  .thumb-remove-btn {
    display: flex;
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .thumb-remove-btn {
    top: -6px;
    right: -6px;
  }
}

/* ==========================================================================
   N-Screen Responsive Breakpoints (1280px Compact Desktop, 1024px Tablet, 640px Mobile)
   ========================================================================== */
@media (max-width: 1280px) {
  .studio-workspace {
    grid-template-columns: 440px 1fr 280px;
  }

  .left-dual-bench {
    grid-template-columns: 220px 210px;
  }

  .project-name-input {
    width: 165px;
  }
}

@media (max-width: 1024px) {
  body {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .top-header {
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    padding: 10px 14px;
    gap: 10px;
    position: sticky;
    top: 0;
  }

  .brand {
    flex-wrap: wrap;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
  }

  .brand-back-btn {
    min-height: 38px;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
  }

  .project-name-wrapper {
    margin-left: 0;
    flex: 1 1 220px;
    min-width: 0;
    min-height: 40px;
  }

  .project-name-input {
    font-size: 16px;
    width: 100%;
    min-width: 0;
  }

  .btn-primary,
  .btn-secondary,
  .add-btn {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .studio-workspace {
    display: flex;
    flex-direction: column;
    overflow: visible;
    padding: 12px;
    gap: 12px;
  }

  .center-stage {
    order: -1;
    overflow: visible;
  }

  .viewport-container {
    padding: 12px;
  }

  .viewport-16-9 {
    width: 100%;
  }

  .left-dual-bench {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    overflow: visible;
  }

  .panel {
    max-height: 420px;
    min-height: 260px;
  }

  .reorder-btn {
    min-width: 28px;
    min-height: 24px;
    font-size: 11px;
  }

  .track-del-btn {
    min-width: 38px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .right-inspector {
    overflow: visible;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .opt-select {
    font-size: 16px;
    min-height: 42px;
    padding: 8px 10px;
  }

  .pill-item {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
  }
}

@media (max-width: 640px) {
  .top-header {
    padding: 10px 12px;
  }

  .project-name-wrapper {
    flex: 1 1 100%;
    order: 3;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions .btn-primary {
    width: 100%;
    min-height: 42px;
  }

  .studio-workspace {
    padding: 10px;
  }

  .left-dual-bench {
    grid-template-columns: 1fr;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  }

  .preview-header {
    height: auto;
    min-height: 36px;
    padding: 6px 12px;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 11px;
  }

  .viewport-container {
    padding: 8px;
  }

  .viewport-empty-state {
    padding: 12px;
    gap: 6px;
  }

  .viewport-empty-state .vp-empty-icon {
    font-size: 30px;
  }

  .viewport-empty-state .vp-empty-title {
    font-size: 13.5px;
  }

  .viewport-empty-state .vp-empty-desc {
    font-size: 11px;
  }

  .viewport-empty-state .vp-empty-hints {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 2px;
  }

  .viewport-empty-state .vp-empty-hints span {
    font-size: 10px;
    padding: 3px 8px;
  }

  .viewport-overlay {
    bottom: 10px;
    left: 10px;
    right: 10px;
    padding: 6px 10px;
  }

  .player-controls {
    padding: 8px 12px;
    gap: 10px;
  }

  .play-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
  }
}

