/* Imaginifera — canvas-first studio.
   Plum-black palette with rose and lavender, Bodoni Moda for display and the user's own words, Manrope for controls. */

@font-face { font-family: 'Bodoni Moda'; src: url('/assets/fonts/bodoni-moda-regular.woff2') format('woff2'), url('/assets/fonts/bodoni-moda-regular.ttf') format('truetype'); font-weight: 400 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Bodoni Moda'; src: url('/assets/fonts/bodoni-moda-italic.woff2') format('woff2'), url('/assets/fonts/bodoni-moda-italic.ttf') format('truetype'); font-weight: 400 900; font-style: italic; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('/assets/fonts/manrope-regular.woff2') format('woff2'), url('/assets/fonts/manrope-regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('/assets/fonts/manrope-medium.woff2') format('woff2'), url('/assets/fonts/manrope-medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('/assets/fonts/manrope-semibold.woff2') format('woff2'), url('/assets/fonts/manrope-semibold.ttf') format('truetype'); font-weight: 600 700; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;
  --night: #100d12;
  --stage: #140f17;
  --velvet: #1b151e;
  --velvet2: #231a27;
  --input: #130f16;
  --ink: #f3edf2;
  --ink2: #ddd0dc;
  --mist: #b8abb8;
  --dim: #8d7f92;
  --placeholder: #9d8ca6;
  --rose: #e3bedb;
  --rose2: #f0d5ea;
  --lav: #b7a0e5;
  --danger: #f2bad0;
  --danger-tint: #4a2238;
  --line: rgba(255, 255, 255, .08);
  --line2: rgba(255, 255, 255, .14);
  --line-accent: rgba(183, 160, 229, .2);
  --focus: rgba(183, 160, 229, .7);
  --glass: rgba(22, 15, 26, .64);

  --display: 'Bodoni Moda', Georgia, 'Times New Roman', serif;
  --body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --t-xs: .75rem;
  --t-sm: .8125rem;
  --t-md: .9375rem;
  --t-lg: 1rem;

  --rail: 84px;
  --strip: 112px;
  --gap: 16px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  --mist-bg:
    radial-gradient(42% 52% at 26% 36%, rgba(183, 160, 229, .55), transparent 70%),
    radial-gradient(40% 50% at 74% 60%, rgba(227, 190, 219, .42), transparent 70%),
    radial-gradient(70% 60% at 50% 108%, rgba(117, 81, 109, .75), transparent 70%),
    radial-gradient(30% 30% at 60% 22%, rgba(140, 110, 200, .35), transparent 70%),
    #17111b;
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .7 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--night); color: var(--ink); font: 400 var(--t-md)/1.55 var(--body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { background: var(--rose); color: var(--night); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button, a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
p, h1, h2, h3, h4, figure { margin: 0; }
h1, h2, h3, h4 { font-weight: 400; }
img, video { display: block; max-width: 100%; }
svg { display: block; width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; top: 12px; left: -10000px; z-index: 100; background: var(--ink); color: var(--night); padding: 10px 16px; border-radius: 8px; }
.skip:focus { left: 12px; }
.glass { background: var(--glass); backdrop-filter: blur(22px) saturate(1.25); -webkit-backdrop-filter: blur(22px) saturate(1.25); border: 1px solid var(--line2); }
.grain { position: absolute; inset: 0; opacity: .16; mix-blend-mode: overlay; pointer-events: none; background-image: var(--grain); }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.rail { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 22px 0 20px; border-right: 1px solid var(--line); z-index: 20; }
.mark { font-size: 32px; line-height: 1; color: var(--rose); margin-bottom: 34px; border-radius: 50%; }
.nav-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 66px; padding: 11px 0 9px; margin-bottom: 6px; border-radius: 14px; color: var(--dim); font-size: var(--t-xs); font-weight: 500; transition: color .2s var(--ease), background .2s var(--ease); }
.nav-item svg { width: 21px; height: 21px; }
.nav-item:hover { color: var(--ink2); background: rgba(255, 255, 255, .04); }
.nav-item[aria-current="page"] { color: var(--rose); background: rgba(183, 160, 229, .13); }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.me { width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(183, 160, 229, .32); background: rgba(183, 160, 229, .06); display: grid; place-items: center; font: 400 22px/1 var(--display); color: var(--rose); flex-shrink: 0; transition: border-color .2s var(--ease), background .2s var(--ease); }
button.me:hover, button.me[aria-expanded="true"] { border-color: rgba(227, 190, 219, .7); background: rgba(183, 160, 229, .14); }
.credit-badge { display: flex; flex-direction: column; align-items: center; gap: 1px; width: 66px; padding: 9px 0 8px; border-radius: 14px; color: var(--dim); transition: background .2s var(--ease), color .2s var(--ease); }
.credit-badge b { font: 400 1.3rem/1.1 var(--display); color: var(--rose); font-variant-numeric: lining-nums; }
.credit-badge span { font-size: .6875rem; font-weight: 500; letter-spacing: .02em; }
.credit-badge:hover { background: rgba(255, 255, 255, .04); color: var(--ink2); }
.credit-badge.is-low b, .m-credits.is-low b { color: var(--danger); }
/* Visitors haven't signed in: the account buttons stay out of the way. */
.is-guest .me, .is-guest .credit-badge, .is-guest .m-credits { display: none !important; }
.plans-signin { margin: 0; font-size: var(--t-sm); color: var(--mist); white-space: nowrap; }
.auth-back { display: block; margin-bottom: 28px; }
.mobile-top { display: none; }
main { min-width: 0; position: relative; }
.global-error { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 70; width: min(560px, calc(100vw - 32px)); padding: 14px 18px; background: var(--danger-tint); border: 1px solid rgba(200, 129, 164, .4); border-radius: 12px; font-size: var(--t-sm); box-shadow: 0 16px 50px rgba(0, 0, 0, .45); }

/* ---------- Studio ---------- */
.view.studio { display: grid; grid-template-columns: minmax(0, 1fr) var(--strip); gap: var(--gap); padding: var(--gap); height: 100vh; height: 100dvh; }
.stage-col { min-width: 0; min-height: 0; }
.stage { --dock-space: 190px; position: relative; height: 100%; border-radius: 22px; overflow: hidden; background: var(--stage); border: 1px solid var(--line); isolation: isolate; }
.stage-concept, .stage-content { position: absolute; inset: 0; }
.stage-concept img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vignette { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(16, 13, 18, .6) 0%, rgba(16, 13, 18, 0) 20%, rgba(16, 13, 18, 0) 50%, rgba(16, 13, 18, .88) 100%); }
.stage-concept .vignette { background: linear-gradient(180deg, rgba(16, 13, 18, .6) 0%, rgba(16, 13, 18, 0) 20%, rgba(16, 13, 18, 0) 48%, rgba(16, 13, 18, .9) 100%), radial-gradient(70% 60% at 0% 78%, rgba(16, 13, 18, .72), transparent 70%); }
.nw { white-space: nowrap; }
.concept-copy { position: absolute; left: 40px; bottom: calc(var(--dock-space) + 4px); max-width: 600px; z-index: 2; }
.concept-copy h1 { font: 400 clamp(2.75rem, 4.6vw, 4.5rem)/1.02 var(--display); letter-spacing: -.035em; color: #fff8fc; text-shadow: 0 2px 40px rgba(16, 13, 18, .5); }
.concept-copy h1 em { color: #edcede; }
.concept-copy p { margin-top: 14px; max-width: 42ch; font-size: var(--t-md); color: var(--ink2); text-shadow: 0 1px 20px rgba(16, 13, 18, .6); }
.glass-button { display: inline-flex; align-items: center; height: 44px; padding: 0 18px; margin-top: 20px; border-radius: 12px; font-size: var(--t-sm); font-weight: 500; color: var(--ink); transition: border-color .2s var(--ease), background .2s var(--ease); }
.glass-button:hover { border-color: rgba(227, 190, 219, .6); background: rgba(70, 49, 69, .7); }

.stage-top { position: absolute; top: 18px; left: 18px; right: 18px; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; z-index: 5; pointer-events: none; }
.stage-top > * { pointer-events: auto; }
.meta { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 16px; border-radius: 999px; font-size: var(--t-sm); font-weight: 500; color: var(--ink2); white-space: nowrap; min-width: 0; overflow: hidden; }
.meta .mp { display: inline-flex; align-items: center; gap: 12px; }
.meta .sep { width: 1px; height: 13px; background: var(--line2); }
.meta .live { width: 7px; height: 7px; border-radius: 50%; background: var(--rose); box-shadow: 0 0 10px rgba(227, 190, 219, .8); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }
.actions { display: flex; gap: 2px; padding: 4px; border-radius: 15px; flex-shrink: 0; }
.actions a, .actions button { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 11px; font-size: var(--t-sm); font-weight: 500; color: var(--ink2); transition: background .2s var(--ease), color .2s var(--ease); }
.actions a:hover, .actions button:hover { background: rgba(255, 255, 255, .07); color: var(--ink); }
.actions .primary { color: var(--rose); background: rgba(227, 190, 219, .1); }
.actions .icon-only { width: 38px; padding: 0; justify-content: center; }
.actions svg { width: 17px; height: 17px; }

/* Finished media */
.stage-media { position: absolute; inset: 0; background: #120d15; overflow: hidden; }
.ambient { position: absolute; inset: -80px; background-size: cover; background-position: center; filter: blur(50px) saturate(1.3) brightness(.62); }
.stage-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.stage-img.fill { object-fit: cover; }
.stage-media .vignette { background: linear-gradient(180deg, rgba(16, 13, 18, .45) 0%, rgba(16, 13, 18, 0) 16%, rgba(16, 13, 18, 0) 62%, rgba(16, 13, 18, .7) 100%); }
.reveal { animation: develop 1.8s var(--ease) both; }
@keyframes develop { from { filter: blur(28px) saturate(.4) brightness(.75); opacity: .35; transform: scale(1.02); } to { filter: none; opacity: 1; transform: none; } }

/* Developing */
.stage-dev { position: absolute; inset: 0; overflow: hidden; background: var(--stage); }
.mistfield { position: absolute; inset: -60px; background: var(--mist-bg); filter: blur(28px); animation: drift 16s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translate3d(36px, -24px, 0) scale(1.07); } }
.ref-bg { position: absolute; inset: -80px; background-size: cover; background-position: center; filter: blur(44px) saturate(.75) brightness(.55); }
.ref-bg + .mistfield { opacity: .55; }
.finder-area { position: absolute; top: 76px; left: 32px; right: 32px; bottom: var(--dock-space); container-type: size; display: grid; place-items: center; }
.finder { --r: calc(var(--rw) / var(--rh)); --w: max(min(100cqw, calc(100cqh * var(--r))), min(100cqw, 560px)); position: relative; width: var(--w); height: max(min(100cqh, calc(var(--w) / var(--r))), min(100cqh, 420px)); display: grid; place-items: center; container-type: size; }
.finder .c { position: absolute; width: 30px; height: 30px; border: 0 solid rgba(243, 237, 242, .55); }
.finder .tl { top: 0; left: 0; border-top-width: 1.5px; border-left-width: 1.5px; border-top-left-radius: 6px; }
.finder .tr { top: 0; right: 0; border-top-width: 1.5px; border-right-width: 1.5px; border-top-right-radius: 6px; }
.finder .bl { bottom: 0; left: 0; border-bottom-width: 1.5px; border-left-width: 1.5px; border-bottom-left-radius: 6px; }
.finder .br { bottom: 0; right: 0; border-bottom-width: 1.5px; border-right-width: 1.5px; border-bottom-right-radius: 6px; }
.finder-label { position: absolute; top: 10px; left: 42px; font-size: var(--t-xs); font-weight: 500; color: rgba(243, 237, 242, .62); }
.dev-body { width: min(660px, 84%); text-align: center; }
.dev-kicker { display: inline-flex; align-items: center; gap: 10px; font-size: var(--t-sm); font-weight: 600; color: var(--rose); margin-bottom: 4cqmin; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--rose); box-shadow: 0 0 0 5px rgba(227, 190, 219, .16), 0 0 16px rgba(227, 190, 219, .8); animation: breathe 2.4s ease-in-out infinite; }
.dev-prompt { font: 400 clamp(1.2rem, 6.4cqmin, 2.4rem)/1.26 var(--display); letter-spacing: -.01em; color: var(--ink); text-wrap: balance; text-shadow: 0 2px 30px rgba(16, 13, 18, .4); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.steps { list-style: none; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px 12px; margin: 5cqmin 0 0; padding: 0; font-size: var(--t-sm); font-weight: 500; color: var(--dim); }
.steps li { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.steps .done { color: var(--ink2); }
.steps .done svg { width: 15px; height: 15px; color: var(--lav); }
.steps .now { color: var(--rose); }
.steps .now .pulse { width: 7px; height: 7px; box-shadow: 0 0 0 4px rgba(227, 190, 219, .16); }
.steps .line { width: 40px; height: 1px; background: rgba(243, 237, 242, .22); }
.steps .line.done { background: var(--lav); }
.steps .o { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid currentColor; }
.dev-note { margin-top: 14px; font-size: var(--t-sm); color: var(--mist); }
@container (max-width: 560px) {
  .steps { flex-direction: column; gap: 8px; }
  .steps .line { display: none; }
  .dev-body { width: 90%; }
}

/* Needs attention */
.stage-issue { position: absolute; inset: 0; display: grid; place-items: center; padding: 84px 32px var(--dock-space); background: radial-gradient(60% 60% at 50% 38%, #3a2133, var(--stage) 72%); overflow: hidden; }
.issue-body { position: relative; max-width: 580px; text-align: center; }
.issue-mark { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; border: 1px solid rgba(220, 157, 184, .55); color: var(--danger); }
.issue-mark svg { width: 22px; height: 22px; }
.issue-body h2 { font: 400 clamp(2rem, 3.4vw, 2.9rem)/1.1 var(--display); letter-spacing: -.03em; margin: 20px 0 12px; }
.issue-body h2 em { color: var(--rose); }
.issue-body .issue-error { font-size: var(--t-md); color: var(--mist); line-height: 1.6; }
.issue-prompt { margin-top: 16px; font: 400 1.0625rem/1.5 var(--display); color: var(--ink2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.issue-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }
.btn-line { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(255, 255, 255, .03); font-size: var(--t-sm); font-weight: 500; color: var(--ink2); transition: border-color .2s var(--ease), background .2s var(--ease), color .2s var(--ease); }
.btn-line svg { width: 16px; height: 16px; }
.btn-line:hover { border-color: rgba(183, 160, 229, .6); background: rgba(183, 160, 229, .08); color: var(--ink); }
.btn-line.primary { color: var(--rose); border-color: rgba(227, 190, 219, .45); background: rgba(227, 190, 219, .07); }
.btn-line.danger:hover { border-color: rgba(242, 186, 208, .6); color: var(--danger); }

/* ---------- Prompt dock ---------- */
.dock { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); width: min(980px, calc(100% - 40px)); z-index: 6; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "prompt prompt" "error error" "controls create"; column-gap: 12px; align-items: end; padding: 16px 16px 14px 22px; border-radius: 22px; box-shadow: 0 24px 80px rgba(0, 0, 0, .45); transition: border-color .2s var(--ease); }
.dock:focus-within { border-color: rgba(183, 160, 229, .4); }
.dock-prompt { grid-area: prompt; min-width: 0; position: relative; }
.dock-prompt .ghost { position: absolute; top: -6px; right: -6px; }
.dock textarea { display: block; width: 100%; min-height: 66px; max-height: 136px; padding: 2px 128px 0 0; border: 0; background: transparent; resize: none; overflow-y: auto; font: 400 1.375rem/1.45 var(--display); letter-spacing: .005em; color: var(--ink); caret-color: var(--rose); scrollbar-width: thin; }
.dock textarea::placeholder { color: var(--placeholder); opacity: 1; }
.dock textarea:focus { outline: none; }
.dock-msgs { grid-area: error; min-width: 0; }
.dock-error { padding: 8px 0 0; }
.dock-notice { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 10px 0 0; font-size: var(--t-sm); color: var(--ink2); }
.dock-notice > [data-icon] svg { width: 16px; height: 16px; color: var(--rose); }
.dock-notice b { font-weight: 600; color: var(--ink); }
.dock-controls { grid-area: controls; display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 12px; min-width: 0; }
.seg { display: flex; padding: 3px; border-radius: 12px; background: rgba(0, 0, 0, .28); border: 1px solid var(--line); flex-shrink: 0; }
.seg button { display: flex; align-items: center; justify-content: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 9px; font-size: var(--t-sm); font-weight: 500; color: var(--mist); transition: background .2s var(--ease), color .2s var(--ease); }
.seg button:hover { color: var(--ink); }
.seg button.on { background: rgba(183, 160, 229, .22); color: var(--rose); }
.seg svg { width: 16px; height: 16px; }
.chip { display: flex; align-items: center; gap: 7px; height: 40px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(255, 255, 255, .025); font-size: var(--t-sm); font-weight: 500; color: var(--ink2); white-space: nowrap; flex-shrink: 0; transition: border-color .2s var(--ease), background .2s var(--ease), color .2s var(--ease); }
.chip:hover { border-color: rgba(183, 160, 229, .5); }
.chip svg { width: 15px; height: 15px; color: var(--dim); margin-right: -2px; transition: transform .2s var(--ease); }
.chip[aria-expanded="true"] { border-color: rgba(227, 190, 219, .6); color: var(--rose); background: rgba(227, 190, 219, .07); }
.chip[aria-expanded="true"] svg { color: var(--rose); transform: rotate(180deg); }
.chip .sw { width: 22px; height: 22px; border-radius: 6px; background-size: cover; background-position: center; background-color: var(--velvet2); }
.ratio-icon { display: inline-block; border: 1.5px solid currentColor; border-radius: 2px; flex-shrink: 0; }
.ref-thumb { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: rgba(183, 160, 229, .14) center / cover no-repeat; color: var(--lav); }
.ref-thumb svg { width: 13px !important; height: 13px !important; color: var(--lav) !important; margin: 0 !important; transform: none !important; }
.chip.has-ref { border-color: rgba(183, 160, 229, .5); }
.prompt-count { font-size: var(--t-xs); color: var(--dim); font-variant-numeric: tabular-nums; margin-left: auto; }
.prompt-count.over { color: var(--danger); }
.ghost { display: flex; align-items: center; gap: 7px; height: 40px; padding: 0 8px; font-size: var(--t-sm); font-weight: 500; color: var(--mist); white-space: nowrap; transition: color .2s var(--ease); }
.ghost svg { width: 16px; height: 16px; }
.ghost:hover { color: var(--rose); }
.create { grid-area: create; display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 46px; padding: 0 22px 0 18px; border-radius: 14px; background: var(--rose); color: #2a1730; font-size: var(--t-md); font-weight: 600; white-space: nowrap; box-shadow: 0 10px 34px rgba(227, 190, 219, .22), inset 0 1px 0 rgba(255, 255, 255, .45); transition: background .2s var(--ease), transform .15s var(--ease); }
.create:hover { background: var(--rose2); }
.create:active { transform: translateY(1px); }
.create svg { width: 17px; height: 17px; }
.dock > .create { margin-top: 12px; }
.create.small { height: 44px; padding: 0 18px 0 14px; font-size: var(--t-sm); }
.create.wide { width: 100%; height: 52px; border-radius: 14px; }
.create-cost { margin-left: 2px; padding-left: 11px; border-left: 1px solid rgba(42, 23, 48, .22); font-size: var(--t-sm); font-weight: 500; color: rgba(42, 23, 48, .72); font-variant-numeric: tabular-nums; }
.create-cost.short { color: #8d2b57; }

/* Popovers */
.pop { position: absolute; left: 0; bottom: calc(100% + 12px); width: 300px; padding: 14px; border-radius: 20px; background: rgba(24, 16, 28, .93); box-shadow: 0 24px 70px rgba(0, 0, 0, .5); z-index: 8; animation: rise .18s var(--ease) both; }
.pop-wide { width: 440px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.pop-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 2px 4px 12px; }
.pop-h b { font-size: var(--t-sm); font-weight: 600; color: var(--ink); }
.pop-h span { font-size: var(--t-xs); color: var(--dim); }
.pop-list { display: grid; gap: 2px; }
.pop-list button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 12px; text-align: left; font-size: var(--t-sm); font-weight: 500; color: var(--ink2); transition: background .15s var(--ease); }
.pop-list button > span:not([data-icon]) { flex: 1; min-width: 0; }
.pop-list button:hover { background: rgba(255, 255, 255, .05); }
.pop-list button[aria-pressed="true"] { background: rgba(227, 190, 219, .1); color: var(--rose); }
.pop-list small { display: block; margin-top: 2px; font-size: var(--t-xs); font-weight: 400; color: var(--dim); }
.pop-list svg { width: 17px; height: 17px; color: var(--lav); }
.pop-list .tick svg { color: var(--rose); }
.ratio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.ratio-grid button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; height: 80px; border-radius: 12px; border: 1px solid var(--line); font-size: var(--t-xs); font-weight: 600; color: var(--mist); transition: border-color .15s var(--ease), background .15s var(--ease); }
.ratio-grid button:hover { border-color: rgba(183, 160, 229, .5); color: var(--ink); }
.ratio-grid button[aria-pressed="true"] { border-color: rgba(227, 190, 219, .6); background: rgba(227, 190, 219, .08); color: var(--rose); }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .02); text-align: left; transition: border-color .15s var(--ease), background .15s var(--ease); }
.opt:hover { border-color: rgba(183, 160, 229, .45); }
.opt .th { width: 58px; height: 58px; flex-shrink: 0; border-radius: 9px; background-size: cover; background-position: center; background-color: var(--velvet2); }
.opt b { display: block; font-size: var(--t-sm); font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.opt small { display: block; font-size: var(--t-xs); line-height: 1.35; color: var(--dim); }
.opt[aria-pressed="true"] { border-color: rgba(227, 190, 219, .62); background: rgba(227, 190, 219, .08); }
.opt[aria-pressed="true"] b { color: var(--rose); }

/* ---------- Filmstrip ---------- */
.strip { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }
.strip-h { display: flex; justify-content: space-between; align-items: baseline; height: 22px; padding: 0 4px; font-size: var(--t-xs); font-weight: 600; color: var(--mist); }
.strip-h span + span { font-weight: 500; color: var(--dim); }
.strip-list { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; overflow-x: hidden; padding: 4px; margin: -4px; scrollbar-width: none; }
.strip-list::-webkit-scrollbar { display: none; }
.strip-empty { padding: 14px 6px; font-size: var(--t-xs); line-height: 1.5; color: var(--dim); text-align: center; border: 1px dashed var(--line2); border-radius: 12px; }
.tile { position: relative; display: block; width: 100%; flex-shrink: 0; padding: 0; border-radius: 11px; overflow: hidden; border: 1px solid var(--line); background: #1d1521; transition: border-color .2s var(--ease), opacity .2s var(--ease); }
.tile:hover { border-color: rgba(183, 160, 229, .55); }
.tile[aria-current="true"] { outline: 2px solid var(--rose); outline-offset: 2px; }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; }
.tile .center { position: absolute; inset: 0; display: grid; place-items: center; color: var(--mist); }
.tile-mist { position: absolute; inset: 0; background: var(--mist-bg); }
.tile.is-failed { background: linear-gradient(160deg, #3d2235, #1f1622); }
.tile.is-failed .center { color: var(--danger); }
.tile .center svg { width: 20px; height: 20px; }
.ring { width: 34px; height: 34px; stroke-width: 2.4; }
.ring.spin { animation: orbit 1.4s linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }
.badge { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); background: rgba(16, 13, 18, .62); backdrop-filter: blur(6px); }
.badge svg { width: 10px; height: 10px; margin-left: 1px; }
.strip-more { display: flex; align-items: center; justify-content: center; gap: 8px; height: 40px; flex-shrink: 0; border-radius: 12px; border: 1px solid var(--line2); font-size: var(--t-sm); font-weight: 500; color: var(--ink2); transition: border-color .2s var(--ease); }
.strip-more:hover { border-color: rgba(183, 160, 229, .55); }
.strip-more svg { width: 15px; height: 15px; }

/* ---------- Pages (library, engines) ---------- */
.view.library { padding: 34px 48px 64px; max-width: 1640px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 8px; }
.page-head h1 { font: 400 clamp(2.75rem, 4.4vw, 3.75rem)/1 var(--display); letter-spacing: -.035em; }
.page-head h1 sup { font: 500 var(--t-md) var(--body); color: var(--dim); letter-spacing: 0; vertical-align: 1.9em; margin-left: 8px; }
.page-head p { margin-top: 12px; color: var(--mist); font-size: var(--t-md); }
.text-button { display: inline-flex; align-items: center; gap: 7px; font-size: var(--t-sm); font-weight: 500; color: var(--mist); transition: color .2s var(--ease); }
.text-button svg { width: 16px; height: 16px; }
.text-button:hover { color: var(--rose); }

/* Library */
.lib-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.search { display: flex; align-items: center; gap: 10px; width: 290px; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(255, 255, 255, .02); transition: border-color .2s var(--ease); }
.search:focus-within { border-color: var(--focus); }
.search svg { width: 17px; height: 17px; color: var(--dim); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; font-size: var(--t-lg); }
.search input:focus { outline: none; }
.search input::placeholder { color: var(--placeholder); }
.search input::-webkit-search-cancel-button { filter: invert(.8); }
.lib-tools .seg button { height: 36px; padding: 0 14px; font-size: var(--t-sm); }
.day { display: flex; align-items: baseline; gap: 16px; margin: 40px 0 20px; }
.day h2 { font: 400 1.875rem/1 var(--display); letter-spacing: -.02em; }
.day span { font-size: var(--t-sm); color: var(--dim); }
.day b { flex: 1; height: 1px; background: var(--line); align-self: center; }
.wall { columns: 4 260px; column-gap: 24px; }
.w { break-inside: avoid; margin-bottom: 28px; }
.pic { position: relative; border-radius: 14px; overflow: hidden; background: #1d1521; border: 1px solid var(--line); transition: border-color .2s var(--ease); }
.w:hover .pic, .w:focus-within .pic { border-color: rgba(227, 190, 219, .45); }
.pic-open { position: absolute; inset: 0; width: 100%; height: 100%; display: block; border-radius: inherit; }
.pic-open img, .pic-open video { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.w:hover .pic-open img { transform: scale(1.025); }
.pic .state { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px; font-size: var(--t-sm); font-weight: 600; color: var(--mist); text-align: center; }
.pic .state svg { width: 22px; height: 22px; }
.pic.is-dev .state { color: var(--rose); }
.pic.is-failed { background: linear-gradient(160deg, #3d2235, #1f1622); }
.pic.is-failed .state { color: var(--danger); }
.vtag { position: absolute; top: 10px; left: 10px; display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 8px; border-radius: 999px; font-size: var(--t-xs); font-weight: 600; color: var(--ink); background: rgba(16, 13, 18, .62); backdrop-filter: blur(8px); pointer-events: none; }
.vtag svg { width: 10px; height: 10px; }
.hov { position: absolute; inset: auto 0 0 0; display: flex; gap: 8px; padding: 12px; background: linear-gradient(0deg, rgba(16, 13, 18, .82), transparent); opacity: 0; transform: translateY(6px); transition: opacity .2s var(--ease), transform .25s var(--ease); pointer-events: none; }
.w:hover .hov, .w:focus-within .hov { opacity: 1; transform: none; }
.w:hover .hov > *, .w:focus-within .hov > * { pointer-events: auto; }
.hov a, .hov button { display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border-radius: 10px; font-size: var(--t-xs); font-weight: 600; color: var(--ink); background: rgba(27, 19, 31, .8); border: 1px solid rgba(255, 255, 255, .16); backdrop-filter: blur(8px); transition: border-color .15s var(--ease), color .15s var(--ease); }
.hov a:hover, .hov button:hover { border-color: var(--rose); color: var(--rose); }
.hov .primary { color: var(--rose); }
.hov .icon-only { width: 36px; padding: 0; justify-content: center; }
.hov svg { width: 15px; height: 15px; }
.w figcaption { padding: 12px 2px 0; }
.w figcaption p { font: 400 1rem/1.42 var(--display); color: var(--ink2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.w .m { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 7px; font-size: var(--t-xs); font-weight: 500; color: var(--dim); }
.w .m .err { color: var(--danger); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w .m .lnk { color: var(--rose); }
.empty-library { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 420px; margin-top: 32px; padding: 40px; border: 1px dashed rgba(183, 160, 229, .25); border-radius: 18px; text-align: center; }
.empty-library > svg { width: 30px; height: 30px; color: var(--lav); margin-bottom: 22px; }
.empty-library h2 { font: 400 clamp(1.9rem, 3vw, 2.5rem)/1.15 var(--display); letter-spacing: -.03em; }
.empty-library p { color: var(--mist); font-size: var(--t-md); margin: 12px 0 24px; }


/* ---------- Feedback ---------- */
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 10px; color: var(--ink2); transition: border-color .2s var(--ease), color .2s var(--ease); }
.icon-button:hover { border-color: var(--lav); color: var(--ink); }
.inline-error, .error-message { color: var(--danger); font-size: var(--t-sm); line-height: 1.6; }
.error-message, .success-message { padding: 10px 0; }
.success-message { color: #d1c4e4; font-size: var(--t-sm); }
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 80; max-width: min(90vw, 480px); padding: 12px 20px; background: #2c2033; border: 1px solid rgba(183, 160, 229, .45); border-radius: 12px; box-shadow: 0 16px 50px rgba(0, 0, 0, .5); font-size: var(--t-sm); text-align: center; animation: rise .2s var(--ease) both; }

/* ---------- Dialogs ---------- */
dialog { border: 1px solid rgba(183, 160, 229, .3); border-radius: 20px; color: var(--ink); background: var(--velvet); padding: 22px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); box-shadow: 0 30px 90px rgba(0, 0, 0, .65); }
dialog::backdrop { background: rgba(16, 13, 18, .82); backdrop-filter: blur(10px); }
.modal-top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; font-size: var(--t-sm); color: var(--mist); }
.modal-top > span:first-child { font-weight: 600; color: var(--ink2); }
.modal-counter { margin-left: auto; font-variant-numeric: tabular-nums; }
.modal-nav { display: flex; gap: 6px; }
.modal-top > .icon-button:last-child { margin-left: 0; }
.picker-dialog .modal-top .icon-button, .account-dialog .modal-top .icon-button { margin-left: auto; }
.preview-dialog { width: 1000px; }
.pv-media { display: grid; place-items: center; background: #120d15; border-radius: 12px; overflow: hidden; }
.pv-el { display: block; max-width: 100%; max-height: min(70dvh, 760px); object-fit: contain; }
.pv-status { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 300px; padding: 32px; border-radius: 12px; background: var(--mist-bg); text-align: center; font-size: var(--t-md); color: var(--ink2); }
.pv-status.is-failed { background: radial-gradient(60% 60% at 50% 40%, #3a2133, #17111b 75%); color: var(--danger); }
.pv-status svg:not(.ring) { width: 24px; height: 24px; }
.pv-status p { max-width: 52ch; color: var(--mist); font-size: var(--t-sm); }
.pv-info { padding-top: 18px; }
.pv-prompt { font: 400 1.1875rem/1.5 var(--display); color: var(--ink2); white-space: pre-wrap; overflow-wrap: anywhere; }
.pv-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; font-size: var(--t-xs); font-weight: 500; color: var(--dim); }
.pv-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.confirm-dialog { width: 440px; padding: 32px; }
.confirm-dialog h2 { font: 400 1.75rem/1.2 var(--display); letter-spacing: -.02em; }
.confirm-dialog p { color: var(--mist); font-size: var(--t-md); margin: 12px 0 24px; line-height: 1.6; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.dialog-actions button { min-height: 44px; padding: 0 18px; border-radius: 12px; font-size: var(--t-sm); font-weight: 600; border: 1px solid var(--line2); color: var(--ink2); transition: border-color .2s var(--ease), background .2s var(--ease); }
.dialog-actions button:hover { border-color: rgba(183, 160, 229, .6); }
.dialog-actions .danger-button { background: var(--danger-tint); border-color: rgba(200, 129, 164, .45); color: var(--danger); }
.dialog-actions .primary-button { background: var(--rose); border-color: rgba(227, 190, 219, .5); color: #241427; }
.picker-dialog { width: 860px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: 62dvh; overflow-y: auto; padding: 3px; }
.picker-grid .tile { aspect-ratio: 1; }
.picker-empty { grid-column: 1 / -1; padding: 40px 20px; text-align: center; color: var(--mist); font-size: var(--t-md); }


/* ---------- Sign-in ---------- */
.booting .shell, .booting .auth { visibility: hidden; }
.auth { position: fixed; inset: 0; z-index: 60; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(440px, 580px); background: var(--night); }
.auth-art { position: relative; overflow: hidden; min-height: 0; }
.auth-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: drift 40s ease-in-out infinite alternate; }
.auth-veil { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(16, 13, 18, .35), rgba(16, 13, 18, 0) 30%, rgba(16, 13, 18, .1) 60%, rgba(16, 13, 18, .85)), linear-gradient(90deg, rgba(16, 13, 18, 0) 70%, var(--night)); }
.auth-quote { position: absolute; left: 48px; bottom: 44px; font: 400 clamp(2.6rem, 4.4vw, 4.25rem)/1.02 var(--display); letter-spacing: -.035em; color: #fff8fc; text-shadow: 0 2px 40px rgba(16, 13, 18, .5); }
.auth-quote em { color: #edcede; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 48px 56px; overflow-y: auto; }
.auth-card { width: min(400px, 100%); }
.auth-brand { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 40px; font: 400 2.1rem/1 var(--display); letter-spacing: -.04em; color: var(--ink); }
.auth-brand span { font: 300 1.6rem var(--body); color: var(--rose); }
.auth-card h1 { font: 400 2.6rem/1.08 var(--display); letter-spacing: -.035em; }
.auth-sub { margin: 12px 0 28px; color: var(--mist); font-size: var(--t-md); line-height: 1.6; }
.auth-notice { margin: -8px 0 24px; padding: 13px 16px; border-radius: 14px; border: 1px solid var(--line-accent); background: rgba(183, 160, 229, .08); font-size: var(--t-sm); line-height: 1.6; color: var(--ink2); }
.auth-notice.is-error { border-color: rgba(200, 129, 164, .4); background: var(--danger-tint); color: var(--ink); }
.google-button { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; height: 52px; border-radius: 14px; border: 1px solid var(--line2); background: rgba(255, 255, 255, .035); font-size: var(--t-md); font-weight: 500; color: var(--ink); transition: border-color .2s var(--ease), background .2s var(--ease); }
.google-button:hover { border-color: rgba(227, 190, 219, .55); background: rgba(255, 255, 255, .06); }
.google-button::before { content: 'G'; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--night); font: 600 .9rem/1 var(--body); }
.auth-or { display: flex; align-items: center; gap: 14px; margin: 24px 0; font-size: var(--t-xs); color: var(--dim); }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--line2); }
.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field > span { font-size: var(--t-sm); font-weight: 500; color: var(--ink2); }
.field small { font-size: var(--t-xs); font-weight: 400; color: var(--dim); margin-left: 4px; }
.field input { width: 100%; height: 50px; padding: 0 15px; border-radius: 12px; border: 1px solid rgba(183, 160, 229, .22); background: var(--input); font-size: var(--t-lg); color: var(--ink); transition: border-color .2s var(--ease), background .2s var(--ease); }
.field input:hover { border-color: rgba(183, 160, 229, .38); }
.field input:focus-visible { outline: none; border-color: var(--focus); background: #17121b; }
.field input[aria-invalid="true"] { border-color: rgba(242, 186, 208, .7); }
.field-hint { margin: -8px 0 18px; font-size: var(--t-xs); color: var(--dim); }
.auth-error { margin: -4px 0 16px; }
.auth-links { display: grid; justify-items: start; gap: 12px; margin-top: 22px; font-size: var(--t-sm); color: var(--mist); }
.text-link { color: var(--rose); font-size: var(--t-sm); font-weight: 500; text-decoration: underline; text-decoration-color: rgba(227, 190, 219, .35); text-underline-offset: 3px; transition: text-decoration-color .2s var(--ease); }
.text-link:hover { text-decoration-color: currentColor; }
.text-link.strong { font-weight: 600; }
@keyframes drift { from { transform: scale(1.04) translate3d(0, 0, 0); } to { transform: scale(1.1) translate3d(-1.5%, -1%, 0); } }

/* ---------- Account ---------- */
.account-menu { position: fixed; left: calc(var(--rail) + 10px); bottom: 18px; z-index: 50; width: 300px; padding: 14px; border-radius: 20px; border: 1px solid var(--line2); background: rgba(24, 16, 28, .97); box-shadow: 0 24px 70px rgba(0, 0, 0, .55); animation: rise .18s var(--ease) both; }
.am-head { display: flex; align-items: center; gap: 12px; padding: 4px 4px 0; }
.am-who { min-width: 0; display: grid; }
.am-who b { font-size: var(--t-md); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-who small { font-size: var(--t-xs); color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-credits { margin: 14px 0 8px; padding: 14px 16px; border-radius: 14px; background: rgba(183, 160, 229, .08); border: 1px solid var(--line-accent); }
.am-balance { display: flex; align-items: baseline; gap: 8px; }
.am-balance b { font: 400 2rem/1 var(--display); color: var(--rose); }
.am-balance span { font-size: var(--t-sm); color: var(--mist); }
.am-credits p { margin-top: 6px; font-size: var(--t-xs); color: var(--dim); }
.am-list { display: grid; gap: 2px; }
.am-list button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border-radius: 12px; text-align: left; font-size: var(--t-sm); font-weight: 500; color: var(--ink2); transition: background .15s var(--ease), color .15s var(--ease); }
.am-list button:hover { background: rgba(255, 255, 255, .05); color: var(--ink); }
.am-list svg { width: 17px; height: 17px; color: var(--lav); }
.account-dialog { width: 560px; padding: 22px 26px 8px; }
.acc-body { max-height: calc(100dvh - 140px); overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.acc-sec { padding: 24px 0; border-top: 1px solid var(--line); }
.acc-sec:first-child { border-top: 0; padding-top: 14px; }
.acc-sec h3 { margin-bottom: 16px; font: 400 1.35rem/1.2 var(--display); letter-spacing: -.01em; }
.acc-credits h3 { margin: 22px 0 10px; font: 600 var(--t-xs)/1 var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.acc-balance { display: flex; align-items: baseline; gap: 10px; }
.acc-balance b { font: 400 3.25rem/1 var(--display); letter-spacing: -.03em; color: var(--rose); }
.acc-balance span { font-size: var(--t-md); color: var(--mist); }
.acc-note { margin-top: 8px; font-size: var(--t-sm); color: var(--mist); line-height: 1.6; }
.acc-history { list-style: none; margin: 0; padding: 0; display: grid; }
.acc-history li { display: flex; align-items: baseline; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: var(--t-sm); }
.acc-history li:last-child { border-bottom: 0; }
.acc-history .what { flex: 1; min-width: 0; color: var(--ink2); }
.acc-history .when { font-size: var(--t-xs); color: var(--dim); white-space: nowrap; }
.acc-history .delta { min-width: 52px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--mist); }
.acc-history .delta.plus { color: var(--rose); }
.acc-history .empty { color: var(--dim); }
.acc-form .field input { height: 46px; }
.acc-email { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-height: 30px; font-size: var(--t-md); color: var(--ink); word-break: break-all; }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: var(--t-xs); font-weight: 600; background: rgba(183, 160, 229, .14); color: var(--rose); }
.pill.warn { background: var(--danger-tint); color: var(--danger); }
.acc-actions { display: flex; justify-content: flex-end; }
.acc-text { margin: -6px 0 18px; font-size: var(--t-sm); color: var(--mist); line-height: 1.6; }
.acc-danger h3 { color: var(--danger); }
.acc-form .inline-error { margin: -6px 0 14px; }

@media (max-width: 1100px) {
  .auth { grid-template-columns: minmax(0, 1fr) minmax(400px, 480px); }
  .auth-panel { padding: 40px 36px; }
}


/* ---------- Plans ---------- */
.dock-plans { margin: 6px 0 0; }
.plans-dialog { width: 980px; padding: 22px 26px 18px; }
.plans-dialog .modal-top .icon-button { margin-left: auto; }
.plans-body { max-height: calc(100dvh - 120px); overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.plans-head { text-align: center; margin: 10px auto 26px; max-width: 680px; }
.plans-head h2 { font: 400 clamp(2rem, 3.4vw, 2.75rem)/1.08 var(--display); letter-spacing: -.03em; }
.plans-head p { margin-top: 10px; color: var(--mist); font-size: var(--t-md); }
.plans-status { margin: -8px auto 22px; max-width: 620px; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--line-accent); background: rgba(183, 160, 229, .08); text-align: center; font-size: var(--t-sm); color: var(--ink2); }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.plan { position: relative; display: flex; flex-direction: column; padding: 24px 22px 22px; border-radius: 20px; border: 1px solid var(--line2); background: rgba(255, 255, 255, .025); }
.plan.is-featured { border-color: rgba(227, 190, 219, .45); background: linear-gradient(180deg, rgba(227, 190, 219, .09), rgba(183, 160, 229, .03)); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.plan.is-current { border-color: rgba(183, 160, 229, .6); }
.plan header { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 26px; }
.plan h3 { font: 400 1.5rem/1.1 var(--display); letter-spacing: -.01em; }
.plan-price { display: flex; align-items: baseline; gap: 6px; margin-top: 18px; }
.plan-price b { font: 400 3rem/1 var(--display); letter-spacing: -.03em; color: var(--ink); }
.plan-price span { font-size: var(--t-sm); color: var(--mist); }
.plan-credits { margin-top: 10px; font-size: var(--t-md); color: var(--ink2); }
.plan-credits b { color: var(--rose); font-weight: 600; }
.plan ul { list-style: none; margin: 18px 0 22px; padding: 16px 0 0; border-top: 1px solid var(--line); display: grid; gap: 9px; font-size: var(--t-sm); color: var(--mist); }
.plan li { display: flex; gap: 10px; align-items: baseline; }
.plan li::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--lav); flex-shrink: 0; transform: translateY(-2px); }
.plan .plan-action { margin-top: auto; }
.plan .plan-action .create, .plan .plan-action .btn-line { width: 100%; justify-content: center; height: 48px; }
.plan .plan-action small { display: block; margin-top: 8px; text-align: center; font-size: var(--t-xs); color: var(--dim); }
.topup-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; padding: 16px 20px; border-radius: 16px; border: 1px dashed var(--line2); }
.topup-row div { display: grid; gap: 2px; font-size: var(--t-sm); color: var(--mist); }
.topup-row b { color: var(--ink); font-weight: 600; font-size: var(--t-md); }
.plans-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.plans-foot p { font-size: var(--t-xs); color: var(--dim); max-width: 60ch; }
#plans-error { margin-top: 14px; text-align: center; }

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  .view.studio { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 84px; }
  .strip { flex-direction: row; align-items: stretch; }
  .strip-h { display: none; }
  .strip-list { flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  .strip-list .tile { width: auto; height: 100%; }
  .strip-empty { display: flex; align-items: center; padding: 0 16px; }
  .strip-more { height: auto; padding: 0 18px; }
  .view.library { padding: 28px 32px 56px; }
  .lib-head { flex-direction: column; align-items: stretch; gap: 20px; }
  .lib-tools { justify-content: flex-start; }
  .search { flex: 1; width: auto; min-width: 220px; }
}

/* ---------- Phone ---------- */
@media (max-width: 760px) {
  :root { --gap: 12px; }
  .shell { display: block; }
  .rail { display: none; }
  .mobile-top { display: flex; justify-content: space-between; align-items: center; height: 60px; padding: 0 12px 0 18px; padding-top: env(safe-area-inset-top); }
  .m-brand { display: flex; align-items: center; gap: 7px; min-width: 0; font: 400 25px/1 var(--display); letter-spacing: -.035em; }
  .m-brand span { font: 300 20px var(--body); color: var(--rose); }
  .m-nav { display: flex; gap: 6px; }
  .m-nav a, .m-nav button { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 13px; color: var(--ink2); }
  .m-nav a[aria-current="page"] { color: var(--rose); background: rgba(183, 160, 229, .13); }
  .m-nav svg { width: 21px; height: 21px; }
  .m-nav { align-items: center; }
  .m-nav .me { width: 36px; height: 36px; margin-left: 4px; font-size: 19px; border-radius: 50%; }
  .m-nav .m-credits { width: auto; min-width: 44px; padding: 0 12px; height: 34px; border-radius: 999px; border: 1px solid var(--line2); font-size: var(--t-sm); }
  .m-nav .m-credits b { font: 400 1.05rem/1 var(--display); color: var(--rose); }
  .account-menu { left: auto; right: 12px; bottom: auto; top: calc(62px + env(safe-area-inset-top)); width: min(320px, calc(100vw - 24px)); }
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; overflow-y: auto; }
  .auth-art { height: 34svh; min-height: 220px; }
  .auth-quote { left: 22px; bottom: 20px; font-size: 2.1rem; }
  .auth-panel { padding: 26px 20px calc(32px + env(safe-area-inset-bottom)); align-items: flex-start; overflow: visible; }
  .auth-card h1 { font-size: 2.2rem; }
  .account-dialog { padding: 16px; }
  .acc-sec { padding: 20px 4px; }
  .acc-balance b { font-size: 2.6rem; }
  .plans-dialog { padding: 16px; }
  .plan-grid { grid-template-columns: 1fr; }
  .plans-head { margin-bottom: 20px; }
  .topup-row { flex-direction: column; align-items: stretch; }

  .view.studio { display: flex; flex-direction: column; height: auto; padding: 0 12px calc(108px + env(safe-area-inset-bottom)); }
  .stage { --dock-space: 24px; height: min(68svh, 620px); min-height: 420px; border-radius: 20px; z-index: 10; }
  .stage-top { top: 12px; left: 12px; right: 12px; gap: 10px; }
  .meta { height: 34px; padding: 0 12px; gap: 9px; font-size: var(--t-xs); }
  .meta .mp { gap: 9px; }
  .meta .m-opt { display: none; }
  .actions .act-label, .actions [data-action="delete"] { display: none; }
  .meta { flex-shrink: 1; }
  .meta > span:first-of-type { overflow: hidden; text-overflow: ellipsis; }
  .actions a, .actions button { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .concept-copy { left: 20px; right: 20px; bottom: 22px; }
  .concept-copy h1 { font-size: 2.6rem; }
  .concept-copy p { display: none; }
  .glass-button { margin-top: 16px; height: 42px; }
  .finder-area { top: 58px; left: 16px; right: 16px; bottom: 20px; }
  .stage-issue { padding: 64px 20px 24px; }
  .strip { height: 76px; flex-shrink: 0; }
  .strip-more { display: none; }

  .dock { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); width: auto; transform: none; padding: 12px 12px 12px 18px; border-radius: 22px; background: rgba(27, 21, 30, .95); grid-template-columns: minmax(0, 1fr); grid-template-areas: "prompt" "error" "controls" "create"; z-index: 30; }
  .dock textarea { font-size: 1.25rem; min-height: 58px; max-height: 120px; }
  .dock-controls { flex-wrap: nowrap; overflow-x: auto; margin-right: -12px; padding-right: 12px; scrollbar-width: none; }
  .dock-controls::-webkit-scrollbar { display: none; }
  .dock textarea { padding-right: 112px; }
  .dock:not(.is-expanded) .ghost { display: none; }
  .dock:not(.is-expanded) textarea { padding-right: 0; }
  .dock > .create { width: 100%; height: 52px; }
  .dock:not(.is-expanded) { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "prompt create"; align-items: center; padding: 8px 8px 8px 18px; }
  .dock:not(.is-expanded) .dock-controls, .dock:not(.is-expanded) .dock-msgs { display: none; }
  .dock:not(.is-expanded) textarea { min-height: 0; height: 30px !important; white-space: nowrap; overflow: hidden; font-size: 1.125rem; padding-top: 2px; }
  .dock:not(.is-expanded) > .create { width: 46px; height: 46px; margin: 0; padding: 0; border-radius: 14px; }
  .dock:not(.is-expanded) .create-label, .dock:not(.is-expanded) .create-cost { display: none; }
  .pop, .pop-wide { left: 0 !important; right: 0; width: auto; max-height: 56dvh; overflow-y: auto; background: rgb(26, 19, 30); }
  .opts { grid-template-columns: 1fr; }

  .view.library { padding: 12px 16px 40px; }
  .page-head h1 { font-size: 2.5rem; }
  .page-head h1 sup { vertical-align: 1.4em; }
  .lib-tools { gap: 10px; }
  .search { flex: 1 1 100%; }
  .lib-tools .seg { flex: 1; }
  .lib-tools .seg button { flex: 1; }
  .create.small { padding: 0 14px; }
  .day { margin: 28px 2px 14px; gap: 12px; }
  .day h2 { font-size: 1.5rem; }
  .day span { display: none; }
  .wall { columns: 2; column-gap: 10px; }
  .w { margin-bottom: 18px; }
  .pic { border-radius: 12px; }
  .hov { display: none; }
  .w figcaption { padding-top: 8px; }
  .w figcaption p { font-size: .875rem; }
  .w .m { gap: 2px 10px; margin-top: 4px; }
  .confirm-dialog { padding: 24px; }
  .preview-dialog { padding: 14px; }
  .modal-nav { display: none; }
  .modal-counter { margin-left: auto; }
}

@media (hover: none) { .hov { display: none; } }

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