:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --ink: #17211d;
  --muted: #65706b;
  --line: #dce3df;
  --surface: #ffffff;
  --canvas: #f4f7f5;
  --forest: #12372a;
  --forest-2: #1f5c45;
  --mint: #dff3e9;
  --coral: #e76346;
  --coral-soft: #fff0eb;
  --blue: #2864dc;
  --danger: #b42318;
  --shadow: 0 16px 40px rgba(18, 55, 42, 0.10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); color: var(--ink); line-height: 1.55; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
:where(a, button, input, textarea, select):focus-visible { outline: 3px solid #6aa6ff; outline-offset: 2px; }
.skip-link { position: fixed; z-index: 50; inset: .75rem auto auto .75rem; padding: .65rem 1rem; background: white; color: var(--forest); transform: translateY(-150%); border-radius: 4px; }
.skip-link:focus { transform: translateY(0); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 .35rem; color: var(--coral); font-size: .72rem; font-weight: 800; letter-spacing: .12em; }
.brand-mark { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 6px; background: var(--coral); color: white; font-size: 1.25rem; font-weight: 900; box-shadow: 5px 5px 0 rgba(255,255,255,.16); }
.brand-mark.small { width: 2rem; height: 2rem; font-size: .85rem; box-shadow: none; }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(20rem, 1.05fr) minmax(24rem, .95fr); background: var(--surface); }
.auth-brand { display: flex; flex-direction: column; justify-content: center; padding: clamp(3rem, 8vw, 8rem); background: var(--forest); color: white; position: relative; overflow: hidden; }
.auth-brand::after { content: ""; position: absolute; width: 18rem; height: 18rem; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; right: -7rem; bottom: -6rem; box-shadow: 0 0 0 4rem rgba(255,255,255,.025), 0 0 0 8rem rgba(255,255,255,.02); }
.auth-brand .eyebrow { margin-top: 2rem; }
.auth-brand h1 { max-width: 10ch; margin: 0; font-size: clamp(2.7rem, 6vw, 5.8rem); line-height: 1.02; letter-spacing: 0; }
.auth-lead { max-width: 34rem; color: #cde1d8; font-size: 1.1rem; }
.auth-points { display: grid; gap: .75rem; margin: 2rem 0 0; padding: 0; max-width: 30rem; list-style: none; }
.auth-points li { display: flex; justify-content: space-between; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid rgba(255,255,255,.13); }
.auth-points span { color: #b5cdc2; }
.auth-panel { display: grid; place-items: center; padding: 2rem; }
.auth-card { width: min(100%, 27rem); }
.auth-card h2 { margin: 1.8rem 0 .2rem; font-size: 2rem; }
.section-intro { margin: 0 0 1.6rem; color: var(--muted); }
.auth-switch { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.auth-tab { min-height: 3rem; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font-weight: 700; }
.auth-tab.is-active { border-bottom-color: var(--coral); color: var(--ink); }

.field { display: grid; gap: .42rem; margin-bottom: 1.1rem; }
.field label, fieldset legend { font-weight: 750; }
.field-hint { color: var(--muted); font-size: .8rem; }
input, textarea, select { width: 100%; min-height: 3rem; border: 1px solid #b9c4bf; border-radius: 5px; padding: .75rem .85rem; background: #fff; color: var(--ink); font-size: 1rem; }
textarea { min-height: 9rem; resize: vertical; }
input:user-invalid, textarea:user-invalid, select:user-invalid { border-color: var(--danger); }
.primary, .ghost { min-height: 3rem; border-radius: 5px; padding: .7rem 1rem; font-weight: 800; }
.primary { border: 1px solid var(--forest); background: var(--forest); color: white; }
.primary:hover { background: var(--forest-2); border-color: var(--forest-2); }
.ghost { border: 1px solid #b7c4be; background: white; color: var(--ink); }
.ghost:hover { background: #f0f5f2; }
.button-link { display: inline-flex; align-items: center; justify-content: center; color: var(--ink); text-decoration: none; }
.wide { width: 100%; }
.compact { min-height: 2.45rem; padding: .45rem .7rem; font-size: .88rem; }
.form-message { min-height: 1.5rem; margin: .65rem 0 0; color: var(--muted); font-size: .9rem; }
.form-message.error { color: var(--danger); }
.form-message.success { color: var(--forest-2); }

.app-shell { min-height: 100vh; }
.topbar { position: sticky; z-index: 20; top: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 4.7rem; padding: .65rem clamp(1rem, 4vw, 3.5rem); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.wordmark { display: flex; align-items: center; gap: .7rem; color: var(--ink); text-decoration: none; font-weight: 900; }
.main-nav { display: flex; align-items: center; gap: .2rem; }
.nav-button { min-height: 2.65rem; padding: .55rem .9rem; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-weight: 750; }
.nav-button:hover, .nav-button.is-active { background: var(--mint); color: var(--forest); }
.account-cluster { position: relative; display: flex; justify-content: flex-end; align-items: center; gap: .7rem; }
.balance-box { display: grid; line-height: 1.15; text-align: right; }
.balance-box span { color: var(--muted); font-size: .72rem; }
.balance-box strong { font-size: 1rem; }
#account-button { display: flex; align-items: center; gap: .5rem; }
.avatar { display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--coral-soft); color: var(--coral); }
.account-menu { position: absolute; top: calc(100% + .7rem); right: 0; width: 13rem; padding: 1rem; border: 1px solid var(--line); border-radius: 6px; background: white; box-shadow: var(--shadow); }
.account-menu p { margin: 0 0 .5rem; }
.account-menu .recharge-note { padding-top: .45rem; border-top: 1px solid var(--line); font-size: .78rem; }
.account-menu button { width: 100%; border: 0; border-top: 1px solid var(--line); padding: .7rem 0 0; margin-top: .5rem; background: transparent; text-align: left; }
.text-danger { color: var(--danger); }

main { width: min(100%, 92rem); margin-inline: auto; padding: clamp(1.4rem, 4vw, 3.5rem); }
.view { animation: appear .2s ease-out; }
@keyframes appear { from { opacity: .5; transform: translateY(5px); } }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; margin-bottom: 2rem; }
.page-heading h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.05; }
.page-heading p:not(.eyebrow) { margin: .55rem 0 0; color: var(--muted); }
.status-chip, .badge { display: inline-flex; align-items: center; gap: .4rem; width: max-content; padding: .4rem .7rem; border-radius: 999px; font-size: .78rem; font-weight: 750; }
.status-chip::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.status-ok { background: var(--mint); color: var(--forest-2); }
.status-warn { background: #fff3d3; color: #805d00; }
.status-error { background: #fee8e5; color: var(--danger); }
.studio-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(19rem, .65fr); gap: 1.5rem; align-items: start; }
.generation-form, .panel, .activity-panel { padding: clamp(1.1rem, 3vw, 2rem); border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: 0 7px 24px rgba(18,55,42,.045); }
.studio-layout > * { min-width: 0; }
.activity-panel { padding: 1.25rem; border-radius: 12px; }
.activity-panel .panel-heading { align-items: center; margin-bottom: .5rem; }
.activity-panel .panel-heading h2 { font-size: 1.05rem; font-weight: 750; }
.activity-panel .panel-heading p { margin-top: .25rem; font-size: .75rem; }
.activity-panel #refresh-orders { min-height: 2.25rem; padding: .35rem .65rem; border-color: var(--line); border-radius: 7px; font-size: .78rem; font-weight: 600; }
.activity-footer { display: flex; justify-content: space-between; align-items: center; min-height: 2.75rem; margin-top: .5rem; padding-top: .65rem; border-top: 1px solid var(--line); color: var(--forest-2); text-decoration: none; font-size: .8rem; font-weight: 650; }
.activity-footer:hover { text-decoration: underline; }
.source-reference { display: grid; grid-template-columns: 5rem minmax(0, 1fr) auto; align-items: center; gap: 1rem; margin-bottom: 1.35rem; padding: .8rem; border: 1px solid #93b5a5; border-radius: 6px; background: #f2faf6; }
.source-reference img { width: 5rem; height: 5rem; border-radius: 4px; object-fit: cover; background: #dce7e1; }
.source-reference h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; }
.source-reference p:not(.eyebrow) { margin: .2rem 0 0; color: var(--muted); font-size: .78rem; }
.field-meta { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .78rem; }
.choice-fieldset { margin: 1.5rem 0 0; padding: 0; border: 0; }
.choice-fieldset legend { margin-bottom: .65rem; }
.price-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: .65rem; }
.price-option { position: relative; cursor: pointer; }
.price-option input, .ratio-options input { position: absolute; opacity: 0; pointer-events: none; }
.price-body { display: grid; min-height: 7.2rem; padding: .85rem; border: 1px solid #b9c4bf; border-radius: 5px; background: white; }
.price-body strong { font-size: 1.35rem; }
.price-body span { color: var(--muted); font-size: .78rem; }
.price-body b { align-self: end; color: var(--coral); }
.price-option input:checked + .price-body { border: 2px solid var(--forest); padding: calc(.85rem - 1px); background: #f2faf6; box-shadow: inset 0 -4px 0 var(--mint); }
.price-option input:focus-visible + .price-body, .ratio-options input:focus-visible + span { outline: 3px solid #6aa6ff; outline-offset: 2px; }
.fieldset-note { margin: .55rem 0 0; color: var(--muted); font-size: .78rem; }
.ratio-options { display: grid; grid-template-columns: repeat(5, 1fr); gap: .45rem; }
.ratio-options label { position: relative; cursor: pointer; }
.ratio-options label > span { display: flex; justify-content: center; align-items: center; gap: .45rem; min-height: 3rem; border: 1px solid #b9c4bf; border-radius: 5px; font-size: .82rem; }
.ratio-options input:checked + span { border: 2px solid var(--forest); background: var(--mint); color: var(--forest); font-weight: 800; }
.ratio-shape { display: inline-block; width: 1rem; height: 1rem; border: 1.5px solid currentColor; }
.ratio-shape.landscape { width: 1.15rem; height: .8rem; }.ratio-shape.portrait { width: .75rem; height: 1rem; }.ratio-shape.cinema { width: 1.25rem; height: .7rem; }.ratio-shape.tall { width: .62rem; height: 1.12rem; }
.submit-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1.7rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.submit-row > div { display: grid; }.submit-row span { color: var(--muted); font-size: .78rem; }.submit-row strong { font-size: 1.35rem; }
.generate-button { min-width: 10rem; }
.recharge-hint { margin: .65rem 0 0; color: var(--muted); font-size: .78rem; }
.panel-heading, .doc-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.2rem; }
.panel-heading h2, .doc-header h2 { margin: 0; font-size: 1.3rem; }.panel-heading p { margin: .2rem 0 0; color: var(--muted); font-size: .85rem; }
.order-stack { display: grid; gap: 0; min-width: 0; }
.empty-state { place-items: center; min-height: 12rem; text-align: center; color: var(--muted); }.empty-state p { margin: 0; font-weight: 750; color: var(--ink); }.empty-state span { font-size: .82rem; }
.mini-order { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); align-items: center; gap: .8rem; min-width: 0; padding: 1rem 0; }
.mini-order + .mini-order { border-top: 1px solid #edf1ee; }
.mini-thumb { display: grid; place-items: center; width: 3.5rem; height: 3.5rem; border-radius: 9px; background: var(--mint); color: var(--forest); font-weight: 750; overflow: hidden; }.mini-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mini-order-info { min-width: 0; }
.mini-order strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; font-size: .82rem; font-weight: 600; line-height: 1.55; }
.mini-order-meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .35rem .5rem; margin-top: .45rem; color: var(--muted); font-size: .7rem; }
.mini-order-meta .state-label { display: inline-flex; align-items: center; gap: .3rem; padding: .13rem .45rem; border-radius: 5px; font-size: .65rem; font-weight: 600; }
.mini-order-meta .state-label::before { content: ""; width: .3rem; height: .3rem; border-radius: 50%; background: currentColor; }
.mini-order-meta .completed { background: #edf6f1; }
.mini-order-meta .active { background: #fff5dc; }
.mini-order-meta .failed { background: #fff0ee; }
.state-label { white-space: nowrap; font-size: .74rem; font-weight: 800; }.state-label.completed { color: var(--forest-2); }.state-label.failed { color: var(--danger); }.state-label.active { color: #805d00; }

.order-filters { display: flex; gap: .45rem; margin-bottom: 1.2rem; overflow-x: auto; }.filter-button { min-height: 2.5rem; padding: .45rem .9rem; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--muted); white-space: nowrap; }.filter-button.is-active { border-color: var(--forest); background: var(--forest); color: white; }
.orders-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1rem; }
.full-span { grid-column: 1 / -1; }
.order-card { overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: white; }
.order-image { display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; background: #e8eeeb; color: var(--muted); }.order-image img { width: 100%; height: 100%; object-fit: cover; }.order-image .progress-mark { width: 3rem; height: 3rem; border: 3px solid #c7d3cd; border-top-color: var(--forest); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.order-info { padding: 1rem; }.order-info h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }.order-meta { display: flex; justify-content: space-between; gap: .7rem; margin-top: .45rem; color: var(--muted); font-size: .78rem; }.order-actions { display: flex; justify-content: space-between; align-items: center; gap: .7rem; margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--line); }.order-action-group { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .3rem; }.download-link, .modify-button { display: inline-flex; align-items: center; min-height: 2.5rem; padding: .35rem; color: var(--forest-2); font-weight: 800; text-decoration: none; }.modify-button { border: 0; background: transparent; }.modify-button:hover, .download-link:hover { text-decoration: underline; }.lineage-badge { display: inline-flex; width: max-content; margin-top: .55rem; padding: .2rem .45rem; border-radius: 3px; background: #e7efff; color: var(--blue); font-size: .72rem; font-weight: 750; }.error-detail { color: var(--danger); font-size: .78rem; }

.api-layout { display: grid; grid-template-columns: minmax(20rem,.7fr) minmax(0,1.3fr); gap: 1.5rem; align-items: start; }.inline-form { display: flex; align-items: end; gap: .7rem; }.grow { flex: 1; }.inline-form .field { margin: 0; }
.keys-list { display: grid; gap: .7rem; margin-top: 1.2rem; }.key-row { display: grid; grid-template-columns: 1fr auto; gap: .7rem; padding: .8rem; border: 1px solid var(--line); border-radius: 5px; }.key-row p { margin: 0; }.key-row small { color: var(--muted); }
.badge { background: #e7efff; color: var(--blue); }.api-doc p { color: var(--muted); }.api-doc h3 { margin: 1.5rem 0 .5rem; font-size: 1rem; }
pre { margin: 0; overflow-x: auto; border: 1px solid #2c3d35; border-radius: 5px; padding: 1rem; background: #14231d; color: #d8e8df; font-size: .78rem; line-height: 1.7; }
code { font-family: "Cascadia Code", Consolas, monospace; }.model-table-wrap, .table-scroll { overflow-x: auto; }table { width: 100%; border-collapse: collapse; font-size: .88rem; }caption { text-align: left; padding: 1.5rem 0 .5rem; font-weight: 800; }th, td { padding: .75rem .6rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }th { color: var(--muted); font-size: .75rem; }.doc-note { padding: .8rem; border-left: 3px solid var(--coral); background: var(--coral-soft); }

.admin-grid { display: grid; grid-template-columns: minmax(18rem,.55fr) minmax(0,1.45fr); gap: 1.5rem; align-items: start; }.confirm-line { display: flex; align-items: flex-start; gap: .6rem; margin: 1rem 0; padding: .8rem; border: 1px solid var(--line); border-radius: 5px; background: #f7f9f8; cursor: pointer; }.confirm-line input { flex: none; width: 1.1rem; min-height: 1.1rem; margin-top: .15rem; accent-color: var(--forest); }.ledger-panel { margin-top: 1.5rem; }

dialog { width: min(92vw, 34rem); padding: 0; border: 0; border-radius: 7px; box-shadow: var(--shadow); }dialog::backdrop { background: rgba(12,25,19,.62); }.dialog-card { padding: 1.6rem; }.dialog-card h2 { margin: 0; }.dialog-card > p:not(.eyebrow) { color: var(--muted); }.secret-box { display: flex; align-items: center; gap: .7rem; margin: 1rem 0; padding: .7rem; border: 1px dashed #87978f; border-radius: 5px; background: #f2f6f4; }.secret-box code { flex: 1; overflow-wrap: anywhere; }
.toast-region { position: fixed; z-index: 60; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; width: min(90vw, 22rem); }.toast { padding: .8rem 1rem; border: 1px solid #afbeb7; border-left: 4px solid var(--forest); border-radius: 5px; background: white; box-shadow: var(--shadow); }.toast.error { border-left-color: var(--danger); }

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }.auth-brand { min-height: auto; padding: 2rem; }.auth-brand h1 { font-size: 2.7rem; }.auth-points { display: none; }.auth-panel { padding: 2rem 1rem; }
  .topbar { grid-template-columns: 1fr auto; }.main-nav { position: fixed; z-index: 25; inset: auto 0 0; justify-content: space-around; border-top: 1px solid var(--line); background: white; padding: .35rem; }.nav-button { flex: 1; }.account-cluster .balance-box { display: none; }
  main { padding-bottom: 6rem; }.studio-layout, .api-layout, .admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 580px) {
  .topbar { padding-inline: .8rem; }.wordmark > span:last-child, #header-username { display: none; }.page-heading { align-items: flex-start; flex-direction: column; gap: 1rem; }.source-reference { grid-template-columns: 4rem minmax(0, 1fr); }.source-reference img { width: 4rem; height: 4rem; }.source-reference button { grid-column: 1 / -1; width: 100%; }.price-options { grid-template-columns: 1fr; }.price-body { grid-template-columns: 1fr auto; min-height: 4.6rem; align-items: center; }.price-body span { grid-row: 2; }.price-body b { grid-column: 2; grid-row: 1 / 3; align-self: center; }.ratio-options { grid-template-columns: repeat(3, 1fr); }.submit-row { align-items: stretch; flex-direction: column; }.generate-button { width: 100%; }.inline-form { align-items: stretch; flex-direction: column; }.orders-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
