:root {
  --bg-canvas: #F3F4F6;
  --bg-canvas-glow: #FAFBFD;
  --surface: #FFFFFF;
  --surface-subtle: #F4F5F7;
  --surface-hover: #ECEEF2;
  --border: #E8EBF0;
  --border-strong: #D8DCE5;

  --text-primary: #151922;
  --text-secondary: #5E6675;
  --text-muted: #939AA8;

  --accent: #18181B;
  --accent-hover: #2E313A;
  --danger: #E5484D;
  --success: #10B981;

  --radius-panel: 18px;
  --radius-card: 12px;
  --radius-sm: 9px;

  --shadow-panel: 0 2px 6px rgba(15, 23, 42, 0.03), 0 12px 32px rgba(15, 23, 42, 0.06);
  --shadow-pill: 0 2px 8px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.07);
  --shadow-artwork: 0 10px 40px rgba(15, 23, 42, 0.11), 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-btn: 0 1px 2px rgba(15, 23, 42, 0.06);

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-primary);
  background: radial-gradient(circle at 50% 45%, var(--bg-canvas-glow) 0%, var(--bg-canvas) 75%);
  user-select: none;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

.workbench {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ===== Center Viewport Stage ===== */
.stage-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background-image: radial-gradient(rgba(15, 23, 42, 0.055) 1px, transparent 1px);
  background-size: 22px 22px;
}
.stage-viewport.panning { cursor: grab !important; }
.stage-viewport.panning-active { cursor: grabbing !important; }
.stage-viewport.painting-cursor { cursor: none; }

.artwork-frame {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  border-radius: 12px;
  overflow: hidden;
  background: #E9ECEF;
  box-shadow: var(--shadow-artwork);
  outline: 1px solid rgba(15, 23, 42, 0.07);
  will-change: transform;
}

#glCanvas,
#overlayCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#overlayCanvas { pointer-events: none; }

/* Dropzone Overlay */
.drop-overlay {
  position: fixed;
  inset: 18px;
  z-index: 120;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  border: 2px dashed #94A3B8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}
.drop-overlay.visible { opacity: 1; pointer-events: auto; }
.drop-overlay-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.drop-overlay-sub { font-size: 12px; color: var(--text-secondary); }

/* ===== Floating Panels Base ===== */
.floating-panel {
  position: absolute;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel);
  display: flex;
  flex-direction: column;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s ease;
}

/* ===== 1. Left Sidebar (Outliner | Assets) ===== */
.left-panel {
  top: 14px;
  left: 14px;
  bottom: 14px;
  width: 250px;
}
.left-panel.collapsed {
  transform: translateX(calc(-100% - 24px));
  opacity: 0;
  pointer-events: none;
}

.left-expand-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 19;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, background 0.15s ease;
}
.left-expand-btn.visible { opacity: 1; pointer-events: auto; }
.left-expand-btn:hover { background: var(--surface-subtle); }

.panel-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 8px 14px;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background 0.14s ease, color 0.14s ease;
}
.icon-btn:hover { background: var(--surface-subtle); color: var(--text-primary); }
.icon-btn.active { background: var(--accent); color: #FFFFFF; }

.project-header { padding: 2px 14px 12px 14px; }
.project-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-sub { margin-top: 2px; font-size: 11px; color: var(--text-muted); }

/* Segmented Control */
.seg-wrap { padding: 0 12px 10px 12px; }
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  border-radius: 11px;
  background: var(--surface-subtle);
}
.segmented.cols-3 { grid-template-columns: repeat(3, 1fr); }
.seg-btn {
  height: 27px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}
.seg-btn:hover { color: var(--text-primary); }
.seg-btn.active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.panel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px 12px 10px;
}
.panel-scroll::-webkit-scrollbar { width: 5px; }
.panel-scroll::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.12); border-radius: 99px; }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Outliner Groups & Rows */
.outliner-group-label,
.asset-section-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  padding: 4px 6px 5px 6px;
}

.layer-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.layer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.layer-row:hover { background: #F7F8FA; }
.layer-row.selected {
  background: var(--surface-subtle);
  border-color: var(--border);
}
.layer-row.hidden-layer .layer-name {
  color: var(--text-muted);
  text-decoration: line-through;
}

.layer-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.layer-row.selected .layer-icon { color: var(--text-primary); }

.layer-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.28;
  transition: opacity 0.15s ease;
}
.layer-dot.has-data { opacity: 1; }

.layer-name {
  flex: 1;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-actions {
  display: flex;
  align-items: center;
  gap: 1px;
  opacity: 0.35;
  transition: opacity 0.14s ease;
}
.layer-row:hover .layer-actions,
.layer-row.selected .layer-actions,
.layer-actions.pinned { opacity: 1; }

.layer-act-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background 0.12s ease, color 0.12s ease;
}
.layer-act-btn:hover { background: rgba(15, 23, 42, 0.06); color: var(--text-primary); }
.layer-act-btn.on { color: var(--text-primary); background: rgba(15, 23, 42, 0.08); }
.layer-act-btn.warn-on { color: #D97706; background: rgba(245, 158, 11, 0.12); }
.layer-act-btn.solo-on { color: #4F46E5; background: rgba(99, 102, 241, 0.12); }

/* Assets Tab */
.sample-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.sample-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.sample-card:hover { border-color: var(--border-strong); background: #FAFBFD; }
.sample-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.sample-thumb {
  width: 64px;
  height: 36px;
  border-radius: 7px;
  object-fit: cover;
  background: var(--surface-subtle);
  flex-shrink: 0;
}
.sample-meta { flex: 1; min-width: 0; }
.sample-title { font-size: 12.5px; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 5px; }
.sample-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.draft-pill {
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 99px;
  background: #ECFDF5;
  color: #059669;
}

.upload-stack { display: flex; flex-direction: column; gap: 7px; }
.soft-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--surface-subtle);
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: left;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.soft-action-btn:hover { background: var(--surface-hover); border-color: var(--border); }
.soft-action-btn svg { color: var(--text-secondary); flex-shrink: 0; }

.panel-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.footer-chip {
  flex: 1;
  height: 30px;
  border-radius: 9px;
  background: var(--surface-subtle);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.14s ease, color 0.14s ease;
}
.footer-chip:hover { background: var(--surface-hover); color: var(--text-primary); }
.footer-chip.active { background: var(--accent); color: #FFFFFF; }

/* ===== Top-Center Floating Pill Toolbar ===== */
.top-toolbar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: var(--shadow-pill);
  max-width: calc(100vw - 570px);
}

.tool-btn {
  height: 32px;
  min-width: 32px;
  padding: 0 8px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.14s ease, color 0.14s ease;
  white-space: nowrap;
}
.tool-btn:hover:not(:disabled) { background: var(--surface-subtle); color: var(--text-primary); }
.tool-btn.active { background: var(--accent); color: #FFFFFF; }
.tool-btn.soft-active { background: var(--surface-subtle); color: var(--text-primary); }
.tool-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.toolbar-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 3px;
  flex-shrink: 0;
}

.toolbar-select {
  height: 32px;
  padding: 0 7px;
  border-radius: 9px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
}
.toolbar-select:hover { background: var(--surface-subtle); }

.save-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 7px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.save-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}
.save-dot.saving {
  background: #F59E0B;
}

.export-pill-btn {
  height: 32px;
  padding: 0 13px;
  border-radius: 9px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.14s ease;
  white-space: nowrap;
}
.export-pill-btn:hover { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }

/* ===== 3. Bottom-Center Slim Pure Time Scrubber ===== */
.bottom-bar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 24;
  width: min(500px, calc(100vw - 590px));
  min-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-panel);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tod-toggle-chip {
  height: 26px;
  padding: 0 10px;
  border-radius: 99px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all 0.14s ease;
}
.tod-toggle-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.tod-slider-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tod-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--text-muted);
}
.tod-labels .current-tod-label {
  color: var(--text-primary);
  font-weight: 600;
}

.tod-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background: linear-gradient(90deg, #9DD7F0 0%, #F4B96B 48%, #263E66 100%);
  outline: none;
  cursor: pointer;
}
.tod-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 2px solid var(--accent);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.25);
}

.timeline-pause-btn {
  height: 26px;
  padding: 0 10px;
  border-radius: 99px;
  background: var(--surface-subtle);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all 0.14s ease;
}
.timeline-pause-btn:hover { background: var(--surface-hover); color: var(--text-primary); }
.timeline-pause-btn.active { background: var(--accent); color: #FFFFFF; }

/* ===== 2 & 4. Right Floating Panel ===== */
.right-panel {
  top: 14px;
  right: 14px;
  bottom: 14px;
  width: 294px;
}

/* 4. Pinned Orthogonal Presets */
.presets-pinned {
  padding: 12px 12px 10px 12px;
  flex-shrink: 0;
}
.presets-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 2px;
}
.section-title { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }

.mini-save-btn {
  height: 23px;
  padding: 0 8px;
  border-radius: 7px;
  background: var(--surface-subtle);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.14s ease;
}
.mini-save-btn:hover { background: var(--accent); color: #FFFFFF; }

.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.preset-card {
  position: relative;
  aspect-ratio: 1 / 0.74;
  border-radius: 11px;
  overflow: hidden;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 5px 7px;
}
.preset-card:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(15, 23, 42, 0.10); }
.preset-card.active { border-color: var(--accent); box-shadow: 0 2px 10px rgba(15, 23, 42, 0.14); }
.preset-card-art { position: absolute; inset: 0; pointer-events: none; }
.preset-card-label {
  position: relative;
  z-index: 1;
  font-size: 11px;
  font-weight: 600;
  color: #FFFFFF;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.preset-toggle-badge {
  position: relative;
  z-index: 1;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent);
}

/* Custom saved presets strip */
.custom-presets-bar {
  display: none;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.custom-presets-bar.has-items { display: flex; }

.custom-preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 7px 0 9px;
  border-radius: 99px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.14s ease;
}
.custom-preset-chip:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.custom-preset-chip.active { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.custom-preset-del {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  opacity: 0.6;
}
.custom-preset-del:hover { opacity: 1; background: rgba(0, 0, 0, 0.14); }

.inspector-divider {
  height: 1px;
  background: var(--border);
  margin: 0 12px;
  flex-shrink: 0;
}

.inspector-scroll {
  padding: 10px 12px 14px 12px;
}

/* Option A: Docked Brush / Eraser Card (0% canvas occlusion) */
.docked-brush-card {
  display: none;
  flex-direction: column;
  gap: 7px;
  padding: 10px;
  margin-bottom: 12px;
  border-radius: 13px;
  background: #F8F9FB;
  border: 1px solid var(--border-strong);
}
.docked-brush-card.visible { display: flex; }

.docked-brush-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.popover-title-group { display: flex; align-items: center; gap: 7px; min-width: 0; }
.popover-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.popover-title { font-size: 12px; font-weight: 600; color: var(--text-primary); }

.brush-sub-block { display: flex; flex-direction: column; gap: 6px; }
.erase-scope-banner {
  padding: 6px 8px;
  border-radius: 8px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  font-size: 11px;
  color: #B91C1C;
}
.brush-dual-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* Contextual Inspector Header & Panes */
.ctx-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 10px;
}
.ctx-title-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.ctx-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ctx-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}
.ctx-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--surface-subtle);
  color: var(--text-muted);
}

.ctx-actions { display: flex; align-items: center; gap: 4px; }
.ctx-mini-btn {
  height: 24px;
  padding: 0 7px;
  border-radius: 7px;
  background: var(--surface-subtle);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.14s ease;
}
.ctx-mini-btn:hover { background: var(--surface-hover); color: var(--text-primary); }

.ctx-pane {
  display: none;
  flex-direction: column;
  gap: 8px;
}
.ctx-pane.active { display: flex; }

.ctx-sub-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 2px 0 2px;
}
.ctx-note {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
  padding: 0 2px;
}

/* Depth Engine Card (shown ONLY inside 深度空间 context!) */
.depth-engine-card {
  padding: 10px;
  border-radius: 13px;
  background: #F8F9FB;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.depth-engine-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.engine-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.engine-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  flex-shrink: 0;
}
.engine-dot.busy { background: #F59E0B; animation: pulseDot 1s infinite ease-in-out; }
.engine-dot.warn { background: #EF4444; }
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

.primary-action-btn {
  height: 30px;
  padding: 0 11px;
  border-radius: 9px;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  box-shadow: var(--shadow-btn);
  transition: background 0.14s ease, opacity 0.14s ease;
}
.primary-action-btn:hover:not(:disabled) { background: var(--accent-hover); }
.primary-action-btn:disabled { opacity: 0.55; cursor: wait; }

.depth-quick-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.soft-mini-btn {
  height: 28px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.14s ease;
}
.soft-mini-btn:hover { background: var(--surface-hover); }
.soft-mini-btn.active { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }

.depth-progress-box {
  padding: 8px 9px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: none;
  flex-direction: column;
  gap: 6px;
}
.depth-progress-box.visible { display: flex; }
.depth-progress-box.error { background: #FEF2F2; border-color: #FECACA; }
.depth-progress-text { font-size: 11px; line-height: 1.4; color: var(--text-secondary); }
.depth-progress-box.error .depth-progress-text { color: #B91C1C; }
.progress-track { width: 100%; height: 5px; border-radius: 99px; background: #E5E7EB; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; border-radius: 99px; background: var(--accent); transition: width 0.2s ease; }
.depth-fallback-row { display: flex; gap: 6px; }
.mini-btn {
  height: 26px;
  padding: 0 9px;
  border-radius: 7px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
}
.mini-btn:hover { background: var(--surface-subtle); }

/* Switch & Parameter Sliders */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 9px;
  border-radius: 10px;
  background: var(--surface-subtle);
}
.switch-label { font-size: 12px; font-weight: 500; color: var(--text-primary); }

.toggle-switch {
  position: relative;
  width: 34px;
  height: 19px;
  border-radius: 99px;
  background: #DCE0E8;
  transition: background 0.16s ease;
  flex-shrink: 0;
}
.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.22);
  transition: transform 0.16s ease;
}
.toggle-switch.on { background: var(--accent); }
.toggle-switch.on::after { transform: translateX(15px); }

.param-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 9px;
  border-radius: 10px;
  background: var(--surface-subtle);
}
.param-row.compact {
  padding: 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.param-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
}
.param-name { color: var(--text-secondary); font-weight: 500; }
.param-val { color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }

.clean-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: #D6DAE3;
  outline: none;
  cursor: pointer;
}
.clean-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 2px solid var(--accent);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.22);
}

.wind-dir-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-top: 3px;
}
.wind-dir-btn {
  height: 24px;
  border-radius: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.14s ease;
}
.wind-dir-btn:hover { background: var(--surface-hover); color: var(--text-primary); }
.wind-dir-btn.active { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }

/* ===== Modals ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.open { display: flex; }

.modal-card {
  width: min(500px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 15px; font-weight: 600; }
.modal-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

.clean-text-input {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-subtle);
  font-size: 13px;
  outline: none;
}
.clean-text-input:focus { border-color: var(--accent); background: var(--surface); }

.export-list { display: flex; flex-direction: column; gap: 7px; }
.export-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px;
  border-radius: 11px;
  background: var(--surface-subtle);
}
.export-item-meta { display: flex; flex-direction: column; gap: 2px; }
.export-item-name { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.export-item-sub { font-size: 11px; color: var(--text-muted); }

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}
.secondary-btn {
  height: 32px;
  padding: 0 13px;
  border-radius: 9px;
  background: var(--surface-subtle);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}
.secondary-btn:hover { background: var(--surface-hover); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 62px;
  left: 50%;
  transform: translate(-50%, -8px);
  z-index: 90;
  padding: 8px 14px;
  border-radius: 99px;
  background: rgba(21, 25, 34, 0.92);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

.hidden-input { display: none; }

@media (max-width: 1120px) {
  .left-panel { width: 226px; }
  .right-panel { width: 272px; }
  .bottom-bar { min-width: 320px; width: min(440px, calc(100vw - 530px)); }
}
