:root {
  color-scheme: dark;
  --base: #0b1611;
  --panel: #102219;
  --raised: #172d21;
  --line: #2e4738;
  --text: #f3f9ee;
  --muted: #b1c8b8;
  --dim: #91ab9a;
  --accent: #91d7a8;
  --lavender: #bbefc8;
  --pink: #ffa9a2;
  --radius: 14px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  background: radial-gradient(ellipse at 42% 8%, #182f22 0, #0b1611 62%);
  color: var(--text);
  font-size: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
body, button, input, textarea, select { font-family: inherit; }
button, input, textarea, select { font-size: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
button, a, input, select, textarea, summary { outline-offset: 3px; }
:focus-visible { outline: 2px solid var(--lavender); }
h1, h2, p { margin: 0; }
a { color: inherit; text-decoration: none; }
i[class^="icon-"] { display: inline-flex; flex-shrink: 0; line-height: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.topbar {
  display: grid; grid-template-columns: 210px minmax(0, 1fr) auto; align-items: center; height: 70px;
  border-bottom: 1px solid var(--line); background: #0e1d16; position: sticky; top: 0; z-index: 4;
}
.brand { display: flex; align-items: center; gap: 12px; margin-left: 24px; width: fit-content; }
.brand-mark {
  display: grid; place-items: center; width: 37px; height: 37px; background: linear-gradient(145deg, #5ab882, #257148);
  color: white; font-size: 23px; border-radius: 11px; box-shadow: 0 2px 18px #6dcb9346, inset 0 1px 1px #ffffff45;
}
.brand-type { display: grid; gap: 3px; }
.brand-type strong { font-size: 20px; line-height: 1; letter-spacing: .12em; }
.brand-type small { color: var(--dim); font: 700 9px/1.2 system-ui, sans-serif; letter-spacing: .115em; }
.top-title { padding-left: 27px; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.top-title i { font-size: 15px; color: var(--dim); }
.top-connection {
  margin-right: 25px; padding: 8px 11px; display: flex; align-items: center; gap: 8px;
  background: var(--raised); border: 1px solid var(--line); border-radius: 9px; font-size: 12px;
  color: var(--muted);
}
.top-connection:hover { border-color: #4a6555; color: var(--text); }
.top-connection[data-state="ready"] .status-dot { background: #6de0b1; box-shadow: 0 0 0 3px #6de0b123; }
.top-connection[data-state="locked"] .status-dot { background: #b1eec9; box-shadow: 0 0 0 3px #91d7a826; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #827e94; box-shadow: 0 0 0 3px #827e9425; }
.layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: calc(100dvh - 70px); }
.sidebar {
  display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #0e1d16;
  padding: 29px 16px 18px; position: sticky; top: 70px; height: calc(100dvh - 70px);
}
.nav-label { color: var(--dim); font-size: 12px; padding: 0 11px 13px; }
.nav { display: grid; gap: 5px; }
.nav button, .help-link {
  display: flex; gap: 10px; align-items: center; background: none; border: 1px solid transparent;
  padding: 11px 12px; color: var(--muted); border-radius: 8px; text-align: left; width: 100%;
}
.nav button:hover, .help-link:hover { color: var(--text); background: #1c2921; }
.nav button[aria-current] { border-color: #395444; background: #203127; color: var(--lavender); font-weight: 650; }
.nav button i, .help-link i { font-size: 16px; }
.nav-count { margin-left: auto; color: var(--lavender); font-size: 11px; }
.sidebar-foot { margin-top: auto; display: grid; gap: 13px; }
.help-link { font-size: 13px; }
.help-link i:last-child { margin-left: auto; font-size: 13px; color: var(--dim); }
.provider { display: flex; gap: 9px; align-items: center; padding: 11px; border-radius: 9px; border: 1px solid #2c3831; background: #161e19; }
.provider i { color: var(--accent); font-size: 17px; }
.provider strong { display: block; font-size: 11px; font-weight: 650; white-space: nowrap; }
.provider small { display: block; margin-top: 5px; color: var(--dim); font-size: 10px; }

.main { display: grid; grid-template-columns: minmax(0, 1fr) 345px; min-width: 0; align-items: start; }
.workspace { min-width: 0; padding: 29px 28px 33px; width: 100%; max-width: 1160px; justify-self: center; }
.section-intro { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 25px; }
.section-intro h1 { font-size: clamp(25px, 2.4vw, 34px); font-weight: 720; letter-spacing: -.055em; line-height: 1.24; }
.section-intro p { color: var(--muted); margin-top: 8px; font-size: 13px; }
.line-button, .icon-button, .upload-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: #182b20;
}
.line-button { padding: 9px 11px; font-size: 12px; white-space: nowrap; }
.line-button i { color: var(--lavender); font-size: 16px; }
.line-button:hover, .icon-button:hover, .upload-button:hover { color: var(--text); border-color: #547a63; background: #203026; }
.icon-button { width: 31px; height: 30px; font-size: 14px; flex-shrink: 0; }
.preview { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.preview-head, .preview-foot, .examples-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.preview-head { min-height: 53px; padding: 10px 15px; }
.preview h2, .examples h2 { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 660; }
.preview h2 i, .examples h2 i { color: var(--accent); font-size: 15px; }
.preview-actions { display: flex; gap: 7px; }
.art-stage {
  height: clamp(275px, 38vw, 475px); position: relative; display: grid; place-items: center; overflow: hidden;
  isolation: isolate; background: #08120d; border-block: 1px solid var(--line);
}
.stage-grid { position: absolute; inset: 0; z-index: -1; background-image: radial-gradient(circle, #465e5050 1px, transparent 1px); background-size: 18px 18px; }
.art-stage img { display: block; width: 100%; height: 100%; position: absolute; inset: 0; object-fit: contain; }
.art-stage.sample-stage img { object-fit: cover; object-position: center 53%; }
.art-tag { position: absolute; top: 13px; left: 13px; display: inline-flex; gap: 6px; align-items: center; border: 1px solid #d7f6e34d;
  border-radius: 7px; background: #15241bb5; color: #eefbf3; padding: 6px 8px; font-size: 11px; backdrop-filter: blur(8px); }
.art-tag i { color: #bbf0d0; }
.stage-empty, .stage-busy { align-self: stretch; justify-self: stretch; display: grid; place-content: center; justify-items: center; gap: 15px; color: var(--muted); }
.stage-empty i { font-size: 32px; color: var(--accent); }
.stage-busy { z-index: 1; background: #0c2016dd; backdrop-filter: blur(5px); }
.spinner { display: inline-block; width: 27px; height: 27px; border-radius: 50%; border: 2px solid #638c73; border-top-color: #cbf3db; animation: rotate .9s linear infinite; }
@keyframes rotate { to { transform: rotate(1turn); } }
.preview-foot { min-height: 63px; padding: 10px 15px; }
.preview-foot strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-foot > div:first-child { min-width: 0; }
.preview-foot p { color: var(--muted); font-size: 11px; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-size { flex-shrink: 0; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; display: inline-flex; gap: 6px; align-items: center; }
.art-size i { color: var(--dim); }
.examples { margin-top: 23px; }
.examples-head { margin-bottom: 12px; }
.examples-head span { color: var(--dim); font-size: 11px; }
.examples-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
.example { position: relative; padding: 0; min-width: 0; background: #151e19; display: block; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; text-align: left; }
.example img { display: block; width: 100%; aspect-ratio: 1.7; object-fit: cover; }
.example span { display: block; color: var(--muted); font-size: 11px; padding: 8px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.example:hover, .example[aria-pressed="true"] { border-color: #7fcb9d; box-shadow: inset 0 0 0 1px #7fcb9d5c; }
.example[aria-pressed="true"] span { color: var(--lavender); }

.settings { min-width: 0; min-height: calc(100dvh - 70px); border-left: 1px solid var(--line); padding: 22px 20px 20px; background: var(--panel); }
.settings-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.settings-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: #25352b; color: var(--lavender); font-size: 18px; }
.settings-head h2 { font-size: 15px; font-weight: 700; }
.settings-head p { color: var(--dim); font-size: 11px; margin-top: 3px; }
.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; padding: 3px; background: #0a1810; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 16px; }
.segmented button { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 2px; border: 1px solid transparent; background: none; border-radius: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.segmented button[aria-pressed="true"] { color: var(--lavender); border-color: #446652; background: #23342a; }
.segmented button:hover:not([aria-pressed="true"]) { color: var(--text); background: #19221d; }
.field { display: grid; gap: 7px; margin-bottom: 14px; min-width: 0; }
.field > label, .custom-size label { font-size: 12px; font-weight: 650; color: #dde9e2; }
.field small, .advanced small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.field input:not([type="file"]), .field select {
  height: 36px; width: 100%; padding: 0 9px; background: #1a221d; border: 1px solid #2c3931; border-radius: 7px;
  color: var(--text); min-width: 0; font-size: 12px;
}
.field select { padding-right: 18px; }
.field input:invalid { border-color: #a75b78; }
.select-icon { position: relative; }
.select-icon i { position: absolute; left: 10px; top: 11px; color: var(--accent); pointer-events: none; }
.select-icon select { padding-left: 31px; }
.prompt-box { display: grid; border: 1px solid #2c3931; border-radius: 8px; background: #161e19; }
.prompt-box:focus-within { border-color: #87c6a0; }
.prompt-box textarea { min-height: 103px; resize: vertical; width: 100%; padding: 10px 11px 2px; background: transparent; border: 0; outline: none; line-height: 1.65; font-size: 12px; }
.prompt-box textarea::placeholder { color: #87839c; }
.prompt-box span { padding: 2px 9px 6px; text-align: right; color: var(--dim); font-size: 10px; pointer-events: none; }
.reference-field { display: flex; align-items: center; gap: 8px; }
.upload-button { min-width: 0; padding: 6px 8px; font-size: 11px; }
.upload-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-button i { color: var(--accent); }
.reference-field .icon-button { width: 26px; height: 25px; }
.ratios { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.ratio { display: grid; justify-items: center; gap: 4px; padding: 7px 2px; border: 1px solid var(--line); color: var(--muted); border-radius: 7px; background: #1a221d; font-size: 10px; }
.ratio i { font-size: 15px; }
.ratio:hover, .ratio[aria-pressed="true"] { color: var(--lavender); border-color: #679e7d; background: #273a2f; }
.size-note.error { color: var(--pink); }
.text-button { display: flex; align-items: center; gap: 4px; justify-self: start; border: 0; color: var(--lavender); background: none; font-size: 11px; padding: 0; }
.text-button:hover { color: #dff8e9; text-decoration: underline; }
.custom-size { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 7px; align-items: end; }
.custom-size label { display: grid; gap: 5px; }
.custom-size span { padding-bottom: 8px; color: var(--muted); }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.advanced { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 2px 0 14px; }
.advanced summary { display: flex; gap: 7px; align-items: center; list-style: none; padding: 10px 0; color: var(--muted); cursor: pointer; font-size: 12px; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary i:first-child { color: var(--accent); }
.advanced summary i:last-child { margin-left: auto; }
.advanced[open] summary i:last-child, .text-button[aria-expanded="true"] i { transform: rotate(180deg); }
.advanced[open] > small { display: block; padding-bottom: 8px; }
.advanced .field { margin-bottom: 6px; }
.generate { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 10px;
  background: linear-gradient(105deg, #367c53, #286443); border: 1px solid #589d70; border-radius: 9px; color: white;
  font-size: 13px; font-weight: 750; min-height: 42px; box-shadow: 0 4px 16px #2864433e, inset 0 1px 0 #ffffff35;
}
.generate:hover:not(:disabled) { background: linear-gradient(105deg, #378257, #31704c); }
.generate i { font-size: 16px; }
.generate .spinner { width: 15px; height: 15px; }
.privacy { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 10px; color: var(--dim); font-size: 10px; }
.form-message { color: var(--lavender); border: 1px solid #436551; background: #1f2f25; border-radius: 7px; padding: 7px 9px; font-size: 12px; line-height: 1.5; margin-bottom: 10px; }
.form-message.error { color: #ffc0cc; border-color: #643449; background: #301928; }

.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 13px; }
.history-item { min-width: 0; overflow: hidden; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; }
.history-image { display: block; cursor: pointer; width: 100%; border: 0; padding: 0; background: #0b100d; }
.history-image img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }
.history-meta { display: flex; align-items: center; gap: 7px; padding: 8px; }
.history-meta strong { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.history-empty { display: grid; justify-items: center; gap: 12px; padding: 80px 15px; background: var(--panel); border: 1px dashed #38483e; border-radius: 12px; text-align: center; }
.history-empty i { font-size: 28px; color: var(--accent); }
.history-empty h2 { font-size: 17px; }
.history-empty p { color: var(--muted); font-size: 13px; }
dialog { width: min(430px, calc(100% - 34px)); max-height: calc(100dvh - 32px); padding: 20px; border: 1px solid #42594b; background: #18201b; border-radius: 13px; color: var(--text); }
dialog::backdrop { background: #090f0bcc; backdrop-filter: blur(5px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 13px; }
.dialog-head h2 { font-size: 18px; }
#account-hint { font-size: 13px; color: var(--muted); line-height: 1.55; margin-bottom: 15px; }
.guide { padding-left: 22px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.guide li + li { margin-top: 10px; }
.lightbox { width: fit-content; max-width: calc(100% - 24px); padding: 6px; background: #0b1611; position: fixed; }
.lightbox img { display: block; max-width: 100%; max-height: calc(100dvh - 62px); object-fit: contain; }
.lightbox .icon-button { position: absolute; right: 10px; top: 10px; }

@media (min-width: 1500px) {
  .topbar, .layout { grid-template-columns: 225px minmax(0, 1fr); }
  .topbar { grid-template-columns: 225px minmax(0, 1fr) auto; }
  .main { grid-template-columns: minmax(0, 1fr) 370px; }
  .workspace { padding-inline: 35px; }
}
@media (max-width: 1150px) {
  .topbar { grid-template-columns: 162px minmax(0, 1fr) auto; }
  .layout { grid-template-columns: 162px minmax(0, 1fr); }
  .main { grid-template-columns: minmax(0, 1fr) 305px; }
  .sidebar { padding-inline: 10px; }
  .workspace { padding-inline: 20px; }
  .settings { padding-inline: 15px; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { top: 70px; z-index: 3; height: auto; flex-direction: row; border-right: 0; border-bottom: 1px solid var(--line); padding: 5px 12px; align-items: center; }
  .nav { display: flex; gap: 4px; }
  .nav button, .help-link { padding: 7px 8px; font-size: 12px; white-space: nowrap; }
  .nav-label, .provider, .help-link i:last-child { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; }
  .main { grid-template-columns: minmax(0, 1fr) 290px; }
  .settings { min-height: calc(100dvh - 111px); }
  .workspace { padding-top: 20px; }
}
@media (max-width: 630px) {
  .topbar { grid-template-columns: minmax(0, 1fr) auto; height: 56px; }
  .top-title { display: none; }
  .brand { margin-left: 13px; }
  .brand-mark { width: 31px; height: 31px; font-size: 20px; }
  .brand-type strong { font-size: 16px; }
  .brand-type small { font-size: 8px; }
  .top-connection { margin-right: 12px; }
  .sidebar { top: 56px; }
  .main { grid-template-columns: minmax(0, 1fr); }
  .settings { min-height: 0; border-left: 0; border-top: 1px solid var(--line); }
  .workspace { padding: 17px 13px 18px; }
  .section-intro { margin-bottom: 16px; }
  .section-intro p { font-size: 11px; }
  .art-stage { height: clamp(208px, 59vw, 365px); }
  .examples { margin-top: 15px; }
  .examples-grid { gap: 6px; }
  .example span { font-size: 10px; padding: 6px 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 3s; }
}

.resolution { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 0; }
.ratio { min-height: 62px; }
.ratio small { white-space: nowrap; font-size: 10px; }
.ratio small:empty { display: none; }
.admin-workspace { grid-column: 1 / -1; max-width: 1050px; }
.admin-card { padding: 18px; margin-bottom: 15px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.admin-card h2 { font-size: 15px; margin-bottom: 13px; }
.admin-inputs { display: grid; grid-template-columns: minmax(0, 1fr) 130px auto; gap: 12px; align-items: end; }
.admin-inputs .field { margin: 0; }
.admin-inputs .generate { min-height: 36px; width: auto; white-space: nowrap; }
.admin-list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.admin-list-head h2 { margin: 0; }
.code-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px auto; gap: 10px; align-items: center; border-top: 1px solid var(--line); padding: 12px 0; }
.code-row strong, .code-row small { display: block; overflow-wrap: anywhere; }
.code-row small, .admin-empty { color: var(--muted); font-size: 12px; }
.code-row small { margin-top: 5px; }
.code-row input { min-width: 0; width: 100%; border: 1px solid var(--line); border-radius: 7px; background: var(--raised); padding: 7px; }
.code-result { margin-top: 13px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.code-result p { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.code-result > div { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.code-result code { font-size: 13px; color: var(--lavender); overflow-wrap: anywhere; user-select: all; }
#admin-message { margin: 10px 0 0; }
@media (max-width: 470px) {
  .admin-inputs { grid-template-columns: minmax(0, 1fr) minmax(85px, .5fr); }
  .admin-inputs .generate { grid-column: 1 / -1; }
  .code-row { grid-template-columns: minmax(0, 1fr) 66px auto; gap: 6px; }
  .nav button { gap: 5px; }
  .help-link { font-size: 0; gap: 0; }
}
