@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&display=swap');

:root {
  --ink: #18202a;
  --muted: #66717f;
  --line: #dce1e7;
  --line-strong: #c5ccd6;
  --paper: #f6f7f9;
  --white: #fff;
  --blue: #1859d1;
  --blue-soft: #eaf1ff;
  --coral: #ed684a;
  --mint: #1c8c73;
  --amber: #c98213;
  --rail: #151d27;
  --shadow: 0 14px 36px rgba(20, 31, 47, .09);
  --radius: 8px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.hidden { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--ink);
  background:
    linear-gradient(rgba(24,32,42,.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24,32,42,.026) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family: "IBM Plex Sans", "Noto Sans SC", sans-serif;
  letter-spacing: 0;
}
button, input, select, textarea { color: inherit; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 76px minmax(0, 1fr); }
.rail {
  position: sticky; top: 0; z-index: 20; height: 100vh; padding: 18px 10px;
  display: flex; flex-direction: column; align-items: center; background: var(--rail); border-right: 1px solid #293442;
}
.brand {
  width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 27px;
  color: #fff; background: var(--coral); border-radius: 7px; text-decoration: none; font-weight: 800; font-size: 14px;
}
.rail-nav { width: 100%; display: grid; gap: 9px; }
.rail-button {
  width: 56px; min-height: 52px; padding: 6px 2px; border: 0; border-radius: 7px; background: transparent;
  color: #8d9aa9; display: grid; place-items: center; gap: 2px; text-decoration: none; font-size: 9px; position: relative;
}
.rail-button svg { width: 20px; height: 20px; }
.rail-button:hover, .rail-button.active { color: #fff; background: #253140; }
.rail-button.active::before { content: ""; position: absolute; left: -10px; width: 3px; top: 10px; bottom: 10px; background: var(--coral); }
.rail-home { margin-top: auto; }

.main-shell { min-width: 0; }
.topbar {
  height: 68px; padding: 0 30px; display: flex; align-items: center; justify-content: space-between; gap: 20px;
  position: sticky; top: 0; z-index: 15; border-bottom: 1px solid var(--line); background: rgba(246,247,249,.94); backdrop-filter: blur(10px);
}
.crumb { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.crumb svg { width: 15px; }
.crumb strong { color: var(--ink); font-size: 14px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.save-state { color: var(--muted); font-size: 11px; display: inline-flex; align-items: center; gap: 6px; }
.save-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--mint); }
.button {
  min-height: 38px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line-strong); border-radius: 7px; background: var(--white); font-size: 12px; font-weight: 600;
}
.button:hover { border-color: #929eac; }
.button.primary { color: #fff; border-color: var(--blue); background: var(--blue); box-shadow: 0 5px 14px rgba(24,89,209,.2); }
.button.primary:hover { background: #104bb7; }
.button svg { width: 16px; }

.workspace { display: none; max-width: 1530px; margin: 0 auto; padding: 26px 30px 50px; }
.workspace.active { display: block; animation: view-in .18s ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-heading { min-height: 62px; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.page-heading h1 { margin: 0; font-size: 25px; line-height: 1.15; }
.page-heading p:not(.eyebrow) { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.eyebrow { margin: 0 0 4px; color: var(--blue); font-size: 9px; font-weight: 700; letter-spacing: .12em; }

.create-layout { display: grid; grid-template-columns: minmax(620px, 1fr) minmax(390px, 500px); gap: 18px; align-items: start; }
.form-surface, .preview-surface { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow); }
.form-surface { overflow: hidden; }
.form-section { padding: 21px 23px; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.section-heading { margin-bottom: 15px; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.section-heading span { display: block; margin-bottom: 3px; color: var(--blue); font-size: 9px; font-weight: 700; letter-spacing: .09em; }
.section-heading h2 { margin: 0; font-size: 16px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.text-action { border: 0; padding: 3px 0; display: inline-flex; align-items: center; gap: 5px; color: var(--blue); background: transparent; font-size: 11px; font-weight: 700; white-space: nowrap; }
.text-action svg { width: 15px; }
.field-grid { display: grid; gap: 11px; }
.field-grid.three { grid-template-columns: 1.5fr .75fr .75fr; }
.field { display: block; min-width: 0; }
.field > span { display: block; margin-bottom: 6px; color: #465362; font-size: 11px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 7px; outline: 0; background: #fff; font-size: 12px;
}
.field input, .field select { height: 40px; padding: 0 10px; }
.field textarea { min-height: 72px; padding: 9px 10px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(24,89,209,.08); }
.field-grid + .field { margin-top: 12px; }
.upload-zone {
  margin-top: 12px; min-height: 82px; padding: 13px; display: flex; align-items: center; gap: 12px;
  border: 1px dashed #aab5c2; border-radius: 7px; background: #fafbfd; cursor: pointer;
}
.upload-zone:hover { border-color: var(--blue); background: #f6f9ff; }
.upload-zone input { display: none; }
.upload-zone strong { display: block; font-size: 12px; }
.upload-zone small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.upload-icon { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 7px; background: var(--blue-soft); color: var(--blue); }
.upload-icon svg { width: 19px; }

.choice-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(138px, 1fr); gap: 9px; overflow-x: auto; padding: 2px 2px 6px; }
.choice-card { min-width: 0; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: #fff; text-align: left; position: relative; }
.choice-card:hover { border-color: #929eac; }
.choice-card.selected { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(24,89,209,.1); }
.choice-card img { display: block; width: 100%; height: 92px; object-fit: cover; background: #e8ecf1; }
.choice-card.instructor img { height: 112px; object-position: center 20%; }
.choice-copy { padding: 8px 9px 9px; }
.choice-copy strong, .choice-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choice-copy strong { font-size: 10px; }
.choice-copy small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.choice-check { display: none; position: absolute; top: 6px; right: 6px; width: 19px; height: 19px; place-items: center; border-radius: 50%; color: #fff; background: var(--blue); }
.choice-check svg { width: 11px; }
.choice-card.selected .choice-check { display: grid; }
.empty-choice { min-height: 110px; padding: 18px; display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: 7px; color: var(--muted); font-size: 10px; }

.ratio-control { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 12px; }
.ratio-option { min-height: 60px; padding: 10px 12px; display: flex; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 7px; background: #fff; text-align: left; }
.ratio-option:hover { border-color: #9aa5b2; }
.ratio-option.selected { border-color: var(--blue); background: #f8faff; box-shadow: 0 0 0 2px rgba(24,89,209,.08); }
.ratio-option strong, .ratio-option small { display: block; }
.ratio-option strong { font-size: 11px; }
.ratio-option small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.ratio-icon { display: block; border: 2px solid currentColor; border-radius: 3px; color: #758191; }
.ratio-option.selected .ratio-icon { color: var(--blue); }
.ratio-icon.landscape { width: 35px; height: 21px; }
.ratio-icon.portrait { width: 20px; height: 34px; margin: 0 7px; }
.mode-control { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.mode-option { min-height: 64px; padding: 11px; display: grid; grid-template-columns: 16px 1fr; gap: 9px; align-items: center; border: 1px solid var(--line); border-radius: 7px; background: #fff; text-align: left; }
.mode-option.selected { border-color: var(--blue); background: #f8faff; }
.mode-option strong, .mode-option small { display: block; }
.mode-option strong { font-size: 11px; }
.mode-option small { margin-top: 3px; color: var(--muted); font-size: 8px; line-height: 1.4; }
.radio { width: 15px; height: 15px; border: 1px solid #aeb7c3; border-radius: 50%; }
.mode-option.selected .radio { border: 4px solid var(--blue); }

.preview-surface { position: sticky; top: 87px; overflow: hidden; }
.preview-heading { height: 50px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); font-size: 11px; }
.preview-heading span { color: var(--muted); font-size: 9px; font-weight: 700; }
.stage-wrap { min-height: 324px; padding: 20px; display: grid; place-items: center; background: #e9edf2; }
.preview-stage { width: 100%; aspect-ratio: 16/9; position: relative; overflow: hidden; background: #1b2430; box-shadow: 0 9px 24px rgba(20,31,47,.2); transition: width .2s; }
.preview-stage.portrait { width: 55%; aspect-ratio: 9/16; }
.preview-background { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.preview-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(11,19,27,.76), rgba(11,19,27,.08)); }
.preview-kicker, .preview-stage h2, .preview-copy { position: absolute; left: 7%; z-index: 2; color: #fff; max-width: 65%; }
.preview-kicker { top: 12%; margin: 0; color: #79d4bc; font-size: 7px; font-weight: 700; letter-spacing: .1em; }
.preview-stage h2 { top: 24%; margin: 0; font-size: clamp(15px, 2vw, 25px); line-height: 1.2; }
.preview-copy { top: 48%; margin: 0; font-size: 8px; line-height: 1.5; color: rgba(255,255,255,.8); }
.preview-instructor { position: absolute; right: -2%; bottom: 0; z-index: 3; width: 42%; max-height: 86%; object-fit: contain; object-position: bottom; }
.preview-stage.portrait .preview-instructor { width: 68%; right: -14%; }
.preview-stage.portrait h2 { font-size: 17px; max-width: 76%; }
.preview-stage.portrait .preview-copy { max-width: 72%; }
.preview-summary { padding: 15px; border-top: 1px solid var(--line); }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-bottom: 13px; background: var(--line); border: 1px solid var(--line); }
.metrics div { padding: 9px; background: #fff; text-align: center; }
.metrics strong, .metrics span { display: block; }
.metrics strong { font-size: 13px; }
.metrics span { margin-top: 2px; color: var(--muted); font-size: 7px; }
.preview-summary dl { margin: 0 0 13px; display: grid; gap: 7px; }
.preview-summary dl div { display: flex; justify-content: space-between; gap: 12px; font-size: 9px; }
.preview-summary dt { color: var(--muted); }
.preview-summary dd { margin: 0; font-weight: 600; text-align: right; }
.create-button { width: 100%; height: 42px; border: 0; border-radius: 7px; color: #fff; background: var(--blue); display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 12px; font-weight: 700; }
.create-button:hover { background: #104bb7; }
.create-button:disabled { opacity: .55; cursor: wait; }
.create-button svg { width: 16px; }
.generation-log { max-height: 190px; margin-top: 11px; padding: 9px; overflow-y: auto; border-radius: 6px; color: #c8d4df; background: #151e29; font: 8px/1.55 ui-monospace, monospace; }
.log-line { margin-bottom: 4px; }
.log-line.success { color: #6ad3b2; }
.log-line.error { color: #ff9b85; }

.toolbar { margin-bottom: 15px; display: flex; justify-content: space-between; gap: 12px; }
.segmented { display: flex; gap: 4px; }
.segmented button { min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--muted); font-size: 10px; font-weight: 600; }
.segmented button.active { color: var(--blue); border-color: #b9cdf4; background: var(--blue-soft); }
.search { width: 240px; height: 35px; padding: 0 10px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; }
.search svg { width: 14px; color: var(--muted); }
.search input { min-width: 0; width: 100%; border: 0; outline: 0; font-size: 10px; }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 13px; }
.project-card { min-height: 180px; position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 8px 22px rgba(20,31,47,.05); color: inherit; }
.project-card:hover { border-color: #aab5c2; transform: translateY(-1px); }
.project-card-link { min-height: 180px; padding: 16px; display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.project-card .status { width: max-content; padding: 4px 7px; border-radius: 4px; color: var(--blue); background: var(--blue-soft); font-size: 8px; font-weight: 700; }
.project-card h2 { margin: 24px 0 7px; font-size: 15px; }
.project-card p { margin: 0; color: var(--muted); font-size: 9px; }
.project-card footer { margin-top: auto; padding-top: 20px; display: flex; justify-content: space-between; color: var(--muted); font-size: 8px; }
.project-delete { width: 30px; height: 30px; position: absolute; top: 12px; right: 12px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 5px; color: #75808d; background: transparent; }
.project-delete:hover { border-color: #efc8c8; color: #b42318; background: #fff5f4; }
.project-delete:disabled { cursor: not-allowed; opacity: .35; }
.project-delete svg { width: 15px; height: 15px; }
.avatar-type-filter { width: max-content; margin: 10px 0 12px; }
.empty-state { min-height: 280px; padding: 30px; display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: 8px; background: rgba(255,255,255,.7); color: var(--muted); text-align: center; font-size: 11px; }

.asset-tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.asset-tabs button { padding: 9px 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; }
.asset-tabs button.active { color: var(--blue); border-bottom-color: var(--blue); }
.asset-layout { min-height: 620px; display: grid; grid-template-columns: 220px minmax(420px,1fr) 280px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.asset-browser { border-right: 1px solid var(--line); background: #fafbfd; }
.asset-browser-head, .asset-canvas-head, .asset-inspector-head { height: 50px; padding: 0 13px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.asset-browser-head strong, .asset-canvas-head strong, .asset-inspector-head strong { font-size: 11px; }
.asset-browser-head span, .asset-canvas-head span, .asset-inspector-head span { color: var(--muted); font-size: 8px; }
.asset-list { padding: 9px; display: grid; gap: 5px; }
.asset-list-item { min-width: 0; padding: 6px; display: grid; grid-template-columns: 62px minmax(0,1fr); gap: 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; text-align: left; }
.asset-list-item:hover { background: #fff; border-color: var(--line); }
.asset-list-item.selected { background: #fff; border-color: var(--blue); box-shadow: 0 0 0 2px rgba(24,89,209,.08); }
.asset-list-item img { width: 62px; height: 45px; object-fit: cover; border-radius: 4px; background: #e7ebef; }
.asset-list-item.instructor-asset { min-height: 78px; grid-template-columns: 54px minmax(0,1fr); align-items: center; }
.asset-list-item.instructor-asset img { width: 54px; height: 66px; object-fit: contain; object-position: center; background: #edf1f4; }
.asset-list-item strong, .asset-list-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-list-item strong { font-size: 9px; }
.asset-list-item small { margin-top: 3px; color: var(--muted); font-size: 7px; }
.asset-canvas { min-width: 0; display: grid; grid-template-rows: 50px minmax(0,1fr) 104px; background: #edf0f4; }
.asset-canvas-head { background: #fff; }
.asset-preview { min-height: 0; position: relative; overflow: hidden; background: #edf0f4; }
.asset-preview img { position: absolute; inset: 28px; display: block; width: calc(100% - 56px); height: calc(100% - 56px); max-width: none; max-height: none; object-fit: contain; object-position: center; background: #dfe4ea; filter: drop-shadow(0 8px 13px rgba(20,31,47,.18)); }
.asset-layout.instructor-mode .asset-preview { background: #e9edf1; }
.asset-layout.instructor-mode .asset-preview img { inset: 18px 28px; width: calc(100% - 56px); height: calc(100% - 36px); object-fit: contain; }
.asset-layout.background-mode .asset-preview img { object-fit: contain; }
.asset-version-strip { min-width: 0; padding: 9px 10px; display: flex; gap: 8px; overflow-x: auto; border-top: 1px solid var(--line); background: #fff; }
.asset-version-item { width: 104px; flex: 0 0 104px; padding: 4px; border: 1px solid var(--line); border-radius: 5px; background: #fff; text-align: left; }
.asset-version-item:hover { border-color: #91a7c2; }
.asset-version-item.current { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(24,89,209,.09); }
.asset-version-item img { display: block; width: 94px; height: 55px; object-fit: contain; border-radius: 3px; background: #e8edf2; }
.asset-version-item span { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 7px; white-space: nowrap; text-overflow: ellipsis; }
.asset-version-item.current span { color: var(--blue); font-weight: 700; }
.asset-inspector { border-left: 1px solid var(--line); }
.asset-inspector-body { padding: 14px; display: grid; gap: 12px; }
.inspector-row { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.inspector-row span, .inspector-row strong { display: block; }
.inspector-row span { margin-bottom: 4px; color: var(--muted); font-size: 8px; }
.inspector-row strong { font-size: 10px; line-height: 1.5; }
.inspector-row .version-prompt { overflow-wrap: anywhere; font-weight: 500; }
.asset-note { padding: 10px; border: 1px solid #d6e2f8; border-radius: 6px; color: #45617f; background: #f6f9ff; font-size: 8px; line-height: 1.5; }
.asset-publication { padding: 0 14px 12px; }
.asset-publication .button { width: 100%; justify-content: center; }
.asset-publication .button:disabled { cursor: not-allowed; opacity: .45; }
.asset-assistant-launch { margin: 0 13px 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.assistant-launch-button { width: 100%; min-height: 56px; padding: 9px 10px; border: 1px solid #b9ccef; border-radius: 7px; display: grid; grid-template-columns: 32px minmax(0,1fr); align-items: center; gap: 9px; color: var(--blue); background: #f6f9ff; text-align: left; }
.assistant-launch-button:hover { border-color: var(--blue); background: var(--blue-soft); }
.assistant-launch-button > svg { width: 18px; justify-self: center; }
.assistant-launch-button strong, .assistant-launch-button small { display: block; }
.assistant-launch-button strong { font-size: 10px; }
.assistant-launch-button small { margin-top: 3px; color: var(--muted); font-size: 7px; line-height: 1.4; }
.asset-chat-drawer { position: fixed; right: 20px; bottom: 24px; z-index: 50; width: min(440px, calc(100vw - 40px)); max-height: calc(100vh - 92px); display: grid; grid-template-rows: auto auto minmax(100px,1fr) auto; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: 0 22px 70px rgba(9,18,28,.28); }
.asset-chat-head { min-height: 56px; padding: 10px 13px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); background: #fff; }
.asset-chat-head strong, .asset-chat-head small { display: block; }
.asset-chat-head strong { font-size: 12px; }
.asset-chat-head small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.asset-chat-context { min-height: 62px; padding: 9px 12px; display: grid; grid-template-columns: 64px minmax(0,1fr); gap: 10px; align-items: center; border-bottom: 1px solid var(--line); background: #f8fafc; }
.asset-chat-context img { width: 64px; height: 48px; object-fit: contain; border-radius: 5px; background: #e5eaf0; }
.asset-chat-context strong, .asset-chat-context span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-chat-context strong { font-size: 10px; }
.asset-chat-context span { margin-top: 3px; color: var(--muted); font-size: 8px; }
.asset-chat-compose { padding: 11px 12px 12px; border-top: 1px solid var(--line); background: #fff; }
.asset-chat-compose .field + .field { margin-top: 8px; }
.assistant-heading { margin-bottom: 13px; display: flex; align-items: center; gap: 9px; }
.assistant-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; color: var(--blue); background: var(--blue-soft); }
.assistant-icon svg { width: 16px; }
.assistant-heading strong, .assistant-heading small { display: block; }
.assistant-heading strong { font-size: 10px; }
.assistant-heading small { margin-top: 2px; color: var(--muted); font-size: 7px; }
.asset-chat-compose textarea { min-height: 76px; }
.assistant-run { width: 100%; min-height: 38px; margin-top: 10px; border: 0; border-radius: 6px; display: flex; align-items: center; justify-content: center; gap: 6px; color: #fff; background: var(--blue); font-size: 9px; font-weight: 700; }
.assistant-run:hover { background: #104bb7; }
.assistant-run:disabled { opacity: .55; cursor: wait; }
.assistant-run svg { width: 14px; }
.assistant-status { margin: 9px 0 0; padding: 8px 9px; border-radius: 6px; color: #42607f; background: #f3f7fd; font-size: 8px; line-height: 1.5; }
.assistant-status.error { color: #a23e2c; background: #fff5f2; }
.asset-assistant-chat { min-height: 110px; max-height: 260px; padding: 10px 12px; overflow-y: auto; background: #f8fafc; display: grid; align-content: start; gap: 8px; }
.asset-chat-message { max-width: 92%; padding: 7px 8px; border-radius: 6px; font-size: 8px; line-height: 1.55; white-space: pre-wrap; }
.asset-chat-message.user { justify-self: end; color: #fff; background: var(--blue); }
.asset-chat-message.assistant { justify-self: start; color: #34475a; background: #e9eef4; }
.assistant-chat-actions { margin-top: 9px; display: grid; grid-template-columns: 1fr; gap: 5px; }
.assistant-chat-actions button { min-height: 32px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 5px; display: flex; align-items: center; justify-content: flex-start; gap: 6px; color: #38506a; background: #fff; font-size: 8px; font-weight: 700; }
.assistant-chat-actions button:hover { color: var(--blue); border-color: #a8bee8; background: #f6f9ff; }
.assistant-chat-actions button:disabled { opacity: .5; cursor: wait; }
.assistant-chat-actions svg { width: 13px; }
.assistant-global-launch { min-width: 112px; }
.lesson-assistant-drawer { position: fixed; top: 64px; right: 18px; bottom: 18px; z-index: 70; width: min(440px, calc(100vw - 36px)); display: grid; grid-template-rows: auto auto minmax(180px, 1fr) auto; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 22px 70px rgba(9,18,28,.26); }
.lesson-assistant-context { padding: 11px 13px; display: grid; gap: 3px; border-bottom: 1px solid var(--line); background: #f7f9fc; }
.lesson-assistant-context strong { color: var(--ink); font-size: 11px; }
.lesson-assistant-context span, .lesson-assistant-context small { color: var(--muted); font-size: 8px; }
.lesson-assistant-messages { min-height: 180px; padding: 12px; overflow-y: auto; display: grid; align-content: start; gap: 12px; background: #f8fafc; }
.lesson-assistant-turn { display: grid; gap: 7px; }
.lesson-assistant-turn .asset-chat-message.user { justify-self: end; max-width: 86%; }
.lesson-assistant-answer, .assistant-pending, .assistant-empty { padding: 9px 10px; border-radius: 6px; color: #34475a; background: #e9eef4; font-size: 9px; line-height: 1.55; }
.lesson-assistant-answer strong, .lesson-assistant-answer span { display: block; }
.lesson-assistant-answer span { margin-top: 4px; }
.lesson-assistant-answer.error { color: #9b3d31; background: #fff1ee; }
.assistant-pending { color: var(--muted); font-style: italic; }
.assistant-empty { color: var(--muted); background: transparent; text-align: center; }
.lesson-assistant-plan { padding: 11px; border: 1px solid #b7c9eb; border-radius: 7px; background: #f5f8ff; }
.lesson-assistant-plan strong { color: var(--blue); font-size: 10px; }
.lesson-assistant-plan p { margin: 6px 0; color: #334b65; font-size: 9px; line-height: 1.5; }
.lesson-assistant-plan small { display: block; margin-bottom: 9px; color: var(--muted); font-size: 8px; line-height: 1.45; }
.lesson-assistant-plan .button { width: 100%; justify-content: center; }
@media (max-width: 620px) {
  .lesson-assistant-drawer { top: 54px; left: 8px; right: 8px; bottom: 8px; width: auto; }
  .assistant-global-launch { min-width: 42px; padding-inline: 9px; font-size: 0; }
  .assistant-global-launch svg { margin: 0; }
}
.asset-assistant-proposal { margin-top: 9px; padding: 10px; border: 1px solid #b7c9eb; border-radius: 6px; color: #334b65; background: #f5f8ff; font-size: 8px; line-height: 1.55; }
.asset-assistant-proposal strong { display: block; margin-bottom: 4px; color: var(--blue); font-size: 9px; }
.asset-assistant-proposal code { display: block; margin-top: 6px; padding: 6px; border-radius: 4px; overflow-wrap: anywhere; color: #40566d; background: #e9eff8; font: 7px/1.45 ui-monospace, monospace; }
.assistant-confirm-actions { margin-top: 8px; display: flex; justify-content: flex-end; gap: 6px; }
.assistant-confirm-actions .button { min-height: 32px; font-size: 8px; }
.asset-assistant-job { margin-top: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: #f8fafc; }
.asset-job-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 8px; }
.asset-job-head strong { color: #334b65; }
.asset-job-head span { color: var(--muted); }
.asset-job-progress { height: 5px; margin: 7px 0; overflow: hidden; border-radius: 999px; background: #dde4ec; }
.asset-job-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--blue); transition: width .2s; }
.asset-job-log { max-height: 118px; overflow-y: auto; display: grid; gap: 4px; font: 7px/1.45 ui-monospace, monospace; color: #53677c; }
.asset-job-log div::before { content: "› "; color: var(--blue); }
.asset-assistant-job.failed { border-color: #f0b3a8; background: #fff5f2; }

.task-table { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.task-row { min-height: 68px; padding: 12px 15px; display: grid; grid-template-columns: minmax(220px,1.5fr) 1fr 100px 100px 28px; gap: 14px; align-items: center; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: #f7faff; box-shadow: inset 3px 0 var(--blue); }
.task-name strong, .task-name small { display: block; }
.task-name strong { font-size: 11px; }
.task-name small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.task-progress { height: 6px; overflow: hidden; border-radius: 999px; background: #e7ebef; }
.task-progress span { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.task-stage, .task-status { font-size: 9px; }
.task-status { color: var(--mint); font-weight: 700; }
.task-row svg { width: 15px; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 40; padding: 10px 15px; border-radius: 7px; color: #fff; background: #17212d; box-shadow: 0 8px 24px rgba(0,0,0,.18); font-size: 10px; opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: .18s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.asset-upload-dialog { width: min(440px, calc(100vw - 28px)); padding: 0; border: 0; border-radius: 8px; color: var(--ink); background: #fff; box-shadow: 0 22px 64px rgba(9,18,28,.28); }
.asset-upload-dialog::backdrop { background: rgba(16,24,34,.55); backdrop-filter: blur(3px); }
.asset-upload-form { padding: 20px; }
.dialog-heading { margin-bottom: 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-heading h2 { margin: 0; font-size: 18px; }
.dialog-close { width: 32px; height: 32px; border: 0; border-radius: 6px; display: grid; place-items: center; color: var(--muted); background: transparent; }
.dialog-close:hover { color: var(--ink); background: #eef1f4; }
.dialog-close svg { width: 17px; }
.dialog-file { min-height: 66px; margin-bottom: 15px; padding: 11px; display: flex; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 7px; background: #f8fafc; }
.dialog-file strong, .dialog-file small { display: block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog-file strong { font-size: 11px; }
.dialog-file small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.asset-upload-form .field { margin-top: 12px; }
.dialog-error { margin: 12px 0 0; padding: 9px 10px; border: 1px solid #f3b6aa; border-radius: 6px; color: #a23e2c; background: #fff5f2; font-size: 9px; line-height: 1.5; }
.dialog-actions { margin-top: 18px; display: flex; justify-content: flex-end; gap: 8px; }
.dialog-actions .button:disabled { opacity: .55; cursor: wait; }

@media (max-width: 1080px) {
  .create-layout { grid-template-columns: 1fr; }
  .preview-surface { position: static; }
  .preview-stage.portrait { width: 44%; }
  .project-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .asset-layout { grid-template-columns: 190px minmax(360px,1fr); }
  .asset-inspector { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 720px) {
  .app-shell { grid-template-columns: 1fr; padding-bottom: 66px; }
  .rail { position: fixed; top: auto; bottom: 0; width: 100%; height: 62px; padding: 5px 8px; flex-direction: row; justify-content: center; border: 0; border-top: 1px solid #293442; }
  .brand { display: none; }
  .rail-nav { width: auto; display: flex; gap: 4px; }
  .rail-button { width: 58px; min-height: 50px; }
  .rail-button.active::before { left: 12px; right: 12px; top: -5px; bottom: auto; width: auto; height: 3px; }
  .rail-home { margin: 0 0 0 4px; }
  .topbar { height: 58px; padding: 0 16px; }
  .crumb > span, .crumb svg, .save-state { display: none; }
  .top-actions .button { width: 38px; padding: 0; font-size: 0; }
  .workspace { padding: 19px 14px 30px; }
  .page-heading { min-height: 54px; }
  .page-heading h1 { font-size: 21px; }
  .field-grid.three { grid-template-columns: 1fr 1fr; }
  .field-grid.three .wide { grid-column: 1 / -1; }
  .form-section { padding: 18px 16px; }
  .section-heading { align-items: center; }
  .ratio-control, .mode-control { grid-template-columns: 1fr; }
  .choice-strip { grid-auto-columns: 46%; }
  .stage-wrap { min-height: 280px; padding: 14px; }
  .preview-stage.portrait { width: 58%; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search { width: 100%; }
  .project-grid { grid-template-columns: 1fr; }
  .asset-layout { min-height: 0; grid-template-columns: 1fr; }
  .asset-browser, .asset-inspector { border: 0; border-bottom: 1px solid var(--line); }
  .asset-list { grid-auto-flow: column; grid-auto-columns: 155px; overflow-x: auto; }
  .asset-canvas { grid-template-rows: 50px 350px 104px; }
  .task-row { grid-template-columns: 1fr 76px 20px; }
  .task-progress, .task-stage { display: none; }
  .asset-chat-drawer { left: 10px; right: 10px; bottom: 72px; width: auto; max-height: calc(100vh - 92px); }
}
