:root {
  color-scheme: dark;
  --bg: #0c1020;
  --panel: #14192d;
  --field: #0e1325;
  --edge: #303750;
  --line: #282e46;
  --text: #f3f2fe;
  --muted: #a7b1cc;
  --accent: #c7b6ff;
  --green: #77e4bd;
  --warn: #f7d196;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; min-height: 100vh; }
body, input, textarea, select, button { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button, select, summary { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible, .mode:focus-within {
  outline: 2px solid #cbb8ff; outline-offset: 3px;
}
h1, h2, p { margin: 0; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.muted, .hint { color: var(--muted); }
.hint { font-size: .78rem; line-height: 1.55; font-variant-numeric: tabular-nums; }
.boot { min-height: 100dvh; display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--muted); }
.boot img { width: 42px; height: 42px; }

.brand { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.brand img { flex: 0 0 auto; }
.brand b { display: block; font-size: .99rem; letter-spacing: .05em; }
.brand span { display: block; margin-top: 3px; color: var(--muted); font-size: .72rem; letter-spacing: .09em; }
.primary, .secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 11px; padding: 11px 17px;
  font-weight: 720; line-height: 1.45; min-height: 42px;
}
.primary { background: linear-gradient(112deg, #cdb9ff, #a5b4ff); color: #161533; box-shadow: 0 7px 20px #7979f12b; }
.primary:hover:not(:disabled) { background: linear-gradient(112deg, #decdff, #b7c5ff); }
.secondary { background: #191f36; color: #dce1f6; border-color: #343c58; }
.secondary:hover:not(:disabled) { background: #252b46; border-color: #586282; }
.compact { font-size: .81rem; padding: 8px 12px; }
.text-button { padding: 5px 8px; border: 0; background: none; color: var(--accent); font-size: .83rem; }
.field-error { color: #ffc0c8; border-radius: 9px; padding: 9px 11px; background: #5c25313c; font-size: .85rem; line-height: 1.55; }

.login-view {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 34px 22px;
  background: radial-gradient(ellipse at 23% 18%, #28244b 0, transparent 48%), radial-gradient(ellipse at 93% 87%, #1a2b4b 0, transparent 45%), var(--bg);
}
.login-frame { width: min(900px, 100%); display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #3b4061; border-radius: 26px; overflow: hidden; box-shadow: 0 24px 90px #0007; }
.login-art { position: relative; min-height: 510px; overflow: hidden; isolation: isolate; background: radial-gradient(ellipse at 26% 36%, #7552ab 0, transparent 47%), radial-gradient(ellipse at 76% 26%, #4463a2 0, transparent 50%), linear-gradient(151deg, #1c1944, #191b36 64%, #12162d); }
.login-art::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 33px, #c8d3ff12 34px 35px), repeating-linear-gradient(90deg, transparent 0 33px, #c8d3ff12 34px 35px); mask-image: linear-gradient(#000a, transparent 84%); z-index: -1; }
.art-orbit { position: absolute; border: 1px solid #c3b9fa5c; width: 400px; height: 230px; border-radius: 50%; transform: rotate(-28deg); inset: 57px auto auto -16px; }
.art-orbit-b { width: 370px; height: 191px; inset: 74px auto auto 27px; transform: rotate(29deg); border-color: #c9b0ff45; }
.art-glow { position: absolute; width: 155px; height: 155px; left: 129px; top: 91px; border-radius: 50%; background: radial-gradient(circle at 28% 24%, #faedff, #ba9ff3 28%, #8b72e3 52%, #32487e 78%); box-shadow: 0 0 54px #b99df68c, inset -15px -12px 26px #211a5a7d; }
.art-point { position: absolute; left: 307px; top: 91px; width: 13px; height: 13px; border-radius: 50%; background: #d0e2ff; box-shadow: 0 0 18px 4px #bed5fb9c; }
.art-copy { position: absolute; left: clamp(30px, 4.1vw, 52px); bottom: 43px; display: grid; gap: 17px; }
.art-copy span { font-size: .73rem; color: #d1cafa; letter-spacing: .18em; }
.art-copy strong { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.16; letter-spacing: .05em; }
.login-content { display: flex; flex-direction: column; justify-content: center; background: #151a30; padding: clamp(26px, 5vw, 52px); }
.login-content h1 { font-size: 1.93rem; margin: 25px 0 9px; letter-spacing: -.03em; }
.login-content > .muted { line-height: 1.6; font-size: .91rem; }
.login-form { margin-top: 22px; display: grid; gap: 9px; }
.login-form label { font-size: .84rem; font-weight: 720; margin-top: 5px; }
.password-field { position: relative; }
.password-field input { padding-right: 64px; }
.password-field button { position: absolute; inset: 6px 7px 6px auto; }
.login-submit { margin-top: 10px; justify-content: space-between; min-height: 48px; }
.privacy { margin-top: 23px; color: var(--muted); font-size: .77rem; display: flex; gap: 7px; align-items: center; }
.privacy .icon, footer .icon { width: 15px; height: 15px; }

.topbar { background: #101528; border-bottom: 1px solid var(--line); }
.topbar-inner { width: min(1240px, 100%); margin: auto; min-height: 72px; padding: 12px clamp(15px, 3vw, 36px); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.connection { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid #3b4059; border-radius: 999px; color: var(--muted); font-size: .79rem; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #a8b0c4; }
.connection[data-status="online"] { color: var(--green); border-color: #326052; background: #14393359; }
.connection[data-status="online"] .dot { background: var(--green); box-shadow: 0 0 10px #77e4bd77; }
.connection[data-status="offline"] { color: var(--warn); border-color: #674b3d; background: #4b2d2733; }
.connection[data-status="offline"] .dot { background: var(--warn); }
.studio { width: min(1240px, 100%); margin: auto; padding: 28px clamp(15px, 3vw, 36px) 0; }
.hero { position: relative; overflow: hidden; display: flex; flex-wrap: wrap; gap: 20px; align-items: end; justify-content: space-between; padding: 27px clamp(20px, 4vw, 36px); border: 1px solid #373b60; border-radius: 21px; background: radial-gradient(ellipse at 98% 14%, #493871 0, transparent 44%), linear-gradient(125deg, #1a2241, #201c42 68%, #242644); }
.hero h1 { font-size: clamp(1.9rem, 4vw, 2.85rem); letter-spacing: .015em; margin: 7px 0 8px; line-height: 1.2; }
.hero p:not(.eyebrow) { color: #c4cbe7; line-height: 1.55; font-size: .93rem; }
.eyebrow { color: #c9b8ff; font-size: .72rem; letter-spacing: .2em; font-weight: 750; display: flex; gap: 9px; align-items: center; }
.eyebrow span { width: 17px; height: 1px; background: var(--accent); }
.hero-tags { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.hero-tags span { display: flex; align-items: center; gap: 7px; padding: 8px 11px; background: #14162d80; color: #ded9f7; border: 1px solid #665983; border-radius: 9px; font-size: .78rem; }
.hero-tags .icon { color: #d5c4ff; width: 16px; height: 16px; }
.notice { border-radius: 11px; background: #49302161; border: 1px solid #6a4a37; padding: 12px 15px; margin-top: 15px; color: #f6d6a5; font-size: .86rem; line-height: 1.55; }
.workbench { display: grid; grid-template-columns: minmax(310px, 405px) minmax(0, 1fr); align-items: start; gap: 18px; margin-top: 18px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 19px; background: var(--panel); box-shadow: 0 10px 35px #0002; }
.compose, .preview, .gallery { padding: clamp(16px, 2.1vw, 24px); }
.panel-title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.section-icon { color: #d4c3ff; background: #292642; border: 1px solid #463d64; display: grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 11px; }
.panel-title h2 { font-size: 1.03rem; font-weight: 750; }
.panel-title p { color: var(--muted); font-size: .76rem; margin-top: 4px; line-height: 1.45; }
.field-label, legend { font-size: .86rem; font-weight: 730; }
.field-label { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin: 17px 0 8px; }
.field-label .hint { font-weight: 500; }
input:not([type="radio"]), textarea, select { min-width: 0; display: block; width: 100%; padding: 11px 12px; border: 1px solid #353e5b; border-radius: 10px; background: var(--field); color: var(--text); font-size: .91rem; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #8895b4; }
textarea { resize: vertical; min-height: 72px; }
textarea:disabled { opacity: .55; }
.mode-field { margin: 15px 0 0; border: 0; min-width: 0; padding: 0; }
.mode-field legend { margin-bottom: 8px; padding: 0; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.mode { display: flex; align-items: center; gap: 8px; padding: 10px 9px; cursor: pointer; border-radius: 10px; background: #13182a; border: 1px solid #343c57; min-width: 0; }
.mode:has(input:checked) { border-color: #a290dc; background: #2b2546; }
.mode input { flex: 0 0 auto; accent-color: #c6b3ff; margin: 0; }
.mode b, .mode small { display: block; }
.mode b { font-size: .88rem; }
.mode small { color: #c0c8de; font-size: .7rem; margin-top: 4px; line-height: 1.4; }
.field-note, .form-foot { font-size: .75rem; color: var(--muted); line-height: 1.55; margin-top: 8px; }
.advanced { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 13px; }
.advanced summary { font-size: .84rem; color: #d2d8ed; font-weight: 650; }
.advanced summary .icon { width: 15px; height: 15px; vertical-align: text-bottom; margin: 0 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.compose .field-error { margin-top: 12px; }
.generate { width: 100%; min-height: 46px; margin-top: 16px; }
.form-foot { text-align: center; }

.preview-head, .gallery-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.badge { flex: 0 0 auto; padding: 6px 10px; border-radius: 999px; border: 1px solid #46506d; background: #1d2540; color: #c6cdef; font-size: .72rem; }
.badge[data-kind="done"] { background: #17403565; color: var(--green); border-color: #366b5c; }
.badge[data-kind="busy"] { background: #392b5f; color: #e3d6ff; border-color: #6f5c9d; }
.badge[data-kind="error"] { background: #5025365f; color: #ffbeca; border-color: #734052; }
.canvas {
  margin-top: 15px; min-height: clamp(290px, 42vw, 468px); border-radius: 14px; overflow: hidden;
  border: 1px solid #2c3756; background: radial-gradient(ellipse at 49% 43%, #242b4b 0, transparent 64%), #0e1428;
  display: grid; place-items: center;
}
.canvas:has(.image-link:not([hidden])) { min-height: 0; background: #0a0d18; }
.empty { padding: 30px 18px; text-align: center; }
.canvas-mark { display: grid; place-items: center; width: 78px; height: 78px; margin: 0 auto 15px; border: 1px solid #665a91; background: linear-gradient(145deg, #3a315b, #202a48); border-radius: 25px; box-shadow: 0 0 0 11px #3d3b661f, 0 0 0 22px #3d3b6610; color: #d6c5ff; }
.canvas-mark .icon { width: 38px; height: 38px; stroke-width: 1.1; }
.empty strong { font-size: 1.02rem; }
.empty p { margin-top: 8px; max-width: 320px; color: var(--muted); font-size: .83rem; line-height: 1.65; }
.image-link { display: flex; width: 100%; align-items: center; justify-content: center; }
.image-link img { display: block; max-width: 100%; max-height: min(74vh, 720px); max-height: clamp(285px, calc(100svh - 446px), 640px); object-fit: contain; }
.progress-area { margin-top: 17px; }
.progress-info, .progress-actions, .result-actions { display: flex; justify-content: space-between; align-items: center; gap: 9px; }
.progress-info { margin-bottom: 9px; font-size: .85rem; color: #e2d9fa; }
#step-label { flex: 0 0 auto; font-variant-numeric: tabular-nums; color: #d5c4ff; }
.progress-actions { margin-top: 9px; }
progress { display: block; width: 100%; height: 9px; appearance: none; border: none; border-radius: 999px; background: #333c59; overflow: hidden; color: #c4aaff; }
progress::-webkit-progress-bar { background: #333c59; }
progress::-webkit-progress-value { background: linear-gradient(90deg, #9c80ea, #adcaff); border-radius: 999px; }
progress::-moz-progress-bar { background: linear-gradient(90deg, #9c80ea, #adcaff); }
.result-actions { margin-top: 14px; flex-wrap: wrap; }
.result-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.gallery { margin-top: 18px; }
.gallery-status { margin-top: 15px; font-size: .83rem; }
.gallery-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.gallery-grid:empty { margin-top: 0; }
.gallery-card { color: var(--text); display: block; text-align: left; min-width: 0; width: 100%; padding: 0; background: #10162b; border: 1px solid #37415f; border-radius: 11px; overflow: hidden; }
.gallery-card:hover { border-color: #a290dc; }
.gallery-card img, .gallery-placeholder { width: 100%; aspect-ratio: 1.45; object-fit: cover; display: block; background: #222b44; }
.gallery-placeholder { display: grid; place-items: center; font-size: .73rem; color: var(--muted); }
.gallery-card strong, .gallery-card small { display: block; padding: 0 9px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.gallery-card strong { margin-top: 8px; font-size: .78rem; }
.gallery-card small { margin: 4px 0 9px; color: var(--muted); font-size: .68rem; }
footer { color: var(--muted); display: flex; justify-content: center; align-items: center; gap: 8px; padding: 20px 0; font-size: .75rem; }
.toast { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); background: #232b47; border: 1px solid #596288; color: #f2efff; padding: 11px 16px; border-radius: 11px; box-shadow: 0 10px 35px #0006; font-size: .85rem; z-index: 5; }

@media (max-width: 850px) {
  .workbench { grid-template-columns: minmax(0, 1fr); }
  .canvas { min-height: 310px; }
  .image-link img { max-height: 75vh; max-height: 75svh; }
  .gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .login-view { padding: 16px; }
  .login-frame { max-width: 445px; grid-template-columns: minmax(0, 1fr); }
  .login-art { min-height: 157px; }
  .art-orbit { inset: -72px -67px auto auto; transform: rotate(-23deg) scale(.66); }
  .art-orbit-b { inset: -56px -66px auto auto; transform: rotate(28deg) scale(.68); }
  .art-glow { inset: 21px 39px auto auto; width: 85px; height: 85px; }
  .art-point { inset: 22px 23px auto auto; width: 8px; height: 8px; }
  .art-copy { bottom: 18px; left: 24px; gap: 7px; }
  .art-copy strong { font-size: 1.38rem; }
  .art-copy span { font-size: .62rem; }
  .login-content h1 { margin-top: 19px; }
  .topbar-inner { min-height: 62px; }
  .top-actions { gap: 6px; }
  .connection { padding: 7px 8px; }
  .top-actions button { padding: 7px 9px; }
  .top-actions button span { display: none; }
  .studio { padding-top: 15px; }
  .hero { padding: 18px; gap: 13px; }
  .workbench, .gallery { margin-top: 13px; }
  .workbench { gap: 13px; }
  .canvas { min-height: 270px; }
  .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 390px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode-grid { gap: 7px; }
  .mode { gap: 6px; padding-inline: 7px; }
}
