/* Workspace layout and shared visual language. No remote fonts or assets. */
:root {
  color-scheme: dark;
  --bg: #101212;
  --bg-2: #151717;
  --surface: #1b1e1e;
  --surface-2: #222626;
  --surface-3: #2b3030;
  --border: #343a38;
  --border-soft: #292e2c;
  --text: #f0f2eb;
  --muted: #a4ada8;
  --dim: #909a94;
  --accent: #d5ef8a;
  --accent-2: #b8d774;
  --accent-3: #d5ef8a;
  --ok: #b6dfa1;
  --warn: #e8c38a;
  --grad: linear-gradient(120deg, #d5ef8a, #c6e77b);
  --grad-soft: linear-gradient(120deg, #d5ef8a14, #d5ef8a08);
  --shadow: 0 20px 70px #0006;
  --shadow-sm: 0 8px 24px #0003;
  --rail: 224px;
}
body { font-family: "Segoe UI", system-ui, sans-serif; }
button, a, input, textarea, select, [tabindex] { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
::selection { background: #d5ef8a40; color: var(--text); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #414942; }
.rail { padding: 28px 16px 16px; align-items: stretch; gap: 5px; overflow-y: auto; }
.rail-brand { display: flex; align-items: center; gap: 11px; margin: 0 8px 36px; text-align: left; }
.rail-logo, .auth-logo { position: relative; flex: 0 0 auto; width: 35px; height: 35px; border-radius: 11px; background: var(--accent); color: #20271a; font-size: 24px; box-shadow: none; margin: 0; line-height: 1; }
.rail-logo > span, .auth-logo > span { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--bg-2); right: 6px; bottom: 6px; }
.rail-logo:hover { transform: none; }
.brand-name { font-size: 15px; font-weight: 750; letter-spacing: 1px; }
.brand-name small { display: block; font-size: 8px; letter-spacing: 1.5px; color: var(--dim); margin-top: 4px; font-weight: 500; }
.nav-label { color: var(--dim); font-size: 10px; letter-spacing: 1.1px; text-transform: uppercase; padding: 0 12px; margin: 0 0 9px; }
.library-label { margin-top: 30px; }
.rail-btn { flex: 0 0 auto; width: 100%; min-height: 46px; padding: 12px; flex-direction: row; gap: 12px; font-size: 13px; letter-spacing: 0; color: var(--muted); text-align: left; border-radius: 9px; }
.rail-btn svg { width: 19px; height: 19px; }
.rail-btn.active { background: #d5ef8a12; color: var(--accent); }
.rail-btn.active::before { left: auto; right: 12px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.nav-spacer { flex: 1; min-height: 28px; }
.rail-foot { margin: 14px 0 0; padding-top: 18px; border-top: 1px solid var(--border-soft); align-items: stretch; gap: 9px; }
.balance-label { padding: 0 12px; color: var(--dim); font-size: 11px; }
.balance-chip { align-self: flex-start; margin-left: 12px; background: transparent; border: 0; padding: 0; border-radius: 3px; font-size: 20px; color: var(--text); font-weight: 650; }
.balance-chip.empty { font-size: 13px; color: var(--muted); }
.account-link { display: flex; align-items: center; gap: 10px; padding: 14px 8px 0; margin-top: 10px; text-align: left; border-top: 1px solid var(--border-soft); }
.account-link > span:nth-child(2) { min-width: 0; flex: 1; }
.account-link b { font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; }
.account-link small { color: var(--dim); font-size: 10px; display: block; margin-top: 2px; }
.account-link > svg { width: 13px; color: var(--dim); }
.avatar { border: 0; background: #333e32; color: var(--accent); }
.topbar { min-height: 96px; height: auto; flex-basis: 96px; padding: 22px 32px; background: var(--bg); backdrop-filter: none; gap: 16px; }
.topbar h1 { font-size: 23px; font-weight: 650; letter-spacing: -.7px; }
.topbar .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.eyebrow { font-size: 9px; font-weight: 650; letter-spacing: 1.9px; color: var(--dim); margin-bottom: 7px; }
.workspace-status { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.workspace-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.btn { min-height: 40px; font-weight: 600; border-radius: 9px; }
.btn.sm { min-height: 34px; }
.btn.primary { background: var(--accent); color: #20271a; box-shadow: none; border: 1px solid transparent; }
.btn.primary:hover:not(:disabled) { background: #e0f5a5; border-color: transparent; filter: none; box-shadow: 0 4px 20px #d5ef8a13; }
.btn:hover:not(:disabled) { border-color: #535d53; }
.input { background: var(--bg-2); border-color: var(--border); border-radius: 9px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #d5ef8a0d; }
.seg { border-color: var(--border-soft); background: var(--bg-2); border-radius: 9px; }
.seg button { display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 6px; min-height: 31px; font-weight: 500; }
.seg button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 2px 4px #0002; }

/* Studio: independently scrollable collection and creation panel. */
#view-studio.active { display: grid; grid-template-columns: minmax(0, 1fr) 352px; grid-template-rows: 110px minmax(0, 1fr); }
#studioBody { grid-column: 1; grid-row: 2; }
#composer { grid-column: 2; grid-row: 2; }
#view-studio > .topbar { grid-column: 1 / -1; padding-top: 20px; padding-bottom: 20px; }
.studio-body { min-width: 0; padding: 28px 30px 40px; }
.studio-welcome { position: relative; display: flex; align-items: center; justify-content: space-between; min-height: 285px; padding: 30px; margin-bottom: 18px; border: 1px solid #3a4436; border-radius: 16px; background: radial-gradient(ellipse at 80% 50%, #3c482f55, transparent 65%), #1b211b; overflow: hidden; }
.welcome-copy { z-index: 1; }
.welcome-copy .eyebrow { color: #b1bf9c; font-size: 8px; }
.welcome-copy h2 { font-size: clamp(26px, 2.55vw, 40px); line-height: 1.17; letter-spacing: -1.5px; font-weight: 550; }
.welcome-copy em { font-style: normal; color: var(--accent); }
.welcome-copy p { font-size: 12px; line-height: 1.8; color: #aab6a1; margin: 15px 0 22px; }
.welcome-copy .btn { font-size: 12px; min-height: 37px; }
.welcome-art { width: 200px; min-width: 170px; height: 225px; position: relative; margin-left: 12px; }
.art-orbit { position: absolute; border: 1px solid #9aad7025; border-radius: 50%; width: 250px; height: 250px; top: -10px; left: -20px; }
.art-orbit::after { content: ""; position: absolute; inset: 20px; border-radius: inherit; border: inherit; }
.art-frame { position: absolute; width: 145px; height: 175px; left: 27px; top: 20px; border-radius: 10px; border: 1px solid #a6b58860; box-shadow: 0 18px 30px #0005; }
.art-frame-back { transform: rotate(-14deg) translate(-12px, 0); background: linear-gradient(155deg, #788758, #242e26); }
.art-frame-front { transform: rotate(9deg) translate(10px, 5px); background: linear-gradient(#c2d197, #e3e9c9); overflow: hidden; animation: artEnter 700ms var(--ease) both; }
.art-sun { position: absolute; width: 58px; height: 58px; border-radius: 50%; background: #f4f3d9; top: 22px; right: 20px; box-shadow: 0 0 35px #faf3c960; }
.art-hill { position: absolute; width: 270px; height: 180px; border-radius: 50%; left: -110px; bottom: -75px; background: linear-gradient(135deg, #8a9d59, #384e32); transform: rotate(-25deg); }
.art-hill::after { content: ""; position: absolute; width: 180px; height: 180px; border-radius: 40%; left: 175px; top: 4px; background: linear-gradient(155deg, #6f834c, #1f382c); }
.art-frame-front > span { position: absolute; bottom: 14px; left: 13px; font-size: 6px; letter-spacing: 1px; color: #eff2dd; z-index: 1; }
.art-label { position: absolute; bottom: 12px; left: 0; display: flex; align-items: center; gap: 8px; background: #222c20ed; padding: 9px 12px; border: 1px solid #6b795344; border-radius: 7px; color: #d2dec0; font-size: 9px; white-space: nowrap; transform: rotate(-4deg); }
.art-label svg { width: 13px; height: 13px; }
.quick-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 32px; }
.quick-tool { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 16px; text-align: left; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 12px; transition: border-color .2s, transform .2s, background .2s; }
.quick-tool:hover { background: #222822; border-color: #687754; transform: translateY(-2px); }
.quick-icon { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; border-radius: 9px; background: #d5ef8a0c; color: var(--accent); }
.quick-icon svg { width: 18px; height: 18px; }
.quick-tool b { display: block; font-size: 12px; font-weight: 600; }
.quick-tool small { display: block; color: var(--dim); font-size: 10px; line-height: 1.5; margin-top: 4px; }
.tool-arrow { margin-left: auto; color: var(--dim); font-size: 17px; }
.collection-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 16px; }
.collection-heading h2 { font-size: 17px; font-weight: 600; margin-bottom: 4px; letter-spacing: -.3px; }
#workTotal { display: inline-block; color: var(--dim); font-size: 11px; margin-left: 7px; padding: 0 6px; background: var(--surface-2); border-radius: 5px; vertical-align: middle; }
.search-field { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-soft); background: var(--bg-2); border-radius: 8px; padding: 9px 11px; width: 180px; }
.search-field:focus-within { border-color: var(--accent); }
.search-field svg { color: var(--dim); width: 15px; height: 15px; }
.search-field input { width: 100%; min-width: 0; background: none; border: 0; font-size: 11px; outline: 0; }
.collection-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 18px; }
.collection-toolbar .seg button { font-size: 11px; padding: 4px 12px; }
.feed-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.card { border-radius: 12px; }
.card-veil { opacity: 1; background: linear-gradient(0deg, #000b, transparent 50%); }
.card-prompt { opacity: 0; transition: opacity .2s; }
.card:hover .card-prompt, .card:focus-within .card-prompt { opacity: 1; }
.card-actions { z-index: 2; }
.card:focus-within .card-actions { opacity: 1; }
.card:hover { border-color: #6c7d58; }
/* Bulk selection stays within the collection, clear of the composer. */
.collection-toolbar { flex-wrap: wrap; }
.collection-selection { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.collection-selection .btn { font-size: 11px; padding: 6px 10px; }
#feedSelectToggle[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: #d5ef8a0d; }
.card-select { position: absolute; top: 9px; left: 9px; z-index: 3; display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #ffffff80; border-radius: 50%; background: #101212c9; color: transparent; opacity: 0; transition: opacity .15s, background .15s; }
.card-select svg { width: 15px; height: 15px; pointer-events: none; }
.card-select:hover { border-color: var(--accent); }
.card:hover .card-select, .card:focus-within .card-select, .feed-grid.is-selecting .card-select { opacity: 1; }
#feedGrid .badge { top: auto; bottom: 38px; pointer-events: none; }
#feedGrid .card-prompt { margin-bottom: 26px; }
#feedGrid .card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.card.is-selected .card-select { background: var(--accent); border-color: var(--accent); color: #20271a; }
.feed-grid.is-selecting .card:hover { transform: none; }
.feed-grid.is-selecting .card-actions { display: none; }
.feed-grid.is-selecting .card { user-select: none; }
#studioBody.has-selection { padding-bottom: 140px; }
.feed-selection-dock { grid-column: 1; grid-row: 2; align-self: end; justify-self: stretch; min-width: 0; margin: 0 16px 18px; z-index: 16; pointer-events: none; }
.feed-selection-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; width: fit-content; max-width: 100%; margin: auto; padding: 10px; border: 1px solid var(--border); border-radius: 14px; background: #171a19f5; backdrop-filter: blur(18px); box-shadow: 0 8px 30px #0008; pointer-events: auto; }
.feed-selection-summary { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; font-size: 12px; font-weight: 600; }
.feed-selection-summary .btn { flex-shrink: 0; }
.feed-selection-actions { display: flex; align-items: center; gap: 7px; }
.feed-selection-actions .btn { font-size: 11px; padding: 7px 10px; white-space: nowrap; }
.feed-selection-actions .btn.icon { padding: 7px; }
.empty-state { padding: 40px 24px; border: 1px dashed var(--border); border-radius: 13px; background: #171a1770; color: var(--dim); }
.empty-state h3 { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.empty-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; color: #b4c29f; margin: 0 auto 14px; }
.empty-state .small { max-width: 370px; margin: auto; line-height: 1.8; }
.setup-banner { display: flex; align-items: center; gap: 12px; border: 1px solid #7c78464a; border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; color: var(--warn); background: #e8c38a09; font-size: 11px; }
.setup-banner > span { flex: 1; }
.setup-banner b { font-weight: 600; }

.composer { position: static; transform: none; width: auto; min-width: 0; height: 100%; max-height: 100%; border: 0; border-left: 1px solid var(--border-soft); border-radius: 0; box-shadow: none; background: var(--bg-2); backdrop-filter: none; display: flex; flex-direction: column; z-index: 10; }
.composer:focus-within { border-color: var(--border-soft); }
.composer-title { display: flex; gap: 12px; align-items: center; padding: 23px 24px 19px; border-bottom: 1px solid var(--border-soft); }
.composer-title h2 { font-size: 16px; font-weight: 600; letter-spacing: -.3px; margin-bottom: 2px; }
.composer-title .small { font-size: 11px; }
.composer-content { padding: 22px 24px; overflow-y: auto; flex: 1; min-height: 0; }
.step-label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; margin-bottom: 13px; }
.step-label > span { display: grid; place-items: center; font-size: 9px; border: 1px solid #424c3a; color: #b7c69f; width: 19px; height: 19px; border-radius: 50%; }
.composer-head { display: block; padding: 0; }
#kindSeg { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 18px; }
#kindSeg button { min-height: 34px; }
#kindSeg button.active { background: #d5ef8a16; color: var(--accent); }
#kindSeg svg { width: 15px; height: 15px; }
.field-label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.model-scroll { display: block; overflow: visible; padding: 0; }
.model-scroll select { width: 100%; font-size: 12px; padding: 10px; min-height: 42px; cursor: pointer; }
#modelHint { margin: 8px 0 24px; font-size: 10px; line-height: 1.65; }
.composer-prompt { padding: 0; }
#promptBox { padding: 13px; min-height: 125px; max-height: 210px; font-size: 12px; line-height: 1.8; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; resize: vertical; }
#promptBox:focus { border-color: #93ac64; outline: none; box-shadow: 0 0 0 3px #d5ef8a06; }
.prompt-hint { font-size: 9px; color: var(--dim); margin-top: 6px; }
.prompt-examples { display: flex; flex-wrap: wrap; gap: 5px; margin: 11px 0 25px; }
.prompt-examples button { padding: 5px 8px; border: 1px solid var(--border); border-radius: 5px; font-size: 9px; color: var(--muted); transition: color .2s, border-color .2s; }
.prompt-examples button:hover { color: var(--accent); border-color: #889e65; }
.composer .ref-strip { padding: 5px 0 16px; gap: 12px; }
.ref-slot { flex-wrap: wrap; max-width: 100%; }
.ref-slot-label { color: var(--muted); font-size: 9px; letter-spacing: .4px; }
.thumb-add { background: var(--bg); border-color: #4a5348; color: var(--muted); }
.thumb-add:hover, .thumb-add.drag { background: #d5ef8a0d; }
.thumb:focus-within .x { opacity: 1; transform: none; }
.composer .params-row { display: grid; grid-template-columns: 1fr; gap: 9px; padding: 12px 0 0; border-top: 1px solid var(--border-soft); }
.composer .param { justify-content: space-between; background: transparent; border: 0; padding: 3px 0; }
.param > .cap { color: var(--muted); }
.composer .param > .dd-btn { background: var(--surface-2); padding: 6px 9px; font-size: 11px; }
.composer .param input[type="number"] { background: var(--surface-2); padding: 6px; border-radius: 5px; }
.composer .param input:is([type="text"], [type="url"], [type="password"]) {
  width: 58%; min-width: 0; padding: 7px 8px; border: 1px solid var(--border-soft);
  border-radius: 5px; background: var(--surface-2); color: var(--text); font: inherit; font-size: 11px;
}
.composer-foot { flex-wrap: wrap; flex: 0 0 auto; padding: 14px 24px 17px; gap: 6px; border-top: 1px solid var(--border-soft); background: #181b18; }
.composer-foot > .grow { display: none; }
.composer-foot > .btn.ghost { font-size: 11px; min-height: 28px; padding: 3px 6px; color: var(--muted); }
#presetSave { margin-left: auto; }
.cost-line { display: flex; align-items: center; justify-content: space-between; width: 100%; font-size: 11px; color: var(--muted); margin: 7px 0 9px; }
.cost { padding: 0; border: 0; background: none; font-size: 16px; color: var(--text); }
#genBtn { width: 100%; min-height: 44px; font-size: 12px; }
.keyboard-hint { text-align: center; width: 100%; font-size: 9px; color: var(--muted); margin-top: 6px; }
.keyboard-hint span { color: var(--dim); margin-left: 3px; }

/* Library, editor and processing tools share the same panel rhythm. */
.page-body { padding: 30px 32px 50px; }
.dropzone { border-color: #424d3e; background: #d5ef8a04; border-radius: 14px; padding: 34px 22px; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: #d5ef8a09; }
.dropzone .big, .empty-state .big { font-size: 28px; opacity: .8; }
.tile-grid { gap: 18px; }
.reference-groups, .reference-sections { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.reference-groups .btn, .reference-sections .btn { white-space: normal; text-align: left; overflow-wrap: anywhere; max-width: 100%; }
.reference-groups .btn { flex: 1 1 210px; justify-content: space-between; }
.reference-count { font-size: 12px; opacity: .7; margin-left: 6px; }
.reference-destinations { display: flex; flex-direction: column; gap: 8px; }
.ref-card:focus-within .card-actions { opacity: 1; }
.preset-card, .ref-card { border-radius: 12px; border-color: var(--border-soft); }
.preset-card:hover, .ref-card:hover { border-color: #6c7d58; }
.preset-card .pv.blank { background: radial-gradient(ellipse at 50% 30%, #3c4c32, #1d241d); }
.settings-wrap { max-width: 960px; gap: 20px; }
.settings-wrap .panel { padding: 25px; border-radius: 13px; }
.panel h4 { font-size: 16px; font-weight: 600; margin-bottom: 9px; }
.panel .hint { line-height: 1.8; margin-bottom: 18px; max-width: 640px; }
.price-table td { padding: 13px 8px; }
.price-table th { padding: 0 8px 13px; }
.price-table td:last-child { font-weight: 500; color: var(--text); }
.price-table tbody tr:hover { background: #d5ef8a04; }
.ip-side { flex-basis: 320px; padding: 20px; gap: 14px; }
.ip-panel { padding: 17px; border-radius: 12px; }
.ip-panel h3 { font-size: 11px; color: var(--muted); }
#canvasWrap { background: radial-gradient(ellipse at center, #1e251e, #111511); }
#dropOverlay { border-color: #45503f; border-width: 1px; inset: 30px; }
#dropOverlay:hover, #dropOverlay.dragover { background: #d5ef8a05; }
.tool.active { background: #d5ef8a16; }
#refEmpty { border-color: #46523e; }
.uq-main { padding: 28px 30px 40px; }
.uq-side { padding: 24px 20px; width: 340px; flex-basis: 340px; }
.uq-src.on { background: #d5ef8a0c; }
.uq-src .tick { background: #60763ba0; }
.uq-side .panel { padding: 16px; }
.toggle input:checked + .track { background: #d5ef8a26; }
input[type="range"] { accent-color: var(--accent); }
.dd-panel { border-radius: 10px; border-color: #46513e; background: var(--surface); }
.dd-option.selected { background: #d5ef8a12; color: var(--accent); }
.dd-option:hover { background: var(--surface-3); }
.drawer { width: min(440px, 100%); box-shadow: none; }
.drawer.open { box-shadow: -20px 0 60px #0006; }
.studio-mobile-tabs { display: none; }
.uq-profile.on { background: #d5ef8a12; }
.uq-profile:not(.on) .ds { display: none; }
.uq-profile:hover { border-color: #6c7d58; }
.uq-layer.on { border-color: #d5ef8a35; }
.uq-advanced { border: 1px solid var(--border-soft); border-radius: 12px; }
.uq-advanced > summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; padding: 16px; font-size: 12px; color: var(--muted); list-style: none; }
.uq-advanced > summary::-webkit-details-marker { display: none; }
.uq-advanced[open] > summary svg { transform: rotate(180deg); }
.uq-advanced .uq-panel { border: 0; border-top: 1px solid var(--border-soft); border-radius: 0; }
.tool { display: flex; align-items: center; flex-direction: column; gap: 6px; padding: 10px 0; }
.tool span { font-size: 8px; color: var(--muted); }
.tool svg { width: 17px; height: 17px; }
.tool.active { color: var(--accent); }
.drawer-backdrop { position: fixed; inset: 0; z-index: 55; background: #0007; backdrop-filter: blur(3px); animation: fadeIn .2s ease both; }
.drawer-head { padding: 22px; }
.drawer-body { padding: 22px; }
.modal { border-radius: 16px; border-color: #46513e; animation: panelIn .22s var(--ease); }
.overlay { backdrop-filter: blur(5px); }
.modal-head { padding: 20px 24px; }
.modal-body { padding: 24px; }
.modal-foot { padding: 16px 24px; }
#auth { background: radial-gradient(ellipse at 50% 10%, #303c27, #101410 65%); }
.auth-card { padding: 38px; width: min(440px, 100%); border-color: #46513e; border-radius: 20px; animation: panelIn .4s var(--ease); }
.auth-logo { width: 48px; height: 48px; margin: 0 auto 22px; font-size: 31px; }
.auth-card .eyebrow { font-size: 8px; margin-bottom: 10px; }
.auth-card h2 { letter-spacing: 2px; font-size: 23px; }
.auth-form label { font-size: 11px; color: var(--muted); margin-bottom: -4px; }
.auth-form .input { min-height: 44px; }
.auth-form .btn { margin-top: 10px; }
.view.active > .page-body, .view.active > .uq-shell { animation: fadeIn .25s ease; }
.toast { border-radius: 10px; padding: 13px 18px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes panelIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes artEnter { from { opacity: 0; transform: rotate(2deg) translate(10px, 18px); } to { opacity: 1; transform: rotate(9deg) translate(10px, 5px); } }

@media (min-width: 1600px) {
  #view-studio.active { grid-template-columns: minmax(0, 1fr) 390px; }
  .studio-body { padding: 36px 42px; }
  .studio-welcome { min-height: 320px; padding: 40px; }
  .welcome-art { margin-right: 40px; transform: scale(1.15); }
  .feed-grid { grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); }
}
@media (max-width: 1240px) {
  :root { --rail: 190px; }
  .rail { padding-left: 10px; padding-right: 10px; }
  .brand-name { font-size: 12px; }
  .brand-name small { font-size: 7px; letter-spacing: 1px; }
  #view-studio.active { grid-template-columns: minmax(0, 1fr) 320px; }
  .studio-body { padding: 22px; }
  .welcome-art { position: absolute; right: -40px; opacity: .4; }
  .welcome-copy { max-width: 85%; }
  .studio-welcome { padding: 26px; }
  .quick-tools { grid-template-columns: 1fr; gap: 9px; margin-bottom: 24px; }
  .quick-tool { padding: 12px; }
  .quick-tool small { margin-top: 2px; }
  .composer-title, .composer-content, .composer-foot { padding-left: 20px; padding-right: 20px; }
  .collection-heading { flex-wrap: wrap; }
  .search-field { width: 100%; }
}
@media (max-width: 1000px) {
  :root { --rail: 76px; }
  .rail { padding: 20px 8px 12px; align-items: center; }
  .rail-brand { margin: 0 0 24px; }
  .brand-name, .nav-label, .balance-label, .account-link > span:nth-child(2), .account-link > svg { display: none; }
  .rail-btn { flex-direction: column; justify-content: center; gap: 6px; padding: 10px 2px; font-size: 8px; min-height: 62px; text-align: center; }
  .rail-btn.active::before { display: none; }
  .rail-foot { width: 100%; align-items: center; }
  .balance-chip { margin: 0; align-self: center; font-size: 13px; }
  .balance-chip.empty { font-size: 9px; }
  .account-link { padding: 12px 0 0; justify-content: center; width: 100%; }
  .ip-side { flex-basis: 280px; }
  .uq-side { width: 300px; flex-basis: 300px; }
  .topbar { padding: 20px 24px; }
}
@media (max-width: 900px) and (min-width: 761px) {
  .ip-shell { flex-direction: row; }
  .ip-side { flex: 0 0 270px; border-left: 1px solid var(--border-soft); border-top: 0; }
}
@media (max-width: 760px) {
  #app { flex-direction: column; height: 100dvh; }
  .rail { order: 2; flex: 0 0 auto; width: 100%; padding: 7px 6px calc(7px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--border); flex-direction: row; gap: 2px; overflow: visible; background: #171b17; }
  .rail-brand, .rail-foot, .nav-spacer { display: none; }
  .rail-btn { flex: 1 1 0; width: auto; min-width: 0; min-height: 52px; padding: 6px 0; font-size: 8px; gap: 5px; }
  .rail-btn svg { width: 18px; height: 18px; }
  main { min-height: 0; }
  .topbar { min-height: 90px; flex-basis: auto; flex-wrap: wrap; padding: 20px; gap: 10px; }
  .topbar h1 { font-size: 22px; }
  .topbar > .grow { display: none; }
  .topbar > div:first-child { flex: 1 1 100%; }
  .topbar .sub { font-size: 11px; }
  .workspace-status { display: none; }
  #view-studio.active { display: flex; overflow-y: auto; }
  #view-studio > .topbar { flex: 0 0 auto; order: 0; }
  .studio-mobile-tabs { display: grid; grid-template-columns: 1fr 1fr; position: sticky; top: 0; z-index: 15; margin: 0 16px; order: 0; flex: 0 0 auto; box-shadow: 0 5px 16px #0003; }
  .studio-mobile-tabs button { min-height: 38px; }
  #view-studio:not(.show-collection) .studio-body { display: none; }
  #view-studio.show-collection .composer { display: none; }
  #view-studio:not(.show-collection) .feed-selection-dock { display: none; }
  .feed-selection-dock { position: fixed; left: 10px; right: 10px; bottom: calc(78px + env(safe-area-inset-bottom)); margin: 0; }
  .feed-selection-bar { width: 100%; }
  .feed-selection-actions { flex: 1 1 auto; }
  .feed-selection-actions .btn:not(.icon) { flex: 1; }
  .composer { flex: 0 0 auto; width: auto; height: auto; max-height: none; order: 1; margin: 16px; border: 1px solid var(--border); border-radius: 14px; overflow: visible; }
  .composer-title { padding: 18px 20px; }
  .composer-content { flex: 0 0 auto; overflow: visible; padding: 20px; }
  .composer-foot { border-radius: 0 0 14px 14px; }
  .studio-body { flex: 0 0 auto; overflow: visible; order: 2; padding: 20px 16px 30px; }
  .studio-welcome { display: none; }
  .quick-tools { grid-template-columns: 1fr 1fr; margin-bottom: 26px; }
  .quick-tool { padding: 12px; gap: 8px; align-items: flex-start; }
  .quick-icon { width: 30px; height: 30px; flex-basis: 30px; }
  .quick-tool b { font-size: 11px; }
  .quick-tool small { font-size: 9px; }
  .tool-arrow { display: none; }
  .collection-heading { gap: 14px; }
  .collection-heading h2 { font-size: 18px; }
  .feed-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .collection-toolbar .seg button { padding: 4px 10px; }
  .page-body { padding: 20px 16px 30px; }
  .settings-wrap .panel { padding: 18px; }
  .price-table { font-size: 10px; }
  .price-table th { font-size: 9px; }
  .price-table td, .price-table th { padding-left: 3px; padding-right: 3px; }
  .ip-shell { flex-direction: column; overflow-y: auto; }
  #canvasWrap { flex: 0 0 390px; min-height: 390px; }
  .ip-side { flex: 0 0 auto; overflow: visible; padding: 16px; }
  #dropOverlay { inset: 16px; }
  #resultBar { max-width: calc(100% - 20px); width: max-content; flex-wrap: wrap; justify-content: center; bottom: 10px; gap: 7px; }
  #splitRange { width: 100px; }
  .uq-shell { flex-direction: column; overflow-y: auto; }
  .uq-main { flex: 0 0 auto; overflow: visible; padding: 20px 16px; }
  .uq-side { flex: 0 0 auto; width: 100%; overflow: visible; border-left: 0; border-top: 1px solid var(--border); padding: 20px 16px; }
  .modal { max-width: calc(100vw - 24px); max-height: calc(100dvh - 32px); }
  .modal-body { padding: 18px; }
  .auth-card { padding: 28px; }
  #toasts { bottom: calc(85px + env(safe-area-inset-bottom)); width: calc(100% - 32px); }
  .toast { max-width: 100%; font-size: 12px; }
}
@media (hover: none) {
  .card-select { opacity: 1; }
  .card-actions, .thumb .x, .uq-src .mini-btn, .ref-card .actions { opacity: 1; transform: none; }
  .mini-btn { width: 36px; height: 36px; }
  .card:hover, .quick-tool:hover { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
