/* ==========================================================================
   SimuVerse — design system
   A dark, glassy, modern lab UI. Vanilla CSS, no build step.
   ========================================================================== */
:root {
  --bg: #070a14;
  --bg-2: #0b1020;
  --panel: rgba(20, 27, 48, 0.72);
  --panel-solid: #131a2e;
  --panel-2: rgba(28, 37, 64, 0.6);
  --border: rgba(120, 140, 190, 0.16);
  --border-strong: rgba(120, 140, 190, 0.32);
  --text: #e8ecf6;
  --muted: #9aa6c4;
  --faint: #6b7693;
  --brand: #7c6cff;
  --brand-2: #22d3ee;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.7);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }

/* Custom scrollbars — slim, glassy, on-brand */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(124, 108, 255, 0.4), rgba(34, 211, 238, 0.3));
  border: 2px solid transparent; background-clip: padding-box; border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(124, 108, 255, 0.7), rgba(34, 211, 238, 0.55));
  background-clip: padding-box;
}
::selection { background: rgba(124, 108, 255, 0.4); color: #fff; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 12% -10%, rgba(124, 108, 255, 0.18), transparent 60%),
    radial-gradient(900px 600px at 100% 0%, rgba(34, 211, 238, 0.12), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { color: var(--brand-2); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); }

/* ----- Layout ----- */
.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100vh;
  display: flex; flex-direction: column;
  gap: 18px; padding: 20px 16px;
  background: linear-gradient(180deg, rgba(13, 18, 34, 0.9), rgba(8, 11, 22, 0.92));
  border-right: 1px solid var(--border);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center; font-size: 22px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(124, 108, 255, 0.35), rgba(34, 211, 238, 0.25));
  border: 1px solid var(--border-strong);
}
.brand-name { font-weight: 800; letter-spacing: 0.2px; }
.brand-tag { font-size: 11.5px; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 12px;
  background: transparent; border: 1px solid transparent; color: var(--muted);
  font: inherit; font-weight: 600; font-size: 14px; text-align: left;
  cursor: pointer; transition: background 0.18s, color 0.18s, transform 0.18s;
}
/* Animated accent bar that grows in when active */
.nav-item::before {
  content: ""; position: absolute; left: 0; top: 50%;
  width: 3px; height: 0; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--brand), var(--brand-2));
  transform: translateY(-50%); transition: height 0.22s ease;
}
.nav-item span {
  font-size: 16px; width: 20px; text-align: center;
  transition: transform 0.18s ease;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item:hover span { transform: scale(1.15); }
.nav-item.active {
  color: #fff; border-color: var(--border-strong);
  background: linear-gradient(135deg, rgba(124, 108, 255, 0.28), rgba(34, 211, 238, 0.12));
}
.nav-item.active::before { height: 60%; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.key-status { display: flex; flex-wrap: wrap; gap: 6px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 26px;
  background: rgba(8, 11, 22, 0.6);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.topbar-title { font-weight: 700; font-size: 16px; }
.topbar-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.menu-btn { display: none; }

.view-host { padding: 28px 26px 80px; max-width: 1180px; width: 100%; margin: 0 auto; }
.view { animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ----- Bits ----- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
}
.pill.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.pill.on { color: var(--text); border-color: var(--border-strong); }
.pill.on.dot::before { background: var(--good); box-shadow: 0 0 8px var(--good); }

.badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border);
}
.badge.beginner { color: #6ee7b7; border-color: rgba(110, 231, 183, 0.4); }
.badge.intermediate { color: #fcd34d; border-color: rgba(252, 211, 77, 0.4); }
.badge.advanced { color: #f0abfc; border-color: rgba(240, 171, 252, 0.4); }

.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  backdrop-filter: blur(10px); box-shadow: var(--shadow);
}
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 14px; }

h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -0.3px; }
h2 { font-size: 19px; margin: 0 0 4px; }
h3 { font-size: 15px; margin: 0 0 4px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 14px; }
.lead { color: var(--muted); margin: 0 0 18px; max-width: 70ch; }

/* ----- Forms ----- */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text);
  background: rgba(8, 12, 24, 0.7); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; transition: 0.15s;
}
textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.18);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
select option { background: var(--panel-solid); }

.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--text);
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s, filter 0.15s;
}
.btn:hover { border-color: var(--brand); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.primary {
  border: none; color: #0a0c16;
  background: linear-gradient(135deg, #8b7bff, #22d3ee);
  box-shadow: 0 8px 24px -10px rgba(124, 108, 255, 0.8);
}
.btn.primary:hover { filter: brightness(1.06); box-shadow: 0 12px 30px -10px rgba(124, 108, 255, 0.95); }
/* Light sweep across the primary button on hover */
.btn.primary::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform 0.6s ease;
}
.btn.primary:hover::after { transform: translateX(120%); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: rgba(248, 113, 113, 0.4); }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.icon-btn {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer; font-size: 16px;
}

.preset-row { display: flex; gap: 6px; }
.preset-row .btn { flex: 1; padding: 7px 4px; font-size: 12px; }
.range-wrap { display: flex; align-items: center; gap: 10px; }
.range-wrap input[type="range"] { accent-color: var(--brand); }
.range-val { font-family: var(--mono); font-size: 12.5px; min-width: 34px; text-align: right; color: var(--text); }

/* ----- Home ----- */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  padding: 34px; border-radius: 22px; margin-bottom: 22px;
  background: linear-gradient(135deg, rgba(124, 108, 255, 0.16), rgba(34, 211, 238, 0.08));
  border: 1px solid var(--border-strong);
}
/* Slowly drifting aurora blobs behind the hero copy */
.hero::before, .hero::after {
  content: ""; position: absolute; z-index: -1; border-radius: 50%;
  filter: blur(60px); opacity: 0.55; pointer-events: none;
}
.hero::before {
  width: 420px; height: 420px; top: -160px; left: -80px;
  background: radial-gradient(circle, rgba(124, 108, 255, 0.7), transparent 70%);
  animation: drift1 16s ease-in-out infinite;
}
.hero::after {
  width: 380px; height: 380px; bottom: -180px; right: -60px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.55), transparent 70%);
  animation: drift2 20s ease-in-out infinite;
}
@keyframes drift1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(80px, 50px) scale(1.15); }
}
@keyframes drift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-70px, -40px) scale(1.1); }
}
.hero > * { position: relative; }
.hero h1 {
  font-size: 32px;
  background: linear-gradient(120deg, #fff 20%, #c9c2ff 45%, #8fe9ff 70%, #fff 90%);
  background-size: 220% auto;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 8s linear infinite;
}
@keyframes shimmer { to { background-position: 220% center; } }
.hero .lead { font-size: 15.5px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.feature-card { cursor: pointer; transition: 0.18s; }
.feature-card:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.feature-ico { font-size: 26px; margin-bottom: 8px; }
.provider-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.pchip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--panel-2); border: 1px solid var(--border);
}
.pchip i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ----- Chat / transcript ----- */
.chat-wrap { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.transcript {
  display: flex; flex-direction: column; gap: 14px;
  min-height: 340px; max-height: 62vh; overflow-y: auto; padding: 6px 4px;
}
.bubble {
  display: flex; gap: 10px; max-width: 88%;
  animation: bubble-in 0.32s cubic-bezier(0.21, 1, 0.36, 1) both;
}
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.bubble .avatar {
  width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #0a0c16; background: var(--brand-2);
  transition: transform 0.18s ease;
}
.bubble:hover .avatar { transform: scale(1.08) rotate(-3deg); }
.bubble .body {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 13px; white-space: pre-wrap; word-wrap: break-word;
}
.bubble .who { font-size: 12px; font-weight: 700; margin-bottom: 3px; color: var(--muted); }
.bubble.me { margin-left: auto; flex-direction: row-reverse; }
.bubble.me .avatar { background: linear-gradient(135deg, #8b7bff, #22d3ee); }
.bubble.me .body { background: rgba(124, 108, 255, 0.16); border-color: rgba(124, 108, 255, 0.3); }
.bubble.sys .body { background: transparent; border-style: dashed; color: var(--muted); font-size: 13px; }
.cursor::after {
  content: "▍"; display: inline-block; margin-left: 1px;
  animation: blink 1s steps(2) infinite; color: var(--brand-2);
  text-shadow: 0 0 8px var(--brand-2);
}
@keyframes blink { 50% { opacity: 0; } }

/* Reasoning-model "thinking" indicator (grok-3-mini, deepseek-reasoner, …) */
.thinking {
  font-size: 12.5px; color: var(--muted); font-style: italic;
  margin-bottom: 6px; padding: 6px 10px; border-radius: 8px;
  background: rgba(124, 108, 255, 0.08); border: 1px dashed var(--border);
  white-space: pre-wrap; word-wrap: break-word;
  animation: rise 0.3s ease both;
}
.body.thinking-inline { color: var(--muted); font-style: italic; }

/* ----- Markdown rendering inside chat bubbles ----- */
.body.md { white-space: normal; }
.body.md > *:first-child { margin-top: 0; }
.body.md > *:last-child { margin-bottom: 0; }
.body.md p { margin: 7px 0; }
.body.md ul, .body.md ol { margin: 7px 0; padding-left: 22px; }
.body.md li { margin: 3px 0; }
.body.md a { color: var(--brand-2); text-decoration: underline; text-underline-offset: 2px; }
.body.md blockquote {
  margin: 8px 0; padding: 4px 12px; color: var(--muted);
  border-left: 3px solid var(--border-strong); background: rgba(124, 108, 255, 0.06); border-radius: 0 8px 8px 0;
}
.md-h { font-weight: 700; line-height: 1.3; margin: 12px 0 6px; color: #fff; }
.md-h1 { font-size: 18px; }
.md-h2 { font-size: 16px; }
.md-h3, .md-h4, .md-h5, .md-h6 { font-size: 14px; }
code.ic {
  font-family: var(--mono); font-size: 0.9em;
  background: rgba(124, 108, 255, 0.16); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 5px;
}
pre.code {
  position: relative; margin: 10px 0; overflow-x: auto;
  background: rgba(4, 7, 16, 0.72); border: 1px solid var(--border);
  border-radius: 10px; padding: 30px 14px 12px;
}
pre.code code {
  display: block; font-family: var(--mono); font-size: 12.8px; line-height: 1.55;
  white-space: pre; color: #d7def0; background: none; border: none; padding: 0;
}
pre.code .code-lang {
  position: absolute; top: 7px; left: 12px;
  font-family: var(--mono); font-size: 11px; color: var(--faint);
}

/* ----- Copy buttons (messages + code blocks) ----- */
.copy-btn {
  font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer;
  padding: 3px 9px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--muted);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.copy-btn:hover { color: var(--text); border-color: var(--brand); background: rgba(124, 108, 255, 0.12); }
.code-copy { position: absolute; top: 6px; right: 8px; padding: 2px 8px; }
.body-wrap { position: relative; }
.msg-copy { position: absolute; top: 2px; right: 2px; opacity: 0; transition: opacity 0.15s; }
.bubble:hover .msg-copy { opacity: 1; }
.msg-copy.always { position: static; opacity: 1; }

/* ----- Toggle switch (e.g. web-search) ----- */
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text); transition: border-color 0.15s;
}
.switch-row:hover { border-color: var(--border-strong); }
.switch-row input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 40px; height: 22px; flex: none; margin: 0; padding: 0; cursor: pointer; position: relative;
  border-radius: 999px; background: var(--panel-solid); border: 1px solid var(--border-strong);
  transition: background 0.18s, border-color 0.18s;
}
.switch-row input[type="checkbox"]::after {
  content: ""; position: absolute; top: 50%; left: 3px; transform: translateY(-50%);
  width: 16px; height: 16px; border-radius: 50%; background: var(--faint); transition: left 0.18s, background 0.18s;
}
.switch-row input[type="checkbox"]:checked { background: linear-gradient(135deg, #8b7bff, #22d3ee); border-color: transparent; }
.switch-row input[type="checkbox"]:checked::after { left: 21px; background: #fff; }

/* ----- Web-search "Sources" panel ----- */
.sources {
  margin: 0 0 10px; padding: 10px 12px; border-radius: 10px;
  background: rgba(34, 211, 238, 0.06); border: 1px solid var(--border);
  animation: rise 0.3s ease both;
}
.sources-head { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.2px; }
.source-item {
  display: flex; align-items: baseline; gap: 9px; padding: 5px 0;
  text-decoration: none; color: var(--text); font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.source-item:last-child { border-bottom: none; }
.source-num { color: var(--brand-2); font-family: var(--mono); font-size: 12px; flex: none; }
.source-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-item:hover .source-title { color: var(--brand-2); text-decoration: underline; }
.source-host { color: var(--faint); font-size: 11.5px; flex: none; }

.composer { display: flex; gap: 10px; margin-top: 12px; align-items: flex-end; }
.composer textarea { min-height: 48px; max-height: 160px; }

.side-panel { position: sticky; top: 84px; }
.side-panel .card { padding: 16px; }
.side-panel label.field { margin-bottom: 12px; }

/* ----- Simulation ----- */
.sim-grid { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
.agent-card { border-left: 3px solid var(--brand); }
.agent-card .row { gap: 8px; }
.agent-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.agent-swatch { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.transcript.sim .bubble { max-width: 92%; }
.transcript.sim .avatar { color: #06080f; }
.scenario-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 10px 14px; border-radius: 12px; background: var(--panel-2);
  border: 1px dashed var(--border-strong); margin-bottom: 12px; font-size: 13px;
}
.turn-indicator { font-size: 13px; color: var(--muted); }
.scenario-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.scenario-tile { cursor: pointer; transition: 0.15s; }
.scenario-tile:hover { border-color: var(--brand); transform: translateY(-2px); }

/* ----- Agent stage: round-robin turn-taking visualisation ----- */
.stage-wrap { display: flex; justify-content: center; }
.agent-ring { position: relative; width: 100%; max-width: 340px; aspect-ratio: 1; margin: 10px auto 14px; }
.stage-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ring-base { fill: none; stroke: var(--border-strong); stroke-width: 0.5; stroke-dasharray: 1.5 2.5; opacity: 0.7; }
.ring-arc {
  fill: none; stroke: var(--brand-2); stroke-width: 1.4; stroke-linecap: round;
  opacity: 0; transition: opacity 0.2s; filter: drop-shadow(0 0 3px var(--brand-2));
}
.ring-arc.show { opacity: 0.95; stroke-dasharray: 4 3; animation: ringflow 0.9s linear infinite; }
@keyframes ringflow { to { stroke-dashoffset: -14; } }
.stage-center {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  text-align: center; width: 100px; pointer-events: none;
}
.stage-turn { font-weight: 800; font-size: 14px; letter-spacing: 0.2px; }
.stage-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.stage-node {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: 78px; text-align: center; transition: opacity 0.25s;
}
.stage-node:not(.active) { opacity: 0.5; }
.stage-avatar-wrap { position: relative; }
.stage-avatar {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: #06080f; background: var(--accent);
  border: 2px solid transparent; transition: transform 0.25s, box-shadow 0.25s;
}
.stage-node.active .stage-avatar { border-color: #fff; transform: scale(1.18); animation: stagespeak 1.2s ease-in-out infinite; }
@keyframes stagespeak {
  0%, 100% { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.22), 0 0 14px var(--accent); }
  50% { box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.05), 0 0 28px var(--accent); }
}
.stage-turns {
  position: absolute; bottom: -5px; right: -5px; min-width: 16px; height: 16px; padding: 0 3px;
  border-radius: 999px; background: var(--panel-solid); border: 1px solid var(--border-strong);
  font-size: 10px; font-weight: 700; display: grid; place-items: center; color: var(--muted);
}
.stage-name { font-size: 11.5px; font-weight: 700; line-height: 1.1; }
.stage-prov { font-size: 9.5px; color: var(--faint); }

/* ----- Compare / Prompt Lab ----- */
.compare-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.compare-col .head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 700; }
.compare-col .out {
  white-space: pre-wrap; word-wrap: break-word; min-height: 80px; font-size: 14px;
  background: rgba(8, 12, 24, 0.5); border: 1px solid var(--border); border-radius: 10px; padding: 12px;
}
.compare-meta { font-size: 11.5px; color: var(--faint); margin-top: 8px; font-family: var(--mono); }
.provider-toggle { display: flex; flex-wrap: wrap; gap: 8px; }
.toggle-chip {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none;
  padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
}
.toggle-chip.on { color: var(--text); border-color: var(--brand); background: rgba(124, 108, 255, 0.14); }
.toggle-chip input { display: none; }
.toggle-chip i { width: 9px; height: 9px; border-radius: 50%; }

/* ----- Learn ----- */
.lesson-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.lesson-tile { cursor: pointer; transition: 0.15s; }
.lesson-tile:hover { border-color: var(--brand); transform: translateY(-2px); }
.lesson-tile .num { font-family: var(--mono); color: var(--faint); font-size: 12px; }
.lesson-body p { margin: 0 0 12px; }
.lesson-body strong { color: #fff; }
.token-widget { background: rgba(34, 211, 238, 0.05); }
.token-readout { display: flex; gap: 16px; margin-top: 10px; flex-wrap: wrap; }
.token-stat { font-size: 13px; color: var(--muted); }
.token-stat b { font-family: var(--mono); font-size: 17px; color: var(--brand-2); margin-right: 3px; }
.level-track { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }

/* ----- Settings ----- */
.key-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 12px; align-items: center; }
.key-row .name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.key-row .name i { width: 9px; height: 9px; border-radius: 50%; }

/* ----- Toast ----- */
.toast-host { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
  position: relative; overflow: hidden;
  padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 500;
  background: var(--panel-solid); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow); animation: toast-in 0.36s cubic-bezier(0.21, 1, 0.36, 1) both;
  max-width: 360px;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
/* Accent stripe on the left edge */
.toast::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--brand);
}
.toast.error { border-color: rgba(248, 113, 113, 0.5); }
.toast.error::before { background: var(--bad); }
.toast.success { border-color: rgba(52, 211, 153, 0.5); }
.toast.success::before { background: var(--good); }

.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 30; }
.empty { text-align: center; color: var(--faint); padding: 40px 20px; }

/* ==========================================================================
   Aesthetic enhancements — entrance choreography & micro-interactions
   ========================================================================== */

/* Staggered "rise" entrance for items in grids and lists. Because views are
   re-rendered on navigation, the choreography replays each time you switch. */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.grid.cols-3 > *,
.scenario-list > *,
.lesson-list > *,
.compare-grid > *,
.provider-chips > .pchip,
.stack > .key-row {
  animation: rise 0.5s cubic-bezier(0.21, 1, 0.36, 1) both;
}
.grid.cols-3 > *:nth-child(1), .scenario-list > *:nth-child(1),
.lesson-list > *:nth-child(1), .compare-grid > *:nth-child(1),
.provider-chips > .pchip:nth-child(1), .stack > .key-row:nth-child(1) { animation-delay: 0.04s; }
.grid.cols-3 > *:nth-child(2), .scenario-list > *:nth-child(2),
.lesson-list > *:nth-child(2), .compare-grid > *:nth-child(2),
.provider-chips > .pchip:nth-child(2), .stack > .key-row:nth-child(2) { animation-delay: 0.10s; }
.grid.cols-3 > *:nth-child(3), .scenario-list > *:nth-child(3),
.lesson-list > *:nth-child(3), .compare-grid > *:nth-child(3),
.provider-chips > .pchip:nth-child(3), .stack > .key-row:nth-child(3) { animation-delay: 0.16s; }
.grid.cols-3 > *:nth-child(4), .scenario-list > *:nth-child(4),
.lesson-list > *:nth-child(4), .compare-grid > *:nth-child(4),
.provider-chips > .pchip:nth-child(4), .stack > .key-row:nth-child(4) { animation-delay: 0.22s; }
.grid.cols-3 > *:nth-child(5), .scenario-list > *:nth-child(5),
.lesson-list > *:nth-child(5), .compare-grid > *:nth-child(5),
.provider-chips > .pchip:nth-child(5), .stack > .key-row:nth-child(5) { animation-delay: 0.28s; }
.grid.cols-3 > *:nth-child(n+6), .scenario-list > *:nth-child(n+6),
.lesson-list > *:nth-child(n+6), .compare-grid > *:nth-child(n+6),
.provider-chips > .pchip:nth-child(n+6), .stack > .key-row:nth-child(n+6) { animation-delay: 0.34s; }

/* Agent editor cards slide in as they're added */
.agent-card { animation: rise 0.4s cubic-bezier(0.21, 1, 0.36, 1) both; }

/* Cards: a soft accent glow lifts on hover for interactive ones */
.feature-card, .scenario-tile, .lesson-tile {
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.25s ease;
}
.feature-card:hover, .scenario-tile:hover, .lesson-tile:hover {
  box-shadow: 0 18px 44px -20px rgba(124, 108, 255, 0.55), var(--shadow);
}

/* Provider chips & toggles get a tactile hover */
.pchip, .toggle-chip { transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease; }
.pchip:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.toggle-chip:hover { transform: translateY(-2px); }
.toggle-chip.on { box-shadow: 0 6px 18px -8px rgba(124, 108, 255, 0.6); }

/* Persona/key dot pills pulse softly when a key is live */
.pill.on.dot::before { animation: pulse-dot 2.4s ease-in-out infinite; }
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 6px var(--good); }
  50% { box-shadow: 0 0 12px var(--good), 0 0 4px var(--good); }
}

/* Brand mark gently breathes */
.brand-mark { animation: breathe 6s ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { transform: translateY(0); box-shadow: 0 0 0 rgba(124, 108, 255, 0); }
  50% { transform: translateY(-2px); box-shadow: 0 8px 22px -10px rgba(124, 108, 255, 0.7); }
}

/* Inputs get a smoother lift on focus */
input:focus, select:focus, textarea:focus { transform: translateY(-1px); }

/* Section headings fade their content up on view entry */
.section-head { animation: rise 0.4s ease both; }

/* Empty-state placeholder breathes so it doesn't read as "broken" */
.empty { animation: rise 0.5s ease both; }

/* Respect users who prefer reduced motion — disable all the flourishes */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  html { scroll-behavior: auto; }
}

/* ----- Responsive ----- */
@media (max-width: 940px) {
  .chat-wrap, .sim-grid { grid-template-columns: 1fr; }
  .side-panel { position: static; }
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 40; width: 264px; transform: translateX(-110%);
    transition: transform 0.22s ease;
  }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .key-row { grid-template-columns: 1fr; }
  .view-host { padding: 18px 14px 70px; }
}
