body {
  background: var(--color-bg-canvas);
}

.preview-shell {
  width: min(1440px, calc(100% - 64px));
  margin: 0 auto;
  padding: 56px 0 96px;
}

.preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-8);
  padding-bottom: var(--space-10);
  border-bottom: 1px solid var(--color-border-subtle);
}

.eyebrow,
.section-kicker {
  margin: 0 0 var(--space-3);
  color: var(--color-text-tertiary);
  font-size: 11px;
  line-height: var(--line-xs);
  letter-spacing: 1.4px;
}

.preview-header h1,
.section-heading h2 {
  margin: 0;
  font-weight: 500;
  letter-spacing: 0;
}

.preview-header h1 {
  font-size: 40px;
  line-height: 48px;
}

.preview-intro,
.section-heading > p,
.preview-meta {
  color: var(--color-text-secondary);
}

.preview-intro {
  margin: var(--space-3) 0 0;
}

.preview-header__meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding-top: var(--space-2);
}

.preview-nav {
  display: flex;
  gap: var(--space-6);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-border-subtle);
}

.preview-nav a {
  color: var(--color-text-secondary);
  text-decoration: none;
}

.preview-nav a:hover {
  color: var(--color-text-primary);
}

.preview-section {
  padding-top: var(--space-12);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.section-heading h2 {
  font-size: 24px;
  line-height: var(--line-lg);
}

.section-heading > p {
  margin: 0;
  font-size: var(--text-xs);
}

.foundation-grid,
.component-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

.preview-card {
  min-width: 0;
  padding: var(--space-6);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  corner-shape: var(--corner-shape-superellipse);
  background: var(--color-bg-panel);
}

.preview-card h3 {
  margin: 0 0 var(--space-5);
  color: var(--color-text-primary);
  font-size: var(--text-md);
  font-weight: 500;
}

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
}

.swatch {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 84px;
  padding: var(--space-2);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  corner-shape: var(--corner-shape-superellipse);
  background: var(--swatch);
  color: var(--color-text-primary);
}

.swatch--light { color: var(--color-bg-canvas); }
.swatch--success { color: var(--color-bg-canvas); }
.swatch--danger { color: var(--color-text-primary); }
.swatch span { font-size: 11px; line-height: 14px; }
.swatch small { color: inherit; opacity: .65; font-size: 10px; line-height: 14px; }

.space-list { display: flex; flex-direction: column; gap: var(--space-3); }
.space-list > div { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: var(--space-3); color: var(--color-text-secondary); }
.space-bar { display: block; width: var(--space); height: 8px; border-radius: 2px; corner-shape: var(--corner-shape-superellipse); background: var(--color-text-primary); }
.space-list code { color: var(--color-text-primary); font-size: 12px; }
.space-list small { color: var(--color-text-tertiary); }

.type-card p { margin: 0; padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border-subtle); }
.type-card p:last-child { border-bottom: 0; }
.type-xl { font-size: 24px; line-height: 32px; }
.type-md { font-size: 16px; line-height: 24px; }
.type-sm { font-size: 14px; line-height: 20px; color: var(--color-text-secondary); }
.type-xs { font-size: 12px; line-height: 16px; color: var(--color-text-tertiary); }

.component-block { display: flex; flex-direction: column; gap: var(--space-4); }
.component-block h3 { margin-bottom: 0; }
.component-block--wide { grid-column: span 2; }
.component-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.component-label { margin: 0; color: var(--color-text-secondary); font-size: var(--text-xs); }
.icon-gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
.icon-gallery__item { display: grid; grid-template-columns: 32px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: var(--space-2); align-items: center; min-width: 0; padding: var(--space-2); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-md); corner-shape: var(--corner-shape-superellipse); background: var(--color-bg-elevated); }
.icon-gallery__preview { display: grid; grid-row: span 2; place-items: center; width: 32px; height: 32px; color: var(--color-text-primary); }
.icon-gallery__preview .ui-icon { width: var(--icon-size); height: var(--icon-size); }
.icon-gallery__item strong, .icon-gallery__item small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-gallery__item strong { color: var(--color-text-primary); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; font-weight: 500; line-height: 16px; }
.icon-gallery__item small { color: var(--color-text-tertiary); font-size: 11px; line-height: 16px; }
.progress-demo-status { min-height: var(--line-sm); color: var(--color-text-secondary); font-size: var(--text-xs); }
.component-block .ui-field + .ui-field { margin-top: var(--space-2); }
.feedback { min-height: var(--line-sm); margin: 0; color: var(--color-text-tertiary); font-size: var(--text-xs); }
.feedback.is-active { color: var(--color-success); }
.status-stack { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.page-component { min-height: 420px; }
.page-component--login { grid-column: span 1; }
.page-component--projects { grid-column: span 2; }
.page-component--assets { grid-column: 1 / -1; }
.page-component__heading { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); }
.page-component__heading h3 { margin: 0; }
.page-component__heading .section-kicker { margin-bottom: var(--space-2); }
.login-preview { display: flex; flex-direction: column; gap: var(--space-4); width: min(100%, 300px); margin: auto; }
.login-preview__brand { font-family: Georgia, serif; font-size: 28px; line-height: 36px; }
.login-preview__hint { margin: calc(var(--space-2) * -1) 0 0; color: var(--color-text-secondary); font-size: var(--text-xs); }
.page-action { width: 100%; }
.page-feedback { min-height: var(--line-sm); margin: 0; color: var(--color-text-tertiary); font-size: var(--text-xs); }
.page-feedback.is-active { color: var(--color-success); }
.project-preview__toolbar { display: flex; justify-content: space-between; padding-bottom: var(--space-3); border-bottom: 1px solid var(--color-border-subtle); color: var(--color-text-primary); }
.project-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.project-card { position: relative; display: flex; align-items: flex-start; gap: var(--space-3); min-width: 0; padding: var(--space-3); border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); corner-shape: var(--corner-shape-superellipse); background: var(--color-bg-elevated); }
.project-card__cover { flex: 0 0 56px; aspect-ratio: 3 / 4; border-radius: var(--radius-md); corner-shape: var(--corner-shape-superellipse); }
.project-card__cover--warm { background: #51423b; }
.project-card__cover--cool { background: #3b4850; }
.project-card__body { min-width: 0; flex: 1; }
.project-card__body strong, .project-card__body span, .project-card__body small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-card__body strong { margin: 2px 0 var(--space-1); font-size: 12px; font-weight: 500; }
.project-card__body span, .project-card__body small { color: var(--color-text-tertiary); font-size: 11px; }
.project-card__progress { height: 4px; margin: var(--space-3) 0 var(--space-1); overflow: hidden; border-radius: 2px; corner-shape: var(--corner-shape-superellipse); background: var(--color-bg-hover); }
.project-card__progress i { display: block; height: 100%; background: var(--color-text-secondary); }
.project-card > .ui-status-badge { position: absolute; top: var(--space-3); right: var(--space-3); transform: translateY(38px); }
.project-empty { display: flex; align-items: center; justify-content: center; min-height: 72px; gap: var(--space-2); border: 1px dashed var(--color-border-default); border-radius: var(--radius-lg); corner-shape: var(--corner-shape-superellipse); color: var(--color-text-tertiary); }
.project-empty span { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; }
.project-empty p { margin: 0; font-size: var(--text-xs); }

.asset-breadcrumb { display: flex; align-items: center; gap: var(--space-2); width: fit-content; padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); corner-shape: var(--corner-shape-superellipse); background: var(--color-bg-elevated); color: var(--color-text-secondary); font-size: var(--text-xs); }
.asset-breadcrumb b { color: var(--color-text-tertiary); font-weight: 400; }
.asset-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .8fr); gap: var(--space-6); }
.asset-groups { display: flex; flex-direction: column; gap: var(--space-6); }
.asset-group { display: flex; flex-direction: column; gap: var(--space-3); }
.asset-group__heading { display: flex; align-items: center; justify-content: space-between; }
.asset-group__heading h4, .asset-generate h4 { margin: 0; font-size: var(--text-md); font-weight: 500; }
.asset-group__heading span { color: var(--color-text-tertiary); font-size: var(--text-xs); }
.asset-grid { display: grid; grid-template-columns: repeat(3, minmax(100px, 1fr)); gap: var(--space-3); }
.asset-card { display: flex; flex-direction: column; align-items: stretch; gap: var(--space-1); min-width: 0; padding: 0; border: 0; background: transparent; color: var(--color-text-primary); cursor: pointer; text-align: left; }
.asset-card__image { display: block; aspect-ratio: 16 / 9; border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); corner-shape: var(--corner-shape-superellipse); background: var(--color-bg-elevated); transition: border-color .16s ease, background-color .16s ease; }
.asset-card:hover .asset-card__image, .asset-card[aria-pressed="true"] .asset-card__image { border-color: var(--color-border-strong); background-color: var(--color-bg-hover); }
.asset-card__image--character-a { background: linear-gradient(145deg, #4d4743, #292726); }
.asset-card__image--character-b { background: linear-gradient(145deg, #3f4b4e, #242b2d); }
.asset-card__image--scene-a { background: linear-gradient(145deg, #51483e, #292725); }
.asset-card__image--prop-a { background: linear-gradient(145deg, #3f4145, #202124); }
.asset-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); font-weight: 400; }
.asset-card small { color: var(--color-text-tertiary); font-size: var(--text-xs); }
.asset-card--add { align-items: center; justify-content: center; aspect-ratio: 16 / 9; min-height: 0; padding: var(--space-3); border: 1px dashed var(--color-border-default); border-radius: var(--radius-lg); corner-shape: var(--corner-shape-superellipse); color: var(--color-text-secondary); text-align: center; }
.asset-card--add:hover { border-color: var(--color-progress-current); color: var(--color-progress-current); background: rgba(9, 243, 208, .04); }
.asset-card--add span { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; }
.asset-card--add strong { font-size: var(--text-xs); }
.asset-card--add small { color: inherit; font-size: 10px; }
.asset-generate { display: flex; flex-direction: column; align-self: start; gap: var(--space-4); padding: var(--space-5); border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); corner-shape: var(--corner-shape-superellipse); background: var(--color-bg-elevated); }
.asset-generate__heading { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.asset-generate__heading p { margin: var(--space-1) 0 0; color: var(--color-text-tertiary); font-size: var(--text-xs); }
.asset-generate__options { display: flex; flex-direction: column; gap: var(--space-2); }

.demo-list { margin: calc(var(--space-2) * -1); }
.file-icon,
.ui-list-item > [data-icon] { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 var(--icon-size); width: var(--icon-size); height: var(--icon-size); color: var(--color-text-tertiary); }
.file-icon .ui-icon,
.ui-list-item > [data-icon] .ui-icon { width: var(--icon-size); height: var(--icon-size); }
.list-check { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 var(--icon-size); width: var(--icon-size); height: var(--icon-size); color: var(--color-success); }
.list-check .ui-icon { width: var(--icon-size); height: var(--icon-size); }

.choice-bubble { display: flex; align-items: center; justify-content: center; min-width: 58px; min-height: 28px; padding: 0 var(--space-2); color: var(--color-bg-canvas); background: var(--color-text-primary); font-size: 11px; }
.choice-bubble--round { border-radius: 50%; corner-shape: var(--corner-shape-superellipse); }
.choice-bubble--sharp { border-radius: 2px; corner-shape: var(--corner-shape-superellipse); }
.choice-bubble--thought { border-radius: 50%; corner-shape: var(--corner-shape-superellipse); color: var(--color-text-primary); background: transparent; border: 1px solid var(--color-text-secondary); }
.frame-preview { display: block; width: 70px; height: 28px; background: var(--color-bg-hover); border-radius: var(--radius-sm); corner-shape: var(--corner-shape-superellipse); }
.frame-preview--thin { border: 1px solid var(--color-text-secondary); }
.frame-preview--dashed { border: 1px dashed var(--color-text-secondary); }

.workbench-demo { display: grid; grid-template-columns: 260px minmax(0, 1fr) 280px; min-height: 560px; overflow: hidden; border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); corner-shape: var(--corner-shape-superellipse); background: var(--color-bg-canvas); }
.workbench-demo__sidebar, .workbench-demo__inspector { padding: var(--space-6); background: var(--color-bg-panel); }
.workbench-demo__sidebar { border-right: 1px solid var(--color-border-subtle); grid-row: 2; }
.workbench-demo__inspector { border-left: 1px solid var(--color-border-subtle); grid-row: 2; }
.demo-back { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-6); color: var(--color-text-primary); font-size: var(--text-md); }
.demo-back > [data-icon] { display: inline-flex; align-items: center; justify-content: center; width: var(--icon-size); height: var(--icon-size); }
.demo-project { display: flex; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); corner-shape: var(--corner-shape-superellipse); background: var(--color-bg-elevated); }
.demo-project__thumb { flex: 0 0 44px; height: 58px; border-radius: var(--radius-md); corner-shape: var(--corner-shape-superellipse); background: #38322e; }
.demo-project strong { display: block; font-size: 12px; line-height: 18px; font-weight: 500; }
.demo-project small { display: block; margin-top: var(--space-2); color: var(--color-text-tertiary); font-size: 11px; }
.demo-tree { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-8); }
.demo-tree > strong { margin-bottom: var(--space-2); font-size: 12px; font-weight: 500; }
.demo-tree .ui-list-item { width: 100%; padding-inline: var(--space-2); }
.workbench-demo__main { min-width: 0; display: flex; flex-direction: column; grid-row: 2; }
.demo-toolbar { display: flex; align-items: center; min-height: 48px; gap: var(--space-3); padding: var(--space-2) var(--space-6); border-bottom: 1px solid var(--color-border-subtle); color: var(--color-text-primary); }
.demo-toolbar__action { margin-left: auto; height: 32px; min-height: 32px; padding-inline: var(--space-4); font-size: 11px; }
.demo-toolbar__progress { width: min(300px, 48%); }
.demo-toolbar__progress .ui-workbench-progress__label { font-size: 11px; }
.demo-canvas { display: grid; place-items: center; flex: 1; padding: var(--space-8); background: #050505; }
.demo-canvas__page { position: relative; width: min(250px, 70%); aspect-ratio: 9 / 16; overflow: hidden; border: 1px solid var(--color-border-default); border-radius: var(--radius-md); corner-shape: var(--corner-shape-superellipse); background: #2d2927; box-shadow: var(--shadow-md); }
.demo-canvas__page::before { content: ""; position: absolute; inset: 20% 12% 38%; background: #4b4642; opacity: .7; }
.demo-speech { position: absolute; top: 24%; left: 13%; z-index: 1; padding: 8px 12px; border-radius: 50%; corner-shape: var(--corner-shape-superellipse); background: var(--color-text-primary); color: var(--color-bg-canvas); font-size: 10px; }
.demo-speech--second { top: 48%; left: auto; right: 10%; }
.demo-inspector__title { margin-bottom: var(--space-8); font-size: 20px; font-weight: 500; }
.demo-inspector__section { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4) 0; border-bottom: 1px solid var(--color-border-subtle); color: var(--color-text-secondary); font-size: 12px; }
.demo-inspector__section[hidden] { display: none; }
.mini-options { display: flex; gap: var(--space-2); }
.mini-options i { display: block; width: 54px; height: 32px; border: 1px solid var(--color-border-default); border-radius: var(--radius-md); corner-shape: var(--corner-shape-superellipse); background: var(--color-bg-elevated); }
.mini-options i.is-active { border-color: var(--color-border-strong); background: var(--color-bg-active); }
.demo-select { display: flex; align-items: center; justify-content: space-between; min-height: 36px; padding: 0 var(--space-3); border: 1px solid var(--color-border-default); border-radius: var(--radius-md); corner-shape: var(--corner-shape-superellipse); background: var(--color-bg-elevated); color: var(--color-text-primary); }
.demo-select b { color: var(--color-text-tertiary); font-weight: 400; }
.mini-frame { width: 100%; height: 34px; border: 1px solid var(--color-text-secondary); border-radius: var(--radius-sm); corner-shape: var(--corner-shape-superellipse); }

@media (max-width: 920px) {
  .preview-shell { width: min(100% - 32px, 720px); padding-top: 32px; }
  .preview-header, .section-heading { flex-direction: column; align-items: flex-start; }
  .foundation-grid, .component-grid { grid-template-columns: 1fr; }
  .component-block--wide { grid-column: auto; }
  .page-component--login, .page-component--projects { grid-column: auto; }
  .page-component--assets { grid-column: auto; }
  .project-cards { grid-template-columns: 1fr; }
  .asset-layout { grid-template-columns: 1fr; }
  .icon-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workbench-demo { grid-template-columns: 220px minmax(420px, 1fr) 240px; overflow-x: auto; }
}

@media (max-width: 600px) {
  .preview-header h1 { font-size: 32px; line-height: 40px; }
  .preview-header__meta, .preview-nav { flex-wrap: wrap; }
  .swatch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workbench-demo { grid-template-columns: 220px 520px 240px; }
}
