/* BAIZHI AI · UI v2 (2026-11-08)
   Every rule is scoped to html.ui-v2, which ui-v2.js sets. Without that class
   the site renders exactly as before, so the switch is reversible at any time.
   Sections: 0 tokens · 1 type floor · 2 dialogs · 3 phone shell & create page
             4 phone works / tools / account · 5 phone sign-in · 6 desktop */

/* ---------------------------------------------------------------- 0 tokens */
html.ui-v2 {
  --v2-bg: #0d1115;
  --v2-surface: #161c22;
  --v2-raised: #1e252c;
  --v2-line: #2b343b;
  --v2-line-strong: #3a454d;
  --v2-text: #eef2f4;
  --v2-muted: #9aa6ae;
  --v2-accent: #d8ff4f;
  --v2-accent-ink: #11150a;
  --v2-danger: #ff6d7a;
  --v2-danger-text: #ff9aa4;
  --v2-nav-h: 64px;
  --v2-bar-h: 72px;
  --v2-safe-b: env(safe-area-inset-bottom, 0px);
}

/* ---------------------------------------------------------------- 1 type floor (no text under 12px) */
html.ui-v2 .studio-layout small,
html.ui-v2 .studio-layout .chip,
html.ui-v2 .studio-layout .counter,
html.ui-v2 .studio-layout .history-library-copy small,
html.ui-v2 .studio-layout .studio-panel-dialog small,
html.ui-v2 .studio-layout .studio-panel-dialog .preset small,
html.ui-v2 .studio-layout .results-heading .chip,
html.ui-v2 .studio-layout .history-item-delete,
html.ui-v2 .studio-layout .video-player-status,
html.ui-v2 .studio-layout .pay-tips b,
html.ui-v2 .studio-layout .profile-avatar i,
html.ui-v2 .pay-dialog-head small,
html.ui-v2 .pay-amount small,
html.ui-v2 .studio-layout .studio-result-empty small,
html.ui-v2 .studio-layout .mini-avatar,
html.ui-v2 .studio-layout #creditLedgerCount,
html.ui-v2 .studio-layout .ledger-amount,
html.ui-v2 .studio-layout .ledger-copy b { font-size: 12px; }
html.ui-v2 .studio-layout .ledger-copy b { font-size: 13px; }
html.ui-v2 .studio-layout .studio-panel-dialog .block-heading > span { font-size: 12px; }
html.ui-v2 .studio-layout .history-confirm-copy small,
html.ui-v2 .studio-layout .history-item-action-heading small { font-size: 12px; letter-spacing: 0; }
html.ui-v2 .studio-layout .history-confirm-copy p,
html.ui-v2 .studio-layout .private-dialog-heading p { font-size: 14px; }
html.ui-v2 .studio-layout .history-confirm-actions button { font-size: 15px; }

/* ---------------------------------------------------------------- 1b centring fixes
   .text-button had 14px padding on the left and 0 on the right, so its label sat
   7px right of centre (also on the live site). Labels in buttons are centred both ways. */
html.ui-v2 .studio-layout .text-button { display: inline-flex; align-items: center; justify-content: center; padding-left: 10px; padding-right: 10px; text-align: center; }
html.ui-v2 .studio-layout .outline-button,
html.ui-v2 .studio-layout .secondary-button,
html.ui-v2 .studio-layout .chip { text-align: center; }
html.ui-v2 .studio-layout .chip { display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
html.ui-v2 .studio-layout .studio-panel-dialog .preset { align-content: center; padding-top: 6px; padding-bottom: 10px; }
html.ui-v2 .studio-layout .mini-avatar { display: inline-grid; place-items: center; line-height: 1; }

/* Sign-in consent checkbox: ".auth-row input" (text-field styling: dark gradient,
   16px radius, 50–56px tall) also hit this checkbox and drew a tall dark box
   around it. Give it back a plain 18px checkbox aligned with the first line. */
html.ui-v2 .auth-row .auth-consent,
html.ui-v2 .auth-email-form .auth-consent { display: flex; align-items: flex-start; gap: 10px; padding: 4px 2px; font-size: 13px; line-height: 1.6; }
html.ui-v2 body.auth-mode .auth-row .auth-consent input[type="checkbox"],
html.ui-v2 .auth-consent input[type="checkbox"] {
  flex: 0 0 18px; width: 18px; height: 18px; min-width: 18px; min-height: 0;
  margin: 2px 0 0; padding: 0; border: 0; border-radius: 4px;
  background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
  accent-color: var(--v2-accent); cursor: pointer;
}

/* Tab switch: fade only. The old slide used transform, which turns the fixed
   generate bar into a child of the form for 0.3s and makes it jump mid-screen. */
@keyframes v2TabIn { from { opacity: 0; } to { opacity: 1; } }
/* Pages glide in from the side the tab sits on (app.js sets --mobile-tab-shift to ±14px). */
@keyframes v2TabSlide { from { opacity: 0; transform: translate3d(var(--mobile-tab-shift, 10px), 0, 0); } to { opacity: 1; transform: none; } }
html.ui-v2 .mobile-tab-entering #historyView,
html.ui-v2 .mobile-tab-entering #privateSpaceView,
html.ui-v2 .mobile-tab-entering #toolsView,
html.ui-v2 .mobile-tab-entering #accountView { animation: v2TabSlide .34s cubic-bezier(.2, .82, .24, 1) both; }
/* The create form holds the fixed generate bar, so the form itself only fades;
   its other blocks (siblings of the bar, never its ancestors) do the slide. */
html.ui-v2 .mobile-tab-entering #generatorForm { animation: v2TabIn .2s ease both; }
html.ui-v2 .mobile-tab-entering #generatorForm .studio-composer > :not(.studio-submit-row),
html.ui-v2 .mobile-tab-entering #historySection,
html.ui-v2 .mobile-tab-entering #resultSection,
html.ui-v2 .mobile-tab-entering #studioResultEmpty { animation: v2TabSlide .34s cubic-bezier(.2, .82, .24, 1) both; }
html.ui-v2 .studio-layout #generatorForm { transform: none; }
@media (prefers-reduced-motion: reduce) {
  html.ui-v2 .mobile-tab-entering * , html.ui-v2 .mobile-tab-entering #generatorForm { animation: none !important; }
  html.ui-v2 .studio-layout .mobile-nav-indicator { transition: none !important; }
}

/* ---------------------------------------------------------------- 2 dialogs: one surface, two shapes */
html.ui-v2 .studio-layout .private-space-dialog,
html.ui-v2 .studio-layout .history-confirm-dialog,
html.ui-v2 .studio-layout .history-item-action-dialog,
html.ui-v2 .studio-layout .pay-dialog,
html.ui-v2 .studio-layout .studio-panel-dialog {
  border: 1px solid var(--v2-line);
  border-radius: 20px;
  background: var(--v2-surface);
  color: var(--v2-text);
  box-shadow: 0 24px 72px rgba(0, 0, 0, .55);
}
html.ui-v2 .studio-layout .private-space-dialog::backdrop,
html.ui-v2 .studio-layout .history-confirm-dialog::backdrop,
html.ui-v2 .studio-layout .history-item-action-dialog::backdrop,
html.ui-v2 .studio-layout .pay-dialog::backdrop,
html.ui-v2 .studio-layout .studio-panel-dialog::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(2px); }

/* Titles and eyebrows read the same in every dialog. */
html.ui-v2 .studio-layout .private-dialog-heading h2,
html.ui-v2 .studio-layout .history-confirm-copy h2,
html.ui-v2 .studio-layout .history-item-action-heading h2,
html.ui-v2 .studio-layout .studio-panel-heading h2,
html.ui-v2 .pay-dialog-head h2 { margin: 4px 0 0; font-size: 17px; font-weight: 600; line-height: 1.35; color: var(--v2-text); }
html.ui-v2 .pay-dialog[data-channel] .pay-dialog-head h2 { color: var(--v2-text); }
html.ui-v2 .studio-layout .history-confirm-copy small,
html.ui-v2 .studio-layout .history-item-action-heading small,
html.ui-v2 .pay-dialog-head small { color: var(--v2-muted); font-family: inherit; font-weight: 400; letter-spacing: 0; }

/* Primary / secondary / danger buttons inside dialogs */
html.ui-v2 .studio-layout .private-dialog-actions button,
html.ui-v2 .studio-layout .history-confirm-actions button,
html.ui-v2 .pay-actions button { min-height: 48px; border-radius: 12px; font-size: 15px; }
html.ui-v2 .studio-layout .history-confirm-actions .danger-confirm { border-color: var(--v2-danger); background: var(--v2-danger); color: #1a0a0c; font-weight: 700; }

/* Close buttons: 44px targets */
html.ui-v2 .pay-close { width: 44px; height: 44px; top: 8px; right: 8px; }
html.ui-v2 .studio-layout .studio-panel-heading button { min-width: 44px; min-height: 44px; }

/* Delete confirm: centred, icon on top, danger only on the button */
/* (.pay-dialog also carries .history-confirm-dialog, so it is excluded here) */
html.ui-v2 .studio-layout .history-confirm-dialog:not(.pay-dialog) { width: min(340px, calc(100vw - 40px)); padding: 24px 20px 20px; text-align: center; }
html.ui-v2 .studio-layout .history-confirm-mark { width: 48px; height: 48px; margin: 0 auto 12px; border: 0; border-radius: 50%; background: rgba(255, 109, 122, .12); color: var(--v2-danger-text); }
html.ui-v2 .studio-layout .history-confirm-copy small { display: none; }
html.ui-v2 .studio-layout .history-confirm-copy p { margin-top: 8px; color: var(--v2-muted); line-height: 1.6; }
html.ui-v2 .studio-layout .history-confirm-actions { margin-top: 20px; gap: 10px; }
html.ui-v2 .studio-layout .history-confirm-actions .outline-button { border-color: var(--v2-line); background: transparent; }

/* Private-space PIN: one big centred field, the phone opens its number pad */
html.ui-v2 .studio-layout .private-space-dialog { text-align: center; }
html.ui-v2 .studio-layout .private-dialog-heading { justify-content: center; margin-bottom: 18px; }
html.ui-v2 .studio-layout .private-dialog-heading::before { content: ""; }
html.ui-v2 .studio-layout .private-space-dialog label > span { display: block; margin-bottom: 8px; font-size: 13px; }
html.ui-v2 .studio-layout .private-space-dialog #privatePinUnlock,
html.ui-v2 .studio-layout .private-space-dialog #privatePinSetup,
html.ui-v2 .studio-layout .private-space-dialog #privatePinSetupConfirm { height: 60px; text-align: center; font-size: 28px; letter-spacing: .6em; padding-left: .6em; border-radius: 12px; }
html.ui-v2 .studio-layout .private-dialog-actions { margin-top: 16px; }

/* Payment: amount first, QR second, steps, then actions */
html.ui-v2 .pay-dialog { text-align: left; }
html.ui-v2 .pay-dialog-head { padding-right: 40px; text-align: left; }
html.ui-v2 .pay-waiting > .pay-amount-label,
html.ui-v2 .pay-waiting > .pay-note,
html.ui-v2 .pay-waiting > .pay-status-line { text-align: left; }
html.ui-v2 .pay-dialog-head h2 { margin-bottom: 12px; }
html.ui-v2 .pay-waiting { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
html.ui-v2 .pay-waiting > .pay-amount-label { order: 1; margin: 0; font-size: 13px; color: var(--v2-muted); }
html.ui-v2 .pay-waiting > .pay-amount { order: 2; width: 100%; justify-items: start; padding: 14px 16px; border-radius: 16px; border-color: var(--v2-accent); background: rgba(216, 255, 79, .06); text-align: left; }
html.ui-v2 .pay-amount b { font-size: 40px; }
html.ui-v2 .pay-waiting > .pay-note { order: 3; }
html.ui-v2 .pay-waiting > .pay-qr { order: 4; align-self: center; width: min(200px, 56vw); }
html.ui-v2 .pay-waiting > .pay-qr-save { order: 5; align-self: center; min-height: 40px; display: inline-flex; align-items: center; padding: 0 16px; border: 1px solid var(--v2-line); border-radius: 10px; color: var(--v2-text); text-decoration: none; font-size: 13px; }
html.ui-v2 .pay-waiting > .pay-steps { order: 6; margin: 4px 0 0; padding: 12px 14px 12px 32px; border-radius: 12px; background: var(--v2-bg); font-size: 14px; line-height: 1.6; }
html.ui-v2 .pay-waiting > .pay-status-line { order: 7; }
html.ui-v2 .pay-waiting > .pay-meta { order: 8; justify-content: flex-start; }
html.ui-v2 .pay-waiting > .pay-actions { order: 9; grid-template-columns: 1fr 2fr; }
html.ui-v2 .pay-actions .outline-button { border-color: var(--v2-line); background: transparent; }

/* Work actions: a list of rows with Cancel apart */
html.ui-v2 .studio-layout .history-item-action-heading { margin-bottom: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--v2-line); }
html.ui-v2 .studio-layout .history-item-action-buttons { display: flex; flex-direction: column; gap: 2px; }
html.ui-v2 .studio-layout .history-item-action-buttons button { min-height: 52px; justify-content: flex-start; text-align: left; padding: 0 12px; border: 0; border-radius: 12px; background: transparent; color: var(--v2-text); font-size: 15px; font-weight: 400; }
html.ui-v2 .studio-layout .history-item-action-buttons button:hover { background: var(--v2-raised); }
html.ui-v2 .studio-layout .history-item-action-buttons .secondary-button { color: var(--v2-text); background: transparent; border: 0; }
html.ui-v2 .studio-layout .history-item-action-buttons .history-delete-button { color: var(--v2-danger-text); }
html.ui-v2 .studio-layout .history-item-action-buttons .text-button { order: 9; margin-top: 8px; justify-content: center; text-align: center; background: var(--v2-raised); color: var(--v2-text); font-weight: 600; }

/* Settings sheet: steadier header */
html.ui-v2 .studio-layout .studio-panel-heading { min-height: 48px; align-items: center; }
html.ui-v2 .studio-layout .studio-panel-footer .secondary-button { min-height: 48px; border-radius: 12px; font-size: 15px; }

/* Phone: choose/fill dialogs slide up from the bottom */
@keyframes v2SheetIn { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (max-width: 619px) {
  html.ui-v2 .studio-layout .history-item-action-dialog,
  html.ui-v2 .studio-layout .private-space-dialog,
  html.ui-v2 .studio-layout .pay-dialog {
    position: fixed; inset: auto 0 0 0; margin: 0;
    width: 100%; max-width: none;
    max-height: calc(100dvh - 12px); overflow-y: auto;
    padding: 22px 20px calc(20px + var(--v2-safe-b));
    border-bottom: 0; border-radius: 24px 24px 0 0;
    animation: v2SheetIn .24s cubic-bezier(.2, .8, .2, 1) both;
  }
  html.ui-v2 .studio-layout .history-item-action-dialog::before,
  html.ui-v2 .studio-layout .private-space-dialog::before,
  html.ui-v2 .studio-layout .pay-dialog::before {
    content: ""; display: block; position: absolute; top: 8px; left: 50%;
    width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--v2-line-strong);
  }
  html.ui-v2 .studio-layout .pay-dialog { height: calc(100dvh - 12px); }
  html.ui-v2 .pay-waiting > .pay-actions { position: sticky; bottom: calc(-20px - var(--v2-safe-b)); margin: 4px -20px calc(-20px - var(--v2-safe-b)); padding: 12px 20px calc(16px + var(--v2-safe-b)); background: var(--v2-surface); border-top: 1px solid var(--v2-line); }
  html.ui-v2 .studio-layout .private-space-dialog { padding-top: 32px; padding-bottom: calc(24px + var(--v2-safe-b)); }
  html.ui-v2 .studio-layout .studio-panel-dialog { border-radius: 24px 24px 0 0; }
}

/* Desktop: payment in two columns */
@media (min-width: 900px) {
  html.ui-v2 .studio-layout .pay-dialog.history-confirm-dialog { width: min(720px, calc(100vw - 48px)); max-width: none; padding: 24px 28px; }
  html.ui-v2 .pay-waiting { display: grid; grid-template-columns: 220px minmax(0, 1fr); grid-auto-flow: dense; column-gap: 28px; row-gap: 12px; align-items: start; justify-items: stretch; }
  html.ui-v2 .pay-waiting > * { grid-column: 2; }
  html.ui-v2 .pay-waiting > .pay-qr { grid-column: 1; grid-row: 1 / span 4; width: 220px; }
  html.ui-v2 .pay-waiting > .pay-qr-save { grid-column: 1; grid-row: 5; justify-self: center; }
}

/* ---------------------------------------------------------------- 3 phone shell & create page */
@media (max-width: 619px) {
  /* Bottom navigation: the old glass capsule that slides between tabs,
     now inside a bar docked to the bottom edge (full width, safe-area aware). */
  html.ui-v2 .studio-layout:not(.auth-mode) #mobileNav:not(.hidden) {
    left: 0; right: 0; bottom: 0; width: 100%; transform: none;
    min-height: 0; height: calc(var(--v2-nav-h) + var(--v2-safe-b));
    padding: 0 8px var(--v2-safe-b); gap: 0;
    border: 0; border-top: 1px solid rgba(242, 248, 246, .12); border-radius: 0;
    /* near-opaque instead of a live blur: same look, much cheaper while scrolling */
    background: linear-gradient(180deg, rgba(30, 37, 42, .97), rgba(13, 17, 21, .99));
    box-shadow: 0 -12px 32px rgba(0, 0, 0, .28);
    -webkit-backdrop-filter: none; backdrop-filter: none;
    contain: layout paint;
  }
  /* soft highlight along the top edge, as on the old capsule */
  html.ui-v2 .studio-layout:not(.auth-mode) .mobile-nav::after { display: block; left: 18%; right: 18%; top: -1px; opacity: .55; }
  /* the sliding capsule: one slot wide, drawn inset by ::before */
  html.ui-v2 .studio-layout:not(.auth-mode) .mobile-nav-indicator {
    display: block; left: 8px; top: 6px; bottom: auto; height: calc(var(--v2-nav-h) - 12px);
    width: calc((100% - 16px) / 4);
    border: 0; border-radius: 0; background: none; box-shadow: none;
    transform: translate3d(0, 0, 0); will-change: transform;
    transition: transform .52s cubic-bezier(.22, 1.22, .36, 1);
  }
  html.ui-v2 .studio-layout:not(.auth-mode) #mobileNav[data-active-tab="works"] .mobile-nav-indicator { transform: translate3d(100%, 0, 0); }
  html.ui-v2 .studio-layout:not(.auth-mode) #mobileNav[data-active-tab="tools"] .mobile-nav-indicator { transform: translate3d(200%, 0, 0); }
  html.ui-v2 .studio-layout:not(.auth-mode) #mobileNav[data-active-tab="account"] .mobile-nav-indicator { transform: translate3d(300%, 0, 0); }
  html.ui-v2 .studio-layout:not(.auth-mode) .mobile-nav-indicator::before {
    content: ""; position: absolute; inset: 0 6px;
    border: 1px solid rgba(239, 255, 192, .2); border-radius: 18px;
    background: radial-gradient(circle at 50% 0%, rgba(239, 255, 194, .2), transparent 62%), linear-gradient(145deg, rgba(216, 255, 79, .15), rgba(216, 255, 79, .05));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 6px 18px rgba(0, 0, 0, .22);
  }
  html.ui-v2 .studio-layout:not(.auth-mode) .mobile-nav-item {
    min-height: var(--v2-nav-h); gap: 4px; border: 0; border-radius: 18px; background: transparent; color: #7f8b95;
    -webkit-tap-highlight-color: transparent;
    transition: color .3s ease, transform .26s cubic-bezier(.2, 1.3, .3, 1);
  }
  html.ui-v2 .studio-layout:not(.auth-mode) .mobile-nav-item:active { transform: scale(.92); transition-duration: 90ms; }
  html.ui-v2 .studio-layout:not(.auth-mode) .mobile-nav-item svg { width: 22px; height: 22px; transition: transform .38s cubic-bezier(.2, 1.35, .3, 1), filter .3s ease; }
  html.ui-v2 .studio-layout:not(.auth-mode) .mobile-nav-item span { font-size: 12px; font-weight: 500; transition: color .3s ease; }
  html.ui-v2 .studio-layout:not(.auth-mode) .mobile-nav-item.active { color: var(--v2-accent); background: transparent; }
  html.ui-v2 .studio-layout:not(.auth-mode) .mobile-nav-item.active span { font-weight: 700; }
  html.ui-v2 .studio-layout:not(.auth-mode) .mobile-nav-item.active svg { transform: translateY(-1px) scale(1.08); filter: drop-shadow(0 0 7px rgba(216, 255, 79, .34)); }
  html.ui-v2 .studio-layout:not(.auth-mode) .mobile-nav-item.nav-item-popping svg { animation: mobileNavIconPop .42s cubic-bezier(.2, 1.35, .3, 1); }

  /* Page frame: 16px gutters, room for nav (+ generate bar on the create page) */
  html.ui-v2 .studio-layout:not(.auth-mode) .shell { padding: max(8px, env(safe-area-inset-top)) 16px calc(var(--v2-nav-h) + var(--v2-safe-b) + 24px); }
  html.ui-v2 .studio-layout:not(.auth-mode):not(.history-page-open):not(.account-page-open):not(.tools-page-open):not(.private-space-page-open) .shell { padding-bottom: calc(var(--v2-nav-h) + var(--v2-bar-h) + var(--v2-safe-b) + 24px); }
  html.ui-v2 .studio-layout:not(.auth-mode) .topbar { min-height: 56px; margin-bottom: 4px; }
  html.ui-v2 .studio-layout:not(.auth-mode) .topbar h1 { font-size: 20px; }
  html.ui-v2 .studio-layout:not(.auth-mode) .status-pill { min-height: 36px; padding: 0 12px 0 5px; font-size: 13px; font-weight: 600; border-radius: 999px; }
  html.ui-v2 .studio-layout .studio-intro { display: none; }

  /* Composer */
  html.ui-v2 .studio-layout .studio-composer { padding: 0; border: 0; background: transparent; box-shadow: none; }
  html.ui-v2 .studio-layout .studio-mode-tabs { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding: 4px; margin-bottom: 12px; border: 1px solid var(--v2-line); border-radius: 12px; background: var(--v2-surface); }
  html.ui-v2 .studio-layout .studio-mode-tabs button { min-height: 38px; font-size: 14px; }
  html.ui-v2 .studio-layout #studioPromptSlot .hero-card { padding: 12px 14px 0; border: 1px solid var(--v2-line); border-radius: 16px; background: var(--v2-surface); }
  html.ui-v2 .studio-layout #studioPromptSlot .card-heading h2 { font-size: 13px; font-weight: 500; color: var(--v2-muted); }
  html.ui-v2 .studio-layout .studio-composer textarea { font-size: 15px; }
  html.ui-v2 .studio-layout .studio-composer .prompt-actions { display: flex; align-items: center; justify-content: space-between; margin: 0 -14px; padding: 0 6px 0 14px; border-top: 1px solid var(--v2-line); }
  html.ui-v2 .studio-layout .studio-composer .prompt-actions .counter { font-size: 12px; color: var(--v2-muted); }
  html.ui-v2 .studio-layout .studio-composer .prompt-actions .text-button { font-size: 13px; color: var(--v2-muted); }

  /* Model + size as two equal tiles, helpers as pill chips */
  html.ui-v2 .studio-layout .studio-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
  html.ui-v2 .studio-layout #studioModelSlot { order: 1; flex: 1 1 calc(50% - 4px); min-width: 0; }
  html.ui-v2 .studio-layout #studioParametersButton { order: 2; flex: 1 1 calc(50% - 4px); }
  html.ui-v2 .studio-layout #studioPresetsButton { order: 3; }
  html.ui-v2 .studio-layout #studioTranslationButton { order: 4; }
  html.ui-v2 .studio-layout #studioRefineButton { order: 5; }
  html.ui-v2 .studio-layout .glass-picker-trigger,
  html.ui-v2 .studio-layout #studioParametersButton { min-height: 52px; padding: 0 14px; border: 1px solid var(--v2-line); border-radius: 12px; background: var(--v2-surface); color: var(--v2-text); font-size: 14px; font-weight: 600; text-align: left; justify-content: space-between; }
  html.ui-v2 .studio-layout #studioPresetsButton,
  html.ui-v2 .studio-layout #studioTranslationButton,
  html.ui-v2 .studio-layout #studioRefineButton { min-height: 36px; padding: 0 14px; border: 1px solid var(--v2-line); border-radius: 999px; background: transparent; color: var(--v2-text); font-size: 13px; }

  /* Generate bar: fixed above the nav on the create page, always reachable */
  html.ui-v2 .studio-layout:not(.auth-mode) .studio-submit-row {
    position: fixed; z-index: 23; left: 0; right: 0;
    bottom: calc(var(--v2-nav-h) + var(--v2-safe-b));
    min-height: var(--v2-bar-h); margin: 0; padding: 10px 16px;
    display: flex; align-items: center; gap: 12px;
    border-top: 1px solid var(--v2-line); background: var(--v2-bg);
  }
  html.ui-v2 .studio-layout.history-page-open .studio-submit-row,
  html.ui-v2 .studio-layout.account-page-open .studio-submit-row,
  html.ui-v2 .studio-layout.tools-page-open .studio-submit-row,
  html.ui-v2 .studio-layout.private-space-page-open .studio-submit-row { display: none; }
  html.ui-v2 .studio-layout.keyboard-open .studio-submit-row { bottom: var(--studio-viewport-bottom, 0px); }
  html.ui-v2 .studio-layout #studioSubmitMeta { flex: 1 1 auto; min-width: 0; }
  html.ui-v2 .studio-layout #studioSubmitMeta small { display: block; font-size: 12px; color: var(--v2-muted); }
  html.ui-v2 .studio-layout #studioEstimate { font-size: 14px; font-weight: 600; color: var(--v2-text); }
  html.ui-v2 .studio-layout .generate-button { min-height: 52px; padding: 0 22px; border-radius: 12px; font-size: 16px; }

  /* Results and recent works */
  html.ui-v2 .studio-layout .studio-result-empty > div { min-height: 112px; border-radius: 16px; }
  html.ui-v2 .studio-layout .results-heading h2,
  html.ui-v2 .studio-layout .history-section .results-heading h2 { font-size: 16px; font-weight: 600; }
  html.ui-v2 .studio-layout #historyList { gap: 8px; }
  html.ui-v2 .studio-layout .history-batch-actions { bottom: calc(var(--v2-nav-h) + var(--v2-safe-b) + 12px); }
  html.ui-v2 .studio-layout .job-card { border-radius: 16px; }
}

/* ---------------------------------------------------------------- 4 phone works / tools / account */
@media (max-width: 619px) {
  html.ui-v2 .studio-layout .account-page-heading { min-height: 48px; margin-bottom: 12px; align-items: center; }
  html.ui-v2 .studio-layout .account-page-heading h2 { font-size: 22px; font-weight: 600; }
  html.ui-v2 .studio-layout .account-page-heading small { display: none; }
  html.ui-v2 .studio-layout .account-back-button { display: none; }
  html.ui-v2 .studio-layout .history-page-actions button { min-height: 40px; font-size: 14px; }

  /* Works: flat grid, no card around it */
  html.ui-v2 .studio-layout .history-library-card { padding: 0; border: 0; background: transparent; box-shadow: none; }
  html.ui-v2 .studio-layout .history-library-grid { gap: 8px; }
  html.ui-v2 .studio-layout .history-library-item { border-radius: 12px; border-color: var(--v2-line); background: var(--v2-surface); }
  html.ui-v2 .studio-layout .history-library-copy b { font-size: 13px; }

  /* Tools: list rows */
  html.ui-v2 .studio-layout .tools-grid { gap: 8px; }
  html.ui-v2 .studio-layout .tool-entry { min-height: 72px; border-radius: 16px; }
  html.ui-v2 .studio-layout .tool-entry b { font-size: 15px; }
  html.ui-v2 .studio-layout .tool-entry small { font-size: 13px; }

  /* Account: identity, balance, then settings */
  html.ui-v2 .studio-layout .account-profile-card,
  html.ui-v2 .studio-layout .account-security-card { padding: 16px; border-radius: 16px; border-color: var(--v2-line); background: var(--v2-surface); }
  html.ui-v2 .studio-layout .profile-avatar { width: 56px; height: 56px; border-radius: 50%; }
  html.ui-v2 .studio-layout #profileAvatarFallback { font-size: 22px; }
  html.ui-v2 .studio-layout .credit-balance-card { border-color: var(--v2-line); background: var(--v2-bg); border-radius: 14px; }
  html.ui-v2 .studio-layout #profileCredits { font-size: 34px; font-family: Inter, system-ui, sans-serif; color: var(--v2-text); }
  html.ui-v2 .studio-layout .pay-panel { border-color: var(--v2-line); background: var(--v2-bg); border-radius: 14px; }
  html.ui-v2 .studio-layout .pay-tiers button { border-radius: 12px; }
  html.ui-v2 .studio-layout .account-form input { min-height: 48px; font-size: 16px; }
  html.ui-v2 .studio-layout .account-form .secondary-button { min-height: 48px; }
  html.ui-v2 .studio-layout .security-tabs button { min-height: 40px; font-size: 14px; }
  html.ui-v2 .studio-layout .account-legal-links { font-size: 13px; }
}

/* ---------------------------------------------------------------- 4b account page (all widths; layout built by ui-v2.js) */
html.ui-v2 #accountView .account-page-heading .mobile-account-actions { display: none; }
html.ui-v2 #accountView .v2-account,
html.ui-v2 #accountView .account-page-heading { width: 100%; max-width: 640px; margin-inline: auto; }
html.ui-v2 #accountView .account-grid.v2-retired { display: none !important; }
html.ui-v2 .v2-account { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
html.ui-v2 .v2-account > * { min-width: 0; }
html.ui-v2 .v2-row-label { min-width: 0; }
html.ui-v2 .v2-account-profile { display: flex; align-items: center; gap: 14px; }
html.ui-v2 .v2-account-profile .profile-avatar { flex: none; width: 56px; height: 56px; border-radius: 50%; }
html.ui-v2 .v2-account-profile #profileAvatarFallback { font-size: 22px; }
html.ui-v2 .v2-account-profile .profile-avatar i { font-size: 11px; }
html.ui-v2 .v2-account-profile .profile-copy { flex: 1 1 auto; min-width: 0; }
html.ui-v2 .v2-account-profile .profile-copy small { display: none; }
html.ui-v2 .v2-account-profile .profile-copy h2 { margin: 0; font-size: 18px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.ui-v2 .v2-account-profile .profile-copy p { margin: 2px 0 0; font-size: 13px; color: var(--v2-muted); }

html.ui-v2 .v2-pill-button,
html.ui-v2 .v2-outline-button,
html.ui-v2 .v2-primary-button,
html.ui-v2 .v2-logout-button { display: inline-flex; align-items: center; justify-content: center; text-align: center; font: inherit; cursor: pointer; }
html.ui-v2 .v2-pill-button { flex: none; min-height: 36px; padding: 0 14px; border: 1px solid var(--v2-line); border-radius: 10px; background: transparent; color: var(--v2-text); font-size: 13px; }
html.ui-v2 .v2-primary-button { min-height: 46px; border: 0; border-radius: 12px; background: var(--v2-accent); color: var(--v2-accent-ink); font-size: 15px; font-weight: 700; }
html.ui-v2 .v2-outline-button { min-height: 46px; border: 1px solid var(--v2-line); border-radius: 12px; background: transparent; color: var(--v2-text); font-size: 15px; }
html.ui-v2 .v2-primary-button[hidden] { display: none; }

html.ui-v2 .v2-account-balance { display: flex; flex-direction: column; gap: 14px; padding: 18px 16px; border: 1px solid var(--v2-line); border-radius: 16px; background: var(--v2-surface); }
html.ui-v2 .v2-account-balance .credit-balance-card { min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; display: flex; align-items: flex-end; justify-content: space-between; }
html.ui-v2 .v2-account-balance .credit-balance-card::before,
html.ui-v2 .v2-account-balance .credit-balance-card::after { display: none; }
html.ui-v2 .v2-account-balance .credit-balance-card span { display: flex; flex-direction: column; gap: 4px; }
html.ui-v2 .v2-account-balance .credit-balance-card small { font-size: 13px; color: var(--v2-muted); }
html.ui-v2 .v2-account-balance #profileCredits { font: 700 34px/1 Inter, system-ui, sans-serif; color: var(--v2-text); }
html.ui-v2 .v2-account-balance .credit-balance-card i { color: var(--v2-accent); font-style: normal; font-size: 20px; }
html.ui-v2 .v2-account-balance .credit-expiry-notice { margin: -4px 0 0; font-size: 13px; color: #ffcf7a; }
html.ui-v2 .v2-balance-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
html.ui-v2 .v2-account-balance.v2-no-pay .v2-balance-actions { grid-template-columns: 1fr; }
html.ui-v2 .v2-account-balance.v2-no-pay .v2-outline-button { border: 0; background: var(--v2-accent); color: var(--v2-accent-ink); font-weight: 700; }

html.ui-v2 .v2-account-list { display: flex; flex-direction: column; border: 1px solid var(--v2-line); border-radius: 16px; background: var(--v2-surface); overflow: hidden; }
html.ui-v2 .v2-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 14px; border: 0; border-top: 1px solid var(--v2-line); background: transparent; color: var(--v2-text); font: inherit; text-align: left; cursor: pointer; }
html.ui-v2 .v2-row:first-child { border-top: 0; }
html.ui-v2 .v2-row[hidden] { display: none; }
html.ui-v2 .v2-row:hover { background: var(--v2-raised); }
html.ui-v2 .v2-row-icon { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: var(--v2-raised); color: var(--v2-accent); }
html.ui-v2 .v2-row-icon svg,
html.ui-v2 .v2-row-chevron svg,
html.ui-v2 .v2-sheet-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
html.ui-v2 .v2-row-label { flex: 1 1 auto; font-size: 15px; }
html.ui-v2 .v2-row-meta { flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--v2-muted); }
html.ui-v2 .v2-row-chevron { flex: none; display: flex; color: var(--v2-muted); }

html.ui-v2 .v2-account .account-legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin: 0; font-size: 13px; }
html.ui-v2 .v2-account .account-legal-links a { color: var(--v2-muted); }
html.ui-v2 .v2-logout-button { min-height: 48px; border: 1px solid var(--v2-line); border-radius: 12px; background: transparent; color: var(--v2-danger-text); font-size: 15px; }

/* Invite a friend (built by referral.js) */
html.ui-v2 .v2-invite-card { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 0 14px; border: 1px solid rgba(216, 255, 79, .28); border-radius: 16px; background: linear-gradient(135deg, rgba(216, 255, 79, .1), rgba(216, 255, 79, .03)); color: var(--v2-text); font: inherit; text-align: left; cursor: pointer; transition: transform .18s cubic-bezier(.2, 1.3, .3, 1), border-color .2s ease; }
html.ui-v2 .v2-invite-card[hidden] { display: none; }
html.ui-v2 .v2-invite-card:active { transform: scale(.98); }
html.ui-v2 .v2-invite-card .v2-row-icon { width: 36px; height: 36px; background: rgba(216, 255, 79, .14); }
html.ui-v2 .v2-invite-card-copy { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
html.ui-v2 .v2-invite-card-copy b { font-size: 15px; font-weight: 600; }
html.ui-v2 .v2-invite-card-sub { font-size: 12px; color: var(--v2-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.ui-v2 .v2-invite-card-cta { flex: none; display: inline-flex; align-items: center; min-height: 32px; padding: 0 14px; border-radius: 999px; background: var(--v2-accent); color: var(--v2-accent-ink); font-size: 13px; font-weight: 700; }

html.ui-v2 #v2InviteSheet .v2-sheet-body { display: flex; flex-direction: column; gap: 16px; }
html.ui-v2 .v2-invite-hero { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 14px; background: linear-gradient(135deg, rgba(216, 255, 79, .12), rgba(216, 255, 79, .03)); border: 1px solid rgba(216, 255, 79, .22); }
html.ui-v2 .v2-invite-hero b { font-size: 16px; font-weight: 600; line-height: 1.45; }
html.ui-v2 .v2-invite-hero small { font-size: 13px; color: var(--v2-muted); }
html.ui-v2 .v2-invite-hero em { font-style: normal; color: var(--v2-accent); font-weight: 700; }
html.ui-v2 .v2-invite-link { display: flex; flex-direction: column; gap: 6px; }
html.ui-v2 .v2-invite-link span { font-size: 13px; color: var(--v2-muted); }
html.ui-v2 .v2-invite-link input { width: 100%; min-height: 46px; box-sizing: border-box; padding: 0 12px; border: 1px solid var(--v2-line); border-radius: 12px; background: var(--v2-bg); color: var(--v2-text); font: 14px/1 Inter, system-ui, sans-serif; }
html.ui-v2 .v2-invite-actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
html.ui-v2 .v2-invite-progress { display: flex; flex-direction: column; gap: 8px; }
html.ui-v2 .v2-invite-progress-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
html.ui-v2 .v2-invite-progress-head b { font: 700 16px/1 Inter, system-ui, sans-serif; }
html.ui-v2 .v2-invite-track { height: 8px; border-radius: 4px; background: var(--v2-raised); overflow: hidden; }
html.ui-v2 .v2-invite-track i { display: block; height: 100%; border-radius: inherit; background: var(--v2-accent); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
html.ui-v2 .v2-invite-progress small { font-size: 12px; color: var(--v2-muted); }
html.ui-v2 .v2-invite-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
html.ui-v2 .v2-invite-stats div { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border-radius: 12px; background: var(--v2-bg); border: 1px solid var(--v2-line); }
html.ui-v2 .v2-invite-stats b { font: 700 18px/1 Inter, system-ui, sans-serif; }
html.ui-v2 .v2-invite-stats small { font-size: 12px; color: var(--v2-muted); }
html.ui-v2 .v2-invite-subtitle { margin: 4px 0 -6px; font-size: 14px; font-weight: 600; }
html.ui-v2 .v2-invite-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; border: 1px solid var(--v2-line); border-radius: 12px; overflow: hidden; }
html.ui-v2 .v2-invite-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 0 12px; border-top: 1px solid var(--v2-line); }
html.ui-v2 .v2-invite-list li:first-child { border-top: 0; }
html.ui-v2 .v2-invite-list .v2-invite-empty { justify-content: center; font-size: 13px; color: var(--v2-muted); }
html.ui-v2 .v2-invite-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
html.ui-v2 .v2-invite-who b { font-size: 14px; font-weight: 500; }
html.ui-v2 .v2-invite-who small { font-size: 12px; color: var(--v2-muted); }
html.ui-v2 .v2-invite-badge { flex: none; display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 6px; font-size: 12px; background: var(--v2-raised); color: var(--v2-muted); }
html.ui-v2 .v2-invite-badge.is-rewarded { background: rgba(216, 255, 79, .12); color: var(--v2-accent); font-weight: 700; }
html.ui-v2 .v2-invite-badge.is-rejected { background: rgba(255, 109, 122, .1); color: var(--v2-danger-text); }
html.ui-v2 .v2-invite-rules { border: 1px solid var(--v2-line); border-radius: 12px; padding: 0 12px; }
html.ui-v2 .v2-invite-rules summary { min-height: 44px; display: flex; align-items: center; font-size: 13px; color: var(--v2-muted); cursor: pointer; }
html.ui-v2 .v2-invite-rules ul { margin: 0 0 12px; padding-left: 18px; font-size: 13px; line-height: 1.6; color: var(--v2-muted); }
/* Sign-up card banner for invited visitors */
html.ui-v2 .v2-invite-banner { display: flex; flex-direction: column; gap: 2px; margin: 0 0 12px; padding: 10px 12px; border: 1px solid rgba(216, 255, 79, .3); border-radius: 12px; background: rgba(216, 255, 79, .08); text-align: left; }
html.ui-v2 .v2-invite-banner b { font-size: 14px; color: var(--v2-accent); }
html.ui-v2 .v2-invite-banner span { font-size: 13px; color: var(--v2-text); }

/* Small sheets (same surface as every other dialog) */
html.ui-v2 .v2-sheet { width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--v2-line); border-radius: 20px; background: var(--v2-surface); color: var(--v2-text); box-shadow: 0 24px 72px rgba(0, 0, 0, .55); overflow: hidden; }
html.ui-v2 .v2-sheet[open] { display: flex; flex-direction: column; }
html.ui-v2 .v2-sheet::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(2px); }
html.ui-v2 .v2-sheet-head { flex: none; display: flex; align-items: center; justify-content: space-between; min-height: 56px; padding: 0 8px 0 20px; border-bottom: 1px solid var(--v2-line); }
html.ui-v2 .v2-sheet-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
html.ui-v2 .v2-sheet-close { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--v2-muted); cursor: pointer; }
html.ui-v2 .v2-sheet-body { overflow-y: auto; padding: 16px 20px calc(20px + var(--v2-safe-b)); }
/* The moved blocks lose their own card chrome inside a sheet. */
html.ui-v2 .v2-sheet-body > .pay-panel,
html.ui-v2 .v2-sheet-body > .account-security-card { margin: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
html.ui-v2 .v2-sheet-body > .account-security-card .account-section-heading { display: none; }
html.ui-v2 .v2-sheet-body > .pay-panel .pay-panel-head b { display: none; }
html.ui-v2 .v2-sheet-body .account-form { margin: 0; }
html.ui-v2 .v2-sheet-body .account-form input { min-height: 48px; font-size: 16px; border-radius: 12px; }
html.ui-v2 .v2-sheet-body .account-form .secondary-button { min-height: 48px; border: 0; border-radius: 12px; background: var(--v2-accent); color: var(--v2-accent-ink); box-shadow: none; font-size: 15px; font-weight: 700; }
html.ui-v2 .v2-sheet-body .account-form .secondary-button:disabled { opacity: .55; }
html.ui-v2 .v2-sheet-body .security-subheading { display: none; }
/* With email features off only one security tab is left: drop the tab bar. */
html.ui-v2 .v2-sheet-body .security-tabs:not(:has(> button:not(.hidden) ~ button:not(.hidden))) { display: none; }
html.ui-v2 .v2-sheet-body .security-tabs { margin-bottom: 14px; }
html.ui-v2 .v2-sheet-body .credit-ledger { padding: 0; }
html.ui-v2 .v2-sheet-body .ledger-copy small,
html.ui-v2 .v2-sheet-body .ledger-amount small { font-size: 12px; }
@media (max-width: 619px) {
  html.ui-v2 .v2-sheet { position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: none; max-height: calc(100dvh - 12px); border-bottom: 0; border-radius: 24px 24px 0 0; animation: v2SheetIn .24s cubic-bezier(.2, .8, .2, 1) both; }
  html.ui-v2 .v2-sheet-head { padding-top: 6px; }
  html.ui-v2 .v2-sheet::before { content: ""; position: absolute; top: 8px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--v2-line-strong); }
}

/* ---------------------------------------------------------------- 5 phone sign-in: form on the first screen */
@media (max-width: 619px) {
  html.ui-v2 body.auth-mode .topbar { flex-direction: row; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
  html.ui-v2 body.auth-mode .topbar h1 { font-size: 26px; }
  html.ui-v2 body.auth-mode .auth-crosslink { display: none; }
  html.ui-v2 body.auth-mode .showcase-subtitle,
  html.ui-v2 body.auth-mode .showcase-features,
  html.ui-v2 body.auth-mode .showcase-lede { display: none; }
  html.ui-v2 body.auth-mode .auth-intro { margin: 4px 0 14px; text-align: left; }
  html.ui-v2 body.auth-mode .showcase-kicker { display: none; }
  html.ui-v2 body.auth-mode .showcase-title { font-size: 22px; line-height: 1.35; text-align: left; }
  html.ui-v2 body.auth-mode .auth-card { padding: 18px 16px 20px; }
  /* The sign-in animation flies this mark to the centre, so it must stay on the
     page (hidden, it would start from the top-left corner). Kept, just smaller. */
  html.ui-v2 body.auth-mode .auth-mark { width: 52px; height: 52px; margin: 0 auto 12px; }
  html.ui-v2 body.auth-mode .auth-card-brand,
  html.ui-v2 body.auth-mode .auth-card .card-heading,
  html.ui-v2 body.auth-mode .auth-copy { display: none; }
  html.ui-v2 body.auth-mode .auth-tabs { margin-bottom: 14px; }
  html.ui-v2 body.auth-mode .auth-row input:not([type="checkbox"]) { min-height: 50px; font-size: 16px; }
  html.ui-v2 body.auth-mode .auth-notice { margin: 4px 0; }
  html.ui-v2 body.auth-mode .auth-consent { font-size: 13px; line-height: 1.55; }
  html.ui-v2 body.auth-mode #loginButton,
  html.ui-v2 body.auth-mode .auth-submit { min-height: 52px; font-size: 16px; }
}

/* ---------------------------------------------------------------- 5b sign-in animation: same look, smoother
   The old animation is unchanged in shape and timing. Only how it is drawn changes:
   - the overlay dimmed by animating background-color (a full-screen repaint every
     frame); here the same colour sits on a layer whose opacity animates instead;
   - the scenery behind it gets its own compositor layer, so its scale-out is free;
   - blurred glass under the overlay stops re-blurring every frame while it is covered. */
html.ui-v2 .login-transition,
html.ui-v2 .login-transition.is-centered,
html.ui-v2 .login-transition.is-revealing { background: transparent; }
html.ui-v2 .login-transition::after {
  content: ""; position: absolute; z-index: -1; inset: 0;
  background: rgb(4, 7, 10); opacity: 0; will-change: opacity;
  transition: opacity .34s ease .5s;
}
html.ui-v2 .login-transition.is-centered::after { opacity: .68; }
html.ui-v2 .login-transition.is-revealing::after { opacity: 0; transition: opacity .78s cubic-bezier(.22, .72, .24, 1); }
html.ui-v2 body.auth-mode .login-fx { will-change: opacity, transform; }
html.ui-v2 .login-transitioning .auth-card,
html.ui-v2 .login-transitioning .auth-showcase,
html.ui-v2 .login-transitioning .auth-crosslink,
html.ui-v2 .login-transitioning .lang-toggle { -webkit-backdrop-filter: none; backdrop-filter: none; }

/* ---------------------------------------------------------------- 5c dialog motion
   Open and close both animate (the old dialogs only animated in, and closed with a
   jump). Pure CSS via @starting-style + allow-discrete: no script changes what
   dialog.open means, and browsers without support simply open and close at once. */
html.ui-v2 .studio-layout .history-item-action-dialog,
html.ui-v2 .studio-layout .private-space-dialog,
html.ui-v2 .studio-layout .history-confirm-dialog:not(.pay-dialog),
html.ui-v2 .studio-layout .studio-panel-dialog,
html.ui-v2 .v2-sheet {
  animation: none;
  opacity: 0; transform: translateY(12px) scale(.97);
  transition: opacity .2s ease, transform .2s ease, overlay .2s allow-discrete, display .2s allow-discrete;
}
html.ui-v2 .studio-layout .history-item-action-dialog[open],
html.ui-v2 .studio-layout .private-space-dialog[open],
html.ui-v2 .studio-layout .history-confirm-dialog:not(.pay-dialog)[open],
html.ui-v2 .studio-layout .studio-panel-dialog[open],
html.ui-v2 .v2-sheet[open] {
  opacity: 1; transform: none;
  transition: opacity .26s ease, transform .34s cubic-bezier(.2, .9, .25, 1.05), overlay .34s allow-discrete, display .34s allow-discrete;
}
@starting-style {
  html.ui-v2 .studio-layout .history-item-action-dialog[open],
  html.ui-v2 .studio-layout .private-space-dialog[open],
  html.ui-v2 .studio-layout .history-confirm-dialog:not(.pay-dialog)[open],
  html.ui-v2 .studio-layout .studio-panel-dialog[open],
  html.ui-v2 .v2-sheet[open] { opacity: 0; transform: translateY(12px) scale(.97); }
}
html.ui-v2 .studio-layout dialog::backdrop,
html.ui-v2 .v2-sheet::backdrop { transition: background-color .26s ease, backdrop-filter .26s ease, overlay .26s allow-discrete, display .26s allow-discrete; }
@starting-style {
  html.ui-v2 .studio-layout dialog[open]::backdrop,
  html.ui-v2 .v2-sheet[open]::backdrop { background-color: transparent; backdrop-filter: none; }
}
/* Phones: sheets ride up from the bottom edge and slide back down when closed */
@media (max-width: 619px) {
  html.ui-v2 .studio-layout .history-item-action-dialog,
  html.ui-v2 .studio-layout .private-space-dialog,
  html.ui-v2 .studio-layout .studio-panel-dialog,
  html.ui-v2 .v2-sheet {
    animation: none; opacity: 1; transform: translateY(100%);
    transition: transform .24s cubic-bezier(.4, 0, 1, 1), overlay .24s allow-discrete, display .24s allow-discrete;
  }
  html.ui-v2 .studio-layout .history-item-action-dialog[open],
  html.ui-v2 .studio-layout .private-space-dialog[open],
  html.ui-v2 .studio-layout .studio-panel-dialog[open],
  html.ui-v2 .v2-sheet[open] {
    transform: none;
    transition: transform .38s cubic-bezier(.32, .72, 0, 1), overlay .38s allow-discrete, display .38s allow-discrete;
  }
  @starting-style {
    html.ui-v2 .studio-layout .history-item-action-dialog[open],
    html.ui-v2 .studio-layout .private-space-dialog[open],
    html.ui-v2 .studio-layout .studio-panel-dialog[open],
    html.ui-v2 .v2-sheet[open] { transform: translateY(100%); }
  }
}
/* Pressed state: buttons give way slightly under the finger */
html.ui-v2 .studio-layout .generate-button,
html.ui-v2 .studio-layout .studio-mode-tabs button,
html.ui-v2 .studio-layout .studio-toolbar > button,
html.ui-v2 .v2-row,
html.ui-v2 .v2-primary-button,
html.ui-v2 .v2-outline-button,
html.ui-v2 .studio-layout .history-item-action-buttons button { transition: transform .18s cubic-bezier(.2, 1.3, .3, 1), background-color .2s ease, color .2s ease, border-color .2s ease; }
html.ui-v2 .studio-layout .generate-button:active,
html.ui-v2 .studio-layout .studio-toolbar > button:active,
html.ui-v2 .v2-primary-button:active,
html.ui-v2 .v2-outline-button:active { transform: scale(.97); transition-duration: 80ms; }
html.ui-v2 .v2-row:active,
html.ui-v2 .studio-layout .history-item-action-buttons button:active { background: var(--v2-raised); transition-duration: 60ms; }
@media (prefers-reduced-motion: reduce) {
  html.ui-v2 .studio-layout dialog, html.ui-v2 .v2-sheet,
  html.ui-v2 .studio-layout dialog[open], html.ui-v2 .v2-sheet[open] { transition: none !important; transform: none !important; }
}

/* ---------------------------------------------------------------- 6 desktop workspace */
@media (min-width: 1100px) {
  /* Left rail becomes a full-height sidebar column */
  html.ui-v2 .studio-layout:not(.auth-mode) #mobileNav:not(.hidden) { top: 0; bottom: 0; left: 0; width: 96px; padding: 96px 8px 24px; gap: 6px; border-right: 1px solid var(--v2-line); background: #11161b; }
  html.ui-v2 .studio-layout:not(.auth-mode) .mobile-nav-item { min-height: 64px; border-radius: 12px; color: var(--v2-muted); }
  html.ui-v2 .studio-layout:not(.auth-mode) .mobile-nav-item.active { border-color: transparent; background: var(--v2-raised); color: var(--v2-accent); }
  html.ui-v2 .studio-layout:not(.auth-mode) .mobile-nav-item span { font-size: 13px; }
  /* Centred in the space right of the 96px sidebar; wide screens no longer leave
     all the spare room on the right. (100% here is the viewport width.) */
  html.ui-v2 .studio-layout:not(.auth-mode) .shell {
    width: calc(100% - 96px); max-width: var(--studio-content, 1280px);
    margin-left: calc(96px + max(0px, (100% - 96px - var(--studio-content, 1280px)) / 2)); margin-right: 0;
    padding: 24px 40px 48px;
  }
  html.ui-v2 .studio-layout:not(.auth-mode) .topbar { margin-bottom: 20px; }
  html.ui-v2 .studio-layout .studio-intro { margin-bottom: 16px; }
  html.ui-v2 .studio-layout .studio-intro p { display: none; }
  html.ui-v2 .studio-layout .studio-intro h2 { font-size: 24px; font-weight: 600; }
  html.ui-v2 .studio-layout .studio-composer { border-color: var(--v2-line); border-radius: 16px; background: var(--v2-surface); }
  html.ui-v2 .studio-layout .studio-result-empty > div { min-height: 280px; }
  html.ui-v2 .studio-layout .studio-toolbar > button,
  html.ui-v2 .studio-layout .glass-picker-trigger { min-height: 44px; font-size: 13px; }
  html.ui-v2 .studio-layout .generate-button { min-height: 48px; padding: 0 24px; border-radius: 12px; }
}

/* ---------------------------------------------------------------- 2026-11-21 image edit tidy-up */
/* What the two optional reference slots are for, inside each slot (was a line above the grid). */
html.ui-v2 .studio-layout .edit-upload-zone .edit-reference-purpose { max-width: 22em; color: var(--v2-muted); opacity: .85; line-height: 1.5; }
/* The three empty slots read top-down in step: title, size line, note on the same rows. */
html.ui-v2 .studio-layout .image-edit-upload-grid { align-items: stretch; }
html.ui-v2 .studio-layout .image-edit-upload-grid .edit-upload-slot > .edit-upload-zone { height: 100%; box-sizing: border-box; }
html.ui-v2 .studio-layout .edit-upload-zone:not(.has-image) { place-items: start stretch; }
html.ui-v2 .studio-layout .edit-upload-zone:not(.has-image) > span { align-content: start; }

@media (max-width: 619px) {
  /* Phones: 开始生成 floats as a compact pill in the bottom-right corner, sized to
     its text, instead of a full-width bar across the screen; the cost line sits
     inside it. */
  html.ui-v2 { --v2-bar-h: 56px; }
  html.ui-v2 .studio-layout:not(.auth-mode) .studio-submit-row {
    left: auto; right: 12px; bottom: calc(var(--v2-nav-h) + var(--v2-safe-b) + 12px);
    width: auto; max-width: calc(100vw - 24px); min-height: 0; margin: 0; padding: 0;
    border: 0; background: none; pointer-events: none;
  }
  html.ui-v2 .studio-layout #studioSubmitMeta { display: none; }
  html.ui-v2 .studio-layout #studioSubmitSlot,
  html.ui-v2 .studio-layout #studioSubmitSlot .action-dock { width: auto; min-width: 0; pointer-events: auto; }
  html.ui-v2 .studio-layout .generate-button,
  html.ui-v2 .studio-layout .action-dock.is-floating .generate-button {
    width: auto; max-width: calc(100vw - 24px); min-height: 48px; padding: 6px 14px 6px 18px; gap: 10px;
    border-radius: 999px; box-shadow: 0 10px 28px rgba(0, 0, 0, .45), 0 0 0 1px rgba(17, 21, 10, .25);
  }
  html.ui-v2 .studio-layout .generate-button .button-copy { min-width: 0; display: grid; gap: 1px; text-align: left; }
  html.ui-v2 .studio-layout .generate-button .button-copy b { font-size: 15px; line-height: 1.2; }
  html.ui-v2 .studio-layout .generate-button .button-copy small { display: block; max-width: 58vw; overflow: hidden; color: rgba(17, 21, 10, .72); font-size: 11px; font-weight: 600; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; opacity: 1; }
  html.ui-v2 .studio-layout .generate-button .arrow { font-size: 18px; }
}

/* ---------------------------------------------------------------- 2026-11-23 debug account model picker */
/* Only accounts allowed to switch SD models (调试权限) see the model picker. On phones
   give 类型 + 模型 their own row so neither is squeezed to one character. */
@media (max-width: 619px) {
  html.ui-v2 .studio-layout #studioModelSlot:has(.model-field:not(.hidden)) { flex: 1 1 100%; }
  html.ui-v2 .studio-layout #studioModelSlot:has(.model-field:not(.hidden)) ~ #studioParametersButton { flex: 1 1 100%; }
  html.ui-v2 .studio-layout #studioModelSlot .workflow-controls:has(.model-field:not(.hidden)) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; width: 100%; }
}
