:root {
  color-scheme: dark;
  --bg: #07101d;
  --surface: rgba(15, 28, 45, 0.88);
  --surface-strong: #111f31;
  --line: rgba(151, 176, 203, 0.17);
  --line-bright: rgba(136, 166, 199, 0.32);
  --text: #f4f8fc;
  --muted: #91a2b5;
  --cyan: #42e8d0;
  --cyan-soft: rgba(66, 232, 208, 0.11);
  --blue: #6da8ff;
  --danger: #ff8f9b;
  --radius: 24px;
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 82% 6%, rgba(27, 111, 132, 0.2), transparent 27rem),
    radial-gradient(circle at 5% 45%, rgba(36, 73, 135, 0.16), transparent 30rem),
    linear-gradient(145deg, #07101d 0%, #091523 48%, #07101b 100%);
  overflow-x: hidden;
}

button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .12;
  pointer-events: none;
}

.ambient-one { width: 420px; height: 420px; right: -180px; top: 18%; background: #1de0c8; }
.ambient-two { width: 520px; height: 520px; left: -310px; bottom: 0; background: #3b73d9; }

.site-header {
  width: min(1380px, calc(100% - 48px));
  height: 82px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 18px;
  font-weight: 720;
  letter-spacing: .04em;
}

.brand-mark {
  position: relative;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(66, 232, 208, .6);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(66, 232, 208, .16), rgba(109, 168, 255, .06));
  box-shadow: inset 0 0 16px rgba(66, 232, 208, .08), 0 0 28px rgba(66, 232, 208, .08);
}

.brand-mark i { position: absolute; display: block; width: 11px; height: 11px; border: 2px solid var(--cyan); transform: rotate(45deg); }
.brand-mark i:first-child { left: 7px; top: 7px; border-right: 0; border-bottom: 0; }
.brand-mark i:last-child { right: 7px; bottom: 7px; border-left: 0; border-top: 0; }

.model-badge, .secure-pill, .status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-bright);
  border-radius: 999px;
  padding: 8px 12px;
  color: #b9c7d6;
  background: rgba(11, 23, 38, .7);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
}

.model-badge span { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }

.page-shell { width: min(1380px, calc(100% - 48px)); margin: 0 auto; }

.intro { max-width: 760px; padding: 74px 0 48px; }
.eyebrow, .step-label { margin: 0 0 13px; color: var(--cyan); font-size: 11px; font-weight: 750; letter-spacing: .2em; text-transform: uppercase; }
.intro h1 { margin: 0; max-width: 720px; font-size: clamp(42px, 5.7vw, 76px); line-height: 1.05; letter-spacing: -.055em; font-weight: 760; }
.intro h1 span { display: block; color: transparent; background: linear-gradient(100deg, #e8fcf9 4%, var(--cyan) 58%, #74aaff); background-clip: text; -webkit-background-clip: text; }
.intro-copy { max-width: 630px; margin: 25px 0 0; color: var(--muted); font-size: 16px; line-height: 1.85; }

.workspace { display: grid; grid-template-columns: minmax(0, .92fr) minmax(440px, 1.08fr); gap: 22px; align-items: stretch; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(17, 32, 51, .94), rgba(11, 23, 37, .9)); box-shadow: 0 24px 70px rgba(0, 0, 0, .23); backdrop-filter: blur(20px); }
.form-panel { padding: clamp(24px, 3vw, 38px); }
.panel-heading, .result-heading, .result-actions { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.panel h2 { margin: 0; font-size: 23px; letter-spacing: -.02em; }
.secure-pill { color: #83d8cc; border-color: rgba(66, 232, 208, .2); background: var(--cyan-soft); letter-spacing: .04em; white-space: nowrap; }
.secure-pill::before { content: ""; width: 7px; height: 7px; border: 1px solid var(--cyan); border-radius: 50%; }

form { margin-top: 34px; }
.field-group { margin: 0 0 29px; padding: 0; border: 0; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.field-label-row label, legend { color: #dfe8f1; font-size: 13px; font-weight: 680; }
.field-label-row span { color: #687b90; font-size: 11px; }
.field-label-row strong { color: #8fa2b6; font-weight: 600; }

input[type="password"], input[type="text"], textarea {
  width: 100%;
  color: var(--text);
  border: 1px solid var(--line-bright);
  border-radius: 13px;
  outline: 0;
  background: rgba(5, 15, 27, .64);
  transition: border-color .2s, box-shadow .2s, background .2s;
}

input[type="password"], input[type="text"] { height: 50px; padding: 0 70px 0 15px; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 13px; }
textarea { min-height: 148px; resize: vertical; padding: 15px; font-size: 14px; line-height: 1.75; }
input:focus, textarea:focus { border-color: rgba(66, 232, 208, .7); background: rgba(7, 20, 34, .9); box-shadow: 0 0 0 3px rgba(66, 232, 208, .08); }
::placeholder { color: #526579; }

.key-control { position: relative; }
.text-button { position: absolute; right: 8px; top: 8px; height: 34px; padding: 0 9px; color: #8ea3b9; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font-size: 12px; }
.text-button:hover { color: var(--cyan); background: var(--cyan-soft); }
.remember-control { display: inline-flex; align-items: center; gap: 8px; margin-top: 11px; color: #8092a5; font-size: 12px; cursor: pointer; }
.remember-control input { position: absolute; opacity: 0; pointer-events: none; }
.checkbox-ui { position: relative; width: 16px; height: 16px; border: 1px solid #607489; border-radius: 5px; background: #091625; }
.remember-control input:checked + .checkbox-ui { border-color: var(--cyan); background: var(--cyan); }
.remember-control input:checked + .checkbox-ui::after { content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px; border: solid #07131f; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.privacy-note { display: flex; align-items: center; gap: 7px; margin: 10px 0 0; color: #62778b; font-size: 11px; }
.privacy-note span { color: var(--cyan); font-size: 7px; }

.prompt-examples { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.prompt-examples button { padding: 6px 10px; color: #73889d; border: 1px solid var(--line); border-radius: 999px; background: rgba(7, 17, 29, .35); cursor: pointer; font-size: 11px; }
.prompt-examples button:hover { color: var(--cyan); border-color: rgba(66, 232, 208, .28); }

legend { margin-bottom: 11px; }
.choice-grid { display: grid; gap: 9px; }
.style-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice-card { position: relative; min-height: 76px; display: flex; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(5, 15, 27, .4); cursor: pointer; transition: .2s; }
.choice-card:hover { border-color: var(--line-bright); transform: translateY(-1px); }
.choice-card input, .segmented-control input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card:has(input:checked) { border-color: rgba(66, 232, 208, .62); background: linear-gradient(145deg, rgba(66, 232, 208, .11), rgba(42, 100, 128, .08)); box-shadow: inset 0 0 0 1px rgba(66, 232, 208, .05); }
.choice-card:has(input:checked)::after { content: "✓"; position: absolute; top: 9px; right: 10px; color: var(--cyan); font-size: 11px; }
.choice-card strong, .choice-card small { display: block; }
.choice-card strong { color: #dce7f1; font-size: 12px; margin-bottom: 5px; }
.choice-card small { color: #697d91; font-size: 10px; }
.choice-icon { position: relative; flex: 0 0 38px; height: 38px; border-radius: 10px; background: rgba(75, 118, 159, .11); }
.photo-icon::before { content: ""; position: absolute; inset: 9px 7px 8px; border: 1px solid #7e9ab6; border-radius: 4px; }
.photo-icon::after { content: ""; position: absolute; width: 7px; height: 7px; left: 15px; top: 14px; border: 1px solid var(--cyan); border-radius: 50%; }
.general-icon::before { content: "✦"; position: absolute; inset: 7px; text-align: center; color: #7fa7d0; font-size: 19px; }
.illustration-icon::before { content: "◒"; position: absolute; inset: 8px; text-align: center; color: #8aa7c4; font-size: 18px; transform: rotate(-25deg); }
.product-icon::before { content: "◇"; position: absolute; inset: 7px; text-align: center; color: #8aa7c4; font-size: 21px; }

.settings-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.compact-group { min-width: 0; }
.segmented-control { display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(4, 13, 24, .48); }
.segmented-control label { position: relative; min-width: 0; cursor: pointer; }
.segmented-control span { height: 38px; display: flex; align-items: center; justify-content: center; gap: 6px; color: #71859a; border-radius: 8px; font-size: 11px; transition: .2s; }
.segmented-control input:checked + span { color: #dbfdf8; background: rgba(66, 232, 208, .13); box-shadow: 0 1px 8px rgba(0, 0, 0, .15); }
.segmented-control i { display: block; border: 1px solid currentColor; border-radius: 2px; }
.ratio-square { width: 10px; height: 10px; }
.ratio-landscape { width: 13px; height: 9px; }
.ratio-portrait { width: 8px; height: 12px; }

.error-message { margin: -8px 0 16px; padding: 12px 14px; color: #ffc1c7; border: 1px solid rgba(255, 110, 125, .25); border-radius: 11px; background: rgba(133, 32, 49, .15); font-size: 12px; line-height: 1.6; }
.generate-button { width: 100%; height: 57px; display: grid; grid-template-columns: 30px 1fr 30px; align-items: center; padding: 0 18px; color: #06211f; border: 0; border-radius: 14px; background: linear-gradient(100deg, #38d9c5, #54f0d7 55%, #77d9e6); box-shadow: 0 12px 35px rgba(45, 221, 200, .17); cursor: pointer; font-weight: 770; letter-spacing: .02em; transition: transform .2s, filter .2s; }
.generate-button:hover { transform: translateY(-2px); filter: brightness(1.05); }
.generate-button:disabled { cursor: wait; transform: none; filter: grayscale(.25) brightness(.72); }
.button-spark { font-size: 17px; }.button-arrow { font-size: 22px; }
.billing-hint { margin: 11px 0 0; color: #5f7286; text-align: center; font-size: 10px; }

.result-panel { position: relative; min-height: 820px; padding: clamp(24px, 3vw, 38px); overflow: hidden; display: flex; flex-direction: column; }
.result-panel::before { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(116, 144, 171, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(116, 144, 171, .035) 1px, transparent 1px); background-size: 32px 32px; mask-image: linear-gradient(to bottom, transparent, black 25%, black 80%, transparent); }
.result-heading { position: relative; z-index: 1; }
.status-pill { letter-spacing: .02em; font-weight: 600; color: #71879d; }
.status-pill.working { color: var(--cyan); border-color: rgba(66, 232, 208, .28); }
.status-pill.complete { color: #8df5d5; background: rgba(49, 174, 138, .1); }
.status-pill.failed { color: #ffb2bb; border-color: rgba(255, 110, 125, .25); background: rgba(133, 32, 49, .12); }
.result-status-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.service-check-button, .retry-button { color: #9fb1c3; border: 1px solid var(--line); border-radius: 9px; background: rgba(6, 16, 28, .55); cursor: pointer; font-size: 10px; font-weight: 650; }
.service-check-button { min-height: 33px; padding: 0 11px; }
.service-check-button:hover, .retry-button:hover { color: var(--cyan); border-color: rgba(66, 232, 208, .3); background: var(--cyan-soft); }
.service-check-button:disabled { cursor: wait; opacity: .6; }
.service-monitor { position: relative; z-index: 1; min-height: 44px; display: flex; align-items: center; gap: 11px; margin-top: 20px; padding: 10px 12px; color: #6f8499; border: 1px solid var(--line); border-radius: 11px; background: rgba(5, 14, 25, .42); font-size: 10px; line-height: 1.5; }
.service-indicator { display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; color: #9caec0; font-weight: 700; }
.service-indicator i { width: 7px; height: 7px; border-radius: 50%; background: #8192a3; box-shadow: 0 0 8px rgba(129, 146, 163, .35); }
.service-indicator.online { color: #8ce9d7; }.service-indicator.online i { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.service-indicator.offline { color: #ffacb6; }.service-indicator.offline i { background: #ff7180; box-shadow: 0 0 9px rgba(255, 113, 128, .7); }
.service-indicator.checking i { animation: pulse-status 1s ease-in-out infinite alternate; }
@keyframes pulse-status { to { opacity: .3; transform: scale(.8); } }

.empty-result, .loading-result { position: relative; z-index: 1; flex: 1; min-height: 580px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-result h3, .loading-result h3 { margin: 28px 0 10px; font-size: 19px; }
.empty-result p, .loading-result p { max-width: 390px; margin: 0; color: #6d8297; font-size: 13px; line-height: 1.8; }
.empty-visual { position: relative; width: 210px; height: 172px; opacity: .8; }
.visual-frame { position: absolute; inset: 12px 17px 18px; border: 1px solid rgba(96, 225, 208, .31); border-radius: 25px; transform: rotate(-2deg); box-shadow: inset 0 0 50px rgba(66, 232, 208, .04), 0 0 45px rgba(66, 232, 208, .04); }
.visual-frame::before { content: ""; position: absolute; inset: 10px; border: 1px dashed rgba(117, 153, 186, .17); border-radius: 18px; }
.visual-sun { position: absolute; width: 24px; height: 24px; right: 47px; top: 45px; border: 1px solid rgba(66, 232, 208, .5); border-radius: 50%; box-shadow: 0 0 24px rgba(66, 232, 208, .13); }
.visual-mountain { position: absolute; bottom: 45px; border: solid transparent; transform: rotate(-3deg); }
.visual-mountain.one { left: 44px; border-width: 0 46px 55px; border-bottom-color: rgba(76, 124, 164, .18); }
.visual-mountain.two { right: 39px; border-width: 0 39px 43px; border-bottom-color: rgba(66, 232, 208, .1); }
.empty-visual i { position: absolute; color: var(--cyan); font-style: normal; text-shadow: 0 0 15px var(--cyan); }
.spark-one { left: 0; top: 46px; font-size: 11px; }.spark-two { right: 0; bottom: 25px; font-size: 8px; }

.loader-orbit { position: relative; width: 86px; height: 86px; border: 1px solid rgba(66, 232, 208, .18); border-radius: 50%; animation: spin 2s linear infinite; }
.loader-orbit::before, .loader-orbit::after { content: ""; position: absolute; border-radius: 50%; }
.loader-orbit::before { inset: 12px; border: 1px dashed rgba(109, 168, 255, .28); }
.loader-orbit::after { width: 9px; height: 9px; top: -5px; left: calc(50% - 4px); background: var(--cyan); box-shadow: 0 0 18px var(--cyan); }
.loader-orbit span { position: absolute; inset: 31px; border-radius: 8px; background: linear-gradient(145deg, var(--cyan), var(--blue)); box-shadow: 0 0 25px rgba(66, 232, 208, .25); transform: rotate(45deg); }
@keyframes spin { to { transform: rotate(360deg); } }
.elapsed-time { margin-top: 22px; padding: 7px 12px; color: #8aa0b5; border: 1px solid var(--line); border-radius: 999px; font-family: ui-monospace, monospace; font-size: 11px; }
.progress-steps { width: min(100%, 430px); display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 27px 0 0; padding: 0; list-style: none; text-align: left; }
.progress-steps li { min-width: 0; display: flex; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: rgba(5, 14, 25, .4); }
.progress-steps li > i { flex: 0 0 auto; width: 8px; height: 8px; margin-top: 3px; border: 1px solid #65798d; border-radius: 50%; }
.progress-steps strong, .progress-steps small { display: block; }
.progress-steps strong { color: #9dafc1; font-size: 10px; }.progress-steps small { margin-top: 4px; color: #596d81; font-size: 8px; line-height: 1.45; }
.progress-steps li.complete > i { border-color: var(--cyan); background: var(--cyan); box-shadow: 0 0 8px rgba(66, 232, 208, .55); }
.progress-steps li.complete strong { color: #91dccf; }
.progress-steps li.active { border-color: rgba(66, 232, 208, .25); background: rgba(66, 232, 208, .06); }
.progress-steps li.active > i { border-color: var(--cyan); box-shadow: 0 0 8px var(--cyan); animation: pulse-status .8s ease-in-out infinite alternate; }
.progress-steps li.active strong { color: var(--cyan); }

.structured-error { position: relative; z-index: 1; width: min(100%, 560px); align-self: center; display: flex; gap: 17px; margin: auto 0; padding: 24px; color: #d9e3ed; border: 1px solid rgba(255, 110, 125, .28); border-radius: 17px; background: linear-gradient(145deg, rgba(105, 29, 43, .18), rgba(19, 25, 39, .88)); box-shadow: 0 20px 50px rgba(0, 0, 0, .18); }
.error-symbol { flex: 0 0 auto; width: 32px; height: 32px; display: grid; place-items: center; color: #ffc0c6; border: 1px solid rgba(255, 130, 143, .4); border-radius: 50%; background: rgba(255, 102, 119, .1); font-weight: 800; }
.structured-error-copy { min-width: 0; flex: 1; }
.error-kicker { margin: 0 0 7px; color: #ff929e; font-size: 9px; font-weight: 750; letter-spacing: .14em; }
.structured-error h3 { margin: 0 0 18px; font-size: 19px; }
.structured-error dl { display: grid; gap: 13px; margin: 0; }
.structured-error dl div { display: grid; grid-template-columns: 62px 1fr; gap: 10px; }
.structured-error dt { color: #73879b; font-size: 10px; font-weight: 700; }.structured-error dd { margin: 0; color: #b9c8d6; font-size: 11px; line-height: 1.65; }
.error-billing-note { margin: 15px 0 0; padding: 10px 11px; color: #9aaec0; border: 1px solid var(--line); border-radius: 9px; background: rgba(5, 14, 25, .42); font-size: 9px; line-height: 1.6; }
.support-line { margin: 16px 0 0; color: #667b90; font-size: 9px; }.support-line code { color: #8fa4b8; overflow-wrap: anywhere; }
.retry-button { margin-top: 15px; min-height: 38px; padding: 0 14px; }

.completed-result { position: relative; z-index: 1; flex: 1; margin-top: 28px; min-height: 0; display: flex; flex-direction: column; }
.image-stage { flex: 1; min-height: 560px; display: flex; align-items: center; justify-content: center; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: rgba(3, 10, 18, .58); overflow: hidden; }
.image-stage img { display: block; width: 100%; height: 100%; max-height: 660px; object-fit: contain; border-radius: 11px; }
.result-actions { align-items: center; padding: 18px 4px 0; }
.result-actions strong, .result-actions span { display: block; }
.result-actions strong { font-size: 13px; }.result-actions div > span { margin-top: 4px; color: #71869a; font-size: 11px; }
.download-button { display: inline-flex; align-items: center; gap: 10px; padding: 11px 15px; color: #d9f8f3; border: 1px solid rgba(66, 232, 208, .25); border-radius: 11px; background: rgba(66, 232, 208, .09); text-decoration: none; font-size: 12px; font-weight: 650; }
.download-button:hover { background: rgba(66, 232, 208, .16); }

footer { width: min(1380px, calc(100% - 48px)); margin: 35px auto 0; padding: 25px 0 36px; display: flex; justify-content: space-between; gap: 20px; color: #43566a; border-top: 1px solid var(--line); font-size: 10px; letter-spacing: .04em; }
footer p { margin: 0; }

[hidden] { display: none !important; }

@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .result-panel { min-height: 680px; }
  .empty-result, .loading-result { min-height: 470px; }
}

@media (max-width: 640px) {
  .site-header, .page-shell, footer { width: min(100% - 28px, 1380px); }
  .site-header { height: 68px; }
  .model-badge { padding: 7px 9px; font-size: 9px; }
  .intro { padding: 51px 0 34px; }
  .intro h1 { font-size: clamp(39px, 13vw, 56px); }
  .intro-copy { font-size: 14px; }
  .panel { border-radius: 19px; }
  .form-panel, .result-panel { padding: 21px; }
  .style-grid, .settings-row { grid-template-columns: 1fr; }
  .style-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .choice-card { padding: 10px; gap: 8px; }
  .choice-icon { flex-basis: 32px; height: 32px; }
  .result-panel { min-height: 580px; }
  .empty-result, .loading-result { min-height: 390px; }
  .image-stage { min-height: 330px; }
  .result-heading { align-items: flex-start; }
  .result-status-actions { max-width: 160px; }
  .service-monitor { align-items: flex-start; flex-direction: column; }
  .progress-steps { grid-template-columns: 1fr; }
  .structured-error { padding: 19px; }
  .structured-error dl div { grid-template-columns: 1fr; gap: 4px; }
  footer { flex-direction: column; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
