/* ==========================================================================
   Studio stylesheet — "Screening Room"
   Curtain-black stage, warm screen-white text, one tungsten accent.
   The single expressive element is the video workbench: the first-frame
   slot is a viewfinder and the duration picker is a strip of film.
   ========================================================================== */

:root {
  --bg: #121016;
  --well: #0c0a0f;
  --surface: #1a171f;
  --surface-2: #231f29;
  --surface-3: #2b2632;
  --line: #2f2a36;
  --line-strong: #433c4c;

  --text: #ede7dc;
  --text-2: #b5aea4;
  --text-3: #7f7882;

  --lamp: #f2a93b;
  --lamp-hover: #f7bd62;
  --lamp-ink: #1d1407;
  --lamp-soft: rgba(242, 169, 59, 0.13);
  --lamp-line: rgba(242, 169, 59, 0.45);

  --rec: #e5553f;
  --rec-soft: rgba(229, 85, 63, 0.13);
  --ok: #8cc595;
  --ok-soft: rgba(140, 197, 149, 0.13);

  --r-panel: 10px;
  --r-btn: 8px;
  --r-frame: 4px;

  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei",
    "Noto Sans CJK SC", "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-code: ui-monospace, "Cascadia Code", "SFMono-Regular", Menlo, Consolas, monospace;

  --page-max: 1240px;
  --gutter: clamp(16px, 3vw, 32px);
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; width: 100%; }

h1, h2 { margin: 0; font-weight: 600; line-height: 1.3; letter-spacing: 0; }
p { margin: 0; }
img, video { max-width: 100%; display: block; }

a { color: var(--lamp); text-decoration: none; }
a:hover { color: var(--lamp-hover); }

:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; border-radius: 4px; }

::selection { background: var(--lamp); color: var(--lamp-ink); }

code {
  font-family: var(--font-code);
  font-size: 0.88em;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text);
  overflow-wrap: anywhere;
}

.small { font-size: 12.5px; }
.muted { color: var(--text-2); }
.text-green { color: var(--ok); }
.text-amber { color: var(--lamp); }
.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.error { color: inherit; }
.notice { color: inherit; }

/* ---------- Form controls ---------- */

input, select, textarea, button { font: inherit; color: inherit; }

input[type="text"], input[type="number"], input[type="password"], input:not([type]),
select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea { resize: vertical; line-height: 1.65; }

input::placeholder, textarea::placeholder { color: var(--text-3); }

input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--lamp-line);
  box-shadow: 0 0 0 3px var(--lamp-soft);
}

select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23b5aea4' stroke-width='2.4'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
}

.form-field, .form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}

.form-field > span, .form-group > span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.field-hint { font-size: 12px; color: var(--text-3); }

/* ---------- Buttons ---------- */

.studio-submit-btn, .action-btn, .studio-new-btn, .nav-signin-btn, .load-more-btn,
.tool-btn, .copy-btn, .credits-pop-cta, .dialog-close-btn, .card-del-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--r-btn);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.studio-submit-btn, .studio-new-btn, .nav-signin-btn {
  min-height: 40px;
  padding: 0 20px;
  background: var(--lamp);
  color: var(--lamp-ink);
  font-weight: 600;
}

.studio-submit-btn:hover, .studio-new-btn:hover, .nav-signin-btn:hover {
  background: var(--lamp-hover);
  color: var(--lamp-ink);
}

.studio-submit-btn:disabled {
  background: var(--surface-3);
  color: var(--text-3);
  cursor: not-allowed;
}

.action-btn {
  min-height: 36px;
  padding: 0 14px;
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
  font-weight: 500;
}

.action-btn:hover { border-color: var(--line-strong); background: var(--surface-3); color: var(--text); }

.action-btn.primary-btn { background: var(--lamp); border-color: var(--lamp); color: var(--lamp-ink); font-weight: 600; }
.action-btn.primary-btn:hover { background: var(--lamp-hover); border-color: var(--lamp-hover); }

.action-btn.outline-btn, .action-btn.secondary-btn { background: transparent; }

.action-btn.danger-btn { background: transparent; color: var(--rec); border-color: rgba(229, 85, 63, 0.35); }
.action-btn.danger-btn:hover { background: var(--rec-soft); border-color: var(--rec); color: var(--rec); }

.action-btn.small { min-height: 30px; padding: 0 10px; font-size: 12.5px; }

.tool-btn, .copy-btn {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12.5px;
  background: transparent;
  border-color: var(--line);
  color: var(--text-2);
}

.tool-btn:hover, .copy-btn:hover { color: var(--text); border-color: var(--line-strong); }

.load-more-btn {
  min-height: 40px;
  padding: 0 22px;
  background: transparent;
  border-color: var(--line);
  color: var(--text-2);
}

.load-more-btn:hover { color: var(--text); border-color: var(--line-strong); }

.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; }

.loading-spinner { align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }

.spin-svg { width: 16px; height: 16px; animation: spin 0.9s linear infinite; }
.spin-svg .path { stroke: var(--lamp); stroke-linecap: round; stroke-dasharray: 90 150; }
.spin-icon { animation: spin 1.4s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Banners, badges ---------- */

.banner-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-btn);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.55;
}

.banner-notice svg { flex: none; margin-top: 3px; }
.banner-notice.success { border-color: rgba(140, 197, 149, 0.35); background: var(--ok-soft); }
.banner-notice.warning { border-color: var(--lamp-line); background: var(--lamp-soft); }
.banner-notice.error { border-color: rgba(229, 85, 63, 0.4); background: var(--rec-soft); }
.banner-notice.small { font-size: 12.5px; padding: 8px 12px; }
.banner-notice a { font-weight: 500; }

.badge, .meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge.ok { color: var(--ok); border-color: rgba(140, 197, 149, 0.35); background: var(--ok-soft); }
.badge.off { color: var(--text-3); }

/* ==========================================================================
   Header
   ========================================================================== */

.top {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
  padding: 0 var(--gutter);
  background: rgba(18, 16, 22, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.top-left { display: flex; align-items: center; gap: 28px; min-width: 0; height: 100%; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); flex: none; }
.brand:hover { color: var(--text); }

.brand-logo { display: inline-flex; color: var(--lamp); }

.brand-name { font-size: 16px; font-weight: 600; }

.tabs { display: flex; align-items: stretch; gap: 4px; height: 100%; }

.tabs a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  color: var(--text-2);
  font-weight: 500;
  white-space: nowrap;
}

.tabs a svg { opacity: 0.7; }
.tabs a:hover { color: var(--text); }

.tabs a.active { color: var(--text); }
.tabs a.active svg { opacity: 1; color: var(--lamp); }
.tabs a.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  background: var(--lamp);
}

.top-right { display: flex; align-items: center; gap: 10px; flex: none; }

/* Credits chip */
#credits-chip { position: relative; }

.credits-details > summary { list-style: none; }
.credits-details > summary::-webkit-details-marker { display: none; }

.credits-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
}

.credits-pill svg { color: var(--lamp); }
.credits-pill:hover { border-color: var(--line-strong); }
.credits-pill.warn { border-color: var(--lamp-line); }

.credits-num { font-weight: 600; font-variant-numeric: tabular-nums; }
.credits-lbl { color: var(--text-2); font-size: 12.5px; }

.credits-exp-dot {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--lamp);
  color: var(--lamp-ink);
  font-size: 11px;
  font-weight: 700;
}

.credits-popover, .account-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 260px;
  padding: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-panel);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  z-index: 60;
}

.credits-pop-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 8px;
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.credits-pop-row strong, .credits-pop-row span:last-child { color: var(--text); }
.credits-pop-row:first-child { border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 4px; }
.credits-pop-row.text-amber span { color: var(--lamp); }

.credits-pop-cta {
  width: 100%;
  margin-top: 6px;
  min-height: 34px;
  background: var(--lamp-soft);
  border-color: var(--lamp-line);
  color: var(--lamp);
  font-weight: 500;
}

.credits-pop-cta:hover { background: var(--lamp); color: var(--lamp-ink); }

/* Account dropdown */
.account-dropdown { position: relative; }
.account-dropdown > summary { list-style: none; }
.account-dropdown > summary::-webkit-details-marker { display: none; }

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px 0 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  cursor: pointer;
}

.user-pill:hover { border-color: var(--line-strong); }

.user-avatar {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--lamp);
  font-size: 12px;
  font-weight: 600;
}

.user-name { font-size: 13px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.account-dropdown-menu { min-width: 200px; }
.account-dropdown-menu form { margin: 0; }

.account-dropdown-email {
  padding: 6px 10px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  color: var(--text-3);
  font-size: 12.5px;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-size: 13.5px;
}

.dropdown-item:hover { background: var(--surface-3); color: var(--text); }

/* ==========================================================================
   Page scaffolding
   ========================================================================== */

.page {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 32px var(--gutter) 64px;
}

.page-narrow { max-width: 1040px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.page-title { font-size: 28px; font-weight: 600; }
.page-sub { margin-top: 6px; color: var(--text-2); max-width: 64ch; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: 24px;
}

.panel + .panel { margin-top: 20px; }

.panel-title { font-size: 16px; font-weight: 600; }
.panel-sub { margin-top: 4px; color: var(--text-2); font-size: 13px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

.stack-sm > * + * { margin-top: 8px; }

/* ---------- Tables ---------- */

.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

th {
  padding: 8px 12px;
  text-align: left;
  font-weight: 500;
  font-size: 12.5px;
  color: var(--text-3);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

.table-scroll td { white-space: nowrap; }
.table-scroll td.td-wrap { white-space: normal; min-width: 220px; max-width: 340px; overflow-wrap: anywhere; }

tr:last-child td { border-bottom: 0; }
td.actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Empty state ---------- */

.studio-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-panel);
  text-align: center;
  color: var(--text-2);
}

.empty-icon { color: var(--text-3); }
.empty-sub { max-width: 40ch; }
.grid-span-all { grid-column: 1 / -1; }

/* ==========================================================================
   Video workbench (the expressive part)
   ========================================================================== */

.studio-workbench { margin-bottom: 40px; }

.workbench-header { margin-bottom: 20px; }
.workbench-title { font-size: 28px; font-weight: 600; }
.workbench-subtitle { margin-top: 6px; color: var(--text-2); max-width: 64ch; }

.studio-workbench > .banner-notice { margin-bottom: 16px; }

.studio-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
}

.video-input-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
}

.upload-panel { padding: 24px; border-right: 1px solid var(--line); }
.prompt-panel { padding: 24px; min-width: 0; }

.prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
  margin-bottom: 12px;
}

.prompt-label, .control-label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.prompt-tools { display: flex; gap: 8px; }
.prompt-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* Viewfinder */
.viewfinder {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--well);
  border-radius: var(--r-frame);
  overflow: hidden;
}

.viewfinder::before {
  /* 90% safe area */
  content: "";
  position: absolute;
  inset: 5%;
  border: 1px dashed rgba(237, 231, 220, 0.12);
  pointer-events: none;
  z-index: 2;
}

.vf-corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: var(--text-2);
  border-style: solid;
  border-width: 0;
  pointer-events: none;
  z-index: 3;
}

.vf-tl { top: 12px; left: 12px; border-top-width: 2px; border-left-width: 2px; }
.vf-tr { top: 12px; right: 12px; border-top-width: 2px; border-right-width: 2px; }
.vf-bl { bottom: 12px; left: 12px; border-bottom-width: 2px; border-left-width: 2px; }
.vf-br { bottom: 12px; right: 12px; border-bottom-width: 2px; border-right-width: 2px; }

.viewfinder.has-frame .vf-corner { border-color: var(--lamp); }
.viewfinder.dragover { outline: 2px solid var(--lamp); outline-offset: -2px; }
.viewfinder.dragover .vf-corner { border-color: var(--lamp); }
.viewfinder.is-invalid { outline: 2px solid rgba(229, 85, 63, 0.85); outline-offset: -2px; }
.viewfinder.is-invalid .vf-corner { border-color: rgba(229, 85, 63, 0.9); }

.dropzone-box {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 1;
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 32ch;
  padding: 0 24px;
  text-align: center;
  color: var(--text-2);
  font-size: 13px;
}

.upload-placeholder svg { color: var(--text-3); }
.dropzone-box:hover .upload-placeholder svg { color: var(--lamp); }

.local-upload-preview, .source-job-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.source-job-preview { position: absolute; inset: 0; z-index: 1; }

.vf-hud {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.vf-hud strong { color: var(--text); font-weight: 500; }

/* Prompt */
.prompt-input-wrapper textarea { min-height: 150px; }

.motion-pills-block { margin-top: 18px; }
.motion-pills-block .control-label { margin-bottom: 10px; }

.motion-pills-row { display: flex; flex-wrap: wrap; gap: 8px; }

.motion-pill-btn {
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.motion-pill-btn:hover { color: var(--text); border-color: var(--lamp-line); }
.motion-pill-btn::before { content: "+ "; color: var(--text-3); }

/* Film-strip duration timeline */
.spec-bar-row { margin-top: 24px; }

.timeline-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.timeline-readout { display: flex; align-items: baseline; gap: 10px; font-variant-numeric: tabular-nums; }
.timecode { font-size: 20px; font-weight: 600; color: var(--lamp); letter-spacing: 0.02em; }
.timeline-frames { font-size: 12.5px; color: var(--text-3); }

.film-strip {
  position: relative;
  padding: 9px 0;
  background:
    radial-gradient(circle, var(--bg) 2.1px, transparent 2.6px) 0 2px / 12px 5px repeat-x,
    radial-gradient(circle, var(--bg) 2.1px, transparent 2.6px) 0 calc(100% - 2px) / 12px 5px repeat-x,
    var(--surface-3);
  border-radius: 3px;
}

.duration-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
}

.duration-option {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  height: 40px;
  padding: 0 8px 5px;
  border: 0;
  border-radius: 2px;
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(0, 0, 0, 0.35) calc(50% - 1px), rgba(0, 0, 0, 0.35) 50%, transparent 50%),
    var(--well);
  color: var(--text-3);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.duration-option:hover { color: var(--text); }

.duration-option.in-range {
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(29, 20, 7, 0.25) calc(50% - 1px), rgba(29, 20, 7, 0.25) 50%, transparent 50%),
    var(--lamp);
  color: var(--lamp-ink);
}

.duration-option.active { box-shadow: inset -3px 0 0 var(--lamp-ink); }

.duration-val { font-size: 12.5px; font-weight: 600; }
.duration-cost { display: none; }

.timeline-scale {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.timeline-scale span { text-align: right; padding-right: 2px; }

.output-spec-box { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 12.5px; color: var(--text-2); }
.output-spec-box .control-label { font-size: 12.5px; font-weight: 500; color: var(--text-3); }
.output-spec-pill { color: var(--text-2); }

/* Submit bar */
.submit-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-panel) var(--r-panel);
}

.submit-cost { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; min-width: 0; }
.submit-cost-num { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.submit-cost-unit { font-size: 13px; color: var(--text-2); margin-left: 4px; font-weight: 500; }
.submit-tips { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); }

.submit-btn-group { display: flex; align-items: center; gap: 14px; }
.submit-btn-group .studio-submit-btn { min-height: 44px; padding: 0 28px; font-size: 15px; }

.submit-lock {
  padding: 12px 24px;
  border-top: 1px solid var(--line);
}

.submit-lock[hidden] { display: none; }

.submit-lock .banner-notice { margin: 0; }

/* ==========================================================================
   Recent + gallery grid, cards
   ========================================================================== */

.studio-section { margin-top: 8px; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-title { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 600; }
.section-title svg { color: var(--text-3); }

.section-action-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-2); }
.section-action-link:hover { color: var(--lamp); }

.studio-section > .banner-notice { margin-bottom: 16px; }

.tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 20px;
}

.tile { min-width: 0; }

.card-clickable {
  display: block;
  height: 100%;
  cursor: pointer;
  border-radius: var(--r-frame);
}

.card-media-box {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--r-frame);
  overflow: hidden;
  outline: 1px solid var(--line);
  outline-offset: -1px;
}

.media-thumb { width: 100%; height: 100%; object-fit: contain; }

.media-hover-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(12, 10, 15, 0.55);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.card-clickable:hover .media-hover-overlay,
.card-clickable:focus-visible .media-hover-overlay { opacity: 1; }

.hover-view-btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(237, 231, 220, 0.5);
  font-size: 12.5px;
  color: var(--text);
}

.media-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  background: var(--well);
  color: var(--text-3);
  font-size: 12.5px;
  text-align: center;
}

.media-placeholder.generating { color: var(--text-2); }
.media-placeholder.generating svg { color: var(--lamp); }
.media-placeholder.failed svg { color: var(--rec); }

.card-badges {
  position: absolute;
  inset: 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
  pointer-events: none;
}

.card-ratio-pill { margin-left: auto; align-self: flex-end; }

.card-status-pill, .card-ratio-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(12, 10, 15, 0.78);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.card-status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-3);
}

.pill-running::before { background: var(--rec); animation: rec 1.4s ease-in-out infinite; }
.pill-queued::before { background: var(--lamp); }
.pill-succeeded::before { background: var(--ok); }
.pill-failed { color: var(--rec); }
.pill-failed::before { background: var(--rec); }
.pill-succeeded { display: none; }

@keyframes rec { 50% { opacity: 0.25; } }

.card-meta { padding: 10px 2px 0; }

.card-prompt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.9em;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text);
}

.card-footer-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.card-footer-right { display: flex; align-items: center; gap: 6px; }
.card-model-tag { color: var(--text-3); }
.card-time { color: var(--text-3); font-size: 12px; }

.card-del-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  background: transparent;
  color: var(--text-3);
  border-radius: 6px;
}

.card-del-btn:hover { color: var(--rec); background: var(--rec-soft); }

.pulse-text { animation: rec 2s ease-in-out infinite; }

.more-container { display: flex; justify-content: center; padding-top: 8px; }

/* Gallery page */
.gallery-container {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 32px var(--gutter) 64px;
}

.gallery-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.gallery-title { font-size: 28px; font-weight: 600; }
.gallery-meta { margin-top: 6px; color: var(--text-2); }
.gallery-title-group .small { margin-top: 2px; color: var(--text-3); }

.gallery-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.gallery-filter-pills { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }

.filter-pill {
  padding: 5px 14px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
}

.filter-pill:hover { color: var(--text); }
.filter-pill.active { background: var(--surface-3); color: var(--text); }

/* ==========================================================================
   Detail dialog
   ========================================================================== */

.detail-dialog {
  width: min(1080px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-panel);
  background: var(--surface);
  color: var(--text);
  overflow: hidden;
}

.detail-dialog::backdrop { background: rgba(6, 5, 8, 0.78); }

.dialog-inner { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 12px 20px;
  border-bottom: 1px solid var(--line);
}

.dialog-title { font-weight: 600; }
.dialog-close-form { margin: 0; }

.dialog-close-btn {
  width: 34px;
  height: 34px;
  background: transparent;
  color: var(--text-2);
}

.dialog-close-btn:hover { background: var(--surface-3); color: var(--text); }

#detail-body { overflow-y: auto; }

.studio-detail-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
  min-height: 420px;
}

.detail-viewer {
  display: grid;
  place-items: center;
  background: #000;
  min-height: 320px;
}

.detail-image-wrap { width: 100%; height: 100%; display: grid; place-items: center; }
.detail-image-wrap video { width: 100%; max-height: 72vh; object-fit: contain; background: #000; }

.detail-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px;
  text-align: center;
  color: var(--text-2);
}

.detail-placeholder svg { color: var(--text-3); margin-bottom: 4px; }
.detail-placeholder.generating svg { color: var(--lamp); }
.detail-placeholder.failed svg { color: var(--rec); }
.detail-placeholder.generating .detail-preview-bg { opacity: 0.45; }
.generating-text { font-weight: 600; color: var(--text); }

.detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border-left: 1px solid var(--line);
  min-width: 0;
}

.detail-status-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.detail-badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 500;
}

.detail-badge-status.succeeded { color: var(--ok); border-color: rgba(140, 197, 149, 0.35); }
.detail-badge-status.running { color: var(--rec); border-color: rgba(229, 85, 63, 0.35); }
.detail-badge-status.queued { color: var(--lamp); border-color: var(--lamp-line); }
.detail-badge-status.failed { color: var(--rec); }
.queue-tip { font-size: 12.5px; }

.prompt-meta-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.prompt-meta-title { font-size: 12.5px; color: var(--text-3); font-weight: 500; }

.prompt-meta-content {
  max-height: 160px;
  overflow-y: auto;
  padding: 10px 12px;
  background: var(--well);
  border-radius: var(--r-btn);
  font-size: 13.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.detail-spec-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  margin: 0;
  font-size: 13px;
}

.spec-label { color: var(--text-3); }
.spec-value { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.detail-actions .primary-btn { flex: 1 1 100%; min-height: 40px; }

.report-details { width: 100%; }

.report-summary {
  display: inline-block;
  padding: 4px 0;
  color: var(--text-3);
  font-size: 12.5px;
  cursor: pointer;
}

.report-summary:hover { color: var(--text-2); }
.report-form { display: grid; gap: 8px; margin-top: 8px; }

.admin-diag-error {
  padding: 10px 12px;
  border: 1px solid rgba(229, 85, 63, 0.35);
  border-radius: var(--r-btn);
  background: var(--rec-soft);
  font-size: 12px;
}

.admin-diag-error pre { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-code); }

/* ==========================================================================
   Login
   ========================================================================== */

.login-main { display: flex; }

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  align-items: center;
  gap: 48px 72px;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 64px var(--gutter);
}

.login-kicker { display: inline-block; color: var(--lamp); font-size: 13px; font-weight: 500; margin-bottom: 16px; }
.login-heading { font-size: clamp(28px, 3.4vw, 40px); font-weight: 600; line-height: 1.25; max-width: 18em; }
.login-subtext { margin-top: 16px; color: var(--text-2); font-size: 15px; max-width: 46ch; }

.login-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  margin: 36px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  max-width: 560px;
}

.login-steps li {
  counter-increment: step;
  padding: 14px 14px 12px;
  background: var(--surface);
  font-size: 13px;
  color: var(--text-2);
}

.login-steps li:first-child { border-radius: var(--r-frame) 0 0 var(--r-frame); }
.login-steps li:last-child { border-radius: 0 var(--r-frame) var(--r-frame) 0; }

.login-steps li::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  margin-bottom: 6px;
  color: var(--lamp);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.login-card {
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  margin-bottom: 22px;
  background: var(--well);
  border-radius: var(--r-btn);
}

.auth-tab {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  cursor: pointer;
}

.auth-tab:hover { color: var(--text); }
.auth-tab.active { background: var(--surface-3); color: var(--text); font-weight: 500; }

.auth-panel { display: flex; flex-direction: column; gap: 16px; }
.auth-submit { width: 100%; min-height: 44px; margin-top: 4px; font-size: 15px; }

.invite-security-warn {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--lamp-line);
  border-radius: var(--r-btn);
  background: var(--lamp-soft);
  font-size: 12.5px;
  line-height: 1.6;
}

.invite-security-warn strong {
  flex: none;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--lamp);
  color: var(--lamp-ink);
  font-size: 12px;
}

.auth-legal { margin-top: 20px; font-size: 12.5px; color: var(--text-3); line-height: 1.6; }
.auth-waitlist { margin-top: 12px; font-size: 13px; }
.login-card > .banner-notice { margin-bottom: 16px; }

/* ==========================================================================
   Billing
   ========================================================================== */

.commercial-wrap {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px var(--gutter) 64px;
}

.commercial-wrap > .workbench-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.commercial-wrap > .banner-notice { margin-bottom: 16px; }

.card, .commercial-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: 24px;
}

.commercial-card + .commercial-card, .billing-top-grid + .commercial-card { margin-top: 20px; }

.card-heading { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.card-heading + .small { margin-bottom: 16px; }

.billing-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 20px;
}

.big-balance {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 12px 0 16px;
  font-size: 40px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.big-balance .small { font-size: 14px; font-weight: 500; }

.balance-bar {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--well);
}

.balance-bar span { display: block; height: 100%; }
.bal-trial { background: var(--ok); }
.bal-paid { background: var(--lamp); }
.bal-held { background: repeating-linear-gradient(135deg, var(--text-3) 0 3px, transparent 3px 6px); }

.balance-pills-row { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; }
.balance-pills-row .meta-chip { padding: 0; border: 0; background: none; font-size: 12.5px; color: var(--text-2); }
.balance-pills-row .meta-chip::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--text-3); }
.balance-pills-row .chip-trial::before { background: var(--ok); }
.balance-pills-row .chip-paid::before { background: var(--lamp); }
.balance-pills-row .chip-held::before { background: repeating-linear-gradient(135deg, var(--text-3) 0 2px, transparent 2px 4px); }

.billing-top-grid .banner-notice { margin-top: 14px; }

.cdk-redeem-form { display: flex; gap: 10px; }
.cdk-redeem-form input { flex: 1; min-width: 0; font-family: var(--font-code); letter-spacing: 0.04em; }
.cdk-redeem-form button { flex: none; }

.packages-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.package-tier-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  background: var(--surface-2);
}

.package-tier-card.featured { border-color: var(--lamp-line); box-shadow: inset 0 3px 0 var(--lamp); }

.pkg-name { font-size: 13px; color: var(--text-2); font-weight: 500; }
.pkg-credits { margin-top: 8px; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.pkg-credits span { font-size: 13px; color: var(--text-2); font-weight: 500; }
.pkg-approx { font-size: 12.5px; color: var(--text-3); }
.pkg-price { margin-top: 12px; font-size: 20px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.package-tier-card.featured .pkg-price { color: var(--lamp); }
.pkg-meta { font-size: 12px; color: var(--text-3); }
.pkg-buy-btn { margin-top: 14px; width: 100%; }

.danger-zone-card { border-color: rgba(229, 85, 63, 0.3); }
.danger-zone-card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.danger-zone-card > summary::-webkit-details-marker { display: none; }
.danger-zone-card > summary .card-heading { margin: 0; color: var(--text-2); font-weight: 500; font-size: 14px; }
.danger-zone-card > summary::after { content: "+"; color: var(--text-3); font-size: 18px; }
.danger-zone-card[open] > summary::after { content: "–"; }
.danger-zone-card .danger-body { margin-top: 14px; }
.delete-account-form { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.delete-account-form input { flex: 1 1 240px; }

/* ==========================================================================
   Developers
   ========================================================================== */

.key-reveal-card { border-color: var(--lamp-line); background: var(--lamp-soft); }
.key-reveal-card p { margin-bottom: 8px; }

.secret-line {
  padding: 10px 12px;
  background: var(--well);
  border-radius: var(--r-btn);
  overflow-x: auto;
}

.secret-line code { background: none; padding: 0; font-size: 13px; white-space: nowrap; }

.api-doc-block { margin-top: 24px; }
.api-doc-block h3 { margin: 0 0 10px; font-size: 14.5px; font-weight: 600; line-height: 1.3; letter-spacing: 0; display: flex; align-items: center; gap: 10px; }
.api-step-num {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  font-size: 12px;
  color: var(--lamp);
  font-variant-numeric: tabular-nums;
}
.api-doc-block p { margin-top: 10px; line-height: 1.8; }

.code-block {
  margin: 0;
  padding: 14px 16px;
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  overflow-x: auto;
  font-family: var(--font-code);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-2);
  white-space: pre;
}

/* ==========================================================================
   Legal
   ========================================================================== */

.legal-wrap { max-width: 760px; }
.legal-prose { color: var(--text-2); font-size: 15px; line-height: 1.85; }
.legal-prose p + p { margin-top: 14px; }

/* ==========================================================================
   Admin
   ========================================================================== */

.admin-wrap {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px var(--gutter) 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-wrap > .card > h2 { font-size: 16px; margin-bottom: 16px; }
.admin-wrap h3 { font-size: 14px; font-weight: 600; line-height: 1.3; letter-spacing: 0; margin: 20px 0 10px; color: var(--text-2); }

.admin-wrap .card.token { border-color: var(--lamp-line); background: var(--lamp-soft); display: grid; gap: 6px; }

.admin-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 10px;
}

.stat-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--r-btn);
}

.stat-num { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; color: var(--text-3); }

.admin-grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px 16px;
  align-items: end;
}

.admin-form-actions { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; }

.inline-search { display: flex; gap: 8px; max-width: 420px; }
.inline-search input { min-height: 36px; }

.admin-wrap td input { min-height: 32px; padding: 4px 8px; font-size: 13px; }
.admin-wrap .inline { flex-wrap: wrap; }
.admin-wrap td code { white-space: nowrap; }

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer { border-top: 1px solid var(--line); }

.site-footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 18px var(--gutter);
  font-size: 12.5px;
  color: var(--text-3);
}

.site-footer-links { display: flex; gap: 18px; }
.site-footer-links a { color: var(--text-3); }
.site-footer-links a:hover { color: var(--text); }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1080px) {
  .video-input-grid { grid-template-columns: 1fr; }
  .upload-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .studio-detail-panel { grid-template-columns: 1fr; }
  .detail-sidebar { border-left: 0; border-top: 1px solid var(--line); }
  .packages-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .top { height: auto; flex-wrap: wrap; gap: 0 10px; padding-top: 10px; }
  .top-left { display: contents; }
  .brand { order: 1; height: 36px; }
  .top-right { order: 2; height: 36px; gap: 8px; }
  .tabs {
    order: 3;
    flex: 1 1 100%;
    height: 44px;
    margin: 10px calc(-1 * var(--gutter)) 0;
    padding: 0 calc(var(--gutter) - 12px);
    overflow-x: auto;
    scrollbar-width: none;
    border-top: 1px solid var(--line);
  }
  .tabs::-webkit-scrollbar { display: none; }
  .login-shell { grid-template-columns: 1fr; padding-top: 40px; gap: 32px; }
  .billing-top-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .user-name, .credits-lbl { display: none; }
  .credits-popover { left: 0; right: auto; min-width: min(260px, calc(100vw - 24px)); }
  .page, .gallery-container, .commercial-wrap { padding-top: 22px; }
  .workbench-title, .gallery-title, .page-title { font-size: 22px; }
  .upload-panel, .prompt-panel { padding: 16px; }
  .panel, .card, .commercial-card, .login-card { padding: 18px; }
  .submit-action-bar { padding: 14px 16px; gap: 12px; }
  .submit-cost { width: 100%; justify-content: space-between; }
  .submit-btn-group { width: 100%; }
  .submit-btn-group .studio-submit-btn { flex: 1; padding: 0 16px; }
  .tiles-grid { grid-template-columns: 1fr; gap: 16px; }
  .packages-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .package-tier-card { padding: 14px; }
  .cdk-redeem-form { flex-direction: column; }
  .login-steps { grid-template-columns: 1fr; }
  .login-steps li, .login-steps li:first-child, .login-steps li:last-child { border-radius: 0; }
  .login-steps li:first-child { border-radius: var(--r-frame) var(--r-frame) 0 0; }
  .login-steps li:last-child { border-radius: 0 0 var(--r-frame) var(--r-frame); }
  .gallery-filter-pills { overflow-x: auto; max-width: 100%; }
  .detail-dialog { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; }
  .dialog-inner { max-height: 100vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Creation mode & aspect ratio controls */
.mode-switch-group {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: var(--r-btn);
  border: 1px solid var(--line);
  background: var(--well);
}
.mode-switch-btn {
  padding: 5px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}
.mode-switch-btn.active {
  background: var(--lamp);
  color: var(--lamp-ink);
  font-weight: 600;
}
.mode-sub-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-3);
}
.ref-multi-grid {
  position: absolute;
  inset: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 6px;
  overflow: hidden;
  z-index: 1;
}
.ref-thumb-item {
  position: relative;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.ref-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ref-thumb-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(12, 10, 15, 0.8);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
}
.keyframe-pair-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.keyframe-slot {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.keyframe-slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
}
.keyframe-dropzone {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-frame);
  background: var(--well);
  border: 1px dashed var(--line-strong);
  overflow: hidden;
  cursor: pointer;
}
.keyframe-dropzone.dragover {
  border-color: var(--lamp);
  outline: 2px solid var(--lamp);
  outline-offset: -2px;
}
.vf-aspect-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.aspect-pills-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.aspect-pill-btn {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
}
.aspect-pill-btn.active {
  border-color: var(--lamp-line);
  background: var(--lamp-soft);
  color: var(--lamp);
  font-weight: 600;
}
.media-placeholder.succeeded svg { color: var(--ok); }
.detail-refs-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.detail-ref-thumb {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
}
@media (max-width: 640px) {
  .keyframe-pair-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Concentrated floating video composer
   ========================================================================== */

.composer-page {
  padding-top: 28px;
}

.composer-stage {
  max-width: 860px;
  margin: 0 auto 44px;
}

.composer-hero {
  text-align: center;
  margin-bottom: 34px;
}

.composer-hero-title {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.composer-notices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.composer-notices:empty {
  display: none;
}

.composer-card {
  position: relative;
  z-index: 20;
  overflow: visible;
  display: flex;
  flex-direction: column;
  padding: 16px 20px 14px;
  background: #18161f;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.composer-card:focus-within {
  border-color: rgba(242, 169, 59, 0.42);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.52), 0 0 0 3px rgba(242, 169, 59, 0.10);
}

.composer-card.is-dragover {
  border-color: var(--lamp);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.52), 0 0 0 3px rgba(242, 169, 59, 0.22);
}

.composer-card.is-uploading .composer-media-dock {
  opacity: 0.72;
}

/* Top tilted media dock */
.composer-media-dock {
  margin-bottom: 10px;
}

.dock-panel {
  display: flex;
  align-items: flex-end;
}

.dock-tilt-card {
  appearance: none;
  font: inherit;
  padding: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 74px;
  height: 92px;
  margin-top: -28px;
  border-radius: 12px;
  background: #24212d;
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  color: var(--text-2);
  cursor: pointer;
  overflow: hidden;
  user-select: none;
  transform: rotate(-5deg);
  transition: transform 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.dock-tilt-card:hover {
  transform: rotate(0deg) translateY(-2px);
  border-color: var(--lamp-line);
  background: #2a2635;
  color: var(--text);
}

.dock-tilt-card.is-last {
  transform: rotate(4deg);
}

.dock-tilt-card.is-last:hover {
  transform: rotate(0deg) translateY(-2px);
}

.dock-tilt-card.has-preview {
  background: #0d0b11;
  border-color: rgba(255, 255, 255, 0.22);
}

.dock-tilt-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dock-frame-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.dock-card-plus {
  font-size: 18px;
  line-height: 1;
  font-weight: 500;
  color: var(--text);
}

.dock-card-title {
  font-size: 12px;
  font-weight: 500;
}

.dock-card-count {
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* Keyframes pair */
.dock-pair {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dock-frame-slot {
  position: relative;
  display: inline-flex;
}

.dock-swap-btn {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-top: -22px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #24212d;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.dock-swap-btn:hover:not(:disabled) {
  border-color: var(--lamp-line);
  background: #2d2938;
  color: var(--lamp);
}

.dock-swap-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Reference strip */
.dock-ref-strip-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.dock-ref-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}

.dock-ref-strip::-webkit-scrollbar {
  display: none;
}

.dock-thumb-card {
  position: relative;
  flex: none;
  width: 68px;
  height: 68px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #0d0b11;
  cursor: pointer;
}

.dock-thumb-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dock-thumb-tag {
  position: absolute;
  left: 4px;
  top: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(12, 10, 15, 0.82);
  color: var(--text);
  font-size: 10.5px;
  font-weight: 600;
  pointer-events: none;
}

.dock-thumb-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(12, 10, 15, 0.86);
  color: var(--text);
  font-size: 11px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0.9;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.dock-frame-slot .dock-thumb-del {
  top: -24px;
  right: 4px;
  z-index: 4;
}

.dock-thumb-del:hover {
  background: var(--rec);
  border-color: var(--rec);
  color: #fff;
}

.dock-add-tile {
  appearance: none;
  font: inherit;
  padding: 0;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.dock-add-tile:hover {
  border-color: var(--lamp-line);
  background: rgba(242, 169, 59, 0.08);
  color: var(--text);
}

.dock-add-plus {
  font-size: 18px;
  line-height: 1;
}

.dock-add-count {
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.dock-scroll-btn {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #24212d;
  color: var(--text-2);
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.dock-scroll-btn:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

/* Prompt textarea */
.composer-prompt-area {
  position: relative;
}

.composer-prompt-area textarea {
  width: 100%;
  min-height: 82px;
  max-height: 220px;
  padding: 2px 0 6px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  resize: none;
}

.composer-prompt-area textarea:hover,
.composer-prompt-area textarea:focus {
  border: 0;
  box-shadow: none;
  outline: none;
}

.composer-prompt-meta {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.composer-notices-inner .submit-lock {
  padding: 0 0 12px;
  border-top: 0;
}

/* Bottom integrated toolbar */
.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.toolbar-left,
.toolbar-tools,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.toolbar-pill:hover,
.toolbar-pill[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.18);
}

.toolbar-pill-icon {
  color: var(--text-2);
}

.toolbar-caret {
  color: var(--text-3);
}

.pill-sep {
  color: var(--text-3);
}

.ratio-mini-glyph {
  display: inline-block;
  width: 14px;
  height: 10px;
  border: 1.5px solid var(--text-2);
  border-radius: 2px;
}

.toolbar-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.toolbar-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--text);
}

.composer-cost-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 10px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.composer-cost-badge svg {
  color: var(--lamp);
}

.composer-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: #f4efe6;
  color: #121016;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, transform 0.12s ease, opacity 0.15s ease;
}

.composer-submit-btn:hover:not(:disabled) {
  background: #ffffff;
}

.composer-submit-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.composer-submit-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

/* Popovers */
.pop-anchor {
  position: relative;
}

.pop-panel {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  padding: 12px;
  background: #201d28;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.58);
  z-index: 45;
  max-width: calc(100vw - 32px);
}

.pop-mode-menu {
  width: 290px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pop-mode-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.pop-mode-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.pop-mode-item.active {
  background: rgba(242, 169, 59, 0.1);
  border-color: rgba(242, 169, 59, 0.35);
}

.pop-mode-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pop-mode-text strong {
  font-size: 13.5px;
  font-weight: 600;
}

.pop-mode-text small {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.4;
}

.pop-check {
  color: var(--lamp);
  font-weight: 700;
  opacity: 0;
}

.pop-mode-item.active .pop-check {
  opacity: 1;
}

.pop-param-card {
  width: 310px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pop-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pop-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pop-section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.ratio-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ratio-option-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease, color 0.14s ease;
}

.ratio-option-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text);
}

.ratio-option-card.active {
  border-color: var(--lamp-line);
  background: rgba(242, 169, 59, 0.12);
  color: var(--text);
}

.ratio-shape {
  display: block;
  border: 1.6px solid currentColor;
  border-radius: 3px;
}

.shape-auto {
  width: 14px;
  height: 14px;
  border-style: dashed;
}

.shape-16-9 {
  width: 20px;
  height: 12px;
}

.shape-9-16 {
  width: 12px;
  height: 20px;
}

.sec-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.sec-pill-btn {
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.sec-pill-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text);
}

.sec-pill-btn.active {
  border-color: var(--lamp-line);
  background: rgba(242, 169, 59, 0.14);
  color: var(--lamp);
  font-weight: 600;
}

.pop-spec-footer {
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 12px;
  color: var(--text-3);
}

.pop-mention-card {
  width: 260px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mention-chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mention-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.mention-chip-btn:hover {
  border-color: var(--lamp-line);
  background: rgba(242, 169, 59, 0.12);
}

.mention-chip-btn img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

.mention-empty-msg {
  margin: 0;
  line-height: 1.5;
}

.pop-motion-card {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (max-width: 640px) {
  .composer-page {
    padding-top: 18px;
  }
  .composer-hero {
    margin-bottom: 28px;
  }
  .composer-card {
    padding: 14px 14px 12px;
    border-radius: 16px;
  }
  .dock-tilt-card {
    width: 66px;
    height: 82px;
    margin-top: -22px;
  }
  .toolbar-right {
    margin-left: auto;
  }
  .pop-mode-menu,
  .pop-param-card,
  .pop-mention-card,
  .pop-motion-card {
    width: min(300px, calc(100vw - 32px));
  }
}

/* ==========================================================================
   Material Library Picker Modal & Gallery Assets View
   ========================================================================== */

.asset-picker-dialog {
  max-width: 720px;
  width: calc(100vw - 32px);
}

.asset-modal-inner {
  display: flex;
  flex-direction: column;
  max-height: min(84vh, 720px);
}

.asset-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.asset-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.asset-quota-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.11);
  color: var(--text-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.asset-modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.asset-upload-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.asset-upload-zone.is-dragover {
  border-color: var(--lamp);
  background: rgba(242, 169, 59, 0.1);
}

.asset-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(242, 169, 59, 0.4);
  background: rgba(242, 169, 59, 0.14);
  color: var(--lamp);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.asset-upload-btn:hover {
  border-color: var(--lamp);
  background: rgba(242, 169, 59, 0.22);
}

.asset-upload-hint {
  font-size: 12.5px;
  color: var(--text-3);
}

.asset-modal-notice {
  margin: 0;
}

.asset-modal-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.asset-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(114px, 1fr));
  gap: 10px;
}

.asset-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: #0d0b11;
  cursor: pointer;
  transition: border-color 0.14s ease, transform 0.14s ease;
}

.asset-tile:hover {
  border-color: rgba(255, 255, 255, 0.28);
}

.asset-tile.is-selected {
  border-color: var(--lamp);
  box-shadow: 0 0 0 2px rgba(242, 169, 59, 0.22);
}

.asset-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.asset-tile-dim {
  position: absolute;
  left: 5px;
  bottom: 5px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(12, 10, 15, 0.8);
  color: var(--text-2);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.asset-tile-check {
  position: absolute;
  left: 6px;
  top: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--lamp);
  color: #121016;
  font-size: 11px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
}

.asset-tile.is-selected .asset-tile-check {
  opacity: 1;
}

.asset-tile-del {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(12, 10, 15, 0.85);
  color: var(--text);
  font-size: 11px;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0.78;
  transition: opacity 0.14s ease, background-color 0.14s ease;
}

.asset-tile:hover .asset-tile-del,
.asset-tile-del:focus-visible {
  opacity: 1;
}

.asset-tile-del:hover {
  background: var(--rec);
  border-color: var(--rec);
  color: #fff;
}

.asset-modal-empty {
  padding: 36px 16px;
  text-align: center;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

.asset-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.gallery-quota-note {
  margin-top: 4px;
}

.gallery-view-pills {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.gallery-upload-pill {
  cursor: pointer;
}

.assets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.asset-library-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-frame);
  overflow: hidden;
}

.asset-card-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #0d0b11;
}

.asset-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.asset-card-dim {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(12, 10, 15, 0.82);
  color: var(--text-2);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.asset-card-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
}

.asset-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.asset-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.asset-use-link {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(242, 169, 59, 0.35);
  background: rgba(242, 169, 59, 0.12);
  color: var(--lamp);
  font-size: 12px;
  font-weight: 600;
}

.asset-use-link:hover {
  border-color: var(--lamp);
  background: rgba(242, 169, 59, 0.22);
}
