:root {
  color-scheme: dark;
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --border-color: #30363d;
  --border-focus: #58a6ff;
  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent-blue: #2f81f7;
  --accent-blue-hover: #388bfd;
  --accent-green: #238636;
  --accent-green-hover: #2ea043;
  --accent-cyan: #39c5bb;
  --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: #30363d var(--bg-secondary);
}

/* Custom Modern Dark Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 4px;
  border: 2px solid var(--bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
  background: #484f58;
}

::-webkit-scrollbar-thumb:active {
  background: var(--accent-blue);
}

::-webkit-scrollbar-corner {
  background: var(--bg-secondary);
}

.canvas-container::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

.canvas-container::-webkit-scrollbar-thumb {
  border-color: var(--bg-primary);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  max-width: 100%;
  overflow: hidden;
}

/* Header */
.app-header {
  height: 60px;
  min-height: 60px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 10;
  gap: 12px;
  flex-wrap: nowrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.logo-badge {
  background: linear-gradient(135deg, #1f6feb, #238636);
  color: #fff;
  padding: 8px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(31, 111, 235, 0.3);
  flex-shrink: 0;
}

.header-titles {
  min-width: 0;
  overflow: hidden;
}

.header-titles h1 {
  font-size: 1.12rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-tag {
  font-size: 0.68rem;
  background: rgba(57, 197, 187, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(57, 197, 187, 0.3);
  padding: 2px 7px;
  border-radius: 12px;
  font-weight: 600;
  text-transform: uppercase;
  flex-shrink: 0;
}

.subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

/* Animated Capsule Language Switcher */
.lang-pill-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: rgba(22, 27, 34, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  padding: 2px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.2);
  user-select: none;
  overflow: hidden;
  flex-shrink: 0;
  white-space: nowrap;
  height: 32px;
  box-sizing: border-box;
}

.lang-glider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(50% - 2px);
  height: calc(100% - 4px);
  border-radius: 9999px;
  background: linear-gradient(135deg, rgba(57, 197, 187, 0.25), rgba(31, 111, 235, 0.32));
  border: 1px solid rgba(57, 197, 187, 0.5);
  box-shadow: 0 0 12px rgba(57, 197, 187, 0.35);
  transition: transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  z-index: 1;
}

.lang-pill-switch[data-active="zh_TW"] .lang-glider {
  transform: translateX(100%);
}

.btn-lang-pill {
  position: relative;
  z-index: 2;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 10px;
  min-width: 32px;
  height: 100%;
  border-radius: 9999px;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  text-align: center;
  transition: color 0.2s ease, text-shadow 0.2s ease;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.btn-lang-pill:hover {
  color: var(--text-primary);
}

.btn-lang-pill.active {
  color: #ffffff;
  text-shadow: 0 0 8px rgba(57, 197, 187, 0.6);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  padding: 5px 10px;
  border-radius: 20px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
  flex-shrink: 0;
}

.status-indicator.loading .status-dot {
  background-color: #d29922;
  box-shadow: 0 0 8px #d29922;
  animation: pulse 1.5s infinite;
}

.status-indicator.ready .status-dot {
  background-color: #3fb950;
  box-shadow: 0 0 8px #3fb950;
}

.status-indicator.error .status-dot {
  background-color: #f85149;
}

.btn-github {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.btn-github:hover {
  background-color: #30363d;
  border-color: #8b949e;
}

/* Workspace Layout */
.workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 340px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  flex-shrink: 0;
}

.card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.section-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px 14px;
  text-align: center;
  cursor: pointer;
  background-color: rgba(22, 27, 34, 0.4);
  transition: all 0.2s ease;
  position: relative;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent-blue);
  background-color: rgba(47, 129, 247, 0.08);
}

.file-input-hidden {
  display: none;
}

.dropzone-icon {
  color: var(--accent-blue);
  margin-bottom: 8px;
}

.dropzone-text .primary-text {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.dropzone-text code {
  font-family: 'JetBrains Mono', monospace;
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 0.82rem;
}

.dropzone-text .secondary-text {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.dropzone-text .highlight {
  color: var(--accent-blue);
  text-decoration: underline;
}

/* Samples */
.sample-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-sample {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.btn-sample:hover {
  background: #30363d;
  border-color: var(--accent-blue);
  transform: translateX(2px);
}

.btn-sample.active {
  border-color: var(--accent-blue);
  background: rgba(47, 129, 247, 0.15);
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.stat-item {
  background: var(--bg-tertiary);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-cyan);
}

.export-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-action.accent-pdf {
  background: linear-gradient(135deg, #8957e5, #6f42c1);
  color: #ffffff;
  border: 1px solid rgba(137, 87, 229, 0.4);
}

.btn-action.accent-pdf:hover {
  background: linear-gradient(135deg, #9e6cf5, #8957e5);
  box-shadow: 0 0 12px rgba(137, 87, 229, 0.4);
}

.btn-action.primary {
  background-color: var(--accent-green);
  color: #fff;
}

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

.btn-action.secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-action.secondary:hover {
  background-color: #30363d;
  border-color: var(--text-secondary);
}

/* Privacy banner */
.privacy-banner {
  margin-top: auto;
  display: flex;
  gap: 12px;
  padding: 12px;
  background: rgba(47, 129, 247, 0.06);
  border: 1px solid rgba(47, 129, 247, 0.2);
  border-radius: var(--radius-md);
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.privacy-banner svg {
  flex-shrink: 0;
  color: var(--accent-blue);
}

.privacy-banner strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: 2px;
}

/* Legal Disclaimer */
.legal-disclaimer {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.legal-disclaimer strong {
  color: var(--text-secondary);
}

.legal-disclaimer a {
  color: var(--accent-blue);
  text-decoration: underline;
}

.legal-disclaimer a:hover {
  color: var(--accent-cyan);
}

/* App Footer */
.app-footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 8px 24px;
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
  z-index: 10;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-content p {
  margin: 0;
}

.footer-content a {
  color: var(--text-secondary);
  text-decoration: underline;
}

.footer-content a:hover {
  color: var(--accent-cyan);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-links .sep {
  color: var(--border-color);
}

/* Preview Panel */
.preview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  overflow: hidden;
  position: relative;
}

/* Toolbar */
.canvas-toolbar {
  height: 48px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
}

.pagination-controls, .view-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover:not(:disabled) {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
}

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

.page-indicator, .zoom-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.84rem;
  color: var(--text-secondary);
  min-width: 80px;
  text-align: center;
}

.btn-secondary-sm {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-secondary-sm:hover {
  background: #30363d;
}

/* Canvas Container */
.canvas-container {
  flex: 1;
  position: relative;
  overflow: auto;
  display: flex;
  background: radial-gradient(#21262d 1px, transparent 1px);
  background-size: 24px 24px;
  padding: 24px;
  -webkit-overflow-scrolling: touch;
}

/* Empty State */
.empty-state {
  margin: auto;
  text-align: center;
  max-width: 380px;
}

.empty-illustration {
  color: var(--text-muted);
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.empty-state code {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
}

/* SVG Stage */
.svg-stage {
  margin: auto;
  background: #ffffff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.15s ease-out;
  transform-origin: center center;
  flex-shrink: 0;
}

.svg-stage svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Loading & Progress Overlay */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13, 17, 23, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.progress-card {
  background: rgba(22, 27, 34, 0.95);
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  width: 100%;
  max-width: 440px;
  backdrop-filter: blur(12px);
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.progress-header h4 {
  font-size: 1rem;
  font-weight: 600;
  flex: 1;
  letter-spacing: -0.01em;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(57, 197, 187, 0.2);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.progress-percent-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(57, 197, 187, 0.12);
  border: 1px solid rgba(57, 197, 187, 0.3);
  padding: 2px 8px;
  border-radius: 12px;
}

.progress-detail-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
  border-radius: 4px;
  transition: width 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(57, 197, 187, 0.5);
}

.progress-steps {
  display: flex;
  gap: 6px;
  justify-content: space-between;
}

.step-badge {
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 1px solid transparent;
  flex: 1;
  text-align: center;
  white-space: nowrap;
  transition: all 0.2s;
}

.step-badge.active {
  background: rgba(47, 129, 247, 0.15);
  color: var(--accent-blue);
  border-color: rgba(47, 129, 247, 0.4);
  font-weight: 600;
}

.step-badge.completed {
  background: rgba(35, 134, 54, 0.15);
  color: #3fb950;
  border-color: rgba(35, 134, 54, 0.4);
}

/* Button Loading & Feedback State */
.btn-action.is-loading, .btn-sample.is-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.8;
}

.btn-action.is-loading::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 8px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  background: rgba(22, 27, 34, 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-green);
  color: var(--text-primary);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(20px);
  opacity: 0;
  animation: toastSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast-item.info {
  border-left-color: var(--accent-blue);
}

.toast-item.error {
  border-left-color: #f85149;
}

.toast-item.fade-out {
  animation: toastFadeOut 0.25s forwards;
}

.hidden {
  display: none !important;
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes toastSlideUp {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastFadeOut {
  to { opacity: 0; transform: translateY(-10px); }
}

/* Mobile Segmented View Tabs (Hidden on Desktop) */
.mobile-view-tabs {
  display: none;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 6px 12px;
  gap: 8px;
  flex-shrink: 0;
  z-index: 9;
}

.mobile-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
}

.mobile-tab-btn:active {
  transform: scale(0.98);
}

.mobile-tab-btn.active {
  background: linear-gradient(135deg, rgba(47, 129, 247, 0.22), rgba(57, 197, 187, 0.18));
  color: #ffffff;
  border-color: var(--accent-blue);
  box-shadow: 0 0 12px rgba(47, 129, 247, 0.25);
}

.mobile-tab-btn svg {
  flex-shrink: 0;
}

/* ==========================================================================
   Responsive Breakpoints & Mobile Adaptations (RWD)
   ========================================================================== */

/* Tablet & Mobile Layout (<= 860px) */
@media (max-width: 860px) {
  .app-header {
    height: 56px;
    min-height: 56px;
    padding: 0 14px;
    flex-wrap: nowrap;
    gap: 10px;
  }

  .subtitle {
    display: none;
  }

  .status-indicator .status-text {
    display: none;
  }

  .status-indicator {
    background: transparent;
    border: none;
    padding: 0 4px;
    width: auto;
    height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .status-dot {
    width: 9px;
    height: 9px;
    margin: 0;
  }

  .lang-pill-switch {
    height: 30px;
    padding: 2px;
    flex-shrink: 0;
  }

  .btn-lang-pill {
    padding: 0 9px;
    min-width: 30px;
    font-size: 0.74rem;
  }

  .mobile-view-tabs {
    display: flex;
  }

  .workspace {
    flex-direction: column;
    position: relative;
  }

  /* Segmented View Switching */
  .workspace[data-active-tab="sidebar"] .sidebar {
    display: flex;
    width: 100%;
    max-height: none;
    flex: 1;
    border-right: none;
    border-bottom: none;
    padding: 14px;
    gap: 12px;
  }

  .workspace[data-active-tab="sidebar"] .preview-panel {
    display: none;
  }

  .workspace[data-active-tab="preview"] .sidebar {
    display: none;
  }

  .workspace[data-active-tab="preview"] .preview-panel {
    display: flex;
    width: 100%;
    flex: 1;
  }

  /* Canvas adjustments */
  .canvas-container {
    padding: 16px 12px;
  }

  .canvas-toolbar {
    padding: 0 12px;
  }

  .btn-icon {
    width: 36px;
    height: 36px;
  }
}

/* Small Tablets & Large Phones (<= 640px) */
@media (max-width: 640px) {
  .app-header {
    height: 52px;
    min-height: 52px;
    padding: 0 10px;
    gap: 8px;
  }

  .header-left {
    gap: 8px;
  }

  .logo-badge {
    padding: 6px;
    border-radius: var(--radius-sm);
  }

  .logo-badge svg {
    width: 18px;
    height: 18px;
  }

  .header-titles h1 {
    font-size: 0.94rem;
    gap: 6px;
  }

  .badge-tag {
    font-size: 0.6rem;
    padding: 1px 5px;
  }

  .header-right {
    gap: 6px;
  }

  .canvas-toolbar {
    height: auto;
    min-height: 42px;
    padding: 6px 8px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .pagination-controls, .view-controls {
    gap: 4px;
  }

  .page-indicator, .zoom-text {
    font-size: 0.78rem;
    min-width: 60px;
  }

  .btn-secondary-sm {
    padding: 4px 6px;
    font-size: 0.72rem;
  }

  /* Stats grid */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 10px;
  }

  .stat-item {
    padding: 6px 8px;
  }

  .stat-value {
    font-size: 0.88rem;
  }

  /* Progress overlay modal */
  .progress-card {
    padding: 18px 16px;
    width: calc(100vw - 28px);
    max-width: 400px;
  }

  .progress-steps {
    gap: 4px;
  }

  .step-badge {
    font-size: 0.64rem;
    padding: 3px 4px;
  }

  /* Footer */
  .app-footer {
    padding: 8px 12px;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 6px;
  }
}

/* Compact Phones (<= 480px) */
@media (max-width: 480px) {
  .app-header {
    height: 48px;
    min-height: 48px;
    padding: 0 8px;
  }

  .badge-tag {
    display: none;
  }

  .header-titles h1 {
    font-size: 0.88rem;
  }

  .lang-pill-switch {
    height: 28px;
  }

  .btn-lang-pill {
    padding: 0 7px;
    min-width: 26px;
    font-size: 0.7rem;
  }

  .mobile-tab-btn {
    font-size: 0.76rem;
    padding: 7px 8px;
    gap: 6px;
  }

  .canvas-container {
    padding: 8px;
  }

  .dropzone {
    padding: 16px 10px;
  }

  .dropzone-icon svg {
    width: 26px;
    height: 26px;
  }

  .dropzone-text .primary-text {
    font-size: 0.82rem;
  }

  .btn-sample {
    padding: 8px 10px;
    font-size: 0.78rem;
  }

  .btn-action {
    padding: 8px 10px;
    font-size: 0.8rem;
  }
}

