:root {
  color-scheme: light;
  --page: #ffffff;
  --surface: #ffffff;
  --surface-soft: #fbfaff;
  --surface-selected: #f4f0ff;
  --ink: #1f2633;
  --muted: #727b8f;
  --muted-light: #a3a9b6;
  --line: #e6e2ee;
  --line-strong: #d9d2ed;
  --purple: #7357f6;
  --purple-hover: #6548ee;
  --purple-soft: #eee9ff;
  --red: #ff6e5c;
  --green: #36a97a;
  --shadow: 0 12px 30px rgba(38, 29, 80, .06);
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--page); font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button { border: 0; cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(115, 87, 246, .18); outline-offset: 1px; }
.is-hidden { display: none !important; }

.app-shell { display: flex; min-height: 100vh; background: #fff; }
.sidebar { position: sticky; top: 0; display: flex; width: 268px; height: 100vh; flex: 0 0 268px; flex-direction: column; padding: 23px 14px 14px; border-right: 1px solid #ebe8f0; background: #fff; }
.brand { display: flex; align-items: center; padding: 0 10px 27px; }
.brand-name { color: #2e3151; font-family: Manrope, "Noto Sans SC", sans-serif; font-size: 22px; font-weight: 800; letter-spacing: .02em; }
.side-nav { display: grid; gap: 4px; }
.side-nav-item { display: flex; height: 44px; align-items: center; gap: 12px; padding: 0 16px; border-radius: 6px; color: #202938; background: transparent; text-align: left; font-size: 14px; transition: background 150ms ease, color 150ms ease; }
.side-nav-item:hover { background: #f7f5fc; color: var(--purple); }
.side-nav-item.active { color: var(--purple); background: #eae3ff; font-weight: 600; }
.nav-icon { width: 18px; color: #667187; font-size: 18px; text-align: center; }
.side-nav-item.active .nav-icon { color: var(--purple); }
.nav-divider { height: 1px; margin: 9px 8px; background: #eceaf1; }
.sidebar-note { display: flex; align-items: center; gap: 7px; margin: auto 11px 14px; padding: 10px; border: 1px solid #eeeaf8; border-radius: 8px; color: #7d7699; background: #faf8ff; font-size: 10px; }
.note-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.sidebar-footer { padding: 13px 10px 0; border-top: 1px solid #eeeef3; color: #b3b6c0; font-size: 10px; text-align: center; }

.main-content { display: grid; width: auto; min-width: 0; flex: 1; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .95fr); align-content: start; column-gap: 20px; margin: 0; padding: 0 20px 38px; }
.main-content.home-view { grid-template-columns: minmax(0, 1fr); }
.main-content.results-view { grid-template-columns: minmax(0, 1fr); }
.topbar { display: flex; height: 72px; grid-column: 1 / -1; align-items: center; justify-content: space-between; margin: 0 -20px; padding: 0 28px; border-bottom: 1px solid #f0eef4; }
.topbar-title { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.topbar-kicker { color: #a3a8b5; }
.topbar-separator { color: #d0ccd8; }
.topbar-title strong { color: #353b4a; font-weight: 600; }
.api-button { position: fixed; z-index: 40; top: 14px; right: 14px; display: inline-flex; align-items: center; gap: 7px; padding: 10px 13px; border: 1px solid transparent; border-radius: 7px; color: #6d6589; background: #fff; font-size: 11px; }
.api-button:hover { color: var(--purple); background: var(--purple-soft); }

.home-workspace { grid-column: 1; width: min(100%, 1100px); margin: 0 auto; padding: 46px 0 38px; }
.main-content:not(.home-view) .home-workspace { display: none; }
.main-content.home-view .generator-card, .main-content.home-view .result-section { display: none; }
.home-intro { margin-bottom: 26px; text-align: center; }
.home-intro h1 { margin: 0; color: #202737; font-family: Manrope, "Noto Sans SC", sans-serif; font-size: 34px; font-weight: 800; line-height: 1.35; }
.home-intro p { margin: 9px 0 0; color: #7c8494; font-size: 13px; }
.home-model-picker { margin-top: 22px; padding: 18px 0 4px; }
.home-model-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.home-model-heading h2 { margin: 0; color: #222a39; font-size: 15px; font-weight: 700; }
.home-model-heading span { color: #a0a6b2; font-size: 10px; }
.home-model-switch { display: flex; width: min(100%, 360px); gap: 4px; margin: 0 0 14px; padding: 4px; border: 1px solid #ece9f2; border-radius: 999px; background: #f8f7fb; }
.home-model-option { min-width: 0; height: 38px; flex: 1; border: 1px solid transparent; border-radius: 999px; color: #626b7c; background: transparent; font-size: 12px; transition: color 150ms ease, background 150ms ease, border-color 150ms ease; }
.home-model-option:hover { color: var(--purple); }
.home-model-option.selected { border-color: var(--purple); color: var(--purple); background: #fff; box-shadow: 0 2px 7px rgba(115,87,246,.1); font-weight: 600; }
.home-submodel-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.home-submodel-card { position: relative; min-height: 68px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fbfaff; text-align: left; transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease; }
.home-submodel-card:hover { border-color: #bdb0ef; background: #fbf9ff; }
.home-submodel-card.selected { border: 2px solid var(--purple); padding: 10px 12px; background: #fbf9ff; box-shadow: 0 4px 12px rgba(115,87,246,.07); }
.home-submodel-card.selected::after { position: absolute; right: 0; bottom: 0; width: 0; height: 0; border-bottom: 16px solid var(--purple); border-left: 16px solid transparent; content: ""; }
.home-submodel-card.selected::before { position: absolute; z-index: 1; right: 2px; bottom: 0; content: "✓"; color: #fff; font-size: 9px; font-weight: 700; }
.home-submodel-name { display: block; color: #242b3a; font-family: Manrope, "Noto Sans SC", sans-serif; font-size: 12px; font-weight: 700; }
.home-submodel-card.selected .home-submodel-name { color: var(--purple); }
.home-submodel-desc { display: block; margin-top: 4px; color: #8b92a1; font-size: 10px; line-height: 1.35; }
.home-submodel-badge { position: absolute; top: -7px; right: -4px; padding: 2px 6px; border-radius: 5px; color: #fff; background: var(--red); font-family: Manrope, sans-serif; font-size: 9px; font-weight: 700; }
.home-composer { display: flex; min-height: 300px; flex-direction: column; padding: 17px 19px 14px; border: 1px solid #b8aafa; border-radius: 14px; background: #fff; box-shadow: 0 13px 32px rgba(56, 44, 96, .06); }
.home-composer-toolbar { display: flex; align-items: center; gap: 10px; }
.home-composer-toolbar .home-thumb-grid { display: flex; flex: 0 1 auto; flex-wrap: wrap; gap: 8px; margin: 0; }
.home-composer-toolbar .home-thumb-grid.is-hidden { display: none; }
.home-composer-toolbar .home-upload-count { margin-left: auto; }
.home-composer .upload-trigger { width: 42px; height: 42px; }
.home-composer-toolbar > .upload-trigger { transform: translateY(-4px); }
.home-upload-count { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid #d8d1eb; border-radius: 8px; color: #777e8c; font-size: 11px; }
.home-upload-count span { color: var(--purple); font-size: 15px; }
.home-upload-count b { color: #394256; font-weight: 500; }
.home-composer textarea { display: block; width: 100%; min-height: 150px; flex: 1; padding: 14px 2px; resize: vertical; border: 0; outline: 0; color: #303848; background: transparent; font-size: 14px; line-height: 1.7; }
.home-composer textarea::placeholder { color: #a1a8b8; }
.home-composer-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid #f0edf5; color: #a3a9b6; font-size: 10px; }
.home-prompt-count b { color: #727b8f; font-weight: 500; }
.home-composer-action { display: flex; justify-content: flex-end; padding-top: 8px; }
.home-generate-button { display: inline-flex; min-width: 150px; height: 42px; align-items: center; justify-content: center; gap: 8px; border-radius: 8px; color: #fff; background: var(--purple); font-size: 13px; font-weight: 700; transition: background 150ms ease, transform 150ms ease; }
.home-generate-button:hover:not(:disabled) { background: var(--purple-hover); transform: translateY(-1px); }
.home-generate-button:disabled { cursor: not-allowed; opacity: .45; }
.home-generate-button span { font-size: 15px; }
.home-thumb-grid { margin-top: 10px; }

.main-content.ecommerce-view { grid-template-columns: minmax(0, 1fr); }
.main-content.ecommerce-view .home-workspace, .main-content.ecommerce-view .chat-workspace, .main-content.ecommerce-view .generator-card, .main-content.ecommerce-view .result-section { display: none; }
.ecommerce-workspace { grid-column: 1; width: min(100%, 1100px); margin: 0 auto; padding: 34px 0 42px; }
.ecommerce-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.ecommerce-header h1 { margin: 0; color: #202737; font-family: Manrope, "Noto Sans SC", sans-serif; font-size: 30px; font-weight: 800; }
.ecommerce-header p { margin: 7px 0 0; color: #7c8494; font-size: 12px; }
.ecommerce-badge { padding: 6px 10px; border: 1px solid #ddd4ff; border-radius: 999px; color: var(--purple); background: var(--purple-soft); font-size: 10px; }
.ecommerce-type-section, .ecommerce-form-card { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.ecommerce-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.ecommerce-section-heading h2, .ecommerce-form-heading h2 { margin: 0; color: #252d3c; font-size: 15px; font-weight: 700; }
.ecommerce-section-heading span { color: #a0a6b2; font-size: 10px; }
.ecommerce-type-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.ecommerce-type-card { display: flex; min-height: 72px; align-items: center; gap: 10px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fbfaff; text-align: left; transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease; }
.ecommerce-type-card:hover { border-color: #bdb0ef; background: #fbf9ff; }
.ecommerce-type-card.selected { border: 2px solid var(--purple); padding: 9px 10px; background: #f8f5ff; box-shadow: 0 4px 12px rgba(115,87,246,.08); }
.ecommerce-type-card.selected b { color: var(--purple); }
.ecommerce-type-icon { display: grid; width: 31px; height: 31px; flex: 0 0 31px; place-items: center; border-radius: 8px; color: var(--purple); background: #eee9ff; font-size: 16px; }
.ecommerce-type-card b, .ecommerce-type-card small { display: block; }
.ecommerce-type-card b { color: #303848; font-size: 12px; font-weight: 700; }
.ecommerce-type-card small { margin-top: 4px; color: #8b92a1; font-size: 9px; line-height: 1.35; }
.ecommerce-form-card { width: min(100%, 780px); margin: 18px auto 0; }
.ecommerce-form-heading { padding-bottom: 16px; border-bottom: 1px solid #eeeaf5; }
.ecommerce-form-heading p { margin: 6px 0 0; color: #7c8494; font-size: 11px; }
.ecommerce-upload-section { padding-top: 19px; }
.ecommerce-field-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.ecommerce-field-title strong { color: #303848; font-size: 13px; }
.ecommerce-field-title span { color: #a0a6b2; font-size: 10px; }
.ecommerce-optimize-button { display: inline-flex; height: 30px; align-items: center; gap: 5px; padding: 0 10px; border: 1px solid #d8d0ee; border-radius: 7px; color: var(--purple); background: #fff; font-size: 10px; font-weight: 600; }
.ecommerce-optimize-button:hover:not(:disabled) { border-color: var(--purple); background: var(--purple-soft); }
.ecommerce-optimize-button:disabled { cursor: not-allowed; opacity: .45; }
.ecommerce-optimize-button span { color: var(--purple); font-size: 13px; }
.ecommerce-optimize-spinner { width: 11px; height: 11px; border: 2px solid rgba(115,87,246,.25); border-top-color: var(--purple); border-radius: 50%; animation: ecommerce-optimize-spin 700ms linear infinite; }
@keyframes ecommerce-optimize-spin { to { transform: rotate(360deg); } }
.ecommerce-upload-box { display: flex; min-height: 118px; align-items: center; gap: 16px; padding: 17px 20px; border: 1px dashed #d8d0ee; border-radius: 10px; background: #fcfbff; }
.ecommerce-upload-box > div:not(.ecommerce-product-previews) { display: grid; gap: 5px; }
.ecommerce-upload-box strong { color: #4b5363; font-size: 12px; }
.ecommerce-upload-box span { color: #9299a8; font-size: 10px; }
.ecommerce-upload-button { min-width: 85px; height: 34px; border-radius: 17px; color: #fff; background: var(--purple); font-size: 11px; font-weight: 600; }
.ecommerce-upload-button:hover { background: var(--purple-hover); }
.ecommerce-product-previews { display: flex; gap: 7px; margin-left: auto; }
.ecommerce-product-thumb { position: relative; display: inline-flex; width: 72px; height: 72px; }
.ecommerce-product-thumb img { width: 100%; height: 100%; border: 1px solid var(--line); border-radius: 7px; object-fit: cover; }
.ecommerce-product-thumb button { position: absolute; top: 3px; right: 3px; display: grid; width: 18px; height: 18px; place-items: center; border-radius: 50%; color: #fff; background: rgba(0,0,0,.6); font-size: 12px; }
.ecommerce-prompt-section { padding-top: 18px; }
.ecommerce-prompt-section textarea { display: block; width: 100%; min-height: 92px; padding: 11px 12px; resize: vertical; border: 1px solid #ded9e9; border-radius: 8px; outline: 0; color: #303848; background: #fff; font-size: 12px; line-height: 1.65; }
.ecommerce-prompt-section textarea:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(115,87,246,.08); }
.ecommerce-prompt-section textarea::placeholder { color: #a1a8b8; }
.ecommerce-prompt-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 7px; color: #a3a9b6; font-size: 10px; }
.ecommerce-prompt-footer b { color: #7d8493; font-weight: 500; }
.ecommerce-select-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.ecommerce-field { display: grid; gap: 7px; color: #626b7c; font-size: 11px; }
.ecommerce-field i { color: #e75555; font-style: normal; }
.ecommerce-field select { width: 100%; height: 39px; padding: 0 10px; border: 1px solid #ded9e9; border-radius: 7px; outline: 0; color: #313848; background: #fff; font-size: 11px; }
.ecommerce-submit-button { display: flex; width: 100%; height: 43px; align-items: center; justify-content: center; gap: 8px; margin-top: 20px; border-radius: 9px; color: #fff; background: var(--purple); font-size: 13px; font-weight: 700; box-shadow: 0 7px 15px rgba(115,87,246,.16); }
.ecommerce-submit-button:hover:not(:disabled) { background: var(--purple-hover); }
.ecommerce-submit-button:disabled { cursor: not-allowed; opacity: .45; box-shadow: none; }
.ecommerce-submit-button span { font-size: 15px; }

.chat-workspace { grid-column: 1; width: min(100%, 980px); margin: 0 auto; padding: 34px 0 38px; }
.main-content.chat-view { grid-template-columns: minmax(0, 1fr); }
.main-content.chat-view .generator-card, .main-content.chat-view .result-section { display: none; }
.chat-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.chat-header h1 { margin: 0; color: #202737; font-family: Manrope, "Noto Sans SC", sans-serif; font-size: 30px; font-weight: 800; }
.chat-header p { margin: 7px 0 0; color: #7c8494; font-size: 12px; }
.chat-model-control { display: grid; min-width: 230px; gap: 7px; }
.chat-model-control label { color: #7c8494; font-size: 11px; }
.chat-model-control select { width: 100%; height: 40px; padding: 0 12px; border: 1px solid #d9d2ed; border-radius: 8px; outline: 0; color: #303848; background: #fff; font-size: 12px; }
.chat-model-control select:hover { border-color: var(--purple); }
.chat-panel { min-height: 620px; display: flex; flex-direction: column; overflow: hidden; border: 1px solid #ddd7ed; border-radius: 14px; background: #fff; box-shadow: 0 13px 32px rgba(56, 44, 96, .06); }
.chat-messages { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 18px; overflow-y: auto; padding: 28px 30px; background: linear-gradient(180deg, #fcfbff 0%, #fff 100%); }
.chat-empty { display: flex; min-height: 430px; align-items: center; justify-content: center; flex-direction: column; gap: 8px; color: #9da3b1; font-size: 12px; }
.chat-empty strong { color: #4a5160; font-size: 15px; }
.chat-empty-icon { display: grid; width: 48px; height: 48px; place-items: center; margin-bottom: 5px; border-radius: 14px; color: var(--purple); background: var(--purple-soft); font-size: 21px; }
.chat-message { display: flex; max-width: 82%; flex-direction: column; gap: 5px; }
.chat-message-user { align-self: flex-end; align-items: flex-end; }
.chat-message-assistant { align-self: flex-start; align-items: flex-start; }
.chat-message-label { color: #969dab; font-size: 10px; }
.chat-message-content { padding: 11px 14px; border: 1px solid #e9e5f1; border-radius: 12px; color: #303848; background: #fff; font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.chat-message-user .chat-message-content { border-color: #c7bdf8; color: #fff; background: var(--purple); }
.chat-message-images { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chat-reference-thumb { position: relative; display: inline-flex; width: 88px; height: 88px; flex: 0 0 auto; }
.chat-reference-thumb img { display: block; width: 100%; height: 100%; border: 1px solid rgba(115,87,246,.2); border-radius: 7px; object-fit: cover; cursor: zoom-in; }
.chat-reference-thumb button { position: absolute; top: 3px; right: 3px; display: grid; width: 18px; height: 18px; place-items: center; border-radius: 50%; color: #fff; background: rgba(0,0,0,.6); font-size: 12px; line-height: 1; }
.chat-reference-thumb button:hover { background: rgba(0,0,0,.82); }
.chat-message-images .chat-generated-thumb { width: min(100%, 420px); height: auto; }
.chat-message-images img.chat-generated-image { width: 100%; height: auto; max-height: 420px; object-fit: contain; cursor: zoom-in; }
.chat-thinking-dots { display: inline-flex; min-width: 18px; margin-left: 2px; }
.chat-thinking-dots span { opacity: 0; animation: chat-thinking-dot 1.2s infinite; }
.chat-thinking-dots span:nth-child(2) { animation-delay: .2s; }
.chat-thinking-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes chat-thinking-dot { 0%, 20% { opacity: 1; } 40%, 100% { opacity: 0; } }
.chat-composer { padding: 14px 17px 13px; border-top: 1px solid #eeeaf5; background: #fff; }
.chat-reference-row { display: flex; min-height: 88px; align-items: center; gap: 12px; }
.chat-reference-button { display: inline-flex; height: 42px; align-items: center; gap: 8px; padding: 0 14px; border: 1px solid #e2dcef; border-radius: 9px; color: #6d6589; background: #fff; font-size: 12px; }
.chat-reference-button:hover:not(:disabled) { border-color: var(--purple); color: var(--purple); background: var(--purple-soft); }
.chat-reference-button:disabled { cursor: not-allowed; opacity: .5; }
.chat-reference-button span { color: var(--purple); font-size: 17px; }
.chat-reference-button b { color: #394256; font-weight: 500; }
.chat-reference-hint { color: #a3a9b6; font-size: 12px; }
.chat-reference-previews { display: flex; gap: 10px; }
.chat-reference-previews .chat-reference-thumb { width: 84px; height: 84px; }
.chat-reference-previews .chat-reference-thumb img { border-color: var(--line); border-radius: 5px; }
.chat-reference-previews .chat-reference-thumb button { width: 24px; height: 24px; font-size: 15px; }
.chat-composer textarea { display: block; width: 100%; min-height: 74px; padding: 5px 3px; resize: vertical; border: 0; outline: 0; color: #303848; font-size: 13px; line-height: 1.7; }
.chat-composer textarea::placeholder { color: #a1a8b8; }
.chat-composer-footer { display: flex; align-items: center; justify-content: space-between; color: #a3a9b6; font-size: 10px; }
.chat-send-button { display: inline-flex; min-width: 88px; height: 37px; align-items: center; justify-content: center; gap: 7px; border-radius: 8px; color: #fff; background: var(--purple); font-size: 12px; font-weight: 700; transition: background 150ms ease, transform 150ms ease; }
.chat-send-button:hover:not(:disabled) { background: var(--purple-hover); transform: translateY(-1px); }
.chat-send-button:disabled { cursor: not-allowed; opacity: .45; }
.chat-send-button > span { font-size: 16px; line-height: 1; }
.chat-spinner { width: 12px; height: 12px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: chat-spin 700ms linear infinite; }
@keyframes chat-spin { to { transform: rotate(360deg); } }

.generator-card { grid-column: 1 / -1; width: min(100%, 760px); margin: 16px auto 0; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.main-content.has-results .generator-card { grid-column: 1; width: 100%; margin: 16px 0 0; }
.main-content.results-view .generator-card { display: none; }
.card-header { padding: 24px 24px 20px; border-bottom: 1px solid #eeeaf5; text-align: center; }
.card-header h1 { margin: 0; color: #222a39; font-family: Manrope, "Noto Sans SC", sans-serif; font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.card-header p { margin: 8px 0 0; color: var(--muted-light); font-size: 11px; }
.card-body { padding: 0 23px 25px; }
.form-section { padding-top: 22px; }
.section-title-row, .prompt-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-title-row h2, .prompt-title-row h2 { margin: 0; color: #222a39; font-size: 14px; font-weight: 700; }
.required-mark { color: #e75555; }
.section-hint { color: #a0a6b2; font-size: 10px; }

.model-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.size-picker { position: relative; width: 100%; }
.size-picker-trigger { display: flex; width: 100%; height: 42px; align-items: center; justify-content: space-between; gap: 10px; padding: 0 12px; border: 1px solid #ded9e9; border-radius: 8px; color: #313848; background: #fff; font-size: 12px; text-align: left; cursor: pointer; }
.size-picker-trigger:hover, .size-picker.open .size-picker-trigger { border-color: #bcb0e9; box-shadow: 0 0 0 3px rgba(115, 87, 246, .08); }
.size-picker-chevron { color: #737b8b; font-size: 14px; transition: transform 150ms ease; }
.size-picker.open .size-picker-chevron { transform: rotate(180deg); }
.size-picker-value { display: flex; min-width: 0; align-items: center; gap: 10px; overflow: hidden; }
.size-picker-menu { position: absolute; z-index: 20; top: calc(100% + 5px); right: 0; left: 0; display: none; max-height: 286px; overflow-y: auto; padding: 5px; border: 1px solid #d7d1e6; border-radius: 8px; background: #fff; box-shadow: 0 12px 25px rgba(44, 34, 84, .14); }
.size-picker.open .size-picker-menu { display: grid; gap: 2px; }
.size-picker-option { display: flex; min-height: 34px; align-items: center; gap: 11px; padding: 6px 9px; border-radius: 5px; color: #34405a; background: #fff; font-size: 11px; text-align: left; }
.size-picker-option:hover, .size-picker-option.selected { color: #243f69; background: #d9effd; }
.image-size-field { display: grid; gap: 7px; margin-top: 16px; }
.image-size-label { color: #6d7585; font-size: 11px; }
.image-size-field.is-hidden { display: none; }
.ratio-swatch { display: inline-flex; width: 24px; height: 24px; flex: 0 0 24px; align-items: center; justify-content: center; }
.ratio-box { display: block; width: 22px; height: 22px; border: 1px solid #5279ac; background: #fff; }
.ratio-box.ratio-wide { width: 24px; height: 13px; }
.ratio-box.ratio-tall { width: 13px; height: 24px; }
.ratio-box.ratio-auto { position: relative; width: 23px; height: 18px; border-color: #5279ac; }
.ratio-box.ratio-auto::after { position: absolute; top: 7px; right: 3px; left: 3px; height: 1px; background: #5279ac; content: ""; }
.option-card { position: relative; min-height: 70px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface-soft); text-align: center; transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease; }
.option-card:hover { border-color: #bdb0ef; background: #fbf9ff; }
.option-card.selected { border: 2px solid var(--purple); padding: 11px 13px; background: #fbf9ff; box-shadow: 0 4px 12px rgba(115, 87, 246, .07); }
.option-card.selected::after { position: absolute; right: 0; bottom: 0; width: 0; height: 0; border-bottom: 17px solid var(--purple); border-left: 17px solid transparent; content: ""; }
.option-card.selected::before { position: absolute; z-index: 1; right: 2px; bottom: 0; content: "✓"; color: #fff; font-size: 10px; font-weight: 700; }
.option-name { display: block; color: #242b3a; font-family: Manrope, "Noto Sans SC", sans-serif; font-size: 15px; font-weight: 700; }
.option-card.selected .option-name { color: var(--purple); }
.option-desc { display: block; margin-top: 4px; color: #8b92a1; font-size: 11px; line-height: 1.4; }
.option-badge { position: absolute; top: -7px; right: -4px; padding: 2px 6px; border-radius: 5px; color: #fff; background: var(--red); font-family: Manrope, sans-serif; font-size: 9px; font-weight: 700; }

.prompt-title-row { align-items: center; }
.prompt-title-row h2 { display: flex; align-items: center; gap: 5px; }
.help-icon { display: inline-grid; width: 15px; height: 15px; place-items: center; border-radius: 50%; color: #fff; background: #8e96a5; font-size: 10px; }
.prompt-box { border: 1px solid #ddd7ed; border-radius: 10px; background: #fff; overflow: hidden; }
.prompt-toolbar { display: flex; align-items: center; gap: 10px; padding: 11px 14px 8px; }
.prompt-toolbar .prompt-thumb-grid { display: flex; flex: 0 1 auto; flex-wrap: wrap; gap: 8px; margin: 0; }
.prompt-toolbar .prompt-thumb-grid.is-hidden { display: none; }
.prompt-toolbar .reference-trigger { margin-left: auto; }
.upload-trigger, .reference-trigger { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--purple); color: var(--purple); background: #fff; }
.upload-trigger { width: 43px; height: 43px; border-radius: 9px; font-size: 27px; font-weight: 300; line-height: 1; }
.upload-trigger:hover, .reference-trigger:hover { background: var(--purple-soft); }
.reference-trigger { gap: 6px; min-width: 42px; height: 43px; padding: 0 9px; border-radius: 9px; font-size: 17px; }
.reference-trigger b { color: #7c8293; font-size: 12px; font-weight: 400; }
.prompt-box textarea { display: block; width: 100%; min-height: 116px; padding: 13px 15px; resize: vertical; border: 0; border-top: 1px solid #f0edf5; outline: 0; color: #303848; background: #fff; font-size: 13px; line-height: 1.7; }
.prompt-box textarea::placeholder { color: #a1a8b8; }
.prompt-footer { display: flex; justify-content: space-between; padding: 7px 14px 10px; border-top: 1px solid #f3f0f6; color: #b0b4bf; font-size: 9px; }
.prompt-footer b { color: #7d8493; font-weight: 500; }
.thumb-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin-top: 9px; }
.thumb { position: relative; width: 58px; height: 76px; flex: 0 0 58px; overflow: visible; border: 0; border-radius: 7px; background: transparent; cursor: zoom-in; }
.thumb img { display: block; width: 58px; height: 58px; border: 1px solid var(--line); border-radius: 7px; object-fit: cover; }
.thumb button { position: absolute; top: 3px; right: 3px; display: grid; width: 18px; height: 18px; place-items: center; border-radius: 50%; color: #fff; background: rgba(0,0,0,.58); font-size: 11px; }
.thumb button:hover { background: rgba(0,0,0,.78); }
.thumb-label { display: block; margin-top: 3px; overflow: hidden; color: #747c8e; font-size: 9px; line-height: 12px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }

.params-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field-label { display: grid; gap: 7px; color: #6d7585; font-size: 11px; }
.field-label select { width: 100%; height: 38px; padding: 0 10px; border: 1px solid #ded9e9; border-radius: 7px; outline: 0; color: #313848; background: #fff; font-size: 11px; }
.field-label select:hover { border-color: #bcb0e9; }
.generate-bar { display: flex; align-items: center; justify-content: flex-end; gap: 16px; padding: 14px 23px 16px; border-top: 1px solid #eeeaf5; background: #fff; }
.generate-button { display: inline-flex; width: 100%; min-width: 180px; height: 44px; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; color: #fff; background: var(--purple); box-shadow: 0 7px 15px rgba(115, 87, 246, .18); font-size: 14px; font-weight: 700; transition: background 150ms ease, transform 150ms ease; }
.generate-button:hover:not(:disabled) { background: var(--purple-hover); transform: translateY(-1px); }
.generate-button:disabled { cursor: not-allowed; opacity: .45; box-shadow: none; }
.generate-icon { font-size: 15px; }

.result-section { grid-column: 2; grid-row: 2; width: 100%; min-width: 0; margin: 16px 0 0; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.main-content.results-view .result-section { grid-column: 1; grid-row: auto; width: 100%; margin: 16px 0 0; }
.result-section.is-hidden { display: none; }
.result-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.result-heading h2 { margin: 0; font-size: 14px; }
.result-actions { display: flex; align-items: center; gap: 12px; }
.result-actions button { color: var(--muted); background: none; font-size: 10px; }
.result-actions .batch-download-button { padding: 7px 10px; border: 1px solid #d9d2ed; border-radius: 6px; color: var(--purple); background: #fff; }
.result-actions .batch-download-button:hover:not(:disabled) { border-color: var(--purple); background: var(--purple-soft); }
.result-actions .batch-download-button:disabled { cursor: not-allowed; opacity: .45; }
.empty-results { display: none; margin: 0; padding: 30px 12px; color: var(--muted-light); font-size: 11px; text-align: center; }
.empty-results.visible { display: block; }
.result-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.main-content.results-view .result-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 10px; }
.result-card { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 8px; background: #f2eff8; }
.result-card.is-clickable { cursor: zoom-in; }
.result-card.is-clickable:hover img { transform: scale(1.03); }
.result-card img { width: 100%; height: 100%; object-fit: cover; }
.result-card img { transition: transform 180ms ease; }
.result-card .result-status { position: absolute; inset: 0; display: grid; place-items: center; color: #7f749d; background: rgba(255,255,255,.75); font-size: 10px; }

.image-viewer { position: fixed; z-index: 60; inset: 0; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(27, 24, 39, .7); backdrop-filter: blur(4px); }
.image-viewer.open { display: flex; }
.image-viewer-panel { display: flex; width: min(100%, 900px); max-height: calc(100vh - 48px); flex-direction: column; overflow: hidden; border: 1px solid rgba(255,255,255,.25); border-radius: 14px; background: #fff; box-shadow: 0 22px 70px rgba(0,0,0,.28); }
.image-viewer-header { display: flex; align-items: center; justify-content: space-between; padding: 13px 17px; border-bottom: 1px solid #eeeaf5; }
.image-viewer-header h2 { margin: 0; color: #222a39; font-size: 14px; }
.image-viewer-close { color: #71798a; background: none; font-size: 24px; line-height: 1; }
.image-viewer-stage { display: grid; min-height: 220px; flex: 1; place-items: center; overflow: auto; padding: 18px; background: #f5f3f8; }
.image-viewer-stage img { display: block; max-width: 100%; max-height: calc(100vh - 170px); object-fit: contain; }
.image-viewer-actions { display: flex; justify-content: flex-end; padding: 12px 17px; border-top: 1px solid #eeeaf5; }
.download-button { display: inline-flex; height: 35px; align-items: center; padding: 0 14px; border-radius: 7px; color: #fff; background: var(--purple); font-size: 11px; text-decoration: none; }
.download-button:hover { background: var(--purple-hover); }

.dialog-overlay { position: fixed; z-index: 30; inset: 0; display: none; align-items: center; justify-content: center; padding: 18px; background: rgba(49, 42, 73, .22); backdrop-filter: blur(3px); }
.dialog-overlay.open { display: flex; }
.dialog { position: relative; width: min(100%, 360px); padding: 23px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 20px 45px rgba(47, 35, 88, .15); }
.dialog h2 { margin: 0; font-size: 17px; }
.dialog p { margin: 8px 0 16px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.dialog input { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 7px; outline: 0; font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 17px; }
.dialog-close { position: absolute; top: 10px; right: 12px; color: #8f96a4; background: none; font-size: 20px; }
.primary-button, .secondary-button { height: 34px; padding: 0 14px; border-radius: 7px; font-size: 11px; }
.primary-button { color: #fff; background: var(--purple); }
.secondary-button { color: #697184; background: #f4f2f8; }
.toast { position: fixed; z-index: 50; bottom: 22px; left: 50%; max-width: calc(100% - 32px); padding: 10px 14px; border: 1px solid #ded9eb; border-radius: 8px; color: #454c5c; background: #fff; box-shadow: 0 8px 22px rgba(42, 32, 73, .14); font-size: 11px; opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: opacity 160ms ease, transform 160ms ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 820px) {
  .sidebar { position: static; width: 100%; height: auto; flex-basis: auto; padding: 14px 16px 10px; border-right: 0; border-bottom: 1px solid #ebe8f0; }
  .brand { padding: 0 4px 12px; }
  .side-nav { display: flex; gap: 5px; overflow-x: auto; }
  .side-nav-item { min-width: max-content; height: 38px; padding: 0 12px; }
  .nav-divider, .sidebar-note, .sidebar-footer { display: none; }
  .app-shell { display: block; }
  .main-content { display: block; width: 100%; padding: 0 0 24px; }
  .home-workspace { width: 100%; padding: 34px 14px 26px; }
  .home-intro h1 { font-size: 28px; }
  .home-composer { min-height: 270px; padding: 13px; }
  .home-submodel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main-content.results-view .result-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .topbar { height: 58px; padding: 0 18px; }
  .ecommerce-workspace { width: 100%; padding: 28px 14px 30px; }
  .ecommerce-type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .topbar-title { font-size: 11px; }
  .api-button { top: 10px; right: 10px; padding: 8px 10px; font-size: 11px; }
  .home-workspace { padding: 28px 10px 20px; }
  .home-intro { margin-bottom: 20px; }
  .home-intro h1 { font-size: 24px; }
  .home-intro p { font-size: 11px; }
  .home-model-switch { margin-bottom: 14px; }
  .home-model-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .home-composer textarea { min-height: 130px; font-size: 13px; }
  .home-composer-footer { align-items: flex-start; font-size: 9px; }
  .home-generate-button { min-width: 128px; }
  .ecommerce-header { align-items: flex-start; flex-direction: column; gap: 10px; }
  .ecommerce-header h1 { font-size: 25px; }
  .ecommerce-type-section, .ecommerce-form-card { padding: 14px; }
  .ecommerce-type-grid { grid-template-columns: 1fr; }
  .ecommerce-section-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .ecommerce-field-title { align-items: flex-start; flex-direction: column; gap: 5px; }
  .ecommerce-upload-box { align-items: flex-start; flex-wrap: wrap; padding: 14px; }
  .ecommerce-product-previews { width: 100%; margin-left: 0; }
  .ecommerce-select-grid { grid-template-columns: 1fr; }
  .generator-card, .result-section { width: calc(100% - 20px); margin: 10px auto 0; }
  .main-content.has-results .generator-card { width: calc(100% - 20px); margin: 10px auto 0; }
  .card-header { padding: 20px 16px 17px; }
  .card-body { padding: 0 14px 18px; }
  .section-title-row, .prompt-title-row { align-items: flex-start; flex-direction: column; gap: 7px; }
  .prompt-title-row { flex-direction: row; align-items: center; }
  .prompt-actions { flex-wrap: wrap; justify-content: flex-end; }
  .model-grid { gap: 8px; }
  .option-card { min-height: 76px; padding: 11px 8px; }
  .option-card.selected { padding: 10px 7px; }
  .option-name { font-size: 13px; }
  .option-desc { font-size: 10px; }
  .thumb-grid { grid-template-columns: repeat(3, 1fr); }
  .home-composer-toolbar .home-thumb-grid, .prompt-toolbar .prompt-thumb-grid { grid-template-columns: none; }
  .generate-bar { align-items: stretch; flex-direction: column; padding: 12px 14px 14px; }
  .generate-button { width: 100%; }
  .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 821px) and (max-width: 1180px) {
  .main-content.has-results { grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr); column-gap: 14px; padding-right: 14px; padding-left: 14px; }
  .main-content.has-results .topbar { margin-right: -14px; margin-left: -14px; }
  .result-section { padding: 14px; }
  .result-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .main-content.results-view .result-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .main-content.has-results .generator-card { width: calc(100% - 20px); margin: 10px auto 0; }
  .main-content.has-results .result-section { width: calc(100% - 20px); margin: 12px auto 0; }
}
