:root {
  --bg: #0c0a09;
  --bg-2: #13100e;
  --panel: #171311;
  --panel-2: #1e1916;
  --line: rgba(255, 237, 220, 0.08);
  --line-2: rgba(255, 237, 220, 0.14);
  --text: #f6efe8;
  --muted: #a3968b;
  --dim: #6f645b;
  --accent: #ff8a3d;
  --accent-2: #ffc46b;
  --accent-ink: #1a0f06;
  --ok: #7fd89a;
  --warn: #ffc46b;
  --err: #ff6b6b;
  --radius: 16px;
  --radius-sm: 10px;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(255, 138, 61, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(255, 196, 107, 0.06), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
code, kbd { font-family: var(--mono); font-size: .86em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: .05;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px;
  background: rgba(12, 10, 9, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 24px rgba(255, 138, 61, .35);
}
.brand-mark svg { width: 14px; height: 14px; fill: var(--accent-ink); stroke: none; }
.brand-name { font-family: var(--serif); font-size: 26px; line-height: 1; letter-spacing: .01em; }
.brand-tag { font-size: 12px; color: var(--muted); border-left: 1px solid var(--line-2); padding-left: 10px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.conn { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.conn.ok i { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.conn.demo i { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.conn.bad i { background: var(--err); }
.quota { display: flex; gap: 8px; }
.quota-pill {
  font-size: 12px; padding: 5px 10px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
}
.quota-pill b { color: var(--text); font-weight: 600; }

.setup-banner {
  margin: 16px 28px 0; padding: 12px 16px; border-radius: var(--radius-sm);
  background: rgba(255, 196, 107, .08); border: 1px solid rgba(255, 196, 107, .25);
  color: #f3dcb8; font-size: 14px;
}
.setup-banner code { background: rgba(0,0,0,.3); padding: 1px 6px; border-radius: 5px; }

/* ---------- Layout ---------- */
.layout {
  display: grid; grid-template-columns: minmax(360px, 440px) 1fr; gap: 28px;
  padding: 24px 28px 48px; max-width: 1600px; margin: 0 auto;
}
.composer { position: sticky; top: 82px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; scrollbar-width: thin; }
.composer form {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line); border-radius: 22px; padding: 24px;
  display: flex; flex-direction: column; gap: 22px;
}
.composer-head h1 { font-family: var(--serif); font-weight: 400; font-size: 36px; line-height: 1.05; margin: 0 0 8px; letter-spacing: -.01em; }
.composer-head h1 em { color: var(--accent); }
.composer-head p { margin: 0; color: var(--muted); font-size: 14px; }

.field { display: flex; flex-direction: column; gap: 10px; }
.field-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.field-label .hint { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--dim); font-family: var(--mono); font-size: 11px; }

/* Models */
.models { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.model {
  text-align: left; padding: 12px 14px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 3px; transition: border-color .15s, background .15s, transform .15s;
}
.model:hover { border-color: var(--line-2); transform: translateY(-1px); }
.model[aria-checked="true"] { border-color: var(--accent); background: rgba(255, 138, 61, .08); box-shadow: inset 0 0 0 1px var(--accent); }
.model-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.model-sub { font-size: 12px; color: var(--muted); }
.model-badge { font-size: 10px; font-family: var(--mono); padding: 1px 6px; border-radius: 5px; background: rgba(255,255,255,.06); color: var(--muted); }
.model-skel { height: 58px; }

/* Modes */
.modes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.mode { padding: 9px 10px; border: 0; background: transparent; border-radius: 9px; text-align: left; display: flex; flex-direction: column; gap: 1px; color: var(--muted); transition: background .15s, color .15s; }
.mode b { font-size: 13px; font-weight: 600; color: inherit; }
.mode small { font-size: 11px; color: var(--dim); }
.mode:hover { background: rgba(255,255,255,.04); color: var(--text); }
.mode[aria-selected="true"] { background: var(--panel-2); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 4px 14px rgba(0,0,0,.3); }
.mode[aria-selected="true"] small { color: var(--accent-2); }

/* Dropzone */
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 20px; border-radius: 14px; border: 1.5px dashed var(--line-2); background: rgba(255,255,255,.015);
  text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: rgba(255, 138, 61, .05); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone.full { opacity: .45; pointer-events: none; }
.dz-icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); color: var(--accent); }
.dz-text { font-size: 14px; color: var(--muted); }
.dz-text strong { color: var(--text); font-weight: 600; }
.dz-sub { font-size: 12px; color: var(--dim); }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs:empty { display: none; }
.thumb { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-2); background: #000; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .tag { position: absolute; left: 4px; bottom: 4px; font-size: 10px; font-family: var(--mono); background: rgba(0,0,0,.7); padding: 1px 5px; border-radius: 4px; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); display: grid; place-items: center; padding: 0; }
.thumb button svg { width: 12px; height: 12px; }

/* Prompt */
.prompt-box { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; transition: border-color .15s; }
.prompt-box:focus-within { border-color: rgba(255, 138, 61, .55); box-shadow: 0 0 0 4px rgba(255, 138, 61, .08); }
.prompt-box textarea { width: 100%; resize: vertical; min-height: 130px; border: 0; background: transparent; padding: 14px 14px 6px; outline: none; line-height: 1.55; }
.prompt-box textarea::placeholder { color: var(--dim); }
.prompt-tools { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.ghost-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); font-size: 12.5px; color: var(--muted);
  transition: color .15s, border-color .15s;
}
.ghost-btn svg { width: 15px; height: 15px; }
.ghost-btn:hover { color: var(--text); border-color: var(--line-2); }
.ghost-btn.loading { pointer-events: none; color: var(--accent-2); }
.ghost-btn.loading svg { animation: spin 1s linear infinite; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; font-size: 12px; color: var(--muted); }
.chip:hover { color: var(--text); border-color: var(--accent); }

/* Ratios */
.ratios { display: flex; gap: 8px; }
.ratio {
  flex: 1; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line); text-align: left;
}
.ratio[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.ratio .shape { border: 1.6px solid currentColor; border-radius: 3px; color: var(--muted); flex: none; }
.ratio[aria-checked="true"] .shape { color: var(--accent); background: rgba(255, 138, 61, .15); }
.ratio b { display: block; font-size: 13px; }
.ratio small { font-size: 11px; color: var(--dim); }

/* Submit */
.submit-row { display: flex; flex-direction: column; gap: 8px; }
.primary-btn {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 15px 18px; border: 0; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent) 60%, #ff6a2a);
  color: var(--accent-ink); font-weight: 700; font-size: 15px; letter-spacing: .01em;
  box-shadow: 0 10px 30px -10px rgba(255, 138, 61, .7), inset 0 1px 0 rgba(255,255,255,.35);
  transition: transform .15s, filter .15s, opacity .15s; overflow: hidden;
}
.primary-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.primary-btn:active { transform: translateY(0); }
.primary-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.primary-btn kbd { font-size: 11px; padding: 2px 6px; border-radius: 5px; background: rgba(0,0,0,.14); }
.primary-btn.busy .btn-label::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.submit-note { margin: 0; font-size: 12px; color: var(--dim); text-align: center; min-height: 18px; }
.submit-note.err { color: var(--err); }

/* ---------- Stage / gallery ---------- */
.stage { min-width: 0; }
.stage-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.stage-head h2 { font-family: var(--serif); font-weight: 400; font-size: 34px; margin: 0; line-height: 1; }
.muted { color: var(--muted); margin: 6px 0 0; font-size: 14px; }
.filters { display: flex; gap: 4px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.filters button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.filters button span { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.filters button.active { background: var(--panel-2); color: var(--text); }
.filters button.active span { color: var(--accent-2); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; align-items: start; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; animation: rise .35s ease both;
}
.card:hover { border-color: var(--line-2); }
.frame { position: relative; background: #050404; overflow: hidden; cursor: pointer; }
.frame.r16x9 { aspect-ratio: 16 / 9; }
.frame.r9x16 { aspect-ratio: 9 / 16; max-height: 520px; }
.frame.r1x1 { aspect-ratio: 1; }
.frame.text { aspect-ratio: auto; cursor: default; }
.frame video, .frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame .play {
  position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transition: opacity .2s;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,.5));
}
.frame:hover .play { opacity: 1; }
.frame .play span { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.14); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.25); }
.frame .play svg { width: 20px; height: 20px; fill: #fff; stroke: none; margin-left: 3px; }
.text-out { padding: 16px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; color: var(--text); background: var(--bg-2); max-height: 320px; overflow: auto; }

/* Rendering state */
.rendering { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 16px; gap: 12px; }
.rendering::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(600px 300px at var(--x, 30%) 40%, rgba(255, 138, 61, .22), transparent 60%),
    linear-gradient(120deg, #120d0a, #1e1410 40%, #120d0a);
  animation: drift 6s ease-in-out infinite alternate;
}
.rendering::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.06) 50%, transparent 70%);
  background-size: 200% 100%; animation: shimmer 2.2s linear infinite;
}
.rendering > * { position: relative; z-index: 1; }
.steps { display: flex; gap: 4px; }
.steps i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.12); overflow: hidden; position: relative; }
.steps i.done { background: var(--accent); }
.steps i.now::after { content: ""; position: absolute; inset: 0; background: var(--accent); animation: load 1.6s ease-in-out infinite; }
.render-note { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
.render-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.render-label b { font-weight: 600; }
.render-label span { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.failed-box { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 20px; text-align: center; background: repeating-linear-gradient(135deg, #150f0e 0 12px, #181110 12px 24px); }
.failed-box svg { color: var(--err); width: 28px; height: 28px; }
.failed-box p { margin: 0; font-size: 13px; color: var(--muted); max-width: 260px; }

.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.card-prompt { margin: 0; font-size: 13.5px; line-height: 1.45; color: #e6dbd1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 11px; font-family: var(--mono); color: var(--dim); }
.meta .badge { padding: 2px 7px; border-radius: 5px; background: rgba(255,255,255,.05); color: var(--muted); }
.badge.st-completed { color: var(--ok); background: rgba(127, 216, 154, .1); }
.badge.st-failed, .badge.st-expired { color: var(--err); background: rgba(255, 107, 107, .1); }
.badge.st-active { color: var(--warn); background: rgba(255, 196, 107, .1); }
.actions { display: flex; gap: 2px; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; display: grid; place-items: center; color: var(--muted); text-decoration: none; }
.icon-btn:hover { background: rgba(255,255,255,.06); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

/* Empty */
.empty { border: 1px dashed var(--line-2); border-radius: 22px; padding: 56px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.empty h3 { font-family: var(--serif); font-weight: 400; font-size: 30px; margin: 22px 0 6px; }
.empty p { color: var(--muted); margin: 0 0 18px; }
.empty-reel { display: flex; gap: 8px; }
.empty-reel span { width: 64px; height: 44px; border-radius: 8px; border: 1px solid var(--line-2); background: linear-gradient(135deg, var(--panel-2), var(--bg)); animation: float 3s ease-in-out infinite; }
.empty-reel span:nth-child(2) { animation-delay: .3s; border-color: rgba(255, 138, 61, .5); background: linear-gradient(135deg, rgba(255, 138, 61, .25), var(--bg)); }
.empty-reel span:nth-child(3) { animation-delay: .6s; }
.empty-ideas { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; width: 100%; max-width: 760px; }
.idea { text-align: left; padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; color: var(--muted); line-height: 1.45; transition: border-color .15s, transform .15s; }
.idea b { display: block; color: var(--text); font-size: 14px; margin-bottom: 4px; }
.idea:hover { border-color: var(--accent); transform: translateY(-2px); }

/* Viewer */
.viewer { border: 0; padding: 0; background: transparent; max-width: min(1200px, 94vw); width: 100%; color: var(--text); }
.viewer::backdrop { background: rgba(5, 4, 3, .85); backdrop-filter: blur(6px); }
.viewer-inner { position: relative; display: grid; grid-template-columns: 1fr 300px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 20px; overflow: hidden; }
.viewer-media { background: #000; display: grid; place-items: center; max-height: 86vh; }
.viewer-media video, .viewer-media img { max-width: 100%; max-height: 86vh; display: block; }
.viewer-side { padding: 22px; display: flex; flex-direction: column; gap: 14px; border-left: 1px solid var(--line); }
.viewer-prompt { margin: 0; font-size: 14px; line-height: 1.6; color: #e6dbd1; overflow: auto; max-height: 50vh; }
.viewer-actions { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.viewer-actions .primary-btn { padding: 12px; font-size: 14px; text-decoration: none; }
.viewer-actions .ghost-btn { justify-content: center; padding: 10px; font-size: 13px; }
.viewer-close { position: absolute; top: 10px; right: 10px; z-index: 2; background: rgba(0,0,0,.5); }

/* Toasts */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { padding: 12px 16px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: 0 12px 40px rgba(0,0,0,.4); font-size: 14px; max-width: 360px; animation: rise .25s ease both; }
.toast.err { border-color: rgba(255, 107, 107, .4); }
.toast.ok { border-color: rgba(127, 216, 154, .35); }

.skeleton { border-radius: 12px; background: linear-gradient(90deg, var(--panel-2), #26201c, var(--panel-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }

/* User menu */
.user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 3px 4px 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-size: 13px; color: var(--muted); }
.user-chip b { color: var(--text); font-weight: 600; }
.user-chip .icon-btn { width: 28px; height: 28px; border-radius: 50%; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 48px;
  background:
    radial-gradient(700px 400px at 30% 30%, rgba(255, 138, 61, .25), transparent 60%),
    radial-gradient(600px 400px at 80% 90%, rgba(255, 196, 107, .12), transparent 60%),
    linear-gradient(160deg, #1a120d, #0c0a09);
  border-right: 1px solid var(--line);
}
.login-reel { position: absolute; inset: 12% -10% auto -10%; display: flex; gap: 14px; transform: rotate(-8deg); }
.login-reel span { flex: 1; aspect-ratio: 16 / 10; border-radius: 12px; border: 1px solid var(--line-2); background: linear-gradient(135deg, rgba(255,255,255,.05), transparent); animation: float 4s ease-in-out infinite; }
.login-reel span:nth-child(2) { animation-delay: .4s; }
.login-reel span:nth-child(3) { animation-delay: .8s; border-color: rgba(255, 138, 61, .55); background: linear-gradient(135deg, rgba(255, 138, 61, .3), rgba(255, 196, 107, .05)); }
.login-reel span:nth-child(4) { animation-delay: 1.2s; }
.login-reel span:nth-child(5) { animation-delay: 1.6s; }
.login-quote { position: relative; font-family: var(--serif); font-size: clamp(36px, 4.4vw, 60px); line-height: 1.02; margin: 0; letter-spacing: -.01em; }
.login-quote em { color: var(--accent); }
.login-card { display: flex; flex-direction: column; justify-content: center; gap: 28px; padding: 48px clamp(24px, 6vw, 88px); max-width: 560px; width: 100%; margin: 0 auto; }
.login-card h1 { font-family: var(--serif); font-weight: 400; font-size: 42px; line-height: 1.05; margin: 0; }
.login-card h1 em { color: var(--accent); }
#login-form { display: flex; flex-direction: column; gap: 16px; }
.login-field { display: flex; flex-direction: column; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.login-field input {
  width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-2);
  font-size: 15px; letter-spacing: 0; text-transform: none; font-weight: 400; outline: none; transition: border-color .15s, box-shadow .15s;
}
.login-field input:focus { border-color: rgba(255, 138, 61, .6); box-shadow: 0 0 0 4px rgba(255, 138, 61, .1); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-wrap .icon-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.login-error { margin: 0; min-height: 20px; color: var(--err); font-size: 13px; }
.login-foot { margin: 0; font-size: 12px; color: var(--dim); }

@media (max-width: 860px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-card { padding: 40px 16px; }
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes load { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes drift { from { --x: 20%; filter: hue-rotate(0deg); } to { --x: 80%; filter: hue-rotate(-12deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes float { 50% { transform: translateY(-6px); } }
@property --x { syntax: "<percentage>"; inherits: false; initial-value: 30%; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; padding: 16px 16px 40px; gap: 24px; }
  .composer { position: static; max-height: none; overflow: visible; }
  .topbar { padding: 12px 16px; }
  .brand-tag { display: none; }
  .setup-banner { margin: 12px 16px 0; }
  .viewer-inner { grid-template-columns: 1fr; }
  .viewer-side { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 520px) {
  .composer form { padding: 18px; border-radius: 18px; }
  .composer-head h1 { font-size: 30px; }
  .quota { display: none; }
  .grid { grid-template-columns: 1fr; }
  .filters { width: 100%; overflow-x: auto; }
  .filters button { flex: 1; justify-content: center; }
  .toasts { left: 16px; right: 16px; }
}
