:root {
  --bg: #0a0a0a;
  --panel: #131313;
  --panel-2: #1b1b1b;
  --panel-3: #222;
  --line: #2a2a2a;
  --text: #f4f4f0;
  --muted: #9a9a92;
  --yellow: #ffd400;
  --yellow-2: #ffe866;
  --yellow-dim: rgba(255, 212, 0, .12);
  --red: #ff5a4f;
  --green: #b8f34a;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(255, 212, 0, .08), transparent 60%),
    repeating-linear-gradient(135deg, transparent 0 22px, rgba(255, 212, 0, .015) 22px 44px),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 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: 20px; flex-wrap: wrap;
  padding: 12px 24px; background: rgba(10, 10, 10, .88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--yellow); color: #000; box-shadow: 0 0 0 3px #000, 0 0 0 4px var(--yellow); }
.logo svg { width: 26px; height: 26px; }
.brand-name { display: block; font-size: 18px; font-weight: 800; line-height: 1.1; }
.brand-name span { color: var(--yellow); }
.sub { display: block; color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.tabs a { padding: 8px 16px; border-radius: 9px; text-decoration: none; font-weight: 700; font-size: 14px; color: var(--muted); }
.tabs a:hover { color: var(--text); }
.tabs a.on { background: var(--yellow); color: #000; }
.sys {
  margin-left: auto; 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(--yellow); box-shadow: 0 0 10px var(--yellow); }
.sys.busy .dot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---- layout ---- */
.app { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 24px; max-width: 1320px; margin: 0 auto; padding: 24px; }
.app.wide { grid-template-columns: minmax(0, 1fr); }
.app.wide .side { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); padding: 16px; gap: 16px; }
  .top { padding: 10px 16px; gap: 12px; }
  .sys { margin-left: 0; order: 3; width: 100%; justify-content: center; }
}

.card {
  background: linear-gradient(180deg, var(--panel), #0f0f0f);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; position: relative;
}

/* ---- sidebar ---- */
.side { position: sticky; top: 90px; align-self: start; display: grid; gap: 12px; max-height: calc(100vh - 110px); overflow: auto; padding-right: 2px; }
.new-btn { justify-content: center; padding: 13px; 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: 10px; align-items: center; padding: 8px; border-radius: 12px;
  text-decoration: none; border: 1px solid transparent; background: var(--panel);
}
.side-item:hover { border-color: #3a3a3a; }
.side-item.active { border-color: var(--yellow); background: #18160c; }
.side-item img, .side-ph { width: 52px; height: 52px; border-radius: 9px; 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(--yellow-2); }
.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: repeating-linear-gradient(90deg, var(--yellow) 0 10px, transparent 10px 16px); }
.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: var(--yellow); color: var(--yellow); box-shadow: 0 0 0 5px var(--yellow-dim); }
.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(19, 19, 19, .95); border: 1px solid var(--line); backdrop-filter: blur(8px);
}
@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 #3a3a32; 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: var(--yellow); background: #1e1c12; }
.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(--yellow); color: #000; }
.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: 12px; border-radius: 12px; background: var(--panel-2); 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(--yellow); }
.toggle input:checked + .sw::after { transform: translateX(18px); background: #000; }
.toggle input:focus-visible + .sw { outline: 2px solid var(--yellow-2); outline-offset: 2px; }
.text, select, .search {
  background: #000; color: var(--text); border: 1px solid #444; border-radius: 9px; padding: 9px 11px; font: inherit; min-width: 0;
}
.text:focus, select:focus, .search:focus { outline: none; border-color: var(--yellow); }
.upload { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 240px; }
.upload .bar { flex: 1; }
.upload-text { color: var(--yellow); 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 15px; border-radius: 10px;
  font-family: inherit; font-size: 13.5px; font-weight: 700; line-height: 1; cursor: pointer; text-decoration: none; white-space: nowrap;
  border: 1px solid #3a3a3a; background: #0d0d0d; color: var(--text);
}
.btn:hover { border-color: var(--yellow); color: var(--yellow); }
.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: 14px 24px; font-size: 15.5px; font-weight: 800; box-shadow: 0 5px 0 #9c8200; }
.btn.primary.lg:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 #9c8200; }
.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: repeating-linear-gradient(135deg, var(--yellow) 0 10px, #e0b900 10px 20px);
  background-size: 28px 28px; animation: stripes 1s linear infinite;
}
@keyframes stripes { to { background-position: 28px 0; } }
.progress-card { display: grid; gap: 14px; padding: 20px; border-radius: 12px; background: #0e0e0e; 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: 900; color: var(--yellow); line-height: 1; font-variant-numeric: tabular-nums; }
.progress-card.waiting .big-pct { color: var(--muted); 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 12px; border-radius: 10px; 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: var(--yellow-dim); border: 1px solid rgba(255, 212, 0, .4); }
.done-card > div { flex: 1; display: grid; gap: 12px; }
.done-ic { background: var(--yellow); color: #000; }

/* ---- people / assignment ---- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.pcard {
  display: grid; gap: 10px; padding: 12px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line);
  transition: border-color .15s; align-content: start;
}
.pcard.on { border-color: var(--yellow); background: #19170d; }
.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: 10px; 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 #444; 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(--yellow); 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(--yellow); }

/* ---- 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: 12px; 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; border-color: var(--yellow); color: var(--yellow); }
.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: var(--panel); border: 1px solid var(--yellow); border-radius: 16px; padding: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.modal.over { background: #1e1c12; }
.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: 10px; object-fit: cover; outline: 2px solid var(--yellow); }
.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: #555; }
.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: 7px; border-radius: 12px; 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: var(--yellow); background: #19170d; }
.pick-img { width: 100%; aspect-ratio: 1; border-radius: 8px; 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(--yellow); 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: 90px; }
@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: 10px 12px; border-radius: 10px; 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: 8px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.lib-face img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; 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(--yellow); }
.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: #000; color: var(--yellow); 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 #3a3a32; border-radius: 12px; background: transparent; color: var(--text); font: inherit; cursor: pointer;
}
.lib-drop:hover, .lib-drop.over { border-color: var(--yellow); background: #1e1c12; }
.lib-drop .ic { width: 40px; height: 40px; padding: 9px; border-radius: 50%; background: var(--yellow); 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(--yellow-2); }

body.signed-out .tabs, body.signed-out .sys { 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::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; border-radius: 14px 14px 0 0; background: repeating-linear-gradient(135deg, var(--yellow) 0 12px, #000 12px 24px); }
.login h1 { font-size: 28px; font-weight: 900; }
.login h1 span { color: var(--yellow); }
.login-logo .logo { width: 64px; height: 64px; border-radius: 16px; }
.login-logo .logo svg { width: 40px; height: 40px; }
.agree { display: flex; gap: 10px; text-align: left; font-size: 13px; color: var(--muted); padding: 12px; border-radius: 12px; 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: var(--yellow-2); color: #000; border-color: var(--yellow-2); }
.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(--yellow); font-weight: 700; }
.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; color: var(--yellow); 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: 5px 10px; border-radius: 999px; background: var(--yellow-dim); color: var(--yellow); font-weight: 800; font-size: 13px; text-decoration: none; white-space: nowrap; }
.credit-badge:hover { background: var(--yellow); color: #000; }
.credit-top { display: flex; flex-direction: column; gap: 2px; }
.credit-balance { font-size: 34px; font-weight: 900; color: var(--yellow); line-height: 1.1; }
.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: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); }
.price-box.warn { border-color: var(--yellow); background: var(--yellow-dim); }
.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; color: var(--yellow); }
.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: var(--yellow); }
.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 */
