:root {
  /* Light Theme Variables */
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-hover: #f9fafb;
  --border: #e5e7eb;
  --border-focus: #cbd5e1;
  --text-main: #111827;
  --text-muted: #6b7280;
  
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  
  --danger: #ef4444;
  --danger-light: #fee2e2;
  
  --success: #10b981;
  --success-light: #d1fae5;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 15px rgba(79, 70, 229, 0.3);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --sidebar-width: 380px;
  --font-family: 'Outfit', sans-serif;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Canvas Area */
  --canvas-bg: #e2e8f0;
  --canvas-pattern: radial-gradient(#cbd5e1 1px, transparent 1px);
}

.dark-theme {
  /* Dark Theme Variables */
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --border: #334155;
  --border-focus: #475569;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-light: rgba(99, 102, 241, 0.15);
  
  --danger: #f87171;
  --danger-light: rgba(248, 113, 113, 0.15);
  
  --success: #34d399;
  --success-light: rgba(52, 211, 153, 0.15);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.4);
  
  --canvas-bg: #0b1120;
  --canvas-pattern: radial-gradient(#1e293b 1px, transparent 1px);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  transition: background-color 0.4s ease, color 0.4s ease;
  -webkit-font-smoothing: antialiased;
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  top: 24px;
  right: 32px;
  z-index: 1000;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-main);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
  color: var(--primary);
}

.dark-theme .light-icon { display: block; }
.dark-theme .dark-icon { display: none; }
.light-theme .light-icon { display: none; }
.light-theme .dark-icon { display: block; }

/* Layout */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 10;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.sidebar-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
}

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

.logo-icon {
  width: 64px;
  height: 64px;
  margin: -12px;
  display: block;
}

.logo-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.logo h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1;
}

.logo span {
  color: var(--primary);
}

.tagline {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Global Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--border-focus);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--text-muted);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-focus) transparent;
}

/* Control Groups */
.control-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.group-title i {
  color: var(--primary);
  font-size: 18px;
}

.flex-between {
  justify-content: space-between;
}

.group-title.flex-between div {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Upload Zone */
.upload-zone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background-color: var(--bg);
  overflow: hidden;
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 5;
}

.upload-placeholder {
  pointer-events: none;
}

.upload-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--primary);
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.upload-zone:hover .upload-icon-wrap {
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

.upload-main-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}

.upload-sub-text {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

#preview-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  z-index: 2;
  border-radius: calc(var(--radius-md) - 2px);
}

.upload-zone.has-image {
  border-style: solid;
  border-color: var(--border);
  padding: 0;
  height: 200px;
}

.upload-zone.has-image .upload-placeholder {
  display: none;
}

.upload-zone.has-image #preview-img {
  display: block;
}

.photo-replace {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 12px;
  background: rgba(0,0,0,0.7);
  color: white;
  font-size: 14px;
  font-weight: 500;
  z-index: 3;
  transform: translateY(100%);
  transition: var(--transition);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.upload-zone.has-image:hover .photo-replace {
  transform: translateY(0);
}

/* Grids & Buttons */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.opt-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.opt-btn:hover {
  border-color: var(--border-focus);
  background-color: var(--surface-hover);
  transform: translateY(-1px);
}

.opt-btn.active {
  border-color: var(--primary);
  background-color: var(--primary-light);
  box-shadow: 0 0 0 1px var(--primary);
}

.opt-main {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  font-family: var(--font-family);
}

.opt-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.opt-btn.active .opt-main {
  color: var(--primary);
}

/* Quantity */
.qty-info {
  font-size: 12px;
  color: var(--text-muted);
}

.qty-info strong {
  color: var(--text-main);
}

.qty-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.stepper {
  display: flex;
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  height: 44px;
}

.stepper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.stepper-btn {
  width: 44px;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stepper-btn:hover:not(:disabled) {
  background-color: var(--surface-hover);
  color: var(--primary);
}

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

#qtyInput {
  flex: 1;
  width: 0;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
  font-family: var(--font-family);
}

#qtyInput::placeholder {
  font-weight: 400;
  color: var(--text-muted);
}

#qtyInput::-webkit-inner-spin-button,
#qtyInput::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
}

.qty-auto-btn {
  height: 44px;
  padding: 0 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-family);
}

.qty-auto-btn:hover {
  background-color: var(--surface-hover);
}

.qty-auto-btn.active {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.qty-warning {
  padding: 10px 14px;
  background-color: var(--danger-light);
  border-left: 4px solid var(--danger);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-warning.hidden {
  display: none;
}

/* Background Colors */
.color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.color-chip {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}

.color-chip:hover {
  transform: scale(1.1);
}

.color-chip.active {
  border-color: var(--text-main);
  transform: scale(1.1);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary);
}

.custom-picker {
  background: var(--surface);
  border: 2px dashed var(--border);
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 18px;
  overflow: hidden;
}

.custom-picker:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.custom-picker.active {
  border-style: solid;
}

.custom-picker input[type="color"] {
  position: absolute;
  inset: -10px;
  width: 200%;
  height: 200%;
  opacity: 0;
  cursor: pointer;
}

/* Sliders */
.slider-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mt-3 {
  margin-top: 12px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}

.slider-value {
  font-weight: 600;
  color: var(--primary);
}

.styled-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}

.styled-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 3px solid var(--surface);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.styled-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: var(--shadow-glow);
}

/* Toggles */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface-hover);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.toggle-row:hover {
  border-color: var(--border-focus);
}

.toggle-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toggle-main {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
}

.toggle-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.toggle-switch {
  width: 44px;
  height: 24px;
  background: var(--border-focus);
  border-radius: 12px;
  position: relative;
  transition: var(--transition);
}

.toggle-thumb {
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.toggle-switch.on {
  background: var(--success);
}

.toggle-switch.on .toggle-thumb {
  transform: translateX(20px);
}

/* Footer Actions */
.sidebar-footer {
  padding: 24px 32px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.action-btn {
  width: 100%;
  height: 52px;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-family);
  text-decoration: none;
  border: none;
}

.action-btn.primary {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-md);
}

.action-btn.primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transform: translateY(-2px);
}

.action-btn.primary:active:not(:disabled) {
  transform: translateY(0);
}

.action-btn.primary:disabled {
  background: var(--border-focus);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
}

.action-btn.secondary {
  background: var(--surface);
  color: var(--primary);
  border: 2px solid var(--primary);
}

.action-btn.secondary:hover {
  background: var(--primary-light);
}

.action-btn.hidden {
  display: none;
}

/* Main Workspace */
.main-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--canvas-bg);
  background-image: var(--canvas-pattern);
  background-size: 24px 24px;
  position: relative;
}

/* Topbar */
.workspace-topbar {
  position: absolute;
  top: 24px;
  left: 32px;
  right: 100px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  pointer-events: none;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  pointer-events: auto;
  transition: var(--transition);
}

.status-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: var(--transition);
}

.status-badge.ready {
  color: var(--success);
  border-color: var(--success-light);
}

.status-badge.ready .dot {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.info-pills {
  display: flex;
  gap: 12px;
  pointer-events: auto;
}

.pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(var(--surface), 0.8);
  backdrop-filter: blur(10px);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.pill i {
  color: var(--primary);
  font-size: 16px;
}

/* Canvas Area */
.canvas-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px 40px;
  overflow: auto;
}

.canvas-stage {
  background: var(--surface);
  min-width: 400px;
  min-height: 500px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: var(--transition);
  padding: 0;
  overflow: hidden;
}

.dark-theme .canvas-stage {
  /* In dark mode, paper is still visually white or off-white typically, but we let canvas draw the bg color anyway */
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px;
  max-width: 380px;
}

.empty-icon {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  opacity: 0.5;
}

.empty-state h2 {
  font-size: 24px;
  color: var(--text-main);
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

#previewCanvas {
  max-width: 100%;
  max-height: calc(100vh - 160px);
  object-fit: contain;
  display: block;
}

/* Side Meta Bar (formerly bottombar) */
.workspace-bottombar {
  position: absolute;
  top: 50%;
  right: 32px;
  left: auto;
  bottom: auto;
  transform: translateY(-50%);
  background: rgba(var(--surface), 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow: var(--shadow-lg);
  z-index: 10;
  transition: var(--transition);
}

.workspace-bottombar.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(20px, -50%);
}

/* Floating Toolbar */
.floating-toolbar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(var(--surface), 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 24px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  transition: var(--transition);
}

.floating-toolbar.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
}

.mode-switch {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-full);
  padding: 4px;
  border: 1px solid var(--border);
}

.mode-btn {
  background: transparent;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  font-family: var(--font-family);
}

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

.mode-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  padding-right: 4px;
}

.toolbar-actions .action-btn {
  height: 40px;
  padding: 0 20px;
  border-radius: var(--radius-full);
  font-size: 14px;
}

/* Alignment View */
.align-view {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.align-container-wrap {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: repeating-conic-gradient(var(--border) 0% 25%, transparent 0% 50%) 50% / 20px 20px;
  border: 1px solid var(--border);
  box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
  margin-top: 20px;
}

.align-container {
  position: relative;
  overflow: hidden;
  cursor: grab;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.1), 0 10px 30px rgba(0,0,0,0.2);
  background: white;
}

.align-container:active {
  cursor: grabbing;
}

#alignImg {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  pointer-events: none;
}

/* Face Template Overlay */
.face-template {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 2px dashed rgba(255, 255, 255, 0.6);
  z-index: 10;
  mix-blend-mode: difference;
}

.head-oval {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  width: 45%;
  height: 50%;
  border: 2px solid rgba(255,255,255,0.7);
  border-radius: 50%;
}

.shoulders-curve {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 25%;
  border: 2px solid rgba(255,255,255,0.7);
  border-bottom: none;
  border-radius: 50% 50% 0 0;
}

.center-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: rgba(255,255,255,0.4);
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  padding: 12px 24px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  color: var(--text-muted);
  font-size: 20px;
  margin-bottom: 20px;
}

.zoom-controls .styled-slider {
  width: 150px;
}

.meta-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.meta-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.meta-val {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

/* Responsive adjustments */
.mobile-tab-bar {
  display: none;
}

@media (max-width: 1024px) {
  body {
    overflow: hidden;
  }
  
  .app-layout {
    position: relative;
    height: 100dvh;
    overflow: hidden;
    display: block; /* Override flex */
  }

  .main-workspace, .sidebar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    bottom: 70px; /* Space for mobile tab bar */
    height: auto;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Preview Tab (Active by default) */
  .main-workspace {
    transform: translateX(0);
    z-index: 5;
    background-color: var(--canvas-bg);
  }

  /* Settings Tab (Hidden by default) */
  .sidebar {
    transform: translateX(100%);
    z-index: 6;
    background-color: var(--surface);
    border-right: none;
    padding-bottom: 20px;
  }

  /* When settings tab is active */
  body.mobile-show-settings .sidebar {
    transform: translateX(0);
  }
  
  body.mobile-show-settings .main-workspace {
    transform: translateX(-30%);
    opacity: 0.5;
  }
  
  .workspace-topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    background: rgba(var(--bg), 0.85);
    backdrop-filter: blur(10px);
    border-radius: 0;
    border-bottom: 1px solid var(--border);
  }

  .status-badge, .pill {
    padding: 6px 12px;
    font-size: 11px;
  }

  .info-pills {
    gap: 8px;
    flex-wrap: wrap;
  }
  
  .canvas-wrapper {
    padding: 12px;
    padding-top: 80px; /* clear topbar */
    padding-bottom: 12px;
    height: 100%;
  }
  
  .workspace-bottombar {
    top: auto;
    bottom: 154px; /* Sits directly above floating toolbar */
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    padding: 12px 16px;
    gap: 16px;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    width: 92%;
    border-radius: var(--radius-full);
    background: rgba(var(--surface), 0.95);
  }

  .workspace-bottombar .meta-stat {
    flex-direction: row;
    align-items: center;
    gap: 6px;
  }

  .workspace-bottombar.hidden {
    transform: translate(-50%, 20px);
  }

  .floating-toolbar {
    position: fixed;
    width: 92%;
    max-width: 400px;
    flex-wrap: wrap;
    justify-content: center;
    bottom: 20px; /* Above mobile tab bar */
    left: 50%;
    transform: translateX(-50%);
    gap: 12px;
    padding: 10px;
    border-radius: var(--radius-full);
    z-index: 1000;
  }
  
  .theme-toggle {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    z-index: 2000; /* Above everything */
  }

  .mode-btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  .toolbar-actions .action-btn {
    height: 38px;
    font-size: 13px;
  }

  /* Mobile Tab Bar */
  .mobile-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 2000;
    padding-bottom: env(safe-area-inset-bottom, 0px); /* For iOS notch */
  }

  .mobile-tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-family);
    cursor: pointer;
    transition: var(--transition);
  }

  .mobile-tab-btn i {
    font-size: 22px;
  }

  .mobile-tab-btn span {
    font-size: 11px;
    font-weight: 500;
  }

  .mobile-tab-btn.active {
    color: var(--primary);
  }
}

@media (max-width: 480px) {
  .workspace-bottombar {
    bottom: 680px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
  }
  
  .floating-toolbar {
    border-radius: var(--radius-md);
  }
  
  .meta-label {
    font-size: 9px;
  }
  
  .meta-val {
    font-size: 11px;
  }

  .toolbar-actions .action-btn {
    height: 34px;
    font-size: 12px;
    padding: 0 16px;
  }

  .mode-btn {
    font-size: 12px;
    padding: 6px 10px;
  }
}