:root {
  color-scheme: dark;
  --bg: #080b12;
  --panel: #101521;
  --panel-2: #151b28;
  --line: rgba(255,255,255,.10);
  --line-strong: rgba(255,255,255,.18);
  --text: #f5f7fb;
  --muted: #8f99aa;
  --accent: #ff6b3d;
  --accent-2: #ff9a62;
  --danger: #ff6b75;
  --success: #4bd89f;
  --shadow: 0 22px 65px rgba(0,0,0,.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100svh;
  color: var(--text);
  background:
    radial-gradient(circle at 90% 2%, rgba(255,107,61,.14), transparent 28rem),
    radial-gradient(circle at 4% 70%, rgba(62,91,180,.12), transparent 32rem),
    var(--bg);
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.shell { width: min(1180px, 100%); margin: 0 auto; padding: 0 16px 28px; }
.topbar {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark, .lock-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: var(--accent); color: #160b07; font-weight: 900; border-radius: 11px;
  box-shadow: 0 10px 30px rgba(255,107,61,.22);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: .04em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.icon-button { border: 1px solid var(--line); background: transparent; border-radius: 9px; padding: 9px 12px; cursor: pointer; }
.icon-button:hover { border-color: var(--line-strong); }

.workspace { display: grid; gap: 16px; }
.composer, .output-panel {
  background: rgba(16,21,33,.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.composer { padding: 22px 18px 6px; border-radius: 24px; }
.output-panel { border-radius: 24px; padding: 22px 18px; min-height: 400px; }
.section-heading, .output-head, .label-row, .result-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.eyebrow { margin: 0 0 6px; color: var(--accent-2); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
h1, h2 { margin: 0; letter-spacing: -.035em; }
h1 { font-size: clamp(24px, 7vw, 36px); line-height: 1.08; }
h2 { font-size: 22px; }
.service-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.service-state i { width: 7px; height: 7px; border-radius: 50%; background: #dba53c; box-shadow: 0 0 0 4px rgba(219,165,60,.10); }
.service-state.is-ready i { background: var(--success); box-shadow: 0 0 0 4px rgba(75,216,159,.10); }
.service-state.is-error i { background: var(--danger); box-shadow: 0 0 0 4px rgba(255,107,117,.10); }

form { margin-top: 26px; }
fieldset { border: 0; padding: 0; margin: 0; }
.field-group { margin: 0 0 24px; }
.field-group > label, .field-group > legend, .field-label, .label-row label {
  display: block; margin: 0 0 10px; color: #dce1eb; font-size: 14px; font-weight: 750;
}
.label-row label { margin: 0; }
.label-row { margin-bottom: 10px; }
.label-row span { color: var(--muted); font-size: 13px; }
.prompt-label-row kbd { display: inline-grid; min-width: 22px; height: 22px; place-items: center; padding: 0 5px; color: var(--accent-2); border: 1px solid rgba(255,154,98,.35); border-radius: 6px; background: rgba(255,107,61,.08); font: 800 13px/1 inherit; }
.field-note { margin: 9px 1px 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.model-list { display: grid; gap: 9px; }
.model-card {
  width: 100%; min-height: 74px; display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 12px;
  padding: 13px 14px; text-align: left; cursor: pointer; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2);
}
.model-card:hover { border-color: var(--line-strong); }
.model-card.is-selected { border-color: rgba(255,107,61,.72); background: linear-gradient(100deg, rgba(255,107,61,.11), rgba(21,27,40,.96)); }
.model-check { width: 16px; height: 16px; border: 1px solid #657085; border-radius: 50%; }
.model-card.is-selected .model-check { border: 5px solid var(--accent); }
.model-copy strong, .model-copy small { display: block; }
.model-copy strong { font-size: 14px; line-height: 1.35; }
.model-copy small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.model-price { color: var(--accent-2); font-size: 12px; font-weight: 800; }

.prompt-wrap { position: relative; }
textarea, select, .lock-card input {
  width: 100%; color: var(--text); background: #0c1019; border: 1px solid var(--line); outline: none;
}
textarea { min-height: 136px; resize: vertical; padding: 14px 14px 34px; border-radius: 14px; font-size: 16px; line-height: 1.6; }
textarea:focus, select:focus, .lock-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,107,61,.12); }
.char-count { position: absolute; right: 12px; bottom: 10px; color: #697486; font-size: 11px; }
.mention-menu { position: absolute; z-index: 12; left: 9px; right: 9px; top: calc(100% + 8px); max-height: 260px; overflow-y: auto; padding: 7px; border: 1px solid var(--line-strong); border-radius: 14px; background: #171e2c; box-shadow: 0 18px 48px rgba(0,0,0,.46); }
.mention-title { padding: 6px 8px 8px; color: var(--muted); font-size: 12px; }
.mention-option { width: 100%; min-height: 50px; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; padding: 6px 8px; border: 0; border-radius: 10px; color: var(--text); background: transparent; text-align: left; cursor: pointer; }
.mention-option:hover, .mention-option.is-active { background: rgba(255,255,255,.07); }
.mention-option img { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; background: #0c1019; }
.mention-option strong, .mention-option small { display: block; }
.mention-option strong { font-size: 14px; }
.mention-option small { max-width: 180px; margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.mention-insert { color: var(--accent-2); font-size: 12px; font-weight: 800; }
.mention-upload-icon { width: 38px; height: 38px; display: grid; place-items: center; border: 1px dashed rgba(255,154,98,.55); border-radius: 8px; color: var(--accent); font-size: 22px; }

.upload-zone {
  width: 100%; min-height: 82px; display: flex; align-items: center; justify-content: center; gap: 13px;
  border: 1px dashed rgba(255,255,255,.22); border-radius: 14px; background: rgba(255,255,255,.025); cursor: pointer;
}
.upload-zone:hover { border-color: var(--accent); background: rgba(255,107,61,.045); }
.upload-zone strong, .upload-zone small { display: block; text-align: left; }
.upload-zone strong { font-size: 14px; }
.upload-zone small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.upload-plus { color: var(--accent); font-size: 26px; font-weight: 300; }
.image-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.image-item { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 11px; background: #0c1019; border: 1px solid var(--line); }
.image-item img { width: 100%; height: 100%; object-fit: cover; }
.image-item button { position: absolute; top: 5px; right: 5px; width: 28px; height: 28px; border: 0; border-radius: 8px; background: rgba(4,6,10,.78); cursor: pointer; }
.image-item span { position: absolute; left: 6px; bottom: 5px; padding: 4px 7px; border-radius: 7px; background: rgba(4,6,10,.82); font-size: 12px; font-weight: 800; }

.settings-grid { display: grid; grid-template-columns: minmax(105px, .42fr) minmax(0, 1fr); gap: 12px; }
.compact { min-width: 0; }
select { height: 47px; border-radius: 12px; padding: 0 12px; font-size: 15px; }
.ratio-list { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; padding: 1px 1px 6px; }
.ratio-list::-webkit-scrollbar { display: none; }
.ratio-button { min-width: 54px; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: #0c1019; font-size: 13px; cursor: pointer; }
.ratio-button.is-selected { color: #130905; border-color: var(--accent); background: var(--accent); font-weight: 800; }

.submit-dock { position: sticky; bottom: 0; z-index: 4; margin: 0 -18px; padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(16,21,33,0), rgba(16,21,33,.96) 26%); }
.generate-button, .login-button {
  width: 100%; height: 54px; display: flex; align-items: center; justify-content: center; gap: 12px;
  border: 0; border-radius: 13px; background: linear-gradient(135deg, var(--accent), #ff8751); color: #170a06; font-weight: 900; cursor: pointer;
  box-shadow: 0 14px 35px rgba(255,107,61,.22);
}
.generate-button:disabled { cursor: not-allowed; opacity: .45; box-shadow: none; }
.clear-button { border: 1px solid var(--line-strong); border-radius: 10px; color: var(--muted); background: rgba(255,255,255,.035); font-weight: 750; cursor: pointer; }
.clear-button:hover { color: var(--text); border-color: rgba(255,255,255,.28); }
.clear-button:disabled { cursor: not-allowed; opacity: .4; }

.output-head { margin-bottom: 20px; }
.task-badge { padding: 6px 9px; border-radius: 8px; color: var(--muted); background: rgba(255,255,255,.05); font-size: 11px; font-variant-numeric: tabular-nums; }
.empty-state, .progress-state { min-height: 310px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-state strong, .progress-state strong { margin-top: 20px; font-size: 16px; }
.empty-state p, .progress-state p { max-width: 300px; margin: 8px auto 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.frame-icon { width: 78px; height: 58px; position: relative; border: 1px solid var(--line-strong); border-radius: 13px; transform: rotate(-4deg); }
.frame-icon::before, .frame-icon::after { content: ""; position: absolute; width: 12px; height: 12px; border-color: var(--accent); }
.frame-icon::before { left: 8px; top: 8px; border-left: 2px solid var(--accent); border-top: 2px solid var(--accent); }
.frame-icon::after { right: 8px; bottom: 8px; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); }
.frame-icon span { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); transform: translate(-50%,-50%); }
.progress-orbit { width: 76px; height: 76px; position: relative; border: 1px solid var(--line); border-radius: 50%; animation: spin 2.4s linear infinite; }
.progress-orbit::before { content: ""; position: absolute; inset: 12px; border: 1px solid var(--line); border-radius: 50%; }
.progress-orbit span { position: absolute; width: 10px; height: 10px; top: -5px; left: calc(50% - 5px); border-radius: 50%; background: var(--accent); box-shadow: 0 0 20px var(--accent); }
.progress-track { width: min(260px, 80%); height: 3px; margin-top: 24px; overflow: hidden; background: rgba(255,255,255,.07); }
.progress-track span { display: block; width: 30%; height: 100%; background: var(--accent); animation: travel 1.35s ease-in-out infinite; }
.result-state video { width: 100%; max-height: 68svh; border-radius: 15px; background: #020305; border: 1px solid var(--line); }
.result-actions { margin-top: 14px; }
.result-actions strong, .result-actions small { display: block; }
.result-actions small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.download-button { padding: 11px 13px; color: #170a06; text-decoration: none; background: var(--accent); border-radius: 10px; font-size: 13px; font-weight: 850; white-space: nowrap; }

.lock-screen { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 22px; background: rgba(4,6,10,.82); backdrop-filter: blur(22px); }
.lock-screen[hidden] { display: none; }
.lock-card { width: min(390px, 100%); margin: 0; padding: 28px 22px 22px; border: 1px solid var(--line-strong); border-radius: 22px; background: #111621; box-shadow: var(--shadow); }
.lock-mark { margin-bottom: 24px; }
.lock-card h2 { font-size: 27px; }
.lock-card > p:not(.eyebrow):not(.form-error) { margin: 10px 0 22px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.lock-card label { display: block; margin: 0 0 8px; font-size: 14px; font-weight: 750; }
.lock-card input { height: 50px; padding: 0 13px; border-radius: 12px; font-size: 16px; }
.login-button { margin-top: 12px; }
.key-actions { display: grid; gap: 8px; }
.key-cancel { height: 40px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: transparent; cursor: pointer; }
.form-error { margin: 9px 0 0; color: var(--danger); font-size: 13px; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 32px); transform: translateX(-50%); padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: #1b2230; box-shadow: var(--shadow); font-size: 13px; }

[hidden] { display: none !important; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes travel { 0% { transform: translateX(-105%); } 55% { transform: translateX(230%); } 100% { transform: translateX(230%); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; } }

@media (min-width: 760px) {
  .shell { padding: 0 24px 42px; }
  .topbar { height: 84px; }
  .workspace { grid-template-columns: minmax(0, 1.03fr) minmax(360px, .97fr); align-items: start; gap: 20px; }
  .composer, .output-panel { padding: 28px; border-radius: 28px; }
  .output-panel { position: sticky; top: 22px; min-height: calc(100svh - 112px); }
  .empty-state, .progress-state { min-height: calc(100svh - 220px); }
  .model-list { grid-template-columns: 1fr 1fr; }
  .model-card { grid-template-columns: 18px 1fr; }
  .model-price { grid-column: 2; }
  .image-grid { grid-template-columns: repeat(5, 1fr); }
  .submit-dock { position: static; margin: 0; padding: 2px 0 22px; background: none; }
}

/* Single-screen creator and queue */
html, body { width: 100%; height: 100%; overflow: hidden; }
.shell { width: min(760px, 100%); height: 100svh; padding: 0 10px 10px; overflow: hidden; }
.topbar { height: 50px; }
.brand { gap: 8px; }
.brand-mark { width: 31px; height: 31px; border-radius: 9px; font-size: 13px; }
.brand strong { font-size: 13px; }
.brand small { font-size: 10px; margin-top: 0; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.nav-link, .icon-button { min-height: 32px; display: inline-flex; align-items: center; justify-content: center; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: rgba(255,255,255,.025); text-decoration: none; font-size: 11px; font-weight: 750; }
.nav-link.is-primary { color: #170a06; border-color: var(--accent); background: var(--accent); }
.workspace { display: block; height: calc(100svh - 60px); }
.composer { height: 100%; padding: 11px 12px 8px; overflow: visible; border-radius: 16px; }
.output-panel { display: none; }
.section-heading { min-height: 31px; }
.section-heading .eyebrow { display: none; }
h1 { font-size: 19px; }
.service-state { font-size: 10px; }
.composer form { height: calc(100% - 35px); margin-top: 5px; display: flex; flex-direction: column; gap: 6px; }
.field-group { margin: 0; }
.field-group > label, .field-group > legend, .field-label, .label-row label { margin-bottom: 5px; font-size: 11px; }
.label-row { margin-bottom: 5px; }
.label-row span { font-size: 10px; }
.prompt-label-row kbd { min-width: 18px; height: 18px; font-size: 10px; }
.model-list { grid-template-columns: 1fr 1fr; gap: 6px; }
.model-card { min-height: 36px; grid-template-columns: 10px minmax(0,1fr) auto; gap: 5px; padding: 4px 6px; border-radius: 9px; }
.model-check { width: 12px; height: 12px; }
.model-card.is-selected .model-check { border-width: 4px; }
.model-copy { min-width: 0; }
.model-copy strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.model-copy small { display: none; }
.model-price { grid-column: auto; margin: 0; font-size: 8px; white-space: nowrap; }
.field-note { display: none; }
.prompt-group { flex: 1 1 50%; min-height: 0; display: flex; flex-direction: column; }
.prompt-wrap { flex: 1 1 auto; min-height: 0; }
textarea { width: 100%; height: 100%; min-height: 180px; max-height: none; resize: none; padding: 9px 10px 20px; border-radius: 10px; font-size: 13px; line-height: 1.4; }
.char-count { right: 8px; bottom: 5px; font-size: 8px; }
.mention-menu { left: 4px; right: 4px; top: calc(100% + 4px); max-height: 176px; padding: 4px; border-radius: 10px; }
.mention-title { padding: 3px 5px 5px; font-size: 9px; }
.mention-option { min-height: 38px; grid-template-columns: 29px 1fr auto; gap: 7px; padding: 4px 5px; }
.mention-option img, .mention-upload-icon { width: 29px; height: 29px; border-radius: 6px; }
.mention-option strong { font-size: 11px; }
.mention-option small { font-size: 9px; }
.mention-insert { font-size: 9px; }
.upload-zone { min-height: 43px; gap: 8px; border-radius: 10px; }
.upload-zone strong { font-size: 11px; }
.upload-zone small { margin-top: 1px; font-size: 9px; }
.upload-plus { font-size: 19px; }
.image-grid { grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; margin-top: 5px; }
.image-item { border-radius: 7px; }
.image-item button { top: 2px; right: 2px; width: 17px; height: 17px; padding: 0; border-radius: 5px; font-size: 11px; }
.image-item span { left: 2px; right: 2px; bottom: 2px; overflow: hidden; padding: 2px; border-radius: 4px; font-size: 7px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.image-item.is-uploading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 20%, rgba(255,255,255,.22) 50%, transparent 80%); animation: image-upload 1.1s linear infinite; }
.image-item.is-error { border-color: var(--danger); }
.image-item.is-ready { border-color: rgba(75,216,159,.55); }
.settings-grid { grid-template-columns: 92px minmax(0,1fr); gap: 8px; }
select { height: 34px; padding: 0 7px; border-radius: 8px; font-size: 11px; }
.ratio-list { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 3px; overflow: visible; padding: 0; }
.ratio-button { min-width: 0; height: 34px; padding: 0 2px; border-radius: 8px; font-size: 9px; }
.submit-dock { position: static; margin: auto 0 0; padding: 0; display: grid; grid-template-columns: minmax(112px,.38fr) minmax(0,1fr); gap: 7px; background: none; }
.generate-button { height: 41px; border-radius: 10px; font-size: 12px; }
.clear-button { height: 41px; font-size: 10px; }
.lock-card { max-height: calc(100svh - 24px); padding: 20px 18px 17px; }
.lock-mark { margin-bottom: 14px; }
.lock-card > p:not(.eyebrow):not(.form-error) { margin: 7px 0 14px; font-size: 12px; }
.lock-card input { height: 42px; font-size: 14px; }
.login-button { height: 43px; }
@keyframes image-upload { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* Dedicated task queue */
.task-shell { width: min(980px, 100%); }
.queue-layout { height: calc(100svh - 60px); display: grid; grid-template-rows: auto minmax(0,1fr); gap: 7px; }
.queue-summary { min-height: 51px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 9px; }
.queue-summary .eyebrow { margin-bottom: 2px; font-size: 8px; }
.queue-summary h1 { font-size: 18px; }
.queue-counts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.queue-counts span { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.queue-counts b { color: var(--text); font-variant-numeric: tabular-nums; }
.status-dot, .status-pill i { width: 6px; height: 6px; border-radius: 50%; background: #9aa3b2; }
.status-dot.queued, .status-pill.queued i { background: #dba53c; }
.status-dot.running, .status-pill.running i { background: #56a7ff; }
.status-dot.succeeded, .status-pill.succeeded i { background: var(--success); }
.status-dot.failed, .status-pill.failed i { background: var(--danger); }
.queue-panel { min-height: 0; display: grid; grid-template-rows: 42px minmax(0,1fr) 36px; padding: 0 9px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: rgba(16,21,33,.92); box-shadow: var(--shadow); }
.queue-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.queue-head strong, .queue-head small { display: block; }
.queue-head strong { font-size: 11px; }
.queue-head small { margin-top: 1px; color: var(--muted); font-size: 8px; }
.live-pulse { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 9px; }
.live-pulse i { width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(75,216,159,.10); }
.queue-live { display: flex; align-items: center; gap: 7px; }
.refresh-button { min-width: 42px; height: 27px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: transparent; font-size: 9px; cursor: pointer; }
.refresh-button:disabled { opacity: .4; cursor: default; }
.task-list { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.task-row { min-height: 0; flex: 0 0 calc(100% / var(--queue-rows, 7)); display: grid; grid-template-columns: 63px minmax(0,1fr) 74px 84px; align-items: center; gap: 7px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-status, .task-main { min-width: 0; }
.task-status small { display: block; margin-top: 4px; color: #687384; font-size: 8px; }
.status-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 5px; border-radius: 6px; background: rgba(255,255,255,.04); font-size: 9px; white-space: nowrap; }
.status-pill.running i { animation: status-pulse 1.2s ease-in-out infinite; }
.task-main strong, .task-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-main strong { font-size: 11px; }
.task-main small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.task-row code { overflow: hidden; color: #687384; font: 8px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.task-action, .task-error { width: 49px; min-height: 29px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; border: 1px solid rgba(255,107,61,.4); border-radius: 7px; color: var(--accent-2); background: rgba(255,107,61,.08); font-size: 9px; font-weight: 750; text-decoration: none; cursor: pointer; }
.task-error { color: var(--danger); border-color: rgba(255,107,117,.35); background: rgba(255,107,117,.08); }
.task-actions { display: flex; justify-content: flex-end; gap: 3px; }
.task-actions .task-error { width: 45px; }
.task-actions .task-action { width: 36px; }
.task-actions button:disabled { cursor: not-allowed; opacity: .45; }
.task-working { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 8px; white-space: nowrap; }
.task-working i { width: 8px; height: 8px; border: 1px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; }
.queue-empty { min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); }
.queue-empty > span { color: var(--accent); font-size: 28px; }
.queue-empty strong { margin-top: 5px; color: var(--text); font-size: 12px; }
.queue-empty a { margin-top: 7px; color: var(--accent-2); font-size: 10px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 13px; border-top: 1px solid var(--line); }
.pagination button { min-width: 60px; height: 27px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: transparent; font-size: 9px; cursor: pointer; }
.pagination button:disabled { opacity: .35; cursor: default; }
.pagination span { min-width: 48px; color: var(--muted); font-size: 9px; text-align: center; }
.video-modal { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; padding: 12px; background: rgba(2,3,7,.87); backdrop-filter: blur(16px); }
.video-dialog { width: min(760px, 100%); max-height: calc(100svh - 24px); display: grid; grid-template-rows: auto minmax(0,1fr) auto; gap: 8px; padding: 10px; border: 1px solid var(--line-strong); border-radius: 15px; background: #111621; }
.video-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.video-modal-head div { min-width: 0; }
.video-modal-head strong, .video-modal-head small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-modal-head strong { font-size: 12px; }
.video-modal-head small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.video-modal-head button { width: 29px; height: 29px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: transparent; cursor: pointer; }
.video-dialog video { min-height: 0; width: 100%; height: 100%; max-height: calc(100svh - 145px); border-radius: 10px; background: #020305; }
.video-dialog .download-button { justify-self: end; padding: 8px 11px; font-size: 10px; }
@keyframes status-pulse { 50% { opacity: .35; transform: scale(.75); } }

@media (max-width: 420px) {
  .task-row { grid-template-columns: 61px minmax(0,1fr) 84px; }
  .task-row code { display: none; }
  .queue-counts span { padding-inline: 4px; }
}
@media (max-height: 640px) {
  .topbar { height: 44px; }
  .workspace, .queue-layout { height: calc(100svh - 52px); }
  .composer { padding-top: 7px; }
  .section-heading { min-height: 25px; }
  .composer form { height: calc(100% - 28px); gap: 4px; }
  .model-card { min-height: 32px; padding-block: 3px; }
  textarea { height: 100%; min-height: 150px; max-height: none; }
  .upload-zone { min-height: 37px; }
  .generate-button { height: 36px; }
  .queue-summary { min-height: 43px; padding-block: 3px; }
  .queue-panel { grid-template-rows: 36px minmax(0,1fr) 32px; }
}
@media (min-width: 760px) {
  .shell { padding: 0 16px 14px; }
  .topbar { height: 58px; }
  .workspace, .queue-layout { height: calc(100svh - 72px); }
  .composer { padding: 14px 18px 10px; }
  .composer form { gap: 8px; }
  textarea { height: 100%; min-height: 220px; max-height: none; }
  .model-card { grid-template-columns: 13px minmax(0,1fr) auto; }
  .model-price { grid-column: auto; margin: 0; }
  .image-grid { grid-template-columns: repeat(9, minmax(0, 1fr)); }
  .queue-summary { min-height: 58px; }
  .task-row { grid-template-columns: 78px minmax(0,1fr) 105px 92px; padding-inline: 6px; }
  .task-main strong { font-size: 12px; }
  .task-main small, .task-status small, .task-row code { font-size: 9px; }
  .task-action, .task-error { width: 58px; }
}

.bottom-nav {
  position: fixed; z-index: 14; left: 50%; bottom: 0; width: min(760px, 100%); height: calc(58px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(3, 1fr); padding: 5px 12px env(safe-area-inset-bottom);
  transform: translateX(-50%); border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0;
  background: rgba(12,16,25,.94); box-shadow: 0 -12px 36px rgba(0,0,0,.28); backdrop-filter: blur(20px);
}
.bottom-nav-link { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 10px; color: #778195; text-decoration: none; font-size: 9px; font-weight: 750; }
.bottom-nav-link i { width: 25px; height: 24px; display: grid; place-items: center; border-radius: 8px; font: normal 17px/1 system-ui; }
.bottom-nav-link.is-active { color: var(--accent-2); }
.bottom-nav-link.is-active i { color: #170a06; background: var(--accent); box-shadow: 0 7px 20px rgba(255,107,61,.2); }
.bottom-nav-link:hover { color: var(--text); background: rgba(255,255,255,.025); }
.has-bottom-nav .workspace, .has-bottom-nav .queue-layout, .has-bottom-nav .archive-layout { height: calc(100svh - 118px - env(safe-area-inset-bottom)); }
@media (max-height: 640px) {
  .bottom-nav { height: calc(50px + env(safe-area-inset-bottom)); padding-top: 3px; }
  .bottom-nav-link { gap: 0; font-size: 8px; }
  .bottom-nav-link i { height: 21px; font-size: 14px; }
  .has-bottom-nav .workspace, .has-bottom-nav .queue-layout, .has-bottom-nav .archive-layout { height: calc(100svh - 100px - env(safe-area-inset-bottom)); }
}
