:root {
  /* Grey theme: page ground, then panels a step lighter, then controls inside them. */
  --bg: #1c1c1f;
  --page: #141416;
  --surface: #252529;
  --surface-2: #303035;
  --line: #323238;
  --line-strong: #4a4a52;
  --text: #ededf0;
  --muted: #a3a3ad;
  --blue: #2f6fec;
  --blue-soft: rgba(59, 130, 246, .16);
  --blue-line: rgba(59, 130, 246, .45);
  --red: #f87171;
  --r: 12px;
  --card: 480px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--page); color: var(--text);
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, select, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 28px;
  height: 56px; padding: 0 24px 0 32px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: .03em; font-size: 16px; white-space: nowrap; }
.key-btn, .balance { white-space: nowrap; }
@media (max-width: 560px) { #keyLabel { display: none; } .brand { font-size: 14px; } }
.tabs { display: flex; gap: 6px; height: 100%; }
.tab {
  position: relative; background: none; border: 0; padding: 0 10px; color: var(--muted); font-weight: 500; font-size: 15px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; background: var(--text); border-radius: 2px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.balance {
  height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  font-weight: 600; font-variant-numeric: tabular-nums;
}
.key-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px;
  padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-weight: 500;
}
.key-btn:hover, .balance:hover { background: var(--surface); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.dot.on { background: #16a34a; }

/* ---------- Layout ---------- */
.layout {
  display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 12px;
  padding: 12px; height: calc(100vh - 56px);
}

/* ---------- Segmented controls ---------- */
.seg { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.seg button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; border: 0; border-radius: 7px; background: none; color: var(--muted); font-weight: 500;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface-2); color: var(--text); }
.seg.big { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 6px; }
.seg.big button { height: 32px; }
.seg.flat { border: 0; padding: 0; background: none; }
.seg.flat button { flex: none; padding: 0 10px; height: 32px; }
.seg.flat b { font-weight: 500; color: var(--muted); margin-left: 2px; }
.seg.tiny { padding: 2px; gap: 2px; }
.seg.tiny button { width: 30px; height: 28px; flex: none; }

/* ---------- Panel ---------- */
.panel {
  display: flex; flex-direction: column; min-height: 0;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); overflow: hidden;
}
.panel-body { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.panel-body > * { flex-shrink: 0; }
.panel-foot { padding: 12px; border-top: 1px solid var(--line); }

.upload {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r); transition: background .15s, border-color .15s;
}
.upload.drag { background: var(--blue-soft); border-color: var(--blue-line); }
.upload-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 0; text-align: left; }
.upload-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 9px; background: var(--surface); }
.upload-text { display: flex; flex-direction: column; min-width: 0; }
.upload-text strong { font-weight: 500; }
.upload-text small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-kinds { display: flex; gap: 6px; }
.upload-kinds button {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--bg); color: var(--muted);
}
.upload-kinds button:hover { color: var(--text); border-color: var(--line-strong); }

.refs { display: flex; flex-wrap: wrap; gap: 8px; }
.refs:empty { display: none; }
.ref { position: relative; width: 58px; height: 58px; border-radius: 9px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.ref img, .ref video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref .tag { position: absolute; left: 3px; bottom: 3px; padding: 0 4px; border-radius: 4px; background: rgba(255,255,255,.92); font-size: 9.5px; font-weight: 600; }
.ref .x {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%;
  border: 0; background: rgba(17,17,19,.75); color: #fff; font-size: 12px; line-height: 18px; padding: 0;
}
.ref.audio { display: grid; place-items: center; font-size: 18px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }

.prompt-box { position: relative; border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; }
.prompt-box:focus-within { border-color: var(--line-strong); }
.prompt-top { display: flex; justify-content: space-between; padding: 12px 12px 4px; font-size: 13px; }
.prompt-top .hint { color: var(--muted); font-size: 12px; }
.prompt-box textarea { border: 0; outline: 0; resize: none; height: 120px; background: transparent; padding: 4px 12px 8px; line-height: 1.6; }
.prompt-box textarea::placeholder { color: #7c7c86; }
.prompt-foot { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 13px; color: var(--text);
}
.chip:hover { background: var(--surface); }
.chip { white-space: nowrap; }
.items:empty { display: none; }
.chip.toggle.on, .chip.picked { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue); }

.at-menu, .popover {
  position: absolute; left: 8px; right: 8px; z-index: 5;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.12); padding: 6px; max-height: 260px; overflow-y: auto;
}
.at-menu { top: 72px; }
.popover { bottom: 48px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 0; border-radius: 7px; background: none; text-align: left; }
.menu-item:hover, .menu-item.sel { background: var(--surface); }
.menu-item img, .menu-item .thumb { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; flex: none; }
.menu-item small { color: var(--muted); margin-left: auto; }
.menu-note { padding: 6px 8px; color: var(--muted); font-size: 12px; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 0; }

.model-card { position: relative; display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; }
.model-card:hover { border-color: var(--line-strong); }
.field-label { display: block; font-size: 12px; color: var(--muted); }
.model-row { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.badge { padding: 1px 7px; border-radius: 6px; background: var(--surface-2); font-size: 11px; font-weight: 500; color: var(--muted); }
.model-card select, .opt select { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.caret { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

.opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.opts.two { grid-template-columns: repeat(2, 1fr); }
.opt {
  position: relative; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px; color: var(--muted); cursor: pointer;
}
.opt:hover { border-color: var(--line-strong); }
.opt .val { color: var(--text); font-weight: 500; }

.summary { font-size: 12px; color: var(--muted); padding: 0 2px; }
.error { padding: 10px 12px; border-radius: 10px; background: #fef2f2; color: var(--red); font-size: 13px; border: 1px solid #fecaca; word-break: break-word; white-space: pre-line; }

.generate {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; border: 0; border-radius: 10px; background: var(--blue); color: #fff; font-weight: 600; font-size: 16px;
  transition: background .15s, transform .1s;
}
.generate:hover { background: #1d4ed8; }
.generate:active { transform: scale(.99); }
.generate:disabled { background: #93b4f5; cursor: not-allowed; }
.cost { padding: 2px 8px; border-radius: 6px; background: rgba(255,255,255,.2); font-size: 13px; font-weight: 500; }

/* ---------- Feed ---------- */
.feed {
  min-width: 0; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); overflow: hidden;
}
.feed-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.feed-tools { display: flex; align-items: center; gap: 12px; }
.icon-btn { position: relative; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface); color: var(--text); }
.filter-btn select { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.filter-btn.on { color: var(--blue); }
input[type=range] { width: 100px; accent-color: var(--blue); }

.items { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.item { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 12px; }
.media {
  position: relative; display: flex; align-items: center; justify-content: center;
  height: var(--card); border-radius: var(--r); overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
}
.media img, .media video { max-width: 100%; max-height: 100%; display: block; }
.media .state { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); padding: 40px; text-align: center; }
.media .state.err { color: var(--red); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--text); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.tools { position: absolute; top: 14px; right: 14px; display: flex; flex-direction: column; gap: 6px; }
.tools a, .tools button {
  position: relative; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.92); border: 1px solid var(--line); color: var(--text); text-decoration: none; padding: 0;
}
.tools a:hover, .tools button:hover { background: #fff; border-color: var(--line-strong); }
.tools .liked { color: #e11d48; }
.more-menu { position: absolute; right: 42px; top: 0; z-index: 4; min-width: 170px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.12); padding: 4px; }
.more-menu button { width: 100%; height: auto; border-radius: 7px; border: 0; padding: 7px 10px; text-align: left; display: block; background: none; }
.more-menu button:hover { background: var(--surface); }
.more-menu .danger { color: var(--red); }

.meta {
  border: 1px solid var(--line); border-radius: var(--r); padding: 14px;
  display: flex; flex-direction: column; gap: 12px; height: var(--card); min-height: 0;
}
.model-tag {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 8px; border: 1px solid var(--line); font-weight: 500; font-size: 13px;
}
.model-tag i { width: 14px; height: 14px; border-radius: 4px; background: var(--blue); display: inline-block; }
.meta .prompt-text { flex: 1; min-height: 0; overflow-y: auto; font-size: 13px; line-height: 1.55; white-space: pre-wrap; color: #3f3f46; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; color: var(--muted); }
.meta .date { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; }

/* Grid view */
.items.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(var(--card) * .55), 1fr)); align-content: start; }
.items.grid .item { grid-template-columns: 1fr; }
.items.grid .meta { display: none; }
.items.grid .media { height: calc(var(--card) * .75); }

.empty { margin: 16px; text-align: center; padding: 80px 20px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r); }
.empty p { margin: 0 0 4px; color: var(--text); font-weight: 600; }
.how { padding: 24px 32px; max-width: 720px; overflow-y: auto; }
.how h3 { margin: 0 0 12px; }
.how li { margin-bottom: 10px; color: #3f3f46; }

/* ---------- Dialog + toast ---------- */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(460px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.18); }
dialog::backdrop { background: rgba(17,17,19,.3); }
.dialog { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.dialog h2 { margin: 0; font-size: 18px; }
.dialog p { margin: 0; color: var(--muted); }
.dialog input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; outline: 0; }
.dialog input:focus { border-color: var(--line-strong); }
.muted { font-size: 13px; }
.dialog-actions { display: flex; gap: 8px; align-items: center; }
.dialog-actions span { flex: 1; }
.primary, .ghost { padding: 8px 14px; border-radius: 10px; font-weight: 600; }
.primary { background: var(--text); color: #fff; border: 0; }
.ghost { background: var(--bg); border: 1px solid var(--line); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: #fff; padding: 9px 14px; border-radius: 10px; font-size: 13px; z-index: 50; }

/* ---------- Phones ---------- */
@media (max-width: 900px) {
  .topbar { gap: 12px; padding: 0 16px; }
  .layout { grid-template-columns: 1fr; height: auto; }
  .panel { max-height: none; }
  .feed { min-height: 70vh; }
  .item { grid-template-columns: 1fr; }
  .meta { height: auto; }
  .feed-tools input[type=range] { display: none; }
}

/* ---------- Accounts, credits, legal ---------- */
.top-group { display: flex; align-items: center; gap: 8px; }
.ghost-btn, .dark-btn { height: 36px; padding: 0 14px; border-radius: 10px; font-weight: 600; white-space: nowrap; }
.ghost-btn { background: var(--bg); border: 1px solid var(--line); }
.ghost-btn:hover { background: var(--surface); }
.dark-btn { background: var(--text); color: #fff; border: 0; }
.dark-btn:hover { background: #2a2a2e; }
.balance { display: inline-flex; align-items: center; gap: 6px; }
.balance.low { color: var(--red); border-color: #fecaca; }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 0; background: linear-gradient(135deg, #93c5fd, #2563eb); color: #fff; font-weight: 700; text-transform: uppercase; }

.foot-links { display: flex; justify-content: center; gap: 14px; margin-top: 10px; font-size: 12px; }
.foot-links a, .small-link, .auth-links a, .fine a, .agree a { color: var(--muted); text-decoration: none; }
.foot-links a:hover, .small-link:hover, .auth-links a:hover, .fine a:hover, .agree a:hover { color: var(--text); text-decoration: underline; }

.dialog { position: relative; }
.dialog .close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 8px; border: 0; background: none; font-size: 20px; color: var(--muted); }
.dialog .close:hover { background: var(--surface); color: var(--text); }
.wide-dialog { width: min(560px, calc(100vw - 32px)); }
.primary.wide { width: 100%; height: 44px; }
.agree { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.agree input { margin-top: 2px; }
.auth-links { display: flex; justify-content: space-between; font-size: 13px; }
.ok { padding: 10px 12px; border-radius: 10px; background: #f0fdf4; color: #15803d; font-size: 13px; border: 1px solid #bbf7d0; }
.fine { font-size: 12px; color: var(--muted); margin: 0; }

.packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pack { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 16px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.pack:hover { border-color: var(--line-strong); background: var(--surface); }
.pack b { font-size: 22px; }
.pack span { color: var(--muted); font-size: 13px; }
.pack.sel { border-color: var(--blue); background: var(--blue-soft); }
.examples { font-size: 12px; color: var(--muted); background: var(--surface); border-radius: 10px; padding: 10px 12px; line-height: 1.7; }
#checkout:empty { display: none; }
#checkout { min-height: 360px; }

.acc-balance { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.acc-balance b { font-size: 20px; }
.dialog h4 { margin: 4px 0 0; font-size: 13px; color: var(--muted); font-weight: 500; }
.ledger { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.ledger div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 12px; font-size: 13px; border-bottom: 1px solid var(--line); }
.ledger div:last-child { border-bottom: 0; }
.ledger .plus { color: #15803d; font-weight: 600; }
.ledger small { color: var(--muted); }

.legal { max-height: 80vh; overflow-y: auto; }
.legal h3 { margin: 4px 0 0; }
.legal p { color: #3f3f46; font-size: 13.5px; line-height: 1.6; }
#legalTabs { margin-right: 40px; }


/* One-pack buy pop-up */
.packs { grid-template-columns: 1fr; }
.pack { flex-direction: row; justify-content: space-between; padding: 16px 18px; text-align: left; }
.pack b { font-size: 28px; }
.pack span { flex: 1; margin-left: 14px; }
.pack em { font-style: normal; font-weight: 600; background: var(--blue); color: #fff; padding: 8px 14px; border-radius: 9px; }
.examples { padding: 12px 14px; line-height: 1.4; }
.ex-head { font-weight: 600; color: var(--text); margin-bottom: 6px; font-size: 13px; }
.examples table { width: 100%; border-collapse: collapse; }
.examples td { padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--text); }
.examples td small { display: block; color: var(--muted); font-size: 11.5px; }
.examples td:last-child { text-align: right; white-space: nowrap; }
.examples td b { font-size: 15px; }
.ex-note { display: block; margin-top: 8px; color: var(--muted); }

/* Phones: keep the top bar inside the screen. The credits pill opens Buy credits. */
@media (max-width: 560px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .tab { padding: 0 6px; font-size: 14px; }
  .top-right { gap: 6px; }
  .top-group { gap: 6px; }
  #buyBtn { display: none; }
  .ghost-btn, .dark-btn, .balance { padding: 0 10px; }
}

/* ---------- Dark grey theme: spots that had white or black written in ---------- */

:root { color-scheme: dark; }
dialog { background: var(--bg); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.5); }
dialog::backdrop { background: rgba(0,0,0,.55); }
.dialog input { background: var(--surface); border-color: var(--line); color: var(--text); }
.dialog input::placeholder { color: #7c7c86; }
.at-menu, .popover, .more-menu { box-shadow: 0 12px 32px rgba(0,0,0,.45); }
.ref .tag { background: rgba(20,20,22,.9); color: var(--text); }
.tools a, .tools button { background: rgba(28,28,31,.92); border-color: var(--line); color: var(--text); }
.tools a:hover, .tools button:hover { background: var(--surface-2); }
.tools .liked { color: #fb7185; }
.meta .prompt-text, .how li, .legal p { color: #d4d4d8; }
.primary, .dark-btn { background: #ededf0; color: #18181b; }
.dark-btn:hover, .primary:hover { background: #ffffff; }
.toast { background: #ededf0; color: #18181b; }
.generate:hover { background: #2563eb; }
.generate:disabled { background: #3a4f7a; color: #c7d2e6; }
.error { background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.35); color: #fca5a5; }
.ok { background: rgba(74,222,128,.12); border-color: rgba(74,222,128,.35); color: #86efac; }
.ledger .plus { color: #86efac; }
.balance.low { border-color: rgba(248,113,113,.45); }
.chip.toggle.on, .chip.picked { color: #93b8ff; }
.media { background: #111113; }

/* The prompt box takes the panel's spare height, so the controls sit evenly with no empty gap. */
.panel-body > .prompt-box { flex: 1 0 auto; min-height: 220px; }
.prompt-box textarea { flex: 1; height: auto; min-height: 120px; }

/* Shown instead of the controls to someone with no models (not on the friends list). */
.invite { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 24px; text-align: center; color: var(--muted); }
.invite b { color: var(--text); font-size: 15px; }

/* ---------- AI apps (MCP) ---------- */
.ai-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.ai-box .fine b { color: var(--text); }
.copyline { display: flex; gap: 8px; align-items: center; }
.copyline code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 8px 10px; border-radius: 8px; background: var(--surface); }
.ghost.small { padding: 6px 10px; font-size: 12.5px; }
.keys summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.keys[open] summary { margin-bottom: 8px; }
.keyrow, .approw { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--line); }
.keyrow small, .approw small { color: var(--muted); }
.keyrow button { margin-left: auto; }
.newkey { margin: 8px 0; }
.who { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 13.5px; }
.grants { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.grants b { color: var(--text); }

/* ---------- Privacy & security (Account) ---------- */
.danger-zone { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.danger-zone summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.danger-zone[open] summary { margin-bottom: 8px; }
.dz-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; color: var(--muted); }
.dz-row button { margin-left: auto; white-space: nowrap; }
.dz-delete { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); margin-top: 4px; font-size: 13px; color: var(--muted); }
.dz-delete input { padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text); }
.danger { color: var(--red) !important; border-color: rgba(248,113,113,.4) !important; }

/* ---------- Continue with Google ---------- */
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 44px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: #fff; color: #1f1f1f; font-weight: 600; }
.google-btn:hover { background: #f2f2f2; }
.ex-sub { font-size: 12px; color: var(--muted); margin: -2px 0 6px; }

/* Model logo beside each row of the buy table */
.ex-model { display: flex; align-items: center; gap: 10px; }
.ex-logo { width: 22px; height: 22px; flex: none; }

/* Password box with a show/hide eye */
.pass-wrap { position: relative; display: flex; }
.pass-wrap[hidden] { display: none; }
.pass-wrap input { flex: 1; min-width: 0; padding-right: 44px; }
.pass-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; }
.pass-eye:hover, .pass-eye[aria-pressed="true"] { color: var(--text); }

/* Pickers (ShotBorn's): model, length, aspect ratio, resolution all open the same popover, upward. */
.model-card select, .opt select { pointer-events: none; }
.model-card:focus-visible, .opt:focus-visible { outline: none; border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(255, 255, 255, .08); }
.model-card[aria-expanded="true"], .opt[aria-expanded="true"] { border-color: var(--line-strong); }
.model-card[aria-expanded="true"] .caret, .opt[aria-expanded="true"] .caret { transform: translateY(-50%) rotate(180deg); }
.caret { transition: transform .16s cubic-bezier(.32, .72, 0, 1); }
.opt-icon { width: 16px; height: 16px; flex: none; opacity: .75; }
.model-logo { display: inline-flex; }
.pick-logo { width: 20px; height: 20px; flex: none; }
.pick-logo-blank { display: inline-block; border-radius: 6px; background: var(--surface-2); }
.pick-pop {
  position: fixed; z-index: 1200; padding: 10px; width: max-content; max-width: min(340px, calc(100vw - 24px));
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .4), 0 18px 48px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .07);
  animation: pick-in 150ms cubic-bezier(.32, .72, 0, 1);
}
.pick-pop.below { animation-name: pick-in-below; }
@keyframes pick-in { from { opacity: 0; transform: translateY(5px); } }
@keyframes pick-in-below { from { opacity: 0; transform: translateY(-5px); } }
.pick-pills { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pick-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px 7px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .72);
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer;
  transition: background-color .14s ease, border-color .14s ease, color .14s ease;
}
.pick-pill:hover { background: rgba(255, 255, 255, .09); border-color: rgba(255, 255, 255, .24); color: #fff; }
.pick-pill.on { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .55); color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .08); }
.pick-pill:focus-visible, .pick-row:focus-visible { outline: none; border-color: rgba(255, 255, 255, .7); box-shadow: 0 0 0 3px rgba(255, 255, 255, .16); }
.pill-icon { width: 15px; height: 15px; flex: none; opacity: .8; }
.pick-pop-model { padding: 6px; max-height: min(340px, 60dvh); overflow-y: auto; overscroll-behavior: contain; }
.pick-row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  background: none; border: 1px solid transparent; border-radius: 10px; color: var(--text); text-align: left; cursor: pointer;
}
.pick-row:hover { background: var(--surface-2); }
.pick-row.on { background: rgba(255, 255, 255, .07); }
.pick-text { flex: 1; min-width: 0; }
.pick-name { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.pick-sub { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-check { color: var(--text); font-weight: 700; }
@media (pointer: coarse) { .pick-pill { padding: 10px 14px; } .pick-row { padding: 11px 10px; } }
@media (prefers-reduced-motion: reduce) { .pick-pop { animation: none; } .caret { transition: none; } }

/* ===== PREMIUM PASS (owner, Oct 17: "looks very faded") =====================================================
   Nothing moves; only colour, light and depth. Why it read as faded: page, panels and controls were three almost
   equal greys, borders were grey lines, and nothing had an edge of light or a shadow. Now: a deeper ground (still
   dark grey, not black), panels that sit ON it (a lit top edge + soft shadow), controls that read as recessed glass,
   hairlines in white at low opacity (crisper than grey), brighter type, and a Generate button with real weight. */
:root {
  --page: #0f0f11;
  --bg: #161619;
  --surface: #1e1e22;
  --surface-2: #2a2a30;
  --line: rgba(255, 255, 255, .075);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #f5f5f7;
  --muted: #a1a1ac;
  --edge: inset 0 1px 0 rgba(255, 255, 255, .06);
  --lift: 0 1px 2px rgba(0, 0, 0, .5), 0 24px 48px -24px rgba(0, 0, 0, .75);
}
body { background: radial-gradient(1200px 600px at 20% -10%, rgba(255, 255, 255, .035), transparent 60%), var(--page); }
.topbar { background: rgba(15, 15, 17, .78); -webkit-backdrop-filter: saturate(140%) blur(14px); backdrop-filter: saturate(140%) blur(14px); }
.brand { letter-spacing: .06em; }
.panel, .feed { background: linear-gradient(180deg, #19191c, #141417); border-color: var(--line); box-shadow: var(--edge), var(--lift); }
.upload, .prompt-box, .model-card, .opt { background: rgba(255, 255, 255, .025); border-color: var(--line); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35); transition: border-color .15s ease, background-color .15s ease; }
.upload:hover, .model-card:hover, .opt:hover { background: rgba(255, 255, 255, .045); border-color: var(--line-strong); }
.prompt-box:focus-within { border-color: rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .035); }
.upload-icon { background: rgba(255, 255, 255, .06); box-shadow: var(--edge); }
.chip, .seg, .ghost-btn, .ghost, .icon-btn { border-color: var(--line); }
.media { background: #0c0c0e; border-color: var(--line); box-shadow: var(--edge); }
.meta { border-color: var(--line); }
.generate {
  background: linear-gradient(180deg, #3d7dff, #2860e8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -10px rgba(47, 111, 236, .75);
}
.generate:hover:not(:disabled) { filter: brightness(1.07); }
.dark-btn, .primary { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 6px 18px -8px rgba(0, 0, 0, .6); }
.balance { border-color: var(--line); }
.empty { border-color: var(--line-strong); }
.dialog, .pick-pop, .more-menu, .at-menu, .popover { box-shadow: var(--edge), 0 2px 4px rgba(0, 0, 0, .4), 0 24px 56px rgba(0, 0, 0, .6); }
