/* ireze — dark glass gateway front end.
   Frosted surfaces over a slow colour mesh. Blur is applied only where a layer
   genuinely overlaps something, because stacked backdrop-filter is what costs. */
:root {
  --bg: #0d0f12;
  --ink: #f4f6f8;
  --muted: #c2c7cd;
  --faint: #a8afb7;
  --accent: #526f91;
  --accent-hi: #7c9dc6;
  --accent-soft: rgba(124, 157, 198, .18);
  --ok: #6fc08f;
  --warn: #d9b53f;
  --bad: #d4735c;

  --hair: rgba(255, 255, 255, .10);
  --hair-soft: rgba(255, 255, 255, .06);
  --glass: rgba(18, 21, 26, .62);
  --glass-2: rgba(24, 28, 34, .55);
  --glass-hi: rgba(38, 44, 52, .62);
  --sheen: linear-gradient(165deg, rgba(255, 255, 255, .085), rgba(255, 255, 255, .018) 42%, rgba(255, 255, 255, .03));
  --edge: inset 0 1px 0 rgba(255, 255, 255, .11);
  --blur: blur(28px) saturate(175%);
  --blur-sm: blur(14px) saturate(160%);
  --drop: 0 28px 56px -30px rgba(0, 0, 0, .82), 0 2px 10px -6px rgba(0, 0, 0, .6);
  --drop-sm: 0 12px 28px -18px rgba(0, 0, 0, .7);
  --ring: 0 0 0 3px rgba(124, 157, 198, .32);

  --radius: 16px;
  --radius-lg: 22px;
  --radius-sm: 11px;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --spring: cubic-bezier(.34, 1.42, .5, 1);

  --sans: "Plus Jakarta Sans", "SF Pro Display", -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.62 var(--sans);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── colour mesh ───────────────────────────────────────────── */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; will-change: transform; }
.blob.b1 {
  width: 78vmax; height: 78vmax; right: -22vmax; top: -30vmax;
  background: radial-gradient(circle at 50% 50%, rgba(88, 128, 178, .34), transparent 66%);
  animation: drift1 34s var(--ease) infinite alternate;
}
.blob.b2 {
  width: 66vmax; height: 66vmax; left: -24vmax; bottom: -26vmax;
  background: radial-gradient(circle at 50% 50%, rgba(95, 168, 124, .19), transparent 66%);
  animation: drift2 42s var(--ease) infinite alternate;
}
.blob.b3 {
  width: 54vmax; height: 54vmax; left: 34%; top: 22%;
  background: radial-gradient(circle at 50% 50%, rgba(126, 108, 176, .17), transparent 66%);
  animation: drift3 50s var(--ease) infinite alternate;
}
@keyframes drift1 { to { transform: translate3d(-7vmax, 6vmax, 0) scale(1.12); } }
@keyframes drift2 { to { transform: translate3d(8vmax, -5vmax, 0) scale(1.08); } }
@keyframes drift3 { to { transform: translate3d(-6vmax, -8vmax, 0) scale(1.15); } }

body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: .55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.05'/%3E%3C/svg%3E");
}

::selection { background: rgba(124, 157, 198, .38); color: #fff; }
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .18) transparent; }
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .26); background-clip: content-box; }

.mono { font-family: var(--mono); font-variant-ligatures: none; }
.spacer { flex: 1 1 auto; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 12px; top: -56px; z-index: 60; padding: 10px 16px;
  background: var(--glass-hi); backdrop-filter: var(--blur-sm);
  border: 1px solid var(--hair); border-radius: 999px; box-shadow: var(--drop-sm);
  color: var(--ink); text-decoration: none; transition: top .22s var(--spring);
}
.skip:focus { top: 12px; }
code { font: .9em/1.45 var(--mono); color: #dfe6ee; background: rgba(255, 255, 255, .07); border-radius: 6px; padding: 1px 6px; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

.ico { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ico-in { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }

/* ── shell ────────────────────────────────────────────────── */
.shell { position: relative; z-index: 2; display: flex; min-height: 100%; }

.side {
  width: 262px; flex: none; display: flex; flex-direction: column; gap: 22px;
  padding: 20px 15px; border-right: 1px solid var(--hair-soft);
  background: rgba(16, 19, 23, .74);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  position: sticky; top: 0; height: 100vh; overflow: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 5px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(150deg, #8fb0d8, var(--accent) 58%, #3f5776);
  color: #fff; position: relative; overflow: hidden;
  box-shadow: 0 10px 26px -12px rgba(124, 157, 198, .9), inset 0 1px 0 rgba(255, 255, 255, .34);
}
.brand-mark::after {
  content: ""; position: absolute; inset: -40% -120%;
  background: linear-gradient(100deg, transparent 38%, rgba(255, 255, 255, .5), transparent 62%);
  transform: translateX(-70%); animation: sheen 6.5s var(--ease) infinite;
}
@keyframes sheen { 0%, 62% { transform: translateX(-70%); } 88%, 100% { transform: translateX(70%); } }
.brand-text { display: flex; flex-direction: column; line-height: 1.22; }
.brand-text strong { font-size: 18px; font-weight: 600; letter-spacing: -.3px; }
.brand-text small { font-size: 11.5px; color: var(--faint); letter-spacing: .1px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.navlink {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  padding: 11px 12px; border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; color: var(--muted); font: 500 14.5px var(--sans);
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--spring);
}
.navlink:hover { background: rgba(255, 255, 255, .06); color: var(--ink); transform: translateX(2px); }
.navlink.is-current {
  background: linear-gradient(100deg, rgba(124, 157, 198, .26), rgba(124, 157, 198, .07));
  border-color: rgba(150, 180, 214, .34); color: #fff;
  box-shadow: var(--edge), 0 10px 24px -18px rgba(124, 157, 198, .9);
}
.navlink.is-current .ico { color: var(--accent-hi); }
.navlink span:first-of-type { flex: 1 1 auto; }

.badge {
  font: 500 10px/1 var(--sans); letter-spacing: .7px; text-transform: uppercase;
  color: var(--muted); background: rgba(255, 255, 255, .07);
  border: 1px solid var(--hair-soft); border-radius: 999px; padding: 4px 8px; font-style: normal; white-space: nowrap;
}

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 11px; padding-top: 16px; border-top: 1px solid var(--hair-soft); }
.balcard {
  background: linear-gradient(165deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02));
  border: 1px solid var(--hair-soft); border-radius: var(--radius);
  box-shadow: var(--edge); padding: 14px; display: flex; flex-direction: column; gap: 1px;
}
.label { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .8px; }
.balnum { font-size: 24px; line-height: 1.2; font-weight: 600; letter-spacing: -.4px; }
.balunit { font-size: 11px; color: var(--faint); }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px;
  padding: 14px 26px; border-bottom: 1px solid var(--hair-soft);
  background: rgba(13, 15, 18, .58);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.page-title { margin: 0; font-size: 15.5px; font-weight: 600; letter-spacing: -.1px; color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.chip {
  font-size: 14px; padding: 7px 13px; border-radius: 999px;
  background: var(--glass-2); backdrop-filter: var(--blur-sm); -webkit-backdrop-filter: var(--blur-sm);
  border: 1px solid var(--hair); color: #fff; box-shadow: var(--edge);
}

.pill {
  display: inline-flex; align-items: center; gap: 8px; cursor: default;
  padding: 7px 13px; border-radius: 999px; font-size: 12.5px;
  background: var(--glass-2); backdrop-filter: var(--blur-sm); -webkit-backdrop-filter: var(--blur-sm);
  border: 1px solid var(--hair-soft); color: var(--muted); box-shadow: var(--edge);
  transition: border-color .2s var(--ease), color .2s var(--ease);
}
.pill:hover { border-color: var(--hair); color: var(--ink); }
.pill.is-flat { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; transition: background .3s var(--ease), box-shadow .3s var(--ease); }
.dot.is-ok { background: var(--ok); box-shadow: 0 0 0 4px rgba(111, 192, 143, .16); }
.dot.is-warn { background: var(--warn); box-shadow: 0 0 0 4px rgba(217, 181, 63, .16); }
.dot.is-bad { background: var(--bad); box-shadow: 0 0 0 4px rgba(212, 115, 92, .18); }
.dot.is-wait { background: var(--faint); }
.dot.is-live { background: var(--accent-hi); box-shadow: 0 0 0 4px rgba(124, 157, 198, .22); animation: pulse 1.5s var(--ease) infinite; }
@keyframes pulse { 50% { opacity: .4; transform: scale(.86); } }

.iconbtn {
  width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--hair-soft); border-radius: var(--radius-sm);
  background: var(--glass-2); color: var(--muted); box-shadow: var(--edge);
  transition: color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--spring);
}
.iconbtn:hover { color: var(--ink); border-color: var(--hair); transform: scale(1.05); }

.scroll { flex: 1 1 auto; padding: 26px; max-width: 1140px; width: 100%; }

/* ── views ─────────────────────────────────────────────────── */
.view { display: none; }
.view.is-current { display: block; }
.view.is-current > * { animation: rise .5s var(--ease) both; }
.view.is-current > *:nth-child(2) { animation-delay: .05s; }
.view.is-current > *:nth-child(3) { animation-delay: .1s; }
.view.is-current > *:nth-child(4) { animation-delay: .15s; }
.view.is-current > *:nth-child(5) { animation-delay: .2s; }
.view.is-current > *:nth-child(6) { animation-delay: .25s; }
.view.is-current > *:nth-child(7) { animation-delay: .3s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.994); } to { opacity: 1; transform: none; } }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.row.is-between { justify-content: space-between; }
.model-row { margin-top: 2px; }
.field-label { font-size: 13px; color: var(--muted); }
.sec-title { margin: 6px 0 8px; font-size: 27px; font-weight: 600; display: flex; align-items: center; gap: 10px; letter-spacing: -.7px; line-height: 1.2; }
.sec-note { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; max-width: 74ch; line-height: 1.66; }
.mini-title { margin: 0 0 11px; font-size: 14.5px; font-weight: 600; letter-spacing: -.1px; }

.selectlike {
  padding: 8px 14px; border-radius: 999px; background: var(--glass-2);
  backdrop-filter: var(--blur-sm); -webkit-backdrop-filter: var(--blur-sm);
  border: 1px solid var(--hair); font-size: 13.5px; color: #fff; box-shadow: var(--edge);
}

.input {
  width: 100%; padding: 12px 14px; border-radius: var(--radius);
  background: rgba(14, 17, 21, .5);
  backdrop-filter: var(--blur-sm); -webkit-backdrop-filter: var(--blur-sm);
  border: 1px solid var(--hair); color: var(--ink);
  font: 14.5px var(--sans); outline: none;
  box-shadow: var(--edge);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
}
.input::placeholder { color: var(--faint); }
.input:hover { border-color: rgba(255, 255, 255, .18); background: rgba(18, 22, 27, .58); }
.input:focus { border-color: rgba(150, 180, 214, .55); box-shadow: var(--ring), var(--edge); background: rgba(20, 24, 30, .66); }
.input.has-ico { padding-left: 40px; }
.input.select { width: auto; cursor: pointer; }
.input.select option,
select option {
  background-color: #14181e;
  color: #eef2f7;
}
.input.select option:checked,
select option:checked { background-color: #2c425f; color: #fff; }
:root[data-theme="light"] .input.select option,
:root[data-theme="light"] select option {
  background-color: #fff;
  color: #151a21;
}
:root[data-theme="light"] .input.select option:checked,
:root[data-theme="light"] select option:checked {
  background-color: #dce9f7;
  color: #151a21;
}
.input.ta { resize: none; min-height: 56px; max-height: 40vh; overflow: auto; line-height: 1.55; }
.searchwrap { position: relative; flex: 1 1 320px; min-width: 220px; }

.panel {
  background: var(--glass); background-image: var(--sheen);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--hair); border-radius: var(--radius-lg);
  padding: 18px; box-shadow: var(--drop), var(--edge); margin-bottom: 18px;
}
.panel.is-flush { padding: 6px 18px; }
.panel-note { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.66; }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field.is-row { flex-direction: row; align-items: center; justify-content: space-between; gap: 18px; }
.field.is-row > div { display: flex; flex-direction: column; gap: 3px; }
.field > label { font-size: 13.5px; font-weight: 500; }
.hint { font-size: 12.5px; color: var(--faint); }
.reveal { display: flex; gap: 8px; align-items: center; }
.reveal .input { flex: 1 1 auto; }

/* ── buttons ───────────────────────────────────────────────── */
button { font-family: inherit; }
.primary {
  cursor: pointer; padding: 11px 20px; border: 1px solid rgba(150, 180, 214, .4); border-radius: var(--radius);
  background: linear-gradient(160deg, #86a8d0, var(--accent) 70%);
  color: #fff; font: 600 14px var(--sans); letter-spacing: -.1px;
  box-shadow: 0 14px 30px -16px rgba(124, 157, 198, .95), inset 0 1px 0 rgba(255, 255, 255, .28);
  transition: transform .22s var(--spring), box-shadow .22s var(--ease), filter .2s var(--ease);
}
.primary:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 18px 34px -16px rgba(124, 157, 198, 1), inset 0 1px 0 rgba(255, 255, 255, .32); }
.primary:active { transform: translateY(0) scale(.985); }
.ghostbtn {
  cursor: pointer; padding: 10px 15px; border-radius: var(--radius); display: flex; align-items: center; gap: 9px;
  background: rgba(255, 255, 255, .055); border: 1px solid var(--hair); color: var(--muted);
  font: 500 13.5px var(--sans); box-shadow: var(--edge);
  transition: color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease), transform .22s var(--spring);
}
.ghostbtn:hover { color: var(--ink); border-color: rgba(150, 180, 214, .5); background: rgba(255, 255, 255, .085); transform: translateY(-1px); }
.ghostbtn:active { transform: translateY(0) scale(.985); }
.ghostbtn.is-danger { border-color: rgba(212, 115, 92, .34); color: #eaa89b; background: rgba(212, 115, 92, .07); align-self: flex-start; }
.ghostbtn.is-danger:hover { border-color: var(--bad); color: #f7bdb0; background: rgba(212, 115, 92, .12); }
.textbtn {
  cursor: pointer; padding: 7px 10px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); font: 500 13px var(--sans);
  transition: color .18s var(--ease), background .18s var(--ease);
}
.textbtn:hover { color: var(--ink); background: rgba(255, 255, 255, .08); }

.quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 8px; }
.qbtn {
  cursor: pointer; padding: 9px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--hair-soft); color: var(--muted);
  font: 500 13px var(--sans); box-shadow: var(--edge);
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), transform .22s var(--spring);
}
.qbtn:hover:not(:disabled) { color: var(--ink); border-color: rgba(150, 180, 214, .45); background: rgba(255, 255, 255, .09); transform: translateY(-1px); }
.qbtn:active:not(:disabled) { transform: translateY(0) scale(.97); }
.qbtn:disabled { opacity: .38; cursor: not-allowed; }
.qbtn.is-strong { color: #fff; border-color: rgba(150, 180, 214, .5); background: var(--accent-soft); }

.sendbtn {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; cursor: pointer;
  border: 1px solid rgba(150, 180, 214, .38); border-radius: 50%;
  background: linear-gradient(160deg, #86a8d0, var(--accent) 72%); color: #fff;
  box-shadow: 0 14px 28px -14px rgba(124, 157, 198, 1), inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: filter .2s var(--ease), transform .24s var(--spring), box-shadow .2s var(--ease);
}
.sendbtn:hover:not(:disabled) { filter: brightness(1.1); transform: scale(1.06); }
.sendbtn:active:not(:disabled) { transform: scale(.94); }
.sendbtn:disabled { background: rgba(255, 255, 255, .06); border-color: var(--hair-soft); color: var(--faint); box-shadow: none; cursor: default; }

/* ── playground ───────────────────────────────────────────── */
.chat-panel { display: flex; flex-direction: column; gap: 13px; }
.chat-head { display: flex; align-items: center; gap: 10px; }
.chat-head strong { font-size: 15.5px; font-weight: 600; letter-spacing: -.2px; }
.spark {
  width: 32px; height: 32px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: linear-gradient(160deg, rgba(124, 157, 198, .3), rgba(124, 157, 198, .1));
  color: #a9c6e6; border: 1px solid rgba(150, 180, 214, .32); box-shadow: var(--edge);
}

.starters { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 9px; margin-top: 14px; }
.starter {
  cursor: pointer; text-align: left; padding: 13px 15px; border-radius: var(--radius);
  background: rgba(255, 255, 255, .035); border: 1px dashed var(--hair);
  color: var(--muted); font: 500 13px var(--sans); box-shadow: var(--edge);
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), transform .24s var(--spring);
}
.starter:hover { color: var(--ink); border-color: rgba(150, 180, 214, .55); border-style: solid; background: var(--accent-soft); transform: translateY(-2px); }
.starter:active { transform: translateY(0) scale(.985); }

.log { display: flex; flex-direction: column; gap: 18px; }
.msg { display: flex; gap: 12px; max-width: 94%; }
/* renderLog() rebuilds the whole log on every send, so only the newest message
   may animate — otherwise the entire history replays its entrance each turn. */
.msg:last-child { animation: msgIn .42s var(--ease) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.msg.is-user { margin-left: auto; flex-direction: row-reverse; }
.msg.is-note { max-width: 100%; }
.ava {
  width: 32px; height: 32px; flex: none; border-radius: 11px; display: grid; place-items: center; margin-top: 2px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .03));
  color: var(--accent-hi); border: 1px solid var(--hair); box-shadow: var(--edge);
  font: 600 10.5px var(--mono); letter-spacing: .5px;
}
.msg-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.role { font: 500 10px/1 var(--sans); letter-spacing: 1px; text-transform: uppercase; color: var(--faint); }
.msg.is-user .role { text-align: right; }
.bubble {
  padding: 14px 16px; border-radius: 6px 20px 20px 20px;
  background: rgba(255, 255, 255, .055); border: 1px solid var(--hair-soft);
  box-shadow: var(--edge); white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.is-user .bubble {
  background: linear-gradient(150deg, rgba(124, 157, 198, .26), rgba(124, 157, 198, .13));
  border-color: rgba(150, 180, 214, .34); border-radius: 20px 6px 20px 20px;
}
.msg.is-user { align-items: flex-start; }
.bubble em { color: var(--muted); font-style: italic; }
.bubble.is-note { background: rgba(212, 115, 92, .1); border-color: rgba(212, 115, 92, .3); color: #f0b5a8; font-size: 13.5px; border-radius: 18px; }
.bubble.is-note .retrylink { color: #f7c4b8; text-decoration: underline; cursor: pointer; background: none; border: 0; font: inherit; padding: 0; }
.meta { display: flex; gap: 10px; font: 400 11px/1 var(--mono); color: var(--faint); }
.msg.is-user .meta { justify-content: flex-end; }
.msg-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .2s var(--ease); }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; }
.msg-actions button { font-size: 11.5px; padding: 4px 8px; }

.cb { border: 1px solid var(--hair-soft); border-radius: 14px; overflow: hidden; margin: 10px 0; background: rgba(8, 10, 13, .66); box-shadow: var(--drop-sm); }
.cb-head { display: flex; align-items: center; gap: 8px; padding: 7px 12px; background: rgba(255, 255, 255, .05); border-bottom: 1px solid var(--hair-soft); }
.cb-lang { font: 500 10px/1 var(--mono); letter-spacing: .7px; text-transform: uppercase; color: var(--faint); }
.cb-copy { margin-left: auto; }
.cb pre { margin: 0; padding: 13px; overflow: auto; font: 12.5px/1.65 var(--mono); color: #d8dde3; white-space: pre; }

.caret { display: inline-block; width: 3px; height: 16px; margin-left: 3px; vertical-align: -3px; border-radius: 2px; background: var(--accent-hi); animation: blink 1.1s var(--ease) infinite; }
@keyframes blink { 50% { opacity: .15; } }

.dots { display: inline-flex; gap: 5px; align-items: center; height: 20px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-hi); animation: bounce 1.3s var(--ease) infinite; }
.dots i:nth-child(2) { animation-delay: .16s; }
.dots i:nth-child(3) { animation-delay: .32s; }
@keyframes bounce { 0%, 62%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-5px); } }

.think { font-size: 12.5px; color: var(--faint); border-left: 2px solid var(--hair); padding-left: 11px; max-height: 130px; overflow: auto; }
.empty { color: var(--faint); font-size: 13.5px; margin: 6px 0; }
.empty.pad { padding: 20px 10px; }

.composer { display: flex; gap: 11px; align-items: flex-end; margin-top: 4px; }
.composer .input { flex: 1 1 auto; }
.composer-bar { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.counter { font-size: 11.5px; color: var(--faint); min-width: 34px; text-align: right; white-space: nowrap; }
.fineprint { font-size: 12.5px; color: var(--faint); margin: 7px 0; max-width: 80ch; line-height: 1.6; }
.statusline { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--faint); margin-top: 14px; }
.kbd-hint { font-family: var(--mono); font-size: 11px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.convowrap { position: relative; display: inline-flex; }
.convo {
  cursor: pointer; padding: 9px 32px 9px 14px; border-radius: 999px; max-width: 280px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--hair-soft); color: var(--muted);
  font: 500 13px var(--sans); box-shadow: var(--edge);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease), transform .22s var(--spring);
}
.convo:hover { border-color: rgba(150, 180, 214, .5); color: var(--ink); transform: translateY(-1px); }
.convo.is-on { background: var(--accent-soft); border-color: rgba(150, 180, 214, .55); color: #fff; }
.convo-del {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 21px; height: 21px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: transparent; color: var(--faint); cursor: pointer; font-size: 15px; line-height: 1; padding: 0;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.convo-del:hover { background: rgba(212, 115, 92, .2); color: #f0b5a8; }

/* ── grids, tables, code ───────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.mcard {
  background: linear-gradient(165deg, rgba(255, 255, 255, .075), rgba(255, 255, 255, .02) 46%, rgba(255, 255, 255, .035));
  border: 1px solid var(--hair); border-radius: var(--radius-lg); padding: 20px;
  display: flex; flex-direction: column; gap: 12px; box-shadow: var(--drop), var(--edge);
  transition: transform .26s var(--spring), border-color .2s var(--ease);
}
.mcard:hover { transform: translateY(-3px); border-color: rgba(150, 180, 214, .34); }
.mcard.is-active { border-color: rgba(124, 157, 198, .55); }
.mcard-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.mcard-select { padding: 4px 10px; font-size: 12px; }
.mcard h4 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.4px; }
.mcard .tagrow { display: flex; flex-wrap: wrap; gap: 7px; }
.mcard dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.mcard dt { color: var(--faint); }
.mcard dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; padding: 11px 10px; color: var(--faint); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; border-bottom: 1px solid var(--hair-soft); }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--hair-soft); color: var(--muted); }
.tbl tbody tr { transition: background .18s var(--ease); }
.tbl tbody tr:hover { background: rgba(255, 255, 255, .045); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td:first-child { color: var(--ink); }
.st-ok { color: var(--ok); }
.st-bad { color: #e8a091; }
.st-wait { color: var(--faint); }
.tag { font-size: 11.5px; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .06); border: 1px solid var(--hair-soft); color: var(--muted); }

.tabs { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  cursor: pointer; padding: 8px 13px; border-radius: 999px; border: 1px solid transparent;
  background: transparent; color: var(--muted); font: 500 13px var(--mono);
  transition: color .18s var(--ease), background .18s var(--ease), border-color .18s var(--ease);
}
.tab:hover { color: var(--ink); background: rgba(255, 255, 255, .06); }
.tab.is-on { background: rgba(255, 255, 255, .08); border-color: var(--hair); color: #fff; box-shadow: var(--edge); }
.code {
  margin: 0; padding: 16px; border-radius: var(--radius); overflow: auto;
  background: rgba(8, 10, 13, .66); border: 1px solid var(--hair-soft); box-shadow: var(--drop-sm);
  font: 13px/1.68 var(--mono); color: #d8dde3; white-space: pre;
}
.bullets { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13.5px; display: grid; gap: 8px; line-height: 1.66; }

.balance { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.big { font-size: 36px; letter-spacing: -.9px; font-weight: 600; line-height: 1.15; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 13px; }
.stat { background: rgba(255, 255, 255, .045); border: 1px solid var(--hair-soft); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 5px; box-shadow: var(--edge); transition: border-color .2s var(--ease), transform .22s var(--spring); }
.stat:hover { border-color: var(--hair); transform: translateY(-2px); }
.stat .mono { font-size: 19px; font-weight: 600; letter-spacing: -.3px; }
.rule { border: 0; border-top: 1px solid var(--hair-soft); margin: 16px 0; }

/* ── sheet, scrim, toast ───────────────────────────────────── */
.sheet { position: fixed; inset: 0 0 0 auto; z-index: 30; padding: 18px; display: flex; }
.sheet-inner {
  width: 412px; max-width: 100%; overflow: auto; margin-bottom: 0;
  background: rgba(20, 24, 29, .78);
  backdrop-filter: blur(34px) saturate(180%); -webkit-backdrop-filter: blur(34px) saturate(180%);
  border: 1px solid var(--hair); border-radius: var(--radius-lg);
  box-shadow: var(--drop), var(--edge); padding: 18px;
  animation: slide .42s var(--spring) both;
}
@keyframes slide { from { transform: translateX(28px) scale(.97); opacity: 0; filter: blur(6px); } to { transform: none; opacity: 1; filter: none; } }
.scrim {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(6, 8, 11, .58);
  backdrop-filter: blur(10px) saturate(120%); -webkit-backdrop-filter: blur(10px) saturate(120%);
  animation: fadein .26s var(--ease) both;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.toast {
  position: fixed; z-index: 40; left: 50%; bottom: 28px;
  transform: translateX(-50%) translateY(14px) scale(.96);
  margin: 0; padding: 11px 18px; border-radius: 999px; max-width: 88vw;
  background: rgba(30, 35, 42, .8);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--hair); color: var(--ink); font-size: 13.5px;
  box-shadow: var(--drop), var(--edge); opacity: 0;
  transition: opacity .26s var(--ease), transform .34s var(--spring);
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }

.range { width: 100%; accent-color: var(--accent-hi); height: 6px; }
.scale { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--faint); }
.check { width: 19px; height: 19px; accent-color: var(--accent-hi); cursor: pointer; }

/* ── fallback when backdrop blur is unavailable ───────────── */
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
  .side, .topbar { background: rgba(14, 17, 21, .96); }
  .panel, .sheet-inner, .toast { background: rgba(24, 28, 34, .97); }
  .input, .chip, .pill, .selectlike { background: rgba(18, 22, 27, .96); }
}

/* ── responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .side { position: fixed; z-index: 25; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .34s var(--spring); height: 100dvh; box-shadow: 34px 0 68px -32px rgba(0, 0, 0, .92); background: rgba(14, 17, 21, .92); }
  body.side-open .side { transform: none; }
  .scroll { padding: 17px; }
  .topbar { padding: 12px 15px; gap: 10px; }
  .msg { max-width: 100%; }
  .sec-title { font-size: 23px; }
}
@media (min-width: 901px) {
  #toggle-side { display: none; }
}
@media (max-width: 640px) {
  .grid, .stats { grid-template-columns: 1fr; }
  .quick { gap: 6px; }
  .qbtn { flex: 1 1 auto; text-align: center; }
  .sheet { padding: 0; }
  .sheet-inner { width: 100%; border-radius: 0; height: 100%; }
  .starters { grid-template-columns: 1fr; }
  .counter { display: none; }
  .chip { display: none; }
  .blob.b3 { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .blob { animation: none !important; }
  .brand-mark::after { display: none; }
}

/* ═══ REDESIGN v2 — additive layer. Delete from here to the end to revert. ═══ */

/* type + rhythm */
body { font-size: 15px; line-height: 1.6; letter-spacing: -.005em; }
.scroll { padding: 28px 32px 40px; max-width: 1080px; }
.sec-title { font-size: 28px; letter-spacing: -.8px; }
.sec-note { color: var(--muted); font-size: 14px; }
.panel { padding: 22px; border-radius: 24px; }

/* sidebar: clearer active marker */
.navlink { position: relative; padding: 11px 14px; }
.navlink.is-current::before {
  content: ""; position: absolute; left: -15px; top: 20%; bottom: 20%; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent-hi);
  box-shadow: 0 0 14px rgba(124, 157, 198, .8);
}
.navlink:hover { transform: none; }
.navlink:focus-visible { box-shadow: var(--ring); }
.badge { letter-spacing: .6px; }

/* topbar */
.topbar { padding: 12px 32px; }
.page-title { font-size: 16px; color: var(--ink); }

/* playground: sticky composer so it stays reachable in long chats */
.composer {
  position: sticky; bottom: 14px; z-index: 4; padding: 10px;
  background: rgba(18, 21, 26, .78);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--hair); border-radius: 26px;
  box-shadow: var(--drop), var(--edge);
}
.composer .input { background: transparent; border-color: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.composer .input:focus { box-shadow: none; border-color: transparent; background: rgba(255, 255, 255, .03); }
.composer:focus-within { border-color: rgba(150, 180, 214, .5); box-shadow: var(--drop), var(--ring); }

/* messages */
.bubble { line-height: 1.68; }
.msg { gap: 14px; }
.starter { min-height: 64px; display: flex; align-items: center; }

/* cards + stats: calmer hover */
.mcard:hover, .stat:hover { transform: translateY(-2px); }

/* tables: sticky header inside scrolling panels */
.tbl th { position: sticky; top: 0; }
.tbl td, .tbl th { padding: 12px 12px; }

/* mobile */
@media (max-width: 900px) {
  .scroll { padding: 18px 16px 28px; }
  .topbar { padding: 12px 16px; }
  .composer { bottom: 8px; border-radius: 22px; }
  .navlink.is-current::before { left: -8px; }
}
/* ═══ END REDESIGN v2 ═══ */

/* ═══ REDESIGN v3 — additive layer. Delete from here to END REDESIGN v3 to revert. ═══ */

/* messages: clearer hierarchy, softer tails, readable measure */
.log { gap: 22px; }
.msg { max-width: min(92%, 78ch); }
.msg.is-user { max-width: min(86%, 64ch); }
.bubble { padding: 15px 18px; border-radius: 8px 22px 22px 22px; background: rgba(255,255,255,.05); }
.msg.is-user .bubble { border-radius: 22px 8px 22px 22px; }
.role { font-size: 10.5px; letter-spacing: 1.1px; }
.ava { border-radius: 12px; background: linear-gradient(160deg, rgba(124,157,198,.28), rgba(124,157,198,.08)); border-color: rgba(150,180,214,.3); }
.meta { opacity: .85; }
.msg-actions { opacity: .0; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; }
.think { background: rgba(255,255,255,.03); border-radius: 0 10px 10px 0; padding: 8px 12px; }

/* code blocks */
.cb { border-radius: 16px; border-color: var(--hair); }
.cb-head { padding: 8px 14px; }
.cb pre { padding: 14px 16px; font-size: 12.8px; tab-size: 2; }

/* chat header + conversation chips */
.chat-head { padding-bottom: 12px; border-bottom: 1px solid var(--hair-soft); }
.convo { padding: 9px 34px 9px 15px; }
.convo.is-on { box-shadow: var(--edge), 0 8px 20px -14px rgba(124,157,198,.9); }
.convo-del { opacity: 0; transition: opacity .18s var(--ease), background .18s var(--ease), color .18s var(--ease); }
.convowrap:hover .convo-del, .convo-del:focus-visible, .convo.is-on + .convo-del { opacity: 1; }

/* quick actions: quieter, grouped */
.quick { padding-top: 6px; }
.qbtn { padding: 8px 14px; }
.statusline { padding-top: 10px; border-top: 1px solid var(--hair-soft); }

/* models page */
.mcard { padding: 24px; gap: 14px; background-image: linear-gradient(165deg, rgba(124,157,198,.10), rgba(255,255,255,.02) 50%); }
.mcard h4 { font-size: 21px; }
.mcard dl { padding: 14px 0; border-top: 1px solid var(--hair-soft); border-bottom: 1px solid var(--hair-soft); row-gap: 9px; }
.tag { font-weight: 500; }

/* activity table + billing stats */
.tbl tbody tr:nth-child(even) { background: rgba(255,255,255,.018); }
.tbl tbody tr:hover { background: rgba(255,255,255,.06); }
.stat { padding: 16px; }
.stat .label { margin-bottom: 2px; }
.big { font-size: 40px; background: linear-gradient(180deg, #fff, #a9c6e6); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* docs + keys */
.tabs { padding: 4px; background: rgba(255,255,255,.04); border-radius: 12px; width: fit-content; max-width: 100%; }
.tabs .spacer { min-width: 14px; }
.code { font-size: 13px; line-height: 1.7; }
.hint { line-height: 1.5; }
.field > label { color: var(--ink); }

/* settings sheet */
.sheet-inner { padding: 22px; gap: 4px; }
.sheet-inner .field { padding: 14px 0; border-bottom: 1px solid var(--hair-soft); margin-bottom: 0; }
.sheet-inner .field:last-of-type { border-bottom: 0; }

/* status pills + toast */
.pill { transition: border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease); }
.toast { padding: 12px 20px; }

/* selection + focus polish for keyboard users */
.navlink:focus-visible, .qbtn:focus-visible, .convo:focus-visible, .tab:focus-visible,
.starter:focus-visible, .textbtn:focus-visible, .ghostbtn:focus-visible, .primary:focus-visible { box-shadow: var(--ring); }

/* mobile */
@media (max-width: 640px) {
  .msg, .msg.is-user { max-width: 100%; }
  .bubble { padding: 13px 15px; }
  .big { font-size: 34px; }
  .tabs { width: 100%; overflow-x: auto; }
  .mcard { padding: 18px; }
  .convo-del { opacity: 1; }
}
@media (hover: none) { .msg-actions, .convo-del { opacity: 1; } }
/* ═══ END REDESIGN v3 ═══ */

/* ═══ REDESIGN v4 — light theme, collapsible sidebar, markdown. Delete to END REDESIGN v4 to revert. ═══ */

/* light theme: overrides the same tokens, so every component follows */
:root[data-theme="light"] {
  --bg: #eef1f5; --ink: #151a21; --muted: #424b57; --faint: #5d6672;
  --accent: #3f6a99; --accent-hi: #2f5f93; --accent-soft: rgba(63,106,153,.14);
  --ok: #1f8a4c; --warn: #9a7406; --bad: #b4452f;
  --hair: rgba(15,23,35,.14); --hair-soft: rgba(15,23,35,.08);
  --glass: rgba(255,255,255,.72); --glass-2: rgba(255,255,255,.62); --glass-hi: rgba(255,255,255,.86);
  --sheen: linear-gradient(165deg, rgba(255,255,255,.7), rgba(255,255,255,.2) 45%, rgba(255,255,255,.35));
  --edge: inset 0 1px 0 rgba(255,255,255,.9);
  --drop: 0 24px 48px -30px rgba(30,45,70,.35), 0 2px 8px -4px rgba(30,45,70,.18);
  --drop-sm: 0 10px 24px -16px rgba(30,45,70,.3);
  --ring: 0 0 0 3px rgba(63,106,153,.32);
}
:root[data-theme="light"] body::after { opacity: .25; }
:root[data-theme="light"] .blob.b1 { background: radial-gradient(circle, rgba(120,160,215,.32), transparent 66%); }
:root[data-theme="light"] .blob.b2 { background: radial-gradient(circle, rgba(120,200,160,.22), transparent 66%); }
:root[data-theme="light"] .blob.b3 { background: radial-gradient(circle, rgba(170,150,220,.2), transparent 66%); }
:root[data-theme="light"] .side { background: rgba(255,255,255,.7); }
:root[data-theme="light"] .topbar { background: rgba(238,241,245,.72); }
:root[data-theme="light"] .input { background: rgba(255,255,255,.78); }
:root[data-theme="light"] .input:hover, :root[data-theme="light"] .input:focus { background: #fff; }
:root[data-theme="light"] .composer { background: rgba(255,255,255,.85); }
:root[data-theme="light"] .composer .input { background: transparent; }
:root[data-theme="light"] .sheet-inner, :root[data-theme="light"] .toast { background: rgba(255,255,255,.92); }
:root[data-theme="light"] .scrim { background: rgba(30,40,55,.35); }
:root[data-theme="light"] .navlink.is-current { color: var(--ink); background: linear-gradient(100deg, rgba(63,106,153,.2), rgba(63,106,153,.05)); }
:root[data-theme="light"] .navlink:hover, :root[data-theme="light"] .qbtn, :root[data-theme="light"] .ghostbtn,
:root[data-theme="light"] .bubble, :root[data-theme="light"] .starter, :root[data-theme="light"] .convo,
:root[data-theme="light"] .stat, :root[data-theme="light"] .tag { background: rgba(255,255,255,.6); }
:root[data-theme="light"] .msg.is-user .bubble { background: linear-gradient(150deg, rgba(63,106,153,.2), rgba(63,106,153,.1)); }
:root[data-theme="light"] .chip, :root[data-theme="light"] .selectlike { color: var(--ink); }
:root[data-theme="light"] .cb, :root[data-theme="light"] .code { background: #f6f8fb; color: #26303c; }
:root[data-theme="light"] .cb pre { color: #26303c; }
:root[data-theme="light"] .cb-head { background: rgba(15,23,35,.04); }
:root[data-theme="light"] code { background: rgba(15,23,35,.07); color: #26303c; }
:root[data-theme="light"] .primary, :root[data-theme="light"] .sendbtn { color: #fff; }
:root[data-theme="light"] .brand-mark { color: #fff; }
:root[data-theme="light"] .tbl tbody tr:nth-child(even) { background: rgba(15,23,35,.03); }
:root[data-theme="light"] .big { background: linear-gradient(180deg, #1b2735, #3f6a99); -webkit-background-clip: text; background-clip: text; }
:root[data-theme="light"] .st-bad { color: var(--bad); }
:root[data-theme="light"] ::selection { color: #fff; }
#toggle-theme .ico { width: 18px; height: 18px; }
:root[data-theme="light"] #toggle-theme .ico { fill: currentColor; fill-opacity: .15; }

/* collapsible sidebar (desktop) */
@media (min-width: 901px) {
  #toggle-side { display: grid; }
  .side { transition: width .3s var(--ease), padding .3s var(--ease); }
  body.side-collapsed .side { width: 76px; padding-left: 12px; padding-right: 12px; }
  body.side-collapsed .brand-text, body.side-collapsed .navlink span,
  body.side-collapsed .navlink .badge, body.side-collapsed .balcard,
  body.side-collapsed #open-settings { font-size: 0; }
  body.side-collapsed .brand-text, body.side-collapsed .navlink span,
  body.side-collapsed .navlink .badge, body.side-collapsed .balcard { display: none; }
  body.side-collapsed .navlink { justify-content: center; padding: 12px; }
  body.side-collapsed .navlink.is-current::before { left: -12px; }
  body.side-collapsed #open-settings { justify-content: center; }
}

/* richer markdown inside bubbles */
.bubble { white-space: normal; }
.bubble .md-p { margin: 0 0 .7em; white-space: pre-wrap; }
.bubble .md-p:last-child, .bubble > :last-child { margin-bottom: 0; }
.bubble h1, .bubble h2, .bubble h3, .bubble h4 { margin: .9em 0 .4em; line-height: 1.3; letter-spacing: -.2px; }
.bubble h1 { font-size: 1.3em; } .bubble h2 { font-size: 1.18em; } .bubble h3 { font-size: 1.08em; } .bubble h4 { font-size: 1em; color: var(--muted); }
.bubble ul, .bubble ol { margin: .4em 0 .8em; padding-left: 1.4em; display: grid; gap: .3em; }
.bubble blockquote { margin: .6em 0; padding: .3em 0 .3em 14px; border-left: 3px solid var(--accent-hi); color: var(--muted); }
.bubble hr { border: 0; border-top: 1px solid var(--hair); margin: 1em 0; }
.bubble a { color: var(--accent-hi); text-decoration: underline; text-underline-offset: 3px; }
.bubble a:hover { filter: brightness(1.2); }

/* Discord Auth & Credit System */
.auth-widget { display: flex; align-items: center; gap: 8px; }
.discord-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px;
  background: #5865F2; color: #fff; font-weight: 500; font-size: 13px;
  border-radius: 999px; text-decoration: none; transition: background .18s var(--ease), transform .12s var(--ease);
}
.discord-btn:hover { background: #4752c4; text-decoration: none; color: #fff; }
.discord-ico { fill: currentColor; }

.user-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--hair);
  border-radius: 999px; font-size: 13px;
}
.user-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.user-name { font-weight: 500; color: var(--ink); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.credit-pill {
  font-family: var(--mono); font-size: 11.5px; padding: 2px 8px;
  background: rgba(94, 234, 212, .12); border: 1px solid rgba(94, 234, 212, .3);
  color: #5eead4; border-radius: 999px;
}
.logout-btn {
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  font-size: 12px; padding: 2px 6px; border-radius: 4px;
}
.logout-btn:hover { color: #e8a091; background: rgba(232, 160, 145, .1); }

.account-card { display: flex; align-items: center; gap: 14px; }
.big-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid var(--hair); }
.promo-row { margin-top: 14px; gap: 10px; display: flex; align-items: center; flex-wrap: wrap; }
.promo-row .input { flex: 1 1 180px; width: auto; min-width: 140px; }
.keybox { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.keybox .input { flex: 1; }
/* ═══ END REDESIGN v4 ═══ */

/* ── admin portal ─────────────────────────────────────────── */
.badge.is-live { color: var(--ok); border-color: rgba(111, 192, 143, .35); background: rgba(111, 192, 143, .10); }
#nav-admin.is-live { color: var(--ok); }
.admin-stats { margin-bottom: 4px; }
.admin-chart-wrap { margin-top: 14px; padding-top: 4px; }
.admin-chart-wrap canvas { width: 100%; display: block; }
.admin-chart-legend {
  display: flex; align-items: center; gap: 14px; padding: 0 2px 6px;
  font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .7px;
}
.admin-chart-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.admin-chart-legend .lg::before { content: ""; width: 10px; height: 3px; border-radius: 2px; background: currentColor; }
.admin-chart-legend .p50 { color: var(--ok); }
.admin-chart-legend .p95 { color: var(--warn); }
.admin-chart-legend .p99, .admin-chart-legend .err { color: var(--bad); }
.admin-chart-legend .req, .admin-chart-legend .tok { color: var(--accent-hi); }
.admin-chart-title { text-transform: none; letter-spacing: 0; color: var(--muted); }
.admin-scroll { max-height: 380px; overflow: auto; border-radius: var(--radius-sm); border: 1px solid var(--hair-soft); }
.admin-scroll .tbl { min-width: 760px; }
.admin-scroll .tbl th { background: rgba(18, 21, 26, .9); backdrop-filter: var(--blur-sm); }
:root[data-theme="light"] .admin-scroll .tbl th { background: rgba(255, 255, 255, .94); }
.admin-dim { color: var(--faint); font-size: 11px; }
.admin-key { color: var(--muted); padding: 0; }
.admin-key:hover { color: var(--accent-hi); }
.admin-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.admin-actions .qbtn { padding: 4px 8px; font-size: 11px; }
.qbtn.is-danger { color: #eaa89b; border-color: rgba(212, 115, 92, .34); background: rgba(212, 115, 92, .07); }
.qbtn.is-danger:hover { border-color: var(--bad); color: #f7bdb0; }
.admin-err { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--bad); font-size: 11px; }
.admin-promo-form { flex-wrap: wrap; align-items: center; }
.admin-promo-form .input { max-width: 140px; }
#admin-user-search { max-width: 260px; }
#admin-gate .hint code { font-size: 11px; }
@media (max-width: 640px) {
  #admin-user-search { max-width: none; width: 100%; }
  .admin-promo-form .input { max-width: none; flex: 1 1 120px; }
}

/* ═══ APPLE GLASS v5 — translucent depth, specular edges, saturated blur ═══ */
:root {
  --glass-strong: rgba(20, 24, 30, .48);
  --glass-clear: rgba(255, 255, 255, .08);
  --blur-glass: blur(42px) saturate(190%) brightness(1.06);
  --drop-glass: 0 34px 80px -38px rgba(0, 0, 0, .92), 0 10px 28px -18px rgba(0, 0, 0, .62);
  --edge-glass: inset 0 1px 0 rgba(255, 255, 255, .2), inset 0 -1px 0 rgba(0, 0, 0, .34);
  --specular: linear-gradient(135deg, rgba(255, 255, 255, .18) 0%, rgba(255, 255, 255, .035) 26%, transparent 52%, rgba(255, 255, 255, .06) 100%);
}

.side, .topbar, .panel, .composer, .input, .qbtn, .ghostbtn, .primary, .sendbtn,
.chip, .pill, .selectlike, .user-badge, .stat, .bubble {
  -webkit-backdrop-filter: var(--blur-glass);
  backdrop-filter: var(--blur-glass);
}

.panel {
  position: relative; isolation: isolate;
  background:
    radial-gradient(130% 170% at 12% -22%, rgba(255, 255, 255, .13), transparent 44%),
    linear-gradient(155deg, rgba(42, 49, 60, .5), rgba(15, 18, 23, .4) 48%, rgba(26, 31, 39, .46));
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 26px;
  box-shadow: var(--drop-glass), var(--edge-glass);
}
.panel::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  border-radius: inherit; background: var(--specular);
}

.side {
  background: linear-gradient(180deg, rgba(30, 36, 44, .58), rgba(13, 16, 20, .46));
  border-right: 1px solid rgba(255, 255, 255, .12);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, .05), 22px 0 70px -46px rgba(0, 0, 0, .95);
}
.topbar {
  background: linear-gradient(180deg, rgba(25, 30, 37, .64), rgba(13, 16, 20, .46));
  border-bottom: 1px solid rgba(255, 255, 255, .11);
  box-shadow: 0 18px 48px -36px rgba(0, 0, 0, .95), inset 0 1px 0 rgba(255, 255, 255, .12);
}

.input {
  background: rgba(255, 255, 255, .055);
  border-color: rgba(255, 255, 255, .14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .13), inset 0 -1px 0 rgba(0, 0, 0, .24), 0 8px 20px -16px rgba(0, 0, 0, .7);
}
.input:hover { background: rgba(255, 255, 255, .075); border-color: rgba(255, 255, 255, .2); }
.input:focus {
  background: rgba(255, 255, 255, .09);
  border-color: rgba(172, 202, 238, .6);
  box-shadow: 0 0 0 3px rgba(124, 157, 198, .24), inset 0 1px 0 rgba(255, 255, 255, .24), 0 12px 30px -20px rgba(0, 0, 0, .8);
}

.qbtn, .ghostbtn, .chip, .pill, .selectlike, .user-badge {
  background: linear-gradient(160deg, rgba(255, 255, 255, .125), rgba(255, 255, 255, .035));
  border-color: rgba(255, 255, 255, .16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .21), inset 0 -1px 0 rgba(0, 0, 0, .26), 0 12px 28px -22px rgba(0, 0, 0, .85);
}
.qbtn:hover:not(:disabled), .ghostbtn:hover {
  background: linear-gradient(160deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .06));
  border-color: rgba(178, 205, 236, .46);
}
.primary, .sendbtn {
  background: linear-gradient(160deg, #a9c4e6 0%, #7396bd 30%, #526f91 76%);
  border-color: rgba(255, 255, 255, .34);
  box-shadow: 0 20px 44px -18px rgba(92, 132, 178, .9), inset 0 1px 0 rgba(255, 255, 255, .52), inset 0 -1px 0 rgba(0, 0, 0, .28);
}

.composer {
  background:
    radial-gradient(120% 180% at 20% -40%, rgba(255, 255, 255, .12), transparent 48%),
    linear-gradient(150deg, rgba(255, 255, 255, .075), rgba(20, 24, 30, .58) 42%, rgba(14, 17, 21, .5));
  border-color: rgba(255, 255, 255, .17);
  border-radius: 28px;
  box-shadow: var(--drop-glass), var(--edge-glass);
}
.composer:focus-within { border-color: rgba(178, 205, 236, .5); box-shadow: var(--drop-glass), 0 0 0 3px rgba(124, 157, 198, .22); }

.stat {
  background: linear-gradient(155deg, rgba(255, 255, 255, .095), rgba(255, 255, 255, .025));
  border-color: rgba(255, 255, 255, .13);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .17), inset 0 -1px 0 rgba(0, 0, 0, .24), 0 18px 40px -30px rgba(0, 0, 0, .9);
}

.bubble {
  background: linear-gradient(155deg, rgba(255, 255, 255, .105), rgba(255, 255, 255, .035));
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 16px 38px -28px rgba(0, 0, 0, .85);
}
.msg.is-user .bubble {
  background: linear-gradient(155deg, rgba(138, 171, 211, .3), rgba(82, 111, 145, .15));
  border-color: rgba(172, 202, 238, .3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .27), 0 16px 38px -24px rgba(52, 84, 124, .9);
}
.navlink.is-current {
  background: linear-gradient(100deg, rgba(255, 255, 255, .16), rgba(124, 157, 198, .1));
  border-color: rgba(255, 255, 255, .14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 14px 32px -26px rgba(0, 0, 0, .9);
}

#invite-panel, #daily-panel {
  background:
    radial-gradient(130% 160% at 100% -10%, rgba(124, 157, 198, .24), transparent 46%),
    linear-gradient(155deg, rgba(42, 49, 60, .52), rgba(15, 18, 23, .4) 50%, rgba(26, 31, 39, .46));
}
#invite-panel .invite-head, #daily-panel .daily-head { margin-top: 0; }
#invite-panel .invite-stats { margin-top: 16px; }
#invite-panel .invite-box .input { font-size: 13px; }
#invite-badge, #daily-badge {
  color: var(--accent-hi); border-color: rgba(124, 157, 198, .42);
  background: rgba(124, 157, 198, .13); font-family: var(--mono); font-size: 11.5px;
}

/* daily bonus: two-step layout */
#daily-panel .daily-head {
  margin: 0 0 16px;
  align-items: flex-start;
  gap: 16px;
}
#daily-panel .daily-head-copy { min-width: 0; }
#daily-panel .daily-head .sec-note {
  margin: 6px 0 0;
  max-width: 68ch;
  font-size: 12.5px;
  line-height: 1.55;
}
#daily-panel .daily-grid {
  display: grid;
  grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
  gap: 12px;
}
#daily-panel .daily-step {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--hair-soft);
  border-radius: 16px;
  background: rgba(255, 255, 255, .035);
}
#daily-panel .daily-step-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font: 600 10.5px/1 var(--sans);
  letter-spacing: .8px;
  text-transform: uppercase;
}
#daily-panel .daily-step-num {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  border: 1px solid var(--hair);
  border-radius: 50%;
  color: var(--accent-hi);
  background: rgba(124, 157, 198, .1);
  font: 600 10.5px/1 var(--mono);
  letter-spacing: 0;
}
#daily-panel .daily-open-btn { flex: none; }
#daily-panel .daily-status {
  margin: 0;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.5;
}
#daily-panel .daily-token-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
#daily-panel .daily-token-row .input {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
}
#daily-panel .daily-token-row .qbtn { flex: none; }
#daily-panel .daily-step .hint {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
}
#daily-panel .daily-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--hair-soft);
}
#daily-panel .daily-foot .streak-row { margin-top: 0; }
#daily-panel .daily-foot-note {
  flex: none;
  color: var(--faint);
  font-size: 11px;
}

:root[data-theme="light"] .panel {
  background:
    radial-gradient(130% 170% at 12% -22%, rgba(255, 255, 255, .95), transparent 46%),
    linear-gradient(155deg, rgba(255, 255, 255, .8), rgba(244, 247, 251, .58) 48%, rgba(255, 255, 255, .68));
  border-color: rgba(255, 255, 255, .95);
  box-shadow: 0 34px 70px -40px rgba(40, 60, 90, .38), inset 0 1px 0 #fff, inset 0 -1px 0 rgba(30, 45, 70, .08);
}
:root[data-theme="light"] .side {
  background: linear-gradient(180deg, rgba(255, 255, 255, .8), rgba(240, 244, 249, .6));
  border-right-color: rgba(255, 255, 255, .9);
  box-shadow: inset -1px 0 0 rgba(30, 45, 70, .06), 22px 0 70px -50px rgba(40, 60, 90, .3);
}
:root[data-theme="light"] .topbar {
  background: linear-gradient(180deg, rgba(255, 255, 255, .82), rgba(238, 242, 247, .62));
  border-bottom-color: rgba(255, 255, 255, .9);
  box-shadow: 0 18px 48px -38px rgba(40, 60, 90, .32), inset 0 1px 0 #fff;
}
:root[data-theme="light"] .input {
  background: rgba(255, 255, 255, .7);
  border-color: rgba(255, 255, 255, .95);
  box-shadow: inset 0 1px 0 #fff, inset 0 -1px 0 rgba(30, 45, 70, .07), 0 8px 20px -18px rgba(40, 60, 90, .3);
}
:root[data-theme="light"] .input:hover,
:root[data-theme="light"] .input:focus { background: rgba(255, 255, 255, .92); }
:root[data-theme="light"] .qbtn,
:root[data-theme="light"] .ghostbtn,
:root[data-theme="light"] .chip,
:root[data-theme="light"] .pill,
:root[data-theme="light"] .selectlike,
:root[data-theme="light"] .user-badge {
  background: linear-gradient(160deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .55));
  border-color: rgba(255, 255, 255, .95);
  box-shadow: inset 0 1px 0 #fff, inset 0 -1px 0 rgba(30, 45, 70, .08), 0 12px 28px -24px rgba(40, 60, 90, .35);
}
:root[data-theme="light"] .composer {
  background:
    radial-gradient(120% 180% at 20% -40%, rgba(255, 255, 255, .95), transparent 50%),
    linear-gradient(150deg, rgba(255, 255, 255, .88), rgba(244, 247, 251, .66) 44%, rgba(255, 255, 255, .78));
  border-color: rgba(255, 255, 255, .98);
  box-shadow: 0 34px 70px -40px rgba(40, 60, 90, .36), inset 0 1px 0 #fff, inset 0 -1px 0 rgba(30, 45, 70, .08);
}
:root[data-theme="light"] .stat,
:root[data-theme="light"] .bubble {
  background: linear-gradient(155deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .55));
  border-color: rgba(255, 255, 255, .95);
  box-shadow: inset 0 1px 0 #fff, inset 0 -1px 0 rgba(30, 45, 70, .07), 0 18px 40px -32px rgba(40, 60, 90, .35);
}
:root[data-theme="light"] .msg.is-user .bubble {
  background: linear-gradient(155deg, rgba(63, 106, 153, .22), rgba(63, 106, 153, .1));
  border-color: rgba(63, 106, 153, .24);
}
:root[data-theme="light"] .navlink.is-current {
  background: linear-gradient(100deg, rgba(63, 106, 153, .2), rgba(63, 106, 153, .06));
  border-color: rgba(255, 255, 255, .8);
  box-shadow: inset 0 1px 0 #fff, 0 14px 32px -28px rgba(40, 60, 90, .4);
}
:root[data-theme="light"] #invite-panel, :root[data-theme="light"] #daily-panel {
  background:
    radial-gradient(130% 160% at 100% -10%, rgba(63, 106, 153, .16), transparent 48%),
    linear-gradient(155deg, rgba(255, 255, 255, .86), rgba(244, 247, 251, .6) 50%, rgba(255, 255, 255, .72));
}
/* ═══ END APPLE GLASS v5 ═══ */

/* ═══ LAYOUT v6 — workspace shell ═══ */

/* nav groups */
.nav-label {
  margin: 13px 12px 3px;
  font: 600 9.5px/1 var(--sans);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--faint);
  opacity: .72;
}
.nav-label:first-child { margin-top: 0; }
body.side-collapsed .nav-label { display: none; }

/* the app frame owns the viewport; only the content column scrolls */
.main { height: 100dvh; }
.scroll { overflow-y: auto; overscroll-behavior: contain; }
.page-title { color: var(--ink); }

/* playground: context bar */
.workspace-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .018));
  border: 1px solid var(--hair-soft);
  box-shadow: var(--edge);
}
.workspace-ident,
.workspace-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.workspace-ident .field-label,
.workspace-tools .key-quick .field-label {
  font-size: 10.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--faint);
}
.workspace-tools .key-quick { display: flex; align-items: center; gap: 8px; }
.workspace-tools .key-quick .input {
  width: 180px;
  height: 34px;
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 10px;
}
.workspace-bar .selectlike { padding: 7px 12px; }
.workspace-bar .pill { padding: 6px 10px; }

/* playground: fill the viewport with a real chat workspace */
.view[data-view="playground"].is-current {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100%;
}
.view[data-view="playground"] .row,
.view[data-view="playground"] .chips { margin: 0; }
.view[data-view="playground"] .chat-panel {
  flex: 1 1 auto;
  min-height: 300px;
  margin-bottom: 0;
  overflow: hidden;
}
.view[data-view="playground"] .log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}
.view[data-view="playground"] .log:empty { display: none; }
.view[data-view="playground"] #starter {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 4px 18px;
}
.starter-kicker {
  margin: 0 0 6px;
  font: 600 10px var(--sans);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent-hi);
}
.starter-title {
  margin: 0 0 8px;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.15;
  letter-spacing: -.7px;
  font-weight: 600;
}
.view[data-view="playground"] #starter .panel-note { max-width: 64ch; }
.view[data-view="playground"] #starter .starters {
  width: 100%;
  max-width: 860px;
  margin: 20px auto 0;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.starter { position: relative; padding-right: 34px; }
.starter::after {
  content: "→";
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  font-size: 14px;
  transition: color .2s var(--ease), transform .24s var(--spring);
}
.starter:hover::after { color: var(--accent-hi); transform: translate(2px, -50%); }

/* the composer is part of the flex column, not a floating sticky layer */
.view[data-view="playground"] .composer { position: static; flex: none; margin: 0; }
.view[data-view="playground"] .quick { flex: none; margin: 0; }
.view[data-view="playground"] .fineprint { flex: none; margin: 0; }
.view[data-view="playground"] .statusline { flex: none; margin: 0; }

/* billing: two-column dashboard instead of one long stack */
.view[data-view="billing"].is-current {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
  gap: 18px;
  align-items: stretch;
}
.view[data-view="billing"] > .sec-title { grid-column: 1 / -1; margin: 6px 0 0; }
.view[data-view="billing"] > .panel { margin-bottom: 0; }
.view[data-view="billing"] > #invite-panel,
.view[data-view="billing"] > #daily-panel { grid-column: 1 / -1; }

/* forms read better at a controlled measure */
.view[data-view="keys"] > .panel { max-width: 820px; }

/* light theme surfaces for the new bar */
:root[data-theme="light"] .workspace-bar {
  background: linear-gradient(160deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .55));
  border-color: rgba(255, 255, 255, .95);
  box-shadow: inset 0 1px 0 #fff, inset 0 -1px 0 rgba(30, 45, 70, .07), 0 14px 30px -28px rgba(40, 60, 90, .35);
}

@media (max-width: 760px) {
  #daily-panel .daily-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  #daily-panel .daily-token-row { flex-wrap: wrap; }
  #daily-panel .daily-token-row .qbtn { width: 100%; }
  #daily-panel .daily-foot { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 760px) {
  .main { height: auto; min-height: 100dvh; }
  .scroll { overflow: visible; }
  .view[data-view="playground"].is-current { min-height: 0; }
  .view[data-view="playground"] .chat-panel { min-height: 360px; }
  .view[data-view="playground"] .log { overflow: visible; }
  .view[data-view="playground"] .composer { position: sticky; bottom: 8px; }
  .view[data-view="billing"].is-current { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar { gap: 8px; }
  .topbar-right { gap: 6px; }
  .page-title { font-size: 14px; }
  .discord-btn { padding: 8px 10px; }
  .discord-btn span { display: none; }
  .user-name, .credit-pill { display: none; }
  #status-text { display: none; }
  #status-pill { padding: 8px; }
  .workspace-bar { padding: 10px 12px; }
  .workspace-tools { width: 100%; }
  .workspace-tools .key-quick { flex: 1 1 auto; }
  .workspace-tools .key-quick .input { width: 100%; }
  .workspace-tools .qbtn { flex: none; }
}

/* mobile: let the empty state grow instead of clipping under the composer */
@media (max-width: 760px) {
  .view[data-view="playground"] .chat-panel {
    min-height: 0;
    overflow: visible;
  }
  .view[data-view="playground"] #starter { padding-bottom: 8px; }
}

@media (max-width: 640px) {
  .workspace-ident .field-label { display: none; }
  .workspace-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    width: 100%;
  }
  .workspace-tools .key-quick { min-width: 0; }
  .workspace-tools .key-quick .input { width: 100%; min-width: 0; }
  .chat-head { gap: 8px; }
  .chat-head .badge { display: none; }
  #chat-title {
    font-size: 14px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #new-chat { white-space: nowrap; }
}

#model-grid { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
.view[data-view="admin"] #admin-gate { max-width: 820px; }
@media (max-width: 640px) {
  #model-grid { grid-template-columns: 1fr; }
}

.table-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.table-scroll .tbl { min-width: 640px; }
@media (max-width: 640px) {
  .table-scroll .tbl { min-width: 560px; }
  .code { font-size: 12px; }
}

/* light theme: strong pills need a readable accent fill, not white-on-white */
:root[data-theme="light"] .qbtn.is-strong {
  color: var(--accent);
  background: rgba(63, 106, 153, .14);
  border-color: rgba(63, 106, 153, .32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 8px 18px -16px rgba(40, 60, 90, .4);
}
:root[data-theme="light"] #invite-badge {
  color: var(--accent);
  background: rgba(63, 106, 153, .12);
  border-color: rgba(63, 106, 153, .28);
}

.btn-boost {
  background: linear-gradient(135deg, rgba(88, 101, 242, .32), rgba(124, 157, 198, .36));
  border-color: rgba(124, 157, 198, .55);
  color: #fff !important;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
}
.btn-boost:hover {
  background: linear-gradient(135deg, rgba(88, 101, 242, .48), rgba(124, 157, 198, .5));
  border-color: rgba(150, 180, 214, .75);
  box-shadow: 0 4px 16px -4px rgba(88, 101, 242, .45);
}
:root[data-theme="light"] .btn-boost {
  background: linear-gradient(135deg, rgba(88, 101, 242, .2), rgba(63, 106, 153, .24));
  border-color: rgba(88, 101, 242, .4);
  color: #273752 !important;
}


/* select control: readable dropdown text in both themes */
select.input.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* chat log: keep text clear of the inner scrollbar and stop horizontal bleed */
.view[data-view="playground"] .log {
  overflow-x: hidden;
  padding-right: 14px;
  scrollbar-gutter: stable;
}
.view[data-view="playground"] .msg { min-width: 0; }
.view[data-view="playground"] .msg-body { min-width: 0; max-width: 100%; }
.view[data-view="playground"] .bubble { overflow-wrap: break-word; word-break: normal; }

/* avoid double scrollbars: the log owns scrolling, the outer panel stays clipped cleanly */
.view[data-view="playground"] .chat-panel { overflow: hidden; }

/* tables: solid sticky header so scrolled rows never bleed through */
.tbl th {
  background: #14181e;
  z-index: 2;
}
:root[data-theme="light"] .tbl th {
  background: #f5f8fb;
}

/* sticky headers: translucent Apple liquid glass (not opaque) */
.tbl th,
.admin-scroll .tbl th {
  background: rgba(20, 24, 30, .55);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
}
:root[data-theme="light"] .tbl th,
:root[data-theme="light"] .admin-scroll .tbl th {
  background: rgba(245, 248, 251, .55);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
}

/* sticky headers: liquid glass with refraction, depth, and rounded corners */
.tbl th,
.admin-scroll .tbl th {
  background:
    radial-gradient(120% 180% at 18% -30%, rgba(255,255,255,.20), rgba(255,255,255,.05) 42%, rgba(255,255,255,0) 72%),
    linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.02));
  background-color: rgba(20, 24, 30, .48);
  -webkit-backdrop-filter: blur(24px) saturate(180%) contrast(1.05);
  backdrop-filter: blur(24px) saturate(180%) contrast(1.05);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.22),
    inset 0 -1px 0 rgba(255,255,255,.06),
    0 14px 28px -22px rgba(0,0,0,.85);
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.tbl th:first-child { border-top-left-radius: 14px; border-bottom-left-radius: 14px; }
.tbl th:last-child { border-top-right-radius: 14px; border-bottom-right-radius: 14px; }
:root[data-theme="light"] .tbl th,
:root[data-theme="light"] .admin-scroll .tbl th {
  background:
    radial-gradient(120% 180% at 18% -30%, rgba(255,255,255,.85), rgba(255,255,255,.25) 45%, rgba(255,255,255,0) 75%),
    linear-gradient(180deg, rgba(255,255,255,.65), rgba(255,255,255,.15));
  background-color: rgba(245, 248, 251, .48);
  -webkit-backdrop-filter: blur(24px) saturate(180%) contrast(1.03);
  backdrop-filter: blur(24px) saturate(180%) contrast(1.03);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.9),
    inset 0 -1px 0 rgba(30,45,70,.08),
    0 14px 28px -24px rgba(40,60,90,.38);
  border-bottom: 1px solid rgba(15,23,35,.10);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .tbl th, .admin-scroll .tbl th { background-color: rgba(20, 24, 30, .88); }
  :root[data-theme="light"] .tbl th,
  :root[data-theme="light"] .admin-scroll .tbl th { background-color: rgba(245, 248, 251, .92); }
}

/* ── growth: hero, demo, sharing, streak, leaderboard ─────── */
.announce {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 14px; padding: 10px 14px;
  border: 1px solid rgba(124, 157, 198, .26);
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, rgba(124, 157, 198, .13), rgba(111, 192, 143, .06));
  color: var(--muted); font-size: 12.5px;
}
.announce a { margin-left: auto; color: var(--accent-hi); text-decoration: none; white-space: nowrap; }
.announce a:hover { color: var(--ink); }

.hero-panel {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(270px, .65fr);
  gap: 22px; align-items: stretch;
  margin: 0 0 18px; padding: 28px;
  border: 1px solid var(--hair); border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 160% at 8% -10%, rgba(124, 157, 198, .22), transparent 55%),
    radial-gradient(100% 120% at 100% 0%, rgba(111, 192, 143, .10), transparent 50%),
    var(--glass);
  box-shadow: var(--drop), var(--edge);
  position: relative; overflow: hidden;
}
.hero-panel::after {
  content: ""; position: absolute; width: 280px; height: 280px; right: -90px; bottom: -150px;
  border-radius: 50%; background: rgba(124, 157, 198, .14); filter: blur(20px); pointer-events: none;
}
.hero-copy { position: relative; z-index: 1; min-width: 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 12px; color: var(--accent-hi); font: 600 11px/1 var(--mono);
  letter-spacing: .12em; text-transform: uppercase;
}
.hero-copy h2 { margin: 0 0 12px; font-size: clamp(27px, 3.3vw, 43px); line-height: 1.08; letter-spacing: -.045em; }
.hero-copy h2 .grad {
  background: linear-gradient(92deg, #b8d0ef, #8fd7ad 58%, #d6c39b);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-lead { margin: 0 0 20px; max-width: 62ch; color: var(--muted); font-size: 14px; line-height: 1.7; }
.hero-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero-primary { padding: 11px 18px; border-radius: 12px; font-size: 13.5px; }
.hero-secondary { text-decoration: none; padding: 10px 16px; }
.hero-docs { color: var(--muted); text-decoration: none; font-size: 12.5px; }
.hero-docs:hover { color: var(--ink); }
.hero-points { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 18px; color: var(--faint); font-size: 11.5px; }
.hero-points span { display: inline-flex; align-items: center; gap: 7px; }

.hero-card {
  position: relative; z-index: 1; display: flex; flex-direction: column; gap: 10px;
  padding: 16px; border: 1px solid var(--hair); border-radius: var(--radius);
  background: rgba(9, 12, 16, .34); box-shadow: var(--edge);
}
.hero-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--hair-soft); }
.hero-uptime { color: var(--faint); font-size: 10.5px; }
.hero-metric { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 3px 0; color: var(--faint); font-size: 11.5px; }
.hero-metric strong { color: var(--ink); font-size: 15px; letter-spacing: -.02em; text-align: right; }
.hero-card-link { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--hair-soft); color: var(--accent-hi); font-size: 11.5px; text-decoration: none; }
.hero-card-link:hover { color: var(--ink); }

.streak-row {
  display: flex; align-items: center; gap: 8px; margin-top: 14px;
  color: var(--muted); font-size: 12px;
}
.streak-flame { filter: saturate(1.2); }
.streak-row strong { color: var(--ink); }
.streak-best { margin-left: auto; color: var(--faint); font-size: 11px; }

.share-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--hair-soft); }
.share-row .field-label { margin-right: 4px; }
.share-row .qbtn { padding: 6px 11px; font-size: 11.5px; }

.milestone { margin-top: 14px; padding: 13px 14px; border: 1px solid var(--hair-soft); border-radius: var(--radius-sm); background: rgba(255, 255, 255, .035); }
.milestone-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.milestone-head strong { color: var(--ink); }
.progress { height: 7px; margin: 10px 0 8px; overflow: hidden; border-radius: 99px; background: rgba(255, 255, 255, .08); }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-hi), #8fd7ad); transition: width .4s var(--ease); }
.milestone .hint { margin: 0; }

.leaderboard { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.leaderboard-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--hair-soft); border-radius: var(--radius-sm); background: rgba(255, 255, 255, .03); }
.lb-rank { width: 30px; color: var(--faint); font: 600 11px/1 var(--mono); }
.lb-avatar { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 9px; color: var(--ink); background: var(--accent-soft); font-size: 11px; font-weight: 700; }
.lb-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: 12.5px; }
.lb-count { margin-left: auto; color: var(--faint); font: 11px/1 var(--mono); white-space: nowrap; }
.leaderboard-empty { padding: 12px; color: var(--faint); font-size: 12px; text-align: center; }

.community-panel { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.community-panel .sec-note { margin: 0; }

:root[data-theme="light"] .hero-panel {
  background:
    radial-gradient(120% 160% at 8% -10%, rgba(82, 111, 145, .13), transparent 55%),
    radial-gradient(100% 120% at 100% 0%, rgba(60, 150, 100, .08), transparent 50%),
    rgba(255, 255, 255, .72);
}
:root[data-theme="light"] .hero-card { background: rgba(255, 255, 255, .55); }
:root[data-theme="light"] .announce { background: linear-gradient(90deg, rgba(82, 111, 145, .08), rgba(60, 150, 100, .05)); }
:root[data-theme="light"] .milestone,
:root[data-theme="light"] .leaderboard-row { background: rgba(255, 255, 255, .5); }

@media (max-width: 820px) {
  .hero-panel { grid-template-columns: 1fr; padding: 20px; }
  .hero-card { order: 2; }
  .hero-copy h2 { font-size: clamp(26px, 8vw, 36px); }
}

/* admin acquisition */
.admin-acq { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.admin-acq-col { padding: 14px; border: 1px solid var(--hair-soft); border-radius: var(--radius-sm); background: rgba(255, 255, 255, .03); }
.admin-acq-col h5 { margin: 0 0 9px; color: var(--faint); font: 600 10.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.admin-acq-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.admin-acq-col li { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; }
.admin-acq-col li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-acq-col li strong { color: var(--ink); font-size: 11.5px; }
.admin-acq-empty { color: var(--faint) !important; font-size: 11.5px !important; }
.seo-links { margin-top: 10px; line-height: 1.8; }
.seo-links a { color: var(--muted); text-decoration: none; }
.seo-links a:hover { color: var(--ink); }

/* ═══════════════════════════════════════════════════════════════════════
   LIQUID GLASS v7 — immersive Apple-inspired design system (additive)
   Overrides the layered v1–v6 rules above with a single coherent material.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Plus Jakarta Sans", "Helvetica Neue", system-ui, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", ui-monospace, "Menlo", "Consolas", monospace;

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --glass-1: rgba(255, 255, 255, .055);
  --glass-2: rgba(255, 255, 255, .095);
  --glass-3: rgba(255, 255, 255, .15);
  --glass-panel: linear-gradient(165deg, rgba(255, 255, 255, .11), rgba(255, 255, 255, .035) 46%, rgba(255, 255, 255, .06));
  --glass-side: linear-gradient(180deg, rgba(28, 34, 42, .72), rgba(12, 15, 19, .58));
  --glass-top: linear-gradient(180deg, rgba(26, 32, 40, .74), rgba(12, 15, 19, .52));

  --blur-thin: blur(12px) saturate(140%);
  --blur: blur(28px) saturate(185%);
  --blur-thick: blur(46px) saturate(210%) brightness(1.04);

  --shadow-1: 0 8px 22px -14px rgba(0, 0, 0, .55);
  --shadow-2: 0 24px 58px -30px rgba(0, 0, 0, .78);
  --shadow-3: 0 44px 96px -48px rgba(0, 0, 0, .92);
  --edge-highlight: inset 0 1px 0 rgba(255, 255, 255, .24), inset 0 -1px 0 rgba(0, 0, 0, .28);
  --edge-soft: inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 -1px 0 rgba(0, 0, 0, .2);

  --accent: #7fa6d6;
  --accent-strong: #5c84b8;
  --accent-soft: rgba(127, 166, 214, .16);
  --ok: #6fc99a;
  --warn: #e3c15a;
  --bad: #e89a86;

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.42, .5, 1);
  --ease-standard: cubic-bezier(.22, .61, .36, 1);
}

:root[data-theme="light"] {
  --glass-1: rgba(255, 255, 255, .58);
  --glass-2: rgba(255, 255, 255, .72);
  --glass-3: rgba(255, 255, 255, .88);
  --glass-panel: linear-gradient(165deg, rgba(255, 255, 255, .86), rgba(244, 247, 251, .56) 48%, rgba(255, 255, 255, .72));
  --glass-side: linear-gradient(180deg, rgba(255, 255, 255, .82), rgba(240, 244, 249, .62));
  --glass-top: linear-gradient(180deg, rgba(255, 255, 255, .86), rgba(238, 242, 247, .62));
  --edge-highlight: inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 rgba(30, 45, 70, .08);
  --edge-soft: inset 0 1px 0 rgba(255, 255, 255, .82), inset 0 -1px 0 rgba(30, 45, 70, .06);
  --accent: #3f6a99;
  --accent-strong: #2f5f93;
  --accent-soft: rgba(63, 106, 153, .14);
  --shadow-2: 0 24px 58px -34px rgba(40, 60, 90, .34);
  --shadow-3: 0 44px 96px -52px rgba(40, 60, 90, .4);
}

html, body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1, "tnum" 1;
}

.mono, code, pre, .cb-lang, .kbd-hint {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ── immersive background ─────────────────────────────────── */
.bg {
  background:
    radial-gradient(120% 120% at 12% -8%, rgba(127, 166, 214, .22), transparent 52%),
    radial-gradient(100% 100% at 92% 8%, rgba(111, 201, 154, .13), transparent 56%),
    radial-gradient(90% 90% at 50% 110%, rgba(180, 160, 220, .12), transparent 60%);
}
.blob { mix-blend-mode: screen; opacity: .82; filter: blur(2px); }
.blob.b1 { background: radial-gradient(circle at 50% 50%, rgba(127, 166, 214, .4), transparent 68%); }
.blob.b2 { background: radial-gradient(circle at 50% 50%, rgba(111, 201, 154, .26), transparent 68%); }
.blob.b3 { background: radial-gradient(circle at 50% 50%, rgba(180, 160, 220, .24), transparent 68%); }
body::after { opacity: .38; mix-blend-mode: overlay; }

:root[data-theme="light"] .blob { mix-blend-mode: multiply; opacity: .55; }
:root[data-theme="light"] body::after { opacity: .18; }

@media (prefers-reduced-motion: reduce) {
  .blob, .brand-mark::after { animation: none !important; }
  .bg { background: var(--bg); }
}

/* ── shell & glass surfaces ───────────────────────────────── */
.shell { gap: 0; }

.side, .topbar, .panel, .composer, .input, .qbtn, .ghostbtn, .primary, .sendbtn,
.chip, .pill, .selectlike, .user-badge, .stat, .bubble, .toast, .sheet-inner,
.workspace-bar, .hero-panel, .hero-card, .mcard, .balcard {
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

.side {
  background: var(--glass-side);
  border-right: 1px solid rgba(255, 255, 255, .12);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, .05), var(--shadow-3);
  padding: 22px 16px;
  gap: 24px;
  transition: width .32s var(--ease-out), padding .32s var(--ease-out), transform .32s var(--ease-spring);
}

.topbar {
  background: var(--glass-top);
  border-bottom: 1px solid rgba(255, 255, 255, .11);
  box-shadow: 0 18px 48px -36px rgba(0, 0, 0, .9), var(--edge-soft);
  padding: 12px 28px;
  gap: 16px;
}

.panel, .workspace-bar, .hero-panel, .hero-card, .mcard, .balcard {
  background: var(--glass-panel);
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2), var(--edge-highlight);
  position: relative;
  overflow: hidden;
}
.panel::before, .workspace-bar::before, .hero-panel::before, .hero-card::before,
.mcard::before, .balcard::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, .16) 0%, rgba(255, 255, 255, .03) 28%, transparent 54%, rgba(255, 255, 255, .06) 100%);
  border-radius: inherit;
}

/* ── brand ────────────────────────────────────────────────── */
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  background: linear-gradient(150deg, #a9c4e6, var(--accent-strong) 62%, #3f5776);
  box-shadow: 0 12px 28px -12px rgba(127, 166, 214, .95), var(--edge-highlight);
  transition: transform .24s var(--ease-spring);
}
.brand:hover .brand-mark { transform: scale(1.06) rotate(-4deg); }
.brand-text strong { font-size: 19px; font-weight: 650; letter-spacing: -.4px; }
.brand-text small { font-size: 12px; color: rgba(255, 255, 255, .58); }

/* ── navigation ───────────────────────────────────────────── */
.nav { gap: 5px; }
.nav-label {
  margin: 14px 12px 4px;
  font: 600 9.5px/1 var(--font-sans);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .42);
}
.navlink {
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, .72);
  font: 500 14.5px var(--font-sans);
  transition: background .2s var(--ease-standard), color .2s var(--ease-standard), transform .22s var(--ease-spring), box-shadow .2s var(--ease-standard);
}
.navlink:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff;
  transform: translateX(3px);
}
.navlink.is-current {
  background: linear-gradient(100deg, rgba(255, 255, 255, .18), rgba(127, 166, 214, .12));
  border-color: rgba(255, 255, 255, .16);
  color: #fff;
  box-shadow: var(--edge-highlight), 0 14px 34px -26px rgba(127, 166, 214, .95);
}
.navlink.is-current .ico { color: var(--accent); }
.navlink:focus-visible, .navlink.is-current:focus-visible { box-shadow: 0 0 0 3px rgba(127, 166, 214, .34), var(--edge-highlight); }

/* ── topbar ───────────────────────────────────────────────── */
.page-title { color: #fff; font-size: 16px; font-weight: 600; letter-spacing: -.2px; }
.topbar-right { gap: 12px; }

.iconbtn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .04));
  border: 1px solid rgba(255, 255, 255, .16);
  color: rgba(255, 255, 255, .78);
  box-shadow: var(--edge-highlight);
  transition: transform .22s var(--ease-spring), background .2s var(--ease-standard), color .2s var(--ease-standard);
}
.iconbtn:hover { color: #fff; background: rgba(255, 255, 255, .12); transform: scale(1.06); }
.iconbtn:active { transform: scale(.94); }

.chip, .pill, .selectlike {
  background: linear-gradient(160deg, rgba(255, 255, 255, .15), rgba(255, 255, 255, .045));
  border: 1px solid rgba(255, 255, 255, .17);
  border-radius: 999px;
  box-shadow: var(--edge-highlight), var(--shadow-1);
  color: rgba(255, 255, 255, .82);
  transition: transform .22s var(--ease-spring), border-color .2s var(--ease-standard), color .2s var(--ease-standard);
}
.chip:hover, .pill:hover, .selectlike:hover { transform: translateY(-1px); border-color: rgba(255, 255, 255, .28); color: #fff; }

.user-badge {
  background: linear-gradient(160deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .04));
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  box-shadow: var(--edge-highlight);
}

.discord-btn {
  background: linear-gradient(160deg, #6d78f7, #5865F2 55%, #4752c4);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  box-shadow: 0 14px 34px -16px rgba(88, 101, 242, .9), var(--edge-highlight);
  transition: transform .22s var(--ease-spring), filter .2s var(--ease-standard), box-shadow .2s var(--ease-standard);
}
.discord-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* ── buttons ──────────────────────────────────────────────── */
button { transition: transform .18s var(--ease-spring), filter .18s var(--ease-standard), box-shadow .18s var(--ease-standard), background .18s var(--ease-standard), border-color .18s var(--ease-standard), color .18s var(--ease-standard); }
.primary, .sendbtn {
  background: linear-gradient(160deg, #a9c4e6 0%, #7fa6d6 34%, #5c84b8 78%);
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: var(--radius-sm);
  color: #fff;
  box-shadow: 0 18px 40px -18px rgba(92, 132, 178, .95), var(--edge-highlight);
  min-height: 44px;
  padding: 11px 20px;
}
.primary:hover, .sendbtn:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1.5px); box-shadow: 0 24px 46px -18px rgba(92, 132, 178, 1), var(--edge-highlight); }
.primary:active, .sendbtn:active:not(:disabled) { transform: translateY(0) scale(.97); }
.sendbtn { width: 46px; height: 46px; border-radius: 50%; padding: 0; }

.ghostbtn, .qbtn {
  background: linear-gradient(160deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .04));
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, .82);
  box-shadow: var(--edge-soft), var(--shadow-1);
  min-height: 40px;
}
.ghostbtn:hover, .qbtn:hover:not(:disabled) { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .28); color: #fff; transform: translateY(-1px); }
.ghostbtn:active, .qbtn:active:not(:disabled) { transform: translateY(0) scale(.97); }
.qbtn.is-strong { color: #fff; border-color: rgba(127, 166, 214, .42); background: linear-gradient(160deg, rgba(127, 166, 214, .24), rgba(127, 166, 214, .08)); }
.qbtn.is-danger { color: #f0b5a8; border-color: rgba(232, 154, 134, .34); background: rgba(232, 154, 134, .08); }

.textbtn { color: rgba(255, 255, 255, .68); border-radius: var(--radius-xs); }
.textbtn:hover { color: #fff; background: rgba(255, 255, 255, .09); }

/* ── inputs ───────────────────────────────────────────────── */
.input {
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .035));
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: var(--radius-sm);
  color: #fff;
  box-shadow: var(--edge-soft), var(--shadow-1);
  min-height: 44px;
  padding: 12px 14px;
  transition: background .2s var(--ease-standard), border-color .2s var(--ease-standard), box-shadow .2s var(--ease-standard), transform .2s var(--ease-spring);
}
.input:hover { background: rgba(255, 255, 255, .085); border-color: rgba(255, 255, 255, .24); }
.input:focus {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(127, 166, 214, .62);
  box-shadow: 0 0 0 3px rgba(127, 166, 214, .22), var(--edge-highlight), var(--shadow-1);
  transform: translateY(-.5px);
}
.input::placeholder { color: rgba(255, 255, 255, .42); }

/* ── forms & workspace ────────────────────────────────────── */
.field > label { color: rgba(255, 255, 255, .86); font-weight: 500; }
.hint { color: rgba(255, 255, 255, .48); line-height: 1.5; }
.workspace-bar { padding: 12px 16px; gap: 12px; }
.workspace-ident .field-label, .workspace-tools .field-label { color: rgba(255, 255, 255, .48); font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase; }
.workspace-tools .key-quick .input { height: 36px; font-size: 12.5px; }

/* ── hero ─────────────────────────────────────────────────── */
.hero-panel { padding: 30px; gap: 24px; }
.hero-copy h2 { font-size: clamp(28px, 3.4vw, 44px); line-height: 1.06; letter-spacing: -.045em; font-weight: 650; }
.hero-copy h2 .grad { background: linear-gradient(92deg, #cfe0f5, #8fd7ad 56%, #d6c39b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-lead { color: rgba(255, 255, 255, .7); font-size: 14.5px; line-height: 1.7; }
.hero-card { background: rgba(8, 11, 15, .34); border-radius: var(--radius); }
.hero-metric strong { color: #fff; font-size: 15px; }
.hero-points { color: rgba(255, 255, 255, .5); font-size: 12px; }

/* ── chat ─────────────────────────────────────────────────── */
.view[data-view="playground"].is-current { gap: 16px; }
.chat-head { padding-bottom: 12px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.chat-head strong { color: #fff; font-size: 16px; }
.spark { background: linear-gradient(160deg, rgba(127, 166, 214, .34), rgba(127, 166, 214, .1)); border-color: rgba(127, 166, 214, .34); color: #cfe0f5; }

.log { gap: 20px; }
.msg { gap: 14px; max-width: min(92%, 76ch); }
.msg.is-user { max-width: min(84%, 62ch); }
.ava { width: 34px; height: 34px; border-radius: 12px; background: linear-gradient(160deg, rgba(127, 166, 214, .3), rgba(127, 166, 214, .08)); border-color: rgba(127, 166, 214, .32); color: #cfe0f5; }
.role { color: rgba(255, 255, 255, .42); font-size: 10.5px; letter-spacing: 1.1px; }
.bubble {
  background: linear-gradient(155deg, rgba(255, 255, 255, .11), rgba(255, 255, 255, .035));
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px 22px 22px 22px;
  box-shadow: var(--edge-soft), 0 18px 42px -30px rgba(0, 0, 0, .85);
  padding: 15px 18px;
  line-height: 1.68;
}
.msg.is-user .bubble {
  background: linear-gradient(155deg, rgba(127, 166, 214, .3), rgba(92, 132, 178, .14));
  border-color: rgba(172, 202, 238, .32);
  border-radius: 22px 8px 22px 22px;
  box-shadow: var(--edge-highlight), 0 18px 42px -26px rgba(92, 132, 178, .9);
}
.bubble.is-note { background: rgba(232, 154, 134, .11); border-color: rgba(232, 154, 134, .32); color: #f0b5a8; }
.meta { color: rgba(255, 255, 255, .42); }
.msg-actions button { color: rgba(255, 255, 255, .55); }
.msg-actions button:hover { color: #fff; background: rgba(255, 255, 255, .09); }

.starter {
  min-height: 68px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02));
  border: 1px dashed rgba(255, 255, 255, .16);
  border-radius: var(--radius);
  color: rgba(255, 255, 255, .72);
  transition: background .2s var(--ease-standard), border-color .2s var(--ease-standard), color .2s var(--ease-standard), transform .24s var(--ease-spring);
}
.starter:hover { background: var(--accent-soft); border-color: rgba(127, 166, 214, .55); border-style: solid; color: #fff; transform: translateY(-2px); }
.starter:active { transform: translateY(0) scale(.985); }

/* ── composer ─────────────────────────────────────────────── */
.composer {
  background: linear-gradient(160deg, rgba(255, 255, 255, .1), rgba(20, 24, 30, .52) 44%, rgba(12, 15, 19, .58));
  border: 1px solid rgba(255, 255, 255, .17);
  border-radius: var(--radius-xl);
  padding: 10px;
  box-shadow: var(--shadow-3), var(--edge-highlight);
}
.composer:focus-within { border-color: rgba(127, 166, 214, .5); box-shadow: var(--shadow-3), 0 0 0 3px rgba(127, 166, 214, .18); }
.composer .input { background: transparent; border-color: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; min-height: 44px; }
.composer .input:focus { box-shadow: none; border-color: transparent; background: rgba(255, 255, 255, .03); }
.counter { color: rgba(255, 255, 255, .42); }
.quick { gap: 8px; }
.qbtn { min-height: 36px; }

/* ── cards, stats, tables ─────────────────────────────────── */
.mcard {
  background: linear-gradient(165deg, rgba(255, 255, 255, .11), rgba(255, 255, 255, .025) 48%, rgba(255, 255, 255, .05));
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2), var(--edge-highlight);
  transition: transform .26s var(--ease-spring), border-color .2s var(--ease-standard), box-shadow .2s var(--ease-standard);
}
.mcard:hover { transform: translateY(-3px); border-color: rgba(127, 166, 214, .34); box-shadow: var(--shadow-3), var(--edge-highlight); }
.mcard h4 { color: #fff; font-size: 20px; font-weight: 600; letter-spacing: -.4px; }
.mcard dl { border-top: 1px solid rgba(255, 255, 255, .08); border-bottom: 1px solid rgba(255, 255, 255, .08); padding: 14px 0; }
.stat {
  background: linear-gradient(155deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .03));
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: var(--radius);
  box-shadow: var(--edge-soft), var(--shadow-1);
  transition: transform .24s var(--ease-spring), border-color .2s var(--ease-standard);
}
.stat:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, .24); }
.stat .mono { color: #fff; font-size: 19px; font-weight: 600; }
.big { color: #fff; font-size: 40px; font-weight: 650; letter-spacing: -.9px; background: linear-gradient(180deg, #fff, #a9c6e6); -webkit-background-clip: text; background-clip: text; color: transparent; }

.tbl { border-collapse: separate; border-spacing: 0; }
.tbl th {
  background: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .04));
  -webkit-backdrop-filter: var(--blur-thin);
  backdrop-filter: var(--blur-thin);
  color: rgba(255, 255, 255, .58);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.tbl td {
  color: rgba(255, 255, 255, .76);
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.tbl tbody tr { transition: background .18s var(--ease-standard), transform .18s var(--ease-standard); }
.tbl tbody tr:hover { background: rgba(255, 255, 255, .055); }
.tbl tbody tr:nth-child(even) { background: rgba(255, 255, 255, .018); }
.tbl tbody tr:nth-child(even):hover { background: rgba(255, 255, 255, .07); }

.tabs {
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
}
.tab { border-radius: 10px; color: rgba(255, 255, 255, .62); font-weight: 500; }
.tab:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.tab.is-on { background: rgba(255, 255, 255, .11); color: #fff; box-shadow: var(--edge-soft); }

.code, .cb {
  background: rgba(8, 10, 13, .58);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: var(--radius);
  box-shadow: var(--edge-soft), var(--shadow-1);
}
.code { color: #d8dde3; }
.cb-head { background: rgba(255, 255, 255, .05); border-bottom: 1px solid rgba(255, 255, 255, .08); }
.cb pre { color: #d8dde3; }

/* ── sheet, scrim, toast ──────────────────────────────────── */
.scrim {
  background: rgba(6, 8, 11, .52);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  backdrop-filter: blur(12px) saturate(120%);
}
.sheet-inner {
  background: linear-gradient(180deg, rgba(24, 29, 35, .82), rgba(14, 17, 21, .74));
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3), var(--edge-highlight);
  animation: slide .36s var(--ease-spring) both;
}
.toast {
  background: linear-gradient(160deg, rgba(34, 40, 48, .82), rgba(20, 24, 30, .76));
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  box-shadow: var(--shadow-2), var(--edge-highlight);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

/* ── auth & billing ───────────────────────────────────────── */
.auth-widget { gap: 10px; }
.credit-pill {
  background: linear-gradient(160deg, rgba(111, 201, 154, .18), rgba(111, 201, 154, .08));
  border: 1px solid rgba(111, 201, 154, .32);
  color: #8fd7ad;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.account-card { gap: 16px; }
.big-avatar { border: 2px solid rgba(255, 255, 255, .16); box-shadow: var(--edge-highlight); }
.balance .big { font-size: 40px; }
.promo-row .input { min-width: 150px; }

/* ── admin ────────────────────────────────────────────────── */
.admin-scroll { border: 1px solid rgba(255, 255, 255, .1); border-radius: var(--radius-sm); }
.admin-scroll .tbl th {
  background: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .04));
  -webkit-backdrop-filter: var(--blur-thin);
  backdrop-filter: var(--blur-thin);
}
.admin-acq-col { background: rgba(255, 255, 255, .035); border: 1px solid rgba(255, 255, 255, .08); border-radius: var(--radius-sm); }

/* ── growth panels ────────────────────────────────────────── */
.announce {
  background: linear-gradient(90deg, rgba(127, 166, 214, .14), rgba(111, 201, 154, .07));
  border: 1px solid rgba(127, 166, 214, .24);
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, .76);
}
.milestone { background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08); border-radius: var(--radius-sm); }
.progress { background: rgba(255, 255, 255, .08); border-radius: 99px; }
.progress span { background: linear-gradient(90deg, var(--accent), #8fd7ad); }
.leaderboard-row { background: rgba(255, 255, 255, .035); border: 1px solid rgba(255, 255, 255, .08); border-radius: var(--radius-sm); }
.community-panel { gap: 18px; }

/* ── accessibility & motion ───────────────────────────────── */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(127, 166, 214, .34);
  border-radius: var(--radius-sm);
}
.skip {
  background: linear-gradient(160deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .06));
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.view.is-current > * { animation: liquidRise .42s var(--ease-out) both; }
.view.is-current > *:nth-child(2) { animation-delay: .04s; }
.view.is-current > *:nth-child(3) { animation-delay: .08s; }
.view.is-current > *:nth-child(4) { animation-delay: .12s; }
.view.is-current > *:nth-child(5) { animation-delay: .16s; }
@keyframes liquidRise {
  from { opacity: 0; transform: translateY(16px) scale(.992); filter: blur(4px); }
  to { opacity: 1; transform: none; filter: none; }
}

.msg:last-child { animation: messageIn .38s var(--ease-out) both; }
@keyframes messageIn {
  from { opacity: 0; transform: translateY(10px) scale(.99); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .blob { animation: none !important; }
  .brand-mark::after { display: none !important; }
}

@media (prefers-contrast: more) {
  .panel, .side, .topbar, .input, .bubble, .stat, .mcard {
    border-width: 2px;
    border-color: rgba(255, 255, 255, .55);
  }
  body { color: #fff; }
}

/* ── light theme overrides ────────────────────────────────── */
:root[data-theme="light"] .side, :root[data-theme="light"] .topbar, :root[data-theme="light"] .panel,
:root[data-theme="light"] .workspace-bar, :root[data-theme="light"] .hero-panel, :root[data-theme="light"] .mcard,
:root[data-theme="light"] .balcard, :root[data-theme="light"] .stat, :root[data-theme="light"] .bubble,
:root[data-theme="light"] .composer, :root[data-theme="light"] .input, :root[data-theme="light"] .qbtn,
:root[data-theme="light"] .ghostbtn, :root[data-theme="light"] .chip, :root[data-theme="light"] .pill,
:root[data-theme="light"] .selectlike, :root[data-theme="light"] .user-badge {
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}
:root[data-theme="light"] .side { background: var(--glass-side); box-shadow: inset -1px 0 0 rgba(30, 45, 70, .06), var(--shadow-3); }
:root[data-theme="light"] .topbar { background: var(--glass-top); box-shadow: 0 18px 48px -38px rgba(40, 60, 90, .32), var(--edge-soft); }
:root[data-theme="light"] .panel, :root[data-theme="light"] .workspace-bar, :root[data-theme="light"] .hero-panel,
:root[data-theme="light"] .mcard, :root[data-theme="light"] .balcard {
  background: var(--glass-panel);
  border-color: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow-2), var(--edge-highlight);
}
:root[data-theme="light"] .stat, :root[data-theme="light"] .bubble { background: var(--glass-panel); border-color: rgba(255, 255, 255, .9); box-shadow: var(--edge-highlight), var(--shadow-1); }
:root[data-theme="light"] .input { background: rgba(255, 255, 255, .72); border-color: rgba(255, 255, 255, .95); color: #151a21; box-shadow: var(--edge-highlight), var(--shadow-1); }
:root[data-theme="light"] .input:hover { background: rgba(255, 255, 255, .86); }
:root[data-theme="light"] .input:focus { background: #fff; border-color: rgba(63, 106, 153, .55); box-shadow: 0 0 0 3px rgba(63, 106, 153, .18), var(--edge-highlight), var(--shadow-1); }
:root[data-theme="light"] .input::placeholder { color: rgba(21, 26, 33, .46); }
:root[data-theme="light"] .qbtn, :root[data-theme="light"] .ghostbtn, :root[data-theme="light"] .chip,
:root[data-theme="light"] .pill, :root[data-theme="light"] .selectlike, :root[data-theme="light"] .user-badge {
  background: linear-gradient(160deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .58));
  border-color: rgba(255, 255, 255, .95);
  color: #243041;
  box-shadow: var(--edge-highlight), var(--shadow-1);
}
:root[data-theme="light"] .qbtn:hover:not(:disabled), :root[data-theme="light"] .ghostbtn:hover { background: #fff; color: #151a21; }
:root[data-theme="light"] .primary, :root[data-theme="light"] .sendbtn { color: #fff; }
:root[data-theme="light"] .navlink { color: rgba(21, 26, 33, .72); }
:root[data-theme="light"] .navlink:hover { color: #151a21; background: rgba(255, 255, 255, .55); }
:root[data-theme="light"] .navlink.is-current { color: #151a21; background: linear-gradient(100deg, rgba(63, 106, 153, .18), rgba(63, 106, 153, .05)); border-color: rgba(255, 255, 255, .8); }
:root[data-theme="light"] .navlink.is-current .ico { color: var(--accent); }
:root[data-theme="light"] .page-title, :root[data-theme="light"] .chat-head strong, :root[data-theme="light"] .mcard h4,
:root[data-theme="light"] .stat .mono, :root[data-theme="light"] .big, :root[data-theme="light"] .hero-metric strong { color: #151a21; }
:root[data-theme="light"] .role, :root[data-theme="light"] .meta, :root[data-theme="light"] .hint,
:root[data-theme="light"] .field-label, :root[data-theme="light"] .hero-points, :root[data-theme="light"] .hero-lead { color: rgba(21, 26, 33, .62); }
:root[data-theme="light"] .bubble { color: #151a21; }
:root[data-theme="light"] .msg.is-user .bubble { color: #151a21; }
:root[data-theme="light"] .composer { background: linear-gradient(160deg, rgba(255, 255, 255, .88), rgba(244, 247, 251, .66) 44%, rgba(255, 255, 255, .78)); }
:root[data-theme="light"] .composer .input { color: #151a21; }
:root[data-theme="light"] .sheet-inner { background: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(244, 247, 251, .82)); color: #151a21; }
:root[data-theme="light"] .toast { background: linear-gradient(160deg, rgba(255, 255, 255, .92), rgba(244, 247, 251, .82)); color: #151a21; }
:root[data-theme="light"] .code, :root[data-theme="light"] .cb, :root[data-theme="light"] .cb pre { background: rgba(245, 248, 251, .72); color: #26303c; }
:root[data-theme="light"] .cb-head { background: rgba(15, 23, 35, .04); }
:root[data-theme="light"] .tbl th { color: rgba(21, 26, 33, .58); }
:root[data-theme="light"] .tbl td { color: rgba(21, 26, 33, .78); }
:root[data-theme="light"] .announce { background: linear-gradient(90deg, rgba(63, 106, 153, .09), rgba(60, 150, 100, .05)); }
:root[data-theme="light"] .milestone, :root[data-theme="light"] .leaderboard-row { background: rgba(255, 255, 255, .52); }

/* ── responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .side { position: fixed; z-index: 25; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .34s var(--ease-spring); height: 100dvh; }
  body.side-open .side { transform: none; }
  .scroll { padding: 18px; }
  .topbar { padding: 12px 16px; }
  .msg, .msg.is-user { max-width: 100%; }
  .sec-title { font-size: 24px; }
}
@media (min-width: 901px) {
  #toggle-side { display: grid; }
}
@media (max-width: 640px) {
  .grid, .stats { grid-template-columns: 1fr; }
  .hero-panel { grid-template-columns: 1fr; padding: 20px; }
  .view[data-view="billing"].is-current { grid-template-columns: 1fr; }
  .composer { border-radius: var(--radius-lg); }
  .topbar-right .chip, .topbar-right .pill span { display: none; }
  .discord-btn span { display: none; }
  .user-name, .credit-pill { display: none; }
}
@media (max-width: 480px) {
  .scroll { padding: 14px; }
  .panel { padding: 16px; border-radius: 20px; }
  .hero-copy h2 { font-size: 26px; }
  .primary, .ghostbtn, .qbtn { min-height: 42px; }
}

/* ── focus and tap targets ────────────────────────────────── */
.primary, .ghostbtn, .qbtn, .sendbtn, .iconbtn, .navlink, .tab, .starter, .convo {
  min-height: 40px;
}
.textbtn { min-height: 28px; }
@media (hover: none) {
  .msg-actions, .convo-del { opacity: 1; }
  .navlink:hover, .qbtn:hover:not(:disabled), .ghostbtn:hover { transform: none; }
}

/* ── high contrast / forced colors ────────────────────────── */
@media (forced-colors: active) {
  .panel, .side, .topbar, .input, .bubble, .stat, .mcard, .composer {
    border: 2px solid CanvasText;
    background: Canvas;
    color: CanvasText;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .primary, .sendbtn { background: Highlight; color: HighlightText; }
}

/* ── Discord avatars on site ─────────────────────────────── */
.lb-avatar {
  display: grid; place-items: center; overflow: hidden;
  width: 30px; height: 30px; border-radius: 10px;
  background: var(--accent-soft); border: 1px solid rgba(255,255,255,.14);
}
.lb-avatar-img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.lb-avatar-initial { font-size: 12px; font-weight: 700; color: var(--accent); }
.user-avatar, .big-avatar {
  object-fit: cover; background: rgba(255,255,255,.08);
}
