:root {
  --bg: #07090e; --surface: #10131a; --surface-2: #151923; --surface-3: #0b0e14;
  --line: #282e3b; --text: #f7f8fb; --muted: #9ba4b5; --primary: #8b5cf6;
  --primary-strong: #7142df; --success: #4ade80; --warning: #fbbf24; --danger: #fb7185;
  --radius: 14px; --focus: 0 0 0 3px rgba(139,92,246,.28);
}
* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 80% -10%,rgba(124,58,237,.18),transparent 34%),var(--bg); color: var(--text); font-family: Inter,ui-sans-serif,system-ui,-apple-system,sans-serif; font-size: 16px; line-height: 1.5; }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 20; padding: 10px 14px; background: var(--primary); color: white; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.topbar { position: sticky; top: 0; z-index: 10; height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px,calc((100vw - 1180px)/2)); border-bottom: 1px solid var(--line); background: rgba(7,9,14,.84); backdrop-filter: blur(18px); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 750; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(145deg,#9b72ff,#6535d5); box-shadow: 0 8px 24px rgba(124,58,237,.3); }
.token-state { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #64748b; }
.token-state.connected .status-dot { background: var(--success); box-shadow: 0 0 0 4px rgba(74,222,128,.1); }
.token-state.connecting .status-dot { background: var(--warning); box-shadow: 0 0 0 4px rgba(251,191,36,.1); }
main { max-width: 1180px; margin: auto; padding: 64px 24px 90px; }
.hero { max-width: 850px; margin-bottom: 38px; }
.eyebrow,.step { margin: 0 0 8px; color: #b59cff; font-size: 12px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.hero h1 { margin: 0 0 20px; font-size: clamp(40px,6vw,70px); line-height: 1.02; letter-spacing: -.055em; }
.lede,.subtle,.helper { color: var(--muted); }
.lede { max-width: 670px; margin: 0; font-size: 18px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg,rgba(21,25,35,.97),rgba(13,16,23,.97)); box-shadow: 0 24px 64px rgba(0,0,0,.3); }
.token-panel { display: grid; grid-template-columns: 1fr minmax(380px,.8fr); gap: 24px; align-items: center; padding: 22px 24px; margin-bottom: 26px; }
.token-panel h2,.panel h2 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.subtle { margin: 5px 0 0; font-size: 13px; }
.token-controls { display: flex; gap: 8px; }
.token-input { position: relative; flex: 1; }
.token-input input { padding-right: 48px; }
.inline-message { grid-column: 1/-1; min-height: 0; color: #a7f3d0; font-size: 13px; }
.tabs { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 12px; background: #0b0e14; }
.tab { min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 18px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; transition: background .2s,color .2s; }
.tab.active { background: #242033; color: #e8deff; }
.tab svg { width: 18px; }
.work-grid { display: grid; grid-template-columns: minmax(0,1.42fr) minmax(300px,.58fr); gap: 16px; align-items: start; }
.task-panel { padding: 24px; }
.jobs-panel { position: sticky; top: 84px; max-height: calc(100vh - 104px); padding: 18px; overflow: hidden; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.jobs-panel .panel-heading { align-items: center; margin-bottom: 12px; }
.heading-line { display: flex; align-items: center; gap: 8px; }
.job-count { min-width: 24px; padding: 2px 7px; border-radius: 999px; background: #282332; color: #c4b5fd; font: 700 11px/1.55 ui-monospace,monospace; text-align: center; }
.badge { padding: 6px 9px; border: 1px solid #4a3c6e; border-radius: 7px; background: #211a35; color: #c4b5fd; font: 700 10px/1 ui-monospace,monospace; letter-spacing: .08em; text-transform: uppercase; }
.badge.live { border-color: #25553a; background: #11291c; color: #86efac; }
label,legend { display: block; margin-bottom: 8px; color: #e1e5ed; font-size: 13px; font-weight: 680; }
input,textarea,select { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 9px; outline: 0; background: var(--surface-3); color: var(--text); font: inherit; }
input,select { padding: 0 13px; }
textarea { padding: 12px 13px; resize: vertical; }
input:focus,textarea:focus,select:focus { border-color: var(--primary); box-shadow: var(--focus); }
select,textarea { margin-bottom: 20px; }
.icon-button { position: absolute; right: 3px; top: 3px; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-button:hover { background: var(--surface-2); color: var(--text); }
.icon-button.active { background: var(--surface-2); color: #c4b5fd; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button { min-height: 44px; border-radius: 9px; padding: 0 16px; font: inherit; font-weight: 720; cursor: pointer; transition: background .2s,border-color .2s,opacity .2s; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.primary { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: var(--primary); color: white; }
.primary:hover:not(:disabled) { background: var(--primary-strong); }
.secondary { border: 1px solid #4e3c78; background: #211a35; color: #ddd2ff; white-space: nowrap; }
.ghost { border: 1px solid var(--line); background: transparent; color: var(--text); }
.compact { min-height: 38px; padding: 0 12px; font-size: 13px; }
#refresh { min-width: 72px; }
#refresh[aria-busy="true"] { opacity: .72; }
button:focus-visible,a:focus-visible,.dropzone:focus-within { outline: none; box-shadow: var(--focus); }
.helper { margin: -10px 0 20px; font-size: 12px; }
.mode-help { margin: -10px 0 18px; padding: 9px 11px; border-left: 2px solid #7c5ce0; border-radius: 0 7px 7px 0; background: rgba(124,92,224,.08); color: var(--muted); font-size: 12px; }
.dropzone { min-height: 142px; display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 0 0 14px; border: 1px dashed #3c4557; border-radius: 10px; background: var(--surface-3); text-align: center; cursor: pointer; transition: border-color .2s,background .2s; }
.dropzone:hover { border-color: var(--primary); background: rgba(124,58,237,.06); }
.dropzone svg { margin-bottom: 10px; color: #b59cff; }
.dropzone small { margin-top: 4px; color: var(--muted); font-weight: 450; }
input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.media-preview { padding: 11px 12px; margin: 0 0 20px; border: 1px solid var(--line); border-radius: 9px; background: #0c1017; color: var(--muted); font: 12px ui-monospace,monospace; }
fieldset { padding: 0; margin: 0 0 20px; border: 0; }
.choice-grid { display: grid; gap: 8px; }
.choice-grid.models { grid-template-columns: repeat(2,1fr); }
.choice-grid.resolutions { grid-template-columns: repeat(3,1fr); }
.choice-grid.generation-modes { grid-template-columns: repeat(3,1fr); }
.choice-grid.generation-resolutions { grid-template-columns: repeat(2,1fr); }
.choice-grid.generation-durations { grid-template-columns: repeat(3,1fr); }
.parameter-row { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(230px,.65fr); gap: 12px; margin-bottom: 20px; }
.parameter-group { min-width: 0; padding: 14px; margin: 0; border: 1px solid var(--line); border-radius: 11px; background: rgba(7,9,14,.42); }
.parameter-title { margin: 0 0 12px; color: #e1e5ed; font-size: 13px; font-weight: 680; line-height: 1.4; }
.compact-choices .choice span { min-height: 56px; padding: 8px 10px; }
.duration-group .choice-grid { gap: 6px; }
.duration-group .choice span { align-items: center; padding-inline: 5px; text-align: center; }
.choice { margin: 0; cursor: pointer; }
.choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.choice span { min-height: 72px; display: flex; flex-direction: column; justify-content: center; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-3); transition: border-color .2s,background .2s; }
.choice small { margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 450; }
.choice input:checked + span { border-color: var(--primary); background: rgba(124,58,237,.12); box-shadow: inset 0 0 0 1px var(--primary); }
.choice input:focus-visible + span { box-shadow: var(--focus); }
.choice.disabled { cursor: not-allowed; }
.choice.disabled span { opacity: .45; cursor: not-allowed; }
.upload-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-bottom: 20px; }
.compact-dropzone { min-height: 104px; margin-bottom: 0; padding: 12px; }
.compact-dropzone span { overflow-wrap: anywhere; }
.compact-dropzone.has-media { min-height: 116px; align-items: stretch; padding: 8px; border-style: solid; }
.compact-dropzone.has-media > small { display: none; }
.compact-dropzone.has-media > span { display: grid; grid-template-columns: 92px minmax(0,1fr); gap: 11px; align-items: center; text-align: left; }
.upload-thumb { width: 92px; height: 88px; display: block; border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); object-fit: cover; }
.upload-preview-copy b,.upload-preview-copy small,.upload-preview-copy em { display: block; }
.upload-preview-copy b { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.upload-preview-copy small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.upload-preview-copy em { margin-top: 9px; color: #b9a7ef; font-size: 10px; font-style: normal; font-weight: 700; }
.video-input-preview { display: grid; grid-template-columns: 180px minmax(0,1fr); gap: 13px; align-items: center; }
.video-input-poster { position: relative; height: 102px; display: grid; place-items: center; border-radius: 8px; overflow: hidden; }
.video-input-poster > span:last-child { position: absolute; left: 10px; bottom: 8px; color: rgba(255,255,255,.86); font: 700 10px ui-sans-serif,system-ui,sans-serif; }
.video-input-info { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.video-input-info b,.video-input-info small { display: block; }
.video-input-info b { overflow: hidden; color: #e7eaf0; text-overflow: ellipsis; white-space: nowrap; }
.video-input-info small { margin-top: 5px; }
.video-input-info button { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #111620; color: var(--muted); cursor: pointer; }
.video-input-info button svg { width: 16px; height: 16px; }
.crop-edit { width: 100%; min-height: 34px; margin-top: 7px; border: 1px solid #4e3c78; border-radius: 8px; background: rgba(124,58,237,.08); color: #c4b5fd; font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; }
.crop-edit:hover { background: rgba(124,58,237,.16); }
.crop-dialog { width: min(860px,calc(100vw - 28px)); max-height: calc(100vh - 28px); padding: 22px; border: 1px solid #3b4354; border-radius: 16px; background: #11151e; color: var(--text); box-shadow: 0 28px 90px rgba(0,0,0,.72); overflow: auto; }
.crop-dialog::backdrop { background: rgba(2,4,8,.78); backdrop-filter: blur(5px); }
.crop-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.crop-heading h2 { margin: 0; font-size: 21px; }
.crop-close { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-3); color: var(--muted); font-size: 25px; cursor: pointer; }
.crop-help { margin: 8px 0 14px; color: var(--muted); font-size: 13px; }
.crop-stage { display: grid; place-items: center; min-height: 280px; margin-bottom: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: repeating-conic-gradient(#0b0e14 0 25%,#151923 0 50%) 50%/22px 22px; overflow: hidden; }
#crop-canvas { display: block; max-width: 100%; max-height: min(60vh,600px); border-radius: 4px; box-shadow: 0 8px 34px rgba(0,0,0,.45); cursor: grab; touch-action: none; user-select: none; }
#crop-canvas:active { cursor: grabbing; }
.crop-dialog label { display: flex; justify-content: space-between; }
#crop-zoom { min-height: 32px; padding: 0; accent-color: var(--primary); }
.crop-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 16px; }
.required-mark,.optional-mark { margin-left: 4px; font-size: 11px; font-weight: 600; }
.required-mark { color: #fda4af; }
.optional-mark { color: var(--muted); }
.standalone-input { margin-bottom: 20px; }
.form-message { min-height: 0; margin-bottom: 0; font-size: 13px; }
.form-message:not(:empty) { margin-bottom: 14px; padding: 10px 12px; border-radius: 8px; background: rgba(251,113,133,.1); color: #fecdd3; }
.form-message.success:not(:empty) { background: rgba(74,222,128,.1); color: #a7f3d0; }
.jobs { max-height: calc(100vh - 192px); display: flex; flex-direction: column; gap: 6px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #353c4b transparent; }
.empty { min-height: 154px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; border: 1px dashed var(--line); border-radius: 10px; color: #d3d7df; text-align: center; }
.empty small { margin-top: 5px; color: var(--muted); }
.job { --job-accent: #8b93a3; position: relative; flex: 0 0 auto; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: #0c0f15; overflow: hidden; transition: border-color .2s,background .2s; }
.job::before { content: ''; position: absolute; z-index: 1; left: 0; top: 9px; bottom: 9px; width: 2px; border-radius: 0 3px 3px 0; background: var(--job-accent); opacity: .85; }
.job.generation { --job-accent: #a78bfa; }
.job.upscale { --job-accent: #38bdf8; }
.job:hover { border-color: color-mix(in srgb,var(--job-accent) 45%,#464f62); background: #10141c; }
.job-summary { width: 100%; padding: 9px 11px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.job-summary:focus-visible { outline: none; box-shadow: inset var(--focus); }
.job-top,.job-meta,.job-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.job-heading { min-width: 0; display: flex; align-items: center; gap: 6px; }
.job-type-label { flex: none; padding: 2px 5px; border-radius: 4px; background: color-mix(in srgb,var(--job-accent) 11%,transparent); color: var(--job-accent); font-size: 9px; font-weight: 800; letter-spacing: .05em; }
.job-title { overflow: hidden; font-size: 13px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.job-meta { color: var(--muted); font: 11px ui-monospace,monospace; }
.job-status { flex: none; padding: 3px 6px; border-radius: 6px; background: #272d39; color: #cbd5e1; font-size: 10px; font-weight: 750; }
.job-status.succeeded { background: rgba(74,222,128,.12); color: #86efac; }
.job-status.failed { background: rgba(251,113,133,.12); color: #fda4af; }
.job-status.running { background: rgba(139,92,246,.18); color: #c4b5fd; }
.job-meta { align-items: center; margin-top: 7px; }
.job-meta time { flex: none; color: #788294; font-size: 10px; }
.job-facts { min-width: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.job-facts span { min-height: 24px; display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; border: 1px solid color-mix(in srgb,var(--job-accent) 25%,var(--line)); border-radius: 6px; background: color-mix(in srgb,var(--job-accent) 7%,#0a0d13); color: #bac2d0; font-size: 10px; font-weight: 700; white-space: nowrap; }
.job-facts svg { width: 12px; height: 12px; color: var(--job-accent); }
.job-progress { margin-top: 9px; }
.job-progress-copy { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 5px; color: #aeb7c8; font-size: 10px; line-height: 1.3; }
.job-progress-copy span:last-child { color: #8f99aa; text-align: right; }
.job-progress-track { height: 4px; border-radius: 999px; background: rgba(148,163,184,.12); overflow: hidden; }
.job-progress-track span { display: block; width: 6%; height: 100%; border-radius: inherit; background: rgba(167,139,250,.58); transition: width 1s ease-out; }
.job-progress.queued .job-progress-track span { width: 20%; animation: queue-progress 1.8s ease-in-out infinite alternate; }
@keyframes queue-progress { from { transform: translateX(-35%); opacity: .45; } to { transform: translateX(435%); opacity: .8; } }
.dialog-open { overflow: hidden; }
.job-detail-dialog { width: min(620px,100vw); max-width: none; height: 100dvh; max-height: none; padding: 0; margin: 0 0 0 auto; border: 0; border-left: 1px solid #343b49; background: #0d1017; color: var(--text); box-shadow: -28px 0 80px rgba(0,0,0,.55); overflow: hidden; }
.job-detail-dialog[open] { animation: detail-enter .24s ease-out; }
.job-detail-dialog::backdrop { background: rgba(2,4,8,.66); backdrop-filter: blur(3px); }
@keyframes detail-enter { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.detail-shell { height: 100%; display: grid; grid-template-rows: auto minmax(0,1fr) auto; }
.detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 26px 28px 20px; border-bottom: 1px solid var(--line); background: rgba(16,19,26,.95); }
.detail-kicker { margin: 0 0 4px; color: #b59cff; font-size: 11px; font-weight: 750; letter-spacing: .13em; }
.detail-header h2 { margin: 0; font-size: 25px; letter-spacing: -.03em; }
.detail-id { margin: 5px 0 0; color: #798395; font: 11px/1.4 ui-monospace,monospace; overflow-wrap: anywhere; }
.detail-close { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-3); color: var(--muted); cursor: pointer; }
.detail-close:hover { border-color: #4b5568; color: var(--text); }
.detail-content { padding: 24px 28px 40px; overflow-y: auto; overscroll-behavior: contain; }
.detail-overview { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px; border: 1px solid #383044; border-radius: 12px; background: linear-gradient(135deg,rgba(124,58,237,.13),rgba(17,20,28,.4)); }
.detail-overview > div:first-child { display: flex; align-items: center; gap: 10px; }
.detail-overview p { margin: 0; color: #cfd4de; font-size: 13px; font-weight: 650; }
.detail-total { text-align: right; }
.detail-total span { display: block; color: var(--muted); font-size: 11px; }
.detail-total strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.detail-section { margin-top: 26px; }
.detail-section h3 { margin: 0 0 11px; color: #aeb7c8; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.detail-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.detail-section-heading h3 { margin-bottom: 0; }
.detail-section-heading > span { color: #737d8f; font: 10px ui-monospace,monospace; }
.detail-timeline { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.timeline-item { min-width: 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; background: #0a0d13; }
.timeline-label { display: flex; align-items: center; gap: 6px; color: #aeb7c8; }
.timeline-marker { flex: none; width: 7px; height: 7px; border: 1px solid #525d70; border-radius: 50%; background: #0d1017; }
.timeline-item.complete .timeline-marker { border-color: #9b7bf2; background: #9b7bf2; box-shadow: 0 0 0 3px rgba(139,92,246,.09); }
.timeline-item.failed .timeline-marker { border-color: var(--danger); background: var(--danger); }
.timeline-item b { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.timeline-item strong { display: block; margin-top: 5px; font: 700 14px/1.3 ui-monospace,monospace; font-variant-numeric: tabular-nums; }
.timeline-item small { display: block; margin-top: 2px; overflow: hidden; color: #7f899b; font-size: 10px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.detail-prompt { max-height: 168px; padding: 14px 15px; border: 1px solid var(--line); border-radius: 10px; background: #090c11; color: #d8dce5; font-size: 13px; line-height: 1.65; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 0; }
.detail-grid > div { min-width: 0; padding: 12px 13px; border: 1px solid var(--line); border-radius: 9px; background: #0a0d13; }
.detail-grid dt { color: var(--muted); font-size: 11px; }
.detail-grid dd { margin: 3px 0 0; color: #e8ebf1; font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }
.asset-list { display: grid; gap: 8px; }
.asset-empty { padding: 16px; border: 1px dashed var(--line); border-radius: 9px; color: var(--muted); font-size: 12px; text-align: center; }
.result-media-preview { position: relative; width: 100%; aspect-ratio: 16/6.3; display: block; padding: 0; border: 1px solid #3c4557; border-radius: 11px; color: white; cursor: pointer; overflow: hidden; text-align: left; }
.result-media-video { width: 100%; aspect-ratio: 16/9; display: block; border: 1px solid #3c4557; border-radius: 11px; background: #05070a; object-fit: contain; }
.result-media-preview::after { content: ''; position: absolute; inset: 35% 0 0; background: linear-gradient(transparent,rgba(4,6,11,.88)); }
.media-play { position: absolute; z-index: 2; left: 50%; top: 50%; width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.48); border-radius: 50%; background: rgba(7,9,14,.72); color: white; transform: translate(-50%,-50%); backdrop-filter: blur(6px); }
.media-play svg { width: 22px; height: 22px; margin-left: 2px; }
.result-media-copy { position: absolute; z-index: 2; left: 15px; right: 15px; bottom: 12px; display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.result-media-copy b { font-size: 13px; }
.result-media-copy small { color: rgba(255,255,255,.72); font-size: 10px; }
.asset-row { min-height: 68px; display: grid; grid-template-columns: 38px minmax(0,1fr) auto; gap: 11px; align-items: center; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: #0a0d13; }
.asset-row:has(.asset-thumb) { grid-template-columns: 76px minmax(0,1fr) auto; }
.asset-thumb { position: relative; width: 76px; height: 48px; display: block; border-radius: 6px; overflow: hidden; background: #05070a; box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); object-fit: cover; }
.asset-thumb i { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(4,6,11,.22); }
.asset-thumb i svg { width: 21px; height: 21px; color: white; }
.asset-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; background: #1c202b; color: #bdaaf7; }
.asset-icon svg { width: 19px; height: 19px; }
.asset-row b,.asset-row small { display: block; overflow-wrap: anywhere; }
.asset-row b { font-size: 13px; }
.asset-row small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.asset-download { min-width: 96px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 10px; border: 1px solid #3c4557; border-radius: 8px; background: #111620; color: #c4b5fd; font: 700 11px/1 ui-sans-serif,system-ui,sans-serif; cursor: pointer; white-space: nowrap; }
.asset-download:hover:not(:disabled) { border-color: #69539b; background: #1d1830; }
.asset-download:focus-visible { outline: none; box-shadow: var(--focus); }
.asset-download:disabled { color: #687285; cursor: not-allowed; opacity: .62; }
.asset-download svg { width: 16px; height: 16px; }
.detail-failure { padding: 13px 14px; border: 1px solid rgba(251,113,133,.25); border-radius: 9px; background: rgba(251,113,133,.07); }
.detail-failure h3 { color: #fda4af; }
.detail-failure p { margin: 0; color: #fecdd3; font-size: 13px; }
.detail-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 28px max(16px,env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(16,19,26,.98); }
.detail-export-message { max-width: 235px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.detail-actions { display: flex; gap: 8px; }
.detail-export { display: inline-flex; align-items: center; gap: 7px; }
.detail-export svg { width: 17px; height: 17px; }
.detail-loading { display: grid; gap: 12px; }
.detail-loading span { height: 84px; border-radius: 10px; background: linear-gradient(90deg,#151923 25%,#202531 50%,#151923 75%); background-size: 200% 100%; animation: detail-shimmer 1.4s infinite; }
@keyframes detail-shimmer { to { background-position: -200% 0; } }
.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; }
[hidden] { display: none !important; }
@media (max-width: 850px) {
  main { padding-top: 44px; }
  .token-panel { grid-template-columns: 1fr; }
  .token-controls { max-width: none; }
  .work-grid { grid-template-columns: 1fr; }
  .jobs-panel { position: static; max-height: none; }
  .jobs { max-height: 360px; }
}
@media (max-width: 680px) {
  .parameter-row { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topbar { padding: 0 16px; }
  .token-state span:last-child { display: none; }
  main { padding: 36px 16px 60px; }
  .hero h1 { font-size: 41px; }
  .panel,.token-panel { padding: 18px; }
  .token-controls { flex-direction: column; }
  .tabs { display: flex; }
  .tab { flex: 1; padding: 0 12px; }
  .choice-grid.models { grid-template-columns: 1fr; }
  .choice-grid.generation-modes,.upload-grid { grid-template-columns: 1fr; }
  .choice-grid.generation-resolutions { grid-template-columns: 1fr 1fr; }
  .choice span { min-height: 64px; }
  .compact-choices .choice span { min-height: 56px; }
  .crop-dialog { padding: 16px; }
  .crop-stage { min-height: 190px; padding: 7px; }
  .crop-actions .button { flex: 1; padding: 0 10px; }
  .job-detail-dialog { width: 100vw; border-left: 0; }
  .detail-header { padding: 20px 18px 16px; }
  .detail-content { padding: 18px 18px 32px; }
  .detail-footer { align-items: stretch; flex-direction: column; padding: 12px 18px max(12px,env(safe-area-inset-bottom)); }
  .detail-export-message { max-width: none; }
  .detail-actions .button { flex: 1; padding: 0 10px; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .detail-timeline { gap: 5px; }
  .timeline-item { padding: 9px 8px; }
  .timeline-item strong { font-size: 12px; }
  .asset-row,.asset-row:has(.asset-thumb) { grid-template-columns: 64px minmax(0,1fr); }
  .asset-thumb { width: 64px; height: 44px; }
  .asset-download { grid-column: 2; min-width: 0; width: fit-content; }
  .result-media-preview { aspect-ratio: 16/8.2; }
  .result-media-copy { display: block; }
  .result-media-copy small { display: block; margin-top: 2px; }
  .video-input-preview { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
  .job-progress.queued .job-progress-track span { animation: none; transform: none; opacity: .65; }
  .job-detail-dialog[open],.detail-loading span { animation: none; }
}
