/* ==========================================================================
   Sprite3D — Clean Minimalist Unity/Godot Inspired Design System
   ========================================================================== */

:root {
  /* Light Theme */
  --bg-app: #f2f2f7;
  --bg-surface: #ffffff;
  --bg-surface-secondary: #f2f2f7;
  --bg-surface-tertiary: #e5e5ea;
  --bg-surface-hover: #d1d1d6;
  --bg-overlay: rgba(0, 0, 0, 0.35);

  --border-color: rgba(60, 60, 67, 0.12);
  --border-color-strong: rgba(60, 60, 67, 0.22);
  --border-focus: #007aff;

  --text-main: #000000;
  --text-secondary: rgba(60, 60, 67, 0.72);
  --text-muted: rgba(60, 60, 67, 0.45);
  --text-inverse: #ffffff;

  --primary: #007aff;
  --primary-hover: #0a84ff;
  --primary-active: #0062cc;
  --primary-light: rgba(0, 122, 255, 0.12);

  --success: #34c759;
  --success-bg: rgba(52, 199, 89, 0.14);
  --danger: #ff3b30;
  --danger-bg: rgba(255, 59, 48, 0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.18);

  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI Variable", "Segoe UI", system-ui, Roboto, sans-serif;
  --header-height: 56px;
  --footer-height: 48px;
  --sidebar-width: 310px;
}

[data-theme="dark"] {
  /* Dark Theme (Neutral Charcoal & Dark Gray) */
  --bg-app: #000000;
  --bg-surface: #1c1c1e;
  --bg-surface-secondary: #2c2c2e;
  --bg-surface-tertiary: #3a3a3c;
  --bg-surface-hover: #48484a;
  --bg-overlay: rgba(0, 0, 0, 0.6);

  --border-color: rgba(84, 84, 88, 0.45);
  --border-color-strong: rgba(84, 84, 88, 0.75);
  --border-focus: #0a84ff;

  --text-main: #ffffff;
  --text-secondary: rgba(235, 235, 245, 0.68);
  --text-muted: rgba(235, 235, 245, 0.38);
  --text-inverse: #000000;

  --primary: #0a84ff;
  --primary-hover: #409cff;
  --primary-active: #0071e3;
  --primary-light: rgba(10, 132, 255, 0.2);

  --success: #30d158;
  --success-bg: rgba(48, 209, 88, 0.18);
  --danger: #ff453a;
  --danger-bg: rgba(255, 69, 58, 0.18);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.65);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

.app-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  min-height: 0;
  background-color: var(--bg-app);
}

/* ==========================================================================
   Clean Header & Workflow Mode Navigation
   ========================================================================== */

.app-header {
  height: var(--header-height);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  z-index: 30;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.015em;
}

.logo-badge {
  background-color: var(--primary);
  color: #ffffff;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 750;
  letter-spacing: 0.02em;
}

/* Unity / Godot Style Workflow Tabs */
.header-workflow-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background-color: var(--bg-surface-secondary);
  padding: 3px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
}

.workflow-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.workflow-tab:hover {
  color: var(--text-main);
  background-color: var(--bg-surface-hover);
}

.workflow-tab.active {
  color: #ffffff;
  background-color: var(--primary);
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.3);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.78125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-lang:hover {
  background-color: var(--bg-surface-tertiary);
}

.btn-icon {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.btn-icon:hover {
  background-color: var(--bg-surface-tertiary);
  color: var(--text-main);
}

[data-theme="light"] .moon-icon { display: block; }
[data-theme="light"] .sun-icon { display: none; }
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="dark"] .sun-icon { display: block; }

/* ==========================================================================
   Main App Content
   ========================================================================== */

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

/* Landing / Dropzone */
.landing-view {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.landing-card {
  width: 100%;
  max-width: 520px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.drop-zone {
  padding: 44px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border: 2px dashed var(--border-color-strong);
  border-radius: var(--radius-md);
  margin: 16px;
  background-color: var(--bg-surface-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.drop-illustration {
  color: var(--primary);
  margin-bottom: 14px;
}

.drop-zone h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.drop-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

.samples-tray {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-surface-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.samples-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.sample-chips {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sample-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sample-chip img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.sample-chip:hover {
  background-color: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* ==========================================================================
   Editor View (Central Viewport + Right Context Sidebar)
   ========================================================================== */

.editor-view {
  flex: 1;
  display: flex;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.viewport-area {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-app);
}

.viewport-container {
  width: 100%;
  height: 100%;
  display: block;
}

.viewport-overlay-top {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 10;
  display: flex;
  gap: 8px;
}

.btn-floating {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  backdrop-filter: blur(8px);
}

.btn-floating:hover {
  background-color: var(--bg-surface-hover);
}

/* Progress Overlay */
.progress-overlay {
  position: absolute;
  inset: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  backdrop-filter: blur(4px);
}

.progress-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 90%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-lg);
}

.progress-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.progress-text-block {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.8125rem;
  font-weight: 600;
}

.progress-bar-track {
  width: 100%;
  height: 6px;
  background-color: var(--bg-surface-tertiary);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--primary);
  border-radius: var(--radius-pill);
  transition: width 0.2s ease;
}

/* Error Banner */
.error-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--danger);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 50;
}

/* ==========================================================================
   Right Contextual Sidebar
   ========================================================================== */

.context-sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 20;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 14px;
  gap: 12px;
}

.context-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  animation: fadeIn 0.18s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.sidebar-card {
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-label {
  font-size: 0.75rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.source-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.source-thumb {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  object-fit: contain;
  flex-shrink: 0;
}

.source-meta {
  flex: 1;
  min-width: 0;
}

.source-title {
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Control Rows */
.control-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.control-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.control-header label, .control-row-toggle label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
}

.value-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
}

.control-row-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* iOS Toggle Style Checkbox */
.toggle-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 36px;
  height: 20px;
  background-color: var(--border-color-strong);
  border-radius: var(--radius-pill);
  position: relative;
  cursor: pointer;
  outline: none;
  transition: background-color 0.2s ease;
}

.toggle-checkbox::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  background-color: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.2s ease;
}

.toggle-checkbox:checked {
  background-color: var(--primary);
}

.toggle-checkbox:checked::before {
  transform: translateX(16px);
}

/* Form Inputs & Selects */
.form-input, .form-select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  font-size: 0.8125rem;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus, .form-select:focus {
  border-color: var(--border-focus);
}

.form-color-picker {
  width: 100%;
  height: 32px;
  padding: 2px 4px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  cursor: pointer;
}

/* Setting Groups */
.setting-group {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.setting-group summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  cursor: pointer;
}

.setting-group summary::-webkit-details-marker {
  display: none;
}

.chevron {
  font-size: 0.875rem;
  transition: transform 0.2s ease;
}

.setting-group[open] .chevron {
  transform: rotate(90deg);
}

.group-content {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--border-color);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--bg-surface-secondary);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: var(--bg-surface-tertiary);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border-color-strong);
  color: var(--text-main);
}

.btn-outline:hover {
  background-color: var(--bg-surface-hover);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-main);
}

.btn-danger-ghost {
  background-color: transparent;
  color: var(--danger);
}

.btn-danger-ghost:hover {
  background-color: var(--danger-bg);
}

.btn-sm {
  padding: 4px 8px;
  font-size: 0.75rem;
}

.btn-action-large {
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 700;
  border-radius: var(--radius-md);
}

.btn-finish-rig {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn-finish-rig:hover {
  filter: brightness(1.08);
}

/* Bone Hierarchy Tree */
.bone-tree-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.bone-tree-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.1s ease;
}

.bone-tree-item:hover {
  background-color: var(--bg-surface-hover);
}

.bone-tree-item.active {
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

/* Animation Tools */
.anim-tool-group {
  display: flex;
  gap: 4px;
  background-color: var(--bg-surface);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.btn-tool {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  padding: 5px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-tool:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-main);
}

.btn-tool.active {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-auto-anim {
  color: #d97706;
  border-color: #fcd34d;
  background-color: #fffbeb;
  font-weight: 600;
}

.btn-auto-anim:hover {
  background-color: #fef3c7;
}

/* Export Cards */
.export-featured-card {
  border-color: #10b981;
  background: linear-gradient(180deg, var(--bg-surface-secondary) 0%, rgba(16, 185, 129, 0.05) 100%);
}

.btn-mc-export {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.btn-mc-export:hover {
  filter: brightness(1.08);
}

/* ==========================================================================
   Clean Minimalist Floating Timeline (Animation Mode Only)
   ========================================================================== */

.bottom-timeline {
  position: absolute;
  bottom: 16px;
  left: 20px;
  right: 20px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-lg);
  padding: 8px 14px;
  box-shadow: var(--shadow-lg);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  backdrop-filter: blur(12px);
  animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.btn-icon-timeline {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface-secondary);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-icon-timeline:hover {
  background-color: var(--bg-surface-hover);
}

.btn-icon-timeline.active {
  color: var(--primary);
  background-color: var(--primary-light);
}

.btn-play-main {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.btn-play-main:hover {
  filter: brightness(1.1);
}

.timeline-counter {
  font-family: monospace;
  font-weight: 700;
  font-size: 0.78125rem;
  color: var(--text-main);
  padding: 0 6px;
  white-space: nowrap;
}

.timeline-track-wrap {
  position: relative;
  flex: 1;
  height: 28px;
  display: flex;
  align-items: center;
}

.timeline-scrubber {
  width: 100%;
  cursor: pointer;
  z-index: 2;
  position: relative;
  accent-color: var(--primary);
}

.timeline-dots-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.keyframe-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f59e0b;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  cursor: grab;
  z-index: 10;
  transition: transform 0.1s ease, background-color 0.1s ease;
}

.keyframe-dot:hover {
  transform: translate(-50%, -50%) scale(1.4);
  background: #fbbf24;
}

.keyframe-dot:active,
.keyframe-dot.dragging {
  cursor: grabbing;
  background: #ef4444;
  transform: translate(-50%, -50%) scale(1.5);
}

.timeline-key-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   Modals (Global Centered Dialogs, Admin Panel, Background Remover)
   ========================================================================== */

.modal-backdrop,
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-sizing: border-box;
}

.modal-backdrop[style*="display: none"],
.modal-overlay[style*="display: none"],
.modal-backdrop.hidden,
.modal-overlay.hidden {
  display: none !important;
}

.modal-dialog,
.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), var(--shadow-lg);
  overflow: hidden;
  max-width: 480px;
  width: 95%;
  animation: modalPopIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 100000;
}

@keyframes modalPopIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-card-bgremover {
  max-width: 920px;
  width: 95%;
  height: 80vh;
  max-height: 700px;
  display: flex;
  flex-direction: column;
}

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

.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 3px 7px;
}

.modal-close:hover {
  background-color: var(--bg-surface-secondary);
  color: var(--text-main);
}

.bg-remover-body {
  flex: 1;
  display: flex;
  gap: 14px;
  padding: 14px;
  min-height: 0;
  overflow: hidden;
}

.bg-canvas-container {
  flex: 1;
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  position: relative;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background-image: linear-gradient(45deg, #e0e0e4 25%, transparent 25%),
                    linear-gradient(-45deg, #e0e0e4 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, #e0e0e4 75%),
                    linear-gradient(-45deg, transparent 75%, #e0e0e4 75%);
  background-size: 16px 16px;
}

[data-theme="dark"] .bg-canvas-container {
  background-image: linear-gradient(45deg, #2c2c2e 25%, transparent 25%),
                    linear-gradient(-45deg, #2c2c2e 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, #2c2c2e 75%),
                    linear-gradient(-45deg, transparent 75%, #2c2c2e 75%);
}

#bgRemoverCanvas {
  max-width: 100%;
  max-height: 100%;
  box-shadow: var(--shadow-md);
  border-radius: 4px;
  image-rendering: pixelated;
  cursor: crosshair;
}

.bg-remover-hint {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--bg-surface);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.bg-tools-panel {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.bg-color-preview-chip {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--border-color-strong);
  display: inline-block;
}

.bg-remover-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-surface);
}

/* ==========================================================================
   Universal Part Cutter & Model Parts UI
   ========================================================================== */

.parts-list-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.part-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.8125rem;
}

.part-item:hover {
  border-color: var(--color-primary);
  background-color: rgba(59, 130, 246, 0.05);
}

.part-item.active {
  border-color: var(--color-primary);
  background-color: rgba(59, 130, 246, 0.12);
  font-weight: 700;
  color: var(--color-primary);
}

.part-item-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cutter-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  cursor: crosshair;
  pointer-events: auto;
}

.cutter-toolbar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 30px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 60;
  color: #f8fafc;
  font-size: 0.8125rem;
  pointer-events: auto;
}

.cutter-status {
  font-weight: 600;
  color: #e2e8f0;
}

.cutter-svg {
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

.cutter-svg line, .cutter-svg polyline {
  stroke: #38bdf8;
  stroke-width: 3;
  stroke-dasharray: 6 4;
  fill: none;
}

.cutter-svg circle {
  fill: #3b82f6;
  stroke: #ffffff;
  stroke-width: 2.5;
  cursor: grab;
  transition: r 0.1s ease;
}

.cutter-svg circle:hover, .cutter-svg circle.dragging {
  r: 9;
  fill: #60a5fa;
  stroke: #38bdf8;
  cursor: grabbing;
}

/* Anatomy Markers List */
.anatomy-markers-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.anatomy-marker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  transition: all var(--transition-fast);
}

.anatomy-marker-item:hover, .anatomy-marker-item.active {
  border-color: var(--primary);
  background: var(--bg-surface-hover);
}

.anatomy-marker-item .marker-badge {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}

.anatomy-marker-item .marker-name {
  font-weight: 600;
  color: var(--text-main);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.anatomy-marker-item .marker-actions {
  display: flex;
  gap: 3px;
}

.anatomy-marker-item .btn-icon-xs {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-xs);
  font-size: 0.75rem;
}

.anatomy-marker-item .btn-icon-xs:hover {
  color: var(--danger);
  background: var(--danger-subtle);
}

/* Quality Presets */
.preset-group {
  display: flex;
  gap: 4px;
  background-color: var(--bg-surface-secondary);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.btn-preset {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.75rem;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-preset:hover {
  color: var(--text-main);
  background: var(--bg-surface-hover);
}

.btn-preset.active {
  background: var(--bg-surface);
  color: var(--text-main);
  font-weight: 700;
  border-color: var(--border-color-strong);
  box-shadow: var(--shadow-sm);
}

.btn-action-large {
  padding: 10px 16px;
  font-size: 0.875rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.btn-action-large:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   Header Nav Tabs (Sprite → 3D | FBX → Minecraft)
   ========================================================================== */
.header-nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-surface-secondary);
  padding: 3px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-tab:hover {
  color: var(--text-main);
  background: var(--bg-surface-hover);
}

.nav-tab.active {
  color: var(--text-main);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   FBX → Minecraft Tab Workspace Styles
   ========================================================================== */
.fbx-container {
  display: flex;
  flex: 1;
  width: 100%;
  height: calc(100vh - var(--header-height));
  position: relative;
  overflow: hidden;
}

.fbx-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.fbx-stat-box {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
}

.fbx-stat-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fbx-stat-value {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}

.fbx-timeline-panel {
  position: absolute;
  bottom: 16px;
  left: 20px;
  right: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-md);
  z-index: 10;
}

.fbx-timeline-slider {
  flex: 1;
  cursor: pointer;
}

.fbx-validation-box {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px;
  margin-top: 8px;
}

.btn-add-anim {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 5px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-add-anim:hover {
  background: var(--bg-surface-hover);
  border-color: var(--primary);
  color: var(--primary);
}

/* ==========================================================================
   Logo, Landing Rules Card, Daily Limit, License Modal & Download Toast
   ========================================================================== */

.logo-img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: 6px;
}

.landing-rules-card {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.rules-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.rules-card-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rules-logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
}

.rules-card-title {
  font-size: 1.05rem;
  font-weight: 750;
  color: var(--text-main);
  margin: 0;
}

.rules-card-author {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.badge-tag {
  font-size: 0.6875rem;
  font-weight: 750;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.daily-limit-badge-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  min-width: 140px;
}

.daily-limit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78125rem;
  margin-bottom: 4px;
}

.daily-limit-track {
  width: 100%;
  height: 6px;
  background: var(--bg-surface-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.daily-limit-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.rule-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--bg-surface);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.rule-icon-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rule-icon-limit {
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
}

.rule-icon-license {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}

.rule-icon-photo {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.rule-text strong {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--text-main);
}

.rule-text p {
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--text-secondary);
  margin: 0;
}

.rules-copy-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-surface);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color-strong);
}

.rules-copy-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.rules-input-group {
  display: flex;
  gap: 8px;
}

.rules-input {
  flex: 1;
  font-family: monospace;
  font-size: 0.8125rem;
  background: var(--bg-surface-secondary);
}

/* License Modal */
.modal-license-card {
  max-width: 540px;
  width: 92%;
}

.license-author-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--primary-light);
  border: 1px solid rgba(37, 99, 235, 0.2);
  padding: 10px 14px;
  border-radius: var(--radius-md);
}

.license-author-info {
  display: flex;
  align-items: center;
  gap: 6px;
}

.license-author-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.license-author-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary);
}

.license-badge-pill {
  font-size: 0.75rem;
  font-weight: 750;
  background: var(--primary);
  color: #ffffff;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}

.license-section-title {
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.license-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.license-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--text-main);
  line-height: 1.4;
}

.license-check {
  color: var(--success);
  font-weight: 800;
  flex-shrink: 0;
}

.license-requirement-card {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.license-req-header {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #b45309;
  font-size: 0.84375rem;
  margin-bottom: 4px;
}

.license-req-icon {
  color: #d97706;
  flex-shrink: 0;
}

.license-req-desc {
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-main);
  margin: 0;
}

.license-copy-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.attribution-copy-box {
  display: flex;
  gap: 8px;
}

.attribution-input {
  flex: 1;
  font-family: monospace;
  font-size: 0.8125rem;
  background: var(--bg-surface-secondary);
}

/* Global Download Attribution Toast */
.download-notice-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  background: var(--bg-surface);
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 14px 18px;
  max-width: 420px;
  width: calc(100vw - 48px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slideUpToast 0.3s ease;
}

@keyframes slideUpToast {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.toast-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 2px 4px;
  line-height: 1;
}

.toast-close-btn:hover {
  color: var(--text-main);
}

.toast-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 0;
}

.toast-copy-row {
  display: flex;
  gap: 6px;
}

.toast-input {
  flex: 1;
  font-family: monospace;
  font-size: 0.75rem;
  background: var(--bg-surface-secondary);
}

/* Dedicated License & Rules Tab Page */
.tab-pane-license {
  width: 100%;
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 32px 20px;
  background-color: var(--bg-app);
}

.license-page-container {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

.license-page-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.license-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-color);
}

.license-page-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.license-author-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.author-highlight {
  color: var(--primary);
  font-size: 1.05rem;
  font-weight: 800;
}

.license-details-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-surface-secondary);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

/* ==========================================================================
   Responsive Screen Optimization
   ========================================================================== */
.context-sidebar {
  width: var(--sidebar-width);
  scrollbar-width: thin;
  scrollbar-color: var(--border-color-strong) transparent;
}

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

.context-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.context-sidebar::-webkit-scrollbar-thumb {
  background-color: var(--border-color-strong);
  border-radius: var(--radius-pill);
}

/* ==========================================================================
   Mobile & Responsive Optimization System (Phones & Tablets)
   ========================================================================== */

/* Touch-action: Prevent page scroll interference during 3D model rotation & zooming */
.viewport-area,
.viewport-container,
.viewport-container canvas,
#fbxViewportContainer,
#fbxViewportContainer canvas {
  touch-action: none !important;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Touch-Friendly Range Sliders across all devices */
input[type="range"] {
  height: 28px;
  cursor: pointer;
  accent-color: var(--primary);
  background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: var(--radius-pill);
  background-color: var(--border-color-strong);
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  margin-top: -8px;
  cursor: grab;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

input[type="range"]:active::-webkit-slider-thumb {
  cursor: grabbing;
  transform: scale(1.18);
  box-shadow: 0 0 0 6px var(--primary-light), 0 2px 6px rgba(0, 0, 0, 0.35);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: var(--radius-pill);
  background-color: var(--border-color-strong);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  cursor: grab;
}

/* Touch active state on buttons */
.btn:active,
.sample-chip:active,
.preset-scale-btn:active,
.preset-thickness-btn:active,
.btn-floating:active {
  transform: scale(0.97);
}

/* Slim scrollbar for sidebar */
.context-sidebar {
  width: var(--sidebar-width);
  scrollbar-width: thin;
  scrollbar-color: var(--border-color-strong) transparent;
}

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

.context-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.context-sidebar::-webkit-scrollbar-thumb {
  background-color: var(--border-color-strong);
  border-radius: var(--radius-pill);
}

/* Laptops & Compact screens (height <= 850px) */
@media (max-height: 850px) {
  .context-sidebar {
    padding: 10px;
    gap: 8px;
  }
  .sidebar-card {
    padding: 10px;
    gap: 8px;
  }
  .control-row {
    margin-bottom: 6px;
  }
  .export-featured-card {
    margin-top: 6px !important;
  }
  .btn-action-large {
    padding: 9px 14px;
  }
}

/* Medium Tablets (width <= 1024px) */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 290px;
  }
  .header-nav-tabs {
    margin-left: 8px !important;
  }
  .nav-tab {
    padding: 5px 10px;
    font-size: 0.75rem;
  }
}

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

  html, body, .app-root {
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100vh;
  }

  .app-header {
    padding: 0 10px;
    height: var(--header-height);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .header-left {
    gap: 8px;
  }

  .logo {
    font-size: 0.9375rem;
    gap: 6px;
  }

  .logo-img {
    width: 24px;
    height: 24px;
  }

  .logo-badge {
    display: none;
  }

  .header-nav-tabs {
    margin-left: 4px !important;
    gap: 2px;
    padding: 2px;
  }

  .nav-tab {
    padding: 4px 8px;
    font-size: 0.72rem;
    gap: 4px;
  }

  .nav-tab svg {
    width: 12px;
    height: 12px;
  }

  .header-right {
    gap: 4px;
  }

  .btn-lang {
    padding: 4px 6px;
    font-size: 0.75rem;
  }

  /* 3D Editor View on Phones */
  .editor-view {
    flex-direction: column;
    height: auto !important;
    min-height: calc(100vh - var(--header-height));
    overflow: visible;
  }

  /* Sticky 3D Viewport on top so users see model while tweaking sliders */
  .viewport-area {
    position: sticky;
    top: 0;
    z-index: 25;
    height: 40vh;
    min-height: 240px;
    max-height: 360px;
    flex: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  }

  .viewport-overlay-top {
    top: 10px;
    left: 10px;
    gap: 6px;
  }

  .btn-floating {
    padding: 4px 8px;
    font-size: 0.72rem;
    gap: 4px;
  }

  .btn-floating svg {
    width: 12px;
    height: 12px;
  }

  /* Context Sidebar Stacks Below Viewport */
  .context-sidebar {
    width: 100% !important;
    height: auto !important;
    border-left: none;
    border-top: 1px solid var(--border-color);
    padding: 12px 14px calc(24px + env(safe-area-inset-bottom, 0px)) 14px;
    gap: 10px;
    overflow-y: visible;
  }

  .sidebar-card {
    padding: 12px 14px;
    gap: 10px;
    border-radius: var(--radius-md);
  }

  .setting-group summary {
    padding: 10px 12px;
    font-size: 0.8125rem;
  }

  .control-row {
    margin-bottom: 8px;
  }

  .control-header label, .control-row-toggle label {
    font-size: 0.8125rem;
  }

  .preset-scale-btn,
  .preset-thickness-btn {
    min-height: 30px;
    padding: 4px 8px;
    font-size: 0.72rem;
    flex: 1 1 auto;
    text-align: center;
  }

  /* Export Block on Phones */
  .export-featured-card {
    margin-top: 10px !important;
    padding: 14px !important;
    background-color: var(--bg-surface) !important;
    border: 1.5px solid var(--primary) !important;
  }

  .form-input, .form-select {
    font-size: 0.875rem;
    padding: 8px 10px;
  }

  #btnUnifiedExport {
    min-height: 48px;
    font-size: 0.9375rem;
    font-weight: 750;
  }

  #btnExportMixamoZip {
    min-height: 40px;
    font-size: 0.8125rem;
  }

  /* Landing Dropzone on Phones */
  .landing-view {
    padding: 16px 12px;
    height: auto !important;
    min-height: calc(100vh - var(--header-height));
  }

  .landing-card {
    padding: 0;
    max-width: 100%;
    width: 100%;
    border-radius: var(--radius-lg);
  }

  .drop-zone {
    padding: 24px 14px;
  }

  .drop-illustration svg {
    width: 38px;
    height: 38px;
  }

  .drop-title {
    font-size: 1.15rem;
  }

  .drop-subtitle {
    font-size: 0.8125rem;
    margin-bottom: 14px;
  }

  #btnBrowse {
    width: 100%;
    max-width: 260px;
    min-height: 44px;
    font-size: 0.875rem;
  }

  .samples-tray {
    padding: 10px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .sample-chips {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  /* Universal Part Cutter on Mobile */
  .cutter-toolbar {
    top: 8px;
    padding: 4px 10px;
    font-size: 0.75rem;
    gap: 6px;
    max-width: 95%;
    flex-wrap: wrap;
    justify-content: center;
  }

  .cutter-toolbar .btn-sm {
    padding: 3px 8px;
    font-size: 0.72rem;
  }

  /* Timeline on Phones */
  .fbx-timeline-panel {
    bottom: 8px;
    left: 8px;
    right: 8px;
    transform: none;
    width: auto;
    padding: 6px 10px;
    gap: 6px;
    flex-wrap: wrap;
  }

  #selectFbxAnimation {
    min-width: 110px !important;
    font-size: 0.75rem;
  }

  /* Background Remover Modal on Phones */
  .modal-card-bgremover {
    height: 92vh !important;
    max-height: 92vh !important;
    width: 96% !important;
  }

  .bg-remover-body {
    flex-direction: column !important;
    gap: 10px;
    overflow-y: auto;
  }

  .bg-canvas-container {
    height: 45vh !important;
    min-height: 200px;
  }

  .bg-tools-panel {
    width: 100% !important;
    height: auto !important;
    overflow-y: visible;
  }

  /* Toast notification on Mobile */
  .download-notice-toast {
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-width: 100% !important;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* License tab on Mobile */
  .tab-pane-license {
    padding: 16px 12px calc(24px + env(safe-area-inset-bottom, 0px)) 12px;
    height: auto !important;
    min-height: calc(100vh - var(--header-height));
  }

  .license-page-card {
    padding: 16px 14px;
    gap: 14px;
  }

  .rules-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }
}

/* Extra small phones (width <= 380px) */
@media (max-width: 380px) {
  .logo-title {
    font-size: 0.875rem;
  }
  .nav-tab {
    padding: 3px 6px;
    font-size: 0.68rem;
  }
  .viewport-area {
    height: 36vh;
    min-height: 210px;
  }
}






/* ==========================================================================
   iOS Design Layer — inset-grouped cards, switches, filled sliders, sheets
   ========================================================================== */

:root { --sidebar-width: 348px; --radius-xl: 24px; --ease-ios: cubic-bezier(0.32, 0.72, 0, 1); }
html { -webkit-text-size-adjust: 100%; }
body { letter-spacing: -0.011em; font-feature-settings: "calt", "kern"; }
.ico { flex-shrink: 0; vertical-align: middle; }

/* ---- Header bar ---- */
.app-header {
  background-color: color-mix(in srgb, var(--bg-surface) 70%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 0.5px solid var(--border-color-strong);
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
}
.logo-img { width: 32px; height: 32px; border-radius: 9px; box-shadow: 0 0 0 0.5px var(--border-color-strong), 0 2px 6px rgba(0, 0, 0, 0.35); }
.logo { font-weight: 700; font-size: 1.12rem; letter-spacing: -0.03em; gap: 10px; }
.logo-badge { border-radius: var(--radius-pill); padding: 2px 9px; font-weight: 700; background: var(--primary-light); color: var(--primary); }

/* ---- Segmented controls ---- */
.header-workflow-nav, .header-nav-tabs, .preset-group {
  background: rgba(118, 118, 128, 0.24);
  border: none !important;
  border-radius: 11px;
  padding: 2px !important;
  gap: 0 !important;
}
[data-theme="light"] .header-workflow-nav, [data-theme="light"] .header-nav-tabs, [data-theme="light"] .preset-group { background: rgba(118, 118, 128, 0.12); }
.workflow-tab, .nav-tab, .btn-preset {
  border-radius: 9px !important;
  padding: 6px 14px;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--text-main);
  background: transparent !important;
  border: none !important;
  box-shadow: none;
  transition: background-color 0.25s var(--ease-ios), box-shadow 0.25s var(--ease-ios), color 0.2s ease;
}
.workflow-tab:not(.active), .nav-tab:not(.active), .btn-preset:not(.active) { color: var(--text-secondary); }
.workflow-tab.active, .nav-tab.active, .btn-preset.active {
  background: #636366 !important;
  color: #fff !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28), 0 0.5px 1px rgba(0, 0, 0, 0.3);
}
[data-theme="light"] .workflow-tab.active, [data-theme="light"] .nav-tab.active, [data-theme="light"] .btn-preset.active {
  background: #ffffff !important; color: #000 !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 0.5px 1px rgba(0, 0, 0, 0.12);
}

/* ---- Buttons ---- */
.btn {
  border-radius: 14px;
  font-weight: 600;
  padding: 9px 18px;
  min-height: 36px;
  border: none;
  transition: transform 0.18s var(--ease-ios), opacity 0.15s ease, background-color 0.15s ease;
}
.btn:active { transform: scale(0.96); opacity: 0.8; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--primary-light); color: var(--primary); border: none; }
.btn-outline, .btn-ghost { background: rgba(118, 118, 128, 0.24); border: none; color: var(--text-main); }
[data-theme="light"] .btn-outline, [data-theme="light"] .btn-ghost { background: rgba(118, 118, 128, 0.12); }
.btn-outline:hover, .btn-ghost:hover { background: rgba(118, 118, 128, 0.36); }
.btn-sm { min-height: 30px; padding: 6px 13px; border-radius: 12px; }
.btn-xs { min-height: 26px; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; }
.btn-action-large { min-height: 50px; border-radius: 16px !important; font-size: 1rem !important; letter-spacing: -0.02em; }
.btn:focus-visible, .nav-tab:focus-visible, .workflow-tab:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 50%, transparent);
  outline-offset: 2px;
}
.preset-thickness-btn.active, .preset-scale-btn.active { background: var(--primary) !important; color: #fff !important; }

/* ---- Landing ---- */
.landing-view { background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 60%), var(--bg-app); }
.landing-card { border: none; border-radius: var(--radius-xl); background: var(--bg-surface); box-shadow: var(--shadow-lg); }
.drop-zone {
  border: 1.5px dashed var(--border-color-strong);
  border-radius: 18px;
  background: var(--bg-surface-secondary);
  margin: 14px;
  padding: 48px 28px;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--primary); background: var(--primary-light); }
.drop-illustration svg { width: 56px; height: 56px; stroke-width: 1.5; }
.drop-zone h2 { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.03em; }
.samples-tray { border-top: 0.5px solid var(--border-color-strong); background: transparent; padding: 14px 18px; flex-wrap: wrap; }
.sample-chip { background: var(--bg-surface-secondary); border: none; border-radius: 999px; padding: 5px 12px 5px 6px; color: var(--text-main); }
.sample-chip img { width: 26px; height: 26px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35)); }
.sample-chip:hover { background: var(--primary-light); color: var(--primary); border: none; }

/* ---- Editor sidebar: inset-grouped ---- */
.context-sidebar {
  background: var(--bg-app);
  border-left: 0.5px solid var(--border-color-strong);
  padding: 14px 14px 28px;
  gap: 14px;
  scrollbar-width: thin;
}
.sidebar-card, .setting-group {
  background: var(--bg-surface);
  border: none;
  border-radius: 20px;
  box-shadow: none;
  padding: 16px;
  gap: 14px;
}
.setting-group { padding: 0; overflow: hidden; }
.card-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}
.source-card { align-items: center; gap: 12px; }
.source-thumb { width: 52px; height: 52px; border-radius: 12px; background: var(--bg-surface-secondary); object-fit: contain; padding: 3px; }
.source-title { font-weight: 600; font-size: 0.9375rem; }

.control-row { gap: 8px; }
.control-header label, .control-row-toggle label { font-size: 0.9375rem; font-weight: 500; letter-spacing: -0.015em; }
.value-badge {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.control-row-toggle { padding: 2px 0; min-height: 34px; gap: 12px; }
.control-row-toggle + .control-row-toggle, .control-row + .control-row-toggle, .control-row-toggle + .control-row { border-top: 0.5px solid var(--border-color); padding-top: 12px; }

/* iOS switch */
.toggle-checkbox { width: 51px; height: 31px; background: rgba(120, 120, 128, 0.32); border-radius: 999px; flex-shrink: 0; transition: background-color 0.3s var(--ease-ios); }
.toggle-checkbox::before { width: 27px; height: 27px; top: 2px; left: 2px; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16), 0 3px 1px rgba(0, 0, 0, 0.1); transition: transform 0.3s var(--ease-ios), width 0.2s ease; }
.toggle-checkbox:active::before { width: 33px; }
.toggle-checkbox:checked { background: var(--success); }
.toggle-checkbox:checked::before { transform: translateX(20px); }
.toggle-checkbox:checked:active::before { transform: translateX(14px); }

/* iOS slider (fill driven by --p from app.js) */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 28px; width: 100%; background: transparent; cursor: pointer; --p: 50%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 999px;
  background: linear-gradient(to right, var(--primary) var(--p), rgba(120, 120, 128, 0.32) var(--p));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 28px; height: 28px; margin-top: -12px; border-radius: 50%;
  background: #fff; border: none;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3), 0 0 0 0.5px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s var(--ease-ios);
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.1); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 999px; background: rgba(120, 120, 128, 0.32); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--primary); }
input[type="range"]::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: none; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3); }

/* Inputs */
.form-input, .form-select, input[type="text"], input[type="password"], input[type="number"], select {
  border-radius: 12px;
  background: rgba(118, 118, 128, 0.24);
  border: 1.5px solid transparent;
  color: var(--text-main);
  padding: 9px 12px;
  font-size: 0.9375rem;
}
[data-theme="light"] .form-input, [data-theme="light"] .form-select { background: rgba(118, 118, 128, 0.12); }
.form-input:focus, .form-select:focus { border-color: var(--primary); }
.form-select {
  -webkit-appearance: none; appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%238e8e93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.form-select option { background: var(--bg-surface); color: var(--text-main); }
.form-color-picker { border-radius: 12px; border: none; background: rgba(118, 118, 128, 0.24); height: 38px; }

/* Collapsible groups as list rows */
.setting-group summary { padding: 16px; font-size: 0.9375rem; font-weight: 600; text-transform: none; letter-spacing: -0.015em; color: var(--text-main); }
.setting-group summary:active { background: rgba(118, 118, 128, 0.18); }
.chevron { font-size: 1.25rem; color: var(--text-muted); line-height: 1; transition: transform 0.3s var(--ease-ios); }
.setting-group[open] .chevron { transform: rotate(90deg); }
.group-content { border-top: 0.5px solid var(--border-color); padding: 16px; gap: 16px; }

/* Export card */
.export-featured-card { background: var(--bg-surface); }
.export-featured-card label { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
#btnExportMixamoZip { min-height: 42px; }

/* ---- Viewport ---- */
.viewport-area { background: var(--bg-app); }
.viewport-overlay-top { gap: 8px; padding: 14px; }
.btn-floating {
  background: color-mix(in srgb, var(--bg-surface) 66%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 0.5px solid var(--border-color-strong);
  border-radius: 999px;
  color: var(--text-main);
  padding: 8px 14px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.btn-floating.active { background: var(--primary); color: #fff; border-color: transparent; }
.progress-box { border-radius: 24px; border: none; background: color-mix(in srgb, var(--bg-surface) 85%, transparent); -webkit-backdrop-filter: saturate(180%) blur(30px); backdrop-filter: saturate(180%) blur(30px); box-shadow: var(--shadow-lg); }
.progress-bar-track { height: 6px; border-radius: 999px; background: rgba(120, 120, 128, 0.32); }
.progress-bar-fill { border-radius: 999px; background: var(--primary); }
.error-banner { border-radius: 16px; border: none; background: var(--danger-bg); color: var(--danger); }

/* ---- Cards on other tabs ---- */
.landing-rules-card, .license-page-card, .bg-tools-panel { border: none; border-radius: 24px; background: var(--bg-surface); box-shadow: var(--shadow-md); }
.license-requirement-card { border: none; border-radius: 16px; background: var(--primary-light); }
.license-req-header, .license-req-header strong, .license-req-icon { color: var(--primary); }
.license-check { display: inline-flex; color: var(--success); margin-right: 4px; }
.badge-tag { border-radius: 999px; }
.rule-item { border: none; border-radius: 16px; background: var(--bg-surface-secondary); }

/* ---- Sheets / modals ---- */
.modal-backdrop { -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.modal-card, .modal-license-card {
  border: none;
  border-radius: 26px;
  background: color-mix(in srgb, var(--bg-surface) 94%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  box-shadow: var(--shadow-lg);
}
.modal-close, .toast-close-btn {
  width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(118, 118, 128, 0.24); color: var(--text-secondary);
}
.modal-close:hover, .toast-close-btn:hover { background: rgba(118, 118, 128, 0.4); color: var(--text-main); }
.download-notice-toast {
  border: none; border-radius: 22px; box-shadow: var(--shadow-lg);
  background: color-mix(in srgb, var(--bg-surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(28px); backdrop-filter: saturate(180%) blur(28px);
}

/* ---- Bones / checks ---- */
.bone-tree-icon { display: inline-flex; color: var(--text-secondary); }
.chk-ico { display: inline-flex; }

/* ---- Scrollbars ---- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(120, 120, 128, 0.45); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 720px) {
  .app-header { height: auto; flex-wrap: wrap; row-gap: 6px; padding-top: 8px; padding-bottom: 8px; }
  .header-left { width: 100%; min-width: 0; gap: 8px; }
  .logo-badge { display: none; }
  .header-nav-tabs { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .header-nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tab { white-space: nowrap; padding: 6px 10px; flex-shrink: 0; }
  .header-right { width: 100%; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
  .landing-card, .license-page-card { max-width: 100%; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.nav-tab, .workflow-tab, .header-right .btn, .btn-floating, .logo-title { white-space: nowrap; }
.source-meta { min-width: 0; flex: 1; }
.source-title, .source-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* ==========================================================================
   Minimal pass — flat header, symmetric layout, compact editor
   ========================================================================== */
.app-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 60px;
  padding: 0 20px;
  background: var(--bg-app);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border-bottom: none;
}
.header-left { justify-self: start; }
.header-right { justify-self: end; display: flex; align-items: center; gap: 8px; }
.header-nav-tabs { justify-self: center; margin: 0 !important; background: var(--bg-surface); border-radius: 12px; padding: 3px !important; }
.logo { gap: 10px; font-size: 1.05rem; font-weight: 650; letter-spacing: -0.03em; }
.logo-img { width: 28px; height: 28px; border-radius: 8px; box-shadow: none; }
.logo-badge { display: none; }
.nav-tab { padding: 7px 16px; font-size: 0.875rem; font-weight: 500; border-radius: 9px !important; }
.nav-tab.active { background: var(--bg-surface-tertiary) !important; color: var(--text-main) !important; box-shadow: none; }
[data-theme="light"] .nav-tab.active { background: var(--bg-surface-tertiary) !important; color: #000 !important; }
.hdr-btn {
  height: 36px; min-width: 36px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 10px; cursor: pointer;
  background: var(--bg-surface); color: var(--text-secondary);
  font-size: 0.8125rem; font-weight: 600; letter-spacing: 0;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s var(--ease-ios);
}
.hdr-btn:hover { background: var(--bg-surface-tertiary); color: var(--text-main); }
.hdr-btn:active { transform: scale(0.95); }
.hdr-square { width: 36px; padding: 0; }
#btnOpenBgRemover { color: var(--text-main); }

/* Landing */
.landing-view { background: var(--bg-app); }
.landing-card { box-shadow: none; background: var(--bg-surface); }
.drop-zone { border: 1.5px dashed var(--border-color-strong); background: transparent; }
.samples-tray { justify-content: center; gap: 14px; border-top: none; padding: 4px 18px 20px; }
.samples-label { display: none; }
.sample-chips { justify-content: center; gap: 10px; }
.sample-chip { background: var(--bg-surface-secondary); padding: 6px 14px 6px 8px; font-weight: 500; }
.sample-chip img { filter: none; }

/* License: minimal list */
.license-page-container { display: flex; justify-content: center; padding: 56px 24px; width: 100%; }
.license-page-card { width: 100%; max-width: 480px; box-shadow: none; padding: 28px; display: flex; flex-direction: column; gap: 8px; }
.license-page-title { font-size: 1.5rem; font-weight: 650; letter-spacing: -0.03em; margin-bottom: 8px; text-align: center; }
.lic-list { display: flex; flex-direction: column; }
.lic-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 0; border-top: 0.5px solid var(--border-color); }
.lic-row:first-child { border-top: none; }
.lic-row strong { font-weight: 500; font-size: 0.9375rem; white-space: nowrap; }
.lic-row p { color: var(--text-secondary); font-size: 0.875rem; text-align: right; }
.lic-limit { display: flex; align-items: center; gap: 12px; color: var(--text-secondary); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.lic-limit .daily-limit-track { width: 96px; }

/* Editor: compact, even rhythm */
.context-sidebar { padding: 12px; gap: 10px; }
.sidebar-card { padding: 14px; gap: 10px; border-radius: 16px; }
.setting-group { border-radius: 16px; }
.setting-group summary { padding: 14px; }
.group-content { padding: 14px; gap: 12px; }
.control-row { gap: 2px; }
.control-row-toggle { min-height: 30px; padding: 0; }
.control-row-toggle + .control-row-toggle, .control-row + .control-row-toggle, .control-row-toggle + .control-row { padding-top: 8px; }
.control-header { min-height: 22px; }
input[type="range"] { height: 24px; }
input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -9px; }
.card-label { font-size: 0.6875rem; }
.form-input, .form-select { padding: 8px 12px; }
.export-featured-card { gap: 12px; }
.source-thumb { width: 44px; height: 44px; }
.btn-floating { padding: 7px 14px; }

@media (max-width: 720px) {
  .app-header { grid-template-columns: 1fr auto; grid-template-areas: "left right" "nav nav"; height: auto; padding: 10px 14px; row-gap: 8px; }
  .header-left { grid-area: left; width: auto; }
  .header-right { grid-area: right; width: auto; }
  .header-nav-tabs { grid-area: nav; justify-self: stretch; display: flex; }
  .nav-tab { flex: 1; padding: 7px 8px; }
  .lic-row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .lic-row p { text-align: left; }
}

/* ==========================================================================
   Round 3 — symmetric header, landing, license; sidebar never squashes
   ========================================================================== */
.context-sidebar > * { flex-shrink: 0; }
.export-featured-card { margin-top: 0 !important; }

.app-header { height: 64px; padding: 0 24px; }
.header-left, .header-right { min-width: 148px; }
.header-right { gap: 8px; }
.hdr-btn, .hdr-square { width: 40px; height: 40px; min-width: 40px; padding: 0; border-radius: 12px; }
.hdr-btn span { font-size: 0.8125rem; font-weight: 600; }
.header-nav-tabs { padding: 4px !important; border-radius: 14px; }
.nav-tab { padding: 8px 20px; }

/* Landing: one dashed drop area, samples as three equal tiles */
.landing-view { padding: 24px; }
.landing-card { max-width: 560px; padding: 0; background: transparent; box-shadow: none; border-radius: 0; overflow: visible; display: flex; flex-direction: column; gap: 20px; }
.drop-zone {
  margin: 0; padding: 56px 32px 48px;
  background: var(--bg-surface);
  border: 1.5px dashed var(--border-color-strong);
  border-radius: 28px;
  gap: 0;
}
.drop-illustration {
  width: 64px; height: 64px; border-radius: 20px; margin-bottom: 20px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-light); color: var(--primary);
}
.drop-illustration svg { width: 28px; height: 28px; stroke-width: 1.75; }
.drop-zone h2 { font-size: 1.5rem; margin-bottom: 6px; }
.drop-subtitle { font-size: 0.9375rem; margin-bottom: 24px; }
.drop-zone .btn { padding: 11px 28px; min-height: 44px; font-size: 0.9375rem; border-radius: 14px; }
.samples-tray { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 0; border: none; background: transparent; }
.samples-label { display: none; }
.sample-chips { display: contents; }
.sample-chip {
  flex-direction: column; justify-content: center; gap: 10px;
  padding: 18px 8px 14px; border-radius: 22px;
  background: var(--bg-surface); color: var(--text-secondary);
  font-size: 0.875rem; font-weight: 500;
}
.sample-chip img { width: 64px; height: 64px; }
.sample-chip:hover { background: var(--bg-surface-tertiary); color: var(--text-main); }

/* License: left-aligned, readable */
.license-page-card { max-width: 560px; padding: 36px; gap: 0; text-align: left; align-items: stretch; }
.license-page-title { text-align: left; font-size: 1.75rem; margin-bottom: 12px; }
.lic-intro { color: var(--text-secondary); font-size: 1rem; line-height: 1.55; margin-bottom: 20px; }
.lic-list { display: flex; flex-direction: column; gap: 0; }
.lic-row { display: block; padding: 18px 0; border-top: 0.5px solid var(--border-color-strong); }
.lic-row:first-child { border-top: 0.5px solid var(--border-color-strong); }
.lic-row strong { display: block; font-size: 1rem; font-weight: 600; white-space: normal; margin-bottom: 4px; }
.lic-row p { text-align: left; font-size: 0.9375rem; line-height: 1.5; color: var(--text-secondary); }

@media (max-width: 720px) {
  .header-left, .header-right { min-width: 0; }
  .app-header { height: auto; }
  .license-page-card { padding: 24px; }
}

/* Landing v4 — drop area and samples are one card */
.landing-card {
  max-width: 520px; gap: 0; overflow: hidden;
  background: var(--bg-surface);
  border: 1.5px dashed var(--border-color-strong);
  border-radius: 28px;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.landing-card:hover, .landing-card:has(.drop-zone.dragover) { border-color: var(--primary); }
.drop-zone { background: transparent; border: none; border-radius: 0; margin: 0; padding: 48px 32px 28px; }
.drop-zone:hover, .drop-zone.dragover { background: transparent; border: none; }
.samples-tray { display: flex; justify-content: center; align-items: center; padding: 0 24px 28px; gap: 0; }
.sample-chips { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.sample-chip {
  flex-direction: row; gap: 8px; padding: 5px 14px 5px 6px; border-radius: 999px;
  background: var(--bg-surface-secondary); color: var(--text-secondary);
  font-size: 0.8125rem; font-weight: 500;
}
.sample-chip img { width: 24px; height: 24px; }
.sample-chip:hover { background: var(--bg-surface-tertiary); color: var(--text-main); }

/* Landing v5 — drop card + inset-grouped sample list (iOS rows) */
.landing-card { max-width: 480px; gap: 12px; overflow: visible; background: transparent; border: none; border-radius: 0; display: flex; flex-direction: column; }
.landing-card:hover, .landing-card:has(.drop-zone.dragover) { border: none; }
.drop-zone {
  background: var(--bg-surface); border: 1.5px dashed var(--border-color-strong); border-radius: 24px;
  padding: 44px 32px 40px; margin: 0;
}
.drop-zone:hover, .drop-zone.dragover { background: var(--primary-light); border: 1.5px dashed var(--primary); }
.samples-tray { display: block; padding: 0; background: var(--bg-surface); border-radius: 20px; overflow: hidden; }
.sample-chips { display: flex; flex-direction: column; gap: 0; flex-wrap: nowrap; }
.sample-chip {
  width: 100%; flex-direction: row; justify-content: flex-start; gap: 14px;
  padding: 10px 16px; border-radius: 0; background: transparent; color: var(--text-main);
  font-size: 1rem; font-weight: 500; text-align: left; position: relative;
}
.sample-chip + .sample-chip::before { content: ""; position: absolute; top: 0; left: 70px; right: 0; border-top: 0.5px solid var(--border-color-strong); }
.sample-chip img { width: 40px; height: 40px; padding: 6px; border-radius: 11px; background: var(--bg-surface-secondary); object-fit: contain; }
.sample-chip span { flex: 1; }
.sample-chip::after {
  content: ""; width: 8px; height: 8px; margin-right: 4px;
  border-top: 2px solid var(--text-muted); border-right: 2px solid var(--text-muted); transform: rotate(45deg);
}
.sample-chip:hover { background: rgba(118, 118, 128, 0.14); color: var(--text-main); }
.sample-chip:active { background: rgba(118, 118, 128, 0.24); }

/* Landing v6 — one grouped card: drop row on top, samples side by side below */
.landing-card {
  max-width: 480px; gap: 0; overflow: hidden;
  background: var(--bg-surface); border: none; border-radius: 24px;
  display: flex; flex-direction: column;
}
.landing-card:hover, .landing-card:has(.drop-zone.dragover) { border: none; }
.drop-zone { background: transparent; border: none; border-radius: 0; margin: 0; padding: 44px 32px 36px; transition: background-color 0.2s ease; }
.drop-zone:hover, .drop-zone.dragover { background: var(--primary-light); border: none; }
.samples-tray { display: block; padding: 0; background: transparent; border-radius: 0; border-top: 0.5px solid var(--border-color-strong); overflow: visible; }
.sample-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.sample-chip {
  width: auto; flex-direction: column; justify-content: center; gap: 8px;
  padding: 18px 8px 16px; border-radius: 0; background: transparent; color: var(--text-secondary);
  font-size: 0.8125rem; font-weight: 500; text-align: center; position: relative;
}
.sample-chip::after { display: none; }
.sample-chip + .sample-chip::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 0; border-left: 0.5px solid var(--border-color-strong); border-top: none; right: auto; }
.sample-chip img { width: 48px; height: 48px; padding: 0; border-radius: 0; background: transparent; }
.sample-chip span { flex: none; }
.sample-chip:hover { background: rgba(118, 118, 128, 0.14); color: var(--text-main); }
.sample-chip:active { background: rgba(118, 118, 128, 0.24); }

/* Landing v7 — iOS settings-style rows (tile icon, title, subtitle, chevron) */
.landing-card { max-width: 440px; border-radius: 22px; background: var(--bg-surface); }
.drop-zone {
  display: grid; grid-template-columns: 48px 1fr 10px; column-gap: 14px; row-gap: 1px; align-items: center;
  text-align: left; padding: 16px 18px; border-radius: 0;
}
.drop-zone .drop-illustration { grid-row: 1 / 3; width: 48px; height: 48px; margin: 0; border-radius: 13px; background: var(--bg-surface-tertiary); color: var(--primary); }
.drop-zone .drop-illustration svg { width: 24px; height: 24px; }
.drop-zone h2 { grid-column: 2; grid-row: 1; margin: 0; font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.02em; text-align: left; align-self: end; }
.drop-zone .drop-subtitle { grid-column: 2; grid-row: 2; margin: 0; font-size: 0.875rem; text-align: left; align-self: start; }
.drop-zone .drop-actions { display: none !important; }
.drop-zone::after { content: ""; grid-column: 3; grid-row: 1 / 3; width: 8px; height: 8px; border-top: 2px solid var(--text-muted); border-right: 2px solid var(--text-muted); transform: rotate(45deg); }
.drop-zone:hover { background: rgba(118, 118, 128, 0.12); }
.drop-zone:active { background: rgba(118, 118, 128, 0.22); }
.drop-zone.dragover { background: var(--primary-light); }

.samples-tray { border-top: 0.5px solid var(--border-color-strong); }
.sample-chips { grid-template-columns: repeat(3, 1fr); padding: 14px 8px 12px; }
.sample-chip { padding: 4px 4px; gap: 8px; color: var(--text-secondary); background: transparent; border-radius: 14px; }
.sample-chip + .sample-chip::before { display: none; }
.sample-chip img { width: 52px; height: 52px; padding: 9px; border-radius: 14px; background: var(--bg-surface-tertiary); object-fit: contain; }
.sample-chip:hover { background: transparent; color: var(--text-main); }
.sample-chip:hover img { background: var(--bg-surface-hover); }
.sample-chip:active img { transform: scale(0.94); }
.sample-chip img { transition: transform 0.2s var(--ease-ios), background-color 0.2s ease; }

/* Landing v8 — big drop area on top, compact samples row below (one grouped card) */
.landing-card { max-width: 480px; border-radius: 24px; }
.drop-zone {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 48px 32px 40px; column-gap: 0; row-gap: 0;
}
.drop-zone::after { display: none; }
.drop-zone:hover, .drop-zone:active { background: transparent; }
.drop-zone.dragover { background: var(--primary-light); }
.drop-zone .drop-illustration { grid-row: auto; width: 64px; height: 64px; margin: 0 0 20px; border-radius: 20px; background: var(--primary-light); }
.drop-zone .drop-illustration svg { width: 28px; height: 28px; }
.drop-zone h2 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.03em; text-align: center; margin: 0 0 6px; align-self: auto; }
.drop-zone .drop-subtitle { font-size: 0.9375rem; text-align: center; margin: 0 0 24px; align-self: auto; }
.drop-zone .drop-actions { display: flex !important; }

.sample-chips { padding: 8px 12px; }
.sample-chip { flex-direction: row; justify-content: center; gap: 8px; padding: 6px 4px; font-size: 0.8125rem; }
.sample-chip img { width: 28px; height: 28px; padding: 4px; border-radius: 8px; }

/* ==========================================================================
   Glass layer v9 — frosted surfaces over an ambient gradient (iOS 26 feel)
   ========================================================================== */
:root {
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(255, 255, 255, 0.9);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 8px 30px rgba(31, 38, 135, 0.10);
  --glass-blur: saturate(190%) blur(28px);
  --ambient:
    radial-gradient(60% 55% at 12% 8%, rgba(10, 132, 255, 0.22), transparent 70%),
    radial-gradient(55% 50% at 92% 18%, rgba(191, 90, 242, 0.16), transparent 70%),
    radial-gradient(60% 55% at 70% 100%, rgba(48, 209, 200, 0.16), transparent 70%);
  --drop-line: rgba(60, 60, 67, 0.32);
}
[data-theme="dark"] {
  --glass: rgba(255, 255, 255, 0.07);
  --glass-strong: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 10px 40px rgba(0, 0, 0, 0.45);
  --ambient:
    radial-gradient(60% 55% at 10% 6%, rgba(10, 132, 255, 0.32), transparent 70%),
    radial-gradient(55% 50% at 94% 16%, rgba(191, 90, 242, 0.24), transparent 70%),
    radial-gradient(60% 55% at 68% 104%, rgba(48, 209, 200, 0.18), transparent 70%);
  --drop-line: rgba(255, 255, 255, 0.34);
}

.app-root { background: var(--ambient), var(--bg-app); }
.app-header, .app-main, .landing-view, .context-sidebar { background: transparent; }
.app-header { border: none; }

/* glass surfaces */
.landing-card, .sidebar-card, .setting-group, .license-page-card, .hdr-btn, .header-nav-tabs, .btn-floating {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-edge);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}
.hdr-btn { box-shadow: var(--glass-edge); color: var(--text-main); }
.hdr-btn:hover { background: var(--glass-strong); }
.header-nav-tabs { border-radius: 14px; }
.nav-tab.active, [data-theme="light"] .nav-tab.active {
  background: var(--glass-strong) !important;
  box-shadow: inset 0 1px 0 var(--glass-border), 0 2px 10px rgba(0, 0, 0, 0.18);
  color: var(--text-main) !important;
}
.setting-group summary:active { background: var(--glass-strong); }
.form-input, .form-select { background: rgba(118, 118, 128, 0.2); }

/* landing: big dashed drop target inside a glass card, icon-only samples */
.landing-view .landing-card {
  max-width: 520px; padding: 14px; border-radius: 30px; overflow: visible; gap: 14px;
  display: flex; flex-direction: column;
}
.landing-view .drop-zone {
  margin: 0; padding: 44px 24px 36px; border: 1.5px dashed var(--drop-line); border-radius: 20px;
  background: transparent; cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.25s var(--ease-ios);
}
.landing-view .drop-zone:hover { border-color: var(--primary); background: var(--primary-light); }
.landing-view .drop-zone.dragover { border-color: var(--primary); background: var(--primary-light); border-style: solid; transform: scale(1.01); }
.landing-view .drop-zone .drop-illustration { background: var(--primary-light); }
.landing-view .samples-tray { border: none; padding: 0 8px 6px; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.landing-view .samples-label { display: block; font-size: 0.75rem; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.landing-view .sample-chips { display: flex; justify-content: center; gap: 8px; padding: 0; }
.landing-view .sample-chip {
  flex-direction: column; gap: 6px; padding: 8px 14px; border-radius: 16px; background: transparent;
  font-size: 0.75rem; font-weight: 500; color: var(--text-secondary);
}
.landing-view .sample-chip img {
  width: 44px; height: 44px; padding: 0; border-radius: 0; background: transparent;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
  transition: transform 0.25s var(--ease-ios);
}
.landing-view .sample-chip:hover { background: transparent; color: var(--text-main); }
.landing-view .sample-chip:hover img { transform: translateY(-3px) scale(1.08); background: transparent; }

/* sheets and floating bits get the same glass */
.modal-card, .modal-license-card, .download-notice-toast, .progress-box {
  background: var(--glass-strong); border: 1px solid var(--glass-border); box-shadow: var(--glass-edge);
}
.license-page-card { padding: 36px; }
.landing-view .sample-chips { flex-direction: row; flex-wrap: nowrap; }
.landing-view .drop-zone { border-width: 2px; }

/* ==========================================================================
   v10 — neutral palette, no glows, flat consistent icons, compact samples
   ========================================================================== */
[data-theme="dark"] {
  --bg-app: #111113;
  --bg-surface: #1b1b1e;
  --bg-surface-secondary: #242428;
  --bg-surface-tertiary: #2e2e33;
  --bg-surface-hover: #3a3a40;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-strong: rgba(255, 255, 255, 0.10);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --ambient:
    radial-gradient(75% 60% at 50% -12%, rgba(255, 255, 255, 0.07), transparent 70%),
    radial-gradient(55% 50% at 100% 100%, rgba(140, 150, 170, 0.07), transparent 70%);
  --drop-line: rgba(255, 255, 255, 0.28);
}
:root {
  --glass-border: rgba(255, 255, 255, 0.95);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 1), 0 1px 3px rgba(20, 24, 40, 0.07);
  --ambient:
    radial-gradient(75% 60% at 50% -12%, rgba(255, 255, 255, 0.95), transparent 70%),
    radial-gradient(55% 50% at 100% 100%, rgba(140, 150, 175, 0.16), transparent 70%);
}
[data-theme="light"] { --bg-app: #ececf0; }

/* every pane lets the background through, so no tab flashes to black */
.tab-pane, .tab-pane-license, .fbx-container, .editor-view, .viewport-area, .app-main { background: transparent; }
.app-root { background: var(--ambient), var(--bg-app); }

/* flat, consistent controls: no heavy shadows or halos */
.hdr-btn, .header-nav-tabs, .btn-floating, .landing-card, .sidebar-card, .setting-group, .license-page-card { box-shadow: var(--glass-edge); }
.nav-tab.active, [data-theme="light"] .nav-tab.active { box-shadow: inset 0 1px 0 var(--glass-border); }
.btn-floating { box-shadow: var(--glass-edge); }
.logo-mark { color: var(--text-main); flex-shrink: 0; }
.logo { gap: 8px; }
.hdr-btn { color: var(--text-secondary); }
.hdr-btn:hover { color: var(--text-main); }
.toggle-checkbox::before { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
input[type="range"]::-webkit-slider-thumb { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); }
.modal-card, .modal-license-card, .download-notice-toast, .progress-box { box-shadow: var(--glass-edge), 0 12px 32px rgba(0, 0, 0, 0.25); }

/* landing: compact samples, no glow */
.landing-view .drop-zone { padding: 36px 24px 30px; }
.landing-view .landing-card { gap: 10px; }
.landing-view .samples-tray { padding: 0 8px 2px; gap: 2px; }
.landing-view .samples-label { font-size: 0.6875rem; }
.landing-view .sample-chip { gap: 4px; padding: 4px 12px; font-size: 0.6875rem; }
.landing-view .sample-chip img { width: 30px; height: 30px; filter: none; }
.landing-view .sample-chip:hover img { transform: translateY(-2px); }
[data-theme="dark"] {
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --ambient:
    radial-gradient(75% 60% at 50% -12%, rgba(255, 255, 255, 0.07), transparent 70%),
    radial-gradient(55% 50% at 100% 100%, rgba(140, 150, 170, 0.07), transparent 70%);
}
