:root {
  color-scheme: light;
  --paper: #f4f3ee;
  --surface: #fbfaf6;
  --ink: #171815;
  --muted: #686a62;
  --line: #d9d8d0;
  --accent: #e9542e;
  --accent-dark: #b93619;
  --lime: #d9f255;
  --shadow: 0 24px 60px rgba(35, 32, 25, 0.12);
}

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #151613;
  --surface: #1d1f1a;
  --ink: #f5f3e9;
  --muted: #a7aa9f;
  --line: #34372f;
  --accent: #ff6b43;
  --accent-dark: #ff8968;
  --lime: #d9f255;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }
html { min-width: 320px; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.login-screen { height: 100vh; height: 100dvh; display: grid; grid-template-columns: minmax(420px, 1.2fr) minmax(430px, .8fr); overflow: hidden; background: var(--surface); }
.login-visual { position: relative; min-height: 0; height: 100%; overflow: hidden; color: #fff; }
.login-visual::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(9, 12, 16, .18) 0%, rgba(9, 12, 16, .02) 42%, rgba(9, 12, 16, .68) 100%); pointer-events: none; }
.login-visual > img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.login-visual-top { position: absolute; z-index: 1; top: clamp(24px, 4vw, 48px); left: clamp(24px, 4vw, 52px); display: flex; align-items: center; gap: 12px; text-shadow: 0 2px 14px rgba(0,0,0,.25); }
.login-brand-mark { width: 42px; height: 42px; display: grid; place-items: center; background: #fff; color: #171815; font: 800 21px/1 Georgia, serif; }
.login-visual-top strong, .login-visual-top small { display: block; letter-spacing: 0; }
.login-visual-top strong { font-size: 18px; line-height: 1.1; }
.login-visual-top small { margin-top: 3px; font-size: 8px; font-weight: 800; letter-spacing: .16em; }
.login-visual-copy { position: absolute; z-index: 1; left: clamp(24px, 4vw, 52px); bottom: clamp(62px, 8vw, 100px); }
.login-visual-copy p { margin: 0 0 14px; color: var(--lime); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.login-visual-copy h2 { margin: 0; max-width: 560px; font: 600 clamp(35px, 4vw, 58px)/1.14 Georgia, "Songti SC", serif; }
.login-image-credit { position: absolute; z-index: 1; left: clamp(24px, 4vw, 52px); bottom: 26px; font-size: 9px; font-weight: 700; letter-spacing: .14em; opacity: .72; }
.login-panel { position: relative; min-height: 0; height: 100%; display: grid; place-items: center; padding: clamp(36px, 5vh, 60px) clamp(34px, 6vw, 96px); overflow-y: auto; background: var(--surface); }
.login-panel-inner { width: min(100%, 410px); }
.login-theme { position: absolute; top: 28px; right: 30px; }
.login-panel h1 { margin: 0; font-size: clamp(38px, 4vw, 54px); }
.login-lead { margin: 10px 0 22px; color: var(--muted); font-size: 15px; }
.auth-modes { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 15px; border-bottom: 1px solid var(--line); }
.auth-modes button { height: 38px; padding: 0 4px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.auth-modes button[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--ink); }
.login-form > label { display: flex; align-items: center; justify-content: space-between; margin: 13px 0 6px; }
.login-form > label span { color: var(--muted); font-size: 10px; font-weight: 500; }
.login-input-wrap { position: relative; display: flex; align-items: center; }
.login-input-wrap > svg { position: absolute; left: 14px; width: 17px; color: var(--muted); pointer-events: none; }
.login-input-wrap input { width: 100%; height: 48px; padding: 0 46px 0 44px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); color: var(--ink); }
.login-input-wrap input:focus { border-color: var(--ink); outline: 0; box-shadow: 0 0 0 1px var(--ink); }
.login-code-row { display: grid; grid-template-columns: minmax(0, 1fr) 116px; gap: 8px; }
.login-code-row > button { border: 1px solid var(--ink); border-radius: 4px; background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 700; cursor: pointer; }
.login-code-row > button:disabled { opacity: .55; cursor: wait; }
.password-toggle { position: absolute; right: 5px; width: 42px; height: 42px; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.password-toggle svg { width: 17px; }
.login-error { min-height: 21px; margin: 10px 0 0; color: var(--accent-dark); font-size: 12px; }
.login-button { width: 100%; height: 54px; margin-top: 8px; padding: 0 17px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--ink); border-radius: 4px; background: var(--ink); color: var(--paper); font-weight: 800; cursor: pointer; box-shadow: 4px 4px 0 var(--accent); transition: transform .15s, box-shadow .15s; }
.login-button:hover { transform: translate(-1px,-1px); box-shadow: 6px 6px 0 var(--accent); }
.login-button:disabled { opacity: .62; cursor: wait; transform: none; }
.login-button svg { width: 18px; }
.login-security { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 12px; color: var(--muted); font-size: 11px; }
.login-security svg { width: 14px; }
.login-footer { display: none; }

button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.topbar {
  height: 72px;
  padding: 0 clamp(18px, 3vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; background: var(--ink); color: var(--paper); font: 800 18px/1 Georgia, serif; }
.brand strong, .brand small { display: block; letter-spacing: 0; }
.brand strong { font-size: 16px; line-height: 1.1; }
.brand small { color: var(--muted); font-size: 8px; font-weight: 700; letter-spacing: .16em; margin-top: 3px; }

.top-actions { display: flex; align-items: center; gap: 14px; }
.balance-button { height: 40px; display: inline-flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); cursor: pointer; }
.balance-button:hover { border-color: var(--ink); }
.balance-button > svg { width: 16px; height: 16px; }
.balance-button > svg:last-child { width: 13px; color: var(--accent); }
.balance-button small, .balance-button strong { display: block; letter-spacing: 0; text-align: left; }
.balance-button small { color: var(--muted); font-size: 7px; line-height: 1; }
.balance-button strong { margin-top: 3px; font-size: 11px; line-height: 1; }
.account-info { min-width: 152px; display: flex; align-items: center; gap: 10px; padding-left: 15px; border-left: 1px solid var(--line); }
.user-avatar { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: var(--paper); font: 700 13px/1 Georgia, "Songti SC", serif; }
.account-info strong, .account-info small { display: block; letter-spacing: 0; }
.account-info strong { max-width: 100px; overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.account-info small { margin-top: 2px; color: var(--muted); font-size: 7px; font-weight: 700; letter-spacing: .12em; }
.service-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #c49a35; box-shadow: 0 0 0 4px color-mix(in srgb, #c49a35 15%, transparent); }
.service-status.ready .status-dot { background: #48a868; box-shadow: 0 0 0 4px color-mix(in srgb, #48a868 15%, transparent); }
.service-status.error .status-dot { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); }

.icon-button { width: 38px; height: 38px; flex: 0 0 38px; display: inline-grid; place-items: center; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; text-decoration: none; }
.icon-button:hover { border-color: var(--ink); background: var(--surface); }
.icon-button svg { width: 17px; height: 17px; }

.studio-shell { min-height: calc(100vh - 72px); }
.studio-form { min-height: inherit; }
.style-panel { padding: 24px clamp(22px, 3vw, 48px); border-bottom: 1px solid var(--line); background: var(--surface); }
.studio-workspace { display: grid; grid-template-columns: minmax(360px, .8fr) minmax(0, 1.2fr); }
.control-panel { padding: clamp(28px, 4vw, 52px) clamp(22px, 3vw, 42px); border-right: 1px solid var(--line); background: var(--surface); }
.panel-heading { margin-bottom: 30px; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.kicker { margin: 0 0 8px; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .15em; }
h1, h2, p { letter-spacing: 0; }
h1 { margin: 0; font: 600 clamp(28px, 3vw, 38px)/1.15 Georgia, "Songti SC", serif; }
.panel-heading > p:last-child { max-width: 320px; margin: 12px 0 0; color: var(--muted); }
.style-heading { margin-bottom: 20px; }
.prompt-heading { margin: 30px 0 0; padding-top: 25px; border-top: 1px solid var(--line); }
.prompt-heading h2 { font-size: 25px; }
.prompt-heading + .field-label { margin-top: 18px; }
h2 { margin: 0; font: 600 21px/1.2 Georgia, "Songti SC", serif; }

.mode-control { display: grid; grid-template-columns: 1fr 1fr; margin: 0; padding: 3px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); }
.mode-control input, .template-control input, .upload-zone > input { position: absolute; opacity: 0; pointer-events: none; }
.mode-control span { height: 40px; display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--muted); cursor: pointer; font-size: 12px; }
.mode-control svg { width: 16px; height: 16px; }
.mode-control input:checked + span { background: var(--ink); color: var(--paper); }
.mode-control input:focus-visible + span, .template-control input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -3px; }
.edit-fields .field-label { margin-top: 16px; }
.edit-fields .field-label > span { color: var(--muted); font-size: 10px; }
.upload-zone { min-height: 88px; border: 1px dashed color-mix(in srgb, var(--muted) 65%, transparent); border-radius: 4px; background: var(--paper); transition: border-color .15s, background .15s; }
.upload-zone.dragging { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--paper)); }
.upload-empty { min-height: 86px; display: flex; align-items: center; justify-content: center; gap: 12px; cursor: pointer; }
.upload-empty > svg { width: 26px; height: 26px; color: var(--accent-dark); }
.upload-empty b, .upload-empty small, .upload-preview strong, .upload-preview small { display: block; letter-spacing: 0; }
.upload-empty b { font-size: 12px; }
.upload-empty small, .upload-preview small { margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 500; }
.upload-preview { min-width: 0; height: 86px; padding: 8px; display: grid; grid-template-columns: 70px minmax(0, 1fr) 38px; align-items: center; gap: 10px; }
.upload-preview img { width: 70px; height: 70px; display: block; object-fit: cover; background: #20221e; }
.upload-preview strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.template-fieldset { margin-top: 14px; }
.template-control { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.template-control span { min-height: 64px; padding: 8px; display: grid; grid-template-columns: 18px minmax(0, 1fr); align-content: center; column-gap: 6px; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; }
.template-control svg { width: 17px; height: 17px; grid-row: 1 / 3; color: var(--accent-dark); }
.template-control b, .template-control small { min-width: 0; display: block; letter-spacing: 0; }
.template-control b { font-size: 11px; }
.template-control small { margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 500; }
.template-control input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); box-shadow: inset 3px 0 0 var(--accent); }

.field-label { display: flex; align-items: center; justify-content: space-between; margin: 25px 0 9px; }
label, legend { color: var(--ink); font-size: 12px; font-weight: 700; }
.text-button { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: transparent; color: var(--accent-dark); font-size: 12px; font-weight: 700; cursor: pointer; }
.text-button svg { width: 14px; height: 14px; }
.prompt-wrap { position: relative; }
textarea { width: 100%; min-height: 150px; padding: 14px 14px 28px; resize: vertical; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); color: var(--ink); line-height: 1.65; }
textarea::placeholder, input::placeholder { color: color-mix(in srgb, var(--muted) 65%, transparent); }
textarea:focus, input:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 1px var(--ink); }
#prompt-count { position: absolute; right: 11px; bottom: 8px; color: var(--muted); font-size: 10px; }

fieldset { min-width: 0; padding: 0; margin: 25px 0 0; border: 0; }
.style-fieldset { margin-top: 0; }
legend { margin-bottom: 10px; }
.style-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.style-option input, .aspect-control input { position: absolute; opacity: 0; pointer-events: none; }
.style-option > span { display: block; min-height: 60px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; transition: border-color .18s, background .18s; }
.style-option b, .style-option small { display: block; letter-spacing: 0; }
.style-option b { font-size: 13px; }
.style-option small { margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 500; }
.style-option input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); box-shadow: inset 3px 0 0 var(--accent); }
.style-option input:focus-visible + span, .aspect-control input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -3px; }

.aspect-control { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.aspect-control label + label { border-left: 1px solid var(--line); }
.aspect-control span { height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); cursor: pointer; font-size: 11px; }
.aspect-control input:checked + span { background: var(--ink); color: var(--paper); }
.ratio { display: inline-block; border: 1px solid currentColor; }
.ratio-square { width: 14px; height: 14px; }
.ratio-portrait { width: 10px; height: 15px; }
.ratio-landscape { width: 16px; height: 11px; }
.ratio-wide { width: 18px; height: 10px; }
.ratio-tall { width: 10px; height: 18px; }

.advanced { margin-top: 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.advanced summary { height: 44px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-size: 12px; font-weight: 700; list-style: none; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary svg { width: 15px; transition: transform .2s; }
.advanced[open] summary svg { transform: rotate(180deg); }
.advanced > label { display: flex; justify-content: space-between; margin: 2px 0 8px; }
.advanced > label span { color: var(--muted); font-weight: 500; }
.advanced textarea { min-height: 76px; padding: 10px 11px; resize: vertical; font-size: 12px; }
.advanced textarea + label { margin-top: 14px; }
.seed-row { display: flex; gap: 8px; padding-bottom: 14px; }
.seed-row input { min-width: 0; width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); color: var(--ink); }

.generate-button { width: 100%; min-height: 52px; margin-top: 24px; padding: 0 15px; display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 8px; border: 1px solid var(--ink); border-radius: 4px; background: var(--ink); color: var(--paper); font-weight: 800; cursor: pointer; box-shadow: 4px 4px 0 var(--accent); transition: transform .15s, box-shadow .15s; }
.generate-button:hover { transform: translate(-1px, -1px); box-shadow: 6px 6px 0 var(--accent); }
.generate-button:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--accent); }
.generate-button:disabled { cursor: wait; opacity: .72; transform: none; box-shadow: 2px 2px 0 var(--accent); }
.generate-button svg { width: 18px; }
kbd { padding: 3px 6px; border: 1px solid color-mix(in srgb, var(--paper) 32%, transparent); border-radius: 3px; color: color-mix(in srgb, var(--paper) 75%, transparent); font: 9px/1.3 inherit; }
.generation-cost { display: flex; align-items: center; justify-content: space-between; margin-top: 13px; padding-bottom: 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.generation-cost b { color: var(--ink); letter-spacing: 0; }
.generation-cost strong { color: var(--accent-dark); font-size: 13px; }
.privacy-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 10px 0 0; color: var(--muted); font-size: 10px; }
.privacy-note svg { width: 13px; }

.canvas-column { min-width: 0; padding: clamp(28px, 4vw, 52px); }
.canvas-toolbar, .history-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; }
.canvas-actions { display: flex; gap: 8px; }
.canvas-stage { position: relative; min-height: min(66vh, 720px); display: grid; place-items: center; background: #20221e; overflow: hidden; box-shadow: var(--shadow); }
.welcome-art, .result-view { width: 100%; height: 100%; min-height: inherit; position: relative; }
.welcome-art img, .result-view > img { width: 100%; height: 100%; min-height: inherit; display: block; object-fit: cover; }
.art-caption { position: absolute; left: 24px; bottom: 22px; color: #fff; text-shadow: 0 2px 18px rgba(0,0,0,.5); }
.art-caption span, .art-caption strong { display: block; letter-spacing: 0; }
.art-caption span { font-size: 10px; font-weight: 700; text-transform: uppercase; }
.art-caption strong { margin-top: 3px; font: 600 20px/1.2 Georgia, "Songti SC", serif; }

.loading-state { text-align: center; color: #f3f1e8; }
.loading-frame { position: relative; width: 116px; height: 116px; margin: 0 auto 22px; border: 1px solid #53564e; overflow: hidden; }
.loading-frame::before, .loading-frame::after { content: ""; position: absolute; background: var(--lime); }
.loading-frame::before { width: 28px; height: 1px; left: 43px; top: 57px; }
.loading-frame::after { width: 1px; height: 28px; left: 57px; top: 43px; }
.scan-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--lime); box-shadow: 0 0 18px var(--lime); animation: scan 2s ease-in-out infinite; }
@keyframes scan { 0%, 100% { top: 10%; opacity: .5; } 50% { top: 90%; opacity: 1; } }
.loading-state p { margin: 0; font-weight: 700; }
.loading-state > span { color: #aeb1a7; font-size: 11px; }
.result-view > img { object-fit: contain; }
.result-meta { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; justify-content: space-between; padding: 8px 10px; background: rgba(15,16,14,.76); color: #fff; font-size: 10px; backdrop-filter: blur(12px); }

.image-dialog { width: 100vw; max-width: none; height: 100vh; max-height: none; margin: 0; padding: 78px 32px 54px; border: 0; background: #11120f; color: #fff; overflow: hidden; }
.image-dialog::backdrop { background: rgba(10, 11, 9, .88); }
.image-dialog[open] { display: grid; place-items: center; }
.image-dialog-toolbar { position: absolute; top: 20px; left: 28px; right: 28px; display: flex; align-items: center; justify-content: space-between; }
.image-dialog-toolbar h2 { color: #fff; }
.image-dialog .icon-button { color: #fff; border-color: #45473f; }
.image-dialog .icon-button:hover { border-color: #fff; background: #20221e; }
.image-dialog > img { display: block; max-width: 100%; max-height: calc(100vh - 150px); object-fit: contain; box-shadow: 0 24px 80px rgba(0,0,0,.45); }
.image-dialog-meta { position: absolute; left: 28px; right: 28px; bottom: 20px; margin: 0; color: #aeb1a7; font-size: 11px; text-align: center; }
body:has(dialog[open]) { overflow: hidden; }

.payment-dialog { width: min(460px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 32px); overflow-y: auto; padding: 32px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 90px rgba(0,0,0,.28); }
.payment-dialog::backdrop { background: rgba(18, 19, 16, .72); backdrop-filter: blur(3px); }
.payment-close { position: absolute; top: 18px; right: 18px; }
.payment-dialog > h2 { font-size: 28px; }
.payment-balance { display: grid; grid-template-columns: 1fr auto; align-items: end; margin: 25px 0 28px; padding: 19px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.payment-balance > span { color: var(--muted); font-size: 11px; }
.payment-balance strong { grid-row: 1 / 3; grid-column: 2; font: 600 30px/1 Georgia, serif; }
.payment-balance small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.payment-balance small b { color: var(--ink); letter-spacing: 0; }
.recharge-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.recharge-options input { position: absolute; opacity: 0; pointer-events: none; }
.recharge-options label > span { min-height: 72px; display: grid; place-items: center; align-content: center; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; }
.recharge-options b, .recharge-options small { display: block; letter-spacing: 0; text-align: center; }
.recharge-options b { font-size: 17px; }
.recharge-options small { margin-top: 4px; color: var(--muted); font-size: 9px; font-weight: 500; }
.recharge-options input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); box-shadow: inset 0 -3px 0 var(--accent); }
.recharge-options input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.payment-submit { width: 100%; height: 52px; margin-top: 22px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--ink); border-radius: 4px; background: var(--ink); color: var(--paper); font-weight: 800; cursor: pointer; box-shadow: 4px 4px 0 var(--accent); }
.payment-submit:disabled { opacity: .6; cursor: wait; box-shadow: none; }
.payment-submit svg { width: 17px; }
.payment-channel { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 18px 0 0; color: var(--muted); font-size: 10px; }
.payment-channel svg { width: 13px; }
.payment-history { margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--line); }
.payment-history-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 10px; }
.payment-history-heading .kicker { margin-bottom: 4px; font-size: 9px; }
.payment-history-heading h3 { margin: 0; font: 600 17px/1.2 Georgia, "Songti SC", serif; }
.payment-history-heading > span { color: var(--muted); font-size: 10px; }
.payment-history-list { max-height: 160px; overflow-y: auto; scrollbar-width: thin; }
.payment-history-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 10px 0; border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent); }
.payment-history-item:first-child { border-top: 0; }
.payment-history-item strong, .payment-history-item small { display: block; letter-spacing: 0; }
.payment-history-item strong { font-size: 12px; }
.payment-history-item small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.payment-history-item > span { align-self: center; color: var(--ink); font-size: 12px; font-weight: 700; text-align: right; }
.payment-history-item > span.paid { color: #3c8d58; }
.payment-history-item > span.pending { color: #b07824; }
.payment-history-empty { margin: 0; padding: 10px 0; color: var(--muted); font-size: 11px; }

.admin-dialog { width: 100vw; max-width: none; height: 100vh; max-height: none; margin: 0; padding: 0; border: 0; background: var(--paper); color: var(--ink); overflow: auto; }
.admin-dialog::backdrop { background: rgba(18, 19, 16, .72); }
.small-dialog { width: min(440px, calc(100vw - 32px)); margin: auto; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); }
.small-dialog::backdrop { background: rgba(18, 19, 16, .48); }
.small-dialog form { padding: 24px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.dialog-heading h2 { margin: 4px 0 0; font-size: 22px; }
.dialog-note { margin: 0 0 18px; color: var(--muted); font-size: 12px; }
.small-dialog .provider-field { display: grid; gap: 7px; margin-top: 14px; }
.small-dialog .provider-field input { width: 100%; height: 42px; box-sizing: border-box; }
.admin-header { height: 92px; position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 4vw, 58px); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(16px); }
.admin-header h1 { font-size: 34px; }
.admin-header-actions { display: flex; gap: 8px; }
.admin-content { width: min(100%, 1500px); margin: 0 auto; padding: 36px clamp(20px, 4vw, 58px) 64px; }
.admin-metrics { display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.admin-metrics > div { min-width: 0; padding: 22px 20px; }
.admin-metrics > div + div { border-left: 1px solid var(--line); }
.admin-metrics span, .admin-metrics strong { display: block; letter-spacing: 0; }
.admin-metrics span { color: var(--muted); font-size: 13px; }
.admin-metrics strong { margin-top: 9px; font: 600 29px/1 Georgia, "Songti SC", serif; }
.admin-tabs { display: flex; gap: 28px; margin-top: 34px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.admin-tabs button { height: 50px; flex: 0 0 auto; padding: 0 2px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 16px; font-weight: 700; cursor: pointer; }
.admin-tabs button[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--ink); }
.admin-view { padding-top: 28px; }
.admin-view-toolbar { min-height: 44px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.admin-view-toolbar h2 { font-size: 24px; }
.admin-view-toolbar > div > span { display: block; margin-top: 6px; color: var(--muted); font-size: 13px; }
.site-announcement { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; padding: 11px 14px; border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line)); border-radius: 4px; background: color-mix(in srgb, var(--accent) 7%, var(--paper)); color: var(--ink); font-size: 12px; }
.site-announcement svg { width: 16px; flex: 0 0 auto; color: var(--accent-dark); }
.provider-toggle { display: grid; grid-template-columns: auto 20px; align-items: center; column-gap: 10px; }
.provider-toggle span { grid-column: 1; }
.provider-toggle input { grid-column: 2; grid-row: 1; width: 18px; height: 18px; accent-color: var(--accent); }
.provider-toggle small { grid-column: 1 / -1; }
.admin-filter { display: flex; align-items: center; gap: 8px; }
.admin-search { position: relative; }
.admin-search svg { position: absolute; left: 11px; top: 10px; width: 15px; color: var(--muted); pointer-events: none; }
.admin-search input, .admin-filter select { height: 42px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); font-size: 14px; }
.admin-filter-select { height: 42px; padding: 0 30px 0 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); font-size: 14px; }
.admin-search input { width: 240px; padding: 0 11px 0 34px; }
.admin-filter select { padding: 0 30px 0 10px; }
.filter-button { height: 42px; padding: 0 18px; border: 1px solid var(--ink); border-radius: 4px; background: var(--ink); color: var(--paper); font-size: 14px; font-weight: 700; cursor: pointer; }
.admin-table-wrap { width: 100%; overflow-x: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.admin-table { width: 100%; min-width: 1080px; border-collapse: collapse; table-layout: fixed; }
.admin-table th { padding: 14px 12px; color: var(--muted); font-size: 12px; text-align: left; font-weight: 700; }
.admin-table td { height: 68px; padding: 12px; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.45; vertical-align: middle; }
.admin-table th:nth-child(1), .admin-table td:nth-child(1) { width: 74px; }
.admin-table th:nth-child(2), .admin-table td:nth-child(2) { width: 120px; }
.admin-table th:nth-last-child(-n+3), .admin-table td:nth-last-child(-n+3) { width: 110px; }
.admin-thumb { width: 44px; height: 44px; display: block; object-fit: cover; background: #20221e; }
.admin-thumb-empty { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); color: var(--muted); }
.admin-thumb-empty svg { width: 15px; }
.admin-prompt { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-subtext { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.record-status { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font-size: 11px; }
.record-status.completed, .record-status.paid { border-color: #73b186; color: #347548; background: color-mix(in srgb, #73b186 9%, transparent); }
.record-status.failed, .record-status.rejected { border-color: var(--accent); color: var(--accent-dark); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.record-status.processing, .record-status.pending { border-color: #c49a35; color: #8b6816; background: color-mix(in srgb, #c49a35 9%, transparent); }
.user-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.record-status.active { border-color: #73b186; color: #347548; background: color-mix(in srgb, #73b186 9%, transparent); }
.record-status.banned { border-color: var(--accent); color: var(--accent-dark); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.user-action-button { min-width: 72px; height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 700; cursor: pointer; }
.user-action-button:hover { border-color: var(--ink); }
.user-action-button.primary { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.user-action-button.unban { border-color: #73b186; color: #347548; }
.admin-user-table { min-width: 1340px; table-layout: auto; }
.admin-user-table th:first-child, .admin-user-table td:first-child { width: 190px; }
.admin-user-table th:nth-child(2), .admin-user-table td:nth-child(2) { width: 125px; }
.admin-user-table th:nth-child(3), .admin-user-table td:nth-child(3) { width: 110px; }
.admin-user-table th:nth-child(4), .admin-user-table td:nth-child(4) { width: 125px; }
.admin-user-table th:nth-child(5), .admin-user-table td:nth-child(5) { width: 150px; }
.admin-user-table th:nth-child(6), .admin-user-table td:nth-child(6) { width: 175px; }
.admin-user-table th:nth-child(7), .admin-user-table td:nth-child(7) { width: 190px; }
.admin-user-table th:last-child, .admin-user-table td:last-child { width: 210px; }
.admin-user-name { font-size: 15px; }
.admin-user-email { display: block; margin-top: 4px; overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.admin-money { font-size: 16px; }
.dialog-help { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.admin-empty { height: 100px !important; color: var(--muted); text-align: center; }
.load-more { display: block; min-width: 120px; height: 38px; margin: 18px auto 0; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); cursor: pointer; }
.load-more:hover { border-color: var(--ink); }
.provider-state { min-height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.provider-state .status-dot { width: 7px; height: 7px; }
.provider-state strong { font-size: 10px; letter-spacing: 0; }
.provider-state.offline .status-dot { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); }
.provider-form { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 28px 0; }
.provider-fields { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(280px, 1.3fr); gap: 20px 24px; }
.provider-field { display: grid; align-content: start; gap: 8px; min-width: 0; }
.provider-field > span { color: var(--muted); font-size: 13px; font-weight: 700; }
.provider-field input, .provider-field select { width: 100%; height: 46px; padding: 0 13px; border: 1px solid var(--line); border-radius: 4px; outline: 0; background: var(--surface); color: var(--ink); font-size: 14px; }
.provider-field input:focus, .provider-field select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 7%, transparent); }
.provider-field small { min-height: 14px; color: var(--muted); font-size: 11px; }
.provider-secret-wrap { position: relative; }
.provider-secret-wrap input { padding-right: 48px; }
.provider-secret-wrap button { position: absolute; top: 2px; right: 2px; width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.provider-secret-wrap button svg { width: 16px; }
.provider-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 30px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.provider-meta > span { min-width: 0; padding: 15px 12px; }
.provider-meta > span + span { border-left: 1px solid var(--line); }
.provider-meta b, .provider-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: 0; }
.provider-meta b { color: var(--muted); font-size: 9px; font-weight: 500; }
.provider-meta strong { margin-top: 5px; font-size: 11px; }
.provider-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.provider-actions button { min-width: 132px; height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border-radius: 4px; font-weight: 700; cursor: pointer; }
.provider-actions button svg { width: 16px; }
.provider-actions button:disabled { opacity: .55; cursor: wait; }
.provider-test-button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.provider-save-button { border: 1px solid var(--ink); background: var(--ink); color: var(--paper); }

.history-section { margin-top: 34px; }
.history-heading { align-items: center; margin-bottom: 13px; }
.history-heading h2 { font-size: 18px; }
.history-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.history-empty { grid-column: 1 / -1; margin: 0; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.history-item { position: relative; aspect-ratio: 1; padding: 0; border: 0; background: #20221e; overflow: hidden; cursor: pointer; }
.history-item img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .25s; }
.history-item:hover img { transform: scale(1.04); }
.history-item span { position: absolute; left: 7px; right: 7px; bottom: 6px; color: #fff; font-size: 9px; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-shadow: 0 1px 5px #000; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: min(360px, calc(100vw - 32px)); padding: 12px 15px; transform: translateY(20px); border-left: 3px solid var(--lime); background: #20221e; color: #fff; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-left-color: var(--accent); }

.contact-float { position: fixed; top: 50%; right: 16px; z-index: 12; width: 220px; display: grid; gap: 8px; transform: translateY(-50%); }
.contact-card { min-width: 0; min-height: 58px; padding: 9px 10px; display: grid; grid-template-columns: 34px minmax(0, 1fr) 28px; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 6px; background: color-mix(in srgb, var(--surface) 94%, transparent); color: var(--ink); box-shadow: 0 12px 28px rgba(24, 26, 22, .1); backdrop-filter: blur(14px); }
.contact-card-copy { min-width: 0; text-align: left; }
.contact-card-copy strong, .contact-card-copy span { display: block; overflow: hidden; letter-spacing: 0; text-overflow: ellipsis; white-space: nowrap; }
.contact-card-copy strong { font-size: 11px; }
.contact-card-copy span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.contact-card-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 5px; font-size: 11px; font-weight: 800; }
.qq-icon { background: #e8f1ff; color: #2878d7; }
.email-icon { background: #fff0e7; color: #d75e27; }
.feedback-icon { background: #e9f5e9; color: #398452; }
.contact-card-icon svg { width: 17px; height: 17px; }
.contact-copy { width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; }
.contact-copy:hover { background: var(--paper); color: var(--ink); }
.contact-copy svg { width: 15px; height: 15px; }
.contact-feedback { width: 100%; border: 1px solid var(--ink); cursor: pointer; text-align: left; }
.contact-feedback:hover { transform: translateX(-2px); box-shadow: 0 14px 30px rgba(24, 26, 22, .16); }
.contact-arrow { width: 15px; color: var(--accent-dark); }
@media (min-width: 721px) {
  .contact-float { width: 44px; transition: width .22s ease; }
  .contact-float:hover, .contact-float:focus-within { width: 220px; }
  .contact-float:not(:hover):not(:focus-within) .contact-card { grid-template-columns: 1fr; padding: 6px; }
  .contact-float:not(:hover):not(:focus-within) .contact-card-copy,
  .contact-float:not(:hover):not(:focus-within) .contact-copy,
  .contact-float:not(:hover):not(:focus-within) .contact-arrow { display: none; }
  .contact-float:not(:hover):not(:focus-within) .contact-card-icon { width: 30px; height: 30px; justify-self: center; }
}
.feedback-dialog { width: min(390px, calc(100vw - 32px)); max-width: none; max-height: min(620px, calc(100vh - 32px)); margin: auto 24px 24px auto; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 80px rgba(0,0,0,.23); overflow: hidden; }
.feedback-dialog::backdrop { background: rgba(18, 19, 16, .18); backdrop-filter: blur(2px); }
.feedback-dialog-header { min-height: 76px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.feedback-dialog-header .kicker { margin-bottom: 4px; }
.feedback-dialog-header h2 { font-size: 22px; }
.feedback-messages { min-height: 220px; max-height: 360px; padding: 16px; display: flex; flex-direction: column; gap: 9px; overflow-y: auto; background: color-mix(in srgb, var(--paper) 72%, var(--surface)); }
.feedback-bubble { max-width: 84%; padding: 9px 11px; border-radius: 5px; font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.feedback-bubble-system { align-self: flex-start; border: 1px solid var(--line); background: var(--surface); }
.feedback-bubble-user { align-self: flex-end; background: var(--ink); color: var(--paper); }
.feedback-form { padding: 12px; border-top: 1px solid var(--line); }
.feedback-form textarea { min-height: 74px; height: 74px; resize: vertical; font-size: 12px; }
.feedback-form-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.feedback-form-footer > span { color: var(--muted); font-size: 10px; }
.feedback-send { height: 34px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--ink); border-radius: 4px; background: var(--ink); color: var(--paper); font-size: 11px; font-weight: 700; cursor: pointer; }
.feedback-send:disabled { opacity: .6; cursor: wait; }
.feedback-send svg { width: 14px; }
[hidden] { display: none !important; }
#app-shell[hidden] ~ .contact-float { display: none; }

@media (max-width: 900px) {
  .login-screen { grid-template-columns: minmax(300px, .85fr) minmax(420px, 1.15fr); }
  .login-visual-copy h2 { font-size: 34px; }
  .topbar { padding-inline: 16px; }
  .account-info { display: none; }
  .top-actions { gap: 8px; }
  .studio-workspace { grid-template-columns: 330px minmax(0, 1fr); }
  .canvas-column { padding: 32px 24px; }
  .canvas-stage { min-height: 500px; }
  .history-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .service-status { display: none; }
}

@media (min-width: 721px) {
  #app-shell { height: 100vh; height: 100dvh; overflow: hidden; }
  .topbar { height: 64px; }
  .studio-shell {
    height: calc(100% - 64px);
    min-height: 0;
    overflow: hidden;
  }
  .studio-form {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .style-panel {
    min-width: 0;
    padding: 13px clamp(22px, 2.5vw, 42px) 14px;
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    align-items: center;
    gap: 24px;
  }
  .style-panel .panel-heading { margin: 0; }
  .style-panel .kicker { margin-bottom: 2px; font-size: 9px; }
  .style-panel h1 { font-size: 30px; }
  .style-panel .panel-heading > p:last-child { margin-top: 3px; font-size: 12px; white-space: nowrap; }
  .style-panel .style-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 7px; }
  .style-panel .style-option > span { min-height: 56px; padding: 7px 9px; }
  .style-panel .style-option b { font-size: 14px; }
  .style-panel .style-option small { margin-top: 2px; font-size: 10px; white-space: nowrap; }
  .studio-workspace {
    min-height: 0;
    grid-template-columns: minmax(520px, 1.05fr) minmax(500px, .95fr);
    overflow: hidden;
  }
  .control-panel {
    height: 100%;
    padding: 22px clamp(28px, 3vw, 48px) 10px;
    overflow-y: auto;
    scrollbar-width: thin;
  }
  .control-panel .kicker { margin-bottom: 5px; font-size: 10px; }
  .control-panel .mode-control { margin-bottom: 14px; }
  .control-panel .prompt-heading { margin: 0; padding: 0; border: 0; }
  .control-panel .prompt-heading h2 { font-size: 28px; }
  .control-panel .panel-heading > p:last-child { margin-top: 7px; font-size: 13px; line-height: 1.45; }
  .control-panel .prompt-heading + .field-label { margin-top: 16px; }
  .control-panel .edit-fields + .field-label { margin-top: 14px; }
  .control-panel .field-label { margin-bottom: 7px; }
  .control-panel label, .control-panel legend { font-size: 14px; }
  .control-panel .text-button { font-size: 13px; }
  .control-panel textarea { min-height: 112px; height: 112px; padding: 12px 13px 25px; resize: none; font-size: 14px; }
  .control-panel:has(#edit-fields:not([hidden])) textarea#prompt { min-height: 70px; height: 70px; }
  .control-panel:has(#edit-fields:not([hidden])) .panel-heading > p:last-child { display: none; }
  .control-panel:has(#edit-fields:not([hidden])) .prompt-heading h2 { font-size: 23px; }
  .control-panel fieldset { margin-top: 16px; }
  .control-panel legend { margin-bottom: 7px; }
  .control-panel .aspect-control span { height: 44px; gap: 6px; font-size: 11px; }
  .control-panel .advanced { margin-top: 14px; }
  .control-panel .advanced summary { height: 40px; font-size: 12px; }
  .control-panel .advanced textarea { min-height: 72px; height: 72px; }
  .control-panel .advanced > label { margin-bottom: 6px; font-size: 11px; }
  .control-panel .advanced textarea + label { margin-top: 10px; }
  .control-panel .seed-row { padding-bottom: 10px; }
  .control-panel .generate-button { min-height: 50px; margin-top: 17px; font-size: 14px; }
  .control-panel .generation-cost { margin-top: 10px; padding-bottom: 8px; font-size: 11px; }
  .control-panel .generation-cost strong { font-size: 13px; }
  .control-panel .privacy-note { margin-top: 8px; font-size: 10px; }

  .canvas-column {
    height: 100%;
    min-width: 0;
    min-height: 0;
    padding: 22px clamp(24px, 3vw, 46px) 14px;
    display: grid;
    grid-template-rows: auto minmax(210px, 1fr) auto;
    gap: 12px;
    overflow: hidden;
  }
  .canvas-toolbar,
  .canvas-stage,
  .history-section,
  .history-strip {
    width: 100%;
    min-width: 0;
  }
  .canvas-toolbar { margin-bottom: 0; }
  .canvas-toolbar .kicker, .history-heading .kicker { margin-bottom: 4px; font-size: 9px; }
  .canvas-toolbar h2 { font-size: 23px; }
  .canvas-stage { min-height: 0; height: 100%; }
  .welcome-art, .result-view,
  .welcome-art img, .result-view > img { min-height: 0; }
  .art-caption span { font-size: 11px; }
  .art-caption strong { font-size: 23px; }
  .history-section { min-height: 0; margin-top: 0; }
  .history-heading { margin-bottom: 7px; }
  .history-heading h2 { font-size: 18px; }
  .history-strip { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: thin; }
  .history-item { height: clamp(68px, 8vh, 82px); min-width: 92px; flex: 1 1 0; aspect-ratio: auto; }
  .history-item span { font-size: 10px; }
  .history-empty { flex: 1; padding: 14px 0; font-size: 13px; }

  .admin-dialog[open] {
    height: 100vh;
    height: 100dvh;
    display: grid;
    grid-template-rows: 76px minmax(0, 1fr);
    overflow: hidden;
  }
  .admin-header { position: relative; height: 76px; }
  .admin-header h1 { font-size: 27px; }
  .admin-content { height: 100%; padding: 20px clamp(20px, 4vw, 58px) 26px; overflow-y: auto; }
  .admin-metrics > div { padding: 13px 16px; }
  .admin-metrics strong { margin-top: 5px; font-size: 22px; }
  .admin-tabs { margin-top: 17px; }
  .admin-tabs button { height: 40px; }
  .admin-view { padding-top: 16px; }
  .admin-view-toolbar { min-height: 38px; margin-bottom: 10px; }
  .admin-table-wrap { max-height: calc(100dvh - 320px); overflow: auto; }
  .admin-table th { position: sticky; top: 0; z-index: 1; background: var(--paper); }
  .provider-form { padding: 18px 0; }
  .provider-fields { gap: 14px 20px; }
  .provider-meta { margin-top: 18px; }
  .provider-meta > span { padding: 11px 12px; }
  .provider-actions { margin-top: 16px; }
}

@media (min-width: 721px) and (max-width: 1100px) {
  .style-panel { grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding-inline: 20px; }
  .style-panel h1 { font-size: 25px; }
  .style-panel .panel-heading > p:last-child { font-size: 10px; white-space: normal; }
  .style-panel .style-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .style-panel .style-option > span { min-height: 43px; padding: 5px 7px; }
  .style-panel .style-option b { font-size: 13px; }
  .style-panel .style-option small { font-size: 10px; }
  .studio-workspace { grid-template-columns: minmax(370px, 1fr) minmax(0, 1fr); }
  .control-panel { padding: 18px 22px 8px; }
  .control-panel .prompt-heading h2 { font-size: 24px; }
  .control-panel .panel-heading > p:last-child { font-size: 12px; }
  .control-panel textarea { min-height: 90px; height: 90px; }
  .canvas-column { padding: 18px 18px 12px; }
}

@media (min-width: 721px) and (max-height: 700px) {
  .login-panel { padding-block: 38px; }
  .login-theme { top: 16px; right: 18px; }
  .login-panel h1 { font-size: 38px; }
  .login-lead { margin: 8px 0 18px; }
  .login-form > label { margin: 12px 0 6px; }
  .login-input-wrap input { height: 46px; }
  .login-error { min-height: 18px; margin-top: 6px; }
  .login-button { height: 48px; margin-top: 4px; }
  .login-security { margin-top: 14px; }
  .login-footer { bottom: 10px; }
  .login-visual-copy { bottom: 52px; }
  .login-visual-copy p { margin-bottom: 8px; }
  .login-visual-copy h2 { font-size: 34px; }
  .login-image-credit { bottom: 15px; }
}

@media (min-width: 721px) and (min-height: 701px) and (max-height: 800px) {
  .login-panel { padding-block: 22px; }
  .login-theme { top: 14px; right: 18px; }
  .login-panel h1 { font-size: 40px; line-height: 1.08; }
  .login-lead { margin: 5px 0 10px; }
  .auth-modes { margin-bottom: 8px; }
  .auth-modes button { height: 34px; }
  .login-form > label { margin: 7px 0 4px; }
  .login-input-wrap input { height: 42px; }
  .login-button { height: 46px; margin-top: 7px; }
  .login-error { min-height: 16px; margin-top: 5px; }
  .login-security { margin-top: 5px; }
  .login-footer { display: none; }
}

@media (max-width: 720px) {
  .login-screen { min-height: 100vh; min-height: 100dvh; height: auto; display: flex; flex-direction: column; overflow: visible; }
  .login-visual { min-height: 220px; height: max(220px, 28vh); flex: 0 0 max(220px, 28vh); }
  .login-visual-top { top: 18px; left: 18px; }
  .login-brand-mark { width: 34px; height: 34px; font-size: 17px; }
  .login-visual-copy { left: 18px; bottom: 28px; }
  .login-visual-copy p, .login-image-credit { display: none; }
  .login-visual-copy h2 { font-size: 27px; line-height: 1.13; }
  .login-panel { min-height: 72vh; height: auto; padding: 48px 22px 66px; place-items: start center; }
  .login-panel-inner { margin-top: 12px; }
  .login-theme { top: 14px; right: 14px; }
  .login-panel h1 { font-size: 36px; }
  .login-lead { margin-bottom: 28px; }
  .topbar { height: 62px; padding: 0 16px; }
  .service-status { display: none; }
  .balance-button { padding: 0 8px; }
  .balance-button > svg, .balance-button small { display: none; }
  .balance-button strong { margin-top: 0; }
  .account-info { display: none; }
  .top-actions { gap: 7px; }
  .studio-shell { display: block; }
  .studio-form, .studio-workspace { display: flex; flex-direction: column; }
  .style-panel { padding: 24px 18px 26px; }
  .style-panel .style-heading { margin-bottom: 16px; }
  .prompt-heading { margin-top: 0; padding-top: 0; border-top: 0; }
  .control-panel { padding: 28px 18px 34px; border-right: 0; border-bottom: 1px solid var(--line); }
  .panel-heading { margin-bottom: 23px; }
  .canvas-column { padding: 28px 16px 42px; }
  .canvas-stage { min-height: 0; aspect-ratio: 1 / 1; }
  .welcome-art, .result-view, .welcome-art img, .result-view > img { min-height: 0; }
  .history-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .image-dialog { padding: 68px 12px 48px; }
  .image-dialog-toolbar { top: 14px; left: 16px; right: 16px; }
  .image-dialog-meta { left: 16px; right: 16px; bottom: 14px; }
  .payment-dialog { padding: 28px 20px 24px; }
  .contact-float { top: auto; right: 10px; bottom: 10px; left: 10px; width: auto; display: flex; align-items: stretch; gap: 6px; transform: none; }
  .contact-card { min-height: 48px; flex: 1 1 0; padding: 6px; grid-template-columns: 26px minmax(0, 1fr); gap: 6px; }
  .contact-card-icon { width: 26px; height: 26px; font-size: 9px; }
  .contact-card-copy strong { font-size: 10px; }
  .contact-card-copy span { font-size: 8px; }
  .contact-copy, .contact-arrow { display: none; }
  .feedback-dialog { width: calc(100vw - 20px); max-height: calc(100vh - 86px); margin: auto auto 72px; }
  .payment-close { top: 14px; right: 14px; }
  .admin-header { height: 76px; padding: 0 16px; }
  .admin-header h1 { font-size: 25px; }
  .admin-content { padding: 24px 16px 44px; }
  .admin-metrics { grid-template-columns: 1fr 1fr; }
  .admin-metrics > div { padding: 16px 12px; border-bottom: 1px solid var(--line); }
  .admin-metrics > div + div { border-left: 0; }
  .admin-metrics > div:nth-child(even) { border-left: 1px solid var(--line); }
  .admin-metrics > div:last-child { grid-column: 1 / -1; border-bottom: 0; }
  .admin-tabs { gap: 22px; margin-top: 26px; }
  .admin-view-toolbar { align-items: stretch; flex-direction: column; }
  .admin-filter { align-items: stretch; flex-wrap: wrap; }
  .admin-search { width: 100%; }
  .admin-search input { width: 100%; }
  .admin-filter select { flex: 1; min-width: 150px; }
  .provider-fields { grid-template-columns: 1fr; gap: 17px; }
  .provider-meta { grid-template-columns: 1fr; }
  .provider-meta > span + span { border-left: 0; border-top: 1px solid var(--line); }
  .provider-actions { flex-direction: column-reverse; }
  .provider-actions button { width: 100%; }
  kbd { display: none; }
  .generate-button { grid-template-columns: 20px 1fr 20px; }
}

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