* {
  box-sizing: border-box;
}

/* Author display rules must not expose collapsed controls. */
[hidden]:not([hidden="until-found"]) {
  display: none !important;
}

html {
  min-width: 0;
  background: var(--ink);
}

body {
  min-width: 0;
  min-height: 100dvh;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: -0.01em;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
}

button:active {
  transform: translateY(1px);
}

.app-shell {
  display: grid;
  grid-template-areas:
    "top top"
    "rail ribbon"
    "rail workspace";
  grid-template-columns: 72px minmax(0, 1fr);
  grid-template-rows: 64px 108px minmax(0, 1fr);
  min-height: 100dvh;
  height: 100dvh;
  background:
    linear-gradient(90deg, transparent 0 71px, color-mix(in srgb, var(--primary) 8%, transparent) 71px 72px, transparent 72px),
    var(--ink);
}

.topbar {
  grid-area: top;
  display: grid;
  grid-template-columns: 250px minmax(240px, 1fr) auto;
  align-items: center;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  background: var(--ink);
}

.topbar::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--signal);
  content: "";
}

.wordmark {
  display: flex;
  align-items: center;
  align-self: stretch;
  gap: 12px;
  min-width: 0;
  padding: 0 18px;
  border-right: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.wordmark-mark {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 4px;
  background: #fff url("assets/icons/favicon-02.svg") center / cover no-repeat;
  box-shadow: 0 0 0 1px var(--line);
  overflow: hidden;
}

.wordmark-copy {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  font-family: var(--display);
  letter-spacing: 0.02em;
}

.wordmark-copy strong {
  min-width: 0;
  overflow: hidden;
  font-size: 16px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wordmark-copy small {
  color: var(--text-muted);
  font-size: 11px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  align-self: stretch;
  gap: 15px;
  padding: 0 18px;
  border-left: 1px solid var(--line);
}

.topbar-history {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: 12px;
  border-right: 1px solid var(--border);
}

.topbar-history-button {
  position: relative;
  display: inline-flex;
  width: 32px;
  min-width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  background: var(--background);
  font-size: 16px;
  line-height: 1;
}

.topbar-history-button::before {
  display: block;
  line-height: 1;
}

#undoButton::before { content: "↶"; }
#redoButton::before { content: "↷"; }

.topbar-history-button:hover:not(.is-muted) {
  border-color: var(--line-strong);
  color: var(--foreground);
  background: var(--muted);
}

.topbar-history-button.is-muted {
  cursor: not-allowed;
  opacity: .42;
}

.topbar-history-button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.editor-theme-toggle {
  display: inline-flex;
  min-width: 82px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--foreground);
  background: var(--background);
  font: 650 11px/1 var(--sans);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.editor-theme-toggle:hover {
  border-color: var(--line-strong);
  background: var(--muted);
}

.editor-theme-toggle:active { transform: translateY(1px); }

.editor-theme-toggle-mark {
  display: grid;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  place-items: center;
  font-size: 16px;
  line-height: 1;
}

.ghost-button,
.primary-button,
.secondary-button,
.toolbar-button,
.toolbar-icon,
.zoom-control,
.reset-button,
.add-look-button,
.text-button {
  border-radius: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.ghost-button {
  min-width: 44px;
  min-height: 32px;
  padding: 0 8px;
}

.ghost-button,
.reset-button,
.text-button {
  border: 0;
  color: var(--text-muted);
  background: transparent;
  font-size: 11px;
}

.ghost-button:hover,
.reset-button:hover,
.text-button:hover {
  color: var(--signal);
}

.primary-button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--signal);
  color: var(--signal-dark);
  background: var(--signal);
  font-size: 11px;
  font-weight: 750;
}

.primary-button:hover {
  background: #e2ff7b;
}

.primary-button[aria-disabled="true"] {
  border-color: var(--line-strong);
  color: var(--foreground);
  background: var(--surface-2);
  cursor: help;
}

.primary-button[aria-disabled="true"]:hover {
  border-color: var(--line-strong);
  color: var(--foreground);
  background: var(--surface-2);
}

.rail {
  grid-area: rail;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: #0d100e;
}

.rail-nav,
.rail-bottom {
  display: flex;
  flex-direction: column;
}

.rail-bottom {
  margin-top: auto;
}

.rail-site-nav {
  position: relative;
}

.rail-site-nav > summary {
  list-style: none;
}

.rail-site-nav > summary::-webkit-details-marker {
  display: none;
}

.rail-site-nav-toggle {
  width: 100%;
}

.rail-site-nav[open] > .rail-site-nav-toggle {
  color: var(--sidebar-foreground);
  background: var(--sidebar-accent);
  box-shadow: none;
}

.rail-site-menu {
  position: absolute;
  bottom: 0;
  left: calc(100% + 10px);
  z-index: 50;
  display: grid;
  width: min(280px, calc(100vw - 84px));
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--foreground);
  background: var(--background);
  box-shadow: 0 14px 32px rgb(0 0 0 / .16);
}

.rail-site-menu-nav {
  display: grid;
  gap: 2px;
}

.rail-site-menu-nav a {
  display: flex;
  min-height: 36px;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: inherit;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.rail-site-menu-nav a:hover,
.rail-site-menu-nav a:focus-visible {
  background: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.rail-site-disclaimer {
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 10px;
  line-height: 1.55;
}

.rail-button {
  display: flex;
  min-height: 66px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text-dim);
  background: transparent;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.rail-button:hover,
.rail-button.is-active {
  color: var(--text);
  background: var(--surface-2);
}

.rail-button.is-active {
  color: var(--signal);
  box-shadow: inset 3px 0 0 var(--signal);
}

.tool-key {
  font-family: var(--mono);
  font-size: 13px;
}

.rail-button small {
  font-size: 8px;
  letter-spacing: 0.04em;
}

.library-sidebar {
  grid-area: ribbon;
  display: grid;
  grid-template-columns: 190px minmax(330px, 1fr) 250px;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.collection-lockup {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  padding: 0 20px;
  border-right: 1px solid var(--line);
}

.collection-lockup span {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.collection-lockup strong {
  overflow: hidden;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 550;
  letter-spacing: 0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-lockup b {
  color: var(--signal);
  font-weight: 500;
}

.look-list {
  display: grid;
  grid-auto-columns: minmax(150px, 1fr);
  grid-auto-flow: column;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.look-list::-webkit-scrollbar {
  display: none;
}

.look-list-item {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 8px;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px 14px;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--text-muted);
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.look-list-item::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: transparent;
  content: "";
}

.look-list-item:hover,
.look-list-item.is-current {
  color: var(--text);
  background: #171b18;
}

.look-list-item.is-current::after {
  background: var(--signal);
}

.look-list-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

.look-list-copy strong {
  overflow: hidden;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 520;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.look-list-copy span {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 8px;
}

.ribbon-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-left: 1px solid var(--line);
}

.search-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field-label kbd {
  margin-left: 6px;
  padding: 2px 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  background: var(--ink);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 500;
}

.search-field input {
  width: 100%;
  min-width: 0;
  padding: 7px 0;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 11px;
}

.search-field input::placeholder {
  color: #747c74;
}

.search-field input:focus {
  border-color: var(--signal);
}

.add-look-button {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: transparent;
  font-size: 10px;
}

.add-look-button span {
  margin-right: 6px;
  color: var(--signal);
}

.add-look-button:hover {
  border-color: var(--signal);
}

.workspace {
  grid-area: workspace;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 332px;
  height: 100%;
  min-height: 0;
}

.canvas-column {
  min-width: 0;
  min-height: 0;
  padding: 24px 32px 22px;
  overflow: auto;
  background:
    linear-gradient(color-mix(in srgb, var(--primary) 2%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--primary) 2%, transparent) 1px, transparent 1px),
    #0e110f;
  background-size: 44px 44px;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.canvas-heading {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: end;
  gap: 24px;
  max-width: 920px;
  margin: 0 auto 20px;
}

.canvas-toolbar,
.toolbar-cluster {
  display: flex;
  align-items: center;
}

.canvas-toolbar {
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
}

.toolbar-cluster {
  gap: 4px;
}

.toolbar-button,
.toolbar-icon,
.zoom-control {
  min-height: 29px;
  padding: 0 9px;
  border: 1px solid var(--line);
  color: var(--text-muted);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 9px;
}

.toolbar-button:hover,
.toolbar-icon:hover:not(.is-muted),
.zoom-control:hover {
  border-color: var(--signal);
  color: var(--signal);
}

.toolbar-icon.is-muted {
  color: var(--muted-foreground);
  cursor: not-allowed;
}

.toolbar-divider {
  width: 13px;
  height: 1px;
  margin: 0 3px;
  background: var(--line-strong);
}

.zoom-control {
  width: 29px;
  padding: 0;
  font-size: 15px;
}

.zoom-readout {
  width: 43px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 9px;
  text-align: center;
}

.stage-wrap {
  max-width: 920px;
  margin: 0 auto;
}

.stage-composition {
  display: grid;
  grid-template-columns: 28px minmax(320px, 640px) 72px;
  justify-content: center;
  align-items: stretch;
  gap: 12px;
}

.canvas-board.is-drop-target::after {
  position: absolute;
  inset: 12px;
  z-index: 20;
  display: grid;
  place-items: center;
  border: 2px solid var(--signal);
  color: var(--signal);
  background: rgba(11, 13, 12, 0.84);
  content: "DROP SCREENSHOT";
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.inspector {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-padding-top: 100px;
  scrollbar-gutter: stable;
  border-left: 1px solid var(--line);
  background: var(--surface);
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.inspector-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 22px 20px 0;
  border-bottom: 1px solid var(--line);
  background: rgba(17, 20, 17, 0.96);
  backdrop-filter: blur(12px);
}

.inspector-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.inspector-title-row span {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
}

.inspector-title-row h1 {
  margin: 5px 0 0;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 560;
  letter-spacing: 0.01em;
}

.reset-button {
  padding-top: 3px;
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
}

.inspector-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 21px;
}

.inspector-tab {
  position: relative;
  min-height: 38px;
  padding: 0;
  border: 0;
  color: var(--text-dim);
  background: transparent;
  font-family: var(--mono);
  font-size: 9px;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}

.inspector-tab::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: transparent;
  content: "";
}

.inspector-tab.is-active {
  color: var(--text);
}

.inspector-tab.is-active::after {
  background: var(--signal);
}

.tab-count {
  color: var(--signal);
}

.inspector-panel {
  animation: panel-in 260ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.inspector-panel.is-hidden {
  display: none;
}

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

.inspector-section {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.cast-section {
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 6%, transparent), transparent 54%), var(--surface);
}

.cast-count-control {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-top: 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.cast-count-control button {
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--line-strong);
  color: var(--text-dim);
  background: transparent;
  font-family: var(--mono);
  font-size: 10px;
  cursor: pointer;
}

.cast-count-control button:last-child {
  border-right: 0;
}

.cast-count-control button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
}

.cast-count-control button.is-selected {
  color: var(--signal-dark);
  background: var(--signal);
}

.cast-selector {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin-top: 10px;
}

.cast-selector button {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line);
  padding: 0;
  background: var(--ink);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.cast-selector button.is-selected {
  border-color: var(--signal);
  box-shadow: inset 0 -3px 0 var(--signal);
}

.cast-selector img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  opacity: 0.72;
}

.cast-selector button.is-selected img {
  opacity: 1;
}

.cast-selector span {
  position: absolute;
  top: 3px;
  left: 3px;
  padding: 2px 3px;
  color: var(--ink);
  background: var(--signal);
  font-family: var(--mono);
  font-size: 6px;
  font-weight: 800;
}

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

.panel-section-head h2,
.items-summary h2 {
  margin: 0;
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
}

.panel-state,
.value-readout,
.items-summary span,
.section-count {
  color: var(--signal);
  font-family: var(--mono);
  font-size: 8px;
}

.portrait-source-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-top: 15px;
}

.source-thumb {
  width: 54px;
  height: 70px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--surface-3);
}

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

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

.source-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-copy span {
  overflow: hidden;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.secondary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 38px;
  margin-top: 14px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 10px;
}

.secondary-button:hover,
.secondary-button.is-highlighted {
  border-color: var(--signal);
}

.secondary-button.is-processing {
  color: var(--signal);
  background: color-mix(in srgb, var(--primary) 6%, transparent);
  cursor: progress;
}

.control-line,
.shadow-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 15px;
}

.control-label {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 8px;
}

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

.color-swatch {
  position: relative;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--swatch);
  cursor: pointer;
}

.color-swatch.is-selected::after {
  position: absolute;
  inset: -4px;
  border: 1px solid var(--signal);
  content: "";
}

.rail-save-status {
  position: relative;
  display: flex;
  min-height: 58px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 3px;
  border-top: 1px solid var(--line);
  color: var(--muted-foreground);
}

.rail-save-status-mark {
  display: inline-grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font: 700 9px/1 var(--sans);
}

.rail-save-status-mark::before { content: "✓"; }
.rail-save-status[data-state="saving"] .rail-save-status-mark::before { content: "…"; }
.rail-save-status[data-state="failed"] .rail-save-status-mark::before { content: "!"; }
.rail-save-status[data-failed="true"] { color: var(--destructive); }

.save-status {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: inherit;
  font: 500 9px/1.25 var(--sans);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.save-status[data-failed="true"] { color: var(--destructive); }
.save-retry-button {
  position: absolute;
  top: 4px;
  right: 3px;
  display: inline-grid;
  place-items: center;
  width: 24px;
  min-width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--text-muted);
  background: transparent;
  font: 700 16px/1 var(--sans);
  cursor: pointer;
}
.save-retry-button:hover { color: var(--foreground); border-color: var(--foreground); background: var(--surface-2); }
.save-retry-button:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.delete-workspace-dialog { width: min(440px, calc(100% - 32px)); padding: 28px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); color: var(--foreground); }
.delete-workspace-dialog::backdrop { background: rgb(0 0 0 / .4); }
.delete-workspace-dialog h2 { margin: 0 0 12px; font: 700 20px/1.4 var(--sans); }
.delete-workspace-dialog p { margin: 0; font: 400 14px/1.7 var(--sans); }
.delete-workspace-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.delete-workspace-actions button { min-height: 44px; padding: 10px 18px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--background); color: var(--foreground); font: 600 14px/1.5 var(--sans); }
#confirmWorkspaceDelete { background: var(--primary); color: var(--primary-foreground); }
@media (max-width: 1100px) {
  .topbar-actions { flex-wrap: wrap; }
}

.direction-pad {
  display: grid;
  grid-template-columns: repeat(3, 22px);
  grid-template-rows: repeat(3, 20px);
  gap: 2px;
}

.direction-pad button {
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--text-dim);
  background: transparent;
  font-size: 10px;
  cursor: pointer;
}

.direction-pad button:hover,
.direction-pad button.is-selected {
  border-color: var(--signal);
  color: var(--signal);
}

.direction-center {
  display: block;
  margin: 8px;
  background: var(--signal);
}

.backdrop-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 16px;
}

.backdrop-swatch {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--backdrop);
  cursor: pointer;
}

.backdrop-swatch.is-selected::after {
  position: absolute;
  inset: -4px;
  border: 1px solid var(--signal);
  content: "";
}

.layer-stack,
.equipment-list,
.catalog-results {
  display: flex;
  flex-direction: column;
  margin-top: 13px;
}

.layer-row,
.equipment-row,
.catalog-result {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  color: var(--text-muted);
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.layer-row:last-child,
.equipment-row:last-child,
.catalog-result:last-child {
  border-bottom: 0;
}

.layer-row:hover,
.layer-row.is-selected,
.equipment-row:hover,
.equipment-row.is-selected,
.catalog-result:hover {
  color: var(--text);
}

.layer-row.is-selected {
  box-shadow: inset 2px 0 0 var(--signal);
  padding-left: 8px;
}

.layer-drag,
.layer-eye {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 7px;
}

.layer-eye {
  margin-left: auto;
}

.layer-mini,
.equipment-icon,
.catalog-result-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  color: var(--signal);
  background: var(--surface-3);
  font-family: var(--mono);
}

.catalog-result-icon img,
.equipment-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.layer-mini--portrait {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #dcd6ce, #8b92a7);
}

.layer-mini--portrait i {
  position: absolute;
  right: 7px;
  bottom: -4px;
  left: 7px;
  height: 22px;
  background: #202431;
  clip-path: polygon(35% 0, 65% 0, 100% 100%, 0 100%);
}

.layer-mini--texture {
  background-image: radial-gradient(rgba(255,255,255,.25) .6px, transparent .6px);
  background-size: 4px 4px;
}

.layer-mini--backdrop {
  background: linear-gradient(135deg, #eee5d7, #a8a8bc);
}

.layer-name {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.items-intro-section p {
  margin: 10px 0 14px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.5;
}

.section-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 10px;
}

.equipment-icon,
.catalog-result-icon {
  font-size: 12px;
}

.equipment-copy,
.catalog-result-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.equipment-copy strong,
.catalog-result-copy strong {
  overflow: hidden;
  font-size: 10px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.equipment-copy span,
.catalog-result-copy span {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 7px;
}

.equipment-check {
  color: var(--signal);
  font-family: var(--mono);
  font-size: 8px;
}

.catalog-search {
  margin-bottom: 10px;
}

.empty-results {
  display: grid;
  gap: 4px;
  padding: 14px 0;
  color: var(--text-dim);
  font-size: 10px;
}

.empty-results strong {
  color: var(--muted-foreground);
  font-size: 10px;
  font-weight: 600;
}

.empty-results span {
  color: var(--text-dim);
  font-size: 9px;
}

.catalog-results-notice {
  padding: 8px 0 6px;
  color: var(--text-dim);
  font-size: 9px;
  line-height: 1.45;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  max-width: 330px;
  padding: 12px 14px;
  border: 1px solid var(--signal);
  border-radius: 0;
  color: var(--text);
  background: var(--surface-2);
  box-shadow: 8px 8px 0 color-mix(in srgb, var(--primary) 14%, transparent);
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: no-preference) {
  .library-sidebar {
    animation: reveal-down 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .canvas-heading,
  .stage-wrap {
    animation: reveal-up 480ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .stage-wrap { animation-delay: 70ms; }

  @keyframes reveal-down {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
  }

  @keyframes reveal-up {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1180px) {
  .library-sidebar {
    grid-template-columns: 160px minmax(260px, 1fr) 185px;
  }

  .workspace-grid {
    grid-template-columns: minmax(0, 1fr) 300px;
  }

  .canvas-column {
    padding-right: 22px;
    padding-left: 22px;
  }

  .ribbon-actions {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .ribbon-actions .add-look-button {
    height: 28px;
  }
}

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

  html {
    scroll-padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .app-shell {
    display: grid;
    grid-template-areas:
      "top"
      "ribbon"
      "workspace";
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 58px 92px auto;
    height: auto;
    min-height: 100dvh;
    padding-bottom: 62px;
  }

  .topbar {
    position: static;
    top: auto;
    z-index: auto;
    grid-template-columns: 1fr auto;
  }

  .wordmark {
    border-right: 0;
  }

  .ghost-button {
    display: none;
  }

  .topbar-actions {
    border-left: 0;
  }

  .primary-button {
    min-height: 32px;
  }

  .rail {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 35;
    display: grid;
    grid-template-columns: 1fr auto;
    min-height: 58px;
    border-top: 1px solid var(--line);
    border-right: 0;
    background: rgba(13, 16, 14, 0.97);
    backdrop-filter: blur(12px);
  }

  .rail-nav,
  .rail-bottom {
    flex-direction: row;
  }

  .rail-bottom {
    margin-top: 0;
  }

  .rail-button {
    width: 64px;
    min-height: 58px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .rail-button.is-active {
    box-shadow: inset 0 3px 0 var(--signal);
  }

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

  .collection-lockup {
    display: none;
  }

  .look-list {
    grid-auto-columns: 155px;
  }

  .look-list-item {
    grid-template-columns: 35px minmax(0, 1fr) 6px;
    padding: 8px 10px;
  }

  .ribbon-actions {
    display: block;
    padding: 0 10px;
  }

  .sidebar-search {
    display: none;
  }

  .ribbon-actions .add-look-button {
    height: 100%;
    border-top: 0;
    border-bottom: 0;
  }

  .workspace {
    overflow: visible;
  }

  .workspace-grid {
    display: block;
    height: auto;
  }

  .canvas-column {
    min-height: 0;
    padding: 22px 16px 18px;
    overflow: visible;
  }

  .canvas-heading {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .canvas-toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .stage-composition {
    grid-template-columns: minmax(0, 1fr);
  }

  .canvas-board {
    max-width: 620px;
    margin: 0 auto;
  }

  .inspector {
    max-height: none;
    overflow: visible;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .inspector-header {
    position: relative;
    top: auto;
  }

  .inspector-section {
    padding-right: 16px;
    padding-left: 16px;
  }
}

.card-compose-section { display: grid; gap: 12px; }
.card-compose-section.is-disabled { opacity: .45; pointer-events: none; }
.compact-option-row { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 8px; }
.compact-option-row[hidden],
.inspector-section[hidden] { display: none !important; }
.compact-option-row > span { color: var(--muted-foreground); font-size: 10px; font-weight: 600; }
.compact-segments { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 2px; border-radius: 999px; background: var(--muted); }
.compact-segments button { min-height: 27px; padding: 4px 7px; border: 0; border-radius: 999px; color: var(--muted-foreground); background: transparent; font-family: var(--sans); font-size: 9px; font-weight: 650; cursor: pointer; }
.compact-segments button.is-selected { color: var(--foreground); background: var(--background); box-shadow: 0 1px 3px rgb(0 0 0 / .1); }
.compact-segments button:disabled { cursor: not-allowed; opacity: .42; }
.compact-option-row select { width: 100%; min-height: 31px; padding: 0 28px 0 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--foreground); background: var(--background); font-family: var(--sans); font-size: 10px; }
.compact-switch { display: inline-flex; align-items: center; gap: 6px; color: var(--muted-foreground); cursor: pointer; }
.compact-switch input { position: absolute; opacity: 0; pointer-events: none; }
.compact-switch span { position: relative; width: 28px; height: 16px; border-radius: 999px; background: var(--border); transition: background 160ms ease; }
.compact-switch span::after { position: absolute; top: 3px; left: 3px; width: 10px; height: 10px; border-radius: 50%; background: white; box-shadow: 0 1px 2px rgb(0 0 0 / .2); content: ""; transition: transform 160ms ease; }
.compact-switch input:checked + span { background: var(--primary); }
.compact-switch input:checked + span::after { transform: translateX(12px); }
.compact-switch b { font-size: 9px; font-weight: 650; }

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

@media (max-width: 560px) {
  .wordmark-copy small {
    display: none;
  }

  .topbar-actions {
    padding-right: 10px;
  }

  .primary-button {
    padding: 0 10px;
    font-size: 9px;
  }

  .canvas-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-cluster--right {
    width: 100%;
  }

  .rail-button {
    width: 56px;
  }
}

@media (max-width: 920px) {
  .canvas-heading { grid-template-columns: 1fr; }
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1000;
  padding: 12px 16px;
  color: var(--primary-foreground);
  background: var(--primary);
  border-radius: var(--radius-sm);
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.app-shell {
  grid-template-areas:
    "top top top"
    "rail ribbon workspace";
  grid-template-columns: 56px 220px minmax(0, 1fr);
  grid-template-rows: minmax(64px, max-content) minmax(0, 1fr);
  background: var(--background);
}

.topbar {
  grid-template-columns: 302px minmax(280px, 1fr) auto;
  border-bottom-color: var(--border);
  background: var(--background);
  box-shadow: 0 1px 0 color-mix(in oklch, var(--primary) 3%, transparent);
}

.topbar::before { display: none; }

.wordmark {
  gap: 8px;
  padding: 0 16px;
  min-height: 44px;
  border-right-color: var(--border);
  color: var(--foreground);
}

.wordmark-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  letter-spacing: -0.02em;
}

.wordmark-copy strong { font-size: 14px; font-weight: 750; letter-spacing: -.035em; }
.wordmark-copy small { color: var(--muted-foreground); font-size: 10px; letter-spacing: .035em; }

.topbar-actions { gap: 10px; padding: 0 16px; border-left-color: var(--border); }
.ghost-button,
.primary-button,
.secondary-button,
.toolbar-button,
.toolbar-icon,
.zoom-control,
.reset-button,
.add-look-button,
.text-button { border-radius: var(--radius-sm); }

.ghost-button,
.reset-button,
.text-button { color: var(--muted-foreground); }
.ghost-button:hover,
.reset-button:hover,
.text-button:hover { color: var(--foreground); }

.primary-button {
  min-height: 36px;
  padding: 0 14px;
  border-color: var(--primary);
  color: var(--primary-foreground);
  background: var(--primary);
  font-size: 12px;
  font-weight: 650;
  box-shadow: 0 1px 2px rgb(0 0 0 / .08);
}
.primary-button:hover { background: color-mix(in oklch, var(--primary) 88%, var(--background)); }

.rail {
  border-right-color: var(--sidebar-border);
  background: var(--sidebar);
  gap: 8px;
  padding: 10px 6px;
}
.rail-nav,
.rail-bottom { gap: 4px; }
.rail-button {
  min-height: 56px;
  border-bottom-color: transparent;
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
}
.rail-button:hover,
.rail-button.is-active { color: var(--sidebar-foreground); background: var(--sidebar-accent); }
.rail-button.is-active { box-shadow: inset 3px 0 0 var(--primary); }
.tool-key { font-family: var(--sans); font-size: 13px; font-weight: 700; }
.rail-button small { font-size: 9px; }
.rail-mode-button .tool-key {
  color: var(--muted-foreground);
  font-size: 10px;
  letter-spacing: .06em;
}
.rail-mode-button.is-active .tool-key { color: var(--primary); }
.rail-collapse-button {
  min-height: 48px;
  color: var(--muted-foreground);
}
.rail-collapse-button .tool-key { font-size: 20px; font-weight: 400; line-height: .7; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.library-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border-right: 1px solid var(--sidebar-border);
  border-bottom: 0;
  background: var(--sidebar);
  transition: opacity 180ms ease, visibility 180ms ease;
}
.collection-lockup {
  min-height: 72px;
  padding: 16px 18px;
  border-right: 0;
  border-bottom: 1px solid var(--sidebar-border);
}
.collection-lockup span { color: var(--muted-foreground); font-family: var(--sans); font-size: 10px; text-transform: none; }
.collection-lockup strong { font-size: 13px; font-weight: 750; letter-spacing: .055em; }
.collection-lockup b { color: var(--foreground); font-weight: 700; }

.look-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  overflow-x: hidden;
  overflow-y: auto;
}
.look-list-item {
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 9px;
  min-height: 62px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted-foreground);
}
.look-list-item::after { display: none; }
.look-list-item:hover { color: var(--foreground); background: var(--sidebar-accent); }
.look-list-item.is-current {
  color: var(--foreground);
  border-color: var(--border);
  background: var(--background);
  box-shadow: 0 1px 2px rgb(0 0 0 / .04);
}
.look-list-index {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted-foreground);
  background: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .02em;
}
.look-list-copy { gap: 3px; }
.look-list-copy strong { font-size: 12px; font-weight: 650; }
.look-list-copy span { color: var(--muted-foreground); font-family: var(--sans); font-size: 9px; }
.look-list-item.is-current .look-list-index {
  color: var(--primary-foreground);
  border-color: var(--primary);
  background: var(--primary);
}

.ribbon-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--sidebar-border);
  border-left: 0;
}
.manage-look-button,
.look-manager-dialog button {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--background);
  color: var(--foreground);
  font: 600 13px/1.5 var(--sans);
  white-space: nowrap;
  cursor: pointer;
}
.manage-look-button:hover,
.look-manager-dialog button:not(:disabled):hover { background: var(--muted); border-color: var(--primary); }
.manage-look-button:focus-visible,
.look-manager-dialog :is(button, input):focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.look-manager-dialog {
  width: min(460px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--foreground);
  background: var(--card);
  font-family: var(--sans);
}
.look-manager-dialog::backdrop { background: rgb(0 0 0 / .4); }
.look-manager-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.look-manager-dialog h2 { margin: 0; font-size: 20px; line-height: 1.4; }
.look-manager-dialog header button { min-width: 40px; font-size: 20px; padding: 4px; }
.look-manager-dialog :is(label, strong) { font-size: 14px; font-weight: 650; line-height: 1.5; }
.look-manager-dialog p { margin: 4px 0 0; font-size: 12px; line-height: 1.6; color: var(--muted-foreground); word-break: keep-all; overflow-wrap: anywhere; }
.look-rename-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.look-rename-row input { width: 0; min-width: 120px; flex: 1; min-height: 44px; padding: 8px 12px; border: 1px solid var(--input); border-radius: var(--radius-sm); color: var(--foreground); background: var(--background); font: 400 16px/1.5 var(--sans); }
.look-rename-row button { color: var(--primary-foreground); background: var(--primary); }
.look-rename-row button:not(:disabled):hover { background: var(--primary); border-color: var(--primary); }
.look-manager-action { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding-block: 20px; border-bottom: 1px solid var(--border); }
.look-manager-action button { min-width: 56px; }
#deleteLookButton { color: var(--destructive); border-color: var(--destructive); }
.look-manager-dialog footer { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-top: 20px; }
.look-manager-dialog footer span { flex: 1 1 180px; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.look-manager-dialog button:disabled { opacity: .5; cursor: default; }
.search-field { gap: 6px; }
.field-label { color: var(--muted-foreground); font-family: var(--sans); font-size: 10px; text-transform: none; }
.field-label kbd { border-color: var(--border); color: var(--muted-foreground); background: var(--background); }
.search-field input {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  color: var(--foreground);
  background: var(--background);
  font-size: 12px;
}
.search-field input::placeholder { color: var(--muted-foreground); opacity: 1; }
.search-field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 14%, transparent); }
.add-look-button {
  height: 36px;
  border-color: var(--border);
  color: var(--foreground);
  background: var(--background);
  font-size: 12px;
  font-weight: 600;
}
.add-look-button span { color: inherit; }
.add-look-button:hover { border-color: var(--line-strong); background: var(--muted); }

.workspace { background: var(--muted); }
.workspace-grid { grid-template-columns: minmax(520px, 1fr) 350px; }
.canvas-column {
  padding: clamp(20px, 2.4vw, 32px) clamp(18px, 3vw, 44px) 30px;
  background: color-mix(in oklch, var(--muted) 82%, var(--background));
  scrollbar-color: var(--line-strong) transparent;
}
.canvas-heading {
  grid-template-columns: minmax(0, 1fr) auto;
  max-width: 860px;
  margin-bottom: 18px;
}
.toolbar-button,
.toolbar-icon,
.zoom-control {
  min-height: 34px;
  border-color: var(--border);
  color: var(--foreground);
  background: var(--background);
}
.toolbar-button:hover,
.toolbar-icon:hover,
.zoom-control:hover { border-color: var(--line-strong); background: var(--muted); }
.zoom-readout { color: var(--muted-foreground); }
.toolbar-divider { background: var(--border); }

.stage-wrap { position: relative; max-width: 860px; margin: 0 auto; }
.canvas-board.is-drop-target::after {
  border-color: var(--primary-foreground);
  color: var(--primary-foreground);
  background: color-mix(in oklch, var(--primary) 84%, transparent);
  content: "스크린샷을 여기에 놓으세요";
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
}
.inspector {
  border-left-color: var(--border);
  background: var(--background);
}
.inspector-header {
  padding: 20px 20px 16px;
  border-bottom-color: var(--border);
  background: var(--background);
  backdrop-filter: none;
}
.inspector-title-row span { color: var(--muted-foreground); font-family: var(--sans); font-size: 10px; text-transform: none; }
.inspector-title-row h1 { margin: 0; font-size: 20px; font-weight: 750; letter-spacing: -.04em; }
.reset-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--foreground);
  background: var(--background);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 650;
  text-transform: none;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.reset-button:hover {
  border-color: var(--primary);
  background: color-mix(in oklch, var(--primary) 7%, var(--background));
  box-shadow: 0 2px 8px color-mix(in oklch, var(--primary) 12%, transparent);
  transform: translateY(-1px);
}
.reset-button:focus-visible {
  border-color: var(--primary);
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--primary) 14%, transparent);
}
.reset-button:active { transform: translateY(1px); }

@media (prefers-reduced-motion: reduce) {
  .reset-button { transition: none; }
}
.inspector-tabs {
  gap: 4px;
  margin-top: 17px;
  padding: 4px;
  border-radius: 999px;
  background: var(--muted);
}
.inspector-tab {
  min-height: 32px;
  border-radius: 999px;
  color: var(--muted-foreground);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  text-transform: none;
}
.inspector-tab::after { display: none; }
.inspector-tab.is-active { color: var(--foreground); background: var(--background); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
.tab-count { color: inherit; }
.inspector-section { padding: 18px 20px; border-bottom-color: var(--border); }
.cast-section { background: var(--background); }
.panel-section-head h2,
.items-summary h2 { font-size: 12px; font-weight: 700; }
.panel-state,
.value-readout { color: var(--muted-foreground); }

.cast-count-control { gap: 4px; padding: 4px; border: 0; border-radius: 999px; background: var(--muted); }
.cast-count-control button {
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  color: var(--muted-foreground);
  font-family: var(--sans);
  font-size: 11px;
}
.cast-count-control button:hover { color: var(--foreground); background: var(--muted); }
.cast-count-control button.is-selected { color: var(--foreground); background: var(--background); box-shadow: 0 1px 2px rgb(0 0 0 / .1); }
.cast-selector { gap: 6px; }
.cast-selector button { border-color: var(--border); background: var(--muted); }
.cast-selector button.is-selected { border-color: var(--foreground); box-shadow: 0 0 0 1px var(--foreground); }
.cast-selector span { color: var(--primary-foreground); background: var(--primary); }
.portrait-source-card,
.layer-row,
.equipment-row,
.catalog-result { border-color: var(--border); border-radius: var(--radius-sm); background: var(--background); }
.secondary-button { min-height: 38px; border-color: var(--border); color: var(--foreground); background: var(--secondary); }
.secondary-button:hover { background: var(--muted); }
.secondary-button.is-processing { color: var(--foreground); background: var(--muted); }
.source-copy strong { color: var(--foreground); font-size: 12px; font-weight: 650; }
.source-copy span { color: var(--muted-foreground); font-family: var(--sans); font-size: 9px; }
.control-label { color: var(--muted-foreground); }
.color-swatch,
.backdrop-swatch { border-color: var(--border); border-radius: var(--radius-sm); }
.color-swatch.is-selected,
.backdrop-swatch.is-selected { border-color: var(--foreground); box-shadow: 0 0 0 1px var(--foreground); }
.direction-pad button { border-color: var(--border); color: var(--muted-foreground); background: var(--background); }
.direction-pad button:hover,
.direction-pad button.is-selected { color: var(--foreground); background: var(--muted); }
.layer-row.is-selected { border-color: var(--foreground); background: var(--muted); }
.toast { border-color: var(--border); border-radius: var(--radius); color: var(--foreground); background: var(--background); box-shadow: 0 12px 35px rgb(0 0 0 / .14); }

@media (max-width: 1180px) and (min-width: 921px) {
  .app-shell { grid-template-columns: 60px 210px minmax(0, 1fr); }
  .topbar { grid-template-columns: 270px minmax(240px, 1fr) auto; }
  .workspace-grid { grid-template-columns: minmax(450px, 1fr) 320px; }
  .canvas-column { padding-right: 20px; padding-left: 20px; }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-areas: "top" "ribbon" "workspace";
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 58px 88px auto;
  }
  .canvas-heading { grid-template-columns: 1fr; }
  .topbar { grid-template-columns: 1fr auto; }
  .library-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .look-list { flex-direction: row; gap: 6px; padding: 8px; overflow-x: auto; overflow-y: hidden; }
  .look-list-item {
    min-width: 160px;
    grid-template-columns: 28px minmax(0, 1fr);
  }
  .ribbon-actions { display: block; padding: 8px; border-top: 0; border-left: 1px solid var(--border); }
  .ribbon-actions .add-look-button { height: 100%; border: 1px solid var(--border); }
  .rail { background: color-mix(in oklch, var(--background) 94%, transparent); }
  .rail-button.is-active { box-shadow: inset 0 3px 0 var(--primary); }
  .canvas-column { padding: 20px 18px 24px; }
  .inspector { border-top-color: var(--border); }
}

@media (max-width: 560px) {
  .wordmark-copy strong { font-size: 13px; }
  .wordmark-copy { white-space: nowrap; }
  .primary-button { min-height: 34px; font-size: 11px; }
}

/* --------------------------------------------------------------------------
   Task-first editor chrome
   Keep actions and the card output; hide persistent scaffolding and status
   copy that does not help a user make a decision.
   -------------------------------------------------------------------------- */

.topbar {
  grid-template-columns: 1fr auto;
}

.stage-composition {
  display: block;
}

.canvas-board {
  max-width: 760px;
  margin: 0 auto;
}

.canvas-heading {
  margin-bottom: 14px;
}

.inspector-section:not(.cast-section) .panel-state {
  display: none;
}

html,
body {
  background: var(--background);
}

body {
  color: var(--foreground);
  font-size: 14px;
  letter-spacing: -0.015em;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[contenteditable="true"]:focus-visible,
a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Use existing Neutral tokens for readable text on muted UI surfaces. */
.topbar,
.rail,
.library-sidebar,
.inspector {
  --muted-foreground: var(--chart-3);
}

.dark :is(.topbar, .rail, .library-sidebar, .inspector) {
  --muted-foreground: var(--chart-1);
}

.search-field input { border-color: var(--muted-foreground); }

@media (min-width: 921px) {
  .app-shell {
    grid-template-columns: 56px 220px minmax(0, 1fr);
  }

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

  body.library-collapsed .library-sidebar {
    visibility: hidden;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    border-right: 0;
  }

.workspace-grid {
  grid-template-columns: minmax(0, 1fr) clamp(360px, 25vw, 420px);
}

  .canvas-column {
    padding: 24px 18px 26px;
  }

.canvas-heading,
.stage-wrap {
    max-width: 960px;
  }

  .canvas-heading {
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  .canvas-board {
    max-width: 900px;
  }

  .canvas-focus-button {
    width: 29px;
    padding: 0;
    font-size: 16px;
  }

  body.canvas-focus-mode .app-shell {
    grid-template-areas: "top" "workspace";
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(64px, max-content) minmax(0, 1fr);
  }

  body.canvas-focus-mode .rail,
  body.canvas-focus-mode .library-sidebar,
  body.canvas-focus-mode .inspector {
    display: none;
  }

  body.canvas-focus-mode .workspace-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  body.canvas-focus-mode .canvas-column {
    padding: 28px clamp(24px, 6vw, 120px) 34px;
  }

  body.canvas-focus-mode .canvas-heading,
  body.canvas-focus-mode .stage-wrap {
    max-width: 1200px;
  }

  body.canvas-focus-mode .canvas-board {
    max-width: 1200px;
  }

  body.canvas-focus-mode .canvas-focus-button {
    color: var(--primary-foreground);
    background: var(--primary);
  }
}

@media (max-width: 920px) {
  .rail {
    gap: 0;
    padding: 0;
  }

  .rail-nav,
  .rail-bottom { gap: 0; }

  .rail-mode-button,
  .rail-collapse-button {
    width: 72px;
    min-height: 58px;
    border-radius: 0;
  }

  .rail-collapse-button { width: 92px; }

  body.library-collapsed .app-shell {
    grid-template-areas:
      "top"
      "workspace";
    grid-template-rows: 58px auto;
  }

  body.library-collapsed .library-sidebar { display: none; }

  .canvas-focus-button {
    display: none;
  }
}

@media (max-width: 560px) {
  .app-shell { grid-template-rows: auto 92px auto; }
  body.library-collapsed .app-shell { grid-template-rows: auto auto; }
  .topbar {
    position: static;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 12px 16px;
  }
  .wordmark { padding: 0; }
  .topbar-actions {
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 0;
  }
}

/* Direct image placement mode keeps the card in context and removes every
   panel that competes with the edit surface. The bottom mode bar is the only
   control surface left on screen. */
body.image-placement-mode {
  overflow: hidden;
}

body.image-placement-mode .app-shell {
  grid-template-areas:
    "top"
    "workspace";
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(64px, max-content) minmax(0, 1fr);
}

body.image-placement-mode .rail,
body.image-placement-mode .library-sidebar,
body.image-placement-mode .inspector {
  display: none;
}

body.image-placement-mode .rail {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: auto;
  z-index: 40;
  display: flex;
  width: auto;
  min-height: 0;
  gap: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--ink);
  box-shadow: 0 8px 24px rgb(0 0 0 / .2);
}

body.image-placement-mode .rail-nav,
body.image-placement-mode .rail-site-nav,
body.image-placement-mode .rail-collapse-button {
  display: none;
}

body.image-placement-mode .rail-bottom {
  display: flex;
  margin: 0;
}

body.image-placement-mode .rail-save-status {
  min-height: 48px;
  padding: 0 34px 0 12px;
  border: 0;
  flex-direction: row;
}

/* Placement is a focused transaction. Keep the persistence status visible,
   but remove unrelated global actions until the user applies or cancels. */
body.image-placement-mode .topbar-actions {
  gap: 0;
}

body.image-placement-mode .topbar-actions .language-select-control,
body.image-placement-mode .topbar-actions #exportButton {
  display: none;
}

body.image-placement-mode .workspace-grid {
  grid-template-columns: minmax(0, 1fr);
}

body.image-placement-mode .canvas-column {
  padding: 24px clamp(16px, 6vw, 96px) 190px;
}

body.image-placement-mode .canvas-heading,
body.image-placement-mode .stage-wrap {
  max-width: 1120px;
}

body.image-placement-mode .canvas-heading {
  margin-bottom: 24px;
}

body.image-placement-mode .stage-composition {
  grid-template-columns: minmax(320px, 840px);
}

body.image-placement-mode .canvas-board[data-ratio="portrait"] {
  width: min(100%, 840px);
  max-width: 840px;
  margin-inline: auto;
}

@media (max-width: 720px) {
  body.image-placement-mode .canvas-column {
    padding: 16px 16px 240px;
  }

  body.image-placement-mode .canvas-heading {
    margin-bottom: 18px;
  }

  body.image-placement-mode .stage-composition {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Header actions ----------------------------------------------------------
   Language is a document setting, so keep it explicit and quiet. Export is
   the only high-emphasis action in the header. */
.language-select-control {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.language-select-label {
  color: var(--muted-foreground);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .02em;
}

.language-select-wrap {
  position: relative;
  display: block;
}

.language-select-wrap::after {
  position: absolute;
  top: 50%;
  right: 10px;
  color: var(--muted-foreground);
  content: "⌄";
  font-size: 13px;
  line-height: 1;
  pointer-events: none;
  transform: translateY(-55%);
}

#languageSelect {
  min-width: 108px;
  min-height: 36px;
  padding: 0 30px 0 11px;
  border: 1px solid var(--muted-foreground);
  border-radius: var(--radius-sm);
  color: var(--foreground);
  background: var(--background);
  font: 650 11px/1 var(--sans);
  appearance: none;
  cursor: pointer;
}

#languageSelect:hover {
  border-color: var(--line-strong);
  background: var(--muted);
}

#languageSelect:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .topbar-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
  }

  .language-select-label {
    display: none;
  }

  #languageSelect {
    min-width: 104px;
  }
}

/* Canvas toolbar ----------------------------------------------------------
   Navigation and history are one compact command row. Clear action words
   prevent the undo control from being mistaken for a modal cancel action. */
.canvas-toolbar {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.toolbar-cluster {
  gap: 6px;
}

.toolbar-cluster--right {
  padding-left: 10px;
  border-left: 1px solid var(--border);
}

.toolbar-divider {
  display: none;
}

.toolbar-button,
.toolbar-icon {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  background: var(--background);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.toolbar-button:hover,
.toolbar-icon:hover:not(.is-muted) {
  border-color: var(--line-strong);
  color: var(--foreground);
  background: var(--muted);
}

.toolbar-icon.is-muted {
  opacity: .52;
}

.canvas-focus-button {
  width: 32px;
  min-width: 32px;
  padding: 0;
  font-size: 15px;
}

@media (max-width: 640px) {
  .canvas-heading {
    width: 100%;
  }

  .canvas-toolbar {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }

  .toolbar-cluster {
    gap: 4px;
  }

  .toolbar-cluster--right {
    padding-left: 6px;
  }

  .toolbar-button,
  .toolbar-icon {
    padding-inline: 8px;
    font-size: 9px;
  }

  .canvas-focus-button {
    width: 30px;
    min-width: 30px;
  }
}

/* Inspector context ------------------------------------------------------
   Keep the current target visible while the user moves through controls. A
   quiet summary is more useful than repeating the selected state in every
   downstream panel. */
.panel-section-head-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.panel-eyebrow {
  color: var(--muted-foreground);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.panel-selection-summary {
  min-width: 86px;
  max-width: 48%;
  overflow: hidden;
  color: var(--muted-foreground);
  font: 650 10px/1.25 var(--sans);
  font-variant-numeric: tabular-nums;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cast-section .panel-selection-summary {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--foreground);
  background: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.cast-section .cast-count-control {
  margin-top: 14px;
}

.reset-control {
  position: relative;
  display: inline-flex;
  justify-content: flex-end;
}

.reset-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  width: min(260px, calc(100vw - 32px));
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--background);
  box-shadow: 0 12px 28px rgb(0 0 0 / .14);
}

.reset-menu[hidden] { display: none; }

.reset-menu p {
  margin: 0 2px 3px;
  color: var(--muted-foreground);
  font-size: 10px;
  line-height: 1.45;
}

.reset-menu [role="menuitem"] {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--foreground);
  background: var(--background);
  font: 650 11px/1.2 var(--sans);
  text-align: start;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease, transform 140ms ease;
}

.reset-menu [role="menuitem"]:hover,
.reset-menu [role="menuitem"]:focus-visible {
  border-color: var(--primary);
  background: color-mix(in oklch, var(--primary) 7%, var(--background));
}

.reset-menu [role="menuitem"]:active { transform: translateY(1px); }

.compact-control-hint {
  margin: -3px 0 0 56px;
  color: var(--muted-foreground);
  font-size: 10px;
  line-height: 1.45;
}

.compact-control-hint[data-ready="true"] { color: var(--foreground); }

@media (prefers-reduced-motion: reduce) {
  .reset-menu [role="menuitem"] { transition: none; }
}

@media (max-width: 560px) {
  .panel-selection-summary {
    min-width: 78px;
    max-width: 44%;
    font-size: 9px;
  }

  .reset-menu {
    right: -4px;
    width: min(248px, calc(100vw - 24px));
  }
}

/* Mobile look search -------------------------------------------------------
   Keep the saved-look ribbon compact while preserving a visible, focusable
   search surface for touch users and the Ctrl/⌘ K shortcut. */
.look-search-control {
  display: contents;
}

.mobile-search-toggle {
  display: none;
}

@media (max-width: 920px) {
  body.mobile-look-search-open .app-shell {
    grid-template-rows: minmax(58px, max-content) 196px auto;
  }

  .library-sidebar {
    position: relative;
    grid-template-rows: 88px;
  }

  body.mobile-look-search-open .library-sidebar {
    grid-template-rows: 88px 108px;
  }

  .ribbon-actions {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: flex-end;
    gap: 6px;
  }

  .mobile-search-toggle {
    display: inline-flex;
    min-width: 56px;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--foreground);
    background: var(--background);
    font-size: 11px;
    font-weight: 650;
    cursor: pointer;
    transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
  }

  .mobile-search-toggle:hover,
  .mobile-search-toggle[aria-expanded="true"] {
    border-color: var(--primary);
    background: color-mix(in oklch, var(--primary) 7%, var(--background));
  }

  .mobile-search-toggle:focus-visible {
    border-color: var(--primary);
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px color-mix(in oklch, var(--primary) 14%, transparent);
  }

  .mobile-search-toggle:active {
    transform: translateY(1px);
  }

  .sidebar-search.is-mobile-open {
    position: absolute;
    z-index: 45;
    top: 96px;
    right: 12px;
    left: 12px;
    display: flex;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
    box-shadow: 0 12px 28px rgb(0 0 0 / .14);
  }

  .look-list {
    grid-column: 1;
    grid-row: 1;
  }

  .ribbon-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .sidebar-search.is-mobile-open input {
    min-height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-search-toggle {
    transition: none;
  }
}

/* Mobile command surface --------------------------------------------------
   The inspector is a long document on touch screens. Keep its context and
   reset action in a compact sticky header, then use one 40px control rhythm
   for actions users need to tap repeatedly. The bottom mode rail remains a
   separate navigation surface with the same radius token. */
@media (max-width: 920px) {
  .inspector-header {
    position: sticky;
    top: 0;
    z-index: 24;
    padding: 12px 16px 12px;
    border-bottom-color: var(--border);
    background: color-mix(in oklch, var(--background) 92%, transparent);
    box-shadow: 0 1px 0 color-mix(in oklch, var(--border) 80%, transparent), 0 8px 18px rgb(0 0 0 / .06);
  }

  .inspector-panel {
    position: relative;
    z-index: 10;
  }

  .inspector-title-row {
    align-items: center;
  }

  .inspector-title-row span {
    font-size: 11px;
    line-height: 1.25;
  }

  .inspector-title-row h1 {
    margin-top: 2px;
    font-size: 18px;
    line-height: 1.2;
  }

  .reset-button {
    min-height: 40px;
    padding-inline: 12px;
    border-radius: var(--radius-sm);
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 700;
    text-transform: none;
  }

  .reset-menu {
    z-index: 30;
  }

  .inspector .inspector-section {
    scroll-margin-top: 76px;
  }

  .rail {
    min-height: calc(60px + env(safe-area-inset-bottom, 0px));
    align-items: stretch;
    gap: 6px;
    padding: 6px max(8px, env(safe-area-inset-left, 0px)) calc(6px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in oklch, var(--background) 96%, transparent);
    box-shadow: 0 -8px 24px rgb(0 0 0 / .08);
  }

  .rail-nav,
  .rail-bottom {
    align-items: stretch;
    gap: 6px;
  }

  .rail-nav { min-width: 0; }

  .rail-site-nav {
    position: static;
  }

  .rail-site-nav,
  .rail-site-nav-toggle {
    width: auto;
    min-height: 48px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
  }

  .rail-site-nav[open] > .rail-site-nav-toggle {
    border-color: var(--border);
    box-shadow: none !important;
  }

  .rail-site-menu {
    position: fixed;
    right: 12px;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    width: auto;
    max-height: min(360px, calc(100dvh - 96px));
    overflow: auto;
  }

  .rail-save-status {
    flex: 0 0 72px;
    min-height: 48px;
    flex-direction: row;
    gap: 5px;
    padding: 0 8px;
    border-top: 0;
    border-left: 1px solid var(--border);
  }

  .rail-save-status .save-status { max-width: 42px; }
  .rail-save-status .save-retry-button { top: 2px; right: 2px; }

  .rail-mode-button,
  .rail-collapse-button {
    width: auto;
    min-height: 48px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
  }

  .rail-mode-button {
    flex: 1 1 0;
  }

  .rail-collapse-button {
    width: 104px;
  }

  .rail-button:hover,
  .rail-button.is-active {
    background: var(--muted);
  }

  .rail-button.is-active {
    border-color: var(--border);
    box-shadow: none;
  }

  .rail-button:focus-visible {
    outline-offset: -2px;
  }

  .app-shell {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .inspector {
    --mobile-inspector-header-height: 69px;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 640px) {
  .toolbar-button,
  .toolbar-icon {
    min-height: 40px;
    padding-inline: 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
  }

  .canvas-focus-button {
    width: 40px;
    min-width: 40px;
  }
}

@media (max-width: 560px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: minmax(48px, auto);
    gap: 8px;
    padding: 8px 12px;
  }

  .wordmark {
    min-width: 0;
  }

  .topbar-actions {
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0;
  }

  .primary-button,
  #languageSelect {
    min-height: 40px;
    border-radius: var(--radius-sm);
  }

  .primary-button {
    padding-inline: 11px;
    font-size: 11px;
  }

  #languageSelect {
    min-width: 96px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  .topbar-actions {
    justify-content: flex-start;
  }
}

/* Shared shell scrollbars: the page can remain scrollable on short phones,
   but the scrollbar must stay a quiet affordance rather than a second rail. */
html,
body,
.workspace,
.canvas-column,
.look-manager-dialog,
.image-editor-dialog-shell {
  scrollbar-color: var(--scrollbar-thumb) transparent;
  scrollbar-width: thin;
}

/* Canvas view controls ----------------------------------------------------
   This is a workspace control, separate from the image-placement zoom in
   the inspector. Keep it quiet enough to sit below the card, but give the
   slider and focus action a clear, persistent home like a canvas editor. */
.canvas-view-bar {
  --canvas-view-foreground: var(--foreground);
  --canvas-view-surface: var(--card);
  --canvas-view-border: var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 860px;
  margin: 18px auto 0;
  padding: 10px 12px;
  border: 1px solid var(--canvas-view-border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 2px 6px color-mix(in oklch, var(--primary) 3%, transparent);
  color: var(--canvas-view-foreground);
  font-size: 11px;
}

.canvas-view-context,
.canvas-view-actions,
.canvas-view-zoom,
.canvas-view-pages {
  display: flex;
  align-items: center;
}

.canvas-view-context {
  gap: 7px;
  font-weight: 700;
  white-space: nowrap;
}

.ui-icon {
  display: block;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  overflow: visible;
  color: currentColor;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.canvas-view-context-mark,
.canvas-view-pages-icon {
  width: 14px;
  height: 14px;
  color: var(--canvas-view-foreground);
}

.canvas-view-actions {
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.canvas-view-navigation {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
}

.canvas-view-nav-button {
  font-size: 14px;
}

.canvas-view-zoom {
  gap: 6px;
  min-width: 0;
}

.canvas-view-step,
.canvas-view-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  min-width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--canvas-view-border);
  border-radius: var(--radius-sm);
  color: var(--canvas-view-foreground);
  background: var(--canvas-view-surface);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.canvas-view-icon {
  font-size: 16px;
}

.canvas-view-step .ui-icon,
.canvas-view-icon .ui-icon {
  width: 15px;
  height: 15px;
}

.canvas-view-step:hover:not(:disabled),
.canvas-view-icon:hover {
  border-color: var(--canvas-view-foreground);
  color: var(--canvas-view-foreground);
  background: var(--muted);
}

.canvas-view-step:disabled {
  cursor: not-allowed;
  opacity: .42;
}

.canvas-view-range-label {
  display: inline-flex;
  align-items: center;
  width: clamp(108px, 16vw, 150px);
}

.canvas-view-range-label input[type="range"] {
  width: 100%;
  height: 24px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.canvas-view-readout {
  min-width: 42px;
  color: var(--canvas-view-foreground);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.canvas-view-divider {
  width: 1px;
  height: 20px;
  margin-inline: 2px;
  background: var(--canvas-view-border);
}

.canvas-view-pages {
  gap: 6px;
  white-space: nowrap;
}

.canvas-view-pages strong {
  color: var(--canvas-view-foreground);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.canvas-view-icon.is-active {
  border-color: var(--canvas-view-foreground);
  color: var(--canvas-view-surface);
  background: var(--canvas-view-foreground);
}

body.canvas-focus-mode .canvas-view-bar {
  max-width: 1120px;
}

@media (max-width: 640px) {
  .canvas-view-bar {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
  }

  .canvas-view-context {
    display: none;
  }

  .canvas-view-actions {
    width: 100%;
    justify-content: space-between;
  }

  .canvas-view-range-label {
    width: clamp(92px, 26vw, 150px);
  }
}

@media (max-width: 420px) {
  .canvas-view-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .canvas-view-zoom {
    flex: 1 1 100%;
  }

  .canvas-view-range-label {
    flex: 1;
    width: auto;
  }

  .canvas-view-divider {
    display: none;
  }

  .canvas-view-pages {
    margin-right: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .canvas-view-range-label input[type="range"] {
    scroll-behavior: auto;
  }
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
.workspace::-webkit-scrollbar,
.canvas-column::-webkit-scrollbar,
.look-manager-dialog::-webkit-scrollbar,
.image-editor-dialog-shell::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: var(--scrollbar-size);
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
.workspace::-webkit-scrollbar-track,
.canvas-column::-webkit-scrollbar-track,
.look-manager-dialog::-webkit-scrollbar-track,
.image-editor-dialog-shell::-webkit-scrollbar-track {
  background: transparent;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
.workspace::-webkit-scrollbar-thumb,
.canvas-column::-webkit-scrollbar-thumb,
.look-manager-dialog::-webkit-scrollbar-thumb,
.image-editor-dialog-shell::-webkit-scrollbar-thumb {
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--scrollbar-thumb);
  background-clip: padding-box;
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
.workspace::-webkit-scrollbar-thumb:hover,
.canvas-column::-webkit-scrollbar-thumb:hover,
.look-manager-dialog::-webkit-scrollbar-thumb:hover,
.image-editor-dialog-shell::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  background-clip: padding-box;
}

/* Keep the `.dark` token scope on editor chrome. The look canvas remains on
   the light token root so a UI theme change cannot recolor the card or PNG. */
html[data-editor-theme="dark"] body {
  color: var(--background);
  background: var(--foreground);
}

html[data-editor-theme="dark"] .app-shell,
html[data-editor-theme="dark"] .workspace,
html[data-editor-theme="dark"] .canvas-column {
  background: var(--foreground);
}

html[data-editor-theme="dark"] .canvas-column { color: var(--background); }
html[data-editor-theme="dark"] .canvas-board { color: var(--foreground); }

html[data-editor-theme="dark"] [data-theme-surface]:is(.topbar, .rail, .library-sidebar, .inspector) {
  --muted-foreground: var(--chart-1);
}

@media (max-width: 560px) {
  .editor-theme-toggle {
    width: 36px;
    min-width: 36px;
    padding-inline: 0;
  }

  .editor-theme-toggle > span:not(.editor-theme-toggle-mark) { display: none; }
}

@media (max-width: 360px) {
  .topbar-actions > #exportButton {
    display: inline-flex;
    flex: 1 0 100%;
    align-items: center;
    justify-content: center;
  }
}
