:root {
  --mobile-nav-height: 64px;
  --topbar-height: 64px;
  --moonlight: #f5f4f1;
  --surface: #ffffff;
  --silver-soft: #efefec;
  --deep-sea: #173f63;
  --deep-sea-ink: #18242f;
  --deep-sea-hover: #123553;
  --muted: #596773;
  --subtle: #62707a;
  --line: #dedfdc;
  --line-strong: #bcc3c8;
  --silver: #929da5;
  --danger: #a64242;
  --success: #467054;
  --ink-soft: #394955;
  --wash: #f8f8f6;
  --chip: #eaf0f4;
  --nav-active: #e1e9ef;
  --focus-ring: rgba(23, 63, 99, .42);
  --shadow-float: 0 18px 50px rgba(24, 36, 47, .11);
  --shadow-composer: 0 14px 38px rgba(24, 36, 47, .075);
  --type-display: clamp(2rem, 3.4vw, 2.85rem);
  --type-title: 1.45rem;
  --type-body: 1rem;
  --type-ui: .875rem;
  --type-meta: .75rem;
  --type-micro: .6875rem;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 72px;
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; color: var(--deep-sea-ink); background: var(--moonlight); font-family: "Segoe UI Variable", "PingFang SC", "Microsoft YaHei UI", sans-serif; font-size: var(--type-body); line-height: 1.6; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button { border: 0; cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
button:disabled { cursor: not-allowed; opacity: .48; }
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { 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; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: var(--moonlight); }
.login-card { width: min(430px, 100%); display: grid; gap: 20px; padding: 48px 42px 40px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-float); }
.login-brand, .top-brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-seal, .brand-logo { display: block; flex: none; width: 34px; height: 34px; object-fit: contain; mix-blend-mode: multiply; }
.brand-seal { display: grid; place-items: center; border: 0; color: #fff; background: var(--deep-sea); font-family: "STSong", "Songti SC", serif; font-size: 17px; }
.login-brand > span:last-child { display: grid; gap: 2px; }
.login-brand strong { font-size: 19px; letter-spacing: .08em; }
.login-brand small { color: var(--muted); font-size: 11px; }
.login-heading { margin: 10px 0 2px; }
.login-heading h1 { margin: 0 0 8px; color: var(--deep-sea); font-family: "STSong", "Songti SC", "Noto Serif CJK SC", serif; font-size: 34px; font-weight: 500; letter-spacing: -.03em; }
.login-copy, .login-note { margin: 0; color: var(--muted); line-height: 1.7; }
.login-note { font-size: 12px; }
.login-note a { display: inline; padding: 12px 2px; color: var(--deep-sea); text-underline-offset: 3px; }
.login-code-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.login-mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 4px; border: 1px solid var(--line); background: var(--wash); }
.login-mode-tab { min-height: 40px; border: 0; color: var(--ink-soft); background: transparent; font-weight: 650; }
.login-mode-tab[aria-selected="true"] { color: #fff; background: var(--deep-sea); }
.login-error { min-height: 1.2em; margin: 0; color: var(--danger); font-size: 12px; }
.text-link-button { justify-self: start; min-height: 36px; padding: 0; border: 0; color: var(--deep-sea); background: transparent; text-decoration: underline; text-underline-offset: 3px; }
.credit-ledger-panel.account-center-panel { width: min(860px, 100%); max-height: min(90vh, 820px); overflow: auto; padding: 0; }
.account-center-head { position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 30px 32px 26px; border-bottom: 1px solid var(--line); background: var(--wash); }
.account-center-head > .close-popover { flex: none; }
.account-center-identity { min-width: 0; display: flex; align-items: center; gap: 20px; }
.account-center-identity-copy { min-width: 0; display: grid; gap: 7px; }
.account-center-identity h2 { margin: 0; color: var(--deep-sea); font-family: "STSong", "Songti SC", "Noto Serif CJK SC", serif; font-size: 28px; font-weight: 520; letter-spacing: -.02em; }
.account-center-person { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.account-center-person strong { overflow: hidden; color: var(--deep-sea-ink); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.account-center-person span { color: var(--muted); font-size: var(--type-meta); }
.account-password-status { justify-self: start; display: inline-flex; min-height: 24px; align-items: center; padding: 3px 9px; border: 1px solid #cbd7df; border-radius: 999px; color: var(--deep-sea); background: var(--chip); font-size: var(--type-micro); font-weight: 700; }
.account-center-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; padding: 22px 24px 26px; background: var(--surface); }
.account-section { display: grid; align-content: start; gap: 20px; }
.account-section-surface { min-width: 0; padding: 24px; border: 1px solid var(--line); background: var(--wash); }
.account-section-heading { display: grid; gap: 5px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.account-section-heading h3 { margin: 0; color: var(--deep-sea-ink); font-size: 16px; font-weight: 720; }
.account-section-heading p { margin: 0; color: var(--muted); font-size: var(--type-meta); line-height: 1.6; }
.account-form { min-height: 100%; display: flex; flex-direction: column; gap: 17px; }
.account-form .form-label { margin-bottom: 0; }
.account-avatar-preview { flex: none; width: 80px; height: 80px; border: 4px solid var(--surface); border-radius: 50%; object-fit: cover; background: var(--chip); box-shadow: 0 0 0 1px var(--line-strong), 0 8px 22px rgba(24, 36, 47, .09); }
.account-avatar-controls { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.account-avatar-button { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; gap: 7px; padding: 7px 11px; cursor: pointer; }
.account-avatar-button svg { width: 16px; height: 16px; }
.account-avatar-help { color: var(--muted); font-size: var(--type-micro); }
.account-field-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account-field-heading small { color: var(--muted); font-size: var(--type-micro); font-weight: 550; }
.account-form input, .account-form textarea { transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.account-form input:hover, .account-form textarea:hover { border-color: var(--line-strong); }
.account-form input:focus, .account-form textarea:focus { border-color: var(--deep-sea); box-shadow: 0 0 0 3px rgba(23, 63, 99, .12); }
.account-section-actions { display: flex; justify-content: flex-end; margin-top: auto; padding-top: 4px; }
.account-section-actions .primary-button { min-width: 128px; }
.account-center-feedback { margin: 18px 24px 0; padding: 10px 12px; border: 1px solid #dfb6b6; color: #7d3030; background: #fff5f5; font-size: var(--type-meta); line-height: 1.55; }
.account-center-feedback.success { border-color: #b8cdbf; color: #315a40; background: #f3f8f4; }

.form-label { display: block; margin-bottom: 16px; color: var(--ink-soft); font-size: 13px; font-weight: 650; }
.form-label input, .video-field input, .video-field select, .video-history-tools select, #redeem-code-input { display: block; width: 100%; min-height: 44px; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; outline: none; color: var(--deep-sea); background: var(--surface); }
.login-code-row input { height: 44px; }
.form-label input:focus, .video-field input:focus, .video-field select:focus, .video-history-tools select:focus, #redeem-code-input:focus { border-color: var(--deep-sea); box-shadow: 0 0 0 3px rgba(23, 63, 99, .12); }
.form-label small { display: block; margin-top: 6px; color: var(--subtle); font-size: 11px; font-weight: 500; line-height: 1.55; }
.primary-button, .generate-button { min-height: 44px; padding: 11px 18px; border-radius: 4px; color: #fff; background: var(--deep-sea); font-weight: 720; box-shadow: none; transition: background .18s ease, transform .18s ease; }
.primary-button:hover:not(:disabled), .generate-button:hover:not(:disabled) { background: var(--deep-sea-hover); transform: translateY(-1px); }
.secondary-button, .refresh-button, .control-button { min-height: 40px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink-soft); background: var(--surface); font-weight: 650; }
.secondary-button:hover, .refresh-button:hover, .control-button:hover { border-color: var(--line-strong); background: var(--wash); }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; }
.icon-button svg { width: 18px; height: 18px; }
.login-submit { width: 100%; min-height: 48px; }
.login-code-row .secondary-button { height: 44px; min-height: 44px; white-space: nowrap; }

.app-shell { min-height: 100vh; }
.app-topbar { position: fixed; inset: 0 0 auto 0; z-index: 18; height: var(--topbar-height); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; border-bottom: 1px solid var(--line); background: var(--moonlight); }
.top-brand { position: relative; z-index: 1; font-size: 17px; font-weight: 760; letter-spacing: .12em; text-decoration: none; }
.top-brand .brand-logo, .top-brand .brand-seal { width: 34px; height: 34px; }
.desktop-primary-nav { position: absolute; left: 50%; top: 0; height: 100%; display: flex; align-items: center; gap: 6px; transform: translateX(-50%); }
.desktop-primary-nav .nav-item { position: relative; display: inline-flex; min-height: 40px; align-items: center; padding: 0 14px; border-radius: 999px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 680; }
.desktop-primary-nav .nav-item:hover { color: var(--deep-sea); background: var(--silver-soft); }
.desktop-primary-nav .nav-item.active { color: var(--deep-sea); background: transparent; }
.desktop-primary-nav .nav-item.active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 6px; height: 2px; border-radius: 999px; background: var(--deep-sea); }
.mobile-primary-nav { display: none; }
.top-account { position: relative; z-index: 1; }
.account-menu-button { display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 4px 5px 4px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--deep-sea); background: var(--surface); }
.account-menu-button > svg { width: 14px; height: 14px; margin-right: 6px; }
.top-credit { font-size: 12px; font-weight: 720; }
.avatar { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; color: #fff; background: var(--deep-sea); font-size: 12px; background-repeat: no-repeat; }
.account-menu { position: absolute; right: 0; top: calc(100% + 10px); width: 240px; padding: 10px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-float); }
.account-identity { display: grid; gap: 7px; padding: 9px 9px 13px; border-bottom: 1px solid var(--line); }
.account-identity strong { font-size: 13px; }
.credit-summary { display: flex; align-items: baseline; justify-content: space-between; margin: 10px 0 6px; padding: 11px 9px; background: var(--chip); }
.credit-summary strong { font-size: 14px; }
.credit-summary small { color: var(--muted); font-size: 11px; }
.account-action { display: flex; width: 100%; min-height: 39px; align-items: center; padding: 8px 9px; border-radius: 3px; color: var(--ink-soft); background: transparent; text-align: left; text-decoration: none; font-size: 13px; }
.account-action:hover { color: var(--deep-sea); background: var(--silver-soft); }
.danger-text { color: var(--danger); }
.main-content { min-height: 100vh; margin-left: 0; padding-top: var(--topbar-height); }
.view { display: none; }
.view.active { display: block; }
.creation-stage { padding: clamp(40px, 5.5vw, 68px) 24px 0; }
.studio-hero { max-width: 860px; margin: 0 auto 26px; text-align: center; }
.studio-hero h1 { margin: 0; color: var(--deep-sea-ink); font-family: "STSong", "Songti SC", "Noto Serif CJK SC", serif; font-size: var(--type-display); font-weight: 500; line-height: 1.18; letter-spacing: -.025em; text-wrap: balance; }
.subtitle { max-width: 660px; margin: 10px auto 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.studio-hero-with-action { position: relative; }
.studio-hero-with-action > div { text-align: center; }
.hero-link, .view-all-button { display: inline-flex; min-height: 40px; align-items: center; gap: 5px; padding: 8px 4px; border-radius: 8px; color: var(--deep-sea); background: transparent; font-size: var(--type-meta); font-weight: 680; text-decoration: none; }
.hero-link:hover, .view-all-button:hover { color: var(--deep-sea-hover); background: var(--silver-soft); }
.hero-link svg, .view-all-button svg { width: 16px; height: 16px; }
.studio-hero-with-action > .hero-link { position: absolute; right: 0; bottom: 2px; }
.creation-card { max-width: 860px; margin: 0 auto; overflow: visible; border: 1px solid rgba(188,195,200,.72); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-composer); }
.composer { padding: 22px 24px 18px; }
.prompt-label { display: block; margin: 0 0 6px; color: var(--muted); font-size: var(--type-meta); font-weight: 650; letter-spacing: .02em; }
.composer textarea { display: block; width: 100%; min-height: 142px; resize: vertical; border: 0; outline: 0; padding: 8px 2px 12px; color: var(--deep-sea-ink); background: transparent; font-size: 1.025rem; line-height: 1.75; caret-color: var(--deep-sea); }
.composer textarea:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 4px; border-radius: 8px; }
.composer textarea::placeholder { color: #6a7781; opacity: 1; }
.inspiration-row { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 15px; }
.inspiration-row button { min-height: 30px; padding: 5px 10px; border: 1px solid transparent; border-radius: 999px; color: var(--muted); background: var(--wash); font-size: var(--type-micro); }
.inspiration-row button:hover { border-color: var(--line); color: var(--deep-sea); background: var(--chip); }
.reference-area { margin: 0 0 14px; }
.preview-list { display: none; grid-template-columns: repeat(auto-fill, 72px); gap: 9px; }
.preview-list:not(:empty) { display: grid; }
.preview { position: relative; width: 72px; height: 72px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--silver-soft); }
.preview img { width: 100%; height: 100%; object-fit: cover; }
.remove-preview { position: absolute; right: 4px; top: 4px; width: 24px; height: 24px; display: grid; place-items: center; padding: 0; border-radius: 50%; color: #fff; background: rgba(24,36,47,.76); }
.remove-preview svg { width: 12px; height: 12px; }
.composer-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.composer-toolbar { align-items: center; }
.composer-tools { min-width: 0; display: flex; align-items: center; gap: 7px; }
.tool-button { min-height: 40px; display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink-soft); background: var(--surface); font-size: var(--type-meta); font-weight: 650; }
.tool-button:hover, .tool-button.active { border-color: var(--line-strong); color: var(--deep-sea); background: var(--wash); }
.tool-button svg { width: 16px; height: 16px; }
.tool-button.icon-only { width: 40px; padding: 0; }
.compact-field { display: inline-flex; flex: none; }
.compact-field select { min-height: 40px; max-width: 136px; padding: 7px 28px 7px 10px; border: 1px solid var(--line); border-radius: 9px; outline: none; color: var(--ink-soft); background: var(--surface); font-size: var(--type-meta); font-weight: 650; }
.compact-field select:hover { border-color: var(--line-strong); background: var(--wash); }
.compact-field select:focus-visible { border-color: var(--deep-sea); }
.model-field select { max-width: 190px; }
.composer-commit { display: flex; flex: none; align-items: center; justify-content: flex-end; gap: 12px; margin-left: auto; }
.tip-text, .commit-cost { color: var(--muted); font-size: var(--type-meta); line-height: 1.45; text-align: right; }
.generate-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 94px; border-radius: 9px; }
.generate-button svg { width: 17px; height: 17px; }
.generate-button.busy svg { display: none; }
.composer-status { min-height: 18px; margin: 8px 0 0; color: var(--muted); font-size: var(--type-meta); line-height: 1.5; }
.composer-status.error { color: var(--danger); }
.ghost-button { min-height: 36px; padding: 7px 10px; border: 0; border-radius: 8px; color: var(--ink-soft); background: transparent; font-size: var(--type-meta); font-weight: 600; }
.ghost-button:hover { color: var(--deep-sea); background: var(--silver-soft); }
.creation-notice { margin: 7px 0 0; color: var(--subtle); font-size: var(--type-micro); line-height: 1.55; }
.dragging.creation-card { border-color: var(--deep-sea); box-shadow: 0 14px 38px rgba(24,36,47,.075), 0 0 0 3px rgba(23,63,99,.12); }

.history-section { max-width: 1180px; margin: 66px auto 0; padding: 0 24px 80px; }
.recent-section { margin-top: 58px; }
.works-stage { padding: 54px 24px 0; }
.works-tabs { display: flex; width: min(420px, 100%); margin: 28px auto 0; border-bottom: 1px solid var(--line); }
.works-tab { position: relative; flex: 1; min-height: 44px; padding: 10px 20px; border: 0; color: var(--muted); background: transparent; font-size: var(--type-ui); font-weight: 650; }
.works-tab::after { position: absolute; right: 24px; bottom: -1px; left: 24px; height: 2px; background: transparent; content: ""; transition: background .18s ease; }
.works-tab:hover { color: var(--deep-sea); }
.works-tab[aria-selected="true"] { color: var(--deep-sea); }
.works-tab[aria-selected="true"]::after { background: var(--deep-sea); }
.works-section { margin-top: 36px; }
.works-section + .works-section { margin-top: 36px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; color: var(--deep-sea-ink); font-family: "STSong", "Songti SC", serif; font-size: var(--type-title); font-weight: 520; letter-spacing: -.01em; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: var(--type-meta); }
.empty-state { min-height: 210px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 0; color: var(--muted); background: transparent; }
.empty-icon { display: grid; width: 42px; height: 42px; place-items: center; color: var(--silver); }
.empty-icon svg { width: 27px; height: 27px; }
.empty-state h3 { margin: 12px 0 5px; color: var(--ink-soft); font-size: var(--type-ui); font-weight: 620; }
.empty-state p { margin: 0; font-size: 12px; }
.history-grid, .gallery-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 16px; }
.history-card { min-width: 0; overflow: hidden; background: transparent; }
.image-stack { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); min-height: 230px; gap: 2px; border-radius: 14px; overflow: hidden; background: #e5e6e3; }
.image-stack.single { display: block; height: 330px; }
.image-stack.single .image-item { height: 100%; }
.image-item { position: relative; min-height: 190px; overflow: hidden; background: #e5e6e3; }
.image-preview-button { width: 100%; height: 100%; min-height: 190px; padding: 0; background: transparent; }
.image-preview-button img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .24s ease; }
.image-item:hover img { transform: scale(1.018); }
.media-card-actions { position: absolute; right: 10px; bottom: 10px; left: 10px; z-index: 3; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 5px; border-radius: 10px; color: #fff; background: rgba(24,36,47,.82); opacity: 0; pointer-events: none; transform: translateY(5px); transition: opacity .18s ease, transform .18s ease; }
.history-card:hover .media-card-actions, .history-card:focus-within .media-card-actions, .video-history-card:hover .media-card-actions, .video-history-card:focus-within .media-card-actions { opacity: 1; pointer-events: auto; transform: translateY(0); }
.media-card-action {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 5px 7px;
  border: 0;
  border-radius: 7px;
  color: inherit;
  background: transparent;
  font: inherit;
  line-height: 1;
  text-decoration: none;
  font-size: 10px;
  white-space: nowrap;
}
.media-card-action:hover { background: rgba(255,255,255,.14); }
.media-card-action.danger-action { color: #ffd6d6; }
.card-pending { min-height: 230px; display: grid; place-items: center; align-content: center; gap: 10px; border-radius: 14px; color: var(--muted); background: #e7e8e5; font-size: 12px; }
.loader { width: 24px; height: 24px; border: 2px solid #c3c9cc; border-top-color: var(--deep-sea); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.card-body { padding: 10px 1px 0; }
.card-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--subtle); font-size: var(--type-micro); }
.failed-note { color: var(--danger); font-size: 11px; }
.video-source-warning { margin: 0; color: #8a5b24; font-size: 11px; line-height: 1.5; }

.options-popover { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px; }
.dialog-backdrop { position: absolute; inset: 0; background: rgba(6,25,43,.56); }
.options-panel { position: relative; z-index: 1; width: min(440px, 100%); max-height: calc(100vh - 48px); overflow-y: auto; padding: 22px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-float); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.dialog-head h2 { margin: 0; color: var(--deep-sea-ink); font-size: 18px; font-weight: 650; }
.close-popover { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; color: var(--muted); background: transparent; }
.close-popover svg { width: 16px; height: 16px; }
.close-popover:hover { color: var(--deep-sea); background: var(--silver-soft); }
.parameter-summary-button { max-width: min(360px, 60vw); justify-content: space-between; }
.parameter-summary-button > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.parameter-summary-button > svg { flex: none; width: 14px; height: 14px; }
.parameter-panel { width: min(460px, 100%); max-height: min(84vh, 780px); padding: 22px; border-radius: 16px; }
.parameter-section + .parameter-section { margin-top: 22px; }
.parameter-section h3 { margin: 0 0 9px; color: var(--deep-sea-ink); font-size: 13px; font-weight: 720; }
.parameter-segments { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 10px; background: var(--silver-soft); }
.parameter-segments button, .parameter-choice-grid button, .parameter-count-grid button { min-height: 40px; border-radius: 8px; color: var(--muted); background: transparent; font-size: var(--type-meta); font-weight: 650; }
.parameter-segments button:hover:not(:disabled), .parameter-choice-grid button:hover:not(:disabled), .parameter-count-grid button:hover:not(:disabled), .parameter-ratio-grid button:hover:not(:disabled) { color: var(--deep-sea); background: rgba(255,255,255,.64); }
.parameter-segments button[aria-pressed="true"], .parameter-choice-grid button[aria-pressed="true"], .parameter-count-grid button[aria-pressed="true"], .parameter-ratio-grid button[aria-pressed="true"] { color: var(--deep-sea-ink); background: var(--surface); box-shadow: 0 1px 4px rgba(24,36,47,.08); }
.parameter-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.parameter-choice-grid button { min-width: 0; padding: 8px 10px; border: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.parameter-choice-grid button[aria-pressed="true"] { border-color: var(--line-strong); }
.parameter-ratio-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px 4px; padding: 8px 6px; border-radius: 10px; background: var(--silver-soft); }
.parameter-ratio-grid button { min-width: 0; min-height: 58px; display: grid; place-items: center; align-content: center; gap: 4px; padding: 6px 2px; border-radius: 8px; color: var(--muted); background: transparent; font-size: 10px; }
.parameter-ratio-shape { display: block; max-width: 30px; max-height: 30px; border: 1.5px solid currentColor; border-radius: 1px; }
.parameter-ratio-auto { display: grid; width: 24px; height: 24px; place-items: center; }
.parameter-ratio-auto svg { width: 21px; height: 21px; }
.parameter-count-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; padding: 4px; border-radius: 10px; background: var(--silver-soft); }
.parameter-count-grid button { min-width: 0; }
.parameter-more { margin-top: 22px; border-top: 1px solid var(--line); }
.parameter-more-inline { margin-top: 10px; border-top: 0; }
.parameter-cost { display: flex; align-items: center; gap: 7px; margin: 0 0 16px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink-soft); background: var(--wash); font-size: var(--type-meta); font-weight: 650; }
.parameter-cost::before { width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--deep-sea); content: ""; }
.parameter-ratio-grid-more { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.parameter-more summary { display: flex; min-height: 44px; align-items: center; justify-content: space-between; color: var(--deep-sea); cursor: pointer; font-size: var(--type-meta); font-weight: 700; list-style: none; }
.parameter-more summary::-webkit-details-marker { display: none; }
.parameter-more summary::after { content: "+"; color: var(--muted); font-size: 18px; font-weight: 400; }
.parameter-more[open] summary::after { content: "−"; }
.parameter-more-content { padding: 4px 0 2px; }
.parameter-panel button:disabled { opacity: .34; }

.credit-ledger { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: rgba(6,25,43,.56); }
.credit-ledger-panel { width: min(620px, 100%); max-height: 82vh; overflow: auto; padding: 24px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-float); }
.credit-entry { display: flex; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.credit-entry div { display: grid; gap: 4px; }
.credit-entry small { color: var(--muted); }
.credit-positive { color: var(--success); }.credit-negative { color: var(--danger); }
#redeem-code-input { margin: 8px 0 14px; letter-spacing: .12em; font-weight: 700; text-transform: uppercase; }
#redemption-result { min-height: 20px; color: var(--muted); }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: flex; align-items: flex-start; gap: 10px; max-width: 420px; padding: 12px 12px 12px 16px; color: #fff; background: var(--deep-sea); box-shadow: var(--shadow-float); font-size: 12px; }
.toast.error { background: var(--danger); }
.toast-close { flex: none; width: 28px; height: 28px; display: grid; place-items: center; padding: 0; color: inherit; background: transparent; }
.toast-close svg { width: 14px; height: 14px; }

.image-preview-modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px; }
.preview-modal-backdrop { position: absolute; inset: 0; background: rgba(4,18,32,.84); }
.preview-modal-content { position: relative; z-index: 1; overflow: hidden; background: var(--surface); }
.media-detail-modal { width: min(1180px, 96vw); height: min(760px, calc(100vh - 48px)); display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .75fr); grid-template-rows: minmax(0, 1fr); }
.media-detail-stage { position: relative; min-width: 0; min-height: 0; display: grid; place-items: center; overflow: hidden; background: #06192b; }
.media-detail-stage > img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.media-detail-stage > video { position: absolute; left: 50%; top: 50%; display: block; max-width: 100%; max-height: 100%; object-fit: contain; transform: translate(-50%, -50%); }
.media-detail-stage > video.media-detail-video-loading { opacity: 0; }
.media-detail-copy { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 22px; padding: clamp(28px, 4vw, 48px); overflow-y: auto; color: var(--deep-sea-ink); background: var(--surface); }
.media-detail-copy h2 { margin: 8px 0 0; font-family: "STSong", "Songti SC", serif; font-size: 25px; font-weight: 550; }
.media-detail-copy > p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; }
.media-count, .media-detail-meta { color: var(--muted); font-size: 11px; }
.media-detail-meta { margin-top: auto !important; }
.modal-close { position: absolute; right: 12px; top: 12px; z-index: 3; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border-radius: 50%; color: #fff; background: rgba(6,25,43,.72); }
.modal-close svg { width: 16px; height: 16px; }
.modal-download { width: fit-content; padding: 9px 13px; color: #fff; background: var(--deep-sea); text-decoration: none; font-size: 12px; }
.video-last-frame { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; color: var(--deep-sea); background: var(--wash); text-decoration: none; font-size: var(--type-meta); font-weight: 650; }
.video-last-frame img { display: block; width: 64px; height: 52px; border-radius: 7px; object-fit: cover; background: var(--silver-soft); }
.video-last-frame:hover { border-color: var(--line-strong); background: var(--chip); }
.media-nav { position: absolute; top: 50%; z-index: 2; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: rgba(6,25,43,.7); transform: translateY(-50%); }
.media-nav svg { width: 22px; height: 22px; }
.media-nav-previous { left: 16px; }.media-nav-next { right: 16px; }
.media-nav:disabled { opacity: .25; }

#redemption-result.error { color: var(--danger); }
.policy-body { min-height: 100vh; padding: 1px 0; background: var(--moonlight); }
.policy-page { width: min(800px, calc(100% - 36px)); margin: 44px auto; padding: clamp(28px, 5vw, 54px); border: 1px solid var(--line); color: #263c51; background: var(--surface); line-height: 1.85; }
.policy-page::before { content: "绘境"; display: inline-block; margin-bottom: 25px; color: var(--silver); font-family: "STSong", "Songti SC", serif; letter-spacing: .2em; }
.policy-page h1 { margin: 0 0 26px; color: var(--deep-sea); font-family: "STSong", "Songti SC", serif; font-size: clamp(34px, 5vw, 46px); font-weight: 520; }
.policy-page h2 { margin: 34px 0 10px; color: var(--deep-sea); font-size: 17px; }
.policy-page p { max-width: 72ch; }

@media (max-width: 900px) {
  .history-grid, .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  body { padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom)); }
  .desktop-primary-nav { display: none; }
  .mobile-primary-nav { position: fixed; inset: auto 0 0; z-index: 25; display: grid; grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); gap: 4px; height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom)); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); overflow: hidden; }
  .mobile-primary-nav .nav-item { display: flex; min-width: 44px; min-height: 44px; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 8px; color: var(--muted); background: transparent; }
  .mobile-primary-nav .nav-item.active { color: var(--deep-sea); background: var(--nav-active); }
  .mobile-primary-nav .nav-icon { display: grid; width: 18px; height: 18px; place-items: center; }
  .mobile-primary-nav .nav-icon svg { width: 18px; height: 18px; }
  .mobile-primary-nav .nav-label { display: block; font-size: 10px; font-weight: 650; }
  .app-topbar { left: 0; height: 58px; padding: 0 14px; }
  .top-brand { font-size: 15px; }
  .top-brand .brand-logo, .top-brand .brand-seal { width: 32px; height: 32px; }
  .top-credit { display: inline-flex; font-size: 11px; }
  .main-content { margin-left: 0; padding-top: 58px; padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom)); }
  .creation-stage { padding: 30px 12px 0; }
  .studio-hero { margin-bottom: 20px; padding: 0 8px; }
  .studio-hero h1 { font-size: clamp(1.8rem, 7.6vw, 2.15rem); }
  .studio-hero-with-action > .hero-link { position: static; margin-top: 10px; }
  .subtitle { font-size: 12px; }
  .creation-card { width: 100%; border-radius: 16px; }
  .composer { padding: 16px 15px 15px; }
  .composer textarea { min-height: 126px; }
  .inspiration-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .inspiration-row button { white-space: nowrap; }
  .composer-footer { flex-wrap: wrap; align-items: stretch; }
  .composer-tools { width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .compact-field select { max-width: 122px; }
  .model-field select { max-width: 170px; }
  .composer-commit { width: 100%; justify-content: space-between; margin-left: 0; }
  .commit-cost, .tip-text { text-align: left; }
  .generate-button { margin-left: auto; }
  .history-section { margin-top: 48px; padding: 0 12px 34px; }
  .works-stage { padding: 30px 12px 0; }
  .works-tabs { width: 100%; margin-top: 22px; }
  .works-tab { min-height: 44px; padding-inline: 12px; }
  .works-tab::after { right: 18px; left: 18px; }
  .works-section { margin-top: 28px; }
  .history-grid, .gallery-grid { grid-template-columns: 1fr; gap: 24px; }
  .section-heading { align-items: flex-start; }
  .image-stack.single { height: min(118vw, 470px); }
  .media-card-actions { opacity: 1; pointer-events: auto; transform: none; }
  .media-card-action { min-height: 44px; padding: 10px 9px; }
  .remove-preview { width: 44px; height: 44px; right: 0; top: 0; }
  .top-brand, .account-menu-button, .account-action, .tool-button, .tool-button.icon-only, .compact-field select, .view-all-button, .hero-link, .inspiration-row button, .ghost-button { min-width: 44px; min-height: 44px; }
  .modal-close, .close-popover, .media-nav, .icon-button { width: 44px; height: 44px; }
  .credit-ledger { align-items: end; padding: 0; }
  .credit-ledger-panel { width: 100%; max-height: 88vh; padding: 20px 17px calc(22px + env(safe-area-inset-bottom)); }
  .toast { right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); left: 12px; max-width: none; }
  .account-menu { position: fixed; right: 10px; top: 66px; left: 10px; width: auto; }
  .policy-page { width: calc(100% - 24px); margin: 18px auto; padding: 26px 20px; }
  .media-detail-modal { width: 100%; height: min(92vh, 820px); grid-template-columns: 1fr; grid-template-rows: minmax(0, 1.35fr) minmax(220px, .65fr); }
  .media-detail-copy { gap: 14px; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); overflow-y: auto; }
  .media-detail-meta { margin-top: 0 !important; }
  .media-nav { width: 44px; height: 44px; }
  .image-preview-modal { align-items: end; padding: 0; }
  .credit-ledger-panel.account-center-panel { width: 100%; max-height: 92vh; padding: 0; }
  .password-reset-panel { width: 100%; max-height: 88vh; }
  .account-center-head { padding: 22px 17px 20px; }
  .account-center-identity { align-items: flex-start; gap: 14px; }
  .account-center-identity h2 { font-size: 24px; }
  .account-avatar-preview { width: 68px; height: 68px; }
  .account-center-person { display: grid; gap: 1px; }
  .account-avatar-controls { align-items: flex-start; gap: 7px; }
  .account-avatar-help { flex-basis: 100%; }
  .account-center-grid { grid-template-columns: 1fr; gap: 14px; padding: 16px 14px calc(20px + env(safe-area-inset-bottom)); }
  .account-section-surface { padding: 19px 17px; }
  .account-center-feedback { margin: 14px 14px 0; }
  .account-section-actions .primary-button { width: 100%; }
  .account-form .primary-button, .account-avatar-button, #submit-password-reset, #send-reset-code { min-height: 44px; }
  .parameter-modal { align-items: end; padding: 0; }
  .parameter-panel { width: 100%; max-height: 88vh; padding: 20px 16px calc(22px + env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; }
  .parameter-ratio-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .parameter-summary-button { max-width: calc(100vw - 132px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .primary-button, .generate-button, .nav-item::after, .image-preview-button img, .media-card-actions { transition: none; }
  .primary-button:hover:not(:disabled), .generate-button:hover:not(:disabled), .nav-item:hover::after, .nav-item:focus-visible::after, .image-item:hover img, .history-card:hover .media-card-actions, .history-card:focus-within .media-card-actions, .video-history-card:hover .media-card-actions, .video-history-card:focus-within .media-card-actions { transform: none; }
  .loader { animation: none; border-color: var(--line-strong); border-top-color: var(--deep-sea); }
}
