:root {
  --ew-ink: #17213a;
  --ew-muted: #76839a;
  --ew-line: #e2e8f2;
  --ew-blue: #4b6df5;
  --ew-purple: #745cf3;
  --ew-navy: #10264a;
  --ew-bg: #f4f7fc;
}

#ecommerce-page.ecommerce-page {
  height: 100%;
  min-height: 100%;
  display: grid;
  grid-template-columns: 214px minmax(0, 1fr);
  align-items: start;
  overflow-x: hidden;
  overflow-y: auto;
  color: var(--ew-ink);
  background: var(--ew-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

#ecommerce-page button,
#ecommerce-page input,
#ecommerce-page select,
#ecommerce-page textarea { font: inherit; }

.ecommerce-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: calc(100vh - 82px);
  padding: 27px 15px 22px;
  color: #dce8ff;
  background:
    radial-gradient(circle at 15% 0%, rgba(74, 111, 245, .28), transparent 28%),
    linear-gradient(180deg, #0d2345 0%, #112d55 100%);
}

.sidebar-title { display: flex; align-items: center; gap: 11px; padding: 0 9px 23px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.sidebar-title-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; color: #fff; background: linear-gradient(135deg, #4774ff, #785cf6); box-shadow: 0 10px 24px rgba(49, 96, 241, .3); }
.sidebar-title small, .sidebar-title strong { display: block; }
.sidebar-title small { margin-bottom: 3px; color: #829ac1; font-size: 10px; letter-spacing: .08em; }
.sidebar-title strong { color: #fff; font-size: 16px; }
.sidebar-nav { display: grid; gap: 6px; padding-top: 18px; }
.sidebar-mode { width: 100%; display: flex; align-items: center; gap: 11px; padding: 11px 10px; border: 0; border-radius: 12px; color: #aebfdb; background: transparent; text-align: left; cursor: pointer; transition: background .18s ease, color .18s ease, transform .18s ease; }
.sidebar-mode:hover { color: #fff; background: rgba(255, 255, 255, .07); transform: translateX(2px); }
.sidebar-mode.is-active { color: #fff; background: linear-gradient(100deg, rgba(69, 111, 248, .3), rgba(105, 89, 239, .18)); box-shadow: inset 3px 0 0 #6f8cff; }
.sidebar-mode > span { display: grid; place-items: center; width: 27px; height: 27px; color: #8facff; font-size: 18px; }
.sidebar-mode strong, .sidebar-mode small { display: block; }
.sidebar-mode strong { font-size: 13px; }
.sidebar-mode small { margin-top: 2px; color: #8097ba; font-size: 10px; }
.sidebar-mode.is-active small { color: #adc0e4; }
.sidebar-note { display: flex; align-items: center; gap: 9px; margin: 25px 8px 0; padding: 13px 11px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 12px; background: rgba(255, 255, 255, .045); }
.sidebar-note > span { width: 8px; height: 8px; border-radius: 50%; background: #41d9a7; box-shadow: 0 0 0 5px rgba(65, 217, 167, .1); }
.sidebar-note strong, .sidebar-note small { display: block; }
.sidebar-note strong { color: #eaf1ff; font-size: 11px; }
.sidebar-note small { margin-top: 2px; color: #8299bb; font-size: 9px; }

.ecommerce-content { min-width: 0; padding: 32px clamp(24px, 3vw, 48px) 70px; overflow: visible; }
.ecommerce-content > section { width: min(1420px, 100%); margin-left: auto; margin-right: auto; }
.ecommerce-hero { position: relative; min-height: 285px; display: flex; align-items: center; justify-content: space-between; gap: 36px; padding: 38px 44px; overflow: hidden; border: 1px solid rgba(218, 225, 241, .9); border-radius: 26px; background: linear-gradient(118deg, #fff 0%, #f5f7ff 52%, #e9f3ff 100%); box-shadow: 0 22px 60px rgba(42, 64, 112, .08); }
.ecommerce-hero::after { content: ""; position: absolute; right: -110px; top: -160px; width: 520px; height: 520px; border-radius: 50%; border: 1px solid rgba(99, 123, 239, .13); box-shadow: 0 0 0 55px rgba(109, 140, 244, .035), 0 0 0 110px rgba(109, 140, 244, .025); }
.hero-copy { position: relative; z-index: 2; max-width: 650px; }
.eyebrow { color: #6376d7; font-size: 10px; font-weight: 850; letter-spacing: .16em; }
.ecommerce-hero h1 { margin: 12px 0 10px; color: #16213b; font-size: clamp(38px, 4vw, 58px); line-height: 1.05; letter-spacing: -.055em; }
.ecommerce-hero p { max-width: 630px; margin: 0; color: #6f7e97; font-size: 15px; line-height: 1.7; }
.hero-action { margin-top: 25px; padding: 12px 19px; border: 0; border-radius: 11px; color: #fff; background: linear-gradient(110deg, var(--ew-blue), var(--ew-purple)); font-size: 13px; font-weight: 800; cursor: pointer; box-shadow: 0 13px 28px rgba(76, 102, 235, .25); transition: transform .18s ease, box-shadow .18s ease; }
.hero-action:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(76, 102, 235, .3); }
.hero-action span { margin-left: 6px; }
.hero-visual { position: relative; z-index: 1; flex: 0 0 340px; height: 210px; }
.hero-orbit { position: absolute; border: 1px solid rgba(83, 110, 239, .22); border-radius: 50%; transform: rotate(-16deg); }
.orbit-one { width: 310px; height: 150px; top: 33px; right: 0; }
.orbit-two { width: 230px; height: 110px; top: 55px; right: 37px; }
.hero-card { position: absolute; width: 150px; height: 175px; padding: 15px; border: 1px solid rgba(255, 255, 255, .82); border-radius: 20px; background: rgba(255, 255, 255, .75); box-shadow: 0 22px 45px rgba(65, 87, 141, .18); backdrop-filter: blur(12px); }
.hero-card-back { top: 2px; right: 32px; transform: rotate(10deg); }
.hero-card-back span { color: #7c8bc2; font-size: 9px; font-weight: 800; letter-spacing: .15em; }
.hero-card-back i { display: block; height: 22px; margin-top: 11px; border-radius: 7px; background: linear-gradient(90deg, #dce6fb, #f2f5fd); }
.hero-card-front { left: 33px; bottom: 2px; transform: rotate(-7deg); }
.hero-card-front > span { display: inline-grid; place-items: center; width: 30px; height: 23px; border-radius: 8px; color: #fff; background: #5777ef; font-size: 10px; font-weight: 850; }
.hero-picture { display: grid; place-items: center; height: 78px; margin: 10px 0; border-radius: 11px; color: #5574ee; background: linear-gradient(145deg, #e4ebff, #f1eaff); font-size: 31px; }
.hero-card-front b { color: #394764; font-size: 10px; }

.studio-section { margin-top: 34px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.section-heading > div { display: flex; align-items: center; gap: 9px; }
.section-mark { width: 4px; height: 19px; border-radius: 99px; background: linear-gradient(180deg, #426eff, #795bf3); }
.section-heading h2 { margin: 0; color: #1f2a44; font-size: 20px; letter-spacing: -.025em; }
.section-heading p { margin: 0; color: #8a95a9; font-size: 11px; }
.mode-gallery { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.mode-card { position: relative; min-width: 0; overflow: hidden; padding: 0; border: 1px solid #e0e6f0; border-radius: 18px; color: var(--ew-ink); background: #fff; text-align: left; cursor: pointer; box-shadow: 0 10px 28px rgba(43, 61, 101, .06); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.mode-card:hover { transform: translateY(-4px); border-color: #bdcafa; box-shadow: 0 18px 36px rgba(43, 61, 101, .12); }
.mode-card.is-active { border-color: #7891f4; box-shadow: 0 0 0 3px rgba(83, 112, 239, .1), 0 18px 36px rgba(43, 61, 101, .11); }
.mode-cover, .direction-cover { display: block; width: 100%; background-repeat: no-repeat; }
.mode-cover { height: 205px; background-size: 500% 100%; }
.sprite-mode { background-image: url("assets/ecommerce-modes-sprite.png"); }
.sprite-mode-1 { background-position: 0% 50%; }
.sprite-mode-2 { background-position: 25% 50%; }
.sprite-mode-3 { background-position: 50% 50%; }
.sprite-mode-4 { background-position: 75% 50%; }
.sprite-mode-5 { background-position: 100% 50%; }
.mode-copy { display: block; min-height: 72px; padding: 14px 38px 13px 14px; }
.mode-copy strong, .mode-copy small { display: block; }
.mode-copy strong { font-size: 14px; }
.mode-copy small { margin-top: 5px; color: #8792a6; font-size: 10px; line-height: 1.45; }
.mode-card > i { position: absolute; right: 14px; bottom: 25px; color: #6b80e9; font-size: 15px; font-style: normal; }
.mode-card.is-active::after { content: "已选择"; position: absolute; top: 10px; left: 10px; padding: 5px 8px; border-radius: 99px; color: #fff; background: rgba(32, 48, 82, .8); font-size: 9px; font-weight: 800; backdrop-filter: blur(7px); }

.direction-gallery { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.direction-card { overflow: hidden; border: 1px solid #e3e8f1; border-radius: 15px; background: #fff; box-shadow: 0 8px 24px rgba(45, 63, 101, .045); }
.direction-cover { height: 132px; background-size: 500% 100%; }
.sprite-direction { background-image: url("assets/ecommerce-directions-sprite.png"); }
.sprite-direction-1 { background-position: 0% 50%; }
.sprite-direction-2 { background-position: 25% 50%; }
.sprite-direction-3 { background-position: 50% 50%; }
.sprite-direction-4 { background-position: 75% 50%; }
.sprite-direction-5 { background-position: 100% 50%; }
.direction-card > div { padding: 11px 12px 13px; }
.direction-card strong, .direction-card small { display: block; }
.direction-card strong { font-size: 12px; }
.direction-card small { margin-top: 4px; color: #8c97aa; font-size: 9px; }

.creation-section { margin-top: 42px; scroll-margin-top: 22px; }
.creation-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.creation-heading h2 { margin: 7px 0 4px; font-size: 27px; letter-spacing: -.04em; }
.creation-heading p { margin: 0; color: #8994a6; font-size: 11px; }
.creation-heading p strong { color: #586ddd; }
.creation-badge { padding: 7px 10px; border: 1px solid #cfece3; border-radius: 99px; color: #23836a; background: #edfbf6; font-size: 10px; font-weight: 800; }
.workbench-layout { display: grid; grid-template-columns: minmax(360px, 450px) minmax(0, 1fr); gap: 20px; align-items: start; }
.workbench-panel, .workbench-results { border: 1px solid rgba(217, 224, 238, .95); border-radius: 22px; background: rgba(255, 255, 255, .94); box-shadow: 0 18px 48px rgba(46, 61, 101, .07); }
.workbench-panel { padding: 23px; }
.workbench-results { min-height: 650px; padding: 25px; }
.panel-intro { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.panel-step { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; color: #576ee9; background: #edf0ff; font-size: 11px; font-weight: 850; }
.panel-intro h3 { margin: 1px 0 4px; font-size: 18px; letter-spacing: -.03em; }
.panel-intro p { margin: 0; color: var(--ew-muted); font-size: 11px; line-height: 1.55; }
.field-label { display: block; position: relative; margin-bottom: 19px; color: #2b354b; font-size: 12px; font-weight: 750; }
.field-label > small { float: right; color: #99a2b3; font-size: 10px; font-weight: 500; }
.upload-box { position: relative; min-height: 168px; display: grid; place-items: center; align-content: center; margin-top: 9px; padding: 18px; border: 1.5px dashed #b9c5dd; border-radius: 14px; color: #8b96a8; background: #fafbfe; text-align: center; cursor: pointer; transition: .2s; }
.upload-box:hover, .upload-box.is-dragover { border-color: #7181ed; background: #f5f7ff; box-shadow: 0 0 0 4px rgba(102, 119, 235, .08); }
.upload-box input { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-plus { color: #6077eb; font-size: 29px; line-height: 1; }
.upload-box strong { margin-top: 5px; color: #46526a; font-size: 12px; }
.upload-box > small { margin-top: 4px; font-size: 9px; }
.preview-grid { position: absolute; inset: 9px; z-index: 3; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 6px; pointer-events: none; }
.preview-item { position: relative; min-width: 0; overflow: hidden; border: 1px solid #dce2ee; border-radius: 8px; background: #fff; }
.preview-item img { width: 100%; height: 100%; display: block; object-fit: cover; }
.preview-item span { position: absolute; left: 4px; bottom: 4px; padding: 2px 5px; border-radius: 5px; color: #fff; background: rgba(28, 36, 58, .72); font-size: 9px; }
.upload-box.has-files .upload-plus, .upload-box.has-files > strong, .upload-box.has-files > small { opacity: 0; }
.textarea-wrap { position: relative; margin-top: 9px; }
.field-label textarea { width: 100%; min-height: 118px; padding: 13px 14px 35px; resize: vertical; border: 1px solid #d9dfeb; border-radius: 12px; outline: 0; color: var(--ew-ink); font-size: 12px; font-weight: 500; line-height: 1.6; }
.field-label textarea:focus { border-color: #7788ec; box-shadow: 0 0 0 4px rgba(90, 108, 231, .1); }
.ai-fill-button { position: absolute; right: 9px; bottom: 9px; padding: 6px 9px; border: 1px solid #d4dafa; border-radius: 8px; color: #586de6; background: #f5f6ff; font-size: 10px; font-weight: 750; cursor: pointer; }
.ai-fill-button:hover { background: #ebedff; }
.field-count { position: absolute; right: 100px; bottom: 11px; color: #9aa3b2; font-size: 9px; }
.advanced-settings { margin: 2px 0 17px; border: 1px solid #e1e6ef; border-radius: 12px; background: #fbfcfe; }
.advanced-settings summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 13px; list-style: none; cursor: pointer; }
.advanced-settings summary::-webkit-details-marker { display: none; }
.advanced-settings summary > span { display: flex; align-items: center; gap: 9px; }
.advanced-settings summary b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: #5e72e5; background: #edf0ff; font-size: 10px; }
.advanced-settings summary strong { font-size: 12px; }
.advanced-settings summary small { color: #98a2b3; font-size: 9px; }
.advanced-settings[open] summary { border-bottom: 1px solid #e5e9f1; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; padding: 14px; }
.select-field { display: grid; gap: 6px; color: #27334b; font-size: 10px; font-weight: 750; }
.select-field select { width: 100%; height: 39px; padding: 0 10px; border: 1px solid #d9dfeb; border-radius: 10px; outline: 0; color: #34415b; background: #fff; font-size: 10px; }
.select-field select:focus { border-color: #7584eb; box-shadow: 0 0 0 3px rgba(90, 108, 231, .1); }
.prompt-plan { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 11px; background: #f4f6ff; }
.prompt-plan-icon { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 9px; color: #5c70e9; background: #e7ebff; font-size: 14px; }
.prompt-plan strong { font-size: 11px; }
.prompt-plan p { margin: 3px 0 0; color: #8a94a5; font-size: 9px; }
.ecommerce-modal-footer { display: grid; gap: 10px; margin-top: 18px; }
.ecommerce-modal-footer > span { color: #8b95a7; font-size: 10px; }
.generate-button { width: 100%; height: 49px; border: 0; border-radius: 12px; color: #fff; background: linear-gradient(105deg, var(--ew-blue), var(--ew-purple)); font-size: 14px; font-weight: 800; cursor: pointer; box-shadow: 0 11px 24px rgba(82, 91, 227, .2); }
.generate-button:hover { filter: saturate(1.08); transform: translateY(-1px); }
.generate-button:disabled { opacity: .55; cursor: wait; transform: none; }
.form-status { min-height: 19px; margin: 8px 2px 0; color: #7b8699; font-size: 11px; }
.form-status.error { color: #cb5866; }
.form-status.success { color: #23866f; }
.results-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; padding-bottom: 18px; border-bottom: 1px solid var(--ew-line); }
.results-head h3 { margin: 7px 0 5px; font-size: 22px; letter-spacing: -.04em; }
.results-head p { margin: 0; color: var(--ew-muted); font-size: 11px; }
.results-status { padding: 7px 10px; border-radius: 99px; color: #66738b; background: #f1f3f8; font-size: 10px; font-weight: 700; white-space: nowrap; }
.result-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.result-empty { grid-column: 1 / -1; min-height: 510px; display: grid; place-items: center; align-content: center; color: #8d97a8; text-align: center; }
.result-empty-preview { position: relative; width: 235px; height: 155px; margin-bottom: 25px; }
.preview-tile { position: absolute; width: 92px; height: 122px; border: 5px solid #fff; border-radius: 13px; background-image: url("assets/ecommerce-directions-sprite.png"); background-size: 500% 100%; box-shadow: 0 13px 32px rgba(54, 70, 111, .14); }
.preview-a { left: 2px; bottom: 0; background-position: 0% 50%; transform: rotate(-8deg); }
.preview-b { left: 72px; top: 0; z-index: 2; background-position: 50% 50%; }
.preview-c { right: 2px; bottom: 0; background-position: 100% 50%; transform: rotate(8deg); }
.result-empty strong { color: #566176; font-size: 14px; }
.result-empty > span { max-width: 300px; margin-top: 7px; font-size: 11px; line-height: 1.6; }
.result-card { position: relative; min-height: 205px; overflow: hidden; border: 1px solid #e1e6f0; border-radius: 14px; background: #f8f9fc; }
.result-card.is-ready { display: block; color: inherit; text-decoration: none; }
.result-card.is-ready img { width: 100%; height: 205px; display: block; object-fit: cover; }
.result-card.is-ready span { position: absolute; left: 8px; bottom: 8px; padding: 4px 7px; border-radius: 6px; color: #fff; background: rgba(26, 34, 56, .72); font-size: 9px; }
.result-queued { display: grid; place-items: center; align-content: center; gap: 5px; color: #8994a8; background: linear-gradient(145deg, #fafbff, #f2f4fb); }
.queued-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; color: #697bea; background: #e8ebff; }
.result-queued strong { color: #606c80; font-size: 11px; }
.result-queued span { font-size: 9px; }

@media (max-width: 1180px) {
  #ecommerce-page.ecommerce-page { grid-template-columns: 184px minmax(0, 1fr); }
  .mode-gallery, .direction-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero-visual { flex-basis: 280px; transform: scale(.9); transform-origin: right center; }
}

@media (max-width: 900px) {
  #ecommerce-page.ecommerce-page { display: block; }
  .ecommerce-sidebar { position: static; min-height: auto; padding: 12px 14px; }
  .sidebar-title, .sidebar-note { display: none; }
  .sidebar-nav { display: flex; gap: 7px; padding: 0; overflow-x: auto; }
  .sidebar-mode { flex: 0 0 auto; width: auto; min-width: 126px; padding: 9px 11px; }
  .ecommerce-content { padding: 22px 20px 55px; }
  .ecommerce-hero { min-height: 250px; padding: 30px; }
  .hero-visual { display: none; }
  .workbench-layout { grid-template-columns: 1fr; }
  .workbench-results { min-height: 440px; }
  .result-empty { min-height: 300px; }
}

@media (max-width: 620px) {
  .ecommerce-content { padding: 16px 13px 45px; }
  .ecommerce-hero { min-height: 230px; padding: 25px 22px; border-radius: 20px; }
  .ecommerce-hero h1 { font-size: 34px; }
  .ecommerce-hero p { font-size: 13px; }
  .section-heading { align-items: flex-start; }
  .section-heading p { display: none; }
  .mode-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .direction-gallery { display: flex; overflow-x: auto; padding-bottom: 5px; }
  .direction-card { flex: 0 0 165px; }
  .mode-cover { height: 175px; }
  .workbench-panel, .workbench-results { padding: 18px; border-radius: 18px; }
  .settings-grid { grid-template-columns: 1fr 1fr; }
  .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .result-card, .result-card.is-ready img { min-height: 150px; height: 150px; }
  .results-head { display: block; }
  .results-status { display: inline-flex; margin-top: 12px; }
}

@media (max-width: 410px) {
  .mode-gallery { grid-template-columns: 1fr; }
  .mode-cover { height: 210px; }
  .advanced-settings summary small { display: none; }
}
