@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("/fonts/bricolage-latin.woff2") format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/instrument-serif.woff2") format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap; src: url("/fonts/instrument-serif-italic.woff2") format("woff2"); }
:root {
  --paper: #f3efe6;
  --paper-deep: #e9e2d5;
  --surface: #fffdf8;
  --surface-soft: #f8f4ec;
  --ink: #201e1a;
  --ink-soft: #625d54;
  --muted: #8b8478;
  --line: #ddd5c7;
  --line-strong: #c7bdad;
  --red: #c84b31;
  --red-dark: #a93a24;
  --blue: #2e4dbb;
  --green: #657a58;
  --shadow: 0 18px 50px rgba(55, 43, 28, 0.08);
  --font-display: "Bricolage Grotesque", "Microsoft YaHei", "PingFang SC", sans-serif;
  --font-serif: "Instrument Serif", "Songti SC", "SimSun", serif;
  --font-body: "Bricolage Grotesque", "Microsoft YaHei", "PingFang SC", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--font-body); font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
a { color: inherit; }
img { display: block; max-width: 100%; }
[hidden], .hidden { display: none !important; }
.paper-texture { position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(circle at 12% 8%, rgba(200,75,49,.055), transparent 28%), radial-gradient(circle at 88% 18%, rgba(46,77,187,.045), transparent 25%), repeating-linear-gradient(0deg, rgba(67,52,34,.018) 0, rgba(67,52,34,.018) 1px, transparent 1px, transparent 4px); }
.topbar { position: sticky; top: 0; z-index: 40; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 72px; padding: 12px clamp(20px,4vw,64px); border-bottom: 1px solid rgba(120,105,84,.18); background: rgba(243,239,230,.9); backdrop-filter: blur(16px); }
.brand { display: inline-flex; align-items: center; gap: 11px; width: max-content; padding: 0; border: 0; background: none; cursor: pointer; }
.brand-seal { display: grid; width: 38px; height: 42px; place-items: center; border-radius: 12px 10px 13px 9px; color: #fff9ee; background: var(--red); font-family: var(--font-serif); font-size: 24px; transform: rotate(-2deg); }
.brand-type { font-size: 16px; font-weight: 800; letter-spacing: .03em; line-height: 1; }
.brand-type small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; letter-spacing: .25em; }
.main-nav { display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,253,248,.55); }
.nav-btn { padding: 8px 18px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-soft); cursor: pointer; font-size: 13px; }
.nav-btn.active { color: #fffdf8; background: var(--ink); }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
.api-status { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-soft); font-size: 12px; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #b2a899; }
.api-status.ready .status-dot { background: #6d8b5d; box-shadow: 0 0 0 3px rgba(109,139,93,.12); }
.api-status.missing .status-dot { background: var(--red); }
.text-btn { padding: 0; border: 0; background: none; color: var(--blue); cursor: pointer; font-size: 12px; white-space: nowrap; }
.text-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.subtle-btn { margin-top: 8px; color: var(--muted); }
.danger-text { color: var(--red); }
.primary-btn, .secondary-btn, .filter-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; text-decoration: none; transition: transform .16s ease, background .16s ease, border-color .16s ease; }
.primary-btn { border: 1px solid var(--ink); color: #fffdf8; background: var(--ink); }
.primary-btn:hover { background: #37332c; transform: translateY(-1px); }
.primary-btn:disabled { opacity: .55; cursor: wait; transform: none; }
.secondary-btn { border: 1px solid var(--line-strong); color: var(--ink); background: transparent; }
.secondary-btn:hover { border-color: var(--ink); background: rgba(255,253,248,.7); }
.filter-btn { min-height: 40px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); }
.filter-btn.active { border-color: var(--red); color: var(--red-dark); background: rgba(200,75,49,.06); }
.full-width { width: 100%; }
.button-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.eyebrow { margin: 0 0 12px; color: var(--red); font-size: 10px; font-weight: 700; letter-spacing: .18em; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading h1 { margin: 0; font-size: clamp(36px,4vw,56px); line-height: 1.05; letter-spacing: -.045em; }
.page-heading p:not(.eyebrow) { max-width: 520px; margin: 0 0 6px; color: var(--ink-soft); }
.page-description { margin: -12px 0 28px; color: var(--ink-soft); }
main { width: min(1540px, calc(100% - clamp(28px,6vw,96px))); margin: 0 auto; }

.hero { display: grid; grid-template-columns: 1.08fr .92fr; align-items: center; min-height: 520px; gap: clamp(40px,7vw,110px); padding: 58px 0 54px; }
.hero-copy h1 { margin: 0; font-size: clamp(48px,5.3vw,82px); font-weight: 700; line-height: 1.02; letter-spacing: -.055em; }
.hero-description { max-width: 590px; margin: 26px 0 0; color: var(--ink-soft); font-size: 16px; line-height: 1.9; }
.hero-actions { display: flex; gap: 12px; margin-top: 30px; }
.hero-stats { display: flex; gap: clamp(24px,4vw,52px); margin-top: 42px; padding-top: 22px; border-top: 1px solid var(--line); width: max-content; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-family: var(--font-serif); font-size: 34px; font-weight: 400; line-height: 1; }
.hero-stats span { margin-top: 7px; color: var(--muted); font-size: 11px; }
.hero-art { position: relative; height: 420px; }
.art-card { position: absolute; overflow: hidden; border: 8px solid var(--surface); background: var(--surface); box-shadow: var(--shadow); }
.art-card img { width: 100%; height: 100%; object-fit: cover; }
.art-card-one { width: 54%; height: 66%; left: 4%; top: 4%; transform: rotate(-5deg); }
.art-card-two { width: 48%; height: 58%; right: 2%; top: 16%; transform: rotate(5deg); }
.art-card-three { width: 38%; height: 43%; left: 31%; bottom: 0; transform: rotate(-1deg); }
.art-note { position: absolute; right: 0; bottom: 6px; color: var(--muted); font-size: 9px; letter-spacing: .16em; writing-mode: vertical-rl; }
.library-shell { padding: 34px 0 60px; border-top: 1px solid var(--line-strong); }
.library-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.library-heading h2 { margin: 0; font-size: 28px; letter-spacing: -.03em; }
.library-heading .eyebrow { margin-bottom: 7px; }
.library-tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.library-tab { padding: 9px 16px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-soft); cursor: pointer; }
.library-tab span { margin-left: 4px; color: var(--muted); font-size: 10px; }
.library-tab.active { background: var(--surface); color: var(--ink); box-shadow: 0 2px 8px rgba(63,48,30,.07); }
.filter-bar { display: grid; grid-template-columns: minmax(280px,1fr) 230px auto; gap: 12px; }
.search-box { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.search-box span { color: var(--muted); font-size: 11px; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 13px; }
.search-box:focus-within { border-color: var(--ink-soft); }
.compact-select, .full-select, .mini-select { border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); outline: none; }
.compact-select { min-height: 44px; padding: 0 12px; }
.full-select { width: 100%; min-height: 40px; padding: 8px 10px; }
.mini-select { padding: 3px 7px; font-size: 11px; }
.result-meta { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin: 8px 0 12px; color: var(--muted); font-size: 12px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(218px,1fr)); gap: 18px; }
.asset-card { position: relative; overflow: hidden; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-align: left; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.asset-card:hover { transform: translateY(-4px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.asset-thumb { position: relative; overflow: hidden; background: #ebe5da; }
.asset-thumb img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; transition: transform .35s ease; }
.asset-card.layout .asset-thumb img, .asset-card.color .asset-thumb img { aspect-ratio: 4 / 3; }
.asset-card:hover .asset-thumb img { transform: scale(1.025); }
.favorite-btn { position: absolute; top: 10px; right: 10px; z-index: 2; display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid rgba(255,255,255,.5); border-radius: 50%; color: var(--ink); background: rgba(255,253,248,.88); cursor: pointer; font-size: 16px; }
.favorite-btn.active { color: var(--red); }
.asset-body { padding: 14px 15px 16px; }
.asset-id { margin-bottom: 5px; color: var(--red); font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.asset-title { display: block; overflow: hidden; font-weight: 600; font-size: 13px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.asset-subtitle { display: -webkit-box; overflow: hidden; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.55; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.asset-tags { display: flex; gap: 5px; margin-top: 11px; overflow: hidden; }
.asset-tag { padding: 2px 7px; border-radius: 4px; color: var(--ink-soft); background: var(--surface-soft); font-size: 9px; white-space: nowrap; }
.load-more-wrap { display: flex; justify-content: center; padding: 34px 0 10px; }
.empty-state { padding: 80px 20px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 14px; }
.empty-state h3 { margin: 0 0 8px; font-size: 20px; }
.empty-state p { margin: 0 0 20px; color: var(--muted); }
.site-footer { display: flex; justify-content: space-between; gap: 24px; padding: 26px 0 36px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.site-footer p { margin: 0; }
.site-footer a { color: var(--ink-soft); }

.studio-heading { padding-top: 42px; }
.scene-tabs { display: grid; grid-template-columns: repeat(5,1fr); gap: 8px; margin-bottom: 18px; }
.scene-tab { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,253,248,.5); cursor: pointer; text-align: left; }
.scene-tab strong { font-size: 13px; }
.scene-tab span { color: var(--muted); font-size: 10px; }
.scene-tab:hover { border-color: var(--line-strong); background: var(--surface); }
.scene-tab.active { border-color: var(--ink); color: #fffdf8; background: var(--ink); }
.scene-tab.active span { color: rgba(255,253,248,.6); }
.studio-layout { display: grid; grid-template-columns: 330px minmax(340px,1fr) 370px; gap: 16px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 14px; background: rgba(255,253,248,.86); box-shadow: 0 8px 28px rgba(63,48,30,.035); }
.controls-panel { padding: 20px; }
.prompt-panel { padding: 20px; min-width: 0; }
.result-panel { padding: 20px; }
.panel-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.panel-title h2 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.panel-title p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.small-muted { color: var(--muted); font-size: 10px; }
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field label, .field-label-row label { display: block; margin-bottom: 7px; color: var(--ink-soft); font-size: 11px; font-weight: 600; }
.field textarea, .field input { width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; outline: none; color: var(--ink); background: var(--surface); font-size: 12px; line-height: 1.65; resize: vertical; }
.field textarea:focus, .field input:focus { border-color: var(--ink-soft); box-shadow: 0 0 0 3px rgba(70,62,50,.05); }
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.field-label-row label { margin-bottom: 0; }
.field-hint { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.selected-style { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); cursor: pointer; text-align: left; }
.selected-style-image { flex: 0 0 46px; width: 46px; height: 46px; overflow: hidden; border-radius: 6px; background: var(--paper-deep); }
.selected-style-image img { width: 100%; height: 100%; object-fit: cover; }
.selected-style-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; }
.selected-style-copy strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.selected-style-copy small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.change-link { color: var(--blue); font-size: 10px; }
.color-options { display: flex; flex-wrap: wrap; gap: 7px; max-height: 116px; overflow-y: auto; padding: 2px; }
.color-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; font-size: 9px; }
.color-chip.active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.color-dot { width: 10px; height: 10px; border: 1px solid rgba(0,0,0,.1); border-radius: 50%; }
.prompt-editor { width: 100%; min-height: 510px; padding: 18px; resize: vertical; border: 1px solid var(--line); border-radius: 10px; outline: none; color: var(--ink); background: var(--surface-soft); font-size: 13px; line-height: 1.9; }
.prompt-editor:focus { border-color: var(--ink-soft); background: var(--surface); }
.prompt-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.prompt-footer > span { color: var(--muted); font-size: 10px; }
.prompt-tip { display: flex; gap: 10px; margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; line-height: 1.6; }
.prompt-tip strong { flex: 0 0 auto; color: var(--ink-soft); }
.result-stage { position: relative; display: grid; min-height: 480px; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.result-empty, .result-loading, .result-error { max-width: 290px; padding: 30px; text-align: center; }
.empty-mark { display: grid; width: 54px; height: 60px; margin: 0 auto 18px; place-items: center; border-radius: 16px 13px 17px 12px; color: rgba(255,253,248,.8); background: var(--red); font-family: var(--font-serif); font-size: 30px; transform: rotate(-3deg); }
.result-empty h3, .result-loading h3, .result-error h3 { margin: 0 0 8px; font-size: 17px; }
.result-empty p, .result-loading p, .result-error p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.result-error p { margin-bottom: 16px; color: var(--red-dark); white-space: pre-wrap; word-break: break-word; }
.loading-ring { width: 42px; height: 42px; margin: 0 auto 20px; border: 2px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.result-image-wrap { width: 100%; height: 100%; min-height: 480px; }
.image-open-btn { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: #e8e1d6; cursor: zoom-in; }
.image-open-btn img { width: 100%; height: 100%; min-height: 480px; max-height: 680px; object-fit: contain; }
.result-actions { display: flex; align-items: center; gap: 9px; margin-top: 14px; flex-wrap: wrap; }
.result-actions .primary-btn, .result-actions .secondary-btn { min-height: 38px; padding: 8px 14px; font-size: 11px; }
.result-actions .text-btn { margin-left: auto; }
.result-panel .result-meta { display: block; margin: 12px 0 0; line-height: 1.7; }

.plan-section { margin-top: 30px; padding-top: 28px; border-top: 1px solid var(--line-strong); }
.plan-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.plan-header h2 { margin: 0; font-size: 28px; }
.plan-header p:not(.eyebrow) { max-width: 760px; margin: 8px 0 0; color: var(--ink-soft); font-size: 12px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(390px,1fr)); gap: 16px; }
.plan-card { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.plan-card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.plan-number { display: grid; flex: 0 0 30px; width: 30px; height: 30px; place-items: center; border-radius: 50%; color: var(--red-dark); background: rgba(200,75,49,.08); font-size: 11px; font-weight: 700; }
.plan-card-title { flex: 1; min-width: 0; }
.plan-card-title h3 { margin: 0; font-size: 14px; }
.plan-card-title p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.plan-layout { color: var(--blue); font-size: 10px; white-space: nowrap; }
.plan-anchor { margin: 0 0 12px; padding: 9px 11px; border-left: 2px solid var(--line-strong); color: var(--ink-soft); background: var(--surface-soft); font-size: 10px; }
.plan-prompt { width: 100%; min-height: 180px; padding: 12px; resize: vertical; border: 1px solid var(--line); border-radius: 8px; outline: none; background: var(--surface-soft); font-size: 11px; line-height: 1.75; }
.plan-prompt:focus { border-color: var(--ink-soft); background: var(--surface); }
.plan-card-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.plan-card-actions .primary-btn, .plan-card-actions .secondary-btn { min-height: 36px; padding: 7px 13px; font-size: 11px; }
.plan-status { margin-left: auto; color: var(--muted); font-size: 10px; }
.plan-status.done { color: var(--green); }
.plan-image { margin-top: 14px; overflow: hidden; border-radius: 8px; background: var(--paper-deep); }
.plan-image img { width: 100%; max-height: 420px; object-fit: contain; }
.plan-image-actions { display: flex; gap: 12px; margin-top: 8px; }
.history-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(260px,1fr)); gap: 18px; }
.history-card { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.history-image { display: block; width: 100%; padding: 0; border: 0; background: var(--paper-deep); cursor: zoom-in; }
.history-image img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.history-body { padding: 14px 16px 16px; }
.history-body h3 { overflow: hidden; margin: 0 0 5px; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.history-meta { color: var(--muted); font-size: 10px; }
.history-prompt { display: -webkit-box; overflow: hidden; margin: 10px 0 13px; color: var(--ink-soft); font-size: 11px; line-height: 1.6; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.history-actions { display: flex; align-items: center; gap: 12px; }
.history-actions .text-btn { font-size: 11px; }
.detail-dialog, .settings-dialog, .image-dialog { border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--surface); box-shadow: 0 30px 100px rgba(34,27,18,.28); }
.detail-dialog { width: min(980px,calc(100vw - 36px)); max-height: 90vh; padding: 0; overflow: auto; }
.settings-dialog { width: min(520px,calc(100vw - 36px)); padding: 34px; }
.image-dialog { width: min(1400px,calc(100vw - 30px)); max-height: 94vh; padding: 12px; overflow: hidden; background: #e7e0d5; }
.image-dialog img { width: 100%; max-height: 88vh; object-fit: contain; }
.dialog-close { position: absolute; top: 14px; right: 16px; z-index: 3; display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,253,248,.9); cursor: pointer; font-size: 22px; line-height: 1; }
.dialog-description { color: var(--ink-soft); font-size: 12px; line-height: 1.8; }
.server-key-state { margin: 18px 0; padding: 11px 13px; border-radius: 8px; color: var(--ink-soft); background: var(--surface-soft); font-size: 11px; }
.server-key-state.ready { color: #49613e; background: rgba(109,139,93,.1); }
.checkbox-row { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 12px; }
.dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; }
.detail-layout { display: grid; grid-template-columns: .9fr 1.1fr; min-height: 520px; }
.detail-media { display: flex; align-items: center; justify-content: center; padding: 28px; background: var(--surface-soft); }
.detail-media img { width: 100%; max-height: 650px; object-fit: contain; }
.detail-copy { padding: 42px 36px 34px; }
.detail-kicker { color: var(--red); font-size: 11px; font-weight: 700; letter-spacing: .1em; }
.detail-copy h2 { margin: 10px 0 8px; font-size: 28px; line-height: 1.2; letter-spacing: -.035em; }
.detail-reference { margin: 0 0 22px; color: var(--muted); font-size: 12px; }
.detail-section { margin-top: 22px; }
.detail-section h3 { margin: 0 0 8px; font-size: 12px; }
.detail-section p { margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.85; white-space: pre-wrap; }
.detail-prompt-box { max-height: 260px; overflow: auto; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); font-size: 11px; line-height: 1.8; white-space: pre-wrap; }
.detail-actions { display: flex; gap: 10px; margin-top: 26px; flex-wrap: wrap; }
.toast-container { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { max-width: 380px; padding: 12px 16px; border-radius: 9px; color: #fffdf8; background: var(--ink); box-shadow: var(--shadow); font-size: 12px; animation: toast-in .2s ease-out; }
.toast.error { background: #9e3523; }
.toast.success { background: #49613e; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 1280px) {
  .studio-layout { grid-template-columns: 310px minmax(320px,1fr); }
  .result-panel { grid-column: 1 / -1; }
  .result-stage, .result-image-wrap { min-height: 360px; }
  .result-image-wrap img { max-height: 560px; }
  .prompt-editor { min-height: 470px; }
}
@media (max-width: 980px) {
  .topbar { grid-template-columns: 1fr auto; }
  .main-nav { grid-row: 2; grid-column: 1 / -1; justify-self: center; margin-top: 10px; }
  .hero { grid-template-columns: 1fr; padding-top: 40px; }
  .hero-art { display: none; }
  .hero-copy h1 { font-size: clamp(44px,9vw,68px); }
  .scene-tabs { grid-template-columns: repeat(3,1fr); }
  .studio-layout { grid-template-columns: 1fr; }
  .controls-panel, .prompt-panel, .result-panel { grid-column: auto; }
  .prompt-editor { min-height: 360px; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-media { max-height: 420px; }
  .detail-copy { padding: 28px; }
  .plan-header { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 680px) {
  main { width: calc(100% - 28px); }
  .topbar { padding: 10px 14px; }
  .header-actions { gap: 10px; }
  .api-status #apiStatusText { display: none; }
  .brand-type { font-size: 13px; }
  .brand-seal { width: 32px; height: 36px; font-size: 20px; }
  .nav-btn { padding: 7px 13px; }
  .hero { min-height: auto; padding: 38px 0; }
  .hero-description { font-size: 14px; }
  .hero-stats { width: 100%; justify-content: space-between; gap: 12px; }
  .library-heading { align-items: flex-start; flex-direction: column; }
  .library-tabs { width: 100%; }
  .library-tab { flex: 1; padding: 8px 6px; }
  .filter-bar { grid-template-columns: 1fr auto; }
  .search-box { grid-column: 1 / -1; }
  .gallery-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .asset-body { padding: 10px; }
  .asset-title { font-size: 11px; }
  .asset-subtitle, .asset-tags { display: none; }
  .scene-tabs { grid-template-columns: repeat(2,1fr); }
  .scene-tab { padding: 11px 12px; }
  .field-row { grid-template-columns: 1fr; }
  .prompt-footer { align-items: flex-start; flex-direction: column; }
  .prompt-footer .button-row { width: 100%; justify-content: flex-end; }
  .plan-grid { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; gap: 8px; }
  .detail-copy { padding: 24px 20px; }
  .settings-dialog { padding: 28px 22px; }
}

.asset-open { display: block; width: 100%; padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; }
.text-btn:disabled { opacity: .45; cursor: wait; text-decoration: none; }
.history-actions a { text-decoration: none; }
.history-actions a:hover { text-decoration: underline; }
.plan-card .primary-btn:disabled, .plan-card .secondary-btn:disabled { opacity: .55; cursor: wait; }
.history-actions .danger-text { margin-left: auto; }

.provider-bar { display: grid; grid-template-columns: minmax(130px,.75fr) minmax(200px,1.25fr); gap: 10px; margin: 4px 0 8px; }
.provider-bar label > span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.provider-bar input { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); outline: none; font-size: 12px; }
.provider-bar input:focus, .provider-bar select:focus { border-color: var(--ink-soft); }
.provider-hint { min-height: 30px; margin: 0 0 10px; }
.cover-ratio-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; color: var(--ink-soft); font-size: 12px; }
.characters-dialog { width: min(840px,calc(100vw - 36px)); max-height: 90vh; overflow: auto; }
.character-create-layout { display: grid; grid-template-columns: 210px 1fr; gap: 22px; margin-top: 22px; }
.character-upload-preview { display: flex; align-items: center; justify-content: center; min-height: 250px; overflow: hidden; border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--surface-soft); color: var(--muted); text-align: center; font-size: 11px; }
.character-upload-preview img { width: 100%; height: 100%; min-height: 250px; object-fit: cover; }
.character-form .field { margin-bottom: 13px; }
.character-create-actions { justify-content: flex-end; }
.character-list-heading { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.character-list-heading h3 { margin: 0; font-size: 15px; }
.character-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.character-empty { grid-column: 1 / -1; padding: 20px; border-radius: 10px; background: var(--surface-soft); color: var(--muted); text-align: center; font-size: 12px; }
.character-card { display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.character-card img { width: 84px; height: 104px; border-radius: 7px; object-fit: cover; background: var(--paper-deep); }
.character-card-copy { min-width: 0; }
.character-card-copy h4 { margin: 1px 0 5px; font-size: 13px; }
.character-card-copy p { display: -webkit-box; overflow: hidden; margin: 0 0 8px; color: var(--ink-soft); font-size: 11px; line-height: 1.55; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.character-card-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.current-character-note { margin-top: 6px; color: var(--green); font-size: 11px; }
@media (max-width: 680px) {
  .provider-bar, .character-create-layout { grid-template-columns: 1fr; }
  .character-upload-preview { min-height: 180px; }
  .character-upload-preview img { max-height: 260px; }
  .character-list { grid-template-columns: 1fr; }
  .character-create-actions { justify-content: stretch; }
  .character-create-actions button { flex: 1; }
}

.plan-error, .plan-warning { margin: 8px 0; padding: 8px 10px; border-radius: 7px; font-size: 11px; line-height: 1.6; }
.plan-error { color: #8d3222; background: rgba(200,75,49,.08); }
.plan-warning { color: #66502a; background: rgba(212,160,23,.1); }
.cover-ratio-row select:disabled { opacity: .45; cursor: not-allowed; }

.panel, .field, .field-row > *, .provider-bar > label { min-width: 0; }
input, textarea, select { min-width: 0; max-width: 100%; }
@media (max-width: 980px) {
  .studio-layout { grid-template-columns: minmax(0, 1fr); }
}
