/* Evil GPT — crimson-on-black members UI. Mobile first; widens on desktop. */
:root {
  /* Deep neutral black with crimson used only for accents and active state. */
  --bg: #08080a;
  --glow-1: #2c0711;
  --glow-2: #150409;
  --surface: #0f0f12;      /* sidebar, menus, raised panels */
  --surface-2: #16161a;    /* code blocks, inputs */
  --panel: rgba(255, 60, 80, .045);
  --panel-2: rgba(255, 60, 80, .085);
  --line: rgba(255, 255, 255, .085);
  --line-strong: rgba(255, 70, 90, .3);
  --text: #f2eff0;
  --muted: #9b9398;
  --faint: #6f686d;
  --red: #e01b2f;
  --kind-chat: #8f8bd6;    /* everyday  */
  --kind-code: #ff5e73;    /* coding    */
  --kind-brief: #e8b14a;   /* quick     */
  --red-soft: #ff4254;
  --radius: 22px;
  --radius-sm: 14px;
  --maxw: 760px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(42% 32% at 50% 30%, rgba(224, 27, 47, .14) 0%, transparent 70%),
    radial-gradient(130% 90% at 50% -10%, #3a0a16 0%, #17040c 42%, #0a0508 72%, var(--bg) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
/* A heading that drops one word onto its own last line is the thing that makes a
   page look generated rather than set. `balance` spreads a short block evenly;
   `pretty` is the slower pass that only pulls orphans up, so it is the one for
   running text. */
h1, h2, h3, .card-title, .plan-name, .empty h1, .plans-head h1, .auth-title {
  text-wrap: balance; }
p, .rc-note, .plans-note, .auth-lead, .tier-sub, .feat-note, .sup-item-meta {
  text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; color: inherit; }

.mark { width: 26px; height: 26px; flex: none; border-radius: 50%; object-fit: cover; -webkit-user-drag: none; user-select: none; filter: drop-shadow(0 0 10px rgba(224, 27, 47, .55)); transition: filter .25s ease, transform .25s ease; }

/* While the AI is answering, the brand mark springs to life (radar-style glow + spin). */
.thinking .mark { animation: markThink 1.15s cubic-bezier(.45,0,.55,1) infinite; }
@keyframes markThink {
  0%   { transform: scale(1) rotate(0deg);      filter: drop-shadow(0 0 8px rgba(224,27,47,.5)); }
  50%  { transform: scale(1.12) rotate(180deg);  filter: drop-shadow(0 0 20px rgba(255,77,94,.95)); }
  100% { transform: scale(1) rotate(360deg);     filter: drop-shadow(0 0 8px rgba(224,27,47,.5)); }
}
@media (prefers-reduced-motion: reduce) {
  .thinking .mark { animation: markPulse 1.2s ease-in-out infinite; }
  @keyframes markPulse { 0%,100% { filter: drop-shadow(0 0 8px rgba(224,27,47,.5)); } 50% { filter: drop-shadow(0 0 20px rgba(255,77,94,.95)); } }
}
.brand { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand-gpt { color: var(--red-soft); }
.brand-lg { font-size: 30px; }
.caret { color: var(--muted); font-size: 12px; line-height: 1; }

/* ---------------- Buttons ---------------- */
/* The attribute means hidden, whatever a class says about display. Without the
   !important a rule like `.btn { display: inline-flex }` quietly outranks it. */
[hidden] { display: none !important; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 18px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--panel-2); font-weight: 600; width: 100%;
  transition: transform .06s ease, filter .15s ease, border-color .15s ease; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, var(--red-soft), var(--red)); border-color: transparent;
  color: #fff; box-shadow: 0 10px 30px -14px var(--red); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { border-color: var(--line-strong); }
.btn-tg { margin-top: 10px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--panel);
  font-size: 14px; font-weight: 500; white-space: nowrap; }
.pill:hover { background: var(--panel-2); }
.pill-model { max-width: 42vw; overflow: hidden; }
.pill-model > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- Language switch ---------------- */
.lang-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: rgba(0, 0, 0, .25); flex: none; }
.lang-opt { padding: 5px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  color: var(--muted); line-height: 1; }
.lang-opt.is-on { background: var(--panel-2); color: var(--text); }
.lang-opt:hover { color: var(--text); }
.topbar .lang-switch { margin-left: 2px; }

/* ---------------- Auth ---------------- */
body.auth { display: grid; place-items: center; padding: 24px; }
.auth-wrap { width: 100%; max-width: 420px; }
.auth-top { display: flex; justify-content: center; margin-bottom: 14px; }
.auth-title { margin: 4px 0 8px; font-size: 22px; font-weight: 700; }
.code-label { color: var(--muted); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; margin-top: 18px; }
.code-big { font-family: "JetBrains Mono", monospace; font-weight: 500;
  font-size: clamp(30px, 10vw, 42px); letter-spacing: .08em; white-space: nowrap;
  margin: 8px 0 4px; color: #fff; text-shadow: 0 0 26px rgba(224, 27, 47, .55); }
.auth-hint { color: var(--muted); font-size: 12.5px; line-height: 1.6; margin: 6px 0 18px; }
.auth-waiting { color: var(--muted); font-size: 13px; margin: 16px 0 10px; }
.auth-waiting.is-error { color: #ffb3bb; }
.auth-cancel { background: none; border: 0; color: var(--faint); font-size: 13px;
  border-bottom: 1px solid transparent; padding: 0; }
.auth-cancel:hover { color: var(--text); border-bottom-color: var(--line-strong); }
.auth-card {
  background: linear-gradient(180deg, rgba(255, 66, 84, .09), transparent 42%), rgba(16, 5, 8, .72);
  border: 1px solid var(--line); border-radius: 26px; padding: 34px 26px;
  text-align: center; box-shadow: 0 50px 120px -50px #000; }
.auth-card { position: relative; }
.auth-close { position: absolute; top: 12px; right: 14px; width: 32px; height: 32px;
  display: grid; place-items: center; border-radius: 50%; color: var(--faint);
  font-size: 22px; line-height: 1; text-decoration: none;
  transition: color .18s ease, background .18s ease; }
.auth-close:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.auth-mark { display: grid; place-items: center; margin-bottom: 12px; }
.auth-mark .mark { width: 46px; height: 46px; }
.auth-tag { color: var(--muted); margin: 8px 0 20px; font-size: 13px; }
.auth-lead { color: #ddc8cb; font-size: 14px; line-height: 1.65; margin: 0 0 18px; }
.auth-form { display: flex; gap: 10px; }
.code-input { flex: 1; width: 100%; text-align: center; letter-spacing: .3em; text-transform: uppercase;
  font-family: "JetBrains Mono", monospace; font-size: 17px; padding: 13px 10px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, .35); color: var(--text); }
.code-input:focus { outline: none; border-color: var(--red); }
.auth-form .btn { width: auto; padding-inline: 20px; }
.auth-error { background: rgba(224, 27, 47, .16); border: 1px solid var(--line-strong); color: #ffc0c6;
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; margin-bottom: 16px; }
.auth-foot { color: var(--faint); font-size: 12px; margin: 18px 0 0; }

/* ---------------- Shell + top bar ---------------- */
.shell { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
body.app { overflow: hidden; }
body.app .shell { height: 100vh; height: 100dvh; }

.topbar { display: flex; align-items: center; gap: 7px; padding: 12px 10px;
  border-bottom: 1px solid var(--line); background: rgba(8, 8, 10, .78);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20; }
.brand-btn { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px; }
.top-link { margin-left: auto; color: var(--muted); font-size: 14px; font-weight: 500; padding: 8px 4px; }
.brand-btn { min-width: 0; }
.brand-btn .brand { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-link:hover, .top-link.is-on { color: var(--text); }

.menu-anchor { position: relative; }
.menu { position: absolute; top: calc(100% + 8px); left: 0; min-width: 212px; z-index: 30;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 16px; padding: 6px;
  box-shadow: 0 30px 70px -30px #000; }
.menu-right { left: auto; right: 0; }
.menu form { margin: 0; }
.menu-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%;
  text-align: left; padding: 10px 12px; border: 0; border-radius: 11px; background: none; font-size: 14.5px; }
.menu-item:hover:not(:disabled) { background: var(--panel-2); }
.menu-item:disabled { opacity: .38; cursor: default; }
.menu-item.is-on { background: rgba(224, 27, 47, .16); }
.menu-danger { color: var(--red-soft); }
.opt-note { color: var(--faint); font-size: 12px; }
.tag { font-size: 10px; font-weight: 700; letter-spacing: .06em; color: var(--red-soft);
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 1px 6px; vertical-align: 1px; }

/* ---------------- Messages ---------------- */
.messages { flex: 1; overflow-y: auto; padding: 22px 14px 6px; position: relative; z-index: 1; }
.composer { position: relative; z-index: 1; }

.msg { max-width: var(--maxw); margin: 0 auto 18px; }
.msg-body { line-height: 1.7; font-size: 15.5px; word-wrap: break-word; overflow-wrap: anywhere; }
.msg-body p { margin: 0 0 12px; }
.msg-body p:last-child { margin-bottom: 0; }
.from-user .msg-body { margin-left: auto; width: fit-content; max-width: 86%;
  background: linear-gradient(180deg, rgba(255, 66, 84, .2), rgba(224, 27, 47, .13));
  border: 1px solid var(--line-strong); border-radius: 20px 20px 6px 20px; padding: 11px 15px; }
.from-ai .msg-body { color: #efe2e4; }
.msg-body pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px; overflow-x: auto; margin: 8px 0 14px; }
.msg-body code { font-family: "JetBrains Mono", monospace; font-size: 13.5px; }
.msg-body :not(pre) > code { background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }
.msg.pending .msg-body { color: var(--muted); }
.msg.failed .msg-body { color: #ffb3bb; }
.dots::after { content: "·"; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { 0% { content: "·"; } 33% { content: "· ·"; } 66% { content: "· · ·"; } 100% { content: "·"; } }

.empty { max-width: var(--maxw); margin: 14vh auto 0; text-align: center; color: var(--muted); }
.empty .mark { width: 52px; height: 52px; }
.empty h1 { color: var(--text); margin: 14px 0 6px; font-size: 22px; font-weight: 700; }
.empty p { margin: 0; font-size: 14px; }

/* ---------------- Composer ---------------- */
.composer { padding: 8px 14px 14px; }
.composer-box { max-width: var(--maxw); margin: 0 auto; padding: 14px 16px 10px;
  background: rgba(0, 0, 0, .45); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid rgba(224, 27, 47, .4); border-radius: 24px;
  box-shadow: 0 30px 80px -40px #000;
  transition: border-color .3s ease, box-shadow .3s ease; }
/* Focus is the border waking up rather than an outline fighting the design. */
.composer-box:focus-within { border-color: rgba(224, 27, 47, .85);
  box-shadow: 0 0 0 1px rgba(224, 27, 47, .3), 0 0 70px -20px rgba(224, 27, 47, .75); }
#input { width: 100%; resize: none; border: 0; background: transparent; color: var(--text);
  font-size: 16px; line-height: 1.5; padding: 6px 2px; height: 36px; min-height: 36px;
  max-height: 190px; overflow-y: auto; outline: none; }
#input::placeholder { color: var(--faint); }
.composer-row { display: flex; align-items: center; gap: 10px; padding-top: 4px; }
.mode-pick { display: inline-flex; align-items: center; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: rgba(0, 0, 0, .25); }
#mode { background: transparent; border: 0; color: var(--text); font-size: 13.5px; font-weight: 500; outline: none; }
#mode option { background: var(--surface); color: var(--text); }
.send { margin-left: auto; width: 42px; height: 42px; border-radius: 50%; border: 0; color: #fff;
  font-size: 19px; background: linear-gradient(180deg, var(--red-soft), var(--red));
  box-shadow: 0 10px 26px -10px var(--red); }
.send:disabled { opacity: .45; box-shadow: none; cursor: default; }

.retry-link { display: block; margin: 12px auto 0; max-width: var(--maxw); padding: 0;
  background: none; border: 0; color: var(--muted); font-size: 14px; text-align: left; }
.retry-link:hover { color: var(--text); }
.retry-link[hidden] { display: none; }

.tier { max-width: var(--maxw); margin: 14px auto 0; text-align: center; }
.tier-head { font-size: 14px; font-weight: 600; color: #e8d2d5; }
.tier-check { color: var(--red-soft); }
/* A tap on a touch screen leaves :hover stuck on whatever was tapped, so every
   hover that moves something has to be told it only applies to a real pointer.
   Colour and border changes are harmless and stay. */
@media (hover: none) {
  .role-card:hover, .sup-item:hover, .topbar .pill:hover, .top-tg:hover,
  .top-buy:hover, .send:hover:not(:disabled), .plan-card:hover { transform: none; }
  .side-new:hover .mi-ic, .chat-row:hover .chat-kind, .chat-row:hover .chat-open,
  .side-item:hover .si-ic, .top-buy:hover .mi-ic, .top-buy:hover svg { transform: none; }
  .btn-primary:hover, .top-buy:hover, .send:hover:not(:disabled) { filter: none; }
}
/* A finger is about 9mm across. These are the controls that were under that. */
@media (pointer: coarse) {
  .lang-opt { padding: 10px 14px; }
  .attach { width: 40px; height: 40px; }
  .search-pill { height: 40px; }
  .pill { padding: 11px 14px; }
}
.tier-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--red-soft); box-shadow: 0 0 10px var(--red); vertical-align: 1px; }
.tier-dot-free { background: var(--faint); box-shadow: none; }
.tier-sub { color: var(--faint); font-size: 12.5px; margin-top: 4px;
  font-variant-numeric: tabular-nums; }
.tier-cta { display: inline-block; margin-top: 8px; font-size: 13px; color: var(--red-soft);
  border-bottom: 1px solid var(--line-strong); }
.disclaimer { text-align: center; color: var(--faint); font-size: 12px; margin: 12px 0 0; }
.disclaimer a { color: var(--muted); border-bottom: 1px solid var(--line); }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60;
  background: #1d070b; border: 1px solid var(--line-strong); color: #ffc9ce;
  padding: 10px 16px; border-radius: 999px; font-size: 13px; max-width: 90vw; text-align: center; }

/* ---------------- Account / guide pages ---------------- */
.page-body { width: 100%; max-width: 620px; margin: 0 auto; padding: 18px 14px 40px;
  display: flex; flex-direction: column; gap: 14px; }
.card { background: linear-gradient(180deg, rgba(255, 66, 84, .07), transparent 46%), rgba(16, 5, 8, .6);
  border: 1px solid var(--line); border-radius: 20px; padding: 18px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-title { font-weight: 700; font-size: 16px; }
.card-sub { color: var(--muted); font-size: 13px; margin: 4px 0 12px; line-height: 1.6; }
.card-foot { color: var(--faint); font-size: 12.5px; margin: 10px 0 0; }
.card-foot.warn { color: #ffb3bb; }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; background: linear-gradient(180deg, rgba(255, 66, 84, .28), rgba(224, 27, 47, .12));
  border: 1px solid var(--line-strong); }
/* The avatar is served as an <img> (real Telegram photo, or a server-made SVG with the
   same gradient and initial when there is none), so it fills the circular frame. */
.avatar-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block;
  -webkit-user-drag: none; user-select: none; }
.badge { margin-left: auto; font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted); }
.badge-pro { color: #ffc6cc; border-color: var(--line-strong); background: rgba(224, 27, 47, .18); }

.facts { margin: 0; display: flex; flex-direction: column; }
.facts > div { display: flex; gap: 14px; align-items: baseline;
  justify-content: space-between; padding: 9px 0; border-top: 1px solid var(--line); }
.facts > div:first-child { border-top: 0; padding-top: 2px; }
.facts dt { color: var(--muted); font-size: 13px; flex: none; }
.facts dd { margin: 0; font-size: 14px; font-weight: 600; text-align: right;
  font-variant-numeric: tabular-nums; }
.meter { height: 7px; border-radius: 999px; background: rgba(0, 0, 0, .45);
  border: 1px solid var(--line); margin-top: 14px; overflow: hidden; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--red-soft)); }
.plans { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.plans li { display: flex; align-items: baseline; gap: 8px; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel); font-size: 14px; }
.plans b { font-size: 15px; }
.plans .per { color: var(--faint); font-size: 12px; margin-left: 4px; }
.plan-row-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The price keeps its own corner whether or not the row has a button beside it. */
.plan-row-price { margin-left: auto; flex: none; white-space: nowrap; }
.plans .btn-sm { width: auto; flex: none; }
.steps, .bullets { margin: 0; padding-left: 20px; color: #ddc8cb; font-size: 14px; line-height: 1.7; }
.steps li, .bullets li { margin-bottom: 10px; }
.steps b { color: var(--text); }
.card .btn { margin-top: 4px; }

/* Narrow phones: the mark alone carries the brand so the pills keep their room. */
@media (max-width: 430px) {
  body.app .brand-btn .brand { display: none; }
  .pill { padding: 8px 11px; font-size: 13.5px; }
}
/* The row has more in it than a phone is wide, and the first thing to lose its text
   was the account link -- "Account" clipped to "A". The sidebar menu already carries
   it, so here it goes rather than half-renders. */
@media (max-width: 560px) {
  body.app .topbar { gap: 5px; padding-left: 8px; padding-right: 8px; }
  body.app .topbar .top-link { display: none; }
  body.app .topbar .ver-badge { display: none; }
  /* Upgrade is already the last line under the composer, where someone who has just
     run out of prompts is looking. Twice in one screen is once too many. */
  body.app .topbar .top-buy { display: none; }
  /* Russian labels are longer than the English ones, and the row has to hold them
     too: the model pill was pushed off the edge and took the page's width with it.
     Scrolling the bar is not an option -- it would clip the menus that drop out of
     it -- so the chrome gives up the room instead. */
  body.app .topbar .lang-opt { padding: 5px 7px; font-size: 12px; }
  body.app .topbar .pill { padding: 7px 9px; font-size: 13px; }
  body.app .topbar .caret { margin-left: 2px; }
}

@media (min-width: 820px) {
  .topbar { padding: 14px 22px; gap: 14px; }
  .messages { padding-inline: 22px; }
  .composer { padding-inline: 22px; }
  .pill-model { max-width: none; }
}

/* ===================== Motion & polish ===================== */
.btn, .pill, .send, .nav-item, .menu-item, .lang-opt, .tier-cta, .top-link,
.model-opt, .icon-btn { position: relative; overflow: hidden; }
.btn, .pill, .lang-opt, .top-link, .tier-cta, .send, .icon-btn {
  transition: transform .08s ease, filter .16s ease, background .18s ease,
              border-color .18s ease, color .18s ease; }
.btn:active, .pill:active, .lang-opt:active { transform: translateY(1px) scale(.985); }

/* Ripple injected by ui.js on press. */
.ripple { position: absolute; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255,255,255,.35), rgba(255,255,255,0) 70%);
  transform: scale(0); opacity: .7; animation: ripple .6s ease-out forwards; z-index: 0; }

@keyframes ripple { to { transform: scale(2.4); opacity: 0; } }
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes heroIn { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes codePulse { 0%, 100% { text-shadow: 0 0 20px rgba(224,27,47,.4); }
                       50% { text-shadow: 0 0 34px rgba(255,66,84,.85); } }

@media (prefers-reduced-motion: no-preference) {
  /* The page itself only fades, and quickly: sliding the whole document up is the
     one entrance every template ships with, and it holds the first word back by a
     third of a second. The parts that should arrive one after another say so
     themselves, just below. */
  body { animation: pageIn .2s ease-out both; }
  html.leaving body { opacity: 0; transition: opacity .13s ease; animation: none; }
  /* The empty screen arrives as four things, about 60ms apart, in reading order. */
  .empty > .hero-mark, .empty > h1, .empty > p, .empty > .roles {
    animation: heroIn .34s cubic-bezier(.22, 1, .36, 1) both; }
  .empty > h1 { animation-delay: .06s; }
  .empty > p { animation-delay: .12s; }
  .empty > .roles { animation-delay: .18s; }
  .menu:not([hidden]) { animation: menuIn .15s ease both; }
  .msg { animation: msgIn .3s ease both; }
  .card { animation: cardIn .4s ease both; }
  .card:nth-child(2) { animation-delay: .05s; }
  .card:nth-child(3) { animation-delay: .1s; }
  .code-big { animation: codePulse 2.4s ease-in-out infinite; }
  .send:hover { transform: scale(1.06); }
  .model-opt, .menu-item { transition: background .14s ease; }
}

/* The message list should still jump instantly when the user prefers less motion. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ===================== Menus: refined dropdowns ===================== */
.menu { padding: 7px; border-radius: 18px; background: rgba(22, 7, 11, .96);
  border: 1px solid var(--line-strong); box-shadow: 0 24px 60px -24px #000, 0 0 0 1px rgba(255,66,84,.05) inset;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.menu-lg { min-width: 236px; }
.menu-item { flex-direction: row; align-items: center; gap: 12px; padding: 11px 12px;
  border-radius: 12px; font-size: 14.5px; font-weight: 500; }
.menu-item:hover:not(:disabled) { background: linear-gradient(90deg, rgba(255,66,84,.16), rgba(255,66,84,.04)); }
.mi-ic { width: 22px; flex: none; text-align: center; font-size: 15px; opacity: .9; color: var(--red-soft); }
.menu-danger .mi-ic { color: var(--red-soft); }
.mi-tx { flex: 1; min-width: 0; }
.menu-sep { height: 1px; margin: 6px 10px; background: linear-gradient(90deg, transparent, var(--line-strong), transparent); }
/* Model rows keep their two-line layout. */
.model-opt { flex-direction: column; align-items: flex-start; gap: 3px; }
.mode-opt { gap: 10px; }

/* Live dot in the model pill. */
.dot-live { width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--red-soft); box-shadow: 0 0 8px var(--red); }
@media (prefers-reduced-motion: no-preference) { .dot-live { animation: pulse 2s ease-in-out infinite; } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ===================== Composer: mode pill ===================== */
.mode-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px;
  border-radius: 999px; border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(255,66,84,.1), rgba(0,0,0,.2));
  font-size: 13.5px; font-weight: 600; color: var(--text);
  transition: border-color .16s ease, background .16s ease, transform .08s ease; }
.mode-pill:hover { border-color: var(--red); }
.mode-pill:active { transform: translateY(1px); }
.mode-ic { color: var(--red-soft); font-size: 13px; }
.menu-up { top: auto; bottom: calc(100% + 10px); min-width: 170px; }
@media (prefers-reduced-motion: no-preference) {
  .menu-up:not([hidden]) { animation: menuUp .15s ease both; }
}
@keyframes menuUp { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }

/* ===================== Plans comparison page ===================== */
.plans-page { width: 100%; max-width: 920px; margin: 0 auto; padding: 22px 14px 48px; }
.plans-page #wallet { margin-bottom: 28px; }
#wallet-topup-form { align-items: center; }
#wallet-topup-form label { flex-basis: 100%; font-size: 13px; }
#wallet-topup-form input { min-width: 120px; }
#wallet summary { cursor: pointer; }
.plans-head { text-align: center; margin-bottom: 22px; }
.plans-head h1 { margin: 0 0 6px; font-size: clamp(22px, 5vw, 32px); font-weight: 800; letter-spacing: -.02em; }
.plans-head p { color: var(--muted); margin: 0; font-size: 14px; }

#top-plan { scroll-margin-top: 5rem; }
.plan-card.max-family { background: linear-gradient(145deg, #231c22, #141114 48%, #100d10); }
.max-family:has(#choice-plus:checked) { border-color: #785767; }
.max-picker { display: inline-grid; grid-template-columns: 1fr 1fr; align-self: flex-start;
  isolation: isolate; position: relative; padding: 3px; border-radius: 12px;
  background: #100e11; box-shadow: inset 0 0 0 1px #ffffff19; }
.max-picker label { z-index: 1; min-width: 63px; text-align: center; padding: 8px 13px;
  cursor: pointer; color: #b7adb4; font-size: 14px; font-weight: 600; line-height: 20px; }
.max-choice { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
.max-choice:checked + label { color: #fff; }
.max-choice:focus-visible + label { outline: 2px solid #ffd3df; outline-offset: 1px; border-radius: 9px; }
.max-thumb { position: absolute; inset: 3px auto 3px 3px; width: calc(50% - 3px);
  border-radius: 9px; background: #3d353c; box-shadow: inset 0 1px 0 #ffffff27, 0 2px 5px #0005; pointer-events: none; }
#choice-plus:checked ~ .max-thumb { transform: translateX(100%); background: #563b49; }
.max-variant { display: none; flex: 1; flex-direction: column; gap: 14px; }
.max-family:has(#choice-max:checked) .variant-base,
.max-family:has(#choice-plus:checked) .variant-plus { display: flex; }
@media (prefers-reduced-motion: no-preference) {
  .max-thumb { transition: transform .24s cubic-bezier(.2,.8,.2,1), background .24s; }
  .max-family .max-variant > :is(.plan-price,.plan-feats,.btn) { animation: maxReveal .2s ease-out both; }
  @keyframes maxReveal { from { opacity: .35; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}
.plan-cards { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 28px; }
.plan-card { position: relative; border: 1px solid var(--line); border-radius: 22px; padding: 22px 20px;
  background: linear-gradient(180deg, rgba(255,66,84,.06), transparent 44%), rgba(16,5,8,.6);
  display: flex; flex-direction: column; gap: 14px; }
.plan-card.rec { border-color: var(--red); box-shadow: 0 24px 60px -30px var(--red), 0 0 0 1px rgba(255,66,84,.25) inset; }
.plan-badge { position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(180deg, var(--red-soft), var(--red)); color: #fff; font-size: 11px;
  font-weight: 700; letter-spacing: .06em; padding: 4px 12px; border-radius: 999px; box-shadow: 0 8px 20px -8px var(--red); }
.plan-name { font-size: 18px; font-weight: 700; }
.plan-price { display: flex; align-items: baseline; gap: 6px; }
.plan-price b { font-size: 34px; font-weight: 800; letter-spacing: -.025em;
  font-variant-numeric: tabular-nums; }
.plan-price span { color: var(--muted); font-size: 13px; }
/* Every line used to open with a red tick, including "Model choice: Basic" and
   "Support: Standard" on the cheapest plan -- a tick that means nothing, because it
   was on everything. The row now says what it is on the left and what you get on the
   right, which is the only layout you can actually read across three cards. */
.plan-feats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.plan-feats li { display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; font-size: 13.5px; padding: 9px 0; border-top: 1px solid var(--line); }
.plan-feats li:first-child { border-top: 0; padding-top: 2px; }
.pf-k { color: var(--muted); flex: none; }
.pf-v { color: var(--text); font-weight: 600; text-align: right; min-width: 0;
  font-variant-numeric: tabular-nums; }
.plan-card .btn { margin-top: auto; }

.cmp { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: rgba(16,5,8,.55); }
.cmp-scroll { overflow-x: auto; }
table.cmp-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.cmp-table th, .cmp-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
.cmp-table thead th { background: rgba(255,66,84,.08); font-size: 14px; font-weight: 700; white-space: nowrap; }
.cmp-table thead th.rec { color: #ffd0d5; }
.cmp-table td:first-child, .cmp-table th:first-child { color: var(--muted); font-weight: 500; }
.cmp-table tbody tr:last-child td { border-bottom: none; }
.cmp-table tbody tr:hover { background: rgba(255,255,255,.02); }
.cmp-table td.rec { background: rgba(255,66,84,.06); color: #fff; font-weight: 600; }
.plans-note { color: var(--faint); font-size: 12.5px; margin: 18px 2px 0; line-height: 1.6; text-align: center; }

@media (min-width: 720px) {
  .plan-cards { grid-template-columns: repeat(3, 1fr); align-items: stretch; }
  .plan-card.rec { transform: translateY(-6px); }
}


/* ========================================================================== */
/*  Conversations sidebar, streaming placeholders and motion                   */
/* ========================================================================== */

.layout { display: flex; min-height: 100vh; min-height: 100dvh; }
body.app .layout { height: 100vh; height: 100dvh; }
body.app .shell { flex: 1; min-width: 0; height: 100vh; height: 100dvh; }

.sidebar {
  width: 264px; flex: none; z-index: 25;
  display: flex; flex-direction: column; gap: 10px; padding: 14px 10px;
  background: var(--surface); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-right: 1px solid var(--line);
}
.side-new {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 12px;
  border-radius: 12px; border: 1px solid var(--line); background: rgba(224, 27, 47, .10);
  color: var(--text); font-weight: 600; font-size: 14px;
  transition: background .18s ease, border-color .18s ease, transform .12s ease;
}
.side-new:hover { background: rgba(224, 27, 47, .2); border-color: var(--red); }
.side-new:active { transform: scale(.98); }
.side-label { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); padding: 2px 6px; }
.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.side-empty { color: var(--muted); font-size: 13px; padding: 6px; margin: 0; }

.chat-row {
  display: flex; align-items: center; gap: 2px; border-radius: 10px; padding: 1px 2px;
  animation: cardIn .22s ease both; transition: background .18s ease;
}
.chat-row:hover { background: rgba(255, 255, 255, .05); }
.chat-row.is-on { background: rgba(224, 27, 47, .16); }
.chat-open { flex: 1; min-width: 0; text-align: left; background: none; border: 0;
  padding: 9px 8px; color: var(--text); font-size: 13.5px; }
.chat-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-act { opacity: 0; background: none; border: 0; color: var(--muted); padding: 6px;
  border-radius: 8px; font-size: 12px; transition: opacity .16s ease, color .16s ease, background .16s ease; }
.chat-row:hover .chat-act, .chat-row.is-on .chat-act { opacity: .75; }
.chat-act:hover { opacity: 1; color: var(--red-soft); background: rgba(255, 255, 255, .07); }
.chat-rename { flex: 1; min-width: 0; margin: 5px 6px; padding: 5px 8px; border-radius: 8px;
  border: 1px solid var(--red); background: var(--surface-2); color: var(--text); font: inherit; font-size: 13.5px; }

/* The panel folds away on a desktop too, so the control is always there. Width is
   what animates: the conversation takes the space back as the panel leaves.
   It is given an outline of its own: unframed, three lines on a dark bar read as a
   decoration rather than as something to press. */
.side-toggle { display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex: none; color: var(--text);
  font-size: 17px; line-height: 1; border-radius: 11px;
  border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: background .16s ease, border-color .16s ease,
              color .16s ease, transform .12s ease; }
.side-toggle:hover { background: rgba(224, 27, 47, .16); border-color: var(--red);
  color: #fff; }
.side-toggle:active { transform: scale(.94); }
.side-toggle:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
/* Folded away, the control is the only way back, so it says so a little louder. */
.layout.side-hidden .side-toggle { border-color: var(--red);
  background: rgba(224, 27, 47, .14); }
.side-scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 24; animation: fadeIn .2s ease; }
.side-scrim[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (min-width: 901px) {
  .sidebar { overflow: hidden;
    transition: width .24s cubic-bezier(.22, 1, .36, 1), padding .24s ease,
                opacity .18s ease, border-color .24s ease; }
  .layout.side-hidden .sidebar { width: 0; padding-left: 0; padding-right: 0;
    opacity: 0; border-right-color: transparent; }
}

@media (max-width: 900px) {
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; transform: translateX(-100%);
    transition: transform .26s cubic-bezier(.22, 1, .36, 1); box-shadow: 0 0 40px rgba(0, 0, 0, .6); }
  .sidebar.open { transform: none; }
}

/* Signed out there is no account to show, so the foot of the panel carries the one
   step that is worth taking next. */
.side-join {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 12px;
  border: 1px solid var(--red); color: #fff; text-decoration: none;
  background: linear-gradient(180deg, var(--red-soft), var(--red));
  box-shadow: 0 10px 24px -14px var(--red);
  transition: transform .12s ease, box-shadow .18s ease, filter .18s ease;
}
.side-join:hover { filter: brightness(1.07); box-shadow: 0 14px 28px -14px var(--red); }
.side-join:active { transform: scale(.985); }
.side-join .si-ic { display: inline-flex; flex: none; }
.side-join-text { display: flex; flex-direction: column; min-width: 0; }
.side-join-cta { font-weight: 700; font-size: 13.5px; }
.side-join-note { font-size: 11px; opacity: .82; }

/* Skeleton shown between sending and the first streamed token. */
.skeleton { display: flex; flex-direction: column; gap: 9px; padding: 2px 0 8px; }
.sk-line { display: block; height: 11px; border-radius: 6px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .05) 25%, rgba(224, 27, 47, .18) 37%, rgba(255, 255, 255, .05) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
.sk-line:nth-child(2) { width: 86%; }
.sk-line.short { width: 54%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* A blinking caret trails the answer while it is still being written. */
.msg.writing .msg-body > :last-child::after {
  content: "▌"; color: var(--red-soft); margin-left: 2px; animation: caret 1s steps(2, end) infinite;
}
@keyframes caret { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* Switching conversations cross-fades the transcript. */
.messages { transition: opacity .15s ease, transform .15s ease; }
.messages.swapping { opacity: 0; transform: translateY(6px); }

/* Stop control, shown only while a reply is streaming. */
.composer-row > .menu-anchor { margin-right: auto; }
.composer-row .send { margin-left: 0; }
.stop { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .05); color: var(--text);
  font-size: 12.5px; font-weight: 600; transition: background .18s ease, border-color .18s ease; }
.stop:hover { border-color: var(--red); background: rgba(224, 27, 47, .16); }
.stop[hidden] { display: none; }

/* Toasts can carry a single action, used to offer "Try again" after a failure. */
.toast { display: flex; align-items: center; gap: 12px; }
.toast-act { background: rgba(224, 27, 47, .92); border: 0; color: #fff; font-weight: 700;
  font-size: 12px; padding: 6px 12px; border-radius: 999px; flex: none;
  transition: background .18s ease, transform .12s ease; }
.toast-act:hover { background: var(--red); }
.toast-act:active { transform: scale(.96); }

/* Menus open with a scale + fade rather than a plain slide. */
.menu { transform-origin: top center; }
.menu-right { transform-origin: top right; }
.menu-up { transform-origin: bottom center; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes menuUp { from { opacity: 0; transform: translateY(6px) scale(.94); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .sk-line, .msg.writing .msg-body > :last-child::after { animation: none; }
  .messages.swapping { transform: none; }
}

/* ========================================================================== */
/*  Copy affordances, searchable dropdowns, sidebar account menu              */
/* ========================================================================== */

/* Code blocks get a titled container with a copy control, like ChatGPT's. */
.code-block { margin: 14px 0; border: 1px solid var(--line); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--surface-2); }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px 8px 7px 13px; background: rgba(255, 255, 255, .035); border-bottom: 1px solid var(--line); }
.code-lang { font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.code-block pre { margin: 0; border: 0; border-radius: 0; background: transparent; }

.copy-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 9px;
  background: none; border: 1px solid transparent; color: var(--muted); font-size: 12px; line-height: 1.4;
  transition: color .16s ease, background .16s ease, border-color .16s ease, transform .12s ease; }
.copy-btn:hover { color: var(--text); background: rgba(255, 255, 255, .07); border-color: var(--line); }
.copy-btn:active { transform: scale(.94); }
.copy-btn.done { color: #5ddc8b; border-color: transparent; background: rgba(93, 220, 139, .12); }
.copy-ic { font-size: 13px; }

/* Copy belongs to a code block, which is taken whole; a reply is selectable text.
   The message-level button also sat on `position: absolute` inside a `.msg` that was
   not positioned, so it measured itself against the page and landed on its neighbour. */

/* Syntax colours. Strings green, keywords in the brand red, numbers warm, calls blue:
   enough contrast to read structure at a glance without turning a block into confetti. */
.tok-com { color: #8a7d83; font-style: italic; }
.tok-str { color: #6fd48a; }
.tok-kw { color: #ff6b86; }
.tok-num { color: #f2a35e; }
.tok-fn { color: #7cb7ff; }
.tok-lit { color: #c99bf2; }
.tok-tag { color: #ff6b86; }
.tok-attr { color: #f2a35e; }

/* Search field inside a dropdown. */
.menu-search { padding: 4px 4px 8px; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
.menu-search input { width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px;
  transition: border-color .16s ease; }
.menu-search input::placeholder { color: var(--faint); }
.menu-search input:focus { outline: none; border-color: var(--red); }
.menu-empty { padding: 12px 10px; color: var(--muted); font-size: 13px; text-align: center; }

/* Account actions pinned to the bottom of the sidebar. */
.side-foot { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 1px; }
.side-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px;
  border-radius: 10px; background: none; border: 0; color: var(--text); font-size: 13.5px; text-align: left;
  transition: background .16s ease, color .16s ease, transform .12s ease; }
.side-item:hover { background: rgba(255, 255, 255, .06); }
.side-item:active { transform: scale(.985); }
.side-item .si-ic { flex: none; width: 18px; text-align: center; font-size: 14px; color: var(--red-soft); }
.side-item.is-danger { color: var(--red-soft); }
.side-item.is-danger:hover { background: rgba(224, 27, 47, .14); }
.side-foot form { margin: 0; }

.side-user { display: flex; align-items: center; gap: 10px; padding: 10px 8px 4px; margin-top: 6px;
  border-top: 1px solid var(--line); }
.side-avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: linear-gradient(180deg, var(--red-soft), var(--red)); color: #fff; font-weight: 700; font-size: 13px; }
.side-who { min-width: 0; }
.side-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-plan { font-size: 11.5px; color: var(--muted); }

/* A new conversation slides up; a deleted one collapses out of the list. */
.chat-row { animation: none; max-height: 64px; overflow: hidden;
  transition: background .18s ease, max-height .24s ease, opacity .2s ease,
              padding .24s ease, margin .24s ease, transform .24s ease; }
.chat-row.is-new { animation: chatIn .3s cubic-bezier(.22, 1, .36, 1) both; }
.chat-row.removing { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0;
  margin-bottom: -3px; transform: translateX(-14px); }
@keyframes chatIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Redeem + referral surfaces on the account pages. */
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.inline-form input { flex: 1; min-width: 180px; padding: 11px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit;
  letter-spacing: .08em; text-transform: uppercase; transition: border-color .16s ease; }
.inline-form input:focus { outline: none; border-color: var(--red); }
.ref-link { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.ref-link code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px;
  font-family: "JetBrains Mono", monospace; font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  .chat-row.is-new { animation: none; }
  .chat-row.removing { transform: none; }
}

/* .btn is full-width by default; inside these one-line rows it must only take its own. */
.ref-link .btn, .inline-form .btn { flex: none; width: auto; }

/* --- referral earnings + payout history ---------------------------------- */
.sub-head { font-size: 13px; font-weight: 600; color: var(--text); margin: 16px 0 0; }

.rows { display: flex; flex-direction: column; margin-top: 8px; }
.row-line { display: flex; align-items: baseline; gap: 10px; padding: 11px 0;
  border-top: 1px solid var(--line); }
.row-line:first-child { border-top: 0; }
.row-main { flex: none; font-size: 14px; }
.row-side { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px;
  font-size: 12.5px; color: var(--muted); }
.row-amount { flex: none; margin-left: auto; font-size: 14px; white-space: nowrap; }
.row-dest { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--faint);
  word-break: break-all; padding-bottom: 10px; }

.state { padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--line); }
.state-pending { color: #ffd27a; border-color: rgba(255, 210, 122, .35); background: rgba(255, 210, 122, .1); }
.state-paid { color: #5ddc8b; border-color: rgba(93, 220, 139, .35); background: rgba(93, 220, 139, .1); }
.state-rejected { color: var(--red-soft); border-color: var(--line-strong); background: rgba(224, 27, 47, .12); }
.ref-note { color: var(--faint); word-break: break-all; }

/* ========================================================================== */
/*  Sidebar scrolling fix, role picker, Tor switch, and the premium pass      */
/* ========================================================================== */

/* THE BUG: .chat-list is a column flex container, so rows kept the default
   flex-shrink:1 and squashed to fit instead of overflowing. Nothing ever
   exceeded the box, so overflow-y:auto never produced a scrollbar. */
.sidebar { height: 100vh; height: 100dvh; }
.chat-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding-right: 2px; scrollbar-width: thin; scrollbar-color: rgba(224, 27, 47, .5) transparent; }
.chat-list::-webkit-scrollbar { width: 6px; }
.chat-list::-webkit-scrollbar-track { background: transparent; }
.chat-list::-webkit-scrollbar-thumb { background: rgba(224, 27, 47, .45); border-radius: 999px; }
.chat-list::-webkit-scrollbar-thumb:hover { background: var(--red); }
.chat-row { flex: 0 0 auto; position: relative; }

/* Row controls float above the title, so they never take width from it. */
.chat-acts { position: absolute; right: 3px; top: 50%; transform: translateY(-50%);
  display: flex; gap: 1px; padding: 2px; border-radius: 10px; opacity: 0; pointer-events: none;
  background: rgba(10, 10, 12, .6); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: opacity .16s ease; }
.chat-row:hover .chat-acts, .chat-row.is-on .chat-acts,
.chat-row:focus-within .chat-acts { opacity: 1; pointer-events: auto; }
.chat-act { opacity: .8; }
.chat-row:hover .chat-act, .chat-row.is-on .chat-act { opacity: .8; }
.chat-row.is-on .chat-open { padding-right: 56px; }

/* New chat: disabled look once the cap is reached. */
.side-new.is-full { opacity: .5; }
.side-new.is-full:hover { background: rgba(224, 27, 47, .10); border-color: var(--line); }

/* Role picker hanging off the New chat button. */
.side-new-anchor { position: relative; }
.menu-roles { left: 0; right: 0; min-width: 0; top: calc(100% + 6px); }
.menu-head { padding: 7px 10px 2px; font-size: 11px; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted); }

/* Tor switch inside the Tools menu. */
.toggle-item { justify-content: flex-start; }
.toggle-item .switch { margin-left: auto; width: 32px; height: 18px; border-radius: 999px; flex: none;
  background: rgba(255, 255, 255, .12); border: 1px solid var(--line); position: relative;
  transition: background .2s ease, border-color .2s ease; }
.toggle-item .switch::after { content: ""; position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%; background: var(--muted);
  transition: transform .2s cubic-bezier(.22, 1, .36, 1), background .2s ease; }
.toggle-item.is-on .switch { background: rgba(224, 27, 47, .45); border-color: var(--red); }
.toggle-item.is-on .switch::after { transform: translateX(14px); background: #fff; }
.toggle-item[data-unavailable] { opacity: .5; }
/* A paid-only switch reads as locked and carries a small PRO tag before its toggle. */
.toggle-item[data-proonly] { opacity: .6; }
.toggle-item .mi-pro { margin-left: auto; font-size: 9.5px; font-weight: 800; letter-spacing: .06em;
  color: var(--red-soft); border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 1px 6px; }
.toggle-item .mi-pro + .switch { margin-left: 8px; }

/* Badge shown only when the server confirms the turn really travelled over Tor. */
.tor-badge { display: inline-flex; align-items: center; gap: 5px; margin-top: 10px;
  padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  color: #9ad7ff; background: rgba(120, 190, 255, .1); border: 1px solid rgba(120, 190, 255, .28); }

/* ---- premium pass: depth, glass and softer edges ------------------------- */
body { line-height: 1.55; letter-spacing: -.011em; }
h1, .card-title, .brand, .empty h1 { letter-spacing: -.022em; }
.msg-body { line-height: 1.75; }
.side-label, .code-lang { letter-spacing: .08em; }

.sidebar, .topbar {
  background: linear-gradient(180deg, rgba(22, 22, 26, .82), rgba(10, 10, 12, .88));
  -webkit-backdrop-filter: blur(20px) saturate(1.3); backdrop-filter: blur(20px) saturate(1.3);
  border-color: rgba(255, 255, 255, .07);
}
.menu {
  background: linear-gradient(180deg, rgba(26, 26, 31, .92), rgba(14, 14, 17, .95));
  -webkit-backdrop-filter: blur(22px) saturate(1.35); backdrop-filter: blur(22px) saturate(1.35);
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 28px 70px -28px rgba(0, 0, 0, .95), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.composer-box, .card {
  background: linear-gradient(180deg, rgba(26, 26, 31, .6), rgba(13, 13, 16, .72));
  -webkit-backdrop-filter: blur(16px) saturate(1.2); backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 22px 60px -30px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .05);
}
.composer-box:focus-within {
  border-color: rgba(224, 27, 47, .55);
  box-shadow: 0 22px 60px -28px rgba(224, 27, 47, .5), inset 0 1px 0 rgba(255, 255, 255, .06);
}

.btn, .pill, .mode-pill, .side-new, .stop {
  border-color: rgba(255, 255, 255, .1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}
.btn:hover, .pill:hover, .mode-pill:hover, .side-new:hover, .stop:hover {
  border-color: rgba(224, 27, 47, .5);
  box-shadow: 0 0 0 1px rgba(224, 27, 47, .12), 0 10px 28px -14px rgba(224, 27, 47, .75),
              inset 0 1px 0 rgba(255, 255, 255, .07);
}
.btn-primary { box-shadow: 0 14px 34px -14px rgba(224, 27, 47, .9), inset 0 1px 0 rgba(255, 255, 255, .22); }
.btn-primary:hover { box-shadow: 0 16px 42px -12px rgba(224, 27, 47, 1), inset 0 1px 0 rgba(255, 255, 255, .28); }
.send { box-shadow: 0 12px 30px -12px rgba(224, 27, 47, .95), inset 0 1px 0 rgba(255, 255, 255, .22); }
.send:hover:not(:disabled) { filter: brightness(1.08); }

.menu-search input, .inline-form input, .chat-rename {
  background: rgba(255, 255, 255, .04);
  border-color: rgba(255, 255, 255, .1);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .4);
}
.menu-search input:focus, .inline-form input:focus {
  border-color: rgba(224, 27, 47, .6);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .4), 0 0 0 3px rgba(224, 27, 47, .14);
}
.menu-item:hover, .side-item:hover { background: rgba(255, 255, 255, .07); }
.code-block { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .09); }

@media (prefers-reduced-motion: reduce) {
  .toggle-item .switch::after { transition: none; }
}

/* ========================================================================== */
/*  Line icons and the refined sidebar                                        */
/* ========================================================================== */

.ic { display: block; flex: none; }
.mi-ic, .si-ic { display: inline-flex; align-items: center; justify-content: center; }

/* The mode pill is gone, so the composer row keeps its controls on the right. */
.composer-row { justify-content: flex-end; }

/* --- New chat ------------------------------------------------------------ */
.sidebar { padding: 12px 10px 10px; gap: 8px; }
.side-new {
  gap: 9px; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; font-weight: 600;
  letter-spacing: -.005em; justify-content: center;
  color: var(--text);
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .025));
  border: 1px solid rgba(255, 255, 255, .11);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 6px 18px -12px rgba(0, 0, 0, .9);
}
.side-new .mi-ic { color: var(--red-soft); }
.side-new:hover {
  background: linear-gradient(180deg, rgba(224, 27, 47, .22), rgba(224, 27, 47, .1));
  border-color: rgba(224, 27, 47, .5);
  box-shadow: 0 0 0 1px rgba(224, 27, 47, .12), 0 10px 26px -14px rgba(224, 27, 47, .85);
}

.side-label { font-size: 10.5px; font-weight: 600; letter-spacing: .13em;
  color: var(--faint); padding: 6px 8px 2px; }

/* --- conversation rows --------------------------------------------------- */
.chat-list { gap: 2px; }
.chat-row { border-radius: 10px; padding: 0; max-height: 44px; }
.chat-open { padding: 10px 10px; font-size: 13.5px; letter-spacing: -.005em; color: var(--muted); }
.chat-row:hover { background: rgba(255, 255, 255, .05); }
.chat-row:hover .chat-open { color: var(--text); }

/* Active conversation: a quiet tint with an accent edge, not a heavy slab. */
.chat-row.is-on {
  background: linear-gradient(90deg, rgba(224, 27, 47, .17), rgba(224, 27, 47, .05));
  box-shadow: inset 2px 0 0 var(--red);
}
.chat-row.is-on .chat-open { color: var(--text); font-weight: 600; }

.chat-acts { gap: 2px; padding: 3px; border-radius: 9px;
  background: rgba(14, 14, 17, .72); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .08); }
.chat-act { padding: 5px; border-radius: 7px; color: var(--muted); opacity: 1; }
.chat-row:hover .chat-act, .chat-row.is-on .chat-act { opacity: 1; }
.chat-act:hover { color: var(--red-soft); background: rgba(255, 255, 255, .09); }
.chat-rename { margin: 4px 6px; font-size: 13.5px; }

/* --- account menu at the foot -------------------------------------------- */
.side-foot { padding-top: 8px; gap: 0; border-top-color: rgba(255, 255, 255, .07); }
.side-item { gap: 11px; padding: 9px 10px; border-radius: 10px;
  font-size: 13.5px; font-weight: 500; letter-spacing: -.005em; color: var(--muted); }
.side-item .si-ic { width: 16px; color: var(--faint); transition: color .16s ease; }
.side-item:hover { background: rgba(255, 255, 255, .06); color: var(--text); }
.side-item:hover .si-ic { color: var(--red-soft); }
.side-item.is-danger { color: rgba(255, 110, 125, .9); }
.side-item.is-danger .si-ic { color: rgba(255, 110, 125, .75); }
.side-item.is-danger:hover { color: #ff8a96; background: rgba(224, 27, 47, .12); }
.side-item.is-danger:hover .si-ic { color: #ff8a96; }

.side-user { gap: 11px; padding: 11px 8px 2px; margin-top: 7px;
  border-top-color: rgba(255, 255, 255, .07); }
.side-avatar { width: 32px; height: 32px; font-size: 13px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12), 0 6px 16px -8px rgba(224, 27, 47, .9); }
.side-name { font-size: 13px; font-weight: 600; letter-spacing: -.01em; }
.side-plan { font-size: 11px; letter-spacing: .02em; color: var(--faint); }

.retry-link { display: inline-flex; align-items: center; gap: 6px; }

/* --- Context meter -------------------------------------------------------- */
/* Sits at the left of the composer row and shows how much of the selected model's
   conversation window this chat is using. The window differs per model, so the scale
   is re-read whenever the picker changes. */
.ctx { display: inline-flex; align-items: center; gap: 8px; margin-right: auto;
  padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, .25); color: var(--faint); font-size: 12px;
  font-variant-numeric: tabular-nums; user-select: none; }
.ctx[hidden] { display: none; }
.ctx-bar { position: relative; width: 56px; height: 4px; border-radius: 999px;
  background: rgba(255, 255, 255, .12); overflow: hidden; }
.ctx-fill { position: absolute; inset: 0 auto 0 0; width: 0;
  background: linear-gradient(90deg, var(--red-soft), var(--red));
  transition: width .2s ease; }
.ctx.is-high { color: var(--text); border-color: rgba(224, 27, 47, .45); }
.ctx.is-full { color: var(--text); border-color: var(--red); }
.ctx.is-full .ctx-fill { background: var(--red); }

@media (max-width: 560px) { .ctx-bar { width: 38px; } .ctx { font-size: 11.5px; } }

/* --- Tool caption --------------------------------------------------------- */
/* Shown inside the pending bubble while the model is searching, reading a page
   or looking at a file, so a multi-second pause reads as work in progress. */
.tool-note { margin-top: 10px; font-size: 12.5px; color: var(--faint);
  display: flex; align-items: center; gap: 7px; }
.tool-note::before { content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--red); animation: tool-pulse 1.1s ease-in-out infinite; }
@keyframes tool-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* --- Attachments ---------------------------------------------------------- */
.attach { width: 34px; height: 34px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; color: var(--faint);
  border: 1px solid transparent; background: transparent; margin-right: 6px;
  transition: color .18s ease, background .18s ease, border-color .18s ease; }
.attach:hover { color: var(--text); border-color: var(--line-strong);
  background: rgba(255, 255, 255, .05); }
.attach:disabled { opacity: .4; cursor: default; }

.attached { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 2px 8px; }
.attached[hidden] { display: none; }
.chip { display: inline-flex; align-items: center; gap: 8px; max-width: 260px;
  padding: 6px 8px 6px 11px; border-radius: 999px; font-size: 12.5px;
  border: 1px solid var(--line-strong); background: rgba(0, 0, 0, .25); color: var(--text); }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-size { color: var(--faint); flex: none; }
.chip-x { width: 18px; height: 18px; border-radius: 50%; flex: none; border: 0;
  color: var(--faint); background: rgba(255, 255, 255, .07); font-size: 13px; line-height: 1; }
.chip-x { position: relative; padding: 0; font-size: 0; }
.chip-x::before, .chip-x::after { content: ""; position: absolute; top: 50%; left: 50%;
  width: 9px; height: 1.5px; border-radius: 1px; background: currentColor;
  transform: translate(-50%, -50%) rotate(45deg); }
.chip-x::after { transform: translate(-50%, -50%) rotate(-45deg); }
.chip-x:hover { color: #fff; background: var(--red); }
.chip.is-busy { opacity: .6; }

/* --- Search switch -------------------------------------------------------- */
/* A pill next to the paperclip: off it is quiet, on it carries the brand red so
   the state is readable at a glance, the way the Tor switch is in the menu. */
.search-pill { display: inline-flex; align-items: center; gap: 7px; height: 34px;
  padding: 0 13px; border-radius: 999px; font-size: 13px; font-weight: 500;
  color: var(--faint); border: 1px solid transparent; background: transparent;
  margin-right: 8px; transition: color .18s ease, background .18s ease, border-color .18s ease; }
.search-pill:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.search-pill.is-on { color: #fff; border-color: var(--red);
  background: linear-gradient(180deg, rgba(224, 27, 47, .35), rgba(224, 27, 47, .18)); }
.search-pill.is-on:hover { background: linear-gradient(180deg, rgba(224, 27, 47, .45), rgba(224, 27, 47, .25)); }
.search-pill:disabled { opacity: .45; cursor: default; }

@media (max-width: 560px) { .search-pill .sp-tx { display: none; }
  .search-pill { padding: 0; width: 34px; justify-content: center; } }

/* ===================== Top-bar links ===================== */
/* The bot is where a subscription is bought, so it is one tap from the chat rather than
   two menus deep. Below 560px only the icons remain: the model picker needs the room. */
.top-tg, .top-buy { display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 7px 11px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  white-space: nowrap; border: 1px solid transparent;
  transition: color .18s ease, background .18s ease, border-color .18s ease; }
.top-tg { color: var(--muted); border-color: var(--line); }
.top-tg:hover { color: var(--text); border-color: var(--line-strong);
  background: rgba(255, 255, 255, .05); }
.top-buy { color: #fff; background: var(--red); border-color: var(--red); }
.top-buy:hover { filter: brightness(1.12); }

.attach-locked { opacity: .55; }
.attach-locked:hover { opacity: 1; }

@media (max-width: 560px) {
  .top-tg .tl-tx, .top-buy .tl-tx { display: none; }
  .top-tg, .top-buy { padding: 7px 9px; }
}

/* ===================== Code Sandbox (ULTRA) ===================== */
/* The island takes the middle of the page over. The ordinary message list and composer
   stay in the DOM, hidden, so the page's own script still finds everything it binds. */
body.has-sandbox .messages,
body.has-sandbox .composer { display: none; }

#code-sandbox { flex: 1 1 auto; min-height: 0; display: flex; }
.cs-notice { margin: 14px 16px; padding: 12px 14px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--panel); color: var(--muted);
  font-size: 13.5px; }
.cs-notice code { display: block; margin-top: 6px; color: var(--text); font-size: 12.5px; }

.cs-empty { margin: auto; max-width: 440px; padding: 28px 20px; text-align: center; }
.cs-empty h2 { margin: 0 0 8px; font-size: 20px; }
.cs-empty p { color: var(--muted); font-size: 14px; line-height: 1.55; }
.cs-empty code { display: inline-block; margin-top: 10px; padding: 6px 10px;
  border-radius: 8px; background: var(--surface-2); font-size: 12.5px; }
.cs-error { color: var(--red-soft); }
.cs-go { margin-top: 14px; padding: 10px 18px; border: 0; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 14px; font-weight: 600; }
.cs-go:hover { filter: brightness(1.12); }

.cs-split { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.cs-chat { display: flex; flex-direction: column; min-height: 0; flex: 1 1 45%;
  border-bottom: 1px solid var(--line); }
.cs-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); }
.cs-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.cs-dot.is-live { background: #35d07f; box-shadow: 0 0 0 3px rgba(53, 208, 127, .18); }

.cs-log { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px; }
.cs-msg { max-width: 92%; padding: 10px 13px; border-radius: 14px; font-size: 14.5px;
  line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.cs-user { align-self: flex-end; background: var(--panel-2); }
.cs-assistant { align-self: flex-start; background: var(--surface); }
/* A tool line is a log entry, not speech: monospace, quiet, full width. */
.cs-tool { align-self: stretch; max-width: none; padding: 6px 10px; border-radius: 8px;
  background: var(--surface-2); color: var(--muted); font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.cs-msg.cs-error { align-self: stretch; max-width: none; background: rgba(224, 27, 47, .12);
  color: var(--red-soft); }

/* The same shape as the chat composer: one box that wakes up on focus, the text
   growing inside it, and a row underneath for the hint and the send button. */
.cs-ask { padding: 10px 14px 14px; }
.cs-ask-box { display: flex; flex-direction: column; gap: 6px; padding: 11px 14px 9px;
  background: rgba(0, 0, 0, .45); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid rgba(224, 27, 47, .4); border-radius: 20px;
  box-shadow: 0 24px 60px -40px #000;
  transition: border-color .3s ease, box-shadow .3s ease; }
.cs-ask-box:focus-within { border-color: rgba(224, 27, 47, .85);
  box-shadow: 0 0 0 1px rgba(224, 27, 47, .3), 0 0 60px -22px rgba(224, 27, 47, .75); }
.cs-ask textarea { width: 100%; resize: none; border: 0; background: transparent;
  color: var(--text); font: inherit; font-size: 15px; line-height: 1.5;
  /* One line of 15px/1.5 plus the padding; any less and the box scrolls itself
     before a single line has been typed. */
  padding: 3px 2px; height: 29px; min-height: 29px; max-height: 170px;
  overflow-y: auto; outline: none; }
.cs-ask textarea::placeholder { color: var(--faint); }
.cs-ask textarea:disabled { color: var(--muted); -webkit-text-fill-color: var(--muted); }
.cs-ask-row { display: flex; align-items: center; gap: 10px; }
.cs-ask-hint { color: var(--faint); font-size: 12px; line-height: 1.3; }
.cs-send { flex: none; margin-left: auto; width: 38px; height: 38px; border: 0;
  border-radius: 50%; color: #fff; font-size: 17px; line-height: 1;
  background: linear-gradient(180deg, var(--red-soft), var(--red));
  box-shadow: 0 10px 24px -10px var(--red); }
.cs-send:disabled { opacity: .4; box-shadow: none; cursor: default; }

/* Three dots that actually move: a still "…" is indistinguishable from a stuck turn.
   It sits where a reply would, not stretched across the log like an empty entry. */
.cs-msg.is-busy { align-self: flex-start; width: auto; max-width: none;
  display: flex; align-items: center; min-height: 26px; padding: 8px 12px; }
.cs-dots { display: inline-flex; gap: 5px; }
.cs-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted);
  animation: cs-pulse 1.1s ease-in-out infinite; }
.cs-dots i:nth-child(2) { animation-delay: .18s; }
.cs-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes cs-pulse { 0%, 70%, 100% { opacity: .25; } 35% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .cs-dots i { animation: none; opacity: .6; }
}

.cs-work { flex: 1 1 55%; min-height: 0; display: flex; flex-direction: column; }
.cs-tabs { display: flex; align-items: center; gap: 4px; padding: 8px 12px;
  border-bottom: 1px solid var(--line); }
.cs-tabs button { padding: 7px 13px; border: 0; border-radius: 999px; background: none;
  color: var(--muted); font-size: 13.5px; font-weight: 600; }
.cs-tabs button.is-on { background: var(--panel-2); color: var(--text); }
.cs-diff { margin-left: auto; display: flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 12.5px; }

/* Getting the work out: copy, this file, the whole project. Pushed to the right so
   the toolbar reads name first, actions last. */
.cs-acts { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.cs-diff + .cs-acts { margin-left: 10px; }
.cs-tabs .cs-act { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-size: 12.5px; font-weight: 600;
  white-space: nowrap; transition: border-color .18s ease, color .18s ease, background .18s ease; }
.cs-tabs .cs-act:hover:not(:disabled) { border-color: var(--line-strong); color: var(--text); }
.cs-tabs .cs-act:disabled { opacity: .4; }
.cs-tabs .cs-act.is-done { border-color: rgba(53, 208, 127, .5); color: #35d07f; }
.cs-tabs .cs-act-main { border-color: rgba(224, 27, 47, .45); color: var(--red-soft); }
.cs-tabs .cs-act-main:hover:not(:disabled) { border-color: var(--red); color: #fff;
  background: rgba(224, 27, 47, .14); }

@media (max-width: 860px) {
  /* On a narrow pane the words go and the project download stays. */
  .cs-tabs .cs-act { padding: 6px 9px; }
}

/* Bringing a project in. The picker is hidden behind the button; the pane itself is
   the drop target, because that is where a dragged folder is already pointed. */
.cs-file-input { display: none; }
.cs-files { position: relative; }
.cs-files.is-over::after { content: ''; position: absolute; inset: 6px; pointer-events: none;
  border: 2px dashed rgba(224, 27, 47, .65); border-radius: 14px;
  background: rgba(224, 27, 47, .08); }
.cs-refused { margin-top: 4px; color: #ffb3bb; font-size: 12.5px; overflow-wrap: anywhere; }

.cs-files { flex: 1 1 auto; min-height: 0; display: flex; }
.cs-tree { flex: 0 0 210px; margin: 0; padding: 8px; list-style: none; overflow-y: auto;
  border-right: 1px solid var(--line); }
.cs-tree button { display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 9px; border: 0; border-radius: 9px; background: none; color: var(--muted);
  font-size: 12.5px; text-align: left; }
.cs-tree button:hover { background: var(--panel); color: var(--text); }
.cs-tree button.is-on { background: var(--panel-2); color: var(--text); }
.cs-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
/* The green dot marks a file the agent has just written. */
.cs-changed { flex: none; margin-left: auto; width: 7px; height: 7px; border-radius: 50%;
  background: #35d07f; }
/* A new row slides in rather than appearing: the list is being written while you watch,
   and a jump is harder to follow than a short movement. */
.cs-row { animation: cs-in .18s ease both; }
@keyframes cs-in { from { opacity: 0; transform: translateX(-10px); } }
@media (prefers-reduced-motion: reduce) { .cs-row { animation: none; } }

.cs-editor { flex: 1 1 auto; min-width: 0; display: flex; }
.cs-monaco { flex: 1 1 auto; min-width: 0; }
.cs-hint { margin: auto; color: var(--faint); font-size: 13.5px; }

/* Side by side once there is room for two columns; stacked on a phone. */
@media (min-width: 900px) {
  .cs-split { flex-direction: row; }
  .cs-chat { flex: 0 0 40%; border-bottom: 0; border-right: 1px solid var(--line); }
  .cs-work { flex: 1 1 60%; }
}

/* ===================== Landing / new-chat screen ===================== */

/* The brand word, huge and dark, parked off the right edge. It should be felt rather
   than read: if you can make out the whole word it is too strong. */
/* The version badge beside the brand. */
.ver-badge { flex: none; padding: 3px 8px; border-radius: 7px;
  border: 1px solid rgba(224, 27, 47, .4); background: rgba(224, 27, 47, .1);
  color: var(--red-soft); font-size: 10.5px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; }
@media (max-width: 560px) { .ver-badge { display: none; } }

/* The hero: the mark turning in its own pool of light. A lean rather than a full
   rotation, because a full turn puts the logo edge-on twice a cycle and reads as a
   flicker. The halo breathes on its own timing so the pair never looks mechanical. */
.hero-mark { position: relative; display: inline-grid; place-items: center;
  perspective: 1000px; }
.hero-halo { position: absolute; width: 190px; height: 190px; border-radius: 50%;
  background: rgba(224, 27, 47, .3); filter: blur(70px);
  animation: heroHalo 5.5s ease-in-out infinite; }
.hero-spin { display: block; transform-style: preserve-3d;
  animation: heroSway 7s cubic-bezier(.45, 0, .55, 1) infinite; }
.empty .mark { width: 92px; height: 92px;
  filter: drop-shadow(0 0 44px rgba(224, 27, 47, .6)); }
@keyframes heroSway {
  0%, 100% { transform: rotateY(-24deg) rotateX(7deg); }
  50%      { transform: rotateY(24deg) rotateX(-7deg); }
}
@keyframes heroHalo {
  0%, 100% { opacity: .55; transform: scale(.92); }
  50%      { opacity: .9;  transform: scale(1.06); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-spin, .hero-halo { animation: none; }
}

.empty { margin-top: 12vh; }
.empty h1 { margin: 18px 0 8px; font-size: clamp(24px, 4.2vw, 34px); font-weight: 600;
  letter-spacing: -.02em; }

/* ===================== Roles ===================== */
/* A conversation says what it is for twice: by the mark in the list and by the card on
   its empty screen. Both read the same three colours. */
.chat-open { display: flex; align-items: center; gap: 9px; min-width: 0; }
.chat-kind { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px;
  border-radius: 7px; background: rgba(255, 255, 255, .05); color: var(--kind-chat); }
.chat-row[data-kind="code"] .chat-kind { color: var(--kind-code); background: rgba(255, 94, 115, .12); }
.chat-row[data-kind="brief"] .chat-kind { color: var(--kind-brief); background: rgba(232, 177, 74, .12); }
/* A hairline down the left edge, so the kind is readable even at a glance. */
.chat-row { position: relative; }
.chat-row::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 2px;
  border-radius: 2px; background: var(--kind-chat); opacity: .55; }
.chat-row[data-kind="code"]::before { background: var(--kind-code); }
.chat-row[data-kind="brief"]::before { background: var(--kind-brief); }
.chat-row.is-on::before { opacity: 1; }

/* One column on a phone, three of equal width above it. As wrapped flex items they
   left two cards on one row and the third alone and off-centre under them, which is
   the ragged look that reads as "generated": three equal things laid out unequally.
   A grid also gives them one shared height, so the row has a baseline. */
.roles { display: grid; grid-template-columns: 1fr; align-items: stretch;
  gap: 10px; margin-top: 24px; }
@media (min-width: 620px) { .roles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.role-card { position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; min-width: 0; text-align: left;
  border: 1px solid var(--line); border-radius: 20px; background: rgba(255, 255, 255, .03);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: transform .2s ease, border-color .2s ease, background .2s ease; }
.role-card:hover { transform: translateY(-2px); border-color: var(--line-strong);
  background: rgba(255, 255, 255, .06); }
.role-card.is-on { border-color: currentColor; background: rgba(255, 255, 255, .07); }
.rc-ic { flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px;
  border-radius: 9px; background: rgba(255, 255, 255, .06); }  /* 9 + 11 padding = 20 */
.rc-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rc-name { color: var(--text); font-size: 14px; font-weight: 600; }
.rc-note { color: var(--faint); font-size: 11.5px; }
.role-card[data-kind="chat"] { color: var(--kind-chat); }
.role-card[data-kind="code"] { color: var(--kind-code); }
.role-card[data-kind="brief"] { color: var(--kind-brief); }
.role-card .rc-ic { color: inherit; }
@media (max-width: 560px) { .role-card { padding: 12px 13px; } }

/* ===================== Press feedback ===================== */
/* Switching a model or a role changes something the user cannot see directly, so the
   control answers: it sinks, then a ring leaves it. */
.role-card:active, .model-opt:active, .role-opt:active,
.side-item:active { transform: scale(.97); }
.role-card, .model-opt, .role-opt, .side-item { position: relative; overflow: hidden; }
.is-pressed::after { content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(circle at center, currentColor 0%, transparent 65%);
  opacity: .22; animation: pressFlash .42s ease-out forwards; pointer-events: none; }
@keyframes pressFlash {
  from { transform: scale(.6); opacity: .3; }
  to   { transform: scale(1.5); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .role-card:hover { transform: none; }
  .is-pressed::after { animation: none; opacity: 0; }
}

/* The three roles keep their colours in the New chat menu as well, so the same thing
   looks the same everywhere it appears. */
.role-opt[data-kind="chat"] .mi-ic { color: var(--kind-chat); }
.role-opt[data-kind="code"] .mi-ic { color: var(--kind-code); }
.role-opt[data-kind="brief"] .mi-ic { color: var(--kind-brief); }

/* Signing out: the page steps back and fades, so leaving reads as leaving rather than
   as a blink. The class is added on submit and the form follows a beat later. */
body { transition: opacity .26s ease, transform .26s ease; }
body.is-leaving { opacity: 0; transform: scale(.985); pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  body { transition: opacity .26s ease; }
  body.is-leaving { transform: none; }
}

/* ===================== --- left column --- ===================== */
/* The sidebar is where the session lives, so it gets depth of its own and movement that
   always means something: rows arrive in order, hovering leans a row towards the cursor,
   and the active chat keeps a lit bar in its own colour. */

.sidebar {
  background:
    linear-gradient(180deg, rgba(224, 27, 47, .055), transparent 220px),
    var(--surface);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, .03);
}

/* New chat: the plus turns as the button lights up. */
.side-new { background: linear-gradient(180deg, rgba(224, 27, 47, .18), rgba(224, 27, 47, .08)); }
.side-new:hover { box-shadow: 0 10px 28px -16px var(--red); }
.side-new .mi-ic { display: inline-grid; place-items: center; transition: transform .25s cubic-bezier(.22, 1, .36, 1); }
.side-new:hover .mi-ic { transform: rotate(90deg); }

.side-label { opacity: .72; }

/* One row per chat: the kind bar brightens, the row leans in, the title stays put. */
.chat-row { transform-origin: left center; }
.chat-row:hover { background: linear-gradient(90deg, rgba(255, 255, 255, .07), transparent 85%); }
.chat-row:hover .chat-kind { transform: scale(1.08); }
.chat-row.is-on {
  background: linear-gradient(90deg, rgba(224, 27, 47, .22), rgba(224, 27, 47, .05) 85%);
}
.chat-row.is-on::before { box-shadow: 0 0 10px currentColor; }
.chat-row[data-kind="chat"].is-on::before { color: var(--kind-chat); }
.chat-row[data-kind="code"].is-on::before { color: var(--kind-code); }
.chat-row[data-kind="brief"].is-on::before { color: var(--kind-brief); }
.chat-kind { transition: transform .18s cubic-bezier(.22, 1, .36, 1); }
.chat-open { transition: transform .18s ease; }
.chat-row:hover .chat-open { transform: translateX(2px); }

/* First paint only: the list writes itself out top to bottom. */
.chat-list.is-first-paint .chat-row {
  animation: rowIn .36s cubic-bezier(.22, 1, .36, 1) both;
  animation-delay: calc(var(--i, 0) * 38ms);
}
@keyframes rowIn {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: none; }
}

/* Footer links: each keeps its own tone in a chip that fills in on hover. */
.side-item { gap: 11px; }
.side-item .si-ic { display: inline-grid; place-items: center; width: 26px; height: 26px;
  border-radius: 8px; background: rgba(255, 255, 255, .04); color: var(--muted);
  transition: background .18s ease, color .18s ease, transform .18s cubic-bezier(.22, 1, .36, 1); }
.side-item:hover { background: linear-gradient(90deg, rgba(255, 255, 255, .07), transparent 90%); }
.side-item:hover .si-ic { transform: translateX(1px) scale(1.06); }
.side-item[data-tone="calm"]:hover .si-ic { color: var(--kind-chat); background: rgba(143, 139, 214, .16); }
.side-item[data-tone="gold"] .si-ic { color: var(--kind-brief); }
.side-item[data-tone="gold"]:hover .si-ic { background: rgba(232, 177, 74, .18); }
.side-item.is-danger .si-ic { color: var(--red-soft); }
.side-item.is-danger:hover .si-ic { background: rgba(224, 27, 47, .2); }

/* The account strip reads as a button once you can tell it is one. */
.side-user { border-radius: 12px; padding: 10px 8px; transition: background .18s ease; }
.side-user:hover { background: rgba(255, 255, 255, .04); }
.side-avatar { box-shadow: 0 6px 18px -8px var(--red); }

/* A calmer scrollbar: the crimson one read as a progress bar. */
.chat-list { scrollbar-color: rgba(255, 255, 255, .16) transparent; }
.chat-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); }
.chat-list::-webkit-scrollbar-thumb:hover { background: rgba(224, 27, 47, .55); }

/* The file pane's header, now that it is a name rather than a row of tabs. */
.cs-tab-name { padding: 7px 4px; color: var(--text); font-size: 13.5px; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .chat-list.is-first-paint .chat-row { animation: none; }
  .side-new:hover .mi-ic, .chat-row:hover .chat-open,
  .chat-row:hover .chat-kind, .side-item:hover .si-ic { transform: none; }
}

/* ===================== Stylized .onion / Source Cards ===================== */
.source-card {
  position: relative;
  margin: 10px 0 14px;
  padding: 15px 18px 14px;
  border-radius: 13px;
  border: 1px solid rgba(224, 27, 47, .32);
  background:
    radial-gradient(65% 110% at 72% 35%, rgba(224, 27, 47, .17) 0%, rgba(120, 12, 28, .08) 48%, transparent 80%),
    linear-gradient(180deg, rgba(22, 8, 12, .92), rgba(11, 5, 8, .96));
  box-shadow:
    0 14px 36px -18px rgba(0, 0, 0, .9),
    inset 0 1px 0 rgba(255, 110, 130, .09);
  transition: border-color .2s ease, box-shadow .2s ease, transform .18s ease;
}
.source-card:hover {
  border-color: rgba(255, 70, 92, .52);
  box-shadow:
    0 16px 40px -16px rgba(224, 27, 47, .28),
    inset 0 1px 0 rgba(255, 120, 140, .14);
}
.source-card-title {
  color: #f7f3f4;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.42;
  letter-spacing: -.01em;
  margin-bottom: 6px;
}
.source-card-url {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.8px;
  color: #e4788e;
  line-height: 1.45;
  word-break: break-all;
  margin-bottom: 5px;
  user-select: all;
}
.source-card-meta {
  color: #9e9398;
  font-size: 12.5px;
  line-height: 1.45;
  margin-bottom: 11px;
}
.source-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, .07);
  background: rgba(255, 255, 255, .035);
  color: #a79ca1;
  font-size: 12px;
  font-weight: 500;
  transition: color .16s ease, background .16s ease, border-color .16s ease;
}
.source-copy .copy-ic:empty { display: none; }
.source-copy:hover {
  color: #fff;
  background: rgba(224, 27, 47, .2);
  border-color: rgba(224, 27, 47, .45);
}
.source-copy.done {
  color: #8ef5b8;
  border-color: rgba(80, 220, 140, .4);
  background: rgba(40, 160, 95, .15);
}

/* ===================== Stylized Tor Search Animation ===================== */
.tor-search-anim {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 12px;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid rgba(224, 27, 47, .38);
  background:
    radial-gradient(60% 120% at 15% 50%, rgba(224, 27, 47, .22), transparent 70%),
    linear-gradient(180deg, rgba(24, 8, 13, .92), rgba(11, 5, 8, .96));
  box-shadow: 0 12px 32px -16px rgba(224, 27, 47, .45), inset 0 1px 0 rgba(255, 110, 130, .1);
  overflow: hidden;
  position: relative;
}
.tor-search-anim::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 80, 105, .07) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: torScanBeam 2.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes torScanBeam {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.tor-radar {
  position: relative;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, rgba(224, 27, 47, .22) 0%, rgba(16, 4, 8, .9) 72%);
  border: 1px solid rgba(255, 80, 100, .35);
  box-shadow: 0 0 18px rgba(224, 27, 47, .4);
}
.tor-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(255, 95, 115, .38);
  pointer-events: none;
}
.tor-ring-1 { width: 40px; height: 40px; animation: torRingSpin 7s linear infinite; }
.tor-ring-2 { width: 28px; height: 28px; border-style: solid; border-color: rgba(224, 27, 47, .45); animation: torRingPulse 1.8s ease-in-out infinite; }
.tor-ring-3 { width: 16px; height: 16px; border-color: rgba(255, 130, 145, .55); animation: torRingSpin 4.5s linear infinite reverse; }
.tor-sweep {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0deg 260deg, rgba(255, 66, 84, .55) 345deg, rgba(255, 160, 175, .85) 360deg);
  animation: torSweepSpin 1.55s linear infinite;
}
.tor-core {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff5e73;
  box-shadow: 0 0 10px #ff4254, 0 0 18px #e01b2f;
  z-index: 1;
}
@keyframes torSweepSpin { to { transform: rotate(360deg); } }
@keyframes torRingSpin { to { transform: rotate(360deg); } }
@keyframes torRingPulse {
  0%, 100% { transform: scale(.92); opacity: .55; }
  50%      { transform: scale(1.06); opacity: 1; }
}
.tor-anim-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.tor-anim-title {
  color: #f8eef0;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -.005em;
}
.tor-anim-sub {
  color: #a59298;
  font-size: 11.5px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tor-nodes {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.tor-node {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .08em;
  padding: 2px 6px;
  border-radius: 5px;
  color: #f3cfd5;
  background: rgba(224, 27, 47, .16);
  border: 1px solid rgba(255, 80, 100, .3);
  animation: torNodeGlow 1.8s ease-in-out infinite;
}
.tor-node.is-2 { animation-delay: .35s; }
.tor-node.is-3 { animation-delay: .7s; color: #ff9aa8; border-color: rgba(255, 110, 130, .5); }
.tor-hop {
  width: 14px;
  height: 1.5px;
  background: linear-gradient(90deg, rgba(224, 27, 47, .25), #ff5e73, rgba(224, 27, 47, .25));
  background-size: 200% 100%;
  animation: torHopFlow 1.1s linear infinite;
}
@keyframes torNodeGlow {
  0%, 100% { opacity: .5; transform: scale(.98); }
  50%      { opacity: 1; transform: scale(1.03); box-shadow: 0 0 10px rgba(224, 27, 47, .4); }
}
@keyframes torHopFlow {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .tor-search-anim::after, .tor-ring, .tor-sweep, .tor-node, .tor-hop { animation: none; }
}

/* --- EvilGPT Security System Violation Card & Animated Alert -------------- */
.msg.is-violation {
  padding-top: 6px;
  padding-bottom: 6px;
}
.violation-card {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: 18px 20px;
  background:
    radial-gradient(125% 140% at 88% 12%, rgba(224, 27, 47, .28) 0%, rgba(150, 14, 30, .14) 48%, rgba(16, 8, 11, .97) 100%),
    linear-gradient(180deg, rgba(28, 10, 14, .96), rgba(14, 6, 9, .98));
  border: 1px solid rgba(255, 66, 84, .48);
  box-shadow:
    0 16px 38px -14px rgba(224, 27, 47, .42),
    0 0 0 1px rgba(255, 80, 100, .12),
    inset 0 1px 0 rgba(255, 160, 175, .18);
  animation: violationCardEnter .44s cubic-bezier(.16, 1, .3, 1), violationBorderPulse 2.8s ease-in-out infinite;
}
.violation-scan {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 0%, rgba(255, 66, 84, .11) 50%, rgba(255, 110, 128, .24) 52%, transparent 56%);
  background-size: 100% 220%;
  animation: violationScanSweep 2.6s linear infinite;
  pointer-events: none;
}
.violation-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.violation-sigil {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ff6b7d;
  background: rgba(224, 27, 47, .2);
  border: 1px solid rgba(255, 90, 110, .45);
  box-shadow: 0 0 18px rgba(224, 27, 47, .35);
  flex-shrink: 0;
}
.violation-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 14px;
  border: 1px solid rgba(255, 66, 84, .55);
  animation: violationSigilPing 1.9s cubic-bezier(0, 0, .2, 1) infinite;
  pointer-events: none;
}
.violation-head-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.violation-sys {
  color: #fff2f4;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(255, 66, 84, .45);
}
.violation-sub {
  color: #b98992;
  font-size: 10.5px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .09em;
}
.violation-strike {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  color: #ffb8c1;
  background: rgba(224, 27, 47, .26);
  border: 1px solid rgba(255, 95, 115, .48);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.violation-msg {
  position: relative;
  z-index: 1;
  color: #faecef;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.5;
  padding: 11px 14px;
  border-radius: 11px;
  background: rgba(10, 4, 6, .58);
  border-left: 3px solid #ff4254;
  margin-bottom: 12px;
}
.violation-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.violation-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 8px;
  background: rgba(224, 27, 47, .16);
  border: 1px solid rgba(255, 82, 100, .34);
  font-size: 12.5px;
}
.violation-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff4254;
  box-shadow: 0 0 8px #ff4254;
  animation: torRingPulse 1.4s ease-in-out infinite;
}
.violation-label {
  color: #c8a2aa;
}
.violation-cat {
  color: #ff8595;
  font-weight: 700;
}
.violation-code {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: #9e7981;
  letter-spacing: .06em;
}
.toast.is-violation-toast {
  background: linear-gradient(135deg, rgba(44, 10, 16, .97), rgba(22, 6, 10, .98));
  border-color: rgba(255, 66, 84, .6);
  color: #ffe6ea;
  box-shadow: 0 14px 36px rgba(224, 27, 47, .45);
}
@keyframes violationCardEnter {
  0%   { opacity: 0; transform: translateY(10px) scale(.98); }
  60%  { opacity: 1; transform: translateY(-2px) scale(1.005); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes violationBorderPulse {
  0%, 100% { border-color: rgba(255, 66, 84, .42); }
  50%      { border-color: rgba(255, 95, 115, .78); }
}
@keyframes violationScanSweep {
  0%   { background-position: 0 140%; }
  100% { background-position: 0 -80%; }
}
@keyframes violationSigilPing {
  0%   { transform: scale(.95); opacity: .75; }
  100% { transform: scale(1.32); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .violation-card, .violation-scan, .violation-pulse, .violation-dot { animation: none; }
}

/* ===================== Thinking ===================== */
/* The wait gets a number. People forgive a slow answer; a screen that looks stuck is a
   different thing, and the seconds are what tells them apart. */
.think { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 8px;
  padding: 5px 11px 5px 8px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .03);
  color: var(--muted); font-size: 12.5px; }
.think-spark { width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: var(--red-soft); box-shadow: 0 0 0 0 rgba(255, 66, 84, .55);
  animation: thinkPulse 1.5s ease-out infinite; }
.think-tx { font-variant-numeric: tabular-nums; }
/* Once the answer starts, the line stays as its caption and stops moving. */
.think.is-done { border-color: transparent; background: none; padding-left: 2px;
  color: var(--faint); }
.think.is-done .think-spark { animation: none; background: var(--faint);
  box-shadow: none; opacity: .6; }
@keyframes thinkPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 66, 84, .55); opacity: 1; }
  70%  { box-shadow: 0 0 0 7px rgba(255, 66, 84, 0); opacity: .75; }
  100% { box-shadow: 0 0 0 0 rgba(255, 66, 84, 0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .think-spark { animation: none; }
}

/* ========================================================================== */
/*  Phones and tablets: iOS Safari / Android Chrome                           */
/* ========================================================================== */
/* The site is one responsive build for every platform — there is no separate
   mobile bundle — so the handheld quirks are gathered here instead of being
   sprinkled through the sections above. Everything in this block is inert on a
   desktop: the env() insets resolve to 0px and the coarse-pointer queries never
   match, so nothing below changes how the site looks on a mouse-driven browser. */

html {
  /* Safari inflates text in landscape unless told not to. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  /* Removes the grey flash Android/iOS paint over a tapped control. */
  -webkit-tap-highlight-color: transparent;
}

/* Tapping must not wait for a possible double-tap-to-zoom. */
.brand-btn, .pill, .btn, .send, .nav-item, .menu-item, .side-item, .lang-opt,
.chat-act, .chat-open, .mode-pick, .top-link, .stop, .copy-btn {
  touch-action: manipulation;
}

/* Notch and home-indicator safe areas. The bars that hug an edge get the inset
   added to the padding they already have, so content never slides under the
   rounded corners or the gesture bar on an iPhone or a cutout Android. */
.topbar { padding-top: calc(12px + env(safe-area-inset-top));
  padding-left: calc(10px + env(safe-area-inset-left));
  padding-right: calc(10px + env(safe-area-inset-right)); }
.composer { padding-bottom: calc(14px + env(safe-area-inset-bottom));
  padding-left: calc(14px + env(safe-area-inset-left));
  padding-right: calc(14px + env(safe-area-inset-right)); }
.sidebar { padding-top: calc(14px + env(safe-area-inset-top));
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  padding-left: calc(10px + env(safe-area-inset-left)); }
.page-body { padding-left: calc(14px + env(safe-area-inset-left));
  padding-right: calc(14px + env(safe-area-inset-right)); }

/* iOS zooms the page in whenever a focused field is under 16px. Every text field
   that was smaller is lifted to 16px on a touch device (and only there, so the
   desktop sizing above is untouched). */
@media (pointer: coarse) {
  .menu-search input, .inline-form input, .chat-rename, #mode { font-size: 16px; }
}

/* A coarse pointer cannot hover, so controls that only appeared on hover have to
   be reachable by tap: the per-message copy button and the chat row actions. */
@media (hover: none) {
  .chat-acts { opacity: 1; pointer-events: auto; }
}

/* ========================================================================== */
/*  Sign-in / registration: a themed entrance                                 */
/* ========================================================================== */
/* The welcome screen is where a new member first meets the brand, so it gets a
   small show: a breathing red aura behind the card, sonar rings pulsing out of
   the sigil, and the card itself materialising in. It is CSS only — no script,
   nothing for the CSP to block — and the whole thing falls silent under
   prefers-reduced-motion. Nothing here affects any page but the auth screen. */
body.auth { position: relative; overflow: hidden; }

/* The ominous glow that breathes behind everything. */
body.auth::before {
  content: ""; position: fixed; inset: -20% -20% -20% -20%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(38% 46% at 50% 42%, rgba(224, 27, 47, .20), transparent 68%),
    radial-gradient(26% 32% at 68% 72%, rgba(255, 66, 84, .12), transparent 70%);
}

/* A slow scanning sweep, like something watching the door. */
body.auth::after {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background: linear-gradient(transparent 0%, rgba(224, 27, 47, .05) 48%, rgba(255, 66, 84, .10) 50%,
              rgba(224, 27, 47, .05) 52%, transparent 100%);
  background-size: 100% 220%;
}
.auth-wrap { position: relative; z-index: 1; }

/* Sonar rings ripple out of the brand sigil. */
.auth-mark { position: relative; }
.auth-mark::before, .auth-mark::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 46px; height: 46px;
  margin: -23px 0 0 -23px; border-radius: 50%; border: 1px solid rgba(255, 66, 84, .55);
  pointer-events: none; opacity: 0; }

@media (prefers-reduced-motion: no-preference) {
  body.auth::before { animation: authAura 6s ease-in-out infinite; }
  body.auth::after { animation: authSweep 7.5s linear infinite; }
  .auth-card { animation: authCardIn .6s cubic-bezier(.22, 1, .36, 1) both; }
  .auth-mark .mark { animation: authSigil 3.2s ease-in-out infinite; }
  .auth-mark::before { animation: authPing 3.2s ease-out infinite; }
  .auth-mark::after { animation: authPing 3.2s ease-out infinite 1.6s; }
  /* The text fades up a beat after the card lands. code-big is left out so its own
     ongoing codePulse (set elsewhere) is not overwritten by this one-shot entrance. */
  .auth-title, .auth-lead, .code-label, .auth-hint, #open-bot {
    animation: authRise .6s ease both; }
  .auth-lead { animation-delay: .06s; }
  .code-label { animation-delay: .1s; }
  .auth-hint { animation-delay: .18s; }
  #open-bot { animation-delay: .22s; }
}

@keyframes authAura {
  0%, 100% { opacity: .75; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.08); }
}
@keyframes authSweep {
  from { background-position: 0 -60%; }
  to   { background-position: 0 160%; }
}
@keyframes authCardIn {
  from { opacity: 0; transform: translateY(16px) scale(.96); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: none; }
}
@keyframes authSigil {
  0%, 100% { transform: scale(1);    filter: drop-shadow(0 0 10px rgba(224, 27, 47, .55)); }
  50%      { transform: scale(1.06); filter: drop-shadow(0 0 22px rgba(255, 77, 94, .9)); }
}
@keyframes authPing {
  0%   { opacity: .7; transform: scale(.7); }
  80%  { opacity: 0;  transform: scale(2.4); }
  100% { opacity: 0;  transform: scale(2.4); }
}
@keyframes authRise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ========================================================================== */
/*  Themed modal (confirmations, the "this version is Pro" choice)            */
/* ========================================================================== */
/* Replaces the browser's own confirm() box so a destructive action, or the
   choice to upgrade, is asked in the site's skin. Built in JS with no inline
   handlers, so it stays within the page CSP. */
.modal-overlay {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center;
  padding: calc(18px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));
  background: rgba(4, 1, 3, .64); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .17s ease; }
.modal-overlay.is-in { opacity: 1; }
.modal-card {
  width: 100%; max-width: 400px; border-radius: 22px; padding: 22px 22px 18px;
  background: linear-gradient(180deg, rgba(255, 66, 84, .12), transparent 46%), rgba(18, 6, 9, .98);
  border: 1px solid var(--line-strong);
  box-shadow: 0 40px 110px -40px #000, 0 0 0 1px rgba(255, 66, 84, .06) inset;
  transform: translateY(10px) scale(.97); opacity: 0;
  transition: transform .2s cubic-bezier(.22, 1, .36, 1), opacity .2s ease; }
.modal-overlay.is-in .modal-card { transform: none; opacity: 1; }
.modal-card.is-danger { background: linear-gradient(180deg, rgba(224, 27, 47, .18), transparent 48%), rgba(18, 6, 9, .98); }
.modal-title { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 8px; letter-spacing: -.01em; }
.modal-body { font-size: 14px; line-height: 1.6; color: #e0cace; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.modal-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 12px; font: inherit; font-size: 14px; font-weight: 600;
  border: 1px solid var(--line-strong); background: transparent; color: var(--text); cursor: pointer;
  text-decoration: none; transition: background .16s ease, border-color .16s ease, filter .16s ease, transform .08s ease; }
.modal-btn:active { transform: translateY(1px); }
.modal-ghost:hover { background: rgba(255, 255, 255, .06); border-color: var(--line-strong); }
.modal-primary { background: linear-gradient(180deg, var(--red-soft), var(--red)); border-color: transparent;
  color: #fff; box-shadow: 0 10px 28px -14px var(--red); }
.modal-primary:hover { filter: brightness(1.08); }
.modal-danger { background: rgba(224, 27, 47, .18); border-color: rgba(224, 27, 47, .55); color: #ffd0d5; }
.modal-danger:hover { background: rgba(224, 27, 47, .3); border-color: var(--red); }
@media (prefers-reduced-motion: reduce) {
  .modal-overlay, .modal-card { transition: opacity .12s ease; }
  .modal-card { transform: none; }
}
@media (max-width: 460px) {
  .modal-actions { flex-direction: column-reverse; }
  .modal-btn { width: 100%; padding: 12px 18px; }
}

/* A paid model slot the free tier cannot use: dimmed but still tappable, so a tap opens
   the upgrade/continue choice rather than doing nothing. */
.model-opt.is-locked { opacity: .62; }
.model-opt.is-locked:hover { opacity: .8; }

/* ========================================================================== */
/*  Top bar polish: nicer buttons and small, tasteful motion                  */
/* ========================================================================== */
/* Pills and links in the header get a consistent lift on hover, a crisper
   "Get Pro" button, an animated underline on the Account link and a caret that
   turns when its menu is open. Everything is a transform/opacity tweak, so it
   stays smooth and goes still under prefers-reduced-motion. */

.topbar .pill, .top-tg, .top-buy, .brand-btn, .lang-switch {
  transition: transform .16s cubic-bezier(.22, 1, .36, 1), background .18s ease,
              border-color .18s ease, box-shadow .2s ease, color .18s ease, filter .18s ease; }

/* A gentle lift. :active presses back down. */
.topbar .pill:hover, .top-tg:hover { transform: translateY(-1px); }
.topbar .pill:active, .top-tg:active, .top-buy:active { transform: translateY(0) scale(.98); }

/* The caret rotates while its dropdown is open. */
.pill .caret { transition: transform .22s cubic-bezier(.22, 1, .36, 1); }
.pill[aria-expanded="true"] .caret { transform: rotate(180deg); }
.pill[aria-expanded="true"] { border-color: rgba(224, 27, 47, .5); }

/* "Get Pro": a living gradient with a soft glow, and a slow sheen crossing it. */
.top-buy {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--red-soft), var(--red));
  border-color: transparent; box-shadow: 0 8px 22px -10px var(--red); }
.top-buy::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .38), transparent);
  transform: skewX(-18deg); pointer-events: none; }
.top-buy:hover { transform: translateY(-1px); filter: brightness(1.08);
  box-shadow: 0 12px 30px -10px var(--red), 0 0 0 1px rgba(255, 120, 135, .4); }
.top-buy .mi-ic, .top-buy svg { transition: transform .2s ease; }
.top-buy:hover .mi-ic, .top-buy:hover svg { transform: rotate(-8deg) scale(1.1); }

/* The Account link gets an underline that grows from the centre. */
.top-link { position: relative; }
.top-link::after {
  content: ""; position: absolute; left: 10%; right: 10%; bottom: 3px; height: 1.5px;
  background: linear-gradient(90deg, var(--red-soft), var(--red));
  transform: scaleX(0); transform-origin: center; border-radius: 2px;
  transition: transform .22s cubic-bezier(.22, 1, .36, 1); }
.top-link:hover::after, .top-link.is-on::after { transform: scaleX(1); }

/* The version badge breathes very faintly, so "free" or the plan name reads as live. */
.ver-badge { transition: border-color .2s ease, background .2s ease, color .2s ease; }

@media (prefers-reduced-motion: no-preference) {
  .top-buy { animation: buyGlow 3.6s ease-in-out infinite; }
  .top-buy::after { animation: buySheen 4.5s ease-in-out infinite; }
  /* The header's controls arrive with a short, staggered rise on first paint. */
  .topbar > * { animation: topRise .5s ease both; }
  .topbar > *:nth-child(2) { animation-delay: .03s; }
  .topbar > *:nth-child(3) { animation-delay: .06s; }
  .topbar > *:nth-child(4) { animation-delay: .09s; }
  .topbar > *:nth-child(5) { animation-delay: .12s; }
  .topbar > *:nth-child(n+6) { animation-delay: .15s; }
}

@keyframes buyGlow {
  0%, 100% { box-shadow: 0 8px 22px -10px var(--red); }
  50%      { box-shadow: 0 10px 30px -8px var(--red), 0 0 18px -6px rgba(255, 90, 106, .7); }
}
@keyframes buySheen {
  0%, 62%  { left: -60%; }
  86%, 100% { left: 130%; }
}
@keyframes topRise {
  from { opacity: 0; transform: translateY(-7px); }
  to   { opacity: 1; transform: none; }
}

/* ========================================================================== */
/*  Site footer and the Terms of Use page                                    */
/* ========================================================================== */
.site-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 8px; padding: 22px 4px calc(8px + env(safe-area-inset-bottom));
  color: var(--faint); font-size: 12.5px; }
.site-foot a { color: var(--muted); border-bottom: 1px solid transparent;
  transition: color .16s ease, border-color .16s ease; }
.site-foot a:hover { color: var(--text); border-bottom-color: var(--line-strong); }
.foot-dot { opacity: .5; }

/* The legal page is long, so it is set for reading: a wider column, generous
   line height, numbered sections and a table of contents that jumps to them. */
.page-body.legal { max-width: 760px; }
.legal-head h1 { margin: 0 0 6px; font-size: 25px; font-weight: 800; letter-spacing: -.02em; }
.legal-updated { margin: 0 0 12px; color: var(--faint); font-size: 12.5px;
  text-transform: uppercase; letter-spacing: .1em; }
.legal-lead { margin: 0; color: #ddc8cb; font-size: 14.5px; line-height: 1.7; }

.legal-toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 26px;
  color: var(--muted); font-size: 13.5px; line-height: 1.9; }
.legal-toc a { color: var(--muted); transition: color .16s ease; }
.legal-toc a:hover { color: var(--red-soft); }
@media (max-width: 560px) { .legal-toc ol { columns: 1; } }

.legal-section { scroll-margin-top: 80px; }
.legal-section h2 { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px;
  font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.legal-num { flex: none; font-family: "JetBrains Mono", monospace; font-size: 12px;
  font-weight: 500; color: var(--red-soft); opacity: .85; }
.legal-section p { margin: 0 0 12px; color: #ddc8cb; font-size: 14.5px; line-height: 1.75; }
.legal-section p:last-child { margin-bottom: 0; }
.legal-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 9px;
  color: #ddc8cb; font-size: 14.5px; line-height: 1.7; }
.legal-list li::marker { color: var(--red-soft); }
.legal-tail { margin-top: 14px; color: var(--muted); font-size: 14px; }

/* Each section rises in as it is reached, which keeps a wall of text from
   landing all at once. Static for anyone who asked for less motion. */
@media (prefers-reduced-motion: no-preference) {
  .legal-section { animation: cardIn .4s ease both; }
}

/* Capability chips in the Tools menu: what this plan includes, and what it does not. */
.feat-item { display: flex; align-items: center; gap: 12px; }
.feat-item.is-on { cursor: default; color: var(--text); }
.feat-item.is-on:hover { background: none; }
.feat-ok { margin-left: auto; color: #5ddc8b; font-size: 13px; font-weight: 700; }
.feat-item.is-locked { opacity: .68; text-decoration: none; }
.feat-item.is-locked:hover { opacity: 1; }
.feat-item.is-locked .mi-pro { margin-left: auto; }
.feat-lock { display: inline-flex; color: var(--faint); margin-left: 2px; }

/* The composer's search pill, locked for a free plan. */
.search-pill.is-locked { opacity: .62; }
.search-pill.is-locked:hover { opacity: .85; }
.sp-lock { display: inline-flex; margin-left: 2px; color: var(--faint); }

/* ========================================================================== */
/*  Pricing cards: one quiet step forward                                   */
/* ========================================================================== */
/* These used to sit in a perspective and tilt after the pointer, while every row
   inside them re-ran a staggered fade on each hover. Two problems: the text moved
   while you were reading the price, and a keyframe cannot be interrupted, so
   crossing the row left three cards mid-animation. A hover is a state change, so
   it is a transition now -- a small lift, a ring, a deeper shadow -- and the
   content stays exactly where it was. */
.plan-card {
  transition: transform .22s cubic-bezier(.22, 1, .36, 1), box-shadow .22s ease,
              border-color .2s ease; }

@media (hover: hover) and (pointer: fine) {
  .plan-card:hover {
    transform: translateY(-4px);
    border-color: rgba(224, 27, 47, .5);
    box-shadow: 0 34px 70px -34px rgba(0, 0, 0, .9),
                0 0 0 1px rgba(255, 66, 84, .18) inset;
    z-index: 2; }
  .plan-card.rec:hover { transform: translateY(-10px); }
}
@media (prefers-reduced-motion: reduce) {
  .plan-card:hover, .plan-card.rec:hover { transform: none; }
}


/* Capability chips carry a one-line explanation, so "Vision" is not a bare word. */
.feat-item .mi-tx { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.feat-name { font-size: 14px; }
.feat-note { font-size: 11.5px; color: var(--faint); line-height: 1.35; white-space: normal; }
.feat-item .mi-pro, .role-opt .mi-pro { white-space: nowrap; }

/* A locked role in the menu: name on its own line, the plan that unlocks it beneath.
   Side by side, a long name (Russian "Повседневный") was squeezed to a
   third of the width it needed and, with nothing clipping it, ran straight under the
   badge -- which is how "Повседневтарифа Pro" appeared on screen. */
.role-opt .mi-tx { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.role-opt .mi-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-opt .mi-pro { max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  font-size: 9.5px; font-weight: 800; letter-spacing: .05em; color: var(--red-soft);
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 1px 7px; }
.role-opt .feat-lock { margin-left: auto; flex: none; color: var(--faint); }

/* The same guard on the big cards in the empty state. */
.role-card .rc-name { min-width: 0; }
.role-card .rc-tx { min-width: 0; }
.role-card.is-locked .rc-name { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; }
.role-card.is-locked .rc-name .mi-pro { display: inline-block; white-space: nowrap; margin-left: 0; }

/* A role the plan cannot reach yet: shown, not hidden, with the plan that unlocks it. */
.role-opt.is-locked, .role-card.is-locked { opacity: .62; text-decoration: none; }
.role-opt.is-locked:hover, .role-card.is-locked:hover { opacity: 1; }
.role-card.is-locked { position: relative; }
.role-card.is-locked .feat-lock { margin-left: auto; flex: none; display: inline-flex;
  color: var(--faint); }
.role-card .mi-pro { font-size: 9.5px; font-weight: 800; letter-spacing: .05em; color: var(--red-soft);
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 1px 6px; margin-left: 6px; }

/* Pricing: the plan you already hold, and the ones below it, are not for sale. */
.plan-card.is-current { border-color: rgba(255, 255, 255, .22); }
.plan-card.is-included { opacity: .72; }
.btn.is-static { cursor: default; opacity: .75; }
.btn.is-static:hover { border-color: var(--line); box-shadow: none; filter: none; }

/* The capability rows carry a sentence of explanation, so the menu needs the width:
   the text column takes what is left and the badge/lock never squeeze it. */
.menu-lg { min-width: 316px; }
.feat-item { align-items: flex-start; gap: 10px; }
.feat-item .mi-ic { margin-top: 1px; }
.feat-item .mi-tx { flex: 1 1 auto; min-width: 0; }
.feat-item .mi-pro, .feat-item .feat-ok, .feat-item .feat-lock { flex: none; align-self: center; }
.feat-item .mi-pro { margin-left: 8px; }
.feat-item .feat-ok { margin-left: 8px; }
@media (max-width: 420px) { .menu-lg { min-width: 0; width: min(316px, calc(100vw - 28px)); } }

/* The locked paperclip carries a small padlock and opens the upgrade dialog. */
.attach { position: relative; }
.attach-locked { opacity: .55; }
.attach-locked:hover { opacity: .85; }
.attach-lock { position: absolute; right: -2px; bottom: -2px; display: inline-flex;
  padding: 2px; color: var(--faint); background: var(--surface-2); border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line); }

/* ========================================================================== */
/*  Header pills, refined                                                     */
/* ========================================================================== */
/* The Tools and model pills were flat panels with a flat border. They now sit on
   a soft vertical gradient with a one-pixel highlight along the top edge, which
   is what gives a small control its weight, and they answer to hover, focus and
   the open state instead of only changing fill. */
.topbar .pill {
  padding: 8px 13px;
  font-size: 13.5px; font-weight: 600; letter-spacing: -.005em;
  color: #e9dcde;
  border: 1px solid rgba(255, 255, 255, .12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .015) 48%, transparent),
    rgba(18, 10, 13, .92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09),
              0 1px 2px rgba(0, 0, 0, .5),
              0 6px 16px -12px rgba(0, 0, 0, .9);
}
.topbar .pill:hover {
  color: #fff;
  border-color: rgba(224, 27, 47, .5);
  background:
    linear-gradient(180deg, rgba(255, 90, 106, .16), rgba(224, 27, 47, .06) 55%, transparent),
    rgba(26, 11, 15, .95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14),
              0 0 0 1px rgba(224, 27, 47, .16),
              0 10px 24px -14px rgba(224, 27, 47, .9);
}
.topbar .pill:focus-visible {
  outline: none;
  border-color: rgba(255, 90, 106, .75);
  box-shadow: 0 0 0 3px rgba(224, 27, 47, .22), inset 0 1px 0 rgba(255, 255, 255, .14);
}
/* While its menu is open the pill reads as pressed rather than hovered. */
.topbar .pill[aria-expanded="true"] {
  color: #fff;
  border-color: rgba(224, 27, 47, .62);
  background: linear-gradient(180deg, rgba(224, 27, 47, .22), rgba(224, 27, 47, .08)), rgba(22, 9, 13, .96);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, .55), 0 0 0 1px rgba(224, 27, 47, .2);
}
.topbar .pill .caret { font-size: 10px; opacity: .65; margin-left: 1px; }
.topbar .pill:hover .caret, .topbar .pill[aria-expanded="true"] .caret { opacity: 1; color: var(--red-soft); }

/* ========================================================================== */
/*  Scrollbars in the site's own colours                                      */
/* ========================================================================== */
/* The default Windows bar — light grey, with stepper arrows — was the one piece
   of chrome that ignored the theme. This is a slim crimson-tinted thumb on an
   invisible track, with the arrows removed; the transparent border plus
   background-clip is what keeps the thumb from touching the edges. */
* { scrollbar-width: thin; scrollbar-color: rgba(224, 27, 47, .38) transparent; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; height: 0; width: 0; }
::-webkit-scrollbar-thumb {
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
  background-color: rgba(224, 27, 47, .34);
  transition: background-color .18s ease;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 66, 84, .62); }
::-webkit-scrollbar-thumb:active { background-color: var(--red); }

/* The sidebar's list keeps its quieter thumb: a crimson bar in a narrow column
   next to the chat titles read as a progress indicator. */
.chat-list { scrollbar-color: rgba(255, 255, 255, .16) transparent; }
.chat-list::-webkit-scrollbar { width: 8px; }
.chat-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent; background-clip: padding-box;
  background-color: rgba(255, 255, 255, .16);
}
.chat-list::-webkit-scrollbar-thumb:hover { background-color: rgba(224, 27, 47, .55); }

/* ========================================================================== */
/*  Sign-in: key or Telegram                                                  */
/* ========================================================================== */
.auth-tabs { display: inline-flex; gap: 3px; padding: 4px; margin: 0 0 18px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: rgba(0, 0, 0, .3); }
.auth-tab { padding: 7px 16px; border: 0; border-radius: 999px; background: none;
  color: var(--muted); font: inherit; font-size: 13px; font-weight: 600;
  transition: color .16s ease, background .18s ease, box-shadow .18s ease; }
.auth-tab:hover { color: var(--text); }
.auth-tab.is-on { color: #fff;
  background: linear-gradient(180deg, rgba(255, 66, 84, .32), rgba(224, 27, 47, .18));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 6px 16px -10px var(--red); }

/* The key is long and pasted, so it reads as one block rather than a spaced code. */
.key-input { letter-spacing: .06em; text-transform: none; font-size: 15px; }
.key-input::placeholder { letter-spacing: normal; text-transform: none; }
#pane-key .auth-form { margin-bottom: 12px; }
#pane-key .btn { width: 100%; }
.auth-pane[hidden] { display: none; }
#pane-new .btn { width: 100%; }
#pane-new .btn + .btn { margin-top: 8px; }

/* What a key-only account does and does not get, said before it is created. */
.perks { margin: 4px 0 16px; padding: 12px 14px; text-align: left;
  border-radius: 14px; border: 1px solid var(--line); background: rgba(0, 0, 0, .22); }
.perks-title { font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.perks-list { list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--text); }
.perks-list li { display: flex; align-items: center; gap: 9px; }
.perks-list .ic { flex: none; color: var(--red); }

/* The one showing of a freshly minted key: big, selectable, hard to miss. */
.key-reveal { margin: 4px 0 14px; padding: 14px 12px; word-break: break-all;
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 15px; letter-spacing: .06em;
  color: #fff; text-align: center; user-select: all; border-radius: 14px;
  border: 1px solid var(--red); background: rgba(224, 27, 47, .10);
  box-shadow: inset 0 0 24px -12px var(--red); }
.key-reveal:focus { outline: 2px solid var(--red); outline-offset: 2px; }

/* Consent sits under the card's own action, the way the rest of the web does it. */
.auth-tos { margin: 18px 0 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.auth-tos a { color: var(--red-soft); text-decoration: none; }
.auth-tos a:hover { text-decoration: underline; }

/* ========================================================================== */
/*  The access key on the account page                                        */
/* ========================================================================== */
.key-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.key-value { flex: 1 1 260px; min-width: 0; padding: 11px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: rgba(0, 0, 0, .4);
  font-family: "JetBrains Mono", monospace; font-size: 14px; letter-spacing: .04em;
  color: #fff; overflow-wrap: anywhere; user-select: all; }
.key-warn { margin: 10px 0 0; color: #ffc6cc; font-size: 13px; line-height: 1.6; }
.key-meta { margin: 10px 0 0; color: var(--faint); font-size: 12.5px; }
.key-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.key-actions .btn { width: auto; flex: 0 1 auto; }
/* A class that sets `display` outranks the UA rule for [hidden], so the key row
   and its warning would otherwise show as empty boxes before a key is issued. */
.key-row[hidden], .key-actions[hidden], .key-warn[hidden] { display: none; }

/* ========================================================================== */
/*  Styled Source / Onion Link Card & Tor Search Radar Animation              */
/* ========================================================================== */
.source-card {
  position: relative;
  overflow: hidden;
  margin: 14px 0;
  padding: 16px 20px;
  border-radius: 14px;
  border: 1px solid rgba(224, 27, 47, .34);
  background:
    radial-gradient(65% 90% at 88% 36%, rgba(224, 27, 47, .22), transparent 72%),
    linear-gradient(180deg, rgba(24, 9, 13, .95), rgba(11, 5, 7, .98));
  box-shadow: 0 18px 42px -22px rgba(0, 0, 0, .92), inset 0 1px 0 rgba(255, 90, 106, .12);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.source-card-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.45;
  letter-spacing: -.005em;
}
.source-card-url {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px;
  color: #e28090;
  word-break: break-all;
  text-decoration: none;
  line-height: 1.45;
  transition: color .16s ease;
}
.source-card-url:hover {
  color: #ff9aa8;
  text-decoration: underline;
}
.source-card-meta {
  font-size: 12.5px;
  color: #a49498;
  line-height: 1.4;
}
.source-card-copy {
  align-self: flex-start;
  margin-top: 4px;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .04);
  color: #b7a7ab;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: color .16s ease, background .16s ease, border-color .16s ease;
}
.source-card-copy:hover {
  color: #fff;
  border-color: rgba(224, 27, 47, .55);
  background: rgba(224, 27, 47, .18);
}

.tool-note.is-tor-anim {
  margin-top: 12px;
  padding: 0;
}
.tool-note.is-tor-anim::before {
  display: none;
}
.tor-search-anim {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-radius: 14px;
  border: 1px solid rgba(224, 27, 47, .42);
  background:
    radial-gradient(60% 100% at 15% 50%, rgba(224, 27, 47, .24), transparent 75%),
    rgba(16, 6, 9, .94);
  box-shadow: 0 12px 32px -16px rgba(224, 27, 47, .65), inset 0 1px 0 rgba(255, 90, 106, .16);
  position: relative;
  overflow: hidden;
}
.tor-search-anim::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 66, 84, .18), transparent);
  animation: torScanSweep 2.2s linear infinite;
  pointer-events: none;
}
.tor-radar {
  position: relative;
  width: 28px;
  height: 28px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tor-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 66, 84, .65);
  opacity: 0;
  animation: torRadarPulse 2.1s cubic-bezier(.16, 1, .3, 1) infinite;
}
.tor-ring.r2 {
  animation-delay: 1.05s;
}
.tor-core {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4254;
  box-shadow: 0 0 12px #ff4254;
}
.tor-anim-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tor-anim-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .01em;
}
.tor-anim-sub {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  color: #e28090;
}
@keyframes torRadarPulse {
  0% { transform: scale(.35); opacity: .9; }
  80%, 100% { transform: scale(1.45); opacity: 0; }
}
@keyframes torScanSweep {
  from { left: -60%; }
  to { left: 130%; }
}

/* ========================================================================== */
/*  EvilGPT Animated Security Violation Alert                                 */
/* ========================================================================== */
.violation-card {
  position: relative;
  overflow: hidden;
  margin: 8px 0;
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 50, 70, .65);
  background:
    radial-gradient(80% 120% at 12% 20%, rgba(224, 27, 47, .32), transparent 70%),
    linear-gradient(180deg, rgba(28, 7, 11, .97), rgba(12, 3, 5, .99));
  box-shadow:
    0 20px 50px -20px rgba(224, 27, 47, .65),
    0 0 0 1px rgba(255, 66, 84, .18) inset;
  animation: violationShake .45s cubic-bezier(.36, .07, .19, .97) both;
}
.violation-scanline {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(255, 66, 84, .11) 48%,
    rgba(255, 66, 84, .22) 50%,
    rgba(255, 66, 84, .11) 52%,
    transparent 100%
  );
  background-size: 100% 240%;
  animation: violationScan 3.2s linear infinite;
}
.violation-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}
.violation-icon {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(224, 27, 47, .22);
  border: 1px solid rgba(255, 66, 84, .55);
  color: #ff4d5e;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  box-shadow: 0 0 18px rgba(224, 27, 47, .55);
}
.violation-pulse {
  position: absolute;
  inset: -2px;
  border-radius: 13px;
  border: 1.5px solid rgba(255, 66, 84, .75);
  animation: violationPulse 1.8s ease-out infinite;
  pointer-events: none;
}
.violation-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.violation-kicker {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .12em;
  color: #ff6676;
  text-transform: uppercase;
}
.violation-title {
  font-size: 15.5px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -.01em;
}
.violation-body {
  position: relative;
  z-index: 1;
  margin: 0 0 14px;
  font-size: 13.8px;
  line-height: 1.6;
  color: #f0d5d9;
}
.violation-meta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.violation-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 8px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  color: #ffb8c0;
  background: rgba(224, 27, 47, .16);
  border: 1px solid rgba(255, 66, 84, .36);
}
.violation-badge strong {
  color: #ffffff;
}
.violation-badge.is-strike {
  background: rgba(255, 66, 84, .24);
  border-color: rgba(255, 66, 84, .6);
}
@keyframes violationShake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}
@keyframes violationPulse {
  0% { transform: scale(.95); opacity: .9; }
  100% { transform: scale(1.38); opacity: 0; }
}
@keyframes violationScan {
  from { background-position: 0 -80%; }
  to { background-position: 0 180%; }
}

/* ========================================================================== */
/*  Support Tickets & Direct Website Checkout                                 */
/* ========================================================================== */
.sup-head-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.sup-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  flex-wrap: wrap;
}
.sup-status-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sup-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .03em;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .04);
  color: var(--muted);
}
.sup-badge.is-open {
  color: #ffb8c0;
  border-color: rgba(224, 27, 47, .55);
  background: rgba(224, 27, 47, .18);
}
.sup-thread-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sup-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 440px;
  overflow-y: auto;
  padding-right: 4px;
}
.sup-empty {
  margin: 12px 0;
  text-align: center;
}
.sup-msg {
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .28);
  max-width: 88%;
}
.sup-msg.is-user {
  align-self: flex-end;
  border-color: rgba(224, 27, 47, .42);
  background: linear-gradient(180deg, rgba(224, 27, 47, .16), rgba(224, 27, 47, .06));
}
.sup-msg.is-admin {
  align-self: flex-start;
  border-color: rgba(255, 255, 255, .16);
  background: rgba(24, 24, 30, .78);
}
.sup-msg-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
}
.sup-msg-author {
  font-weight: 700;
  color: #fff;
}
.sup-msg-subj {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(224, 27, 47, .22);
  color: #ffb8c0;
}
.sup-msg-time {
  margin-left: auto;
  color: var(--faint);
  font-size: 11px;
}
.sup-msg-body {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.sup-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.sup-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}
/* Each field is a column: its label belongs above the control, not beside it.
   The flex sizing is scoped to .sup-row on purpose -- in a column container a
   flex-basis is a HEIGHT, which stretched these fields to 220px of empty box. */
.sup-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.sup-row > .sup-field { flex: 1 1 220px; }
.sup-row > .sup-field-grow { flex: 2 1 280px; }
.sup-label {
  font-size: 11px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted);
}
.sup-field .sup-input, .sup-field .picker { width: 100%; }
.sup-select, .sup-input, .sup-textarea {
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 12px;
  padding: 10px 13px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.sup-select {
  flex: 0 0 180px;
  background-color: #140b0e;
}
.sup-input {
  min-width: 0;
}
.sup-textarea {
  width: 100%;
  resize: vertical;
  min-height: 84px;
}
.sup-select:focus, .sup-input:focus, .sup-textarea:focus {
  border-color: rgba(224, 27, 47, .65);
  box-shadow: 0 0 0 3px rgba(224, 27, 47, .15);
}
.sup-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* A panel inside a card, so it needs its own box: it had a background and a border
   colour but no border, radius or padding, which painted the gradient edge to edge
   and squared it off against the card's rounded corners. */
.checkout-panel, .invoice-panel {
  margin-top: 14px;
  padding: 16px 18px;
  /* No border: this panel always sits inside a card that already has one, and the red
     line it drew ran a few pixels under the pay button like a stray rule. The gradient
     is enough to set the panel apart from the card around it. */
  border: 1px solid transparent;
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(70% 100% at 90% 10%, rgba(224, 27, 47, .18), transparent 70%),
    linear-gradient(180deg, rgba(24, 10, 14, .95), rgba(12, 6, 8, .98));
}
.checkout-panel .card-title, .invoice-panel .card-title { margin-bottom: 4px; }
.checkout-panel .card-sub, .invoice-panel .card-sub { margin: 0 0 14px; }
.checkout-facts { margin-bottom: 14px; }
/* The promo field is one input, so it should not stretch a flex row on its own. */
.checkout-panel .inline-form { margin-bottom: 14px; }
.checkout-panel .inline-form input { width: 100%; }
.checkout-actions { margin-top: 0; }
.checkout-actions .btn { flex: 0 1 auto; }
/* Where the total comes from, under the figures and in the quieter voice of a note. */
.checkout-why { margin: 0 0 14px; color: var(--faint); font-size: 12.5px; line-height: 1.5; }
.checkout-why[hidden] { display: none; }
/* An empty note still reserved its margin, which is what put the panel's own edge a
   few pixels under the button. */
.card-foot:empty { display: none; }

@media (max-width: 560px) {
  .checkout-panel, .invoice-panel { padding: 14px; }
  .checkout-actions { flex-direction: column; align-items: stretch; }
  .checkout-actions .btn { width: 100%; }
}
.checkout-panel[hidden], .invoice-panel[hidden] {
  display: none;
}
.checkout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.checkout-form {
  margin-top: 12px;
}
.invoice-grid {
  margin-top: 10px;
  margin-bottom: 14px;
}
.invoice-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.plan-buy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 10px;
}


/* ========================================================================== */
/*  The creator programme block on /referral                                  */
/* ========================================================================== */
.cr-card .card-head { align-items: flex-start; gap: 12px; }
/* The offer, read before anything is typed: one number per fact, the share first
   because it is the reason to read on at all. */
.cr-terms { display: grid; gap: 10px; margin-top: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cr-term { padding: 13px 14px; border-radius: 14px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .035); }
.cr-term.is-lead { border-color: rgba(224, 27, 47, .45);
  background: linear-gradient(180deg, rgba(224, 27, 47, .14), rgba(255, 255, 255, .02)); }
.cr-term-value { font-size: 25px; font-weight: 800; line-height: 1.1;
  font-variant-numeric: tabular-nums; }
.cr-term.is-lead .cr-term-value { color: var(--red-soft); }
.cr-term-label { margin-top: 5px; font-size: 11px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted); line-height: 1.35; }

.cr-perk { display: flex; align-items: flex-start; gap: 10px;
  margin: 12px 0 0; padding: 12px 14px; font-size: 13px; line-height: 1.55;
  color: var(--text); border-radius: 12px; border: 1px solid rgba(224, 27, 47, .28);
  background: rgba(224, 27, 47, .08); }
.cr-perk svg { flex: none; margin-top: 2px; color: var(--red-soft); }

/* The application itself, set apart from the pitch above it. */
.cr-apply { margin-top: 16px; padding: 16px; border-radius: 16px;
  border: 1px solid var(--line); background: rgba(0, 0, 0, .22); }
.cr-apply-head { margin-bottom: 13px; font-size: 13px; font-weight: 700;
  letter-spacing: .03em; }
.cr-apply-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* The note runs the width of the pair above it: it is one field, not a third column. */
.cr-apply-about { margin-top: 12px; }
.cr-apply-about .sup-textarea { min-height: 76px; }
.cr-apply-foot { display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-top: 14px; }
.cr-apply-hint { flex: 1 1 220px; margin: 0; font-size: 12.5px; line-height: 1.5;
  color: var(--faint); }
.cr-apply-foot .btn { flex: none; width: auto; }
.cr-apply .key-warn { margin-top: 12px; }
.cr-lines { list-style: none; margin: 10px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 2px; }
.cr-lines li { display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 10px; font-size: 13px; background: rgba(255, 255, 255, .03); }
.cr-lines li:nth-child(odd) { background: rgba(255, 255, 255, .055); }
.cr-lines li > span:first-child { color: var(--faint); flex: none; font-variant-numeric: tabular-nums; }
.cr-plan { flex: 1; min-width: 0; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-lines b { flex: none; color: #9ff3c0; font-variant-numeric: tabular-nums; }
.cr-lines b.cr-minus { color: #ffb3bb; }

/* The working panel a creator sees once they are approved. */
.cr-field { margin-top: 18px; }
.cr-field-label { font-size: 11px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.cr-field .sup-input, .cr-field .sup-select { width: 100%; margin-bottom: 10px; }
.cr-payout-btn { width: 100%; }
.cr-payout-btn:disabled { opacity: .5; filter: grayscale(.4); cursor: not-allowed; }
.cr-rate-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cr-chip { flex: none; padding: 6px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 700; letter-spacing: .04em; color: #fff;
  background: linear-gradient(180deg, var(--red-soft), var(--red));
  box-shadow: 0 8px 20px -12px var(--red); }
.cr-rate-note { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

.cr-grid { display: grid; gap: 10px; margin-top: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cr-tile { padding: 14px 15px; border-radius: 14px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .035); }
.cr-tile.is-money { border-color: rgba(224, 27, 47, .45);
  background: linear-gradient(180deg, rgba(224, 27, 47, .14), rgba(255, 255, 255, .02)); }
.cr-tile-value { font-size: 26px; font-weight: 800; line-height: 1.1;
  font-variant-numeric: tabular-nums; }
.cr-tile.is-money .cr-tile-value { color: var(--red-soft); }
.cr-tile-label { margin-top: 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); }
.cr-tile-foot { margin-top: 8px; font-size: 11.5px; color: var(--faint); line-height: 1.45; }
.cr-meter { margin-top: 11px; }

@media (max-width: 560px) {
  .cr-grid { grid-template-columns: minmax(0, 1fr); }
  .cr-tile-value { font-size: 23px; }
  /* Three stacked tiles would be a column of air; on a phone each fact is one row. */
  .cr-terms { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .cr-term { display: flex; align-items: baseline; justify-content: space-between;
    gap: 12px; padding: 11px 13px; }
  .cr-term-value { font-size: 20px; }
  .cr-term-label { margin-top: 0; text-align: right; }
  .cr-apply-grid { grid-template-columns: minmax(0, 1fr); }
  .cr-apply-foot .btn { width: 100%; }
}

/* On a phone the page topbar holds the mark, Account, the language switch and Back
   to chat; the wordmark is the one item that carries no information the logo does
   not, so it is what gives way rather than being clipped to "Evil...". */
@media (max-width: 520px) {
  body.page .topbar .brand { display: none; }
  body.page .topbar .top-link { white-space: nowrap; }
}

/* The themed stand-in for a <select>: the trigger borrows the input's shape so a
   row of fields lines up, and the list is the site's own menu. */
.picker { position: relative; }
.picker-button {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 11px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: 14px; text-align: left;
  transition: border-color .16s ease, background .16s ease;
}
.picker-button:hover { border-color: var(--line-strong); }
.picker-button[aria-expanded="true"] { border-color: var(--red); }
.picker-button:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.picker-caret { display: inline-flex; flex: none; color: var(--muted);
  transition: transform .18s ease; }
.picker-button[aria-expanded="true"] .picker-caret { transform: rotate(180deg); }
/* At least as wide as the trigger, but free to grow to the longest label rather
   than wrapping it onto two lines in a narrow column. */
.picker-menu { left: 0; right: auto; min-width: 100%; width: max-content; max-width: 300px; }
.picker-option { white-space: nowrap; }
.picker-menu[hidden] { display: none; }
.picker-option { flex-direction: row; align-items: center; justify-content: space-between; }
.picker-option[aria-selected="true"] { background: rgba(224, 27, 47, .16); color: #fff; }
.picker-option[aria-selected="true"]::after { content: ""; flex: none;
  width: 7px; height: 7px; border-radius: 50%; background: var(--red-soft); }

/* A refusal with two ways out: one panel per way, side by side, each a whole offer
   rather than a clause in a sentence. */
.unlock-card { max-width: 720px; width: min(720px, calc(100vw - 32px)); }
.unlock-grid { display: grid; gap: 12px; margin: 18px 0 4px;
  grid-template-columns: repeat(2, minmax(0, 1fr)); }
.unlock-grid.is-single { grid-template-columns: minmax(0, 1fr); }
.unlock-panel { display: flex; flex-direction: column; gap: 8px; padding: 16px;
  border-radius: 16px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); }
.unlock-panel.is-accent { border-color: rgba(224, 27, 47, .55);
  background: linear-gradient(180deg, rgba(224, 27, 47, .14), rgba(255, 255, 255, .02)); }
.unlock-tag { align-self: flex-start; padding: 3px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line-strong); background: rgba(0, 0, 0, .3); }
.unlock-panel.is-accent .unlock-tag { color: #ffd7dc; border-color: rgba(224, 27, 47, .5);
  background: rgba(224, 27, 47, .22); }
.unlock-panel-title { font-size: 16px; font-weight: 700; }
.unlock-panel-text { margin: 0; font-size: 13px; line-height: 1.55; color: var(--muted); }
.unlock-points { list-style: none; margin: 2px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text); }
.unlock-points li { position: relative; padding-left: 16px; line-height: 1.45; }
.unlock-points li::before { content: ""; position: absolute; left: 0; top: .5em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--red-soft); }
.unlock-panel .btn { margin-top: auto; width: 100%; }
.unlock-foot { justify-content: center; margin-top: 14px; }

@media (max-width: 620px) {
  .unlock-grid { grid-template-columns: minmax(0, 1fr); }
}

/* The sign-in pane holds both ways in, so each needs a label and a clear break
   between them; the waiting screen replaces them rather than sitting alongside. */
.auth-way-head {
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 8px; text-align: left;
}
#login-ways .auth-lead { margin-bottom: 12px; }
.auth-or {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0 18px; color: var(--faint); font-size: 12px;
}
.auth-or::before, .auth-or::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}
#login-ways .btn-tg { width: 100%; }

/* Two-step sign-in, shown beside the key it guards. */
.twofa-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--line);
}
.twofa-text { flex: 1 1 260px; min-width: 0; }
.twofa-head { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 700; }
.twofa-note { margin: 6px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.twofa-row .btn { flex: none; width: auto; }

@media (max-width: 520px) {
  .twofa-row .btn { width: 100%; }
}

/* ===================== Phones: give the conversation its room back =========== */
/* The plan footer under the composer ran to three lines plus margins -- about a
   third of the screen on a phone -- which pushed the composer up and squeezed the
   conversation into a letterbox. Same words, less air. */
@media (max-width: 560px) {
  .composer { padding: 6px 12px 10px; }
  .composer-box { padding: 11px 14px 8px; }
  .retry-link { margin-top: 8px; font-size: 13px; }
  .tier { margin-top: 8px; }
  .tier-head { font-size: 12.5px; }
  .tier-sub { font-size: 11.5px; margin-top: 2px; }
  .tier-cta { margin-top: 4px; font-size: 12px; }
}

/* ===================== Support: a request you can come back to ============== */
/* Every message used to open its own ticket, so the panel showed a number that led
   nowhere. A request is now a thread, and these are the threads: the one on screen is
   lit, the live one carries a pulse, and the rest are one tap away. */
.sup-head .badge { flex: none; white-space: nowrap; align-self: flex-start; }
.sup-sub-head { margin-top: 18px; }
/* Wrapping, not scrolling: a strip that scrolls sideways hides the requests it cannot
   fit, clips the card it cuts in half, and shaved the hover lift off the top as well. */
.sup-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px; margin: 10px 0 4px; }
.sup-item { min-width: 0; display: flex; flex-direction: column; gap: 5px;
  padding: 11px 13px; border-radius: 15px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--muted); text-decoration: none;
  transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.sup-item:hover { border-color: var(--line-strong); background: var(--panel-2);
  transform: translateY(-1px); }
.sup-item.is-on { border-color: rgba(224, 27, 47, .7); background: rgba(224, 27, 47, .1); }
/* The one you are reading is not somewhere to go. */
.sup-item.is-on { cursor: default; }
.sup-item.is-on:hover { transform: none; border-color: rgba(224, 27, 47, .7);
  background: rgba(224, 27, 47, .1); }
.sup-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sup-id { font-size: 13px; font-weight: 700; color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.sup-state { display: inline-flex; align-items: center; gap: 5px; font-size: 11px;
  font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.sup-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.sup-item.is-live .sup-state { color: var(--red-soft); }
.sup-item.is-live .sup-dot { background: #35d07f;
  box-shadow: 0 0 0 3px rgba(53, 208, 127, .16); }
.sup-item-subject { color: var(--text); font-size: 13.5px; line-height: 1.35;
  min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; overflow-wrap: anywhere; }
/* Topic, date and the message count run just past a narrow card, and a cut date is
   worse than a second line: the row is a grid, so the cards stay level either way. */
.sup-item-meta { font-size: 11.5px; line-height: 1.35; color: var(--faint); min-width: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; }

/* Which request the box below writes into, said above the box rather than after. */
.sup-compose-head { margin-top: 18px; font-size: 13px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sup-notice { display: flex; align-items: flex-start; gap: 9px; margin: 10px 0 0;
  padding: 10px 13px; border-radius: 13px; border: 1px solid rgba(224, 27, 47, .3);
  background: rgba(224, 27, 47, .07); color: #e8d2d5; font-size: 13px; line-height: 1.5; }
.sup-notice .ic { flex: none; margin-top: 2px; color: var(--red-soft); }
.sup-thread-subject { color: var(--muted); font-size: 13px; text-align: right;
  max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 560px) {
  .sup-list { grid-template-columns: 1fr; }
  .sup-thread-subject { display: none; }
}

/* ===================== Header controls: plain, and menus that open from their button === */
/* Tools and the model pill had a gloss gradient, an inset highlight, a red glow on
   hover and a lift -- four effects on a control that is clicked all day. They now
   match Telegram and EN/RU beside them: a hairline outline, a faint fill on hover,
   a firmer fill while the menu is open. The chevron is the same drawn icon as
   elsewhere instead of two different text characters, and it turns with the menu. */
.topbar .pill {
  gap: 5px; padding: 7px 12px;
  font-size: 13.5px; font-weight: 500; letter-spacing: 0;
  color: #d9cdcf;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .025);
  box-shadow: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease,
              transform .1s ease-out;
}
.topbar .pill:hover {
  color: #fff; transform: none;
  border-color: rgba(255, 255, 255, .17);
  background: rgba(255, 255, 255, .06);
  box-shadow: none;
}
.topbar .pill:active { transform: scale(.97); }
.topbar .pill:focus-visible {
  outline: 2px solid rgba(255, 90, 106, .8); outline-offset: 2px;
  border-color: rgba(255, 255, 255, .17); box-shadow: none;
}
.topbar .pill[aria-expanded="true"] {
  color: #fff;
  border-color: rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .085);
  box-shadow: none;
}
.topbar .pill .caret {
  display: inline-flex; margin: 0 -3px 0 0; opacity: 1; font-size: 0;
  color: var(--faint);
  transition: transform .2s cubic-bezier(.23, 1, .32, 1), color .15s ease;
}
.topbar .pill:hover .caret { color: var(--muted); }
.topbar .pill[aria-expanded="true"] .caret { color: var(--red-soft); transform: rotate(180deg); }
/* The model's name is the thing being read, so it keeps the heavier weight. */
.topbar .pill-model #model-label { font-weight: 600; }

/* The menus themselves: one flat surface, no gradient, no red rule between groups. */
.topbar .menu, .menu-roles {
  background: #141013;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 14px; padding: 5px;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .85), 0 2px 6px rgba(0, 0, 0, .4);
}
.topbar .menu-item { border-radius: 9px; padding: 9px 11px; font-size: 14px; }
.topbar .menu-item:hover:not(:disabled) { background: rgba(255, 255, 255, .06); }
.topbar .menu-sep { height: 1px; margin: 5px 8px; background: rgba(255, 255, 255, .07); }

/* The chosen model is marked with a tick, not a red block: the block shouted louder
   than the row under the cursor. */
.topbar .model-opt { position: relative; padding-right: 38px; }
.topbar .model-opt.is-on { background: none; }
.topbar .model-opt.is-on:hover { background: rgba(255, 255, 255, .06); }
.opt-tick { position: absolute; right: 12px; top: 50%; display: inline-flex;
  color: var(--red-soft); opacity: 0; transform: translateY(-50%) scale(.6); }
.model-opt.is-on .opt-tick { opacity: 1; transform: translateY(-50%); }
.topbar .model-opt.is-on .opt-main { color: #fff; }

/* Opening: the menu grows out of the corner nearest its button -- scale from .96
   rather than from nothing, plus a 4px drop -- in 180ms on a fast-out curve, so the
   first frame already moves. Closing is the same path reversed in 120ms: the user
   has already decided, nothing to watch. */
@media (prefers-reduced-motion: no-preference) {
  .topbar .menu:not([hidden]), .menu-roles:not([hidden]) {
    animation: dropIn .18s cubic-bezier(.23, 1, .32, 1) both; }
  .topbar .menu.is-leaving, .menu-roles.is-leaving {
    animation: dropOut .12s ease-out both; pointer-events: none; }
  .opt-tick { transition: opacity .15s ease, transform .2s cubic-bezier(.23, 1, .32, 1); }
}
.topbar .menu-right { transform-origin: top right; }
.menu-roles { transform-origin: top center; }
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-4px) scale(.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes dropOut {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(-3px) scale(.98); }
}
@media (prefers-reduced-motion: reduce) {
  .topbar .pill, .topbar .pill .caret { transition: none; }
  .topbar .pill:active { transform: none; }
}

/* ===================== Roles: one colour, literal icons ======================== */
/* Each role had its own pastel -- violet, coral, gold -- in a tinted tile, and the
   quick role wore a sparkle. Three colours for three menu entries is decoration, not
   information: the icon already says which is which. The icons are now drawn in the
   text colours, on a hairline tile, and the chosen one is lit by the brand red, the
   same signal as everywhere else. The sidebar follows, so a role looks the same in
   both places. */
:root { --kind-chat: var(--muted); --kind-code: var(--muted); --kind-brief: var(--muted); }

.rc-ic { width: 34px; height: 34px; border-radius: 10px;
  background: none; border: 1px solid rgba(255, 255, 255, .09); color: var(--muted);
  transition: color .15s ease, border-color .15s ease; }
.role-card { color: var(--muted); -webkit-backdrop-filter: none; backdrop-filter: none; }
.role-card .rc-ic { color: var(--muted); }
.role-card:hover { transform: none; }
.role-card:hover .rc-ic { color: var(--text); border-color: rgba(255, 255, 255, .16); }
.role-card.is-on { border-color: rgba(224, 27, 47, .55); background: rgba(224, 27, 47, .06); }
.role-card.is-on .rc-ic { color: #fff; border-color: rgba(224, 27, 47, .45); }
.role-card.is-locked .rc-ic { color: var(--faint); }

.role-opt .mi-ic { color: var(--muted); }
.role-opt:hover .mi-ic { color: var(--text); }

.chat-kind { background: none; color: var(--faint); }
.chat-row[data-kind] .chat-kind { background: none; color: var(--faint); }
.chat-row:hover .chat-kind { color: var(--muted); transform: none; }
.chat-row.is-on .chat-kind { color: var(--text); }
.chat-row::before { opacity: 0; }
.chat-row[data-kind].is-on::before { opacity: 1; color: var(--red); background: var(--red); box-shadow: none; }

/* ===================== Small motions that confirm an action ==================== */

/* 1. Toasts rise 8px into place and sink back out, quicker on the way out. */
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toastIn .2s cubic-bezier(.23, 1, .32, 1) both; }
  .toast.is-leaving { animation: toastOut .15s ease-out both; }
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 8px) scale(.98); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translate(-50%, 0); }
  to   { opacity: 0; transform: translate(-50%, 6px) scale(.98); }
}

/* 2. A file chip grows in from .9, folds away when removed, and while it uploads a
   thin bar runs along its bottom edge instead of the whole chip just going grey. */
.chip { position: relative; overflow: hidden; }
.chip.is-busy { opacity: .75; }
.chip.is-busy::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--red-soft), transparent);
  background-size: 40% 100%; background-repeat: no-repeat; }
@media (prefers-reduced-motion: no-preference) {
  .chip.is-new { animation: chipIn .18s cubic-bezier(.23, 1, .32, 1) both; }
  .chip.is-leaving { animation: chipOut .14s ease-out both; pointer-events: none; }
  .chip.is-busy::after { animation: chipLoad 1.1s linear infinite; }
}
@keyframes chipIn { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
@keyframes chipOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: scale(.9); } }
@keyframes chipLoad { from { background-position: -40% 0; } to { background-position: 140% 0; } }

/* 3. A new model name slides up into the pill. */
@media (prefers-reduced-motion: no-preference) {
  #model-label { display: inline-block; }
  #model-label.is-flash { animation: labelIn .2s cubic-bezier(.23, 1, .32, 1) both; }
}
@keyframes labelIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* 4. Stop arrives beside Send instead of popping in; Send dims rather than snaps. */
.stop-sq { width: 8px; height: 8px; flex: none; border-radius: 2px; background: currentColor; }
.send { transition: opacity .15s ease, transform .1s ease-out, filter .15s ease; }
.send:active:not(:disabled) { transform: scale(.94); }
@media (prefers-reduced-motion: no-preference) {
  .stop:not([hidden]) { animation: stopIn .18s cubic-bezier(.23, 1, .32, 1) both; }
}
@keyframes stopIn { from { opacity: 0; transform: translateX(6px) scale(.96); } to { opacity: 1; transform: none; } }

/* 5. The context meter pulses once when it crosses 75% or 100%, or when switching
   models changes its scale -- a ring that spreads and fades, then nothing. */
.ctx { position: relative; }
@media (prefers-reduced-motion: no-preference) {
  .ctx.is-flash { animation: ctxPulse .6s ease-out; }
}
@keyframes ctxPulse {
  from { box-shadow: 0 0 0 0 rgba(224, 27, 47, .45); }
  to   { box-shadow: 0 0 0 8px rgba(224, 27, 47, 0); }
}

/* 6. Copy: the two drawn icons share one spot, and the tick takes over on success. */
.copy-ic { position: relative; display: inline-grid; place-items: center; width: 14px; height: 14px; }
.copy-ic .ic { grid-area: 1 / 1; }
.copy-ic .ic-done { opacity: 0; transform: scale(.5); }
.copy-btn.done .copy-ic .ic-copy { opacity: 0; transform: scale(.5); }
.copy-btn.done .copy-ic .ic-done { opacity: 1; transform: none; }
@media (prefers-reduced-motion: no-preference) {
  .copy-ic .ic { transition: opacity .15s ease, transform .2s cubic-bezier(.23, 1, .32, 1); }
}

.chat-row.is-pending { box-shadow: inset 3px 0 var(--accent, #ed334d); background: rgba(224,27,47,.12); }
#code-sandbox[hidden] { display: none; }
#web-checkout-box { background: transparent; border: 0; padding: 0; border-radius: 0; margin: 18px 0 0; }
.plans-checkout-wrap #web-checkout-box { margin: 0; }
.checkout-promo { margin: 12px 0 18px; }
.checkout-promo summary { width: fit-content; cursor: pointer; font-size: .9rem; }
.checkout-promo input { margin-top: 10px; padding: 10px 12px; color: inherit; background: rgba(255,255,255,.04); border: 1px solid var(--line, #493a40); border-radius: 9px; width: min(100%, 20rem); box-sizing: border-box; }
#web-checkout-box .checkout-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 10px; }
#web-checkout-box .btn { white-space: normal; min-width: 0; }
#web-checkout-box .btn:disabled { opacity: .5; }
#web-checkout-box .checkout-facts dd { text-align: end; overflow-wrap: anywhere; }

.msg-body > .skeleton[hidden] { display: none; }
.msg-body > .tor-search-status {
  display: flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  gap: 7px;
  margin: 0 0 3px;
  padding: 3px 0;
  font-size: .82rem;
  line-height: 1.4;
  color: var(--muted);
}
.tor-search-status + .dots { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .chat-row.is-pending .chat-kind { transform: translateX(2px); }
  .chat-kind { transition: transform 120ms ease-out; }
}
@media (prefers-reduced-motion: reduce) {
  .tor-search-status::before, .tor-search-status + .dots::after { animation: none; }
}

.opening-chat > :is(.messages, .composer, #code-sandbox, .cs-notice) { visibility: hidden; }
.shell.opening-chat { position: relative; }
.chat-opening {
  position: absolute; inset: 3.75rem 0 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .55rem; padding: 1.5rem;
}
.chat-opening strong { max-width: min(32rem, 90%); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-opening span { font-size: .85rem; color: var(--muted); }

@media (max-width: 560px) {
  body.page .shell, body.page main, body.page .card { min-width: 0; }
  #wallet-topup-form { display: grid; grid-template-columns: minmax(0, 1fr); }
  #wallet-topup-form input, #wallet-topup-form .btn { width: 100%; min-width: 0; }
  #wallet-amount, #co-discount, #input, .auth-pane input { font-size: 16px; }
  .role-card, .auth-tab { min-height: 44px; }
}
#registration-captcha:not([hidden]) { margin: 12px 0; min-width: 0; }

#key-go { margin-top: 10px; }

.invoice-stack { margin-block: 1.25rem; }
.invoice-stack[hidden] { display: none; }
.invoice-stack h3 { margin: 0; font-size: 1.05rem; }
.invoice-stack > p, .invoice-item small { color: var(--muted); font-size: .8rem; }
.invoice-item { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: .8rem; padding: .85rem 0; border-top: 1px solid var(--line); }
.invoice-item small { display: block; margin-top: .2rem; }
.invoice-amount { text-align: right; }
.invoice-item .btn { margin: 0; }
@media(max-width: 600px) {
  .invoice-item { grid-template-columns: minmax(0,1fr) auto; }
  .invoice-item .btn { grid-column: 1 / -1; justify-self: stretch; }
}
/* Rolling subscription allowance */
.quota-ring {position:relative;display:inline-grid;place-items:center;width:32px;height:32px;vertical-align:middle;border-radius:50%;color:var(--red-soft)}
.quota-ring svg,.quota-ring img {grid-area:1/1}
.quota-ring svg {width:100%;height:100%;fill:none;stroke:#43232a;stroke-width:2.4;transform:rotate(-90deg)}
.quota-ring .quota-arc {stroke:currentColor;stroke-dasharray:100;stroke-dashoffset:calc(100 - var(--left));transition:stroke-dashoffset .42s ease-out}
.quota-ring img {width:58%;height:58%;transition:transform .2s ease}
.quota-ring:focus-visible {outline:2px solid currentColor;outline-offset:3px}
.quota-ring:is(:focus,:hover) img {transform:scale(1.07)}
.quota-caption {position:absolute;bottom:calc(100% + 4px);left:0;z-index:3;white-space:nowrap;color:var(--text);background:var(--surface);border:1px solid var(--line);border-radius:8px;padding:4px 9px;opacity:0;pointer-events:none;transition:opacity .15s}
.quota-ring:is(:hover,:focus) .quota-caption {opacity:1}
.account-quota {padding-top:12px}
.account-quota .quota-ring {width:56px;height:56px}
.account-quota .quota-caption {bottom:auto;left:calc(100% + 12px);opacity:1;border:0;padding:0;background:none}
.quota-form {display:flex;align-items:center;flex-wrap:wrap;gap:10px;margin:12px 0}
.quota-form label {display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:190px}
.quota-form input {width:124px;color:var(--text);background:var(--surface-2);border:1px solid var(--line);border-radius:8px;padding:8px}
@media(prefers-reduced-motion:reduce){.quota-ring .quota-arc,.quota-ring img,.quota-caption {transition:none}.quota-ring:is(:focus,:hover) img {transform:none}}
