:root {
  /* black studio + glass panels + iridescent accents. "--yellow" is the historical name of the accent (now white) */
  --bg: #0c0c0d;
  --panel: #151516;
  --panel-2: #1b1b1d;
  --panel-3: #242427;
  --line: rgba(255, 255, 255, .08);
  --text: #f5f5f7;
  --muted: #8e8e95;
  --yellow: #ffffff;
  --yellow-2: #e6e6ea;
  --yellow-dim: rgba(255, 255, 255, .07);
  --red: #ff5f6d;
  --green: #6dffa0;
  --g1: #ff5fcf; --g2: #8b5cff; --g3: #3fd8ff; --g4: #57f287; --g5: #ff9a3d;
  --grad: linear-gradient(100deg, var(--g1), var(--g2) 28%, var(--g3) 52%, var(--g4) 74%, var(--g5));
  --glass: rgba(255, 255, 255, .028);
  --radius: 24px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(900px 520px at 92% -12%, rgba(139, 92, 255, .10), transparent 60%),
    radial-gradient(800px 480px at -12% 108%, rgba(255, 95, 207, .06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 Manrope, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.grow { flex: 1; }
.ic { width: 18px; height: 18px; flex: none; }

/* ---- header ---- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px 28px; background: rgba(12, 12, 13, .78); backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--grad); color: #000; }
.logo svg { width: 24px; height: 24px; }
.brand-name { display: block; font-size: 19px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.brand-name span { color: var(--muted); font-weight: 500; }
.sub { display: block; color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 4px; padding: 5px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); }
.tabs a { padding: 9px 18px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 14px; color: #c9c9cf; }
.tabs a:hover { color: var(--text); }
.tabs a.on { background: var(--yellow); color: #000; }
.sys {
  display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums;
}
.sys .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.sys.ok .dot { background: var(--g4); box-shadow: 0 0 10px var(--g4); }
.sys.busy .dot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---- layout ---- */
.app { display: grid; grid-template-columns: 76px 280px minmax(0, 1fr); gap: 24px; max-width: 1560px; margin: 0 auto; padding: 12px 28px 28px; }
.app.wide { grid-template-columns: 76px minmax(0, 1fr); }
.app.wide .side { display: none; }
@media (max-width: 900px) {
  .app, .app.wide { grid-template-columns: minmax(0, 1fr); padding: 12px 16px 96px; gap: 16px; }
  .top { padding: 10px 16px; gap: 10px; }
  .top .tabs, .sys { display: none; }
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .012));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; position: relative;
}

/* ---- sidebar ---- */
.side { position: sticky; top: 86px; align-self: start; display: grid; gap: 12px; max-height: calc(100vh - 110px); overflow: auto; padding-right: 2px; }
.new-btn { justify-content: center; padding: 14px; font-size: 15px; }
.side-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: 6px; }
.side-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.side-item {
  display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px; border-radius: 18px;
  text-decoration: none; border: 1px solid var(--line); background: var(--glass);
}
.side-item:hover { border-color: rgba(255, 255, 255, .18); }
.side-item.active { border-color: rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .06); }
.side-item img, .side-ph { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; background: #000; display: grid; place-items: center; color: #444; }
.side-text { min-width: 0; display: grid; gap: 3px; }
.side-text b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-status { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.side-status.attn { color: var(--yellow); font-weight: 700; }
.side-status.attn::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--yellow); margin-right: 6px; animation: pulse 1.2s infinite; }
.side-status.run { color: var(--g3); }
.side-status.fail { color: var(--red); }
.side-status.done { color: var(--green); }
.side-empty { padding: 8px; font-size: 13px; }
@media (max-width: 900px) {
  .side { position: static; max-height: none; overflow: visible; }
  .side-list { grid-auto-flow: column; grid-auto-columns: 230px; overflow-x: auto; padding-bottom: 4px; }
}

/* ---- project header + stepper ---- */
.project { display: grid; gap: 18px; min-width: 0; }
.proj-head { display: flex; align-items: flex-start; gap: 16px; }
.proj-title { min-width: 0; flex: 1; }
.proj-head h1 { font-size: 26px; font-weight: 800; overflow-wrap: anywhere; }
.proj-head h1.editable { cursor: text; border-bottom: 1px dashed transparent; display: inline; }
.proj-head h1.editable:hover { border-bottom-color: #555; }
.proj-head p { margin: 4px 0 0; font-size: 13px; }
.title-input { font-size: 22px; font-weight: 800; width: 100%; }

.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); }
.step { position: relative; }
.step:not(:last-child)::after {
  content: ""; position: absolute; top: 21px; left: calc(50% + 26px); right: calc(-50% + 26px); height: 3px; border-radius: 3px; background: var(--line);
}
.step.done:not(:last-child)::after { background: var(--grad); }
.step button {
  width: 100%; display: grid; justify-items: center; gap: 8px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: default;
}
.step.can button { cursor: pointer; }
.step-dot {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; position: relative; z-index: 1;
  background: var(--panel-2); border: 2px solid var(--line); color: #555; transition: transform .15s;
}
.step-dot .ic { width: 20px; height: 20px; }
.step.done .step-dot { background: var(--yellow); border-color: var(--yellow); color: #000; }
.step.current .step-dot { border-color: transparent; color: #fff; background: linear-gradient(var(--panel-2), var(--panel-2)) padding-box, var(--grad) border-box; box-shadow: 0 0 22px rgba(139, 92, 255, .35); }
.step.viewing .step-dot { transform: scale(1.12); outline: 2px solid var(--text); outline-offset: 3px; }
.step.can button:hover .step-dot { transform: scale(1.08); }
.step-label { display: grid; text-align: center; }
.step-label small { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.step-label b { font-size: 14px; }
.step.todo .step-label b { color: var(--muted); }
@media (max-width: 640px) {
  .step-label small { display: none; }
  .step-label b { font-size: 12px; }
  .step-dot { width: 38px; height: 38px; }
  .step:not(:last-child)::after { top: 18px; left: calc(50% + 22px); right: calc(-50% + 22px); }
}

.step-body { display: grid; gap: 18px; }
.step-body.split { grid-template-columns: minmax(0, 320px) minmax(0, 1fr); align-items: start; }
@media (max-width: 760px) { .step-body.split { grid-template-columns: minmax(0, 1fr); } }
.step-intro h2 { font-size: 20px; }
.step-intro p { margin: 4px 0 0; font-size: 14px; }
.step-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 4px; }
.step-foot.sticky {
  position: sticky; bottom: 12px; z-index: 5; padding: 12px 14px; border-radius: 12px;
  background: rgba(21, 21, 22, .92); border: 1px solid var(--line); backdrop-filter: blur(14px); border-radius: 999px; padding-left: 20px;
}
@media (max-width: 640px) {
  .step-foot.sticky { position: static; }
  .step-foot .btn.primary.lg { width: 100%; }
}
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.poster { width: 100%; border-radius: 12px; background: #000; display: block; object-fit: cover; aspect-ratio: 16 / 10; }
.poster.ph { display: grid; place-items: center; color: #444; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0 0 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.empty-state { text-align: center; display: grid; gap: 10px; justify-items: center; padding: 48px 22px; }

/* ---- upload (step 1) ---- */
.drop {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; min-height: 260px;
  border: 2px dashed rgba(255, 255, 255, .14); border-radius: var(--radius); padding: 18px; cursor: pointer;
  background: var(--panel-2); position: relative; overflow: hidden; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .04); }
.drop.has { border-style: solid; border-color: var(--yellow); }
.drop-body { position: relative; z-index: 1; display: grid; justify-items: center; text-align: center; gap: 6px; margin: auto; }
.drop-ic { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #000; box-shadow: 0 10px 40px rgba(139, 92, 255, .35); }
.drop-ic .ic { width: 28px; height: 28px; }
.drop-body strong { font-size: 17px; }
.drop-body small { color: var(--muted); font-size: 13px; }
.drop.has .drop-body { margin: auto auto 0 0; justify-items: start; text-align: left; background: rgba(0,0,0,.72); padding: 10px 12px; border-radius: 10px; backdrop-filter: blur(4px); }
.drop.has .drop-ic { display: none; }
.drop-preview { position: absolute; inset: 0; }
.drop-preview img, .drop-preview video { width: 100%; height: 100%; object-fit: cover; }

.form-grid { display: grid; grid-template-columns: 2fr 1fr 1.3fr; gap: 12px; align-items: stretch; }
.form-grid .span { grid-column: 1 / -1; }
.model-select { max-width: 280px; font-size: 13px; padding: 7px 9px; }
@media (max-width: 900px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.field, .toggle {
  display: grid; gap: 4px; padding: 14px; border-radius: 18px; background: var(--glass); border: 1px solid var(--line);
}
.field b, .toggle b { font-size: 14px; }
.field small, .toggle small { color: var(--muted); font-size: 12px; }
.toggle { grid-template-columns: auto 1fr; align-items: center; gap: 12px; cursor: pointer; position: relative; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.sw { width: 42px; height: 24px; border-radius: 999px; background: #333; position: relative; transition: background .15s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #888; transition: transform .15s, background .15s; }
.toggle input:checked + .sw { background: var(--grad); }
.toggle input:checked + .sw::after { transform: translateX(18px); background: #fff; }
.toggle input:focus-visible + .sw { outline: 2px solid var(--yellow-2); outline-offset: 2px; }
.text, select, .search {
  background: rgba(0, 0, 0, .45); color: var(--text); border: 1px solid rgba(255, 255, 255, .12); border-radius: 12px; padding: 10px 13px; font: inherit; min-width: 0;
}
.text:focus, select:focus, .search:focus { outline: none; border-color: rgba(255, 255, 255, .55); }
.upload { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 240px; }
.upload .bar { flex: 1; }
.upload-text { color: var(--g3); font-variant-numeric: tabular-nums; font-size: 13px; }
.msg { margin: 0; font-size: 13.5px; color: var(--muted); }
.msg.err, .err { color: var(--red); }
.msg:empty { display: none; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 17px; border-radius: 999px;
  font-family: inherit; font-size: 13.5px; font-weight: 700; line-height: 1; cursor: pointer; text-decoration: none; white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .04); color: var(--text); transition: background .15s, border-color .15s;
}
.btn:hover { border-color: rgba(255, 255, 255, .4); background: rgba(255, 255, 255, .08); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--yellow); color: #000; border-color: var(--yellow); }
.btn.primary:hover:not(:disabled) { background: var(--yellow-2); color: #000; }
.btn.primary.lg { padding: 15px 26px; font-size: 15.5px; font-weight: 800; box-shadow: 0 10px 40px -10px rgba(139, 92, 255, .6); }
.btn.primary.lg:active:not(:disabled) { transform: translateY(1px); }
.btn.lg { padding: 15px 26px; font-size: 15.5px; }
.btn.lg .ic { order: 2; }
.btn.ghost { background: transparent; }
.btn.danger:hover { border-color: var(--red); color: var(--red); }
.btn.tiny { padding: 6px 9px; font-size: 12px; }
.btn.tiny .ic { width: 14px; height: 14px; }
.icon-btn { padding: 8px; }

/* ---- progress ---- */
.bar { height: 8px; border-radius: 999px; background: #262626; overflow: hidden; display: block; }
.bar.big { height: 14px; }
.bar.thin { height: 4px; }
.bar i {
  display: block; height: 100%; width: 0; border-radius: inherit; transition: width .5s;
  background: var(--grad); background-size: 200% 100%; animation: sheen 3s linear infinite;
}
@keyframes sheen { to { background-position: -200% 0; } }
@keyframes stripes { to { background-position: 28px 0; } }
.progress-card { display: grid; gap: 14px; padding: 22px; border-radius: 20px; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); }
.pc-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.pc-top h3 { font-size: 18px; }
.pc-top p { margin: 4px 0 0; font-size: 13.5px; }
.big-pct { font-size: 48px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.progress-card.waiting .big-pct { animation: pulse 1.4s infinite; }
.progress-card.waiting .bar i { display: none; }
.progress-card.waiting .bar { background: repeating-linear-gradient(135deg, #333 0 10px, #262626 10px 20px); background-size: 28px 28px; animation: stripes 1s linear infinite; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stats:empty { display: none; }
.stat { padding: 10px 14px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); display: grid; }
.stat small { color: var(--muted); font-size: 12px; }
.stat b { font-size: 16px; font-variant-numeric: tabular-nums; }
.error-card, .done-card { display: flex; gap: 16px; align-items: flex-start; padding: 18px; border-radius: 12px; }
.error-card { background: rgba(255, 90, 79, .07); border: 1px solid rgba(255, 90, 79, .35); }
.error-card p { margin: 6px 0 12px; }
.err-ic, .done-ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.err-ic { background: rgba(255, 90, 79, .18); color: var(--red); }
.done-card { background: linear-gradient(100deg, rgba(87, 242, 135, .08), rgba(63, 216, 255, .06)); border: 1px solid rgba(87, 242, 135, .3); }
.done-card > div { flex: 1; display: grid; gap: 12px; }
.done-ic { background: var(--grad); color: #000; }

/* ---- people / assignment ---- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.pcard {
  display: grid; gap: 10px; padding: 14px; border-radius: 22px; background: var(--glass); border: 1px solid var(--line);
  transition: border-color .15s; align-content: start;
}
.pcard.on { border-color: transparent; background: linear-gradient(#161618, #161618) padding-box, var(--grad) border-box; }
.pcard.skeleton { min-height: 190px; background: linear-gradient(90deg, var(--panel-2), #232323, var(--panel-2)); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.pcard-imgs { display: grid; grid-template-columns: 1fr 26px 1fr; align-items: center; gap: 6px; }
.pcard-person, .pcard-face { width: 100%; aspect-ratio: 1; border-radius: 50%; object-fit: cover; background: #000; }
.pcard-arrow { color: #555; display: grid; place-items: center; }
.pcard.on .pcard-arrow { color: var(--yellow); }
.pcard-face { padding: 0; border: 2px dashed rgba(255, 255, 255, .2); cursor: pointer; overflow: hidden; color: var(--muted); display: grid; place-items: center; transition: border-color .15s, color .15s; font: inherit; }
.pcard-face:hover:not(:disabled) { border-color: var(--yellow); color: var(--yellow); }
.pcard.on .pcard-face { border: 2px solid var(--yellow); }
.pcard-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard-face:disabled { cursor: default; }
.pf-empty { display: grid; justify-items: center; gap: 4px; }
.pf-empty .ic { width: 26px; height: 26px; }
.pf-empty small { font-size: 12px; font-weight: 700; }
.pcard-info { display: grid; gap: 1px; }
.pcard-info small { font-size: 12.5px; }
.pcard.on .pcard-info small:first-of-type { color: var(--text); font-weight: 700; }
.pcard-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: -4px; }
.minor summary { cursor: pointer; color: var(--muted); font-size: 13.5px; padding: 4px 0 10px; }
.mini-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; cursor: pointer; }
.mini-toggle input { accent-color: var(--yellow); width: 16px; height: 16px; }

.map-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.map-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line); font-size: 12.5px; font-weight: 700;
}
.map-chip img, .map-chip .gone { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: #000; display: grid; place-items: center; }
.map-chip .ic { width: 14px; height: 14px; color: var(--g3); }

/* ---- result ---- */
.step-body.result { grid-template-columns: minmax(0, 1fr) 280px; align-items: start; }
@media (max-width: 1000px) { .step-body.result { grid-template-columns: minmax(0, 1fr); } }
.player { display: grid; gap: 8px; }
.player video, .result-img { width: 100%; border-radius: 20px; background: #000; display: block; max-height: 70vh; }
.player-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.player-label { font-weight: 700; color: var(--text); }
.quality { padding: 5px 8px; font-size: 12.5px; }
.result-side { display: grid; gap: 10px; align-content: start; }
.result-side h3 { font-size: 15px; }
.btn.dl { justify-content: flex-start; padding: 12px 14px; }
.result-side p { margin: 0; }

/* ---- modal picker ---- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .72); display: grid; place-items: center; padding: 16px; backdrop-filter: blur(3px); }
.modal {
  width: min(820px, 100%); max-height: min(86vh, 900px); overflow: auto; display: grid; gap: 14px; align-content: start;
  background: rgba(22, 22, 24, .96); border: 1px solid rgba(255, 255, 255, .12); border-radius: 28px; padding: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.modal.over { background: #1d1d22; }
.modal-head { display: flex; align-items: center; gap: 12px; }
.modal-head > div { flex: 1; }
.modal-head small { color: var(--muted); }
.modal-person { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; outline: 2px solid rgba(255, 255, 255, .6); }
.modal-tools { display: grid; gap: 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text); font: inherit; font-size: 13px; font-weight: 700;
}
.chip:hover { border-color: rgba(255, 255, 255, .3); }
.chip.on { background: var(--yellow); border-color: var(--yellow); color: #000; }
.chip-n { font-size: 11px; padding: 1px 6px; border-radius: 999px; background: rgba(255, 255, 255, .08); font-variant-numeric: tabular-nums; }
.chip.on .chip-n { background: rgba(0, 0, 0, .15); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; }
.pick {
  display: grid; gap: 6px; padding: 8px; border-radius: 18px; cursor: pointer; text-align: center;
  background: var(--panel-2); border: 2px solid transparent; color: var(--text); font: inherit;
}
.pick:hover { border-color: #555; }
.pick.on { border-color: #fff; background: rgba(255, 255, 255, .06); }
.pick-img { width: 100%; aspect-ratio: 1; border-radius: 50%; object-fit: cover; background: #000; display: grid; place-items: center; color: var(--muted); }
.pick-img .ic { width: 28px; height: 28px; }
.pick.add .pick-img { background: var(--grad); color: #000; }
.pick-name { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-grid .empty { grid-column: 1 / -1; margin: 0; color: var(--muted); }

/* ---- face library page ---- */
.library { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 800px) { .library { grid-template-columns: minmax(0, 1fr); } }
.groups { display: grid; gap: 4px; position: sticky; top: 86px; }
@media (max-width: 800px) { .groups { position: static; grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; } }
.group {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 999px; cursor: pointer; text-align: left;
  background: transparent; border: 1px solid transparent; color: var(--text); font: inherit; font-size: 14px; font-weight: 700;
}
.group:hover { background: var(--panel); }
.group.on { background: var(--yellow); color: #000; }
.group.on .chip-n { background: rgba(0, 0, 0, .15); }
.group-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.groups .btn { justify-content: flex-start; margin-top: 6px; }
.lib-main { display: grid; gap: 16px; }
.lib-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.lib-head > div:first-child { flex: 1; min-width: 220px; }
.lib-head h2 { font-size: 22px; }
.hint { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.lib-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search { min-width: 180px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; align-items: start; }
.lib-face { position: relative; display: grid; gap: 6px; padding: 10px; border-radius: 22px; background: var(--glass); border: 1px solid var(--line); }
.lib-face img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 16px; background: #000; display: block; }
.face-name {
  font: inherit; font-size: 13px; font-weight: 700; color: var(--text); background: none; border: 0; padding: 2px; cursor: text;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.face-name:hover { color: var(--g3); }
.mini-select { padding: 5px 6px; font-size: 12px; }
.corner-x {
  position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0, 0, 0, .7); color: #fff; display: grid; place-items: center; opacity: 0; transition: opacity .15s;
}
.corner-x .ic { width: 14px; height: 14px; }
.lib-face:hover .corner-x, .corner-x:focus-visible { opacity: 1; }
@media (hover: none) { .corner-x { opacity: 1; } }
.lib-drop {
  display: grid; justify-items: center; align-content: center; gap: 6px; min-height: 188px; padding: 12px; text-align: center;
  border: 2px dashed rgba(255, 255, 255, .14); border-radius: 22px; background: transparent; color: var(--text); font: inherit; cursor: pointer;
}
.lib-drop:hover, .lib-drop.over { border-color: rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .04); }
.lib-drop .ic { width: 40px; height: 40px; padding: 9px; border-radius: 50%; background: var(--grad); color: #000; }
.lib-drop small { color: var(--muted); font-size: 12px; }
.lib-grid .empty { grid-column: 1 / -1; color: var(--muted); margin: 0; }

/* ---- comparison page ---- */
.cmp-list { display: grid; gap: 18px; }
.cmp-card { display: grid; gap: 12px; }
.cmp-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.cmp-head h3 { font-size: 17px; }
.cmp-card .result-img { max-height: none; }
@media (max-width: 640px) { .tabs a { padding: 8px 10px; font-size: 13px; } }

/* ---- account ---- */
.user { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); }
.user img, .user .avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--yellow); color: #000; display: grid; place-items: center; font-weight: 800; }
.user-name { font-size: 13px; font-weight: 700; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user .role { font-size: 11px; font-weight: 800; color: #000; background: var(--yellow); padding: 2px 7px; border-radius: 999px; }
@media (max-width: 900px) { .user-name { display: none; } }
.limits { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }

body.signed-out .top .tabs, body.signed-out .sys, body.signed-out .quick { display: none; }
.login-wrap { min-height: calc(100vh - 80px); display: grid; place-items: center; padding: 24px 16px; }
.login { width: min(440px, 100%); display: grid; gap: 16px; text-align: center; justify-items: center; padding: 34px 28px; }
.login { background: rgba(22, 22, 24, .96); overflow: hidden; }
.login::before { content: ""; position: absolute; inset: -40% -20% auto; height: 70%; background: radial-gradient(40% 50% at 30% 60%, rgba(255, 95, 207, .35), transparent 70%), radial-gradient(40% 50% at 70% 60%, rgba(63, 216, 255, .28), transparent 70%); filter: blur(30px); pointer-events: none; }
.login > * { position: relative; }
.login h1 { font-size: 28px; font-weight: 800; }
.login h1 span { color: var(--muted); font-weight: 500; }
.login-logo .logo { width: 64px; height: 64px; border-radius: 20px; }
.login-logo .logo svg { width: 40px; height: 40px; }
.agree { display: flex; gap: 10px; text-align: left; font-size: 13px; color: var(--muted); padding: 14px; border-radius: 18px; background: var(--panel-2); border: 1px solid var(--line); cursor: pointer; }
.agree input { accent-color: var(--yellow); width: 18px; height: 18px; flex: none; margin-top: 1px; }
.btn.google { width: 100%; padding: 14px; font-size: 15px; background: #fff; color: #1f1f1f; border-color: #fff; gap: 12px; }
.btn.google:hover { background: #e9e9ee; color: #000; border-color: #e9e9ee; }
.btn.google svg { width: 20px; height: 20px; }
.btn.google.off { opacity: .45; }
.dev-login { display: grid; gap: 8px; width: 100%; padding-top: 12px; border-top: 1px dashed var(--line); }
.toggle > span:last-child { display: grid; gap: 2px; }

/* ---- terms ---- */
.agree a { color: var(--text); font-weight: 700; text-decoration: underline; }
.terms-modal { width: min(760px, 100%); }
.terms-doc { text-align: left; display: grid; gap: 8px; font-size: 14px; line-height: 1.6; }
.terms-doc h2 { font-size: 20px; margin-bottom: 4px; }
.terms-doc h3 { font-size: 15.5px; margin-top: 10px; }
.terms-doc p, .terms-doc ul { margin: 0; color: #d6d6cf; }
.terms-doc ul { padding-left: 20px; display: grid; gap: 4px; }
.terms-doc b { color: var(--text); }
.terms-gate { width: min(760px, 100%); }
.terms-gate .terms-doc { max-height: 52vh; overflow: auto; padding: 14px; border-radius: 12px; background: #0e0e0e; border: 1px solid var(--line); }

.lib-face.pending { opacity: .75; }
.pending-img { width: 100%; aspect-ratio: 1; border-radius: 8px; background: #000; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid #333; border-top-color: var(--yellow); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- credits ---- */
.credit-badge { padding: 9px 14px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-weight: 700; font-size: 13px; text-decoration: none; white-space: nowrap; }
.credit-badge::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--grad); margin-right: 8px; vertical-align: 1px; }
.credit-badge:hover { border-color: rgba(255, 255, 255, .4); }
.credit-top { display: flex; flex-direction: column; gap: 2px; }
.credit-balance { font-size: 38px; font-weight: 800; line-height: 1.1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; justify-self: start; }
.sec-title { margin: 22px 0 10px; font-size: 16px; }
.small { font-size: 13px; }
.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.pack { display: flex; flex-direction: column; gap: 6px; }
.pack-credits { font-size: 20px; }
.pack-bonus { color: var(--green); font-size: 13px; font-weight: 700; min-height: 1.4em; }
.pack .btn { margin-top: auto; }
.price-rules { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.table-card { padding: 0; overflow-x: auto; }
.ledger { width: 100%; border-collapse: collapse; font-size: 14px; }
.ledger th, .ledger td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.ledger th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.ledger .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger .plus { color: var(--green); }
.ledger .minus { color: var(--text); }
.grant-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grant-form input { flex: 1 1 160px; min-width: 0; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; }
.price-box { margin-top: 14px; padding: 14px 18px; border-radius: 18px; border: 1px solid var(--line); background: var(--panel-2); }
.price-box.warn { border-color: rgba(255, 154, 61, .5); background: rgba(255, 154, 61, .07); }
.price-box.short { border-color: var(--red); }
.price-main { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.price-main b { font-size: 17px; }
.price-main .grow { flex: 1; }
.price-warn { margin: 8px 0 0; font-size: 14px; }
.pay-modal { width: min(460px, 100%); }
.pay-body { display: grid; gap: 14px; justify-items: center; }
.pay-sum { font-size: 15px; }
.pay-sum b { font-size: 22px; }
.pay-qr { width: min(260px, 70vw); aspect-ratio: 1; background: #fff; border-radius: 12px; padding: 8px; }
.pay-banks { width: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.pay-bank { display: grid; justify-items: center; gap: 4px; padding: 8px 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); text-decoration: none; text-align: center; }
.pay-bank:hover { border-color: rgba(255, 255, 255, .4); }
.pay-bank img { width: 36px; height: 36px; border-radius: 8px; object-fit: contain; }
.pay-bank small { font-size: 11px; line-height: 1.2; color: var(--muted); }
.pay-foot { width: 100%; display: flex; align-items: center; gap: 8px; }
.pay-foot .grow { flex: 1; }
.pay-done { display: grid; gap: 8px; justify-items: center; text-align: center; padding: 16px 0; }
.pay-done b { font-size: 18px; }
@media (min-width: 900px) and (hover: hover) { .pay-banks { display: none; } } /* desktop: scan the QR with the phone */

/* ---- AI generation ---- */
.src-tabs { display: inline-flex; gap: 4px; padding: 5px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); justify-self: start; }
.src-tab { padding: 9px 18px; border-radius: 999px; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.src-tab.on { background: var(--yellow); color: #000; }
.prompt { width: 100%; resize: vertical; min-height: 110px; line-height: 1.5; }
.gen-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.gen-price { font-size: 14px; }
.gen-price b { color: var(--text); font-size: 16px; }
.gen-price.short b { color: var(--red); }
.gen-price .topup { color: var(--g3); font-weight: 700; }
.gen-prompt { margin: 0; padding: 14px 18px; border-left: 3px solid var(--g2); background: rgba(0, 0, 0, .35); border-radius: 0 14px 14px 0; color: #d6d6cf; font-size: 14px; }
.gen-modes { display: flex; flex-wrap: wrap; gap: 4px; padding: 5px; border-radius: 24px; background: var(--panel-2); border: 1px solid var(--line); }
.gen-model { max-width: 100%; }
.gen-fields { display: grid; gap: 12px; }
.gen-grid .field.wide { grid-column: 1 / -1; }
.gen-adv summary { cursor: pointer; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.media-list { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.media-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .25); background: var(--yellow-dim); max-width: 220px; }
.media-chip img, .media-ic { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; display: grid; place-items: center; background: var(--panel-3); }
.media-chip small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-add { position: relative; }
.media-menu { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: min(420px, 86vw); max-height: 320px; overflow: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); box-shadow: 0 16px 40px rgba(0,0,0,.5); }
.media-opt { display: grid; justify-items: center; gap: 4px; padding: 6px 4px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; font-size: 12px; cursor: pointer; text-align: center; }
.media-opt:first-child { grid-column: 1 / -1; font-weight: 700; }
.media-opt:hover { border-color: rgba(255, 255, 255, .4); }
.media-opt img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; }
.media-opt small { font-size: 11px; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ======================================================================
   Studio shell: icon rail, quick "new" pills, node canvas, landing page
   ====================================================================== */
.user { padding: 0; background: none; border: 0; }
.quick { margin-left: auto; display: flex; align-items: center; gap: 4px; padding: 5px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); }
.quick-label { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px 0 8px; color: var(--muted); font-size: 12.5px; font-weight: 700; }
.quick-label .ic { width: 15px; height: 15px; }
.quick-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 999px; border: 0; background: transparent;
  color: #d4d4da; font: inherit; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.quick-btn .ic { width: 16px; height: 16px; }
.quick-btn:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.quick-btn.on { background: #fff; color: #000; }
.quick-more { position: relative; }
.quick-menu, .user-menu {
  position: absolute; z-index: 40; display: grid; gap: 2px; min-width: 220px; padding: 8px; border-radius: 20px;
  background: rgba(24, 24, 26, .97); border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 24px 60px rgba(0, 0, 0, .6); backdrop-filter: blur(16px);
}
.quick-menu { top: calc(100% + 10px); right: 0; }
.quick-menu a, .user-menu a, .user-menu button {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 0; background: none;
  color: var(--text); font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; text-align: left; cursor: pointer;
}
.quick-menu a:hover, .user-menu a:hover, .user-menu button:hover { background: rgba(255, 255, 255, .07); }

.rail {
  position: sticky; top: 86px; align-self: start; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 14px 0; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); min-height: min(640px, calc(100vh - 110px));
}
.rail .grow { flex: 1; }
.rail-btn {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; color: #e6e6ea; border: 0; background: none;
  cursor: pointer; transition: background .15s, transform .15s; text-decoration: none;
}
.rail-btn .ic { width: 22px; height: 22px; stroke-width: 1.8; }
.rail-btn:hover { background: rgba(255, 255, 255, .07); }
.rail-btn.on { background: #fff; color: #000; transform: scale(1.12); box-shadow: 0 8px 30px rgba(255, 255, 255, .12); }
.rail-sep { width: 36px; height: 1px; background: var(--line); margin: 4px 0; }
.rail-user { position: relative; }
.rail-avatar { width: 52px; height: 52px; padding: 0; border: 2px solid rgba(255, 255, 255, .2); border-radius: 50%; background: none; cursor: pointer; overflow: hidden; display: grid; place-items: center; }
.rail-avatar img, .rail-avatar .avatar, .um-head img, .um-head .avatar { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #000; font-weight: 800; }
.user-menu { left: calc(100% + 14px); bottom: 0; min-width: 250px; }
.um-head { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 10px; align-items: center; padding: 6px 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.um-head .avatar, .um-head img { width: 40px; height: 40px; }
.um-head b { display: block; font-size: 14px; }
.um-head small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.user-menu .role { justify-self: start; margin: 2px 12px 4px; font-size: 11px; font-weight: 800; color: #000; background: var(--grad); padding: 2px 9px; border-radius: 999px; }
@media (max-width: 900px) {
  .rail {
    position: fixed; z-index: 30; top: auto; left: 12px; right: 12px; bottom: 12px; min-height: 0; flex-direction: row; justify-content: space-between;
    padding: 6px 10px; overflow-x: auto; background: rgba(21, 21, 22, .92); backdrop-filter: blur(16px);
  }
  .rail .grow, .rail-sep { display: none; }
  .rail { gap: 2px; padding: 6px; }
  .rail-btn { width: 38px; height: 38px; flex: none; }
  .rail-btn .ic { width: 20px; height: 20px; }
  .rail-btn.on { transform: none; }
  .rail-avatar { width: 38px; height: 38px; }
  .user-menu { left: auto; right: 0; bottom: calc(100% + 12px); }
  .quick { order: 5; width: 100%; margin-left: 0; overflow-x: auto; }
  .quick-more { position: static; }
  .user { margin-left: auto; }
}

/* ---- studio canvas (home) ---- */
.home { display: grid; gap: 22px; }
.canvas {
  position: relative; display: grid; gap: 34px 70px; align-items: center; min-height: 560px; padding: 18px 0;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 300px) minmax(0, 1fr);
}
.c-nodes { display: contents; }
.c-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.c-lines path { fill: none; stroke: rgba(255, 255, 255, .22); stroke-width: 1.3; }
.c-lines circle { fill: var(--bg); stroke: rgba(255, 255, 255, .35); stroke-width: 1.3; }
.c-center { grid-column: 2; grid-row: 1 / 3; display: grid; gap: 14px; justify-items: center; position: relative; z-index: 1; }
.c-head { display: flex; align-items: center; gap: 8px; font-size: 14px; max-width: 100%; }
.c-btn { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .07); color: #fff; }
.c-btn .ic { width: 15px; height: 15px; }
.c-btn:hover { background: rgba(255, 255, 255, .16); }
.c-pill { padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .07); font-size: 12px; color: #cfcfd5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.c-frame { width: 100%; aspect-ratio: 3 / 5; border-radius: 999px; overflow: hidden; background: #000; box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 40px 120px -30px rgba(139, 92, 255, .45); }
.c-media { width: 100%; height: 100%; object-fit: cover; display: block; }
.art {
  background:
    radial-gradient(circle at 28% 30%, var(--g1), transparent 42%), radial-gradient(circle at 74% 38%, var(--g3), transparent 40%),
    radial-gradient(circle at 46% 74%, var(--g5), transparent 46%), radial-gradient(circle at 40% 52%, var(--g4), transparent 34%),
    radial-gradient(circle at 62% 62%, var(--g2), transparent 44%), #111;
  animation: hue 14s linear infinite;
}
.art.big { display: grid; align-items: end; }
.art.big svg { width: 100%; height: 100%; mix-blend-mode: multiply; }
@keyframes hue { to { filter: hue-rotate(360deg); } }

.node {
  position: relative; z-index: 1; display: grid; gap: 12px; padding: 14px; border-radius: 34px; text-decoration: none; color: var(--text);
  background: var(--glass); border: 1px solid var(--line); transition: border-color .2s, transform .2s;
}
.node:hover { border-color: rgba(255, 255, 255, .22); transform: translateY(-2px); }
.n-tl { grid-column: 1; grid-row: 1; align-self: start; }
.n-bl { grid-column: 1; grid-row: 2; align-self: end; }
.n-tr { grid-column: 3; grid-row: 1; align-self: start; margin-top: 30px; }
.n-br { grid-column: 3; grid-row: 2; align-self: end; }
.node-head { display: flex; align-items: center; gap: 10px; padding: 2px 4px 0; font-size: 15px; }
.node-ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .07); flex: none; }
.node-ic .ic { width: 17px; height: 17px; stroke-width: 1.8; }
.node-body {
  position: relative; display: flex; align-items: center; gap: 14px; min-height: 104px; padding: 12px 12px 12px 26px;
  border-radius: 999px; overflow: hidden; background: #131315; border: 1px solid rgba(255, 255, 255, .1);
}
.node-body::before {
  content: ""; position: absolute; inset: -30% 30% -30% -10%; filter: blur(26px); opacity: .55; transition: opacity .2s;
  background: radial-gradient(45% 55% at 25% 50%, var(--g1), transparent 70%), radial-gradient(40% 50% at 60% 60%, var(--g2), transparent 70%), radial-gradient(30% 40% at 40% 20%, var(--g5), transparent 70%);
}
.n-tr .node-body::before { background: radial-gradient(45% 55% at 25% 50%, var(--g2), transparent 70%), radial-gradient(40% 50% at 60% 60%, var(--g1), transparent 70%); }
.n-br .node-body::before { background: radial-gradient(45% 55% at 25% 50%, var(--g3), transparent 70%), radial-gradient(40% 50% at 60% 60%, var(--g4), transparent 70%); }
.node:hover .node-body::before { opacity: .85; }
.node-text { position: relative; flex: 1; font-size: 13.5px; line-height: 1.45; color: rgba(255, 255, 255, .62); }
.node-thumb { position: relative; width: 78px; height: 78px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, .06); }
.n-hero {
  min-height: 250px; padding: 22px; align-content: space-between; overflow: hidden; border-radius: 48px; border-color: rgba(255, 255, 255, .14);
  background: radial-gradient(60% 80% at 20% 60%, var(--g1), transparent 70%), radial-gradient(50% 70% at 55% 40%, var(--g4), transparent 70%),
    radial-gradient(40% 60% at 75% 55%, var(--g5), transparent 70%), radial-gradient(40% 60% at 95% 30%, var(--g2), transparent 70%), #d9b8f0;
}
.n-hero::after { content: ""; position: absolute; inset: 0; background: radial-gradient(40% 60% at 55% 45%, rgba(0, 0, 0, .55), transparent 75%); pointer-events: none; }
.n-hero > * { position: relative; z-index: 1; }
.hero-chip, .hero-status {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 15px; color: #fff;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .35); backdrop-filter: blur(10px); max-width: 100%;
}
.hero-chip span, .hero-status span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-chip { justify-self: start; }
.hero-status { justify-self: end; }
.hero-chip .ic, .hero-status .ic { width: 16px; height: 16px; }
.hero-bar { background: rgba(255, 255, 255, .25); }
.hero-bar i { background: #fff; animation: none; }
.more-kinds { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; font-size: 13px; }
.more-kinds .chip { text-decoration: none; }
@media (max-width: 1320px) {
  .canvas { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 0; gap: 18px; }
  .c-center { grid-column: 1 / -1; grid-row: 1; }
  .c-frame { width: min(300px, 70vw); }
  .n-tl, .n-bl, .n-tr, .n-br { grid-column: auto; grid-row: auto; align-self: stretch; margin: 0; }
  .c-lines { display: none; }
}
@media (max-width: 640px) {
  .canvas { grid-template-columns: minmax(0, 1fr); }
  .c-frame { width: min(220px, 60vw); }
  .n-hero { min-height: 180px; }
}

/* ---- landing ---- */
body.landing-page { background: #09090a; }
.landing { position: relative; max-width: 1280px; margin: 0 auto; padding: 0 28px; overflow-x: clip; }
.lp-glow { position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background: radial-gradient(30% 40% at 25% 40%, rgba(255, 95, 207, .14), transparent 70%), radial-gradient(30% 40% at 75% 30%, rgba(63, 216, 255, .12), transparent 70%), radial-gradient(30% 40% at 50% 60%, rgba(139, 92, 255, .12), transparent 70%); }
.lp-nav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 18px 0; background: rgba(9, 9, 10, .72); backdrop-filter: blur(14px); }
.lp-links a { text-decoration: none; }
.lp-hero { display: grid; justify-items: center; text-align: center; gap: 20px; padding: 70px 0 30px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); font-size: 13.5px; font-weight: 600; }
.eyebrow .ic { width: 15px; height: 15px; }
.lp-hero h1 { font-size: clamp(36px, 6.4vw, 76px); line-height: 1.04; font-weight: 800; letter-spacing: -.035em; max-width: 960px; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lp-sub { margin: 0; max-width: 640px; font-size: 18px; color: #b4b4bb; }
.lp-cta { justify-content: center; margin-top: 6px; }
.lp-canvas { width: 100%; margin-top: 40px; padding: 26px 34px; border-radius: 48px; border: 1px solid var(--line); background: rgba(255, 255, 255, .015); cursor: pointer; }
.lp-sec { padding: 90px 0 20px; display: grid; gap: 14px; }
.lp-sec h2 { font-size: clamp(28px, 4vw, 44px); font-weight: 800; letter-spacing: -.03em; text-align: center; }
.lp-lead { margin: 0 auto 20px; color: var(--muted); font-size: 17px; text-align: center; max-width: 620px; }
.lp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.lp-card { position: relative; overflow: hidden; display: grid; gap: 10px; align-content: start; padding: 26px; border-radius: 32px; background: var(--glass); border: 1px solid var(--line); }
.lp-card::before { content: ""; position: absolute; inset: auto -30% -60% 10%; height: 80%; filter: blur(40px); opacity: .35; pointer-events: none; }
.lp-card.g0::before { background: radial-gradient(closest-side, var(--g1), transparent); }
.lp-card.g1::before { background: radial-gradient(closest-side, var(--g2), transparent); }
.lp-card.g2::before { background: radial-gradient(closest-side, var(--g3), transparent); }
.lp-card.g3::before { background: radial-gradient(closest-side, var(--g5), transparent); }
.lp-card > * { position: relative; }
.lp-card h3 { font-size: 19px; margin-top: 8px; }
.lp-card p, .lp-step p { margin: 0; color: #a8a8b0; font-size: 14.5px; }
.lp-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 20px; }
.lp-step { display: grid; gap: 8px; padding: 26px; border-radius: 32px; border: 1px solid var(--line); }
.lp-n { font-size: 44px; font-weight: 800; line-height: 1; justify-self: start; }
.lp-step h3 { font-size: 19px; }
.lp-price-card { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; padding: 40px; border-radius: 40px; border: 1px solid rgba(255, 255, 255, .12);
  background: radial-gradient(50% 120% at 0% 50%, rgba(255, 95, 207, .18), transparent 70%), radial-gradient(50% 120% at 100% 50%, rgba(63, 216, 255, .14), transparent 70%), var(--glass); }
.lp-price-card > div { flex: 1 1 380px; display: grid; gap: 10px; }
.lp-price-card h2 { text-align: left; }
.lp-price-card p { margin: 0; color: #b4b4bb; font-size: 16px; max-width: 620px; }
.lp-foot { margin-top: 90px; padding: 48px 0 32px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; display: grid; gap: 40px; }
.lp-fgrid { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 28px; }
.lp-fbrand { display: grid; gap: 14px; align-content: start; }
.lp-fbrand p { margin: 0; max-width: 340px; line-height: 1.6; }
.lp-fcol { display: grid; gap: 10px; align-content: start; }
.lp-fcol h4 { color: var(--text); font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.lp-foot a { color: var(--muted); text-decoration: none; }
.lp-foot a:hover { color: var(--text); }
.lp-fbottom { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 22px; border-top: 1px solid var(--line); font-size: 12.5px; }
@media (max-width: 960px) { .lp-fgrid { grid-template-columns: 1fr 1fr; } .lp-fbrand { grid-column: 1 / -1; } }
.login-overlay .login-wrap { min-height: 0; padding: 0; width: 100%; }
@media (max-width: 760px) {
  .landing { padding: 0 16px; }
  .lp-links { display: none; }
  .lp-nav .btn.ghost { display: none; }
  .lp-hero { padding-top: 36px; }
  .lp-canvas { padding: 14px; border-radius: 32px; }
  .lp-sec { padding-top: 60px; }
  .lp-price-card { padding: 26px; border-radius: 30px; }
}
@media (max-width: 1520px) { .sys { display: none; } }
@media (max-width: 1180px) { .quick-btn span, .quick-label span { display: none; } .quick-more .quick-btn span { display: inline; } }

/* ---- credits page: balance hero, history, top-up popup ---- */
.credits-page { max-width: 880px; }
.cb-card {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; padding: 30px 32px;
  border-radius: 36px; border: 1px solid rgba(255, 255, 255, .12); background: #131315;
}
.cb-card::before {
  content: ""; position: absolute; inset: -40% 35% -40% -15%; filter: blur(50px); opacity: .45; pointer-events: none;
  background: radial-gradient(40% 50% at 30% 50%, var(--g1), transparent 70%), radial-gradient(35% 45% at 65% 55%, var(--g2), transparent 70%), radial-gradient(30% 40% at 50% 20%, var(--g3), transparent 70%);
}
.cb-card > * { position: relative; }
.cb-main { flex: 1 1 260px; display: grid; gap: 6px; }
.cb-label { color: rgba(255, 255, 255, .7); font-size: 13.5px; font-weight: 600; }
.cb-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.cb-row .credit-balance { font-size: 56px; line-height: 1; letter-spacing: -.03em; background: none; color: #fff; }
.cb-unit { font-size: 18px; font-weight: 600; color: rgba(255, 255, 255, .7); }
.cb-badge { align-self: center; font-size: 11.5px; font-weight: 800; color: #000; background: var(--grad); padding: 3px 10px; border-radius: 999px; }
.cb-rate { color: rgba(255, 255, 255, .55); font-size: 12.5px; }
.cb-add { flex: none; }
.btn.cb-add .ic { order: 0; }

.tx-list { display: grid; border-radius: 28px; border: 1px solid var(--line); background: var(--glass); overflow: hidden; }
.tx { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 20px; }
.tx + .tx { border-top: 1px solid var(--line); }
.tx:hover { background: rgba(255, 255, 255, .025); }
.tx-ic { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .06); color: #cfcfd5; }
.tx-ic .ic { width: 18px; height: 18px; stroke-width: 1.8; }
.tx.plus .tx-ic { background: rgba(109, 255, 160, .1); color: var(--green); }
.tx-text { display: grid; gap: 2px; min-width: 0; }
.tx-text b { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-text small { color: var(--muted); font-size: 12.5px; }
.tx-amt { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx.plus .tx-amt { color: var(--green); }
.tx-empty { display: grid; justify-items: center; gap: 6px; padding: 40px 20px; text-align: center; }
.tx-empty .ic { width: 30px; height: 30px; color: var(--muted); }

.tu-modal { width: min(560px, 100%); gap: 18px; }
.tu-modal .modal-head h3 { font-size: 20px; }
.tu-list { display: grid; gap: 10px; }
.tu-pack {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; gap: 2px 14px;
  padding: 18px 22px; border-radius: 22px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .03);
  color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background .15s, transform .15s;
}
.tu-pack:hover:not(:disabled) { border-color: rgba(255, 255, 255, .45); background: rgba(255, 255, 255, .06); transform: translateY(-1px); }
.tu-pack:disabled { cursor: not-allowed; opacity: .55; }
.tu-pack.best { border-color: transparent; background: linear-gradient(#1a1a1d, #1a1a1d) padding-box, var(--grad) border-box; }
.tu-flag { position: absolute; top: -10px; right: 18px; padding: 3px 10px; border-radius: 999px; background: var(--grad); color: #000; font-size: 11px; font-weight: 800; }
.tu-credits { display: flex; align-items: baseline; gap: 6px; }
.tu-credits b { font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tu-credits small { color: var(--muted); font-size: 13px; }
.tu-bonus { grid-column: 1; font-size: 13px; font-weight: 700; color: var(--green); }
.tu-bonus.none { color: var(--muted); font-weight: 500; }
.tu-price { grid-column: 2; grid-row: 1 / 3; padding: 10px 18px; border-radius: 999px; background: #fff; color: #000; font-weight: 800; font-size: 15px; white-space: nowrap; }
.tu-note { margin: 0; text-align: center; color: var(--muted); font-size: 12.5px; }
@media (max-width: 640px) {
  .cb-card { padding: 24px; border-radius: 28px; }
  .cb-row .credit-balance { font-size: 44px; }
  .cb-add { width: 100%; }
  .tx { padding: 12px 14px; gap: 10px; grid-template-columns: 36px minmax(0, 1fr) auto; }
  .tx-ic { width: 36px; height: 36px; }
}
.top .user { margin-left: auto; }
/* long face names: cut with "…" instead of spilling out of cards and chips (full name on hover) */
.pcard, .pcard-info, .lib-face, .pick, .result-side, .result-side > * { min-width: 0; }
.pcard-info b, .pcard-info small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-chips { min-width: 0; }
.map-chip { max-width: 100%; min-width: 0; }
.map-chip img, .map-chip .gone, .map-chip .ic { flex: none; }
.map-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.face-name { min-width: 0; max-width: 100%; text-align: left; }

/* ---- earlier versions under the result ---- */
.result-wrap { display: grid; gap: 22px; }
.versions { display: grid; gap: 14px; }
.versions-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.versions-head h3 { font-size: 17px; }
.versions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.ver-card { display: grid; gap: 10px; align-content: start; padding: 10px 10px 14px; border-radius: 24px; border: 1px solid var(--line); background: var(--glass); min-width: 0; }
.ver-media { width: 100%; aspect-ratio: 16 / 10; object-fit: contain; border-radius: 16px; background: #000; display: block; }
.ver-meta { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.ver-title { flex: 1; min-width: 0; display: grid; }
.ver-title b { font-size: 14.5px; }
.ver-title small { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ver-card .map-chips { padding: 0 4px; }

/* Safari: rounded corners with overflow:hidden don't clip blurred / animated / transformed / video children,
   so the colour shows as a square. A mask forces the clip. (No outer shadows on these, the mask would cut them.) */
.drop, .bar, .pcard-face, .login, .rail-avatar, .c-frame, .node-body, .n-hero, .lp-card, .cb-card, .tx-list, .side-item img,
.player video, .result-img, .poster, .ver-media, .drop-preview, .node-thumb, .art, .credit-badge, .logo {
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  mask-image: radial-gradient(white, black);
  isolation: isolate;
}
.c-frame { box-shadow: none; }
.c-center { filter: drop-shadow(0 30px 50px rgba(139, 92, 255, .3)); }
/* the rail (and its avatar menu) above the video list and the page; sticky makes it its own stacking layer */
.rail { z-index: 25; }
.user-menu { z-index: 60; }
.user-menu { position: fixed; z-index: 60; }
.about-modal .terms-doc a { color: var(--text); }
.mark-note { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.mark-note a { color: var(--text); font-weight: 700; }
.tu-mark { margin: 0; padding: 10px 14px; border-radius: 16px; text-align: center; font-size: 13px; background: rgba(109, 255, 160, .08); border: 1px solid rgba(109, 255, 160, .25); color: #d9ffe6; }

/* crawler / no-JS fallback inside #view (replaced by the app on load) */
.seo-fallback { max-width: 720px; margin: 64px auto; padding: 0 20px; color: var(--muted, #a1a1aa); line-height: 1.6; }
.seo-fallback h1 { color: #fff; font-size: 32px; line-height: 1.2; margin: 0 0 16px; }
.seo-fallback a { color: #fff; }
/* help menu (rail "?"): guide pages */
.help-menu { min-width: 270px; }
.hm-head { display: grid; padding: 6px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.hm-head b { font-size: 14px; }
.hm-head small { color: var(--muted); font-size: 12px; }
.hm-text { display: grid; gap: 1px; }
.hm-text small { color: var(--muted); font-size: 12px; font-weight: 500; }
.lp-fb { display: inline-flex; align-items: center; gap: 6px; } .lp-fb .ic { width: 16px; height: 16px; }

/* ---- admin: payments ---- */
.pay-admin { display: grid; gap: 12px; margin-top: 8px; }
.pay-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pay-head .grow { flex: 1; }
.pay-head .sec-title { margin: 22px 0 0; }
.pay-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.pay-tile { display: grid; gap: 2px; padding: 14px 16px; border-radius: 18px; border: 1px solid var(--line); background: var(--panel-2); }
.pay-tile small { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.pay-tile b { font-size: 22px; font-variant-numeric: tabular-nums; }
.pay-tile .muted { font-size: 12px; }
.pay-tile.accent { border-color: var(--yellow); }
.pay-months { border-radius: 14px; overflow: hidden; }
.pay-filter { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); justify-self: start; flex-wrap: wrap; }
.pay-inv { display: grid; border-radius: 18px; border: 1px solid var(--line); overflow: hidden; }
.pay-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); }
.pay-row:first-child { border-top: 0; }
.pay-who, .pay-when { display: grid; min-width: 0; }
.pay-who b, .pay-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay-who small, .pay-when small { font-size: 12px; color: var(--muted); }
.pay-when small:first-child { color: var(--text); }
.pay-status { font-size: 11.5px; font-weight: 800; padding: 3px 9px; border-radius: 999px; white-space: nowrap; background: var(--panel-3); color: var(--muted); }
.pay-status.ok { background: rgba(109, 255, 160, .12); color: var(--green); }
.pay-status.wait { background: var(--yellow-dim); color: var(--yellow); }
.pay-amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pay-row.off .pay-amt { color: var(--muted); text-decoration: line-through; }
@media (max-width: 640px) { .pay-row { grid-template-columns: minmax(0, 1fr) auto; } .pay-when { grid-column: 1; } .pay-status { grid-row: 1; grid-column: 2; } }
.pay-months { width: 100%; border-collapse: collapse; font-size: 14px; border: 1px solid var(--line); }
.pay-months th, .pay-months td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.pay-months th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.pay-months .num { text-align: right; font-variant-numeric: tabular-nums; }
