:root {
  color-scheme: light;
  --bg: #f5f5f5;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-solid: #ffffff;
  --border: rgba(55, 53, 47, 0.09);
  --text: #37352f;
  --muted: #787774;
  --blue: #2765f6;
  --blue-soft: rgba(39, 101, 246, 0.1);
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
  --panel-edge: rgba(55, 53, 47, 0.05);
  --soft-fill: rgba(55, 53, 47, 0.03);
  --surface-hover: rgba(55, 53, 47, 0.06);
  --surface-elevated: rgba(255, 255, 255, 0.78);
  --surface-overlay: rgba(255, 255, 255, 0.98);
  --surface-muted: #f3f4f6;
  --surface-input: rgba(255, 255, 255, 0.92);
  --divider: rgba(55, 53, 47, 0.06);
  --divider-strong: rgba(55, 53, 47, 0.08);
  --inset-highlight: rgba(255, 255, 255, 0.72);
  --text-strong: #111827;
  --text-secondary: #6b7280;
  --text-disabled: #9ca3af;
  --canvas-surface: #ffffff;
  --empty-hero-bg: #ffffff;
  --empty-hero-title: #16181d;
  --fab-color: #4b5563;
  --surface-item: rgba(255, 255, 255, 0.72);
  --surface-item-active: rgba(39, 101, 246, 0.09);
  --surface-thumb: #f3f4f6;
  --surface-dialog: rgba(255, 255, 255, 0.98);
  --surface-dialog-strong: rgba(255, 255, 255, 0.99);
  --surface-dropdown: rgba(255, 255, 255, 0.98);
  --surface-toolbar: rgba(255, 255, 255, 0.88);
  --surface-floating: rgba(255, 255, 255, 0.86);
  --surface-card-action: rgba(255, 255, 255, 0.92);
  --surface-card-select: rgba(255, 255, 255, 0.96);
  --surface-input-bg: #f3f4f6;
  --surface-input-disabled: #f1f5f9;
  --surface-input-editing: #f1f3f5;
  --surface-preview: #f3f4f6;
  --surface-page-panel: #ffffff;
  --surface-popover-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  --surface-dialog-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
  --surface-card-action-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  --dialog-backdrop: rgba(15, 23, 42, 0.22);
  --overlay-backdrop: rgba(15, 23, 42, 0.18);
  --text-card-title: #1f2937;
  --text-subtle: #94a3b8;
  --text-subtle-strong: #475569;
  --text-placeholder: #64748b;
  --text-smart-seg: #334155;
  --shimmer-highlight: rgba(255, 255, 255, 0.42);
  --scrollbar-thumb: rgba(55, 53, 47, 0.14);
  --history-hover: rgba(55, 53, 47, 0.04);
  --option-hover: rgba(55, 53, 47, 0.06);
  --accent: #2765f6;
  --accent-link: #4263ff;
  --accent-hover: #1f59e6;
  --accent-active: #1d4ed8;
  --text-field-muted: #b0b7c3;
  --history-active-bg: rgba(39, 101, 246, 0.1);
  --nav-active-bg: rgba(39, 101, 246, 0.08);
  --border-ui: rgba(55, 53, 47, 0.08);
  --border-ui-strong: rgba(55, 53, 47, 0.14);
  --border-ui-alt: rgba(15, 23, 42, 0.08);
  --border-ui-alt-strong: rgba(15, 23, 42, 0.12);
  --locale-hover-bg: rgba(47, 102, 235, 0.08);
  --locale-active-bg: rgba(47, 102, 235, 0.12);
  --canvas-stage-bg: #ffffff;
  --canvas-checker: rgba(148, 163, 184, 0.18);
  --resize-handle-bg: #ffffff;
  --toast-bg: rgba(244, 249, 255, 0.98);
  --toast-border: rgba(39, 101, 246, 0.14);
  --toast-message-color: rgba(44, 64, 96, 0.82);
  --toast-shadow: 0 18px 42px rgba(39, 101, 246, 0.1);
  --loading-scrim: rgba(245, 245, 245, 0.72);
  --empty-dropzone-border: rgba(203, 209, 220, 0.9);
  --empty-dropzone-text: #9aa0aa;
  --empty-dropzone-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 249, 252, 0.96));
  --confirm-meta-bg: rgba(39, 101, 246, 0.06);
  --confirm-meta-border: rgba(39, 101, 246, 0.1);
  --confirm-meta-note: rgba(44, 64, 96, 0.82);
  --surface-input-focus-bg: #eef2ff;
  --surface-input-focus-ring: rgba(39, 101, 246, 0.08);
  --range-track-active: #2785f6;
  --range-track-inactive: rgba(15, 23, 42, 0.14);
  --range-thumb-bg: #2785f6;
  --range-thumb-ring: rgba(255, 255, 255, 0.92);
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 7.5l5 5 5-5' fill='none' stroke='%236b7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --soft-accent-surface: rgba(15, 23, 42, 0.04);
  --badge-surface: rgba(15, 23, 42, 0.08);
  --accent-surface-soft: rgba(39, 101, 246, 0.1);
  --accent-surface-medium: rgba(39, 101, 246, 0.12);
  --accent-border-soft: rgba(39, 101, 246, 0.24);
  --overlay-highlight: rgba(39, 101, 246, 0.2);
  --empty-illustration-bg: linear-gradient(135deg, rgba(39, 101, 246, 0.08), rgba(39, 101, 246, 0.02)), #f8fafc;
  --empty-illustration-border: rgba(148, 163, 184, 0.14);
  --swatch-inset-ring: rgba(255, 255, 255, 0.5);
  --swatch-border: rgba(15, 23, 42, 0.08);
  --stage-sheen: rgba(255, 255, 255, 0.3);
  --snap-guide-halo: rgba(255, 255, 255, 0.72);
  --library-panel-shadow: 0 4px 16px rgba(15, 23, 42, 0.03);
  --home-quick-bg: rgba(55, 53, 47, 0.06);
  --radius-none: 0;
  --radius-2xs: 4px;
  --radius-xs: 5px;
  --radius-sm: 6px;
  --radius-md: 7px;
  --radius-lg: 8px;
  --radius-xl: 10px;
  --radius-2xl: 12px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: Inter, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

body.library-mode {
  background: var(--bg);
}

html.route-library body:not(.library-mode) #libraryView {
  display: flex !important;
}

html.route-library body:not(.library-mode) .canvas-stage,
html.route-library body:not(.library-mode) #topToolbar,
html.route-library body:not(.library-mode) #bottomToolbar {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr) 276px;
  height: 100vh;
  overflow: hidden;
  transition: grid-template-columns 0.18s ease;
  position: relative;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 268px minmax(0, 1fr) 276px;
}

.app-shell.projects-collapsed {
  grid-template-columns: 0 minmax(0, 1fr) 276px;
}

.app-shell.inspector-collapsed {
  grid-template-columns: 268px minmax(0, 1fr) 0;
}

.app-shell.sidebar-collapsed.projects-collapsed {
  grid-template-columns: 0 minmax(0, 1fr) 276px;
}

.app-shell.projects-collapsed.inspector-collapsed {
  grid-template-columns: 0 minmax(0, 1fr) 0;
}

.app-shell.sidebar-collapsed.inspector-collapsed {
  grid-template-columns: 268px minmax(0, 1fr) 0;
}

.app-shell.sidebar-collapsed.projects-collapsed.inspector-collapsed {
  grid-template-columns: 0 minmax(0, 1fr) 0;
}

.sidebar,
.projects-sidebar,
.inspector {
  background: var(--panel);
  backdrop-filter: blur(8px);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  box-shadow: inset 0 1px 0 var(--inset-highlight);
}

.sidebar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 268px;
  z-index: 25;
  min-width: 0;
  overflow: hidden;
  transition: opacity 0.16s ease, transform 0.16s ease, padding 0.16s ease;
}

.sidebar-head,
.sidebar .panel-section-head {
  flex-shrink: 0;
}

.sidebar .panel-section {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sidebar .layer-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.layer-list > * {
  flex-shrink: 0;
}

.projects-sidebar {
  min-width: 0;
  overflow: hidden;
  transition: opacity 0.16s ease, transform 0.16s ease, padding 0.16s ease;
}

.projects-sidebar-footer {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-top: auto;
  flex-shrink: 0;
  padding-top: 8px;
  border-top: 1px solid var(--divider);
}

.projects-sidebar-link {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  padding: 4px 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.projects-sidebar-link + .projects-sidebar-link {
  border-left: 1px solid var(--divider);
}

.projects-sidebar-link:hover {
  background: transparent;
  color: var(--text-strong);
}

.projects-sidebar-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--surface-input-focus-ring);
}

.inspector {
  border-right: 0;
  min-width: 0;
  transition: opacity 0.16s ease, transform 0.16s ease, padding 0.16s ease;
}

.inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--divider);
}

.sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--divider);
}

.sidebar-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.theme-toggle-glyph {
  width: 18px;
  height: 18px;
  display: block;
}

.theme-toggle-glyph svg {
  width: 100%;
  height: 100%;
  display: block;
}

.projects-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.locale-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.locale-switcher-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
}

.locale-switcher-select {
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-input);
  color: var(--text);
  padding: 0 10px;
  min-width: 96px;
}

.footer-locale-switcher {
  position: relative;
  flex: 0 0 auto;
  color: var(--muted);
}

.footer-locale-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}

.footer-locale-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.footer-locale-trigger {
  height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  border: 1px solid var(--border-ui);
  border-radius: 6px;
  background: transparent;
  color: currentColor;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.footer-locale-trigger:hover,
.footer-locale-trigger[aria-expanded="true"] {
  color: var(--text);
  border-color: var(--border-ui-strong);
  background: transparent;
}

.footer-locale-label {
  white-space: nowrap;
}

.footer-locale-caret {
  width: 12px;
  height: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.footer-locale-caret svg {
  width: 100%;
  height: 100%;
  display: block;
}

.footer-locale-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  min-width: 148px;
  padding: 6px;
  border: 1px solid var(--border-ui);
  border-radius: 8px;
  background: var(--surface-dropdown);
  box-shadow: var(--surface-popover-shadow);
  display: grid;
  gap: 2px;
  z-index: 40;
}

.footer-locale-option {
  width: 100%;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.footer-locale-option:hover {
  background: var(--locale-hover-bg);
}

.footer-locale-option[aria-checked="true"] {
  background: var(--locale-active-bg);
  color: var(--accent);
}

.projects-brand-mark {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.projects-brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.sidebar-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.sidebar-head .section-title,
.inspector-head .section-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.projects-brand .section-title {
  font-size: 16px;
  font-weight: 800;
}

.collapse-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.icon-button.collapse-button {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.icon-button.collapse-button:hover,
.theme-toggle-button:hover {
  background: var(--surface-hover);
}

.collapse-glyph {
  width: 18px;
  height: 18px;
  display: block;
}

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

.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0;
}

.sidebar-head h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0;
}

.app-shell.sidebar-collapsed .sidebar {
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  transform: translateX(-8px);
}

.app-shell.projects-collapsed .projects-sidebar {
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  padding-left: 0;
  padding-right: 0;
  border-right: 0;
  transform: translateX(-8px);
}

.app-shell.inspector-collapsed .inspector {
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  padding-left: 0;
  padding-right: 0;
  border-left: 0;
  transform: translateX(8px);
}

.icon-button {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--muted);
}

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

.panel-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.inspector .panel-section {
  gap: 10px;
  padding-bottom: 0;
}

.inspector .panel-section:not(.hidden) + .panel-section:not(.hidden) {
  padding-top: 12px;
  border-top: 1px solid var(--panel-edge);
}

.section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
  line-height: 1.4;
  margin: 0;
}

.layer-list,
.history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: auto;
}

.history-section {
  min-height: 0;
  flex: 1;
}

.projects-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-ui);
}

.projects-section-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.history-section .section-title {
  margin-bottom: 0;
}

.projects-primary-action,
.projects-nav-button {
  width: 100%;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-none);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  line-height: 1.2;
}

.projects-primary-action:hover,
.projects-nav-button:hover {
  background: transparent;
  color: var(--text-strong);
}

.projects-primary-action.is-active {
  color: var(--blue);
}

.projects-nav-button.is-active {
  color: var(--blue);
}

.projects-primary-action.is-active:hover {
  color: var(--accent-hover);
}

.projects-nav-button.is-active:hover {
  color: var(--accent-hover);
}

.projects-nav-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.projects-nav-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.panel-action-button {
  height: 22px;
  padding: 0 2px;
  border: 0;
  border-radius: var(--radius-none);
  background: transparent;
  color: var(--blue);
  font-size: 11px;
  white-space: nowrap;
}

.panel-action-button:hover:not(:disabled) {
  background: transparent;
  color: var(--accent-hover);
}

.panel-action-button:disabled {
  color: var(--text-disabled);
  cursor: default;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 5px;
  border: 0;
  background: var(--surface-item);
  border-radius: var(--radius-md);
  text-align: left;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  box-shadow: none;
}

.layer-item.active {
  background: var(--surface-item-active);
}

.layer-item.is-hidden {
  opacity: 0.64;
}

.layer-item.is-background {
  cursor: pointer;
}

.layer-item.is-background .layer-visibility {
  opacity: 0.3;
  cursor: default;
}

.layer-item.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 0%, var(--shimmer-highlight) 45%, transparent 70%);
  transform: translateX(-130%);
  animation: shimmer-sweep 1.25s linear infinite;
  pointer-events: none;
}

.layer-thumb {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-xs);
  background: var(--surface-thumb);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  position: relative;
}

.layer-thumb-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.layer-thumb-placeholder {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-2xs);
  background: rgba(148, 163, 184, 0.14);
  color: var(--text-placeholder);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex: 0 0 auto;
}

.layer-thumb-spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(37, 99, 235, 0.18);
  border-top-color: #2563eb;
  animation: loading-spin 0.72s linear infinite;
}

.layer-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
}

.layer-copy .layer-name-input,
.layer-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-name-input {
  width: 100%;
  min-width: 0;
  padding: 1px 3px;
  margin-left: -3px;
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  border-radius: var(--radius-2xs);
  cursor: default;
  pointer-events: none;
}

.layer-copy small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.layer-item.is-renaming .layer-name-input {
  background: var(--panel-solid);
  border-radius: var(--radius-2xs);
  pointer-events: auto;
}

.layer-name-input:focus {
  color: var(--blue);
}

.layer-visibility {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  padding: 0;
  flex: 0 0 auto;
}

.layer-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}

.layer-visibility:hover {
  background: var(--surface-hover);
  color: var(--text-strong);
}

.layer-visibility svg {
  width: 15px;
  height: 15px;
  display: block;
}

.layer-item.is-hidden .layer-visibility {
  color: var(--text-disabled);
}

.layer-more {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  padding: 0;
  flex: 0 0 auto;
}

.layer-more:hover,
.layer-more[aria-expanded="true"] {
  background: var(--surface-hover);
  color: var(--text-strong);
}

.layer-more svg {
  width: 14px;
  height: 14px;
  display: block;
}

.layer-context-menu {
  position: fixed;
  top: 0;
  left: 0;
  min-width: 132px;
  padding: 5px;
  border-radius: var(--radius-md);
  border: 1px solid var(--divider-strong);
  background: var(--surface-dropdown);
  box-shadow: var(--surface-popover-shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 80;
}

.layer-menu-action {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text);
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}

.layer-menu-action:hover {
  background: var(--option-hover);
}

.layer-menu-action.is-danger {
  color: #c2410c;
}

.layer-menu-action.is-danger:hover {
  background: rgba(251, 146, 60, 0.12);
}

.layer-menu-action:disabled {
  color: var(--text-disabled);
  cursor: default;
}

.layer-menu-action:disabled:hover {
  background: transparent;
}

.layer-item.is-loading .layer-thumb {
  background: rgba(241, 245, 249, 0.9);
}

.layer-item.is-loading .layer-copy strong,
.layer-item.is-loading .layer-copy small {
  color: var(--text-secondary);
}

.workspace-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 12px;
  gap: 10px;
  overflow: hidden;
}

.top-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: var(--radius-none);
  box-shadow: none;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 0 0 auto;
  padding-right: 18px;
}

.brand-mark {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.project-title-input {
  min-width: 0;
  width: 164px;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  border-radius: 4px;
  outline: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: background-color 0.16s ease, box-shadow 0.16s ease, padding 0.16s ease;
}

.project-title-input.is-editing {
  padding: 5px 8px;
  background: var(--surface-input-editing);
  box-shadow: none;
  text-overflow: clip;
  border-radius: 4px;
}

.toolbar-strip {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  justify-content: center;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-toolbar);
  box-shadow: var(--shadow);
  justify-self: center;
}

.toolbar-spacer {
  min-width: 1px;
}

.export-menu {
  position: relative;
}

.image-menu,
.selection-menu {
  position: relative;
}

.toolbar-button,
.mini-tool {
  height: 30px;
  border-radius: var(--radius-sm);
  border: 0;
  background: var(--panel-solid);
  padding: 0 9px;
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
}

.mini-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.mini-tool svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mini-tool svg.filled-icon {
  fill: currentColor;
  stroke: none;
}

.mini-tool.icon-only {
  width: 34px;
  padding: 0;
}

.toolbar-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.toolbar-button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toolbar-button.active,
.toolbar-button.is-running,
.mini-tool.active {
  background: var(--blue-soft);
  color: var(--blue);
}

.toolbar-strip.smart-seg-running .toolbar-button.active:not(#smartSegmentBtn),
.toolbar-strip.smart-seg-running .mini-tool.active {
  background: var(--panel-solid);
  color: var(--text);
}

.mini-tool:hover:not(:disabled) {
  background: var(--blue-soft);
  color: var(--blue);
}

.mini-tool:disabled {
  color: var(--text-disabled);
  cursor: default;
}

.toolbar-button.primary {
  background: var(--blue);
  color: #fff;
}

.toolbar-button.primary:hover {
  background: var(--accent-hover);
}

.export-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.export-caret {
  font-size: 10px;
  line-height: 1;
}

.export-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 124px;
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-dropdown);
  box-shadow: var(--surface-popover-shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 20;
}

.export-option {
  height: 32px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 0 10px;
  font-size: 12px;
}

.export-option:hover {
  background: var(--option-hover);
}

.export-option.is-active {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
}

.canvas-stage {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.library-view {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 12px 18px 8px;
  overflow: auto;
}

.library-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 2px 8px;
}

.library-page-title-wrap h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--text);
}

.library-upload-btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
}

.library-page-panel {
  flex: 1 1 auto;
  min-height: calc(100vh - 122px);
  background: var(--panel-solid);
  border-radius: var(--radius-sm);
  padding: 22px 24px 18px;
  box-shadow: var(--library-panel-shadow);
  overflow: auto;
  overflow-x: hidden;
}

.library-page-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  margin-bottom: 16px;
  min-width: 0;
}

.library-page-filters {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}

.library-filter-chip {
  height: 28px;
  padding: 0 1px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.library-filter-chip.is-active {
  border-bottom-color: var(--blue);
  color: var(--blue);
}

.library-new-group-btn {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.library-new-group-btn:hover,
.library-manage-btn:hover {
  color: var(--accent-active);
}

.library-inline-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.library-inline-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.library-page-tools {
  min-width: 0;
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  justify-self: end;
}

.library-bulk-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.library-selection-meta {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.library-bulk-actions select {
  height: 30px;
  min-width: 116px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-thumb);
  color: var(--text-strong);
  font-size: 11px;
  outline: none;
}

.library-page-tools input {
  width: 144px;
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-thumb);
  color: var(--text-strong);
  font-size: 11px;
  outline: none;
}

.library-page-tools input::placeholder {
  color: var(--muted);
}

.library-page-meta {
  margin-bottom: 10px;
  font-size: 11px;
  line-height: 1.3;
  color: var(--text-disabled);
}

.library-manage-btn {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0;
  gap: 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
}

.library-manage-btn .library-inline-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.library-manage-btn .library-inline-icon svg {
  fill: currentColor;
  stroke: none;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 16px 12px;
  min-height: calc(100vh - 228px);
  align-content: start;
}

.library-grid.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.library-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.library-card.is-selected .library-card-preview {
  box-shadow: 0 0 0 2px rgba(39, 101, 246, 0.92);
}

.library-card-preview {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  background: var(--surface-thumb);
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--text-subtle);
  font-size: 11px;
  font-weight: 600;
  position: relative;
  padding: 0;
  cursor: pointer;
}

.library-card-select {
  position: absolute;
  left: 8px;
  top: 8px;
  width: 20px;
  height: 20px;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.library-card:hover .library-card-select,
.library-card:focus-within .library-card-select,
.library-card.is-selected .library-card-select {
  opacity: 1;
}

.library-card-select input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.library-card-select-mark {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--surface-card-select);
  box-shadow: var(--surface-card-action-shadow);
  display: grid;
  place-items: center;
  color: var(--blue);
}

.library-card-select-mark::before {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: rotate(-45deg) translate(0.5px, -1px);
  opacity: 0;
}

.library-card-select input:checked + .library-card-select-mark {
  background: var(--blue);
  color: #ffffff;
}

.library-card-select input:checked + .library-card-select-mark::before {
  opacity: 1;
}

.library-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.library-card-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: center;
}

.library-card-title {
  max-width: 100%;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 400;
  color: var(--text-card-title);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.library-card-format {
  max-width: 100%;
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-card-preview-actions {
  position: absolute;
  left: 50%;
  bottom: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity 0.16s ease;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--surface-card-action);
  box-shadow: var(--surface-card-action-shadow);
}

.library-card:hover .library-card-preview-actions,
.library-card:focus-within .library-card-preview-actions {
  opacity: 1;
  transform: translate(-50%, 0);
}

.library-card-preview-actions .mini-tool {
  height: 22px;
  padding: 0 5px;
  background: transparent;
  box-shadow: none;
  font-size: 10px;
  color: var(--text);
}

#libraryMoveApplyBtn {
  background: var(--blue);
  color: #ffffff;
}

#libraryMoveApplyBtn:hover:not(:disabled) {
  background: var(--accent-active);
  color: #ffffff;
}

.library-empty-state {
  min-height: calc(100vh - 292px);
  display: grid;
  place-items: center;
  align-content: center;
  justify-items: center;
  gap: 10px;
  width: 100%;
  text-align: center;
  color: var(--text-subtle);
}

.library-empty-state strong {
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text-subtle-strong);
}

.library-empty-state p {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-subtle);
}

.library-empty-plus {
  display: block;
  line-height: 1;
  font-size: 28px;
  color: rgba(100, 116, 139, 0.8);
  transform: translateY(-1px);
}

.library-empty-illustration {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: var(--empty-illustration-bg);
  border: 1px solid var(--empty-illustration-border);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.library-empty-illustration::before,
.library-empty-illustration::after {
  content: none;
}

.library-empty-state.is-search-empty .library-empty-illustration {
  display: none;
}

.library-empty-state button {
  border: 0;
  padding: 0;
  cursor: pointer;
}

#groupManagerAddBtn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

#groupManagerAddBtn .library-inline-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.group-manager-panel {
  position: relative;
  width: min(460px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 40px));
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-dialog);
  border: 1px solid var(--divider-strong);
  box-shadow: var(--surface-dialog-shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}

.group-manager-head,
.group-manager-actions,
.group-manager-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.group-manager-head h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  color: var(--text);
}

.group-manager-list {
  min-height: 120px;
  max-height: 320px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.group-manager-row input {
  flex: 1 1 auto;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-input-bg);
  color: var(--text-strong);
  font-size: 13px;
  outline: none;
}

.group-manager-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.material-preview-panel {
  position: relative;
  width: min(660px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-dialog-strong);
  border: 1px solid var(--divider-strong);
  box-shadow: var(--surface-dialog-shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.material-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.material-preview-head h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  color: var(--text);
}

.material-preview-body {
  min-height: 280px;
  max-height: calc(100vh - 170px);
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-preview);
  display: grid;
  place-items: center;
}

.material-preview-body img {
  max-width: 100%;
  max-height: calc(100vh - 210px);
  object-fit: contain;
  display: block;
}

.material-preview-meta {
  flex: 1 1 auto;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.material-preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.material-preview-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.canvas-wrap {
  height: 100%;
  min-height: 0;
  background: transparent;
  border: 0;
  border-radius: var(--radius-none);
  padding: 0;
  overflow: hidden;
}

.canvas-viewport {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding-top: 20px;
  padding-bottom: 88px;
  box-sizing: border-box;
  border-radius: var(--radius-none);
  background: transparent;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  overflow: auto;
  position: relative;
  transition: background 0.18s ease, box-shadow 0.18s ease;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.canvas-viewport.center-x {
  justify-content: center;
}

.canvas-viewport.center-y {
  align-items: center;
}

.canvas-viewport::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.image-stage.mode-rect,
.image-stage.mode-text,
.selection-overlay.mode-rect,
.selection-overlay.mode-text {
  cursor: crosshair;
}

.image-stage.mode-brush,
.selection-overlay.mode-brush {
  cursor: default;
}

.selection-overlay.mode-brush.brush-cursor-active {
  cursor: none;
}

.selection-box,
.selection-box.hit-area,
.selection-delete,
.resize-handle {
  cursor: default;
}

.canvas-viewport.drag-over {
  background: rgba(39, 101, 246, 0.05);
  box-shadow: inset 0 0 0 2px rgba(39, 101, 246, 0.3);
}

.empty-state {
  width: min(1200px, calc(100% - 88px));
  margin: 10px auto 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text);
}

.empty-hero {
  width: 100%;
  min-height: 320px;
  padding: 40px 20px;
  border-radius: var(--radius-2xl);
  background: var(--empty-hero-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.empty-hero-logo {
  width: 62px;
  height: 62px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.empty-hero-logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.empty-hero h1 {
  margin: 0;
  max-width: 100%;
  font-size: clamp(20px, 2.3vw, 34px);
  line-height: 1.12;
  font-weight: 700;
  color: var(--empty-hero-title);
  white-space: nowrap;
}

.empty-hero-subtitle {
  margin: 14px 0 0;
  max-width: min(680px, 100%);
  font-size: clamp(13px, 1.05vw, 16px);
  line-height: 1.55;
  font-weight: 400;
  color: var(--empty-dropzone-text);
  text-align: center;
}

.empty-dropzone {
  width: min(660px, 100%);
  margin-top: 20px;
  min-height: 68px;
  border: 1.5px dashed var(--empty-dropzone-border);
  border-radius: var(--radius-xl);
  display: grid;
  place-items: center;
  padding: 12px 18px;
  color: var(--empty-dropzone-text);
  font-size: clamp(12px, 0.95vw, 15px);
  line-height: 1.4;
  background: var(--empty-dropzone-bg);
}

.empty-upload-button {
  border: 0;
  margin-top: 18px;
  min-width: 196px;
  max-width: 100%;
  height: 46px;
  padding: 0 22px;
  border-radius: var(--radius-lg);
  background: var(--blue);
  color: #fff;
  font-size: clamp(15px, 1.1vw, 18px);
  font-weight: 700;
  transition: filter 0.18s ease;
}

.empty-upload-shell {
  margin-top: 18px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

.empty-upload-trigger {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

.empty-upload-shell .empty-upload-button {
  margin-top: 0;
}

.empty-upload-button:hover {
  filter: saturate(1.03);
}

.empty-example-row {
  margin-top: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  font-size: 13px;
  line-height: 1.4;
}

.empty-example-prefix {
  color: var(--muted);
  font-weight: 400;
}

.empty-example-link {
  border: 0;
  padding: 0;
  margin-left: 5px;
  background: transparent;
  color: var(--muted);
  font-size: inherit;
  font-weight: 400;
  line-height: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color 0.18s ease;
}

.empty-example-link:hover {
  color: var(--text);
}

.empty-upload-tip {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: rgba(17, 24, 39, 0.94);
  color: #fff;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.empty-upload-tip::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -5px;
  width: 10px;
  height: 10px;
  background: rgba(17, 24, 39, 0.94);
  transform: translateX(-50%) rotate(45deg);
}

.empty-upload-trigger:hover .empty-upload-tip,
.empty-upload-trigger:focus-within .empty-upload-tip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.empty-features {
  width: 100%;
  margin-top: 40px;
}

.empty-features-heading {
  margin: 0;
  text-align: center;
  color: var(--text);
  font-size: clamp(18px, 1.5vw, 22px);
  font-weight: 600;
  line-height: 1.35;
}

.empty-features-list {
  margin: 20px 0 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 16px;
}

.empty-feature-item {
  margin: 0;
  min-width: 0;
  padding: 16px 14px 16px;
  border-radius: var(--radius-2xl);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.empty-feature-visual {
  width: 56px;
  height: 56px;
  margin-bottom: 5px;
  flex-shrink: 0;
}

.empty-feature-visual img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.empty-feature-item dt {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.empty-feature-item dd {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.empty-faq {
  width: 100%;
  margin-top: 36px;
}

.empty-faq-heading {
  margin: 0;
  text-align: center;
  color: var(--text);
  font-size: clamp(18px, 1.5vw, 22px);
  font-weight: 600;
  line-height: 1.35;
}

.empty-faq-list {
  margin: 20px 0 0;
  display: grid;
  gap: 14px;
}

.empty-faq-item {
  margin: 0;
  min-width: 0;
  padding: 16px 18px 18px;
  border-radius: var(--radius-2xl);
  background: #ffffff;
}

.empty-faq-item dt,
.empty-faq-item dd {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.empty-faq-item dt {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
}

.empty-faq-item dd {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.empty-faq-mark {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
}

.empty-faq-mark-q {
  background: var(--surface-hover);
  color: var(--text-subtle-strong);
}

.empty-faq-mark-a {
  background: var(--soft-fill);
  color: var(--muted);
}

.empty-faq-copy {
  flex: 1;
  min-width: 0;
}

.home-footer {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 20px 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  text-align: center;
  justify-self: stretch;
  align-self: end;
  flex-wrap: wrap;
}

.home-footer-copy {
  white-space: nowrap;
}

.home-footer-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.home-footer .theme-toggle-button.footer-locale-trigger {
  flex: 0 0 auto;
}

.image-stage {
  position: relative;
  user-select: none;
  flex: 0 0 auto;
  overflow: visible;
  background: var(--canvas-stage-bg);
}

.canvas-clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.image-stage.is-transparent-canvas {
  background-color: var(--canvas-stage-bg);
  background-image:
    linear-gradient(45deg, var(--canvas-checker) 25%, transparent 25%),
    linear-gradient(-45deg, var(--canvas-checker) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--canvas-checker) 75%),
    linear-gradient(-45deg, transparent 75%, var(--canvas-checker) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.stage-loading-overlay {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 4;
  background: var(--blue-soft);
  border: 2px solid rgba(96, 165, 250, 0.76);
}

.stage-loading-sheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 0%, var(--stage-sheen) 45%, transparent 68%);
  transform: translateX(-140%);
  animation: shimmer-sweep 1.1s linear infinite;
  pointer-events: none;
}

.image-stage.hidden,
.hidden {
  display: none !important;
}

#stageImage {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  max-width: none;
}

.selection-overlay,
.layer-preview-stage,
.canvas-text-editor,
.brush-canvas {
  position: absolute;
  inset: 0;
}

.brush-cursor-ghost {
  position: absolute;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  pointer-events: none;
  z-index: 8;
  background: center / contain no-repeat url("../../assets/cursors/brush-cursor.svg");
  will-change: transform;
}

.layer-preview-stage {
  pointer-events: none;
}

.layer-preview {
  position: absolute;
  display: block;
  max-width: none;
  user-select: none;
  pointer-events: none;
  will-change: transform;
}

.layer-preview.active {
  filter: saturate(1.04);
}

.brush-canvas {
  pointer-events: none;
  opacity: 0.5;
}

.selection-box {
  position: absolute;
  overflow: visible;
  will-change: transform;
}

.canvas-selection-box {
  z-index: 1;
}

.background-selection-box {
  z-index: 2;
  pointer-events: none;
}

.background-selection-box.is-transforming {
  pointer-events: auto;
  cursor: grab;
}

.background-selection-box.is-transforming:active {
  cursor: grabbing;
}

.selection-visual {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 2px solid rgba(96, 165, 250, 0.76);
  background: rgba(39, 101, 246, 0.06);
  box-shadow: none;
  pointer-events: none;
}

.selection-visual.active {
  background: rgba(39, 101, 246, 0.1);
}

.selection-visual.background-active {
  background: rgba(39, 101, 246, 0.02);
  border-color: rgba(39, 101, 246, 0.62);
}

.selection-visual.background-active.is-transforming {
  background: rgba(39, 101, 246, 0.04);
  border-color: rgba(39, 101, 246, 0.9);
}

.selection-visual.canvas-active {
  border-color: rgba(59, 130, 246, 0.52);
  border-style: dashed;
  background: transparent;
}

.snap-guide {
  position: absolute;
  pointer-events: none;
  z-index: 4;
  background: rgba(39, 101, 246, 0.78);
  box-shadow: 0 0 0 1px var(--snap-guide-halo);
}

.snap-guide-vertical {
  top: 0;
  bottom: 0;
  width: 1px;
  transform: translateX(-0.5px);
}

.snap-guide-horizontal {
  left: 0;
  right: 0;
  height: 1px;
  transform: translateY(-0.5px);
}

.selection-visual.brush-shape {
  border: 0;
  background: transparent;
}

.selection-visual.brush-shape.smart-preview {
  border: 2px solid var(--smart-preview-border, rgba(96, 165, 250, 0.76));
  background: var(--smart-preview-fill, rgba(39, 101, 246, 0.06));
}

.selection-box.active > .selection-visual.brush-shape:not(.smart-preview) {
  border: 2px solid rgba(96, 165, 250, 0.76);
  background: rgba(39, 101, 246, 0.1);
}

.selection-visual.is-loading {
  background: rgba(39, 101, 246, 0.08);
}

.selection-visual.smart-preview {
  border-color: var(--smart-preview-border, rgba(96, 165, 250, 0.76));
  background: var(--smart-preview-fill, rgba(39, 101, 246, 0.06));
  pointer-events: auto;
}

.selection-visual.smart-preview.excluded {
  border-color: transparent;
  background: transparent;
  opacity: 0.06;
}

.selection-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 0%, var(--shimmer-highlight) 45%, transparent 68%);
  transform: translateX(-140%);
  animation: shimmer-sweep 1.1s linear infinite;
  pointer-events: none;
}

.selection-visual.brush-shape .selection-shimmer {
  background: linear-gradient(100deg, transparent 0%, var(--shimmer-highlight) 45%, transparent 68%);
}

.selection-delete {
  position: absolute;
  top: -9px;
  right: -9px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: var(--radius-pill);
  background: rgba(71, 85, 105, 0.58);
  color: transparent;
  display: block;
  padding: 0;
  font-size: 0;
  line-height: 0;
  text-align: left;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(4px);
  z-index: 3;
  pointer-events: auto;
}

.selection-delete::before {
  content: "×";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 11px;
  line-height: 1;
  transform: translateY(-0.5px);
  font-family: Inter, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

.selection-delete:hover {
  background: rgba(51, 65, 85, 0.72);
}

@keyframes shimmer-sweep {
  from {
    transform: translateX(-140%);
  }

  to {
    transform: translateX(140%);
  }
}

.resize-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid var(--blue);
  background: var(--resize-handle-bg);
  pointer-events: auto;
  z-index: 3;
}

.canvas-selection-box > .resize-handle {
  width: 10px;
  height: 10px;
  border-color: rgba(59, 130, 246, 0.72);
}

.resize-handle-nw {
  left: -6px;
  top: -6px;
  cursor: nwse-resize;
}

.resize-handle-n {
  left: calc(50% - 6px);
  top: -6px;
  cursor: ns-resize;
}

.resize-handle-ne {
  right: -6px;
  top: -6px;
  cursor: nesw-resize;
}

.resize-handle-e {
  right: -6px;
  top: calc(50% - 6px);
  cursor: ew-resize;
}

.resize-handle-se {
  right: -6px;
  bottom: -6px;
  cursor: nwse-resize;
}

.resize-handle-s {
  left: calc(50% - 6px);
  bottom: -6px;
  cursor: ns-resize;
}

.resize-handle-sw {
  left: -6px;
  bottom: -6px;
  cursor: nesw-resize;
}

.resize-handle-w {
  left: -6px;
  top: calc(50% - 6px);
  cursor: ew-resize;
}

.mask-ghost {
  position: absolute;
  inset: 0;
  background: rgba(39, 101, 246, 0.12);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  pointer-events: none;
  filter: none;
}

.selection-visual.brush-shape.active .mask-ghost {
  background: rgba(39, 101, 246, 0.16);
  filter: none;
}

.drawing-box {
  position: absolute;
  inset: auto;
  border: 2px dashed var(--blue);
  background: rgba(39, 101, 246, 0.08);
  pointer-events: none;
  z-index: 9;
  will-change: left, top, width, height;
}

.bottom-toolbar {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: var(--radius-lg);
  background: var(--surface-floating);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 25;
}

.sidebar-fab {
  position: fixed;
  left: 18px;
  bottom: 18px;
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--fab-color);
  display: grid;
  place-items: center;
  box-shadow: none;
  padding: 0;
  z-index: 30;
}

.sidebar-fab svg {
  width: 26px;
  height: 26px;
  display: block;
}

.projects-fab {
  left: 18px;
}

.projects-fab img {
  display: block;
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.layer-fab {
  left: 56px;
}

.sidebar-fab.is-docked {
  transform: none;
  left: 280px;
  bottom: 18px;
}

.app-shell.sidebar-collapsed:not(.projects-collapsed) #sidebarToggleFab.is-docked,
.app-shell.projects-collapsed:not(.sidebar-collapsed) #projectsToggleFab.is-docked {
  left: 280px;
}

.inspector-fab {
  position: fixed;
  right: 28px;
  bottom: 18px;
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--fab-color);
  display: grid;
  place-items: center;
  box-shadow: none;
  padding: 0;
  z-index: 30;
}

.inspector-fab svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.sidebar-fab svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.sidebar-fab:hover,
.inspector-fab:hover {
  color: var(--blue);
}

.zoom-readout {
  min-width: 52px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.range-field {
  gap: 2px;
}

.field > span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.25;
  margin: 0;
}

.field-head > span {
  font-size: 11px;
  line-height: 1.2;
  color: var(--muted);
  font-weight: 600;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  height: 34px;
  border-radius: var(--radius-xs);
  border: 0;
  padding: 0 10px;
  background-color: var(--surface-input-bg);
  color: var(--text);
  font-size: 12px;
  box-shadow: none;
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px 14px;
  cursor: pointer;
}

.field select option {
  background-color: var(--surface-dropdown);
  color: var(--text);
}

.field.is-disabled > span,
.field.is-disabled > strong {
  color: var(--text-field-muted);
}

.field.is-disabled input,
.field.is-disabled textarea,
.field.is-disabled select,
.field input:disabled,
.field textarea:disabled,
.field select:disabled {
  color: var(--text-input-disabled);
  background: var(--surface-input-disabled);
  box-shadow: none;
  cursor: not-allowed;
}

.field.is-disabled input::placeholder,
.field.is-disabled textarea::placeholder,
.field input:disabled::placeholder,
.field textarea:disabled::placeholder {
  color: var(--text-field-muted);
}

.field.is-disabled input[type="range"],
.field input[type="range"]:disabled {
  opacity: 0.45;
}

.field textarea {
  height: auto;
  min-height: 78px;
  padding: 8px 10px;
  resize: vertical;
}

.text-content-overlay,
.text-content-input {
  min-height: 88px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.canvas-text-editor {
  z-index: 8;
  pointer-events: auto;
  overflow: hidden;
  user-select: text;
  -webkit-user-select: text;
}

.canvas-text-editor,
.canvas-text-editor * {
  user-select: text !important;
  -webkit-user-select: text !important;
}

.canvas-text-editor:not(.hidden) {
  display: block;
}

.canvas-text-editor .text-content-overlay,
.canvas-text-editor .text-content-input {
  min-height: 0;
  height: 100%;
  box-sizing: border-box;
}

.text-content-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  color: var(--text);
  overflow: hidden;
  box-sizing: border-box;
}

.text-content-input {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: transparent !important;
  color: transparent !important;
  caret-color: currentColor;
  -webkit-text-fill-color: transparent !important;
  border: 0 !important;
  border-radius: var(--radius-none) !important;
  box-shadow: none !important;
  resize: none !important;
  overflow: hidden;
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
  box-sizing: border-box;
  margin: 0;
  outline: none !important;
  appearance: none;
  -webkit-appearance: none;
}

.overlay-run {
  white-space: pre-wrap;
}

.overlay-run.is-selected {
  background: var(--overlay-highlight);
  border-radius: 2px;
}

.overlay-caret {
  display: inline-block;
  width: 0;
  margin-left: -1px;
  border-left: 1.5px solid currentColor;
  animation: overlay-caret-blink 1s steps(1) infinite;
  vertical-align: text-bottom;
}

@keyframes overlay-caret-blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

.field input[type="range"] {
  padding: 0;
  height: 14px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  --range-progress: 0%;
  color: var(--range-track-active);
}

.field input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: var(--radius-pill);
  background: linear-gradient(
    to right,
    var(--range-track-active) 0%,
    var(--range-track-active) var(--range-progress),
    var(--range-track-inactive) var(--range-progress),
    var(--range-track-inactive) 100%
  );
}

.field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border: 0;
  border-radius: 50%;
  background: var(--range-thumb-bg);
  box-shadow: 0 0 0 2px var(--range-thumb-ring);
}

.field input[type="range"]::-moz-range-track {
  height: 4px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--range-track-inactive);
}

.field input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--range-track-active);
}

.field input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: var(--range-thumb-bg);
  box-shadow: 0 0 0 2px var(--range-thumb-ring);
}

.field input[type="color"] {
  padding: 4px;
}

.field > strong {
  display: block;
  margin: 0;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 600;
  color: var(--muted);
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.layer-name-input:focus,
.project-title-input:focus {
  outline: none;
  background-color: var(--surface-input-focus-bg);
  box-shadow: 0 0 0 2px var(--surface-input-focus-ring);
}

.inspector .field input:not([type="range"]),
.inspector .field select,
.inspector .field textarea {
  background-color: var(--surface-input-bg);
  color: var(--text);
}

.project-title-input.is-editing:focus {
  background: var(--surface-input-editing);
  box-shadow: none;
}

.text-layer-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.text-style-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.text-style-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.text-style-compact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
}

.text-style-compact-grid .field-span-full {
  grid-column: 1 / -1;
}

.inline-style-button {
  min-width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 700;
}

.inline-style-button:nth-of-type(2) {
  font-style: italic;
}

.inline-style-button:nth-of-type(3) {
  text-decoration: underline;
}

.text-style-compact-grid .field {
  gap: 4px;
}

.text-style-compact-grid .field input,
.text-style-compact-grid .field select {
  height: 32px;
}

.font-family-shell {
  display: block;
}

.font-picker-trigger {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border: 1px solid var(--border-ui-alt-strong);
  border-radius: var(--radius-xs);
  background: var(--panel-solid);
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 500;
}

.font-picker-trigger svg {
  width: 12px;
  height: 12px;
  color: var(--text-secondary);
}

.font-picker-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.font-picker-dialog {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.materials-panel-dialog {
  position: fixed;
  inset: 0;
  z-index: 70;
}

.materials-panel-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay-backdrop);
}

.materials-panel {
  position: absolute;
  top: 28px;
  left: 96px;
  right: 96px;
  bottom: 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-page-panel);
  border: 1px solid var(--divider-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--surface-dialog-shadow);
}

.materials-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 14px;
}

.materials-panel-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 600;
  color: var(--text);
}

.materials-panel-head .collapse-button {
  width: 28px;
  height: 28px;
  color: var(--muted);
}

.materials-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 212px minmax(0, 1fr);
}

.materials-panel-sidebar {
  border-right: 1px solid var(--border-ui);
  padding: 8px 0 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 0;
}

.materials-panel-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
  overflow: auto;
}

.materials-panel-nav-item {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
  text-align: left;
}

.materials-panel-nav-item.is-active {
  background: var(--nav-active-bg);
  color: var(--blue);
}

.materials-panel-new-group {
  margin: 10px 12px 0;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.materials-panel-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 18px 18px;
}

.materials-panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 2px 14px;
}

.materials-panel-meta {
  font-size: 12px;
  line-height: 1.3;
  color: var(--muted);
}

.materials-panel-toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.materials-panel-toolbar-actions input {
  width: 160px;
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-thumb);
  color: var(--text-strong);
  font-size: 11px;
  outline: none;
}

.materials-panel-toolbar-actions input::placeholder {
  color: var(--muted);
}

.materials-panel-upload-btn {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: var(--blue);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.materials-panel-list {
  flex: 1 1 auto;
  overflow: auto;
  padding: 10px 2px 6px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 18px 14px;
  align-content: start;
}

.materials-panel-list.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.materials-panel-entry {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  border-radius: 0;
  cursor: pointer;
}

.materials-panel-entry.is-selected .materials-panel-thumb {
  box-shadow: 0 0 0 2px rgba(39, 101, 246, 0.92);
}

.materials-panel-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-thumb);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
}

.materials-panel-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.materials-panel-copy {
  min-width: 0;
}

.materials-panel-title-row strong {
  display: block;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 400;
  color: var(--text-card-title);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.materials-rename-input {
  width: 100%;
  height: 38px;
  padding: 0 9px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-thumb);
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 400;
  outline: none;
  box-shadow: none;
}

.materials-panel-footer {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px 2px 0;
}

.materials-panel-selection-meta {
  color: var(--muted);
  font-size: 12px;
}

.materials-panel-pager {
  color: var(--muted);
  font-size: 12px;
}

.materials-panel-footer-actions {
  display: inline-flex;
  align-items: center;
  gap: 16px;
}

.materials-panel-confirm-btn,
.materials-panel-cancel-btn {
  min-width: 92px;
  height: 32px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.materials-panel-confirm-btn:disabled {
  background: rgba(39, 101, 246, 0.3);
  color: #ffffff;
}

.materials-panel-cancel-btn {
  background: var(--surface-thumb);
  color: var(--text);
}

.materials-panel-empty-state {
  min-height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  justify-items: center;
  gap: 10px;
  text-align: center;
  color: var(--text-subtle);
}

.materials-panel-empty-state strong {
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text-subtle-strong);
}

.materials-panel-empty-state p {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-subtle);
}

.materials-panel-empty-cta {
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--empty-illustration-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-placeholder);
  box-shadow: inset 0 0 0 1px var(--empty-illustration-border);
}

.materials-panel-empty-plus {
  display: block;
  line-height: 1;
  font-size: 28px;
  transform: translateY(-1px);
}

.font-picker-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay-backdrop);
}

.font-picker-panel {
  position: absolute;
  top: 14px;
  right: 14px;
  width: min(286px, calc(100vw - 20px));
  height: calc(100vh - 28px);
  max-height: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--surface-page-panel);
  border: 1px solid var(--border-ui-alt-strong);
  border-radius: 10px;
  box-shadow: var(--surface-dialog-shadow);
}

.font-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 9px;
  border-bottom: 1px solid var(--border-ui-alt);
}

.font-picker-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-strong);
}

.font-picker-search-shell {
  padding: 5px 12px 4px;
  border-bottom: 1px solid var(--border-ui-alt);
}

.font-picker-search-shell input {
  width: 100%;
  height: 34px;
  font-size: 13px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text-strong);
}

.font-picker-search-shell input::placeholder {
  color: var(--text-field-muted);
}

.font-picker-search-shell input:focus {
  border: 0;
  outline: 0;
  box-shadow: none;
}

.font-picker-sections {
  flex: 1 1 auto;
  overflow: auto;
  padding-bottom: 6px;
}

.font-picker-section {
  padding: 8px 0 0;
  border-bottom: 1px solid var(--border-ui-alt);
}

.font-picker-section:last-child {
  border-bottom: 0;
}

.font-picker-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 12px 6px;
}

.font-picker-section-head strong {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-disabled);
}

.font-picker-head-action {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-link);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 700;
  white-space: nowrap;
}

.font-picker-head-action:disabled {
  color: var(--text-subtle);
  cursor: not-allowed;
}

.font-picker-meta {
  margin: -2px 12px 8px;
  color: var(--text-disabled);
  font-size: 11px;
  line-height: 1.4;
}

.font-picker-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: visible;
}

.font-picker-list:empty::before {
  content: "";
  display: none;
}

.project-fonts-empty {
  min-height: 32px;
  margin: 0 12px 14px;
  padding: 8px 9px;
  border-radius: 8px;
  background: var(--soft-accent-surface);
  color: var(--text-placeholder);
  font-size: 11px;
  line-height: 1.4;
}

.project-font-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 8px;
  align-items: stretch;
  padding: 0 12px 0;
  margin-bottom: 0;
}

.project-font-item.has-side-action {
  grid-template-columns: minmax(0, 1fr) auto;
}

.project-font-apply {
  justify-content: flex-start;
  min-width: 0;
  height: 34px;
  padding: 0 2px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
}

.project-font-apply.is-active {
  background: transparent;
  color: var(--accent-active);
}

.project-font-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-font-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.project-font-badge {
  flex: 0 0 auto;
  padding: 2px 5px;
  border-radius: 999px;
  background: var(--badge-surface);
  color: var(--text-placeholder);
  font-size: 10px;
  line-height: 1.2;
}

.project-font-remove {
  width: 24px;
  min-width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  margin: 5px 0 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.project-font-item:hover .project-font-remove,
.project-font-item:focus-within .project-font-remove {
  opacity: 1;
  pointer-events: auto;
}

.project-font-remove:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.project-font-remove svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.font-picker-inline-action {
  min-width: 0;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-link);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, color 0.16s ease;
}

.font-picker-inline-action:disabled {
  color: var(--text-subtle);
  cursor: not-allowed;
}

.project-font-item:hover .font-picker-inline-action,
.project-font-item:focus-within .font-picker-inline-action {
  opacity: 1;
  pointer-events: auto;
}

.inline-style-clear {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--radius-xs);
}

.inline-style-clear svg {
  width: 16px;
  height: 16px;
  display: block;
  margin: 0 auto;
}

.color-input-shell {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  position: relative;
  width: 100%;
}

.color-swatch-button {
  width: 40px;
  height: 34px;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 5px;
  background: var(--surface-thumb);
  display: grid;
  place-items: center;
  box-shadow: none;
}

.color-swatch-button:disabled {
  cursor: not-allowed;
  background: var(--surface-input-disabled);
}

.color-swatch-chip {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-2xs);
  border: 1px solid var(--swatch-border);
  background: #111111;
  box-shadow: inset 0 0 0 1px var(--swatch-inset-ring);
}

.color-input-shell.is-disabled {
  opacity: 0.58;
}

.color-input-shell.is-disabled .color-swatch-button {
  cursor: not-allowed;
}

.native-color-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.inline-style-button.is-active {
  color: var(--blue);
  border-color: var(--accent-border-soft);
  background: var(--accent-surface-soft);
}

.coord-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.aspect-lock-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.aspect-lock-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.aspect-lock-toggle.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.inspector-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.inspector-fields > .field > .coord-grid,
.text-layer-fields > .coord-grid {
  margin-top: 0;
}

.coord-grid .field {
  gap: 4px;
}

.coord-field > span {
  font-size: 10px;
}

.inspector-empty,
.result-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.history-empty-state {
  min-height: 120px;
  display: grid;
  place-items: center;
  text-align: center;
  padding-top: 18px;
}

.inspector-fields > .field,
.inspector-fields > .text-layer-fields,
.inspector-fields > .inspector-empty {
  margin: 0;
}

.projects-section-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.sidebar::-webkit-scrollbar,
.inspector::-webkit-scrollbar,
.projects-sidebar::-webkit-scrollbar,
.layer-list::-webkit-scrollbar,
.history-list::-webkit-scrollbar,
.library-view::-webkit-scrollbar,
.library-page-panel::-webkit-scrollbar,
.group-manager-list::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-thumb,
.inspector::-webkit-scrollbar-thumb,
.projects-sidebar::-webkit-scrollbar-thumb,
.layer-list::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb,
.library-view::-webkit-scrollbar-thumb,
.library-page-panel::-webkit-scrollbar-thumb,
.group-manager-list::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: var(--radius-pill);
  transition: background-color 0.18s ease;
}

.sidebar::-webkit-scrollbar-track,
.inspector::-webkit-scrollbar-track,
.projects-sidebar::-webkit-scrollbar-track,
.layer-list::-webkit-scrollbar-track,
.history-list::-webkit-scrollbar-track,
.library-view::-webkit-scrollbar-track,
.library-page-panel::-webkit-scrollbar-track,
.group-manager-list::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar:hover::-webkit-scrollbar-thumb,
.sidebar.is-scrolling::-webkit-scrollbar-thumb,
.layer-list:hover::-webkit-scrollbar-thumb,
.layer-list.is-scrolling::-webkit-scrollbar-thumb,
.inspector:hover::-webkit-scrollbar-thumb,
.inspector.is-scrolling::-webkit-scrollbar-thumb,
.projects-sidebar:hover::-webkit-scrollbar-thumb,
.projects-sidebar.is-scrolling::-webkit-scrollbar-thumb,
.history-list:hover::-webkit-scrollbar-thumb,
.history-list.is-scrolling::-webkit-scrollbar-thumb,
.library-view:hover::-webkit-scrollbar-thumb,
.library-view.is-scrolling::-webkit-scrollbar-thumb,
.library-page-panel:hover::-webkit-scrollbar-thumb,
.library-page-panel.is-scrolling::-webkit-scrollbar-thumb,
.group-manager-list:hover::-webkit-scrollbar-thumb,
.group-manager-list.is-scrolling::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
}

.result-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.result-link {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  width: 100%;
  justify-content: center;
  min-height: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  text-decoration-line: none;
  line-height: 1;
  white-space: normal;
  overflow: hidden;
  text-align: center;
}

.result-link:link,
.result-link:visited,
.result-link:hover,
.result-link:active {
  text-decoration: none;
}

.result-link:not(.primary) {
  background: var(--surface-thumb);
  color: var(--text);
}

.result-link:not(.primary):hover {
  background: var(--accent-surface-soft);
  color: var(--blue);
}

.result-card img {
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--canvas-stage-bg);
  display: block;
}

.history-entry {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 8px;
  padding: 10px 5px;
  position: relative;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  transition: background-color 0.16s ease, border-radius 0.16s ease;
}

.history-entry:hover,
.history-entry:focus-within {
  background: var(--history-hover);
}

.history-entry.active {
  background: var(--history-active-bg);
  border-radius: var(--radius-lg);
}

.history-list {
  gap: 0;
}

.history-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-thumb);
  display: grid;
  place-items: center;
  justify-self: center;
  align-self: center;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.history-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-entry strong,
.history-entry small {
  display: block;
}

.history-entry strong {
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-entry small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.history-delete {
  position: absolute;
  top: 28px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  padding: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.history-entry:hover .history-delete,
.history-entry:focus-within .history-delete {
  opacity: 1;
  pointer-events: auto;
}

.history-delete:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.history-delete svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
}

#confirmDialog {
  z-index: 120;
}

.confirm-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: var(--dialog-backdrop);
  backdrop-filter: blur(4px);
}

.confirm-dialog-panel {
  position: relative;
  width: min(420px, calc(100vw - 32px));
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--surface-dialog);
  border: 1px solid var(--divider-strong);
  box-shadow: var(--surface-dialog-shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.confirm-dialog-panel h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  color: var(--text);
}

.confirm-dialog-panel p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.confirm-dialog-meta {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--confirm-meta-bg);
  border: 1px solid var(--confirm-meta-border);
}

.confirm-dialog-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  line-height: 1.45;
}

.confirm-dialog-meta-row span:last-child {
  color: var(--text);
  font-weight: 600;
}

.confirm-dialog-meta-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--confirm-meta-note);
}

.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.smart-seg-review {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 121;
  width: min(760px, calc(100vw - 24px));
}

.smart-seg-review-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--surface-dropdown);
  border: 1px solid var(--divider-strong);
  box-shadow: var(--surface-popover-shadow);
  backdrop-filter: blur(10px);
}

.smart-seg-review-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.smart-seg-review-copy strong {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-smart-seg);
}

.smart-seg-review-copy p {
  margin: 0;
  line-height: 1.45;
}

.smart-seg-review-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-subtle-strong);
}

.smart-seg-review-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.smart-seg-review-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-placeholder);
  padding: 3px 0;
  white-space: nowrap;
}

.smart-seg-review-toggle input {
  order: -1;
  width: 13px;
  height: 13px;
  margin: 0;
}

.smart-seg-review-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-subtle-strong);
  min-width: 0;
}

.smart-seg-review-stats span {
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(39, 101, 246, 0.08);
  white-space: nowrap;
}

.smart-seg-review-stats span.candidate-text {
  color: rgb(194, 65, 12);
  background: rgba(249, 115, 22, 0.14);
}

.smart-seg-review-stats span.candidate-graphic {
  color: rgb(29, 78, 216);
  background: rgba(59, 130, 246, 0.12);
}

.smart-seg-review-note {
  font-size: 11px;
  line-height: 1.55;
  color: var(--text-placeholder);
}

.smart-seg-review-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.smart-seg-review-actions .mini-tool,
.smart-seg-review-actions .toolbar-button {
  height: 36px;
}

@media (max-width: 760px) {
  .smart-seg-review-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .smart-seg-review-actions {
    justify-content: flex-end;
  }
}

.toast-viewport {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, calc(100vw - 24px));
  z-index: 120;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--toast-border);
  background: var(--toast-bg);
  color: var(--text);
  box-shadow: var(--toast-shadow);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

.toast.is-success,
.toast.is-error,
.toast.is-info {
  border-color: var(--toast-border);
  background: var(--toast-bg);
}

.toast-mark {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: var(--radius-pill);
  display: grid;
  place-items: center;
  margin-top: 1px;
  font-size: 11px;
  font-weight: 700;
}

.toast.is-success .toast-mark,
.toast.is-error .toast-mark,
.toast.is-info .toast-mark {
  background: var(--accent-surface-medium);
  color: var(--blue);
}

.toast-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.toast-title {
  display: block;
  margin: 0 0 2px;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 700;
}

.toast-message {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--toast-message-color);
}

.toast-close {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(39, 101, 246, 0.54);
  display: grid;
  place-items: center;
  padding: 0;
}

.toast-close:hover {
  background: var(--accent-surface-soft);
  color: var(--accent-hover);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 160;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--loading-scrim);
  backdrop-filter: blur(6px);
}

.loading-panel {
  width: min(360px, calc(100vw - 32px));
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 22px 20px;
  border: 1px solid rgba(39, 101, 246, 0.14);
  border-radius: var(--radius-lg);
  background: var(--surface-dialog);
  box-shadow: var(--surface-dialog-shadow);
  text-align: center;
}

.loading-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(39, 101, 246, 0.16);
  border-top-color: #2765f6;
  animation: loading-spin 0.72s linear infinite;
}

.loading-title {
  font-size: 14px;
  line-height: 1.35;
  font-weight: 700;
}

.loading-message {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(44, 64, 96, 0.82);
}

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

@media (max-width: 1480px) {
  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr) 250px;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 240px minmax(0, 1fr) 250px;
  }

  .app-shell.projects-collapsed {
    grid-template-columns: 0 minmax(0, 1fr) 250px;
  }

  .app-shell.inspector-collapsed {
    grid-template-columns: 240px minmax(0, 1fr) 0;
  }

  .app-shell.sidebar-collapsed.projects-collapsed {
    grid-template-columns: 0 minmax(0, 1fr) 250px;
  }

  .app-shell.projects-collapsed.inspector-collapsed {
    grid-template-columns: 0 minmax(0, 1fr) 0;
  }

  .app-shell.sidebar-collapsed.inspector-collapsed {
    grid-template-columns: 240px minmax(0, 1fr) 0;
  }

  .app-shell.sidebar-collapsed.projects-collapsed.inspector-collapsed {
    grid-template-columns: 0 minmax(0, 1fr) 0;
  }

  .sidebar {
    width: 240px;
  }

  .sidebar-fab.is-docked,
  .app-shell.sidebar-collapsed:not(.projects-collapsed) #sidebarToggleFab.is-docked,
  .app-shell.projects-collapsed:not(.sidebar-collapsed) #projectsToggleFab.is-docked {
    left: 252px;
  }
}

@media (max-width: 1220px) {
  .app-shell {
    grid-template-columns: 200px minmax(0, 1fr) 220px;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 200px minmax(0, 1fr) 220px;
  }

  .app-shell.projects-collapsed {
    grid-template-columns: 0 minmax(0, 1fr) 220px;
  }

  .app-shell.inspector-collapsed {
    grid-template-columns: 200px minmax(0, 1fr) 0;
  }

  .app-shell.sidebar-collapsed.projects-collapsed {
    grid-template-columns: 0 minmax(0, 1fr) 220px;
  }

  .app-shell.projects-collapsed.inspector-collapsed {
    grid-template-columns: 0 minmax(0, 1fr) 0;
  }

  .app-shell.sidebar-collapsed.inspector-collapsed {
    grid-template-columns: 200px minmax(0, 1fr) 0;
  }

  .app-shell.sidebar-collapsed.projects-collapsed.inspector-collapsed {
    grid-template-columns: 0 minmax(0, 1fr) 0;
  }

  .sidebar {
    width: 200px;
  }

  .inspector {
    display: flex;
  }

  .inspector-fab {
    display: grid;
  }

  .sidebar-fab.is-docked,
  .app-shell.sidebar-collapsed:not(.projects-collapsed) #sidebarToggleFab.is-docked,
  .app-shell.projects-collapsed:not(.sidebar-collapsed) #projectsToggleFab.is-docked {
    left: 232px;
  }

  .empty-features-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    overflow: visible;
  }

  .sidebar,
  .projects-sidebar,
  .inspector,
  .workspace-shell {
    border: 0;
  }

  .workspace-shell {
    min-height: 720px;
  }

  .library-page-head,
  .library-page-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .library-page-tools {
    min-width: 0;
    align-items: stretch;
  }

  .library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .canvas-viewport {
    padding-top: 0;
    padding-bottom: 48px;
  }

  .empty-state {
    width: min(100%, calc(100% - 24px));
    margin: 10px auto 18px;
    gap: 16px;
  }

  .empty-hero {
    min-height: auto;
    padding: 34px 14px 26px;
    border-radius: var(--radius-xl);
  }

  .empty-hero-logo {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
  }

  .empty-hero h1 {
    white-space: normal;
  }

  .empty-hero-subtitle {
    margin-top: 10px;
    font-size: 13px;
  }

  .empty-dropzone {
    margin-top: 16px;
    min-height: 66px;
    padding: 10px 12px;
    border-radius: var(--radius-lg);
  }

  .empty-upload-button {
    margin-top: 16px;
    min-width: 0;
    width: 100%;
    height: 42px;
    border-radius: var(--radius-md);
  }

  .empty-features {
    margin-top: 20px;
  }

  .empty-faq {
    margin-top: 20px;
  }

  .empty-features-list {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .empty-feature-item {
    padding: 14px 16px 16px;
  }

  .toast-viewport {
    top: 12px;
    width: min(100vw - 20px, 420px);
  }
}

/* 夜间模式：覆盖语义化 CSS 变量，各组件自动继承暗色样式 */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #191919;
  --panel: rgba(37, 37, 37, 0.94);
  --panel-solid: #252525;
  --border: rgba(255, 255, 255, 0.09);
  --text: #e8e8e7;
  --muted: #9b9a97;
  --blue: #5b8af7;
  --blue-soft: rgba(91, 138, 247, 0.14);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --panel-edge: rgba(255, 255, 255, 0.05);
  --soft-fill: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --surface-elevated: rgba(255, 255, 255, 0.08);
  --surface-overlay: rgba(42, 42, 42, 0.98);
  --surface-muted: #2f2f2f;
  --surface-input: rgba(255, 255, 255, 0.06);
  --divider: rgba(255, 255, 255, 0.06);
  --divider-strong: rgba(255, 255, 255, 0.08);
  --inset-highlight: rgba(255, 255, 255, 0.04);
  --text-strong: #f5f5f4;
  --text-secondary: #a8a29e;
  --text-disabled: #78716c;
  --canvas-surface: #2a2a2a;
  --empty-hero-bg: #252525;
  --empty-hero-title: #f5f5f4;
  --fab-color: #a8a29e;
  --surface-item: rgba(255, 255, 255, 0.06);
  --surface-item-active: rgba(91, 138, 247, 0.16);
  --surface-thumb: #333333;
  --surface-dialog: rgba(42, 42, 42, 0.98);
  --surface-dialog-strong: rgba(42, 42, 42, 0.99);
  --surface-dropdown: rgba(42, 42, 42, 0.98);
  --surface-toolbar: rgba(42, 42, 42, 0.88);
  --surface-floating: rgba(42, 42, 42, 0.86);
  --surface-card-action: rgba(32, 32, 32, 0.96);
  --surface-card-select: rgba(50, 50, 50, 0.96);
  --surface-input-bg: #2f2f2f;
  --surface-input-disabled: #2a2a2a;
  --surface-input-editing: #333333;
  --surface-preview: #2f2f2f;
  --surface-page-panel: #252525;
  --surface-popover-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  --surface-dialog-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --surface-card-action-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  --dialog-backdrop: rgba(0, 0, 0, 0.55);
  --overlay-backdrop: rgba(0, 0, 0, 0.5);
  --text-card-title: #e8e8e7;
  --text-subtle: #9b9a97;
  --text-subtle-strong: #a8a29e;
  --text-placeholder: #78716c;
  --text-smart-seg: #d6d3d1;
  --text-input-disabled: #78716c;
  --shimmer-highlight: rgba(255, 255, 255, 0.08);
  --scrollbar-thumb: rgba(255, 255, 255, 0.14);
  --history-hover: rgba(255, 255, 255, 0.04);
  --option-hover: rgba(255, 255, 255, 0.06);
  --accent: #5b8af7;
  --accent-link: #7ba4ff;
  --accent-hover: #6b96f8;
  --accent-active: #5b8af7;
  --text-field-muted: #78716c;
  --history-active-bg: rgba(91, 138, 247, 0.16);
  --nav-active-bg: rgba(91, 138, 247, 0.12);
  --border-ui: rgba(255, 255, 255, 0.08);
  --border-ui-strong: rgba(255, 255, 255, 0.12);
  --border-ui-alt: rgba(255, 255, 255, 0.08);
  --border-ui-alt-strong: rgba(255, 255, 255, 0.1);
  --locale-hover-bg: rgba(91, 138, 247, 0.12);
  --locale-active-bg: rgba(91, 138, 247, 0.16);
  --canvas-stage-bg: #2a2a2a;
  --canvas-checker: rgba(255, 255, 255, 0.06);
  --resize-handle-bg: #3a3a3a;
  --toast-bg: rgba(38, 42, 52, 0.98);
  --toast-border: rgba(91, 138, 247, 0.22);
  --toast-message-color: rgba(214, 211, 209, 0.88);
  --toast-shadow: 0 18px 42px rgba(0, 0, 0, 0.4);
  --loading-scrim: rgba(0, 0, 0, 0.62);
  --empty-dropzone-border: rgba(255, 255, 255, 0.12);
  --empty-dropzone-text: var(--text-secondary);
  --empty-dropzone-bg: linear-gradient(180deg, rgba(42, 42, 42, 0.98), rgba(35, 35, 35, 0.96));
  --confirm-meta-bg: rgba(91, 138, 247, 0.1);
  --confirm-meta-border: rgba(91, 138, 247, 0.18);
  --confirm-meta-note: rgba(214, 211, 209, 0.82);
  --surface-input-focus-bg: rgba(91, 138, 247, 0.16);
  --surface-input-focus-ring: rgba(91, 138, 247, 0.24);
  --range-track-active: #5b8af7;
  --range-track-inactive: rgba(255, 255, 255, 0.14);
  --range-thumb-bg: #5b8af7;
  --range-thumb-ring: rgba(42, 42, 42, 0.96);
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 7.5l5 5 5-5' fill='none' stroke='%23a8a29e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --soft-accent-surface: rgba(255, 255, 255, 0.04);
  --badge-surface: rgba(255, 255, 255, 0.08);
  --empty-illustration-bg: linear-gradient(135deg, rgba(91, 138, 247, 0.12), rgba(91, 138, 247, 0.04)), #2f2f2f;
  --empty-illustration-border: rgba(255, 255, 255, 0.1);
  --swatch-inset-ring: rgba(255, 255, 255, 0.12);
  --swatch-border: rgba(255, 255, 255, 0.1);
  --stage-sheen: rgba(255, 255, 255, 0.08);
  --snap-guide-halo: rgba(0, 0, 0, 0.35);
  --library-panel-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  --home-quick-bg: rgba(255, 255, 255, 0.04);
  --accent-surface-soft: rgba(91, 138, 247, 0.14);
  --accent-surface-medium: rgba(91, 138, 247, 0.18);
  --overlay-highlight: rgba(91, 138, 247, 0.22);
}

[data-theme="dark"] .sidebar,
[data-theme="dark"] .projects-sidebar,
[data-theme="dark"] .inspector {
  box-shadow: inset 0 1px 0 var(--inset-highlight);
}

[data-theme="dark"] .sidebar-head,
[data-theme="dark"] .inspector-head {
  border-bottom-color: var(--divider);
}

[data-theme="dark"] .sidebar:hover::-webkit-scrollbar-thumb,
[data-theme="dark"] .sidebar.is-scrolling::-webkit-scrollbar-thumb,
[data-theme="dark"] .layer-list:hover::-webkit-scrollbar-thumb,
[data-theme="dark"] .layer-list.is-scrolling::-webkit-scrollbar-thumb,
[data-theme="dark"] .inspector:hover::-webkit-scrollbar-thumb,
[data-theme="dark"] .inspector.is-scrolling::-webkit-scrollbar-thumb,
[data-theme="dark"] .projects-sidebar:hover::-webkit-scrollbar-thumb,
[data-theme="dark"] .projects-sidebar.is-scrolling::-webkit-scrollbar-thumb,
[data-theme="dark"] .history-list:hover::-webkit-scrollbar-thumb,
[data-theme="dark"] .history-list.is-scrolling::-webkit-scrollbar-thumb,
[data-theme="dark"] .library-view:hover::-webkit-scrollbar-thumb,
[data-theme="dark"] .library-view.is-scrolling::-webkit-scrollbar-thumb,
[data-theme="dark"] .library-page-panel:hover::-webkit-scrollbar-thumb,
[data-theme="dark"] .library-page-panel.is-scrolling::-webkit-scrollbar-thumb,
[data-theme="dark"] .group-manager-list:hover::-webkit-scrollbar-thumb,
[data-theme="dark"] .group-manager-list.is-scrolling::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
}

[data-theme="dark"] .empty-dropzone {
  border-color: var(--empty-dropzone-border);
  color: var(--empty-dropzone-text);
  background: var(--empty-dropzone-bg);
}

[data-theme="dark"] .empty-feature-item {
  background: var(--panel-solid);
  box-shadow: var(--shadow);
}

[data-theme="dark"] .library-empty-state,
[data-theme="dark"] .library-empty-state p {
  color: var(--text-subtle);
}

[data-theme="dark"] .library-empty-state strong {
  color: var(--text-secondary);
}

[data-theme="dark"] .layer-visibility,
[data-theme="dark"] .layer-more,
[data-theme="dark"] .sidebar-fab {
  color: var(--fab-color);
}

[data-theme="dark"] .layer-visibility:hover,
[data-theme="dark"] .layer-more:hover,
[data-theme="dark"] .layer-more[aria-expanded="true"],
[data-theme="dark"] .layer-menu-action:hover,
[data-theme="dark"] .export-option:hover,
[data-theme="dark"] .export-option.is-active {
  color: var(--text-strong);
}

[data-theme="dark"] .layer-item.is-hidden .layer-visibility,
[data-theme="dark"] .layer-menu-action:disabled,
[data-theme="dark"] .toolbar-button:disabled,
[data-theme="dark"] .mini-tool:disabled {
  color: var(--text-disabled);
}

[data-theme="dark"] .inspector .panel-section:not(.hidden) + .panel-section:not(.hidden) {
  border-top-color: var(--divider);
}
