@font-face { font-family: "Exo 2"; font-weight: 200; font-display: swap; src: url(/static/vendor/fonts/exo-2-cyrillic-200-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Exo 2"; font-weight: 200; font-display: swap; src: url(/static/vendor/fonts/exo-2-latin-200-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Exo 2"; font-weight: 300; font-display: swap; src: url(/static/vendor/fonts/exo-2-cyrillic-300-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Exo 2"; font-weight: 300; font-display: swap; src: url(/static/vendor/fonts/exo-2-latin-300-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Exo 2"; font-weight: 400; font-display: swap; src: url(/static/vendor/fonts/exo-2-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Exo 2"; font-weight: 400; font-display: swap; src: url(/static/vendor/fonts/exo-2-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Exo 2"; font-weight: 500; font-display: swap; src: url(/static/vendor/fonts/exo-2-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Exo 2"; font-weight: 500; font-display: swap; src: url(/static/vendor/fonts/exo-2-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Exo 2"; font-weight: 600; font-display: swap; src: url(/static/vendor/fonts/exo-2-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Exo 2"; font-weight: 600; font-display: swap; src: url(/static/vendor/fonts/exo-2-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url(/static/vendor/fonts/inter-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url(/static/vendor/fonts/inter-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url(/static/vendor/fonts/inter-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url(/static/vendor/fonts/inter-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url(/static/vendor/fonts/jetbrains-mono-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url(/static/vendor/fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

@property --sweep { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

:root {
  --bg: #07060d;
  --ink: #eeebf8;
  --ink-2: #cfcae2;
  --muted: #8e88a6;
  --faint: #5c5672;
  --line: rgba(196, 170, 255, .10);
  --line-2: rgba(196, 170, 255, .18);
  --glass: rgba(17, 14, 29, .62);
  --glass-2: rgba(255, 255, 255, .045);
  --accent: #b04bff;
  --accent-2: #dba3ff;
  --cyan: #4fe3ff;
  --magenta: #ff5bd9;
  --danger: #ff7a95;
  --hud: rgba(190, 120, 255, .9);
  --head: "Exo 2", "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(.7, 0, .2, 1);
  --stage-w: 31vw;
  --top: 26px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink); overflow: hidden;
  font: 15px/1.6 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .35; cursor: default; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
svg { display: block; }
::selection { background: rgba(176, 75, 255, .35); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .08); border-radius: 6px; }

/* ---------- атмосфера ---------- */
.space { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
.nebula {
  position: fixed; inset: -20%; z-index: 0; pointer-events: none; filter: blur(40px);
  background:
    radial-gradient(38% 32% at 62% 58%, rgba(140, 50, 255, .20), transparent 70%),
    radial-gradient(30% 26% at 34% 40%, rgba(60, 120, 255, .10), transparent 70%),
    radial-gradient(26% 22% at 72% 30%, rgba(255, 70, 210, .07), transparent 70%);
  animation: nebula 70s ease-in-out infinite alternate;
}
.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 55%, transparent 45%, rgba(0, 0, 0, .7) 100%);
}
.grain {
  position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: .055; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- кнопки ---------- */
.ghost-btn {
  width: 44px; height: 44px; border-radius: 14px; border: 1px solid transparent; background: none;
  color: var(--muted); display: grid; place-items: center; transition: color .25s, background .25s, border-color .25s;
}
.ghost-btn:hover:not(:disabled) { color: var(--ink); background: var(--glass-2); border-color: var(--line); }
.ghost-btn.active { color: #fff; background: rgba(176, 75, 255, .16); border-color: rgba(219, 163, 255, .3); }
.ghost-btn.small { width: 38px; height: 38px; border-radius: 12px; }
.ghost-btn svg, .send svg, .board-controls svg {
  width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.pill {
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, .035); border-radius: 999px;
  padding: 9px 18px; font-size: 14px; font-weight: 500; letter-spacing: .01em;
  transition: background .25s, border-color .25s, box-shadow .25s, transform .12s;
}
.pill:hover:not(:disabled) { background: rgba(176, 75, 255, .14); border-color: rgba(219, 163, 255, .4); }
.pill:active:not(:disabled) { transform: scale(.97); }
.pill.accent {
  border-color: transparent; color: #fff;
  background: linear-gradient(135deg, #8f2cff, #c35bff 60%, #e27bff);
  box-shadow: 0 8px 30px rgba(176, 75, 255, .4), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.pill.accent:hover:not(:disabled) { box-shadow: 0 10px 40px rgba(176, 75, 255, .6), inset 0 1px 0 rgba(255, 255, 255, .3); }
.pill.danger:hover:not(:disabled) { background: rgba(255, 122, 149, .12); border-color: rgba(255, 122, 149, .45); color: #ffd6df; }
.chip {
  font-size: 12px; color: var(--muted); padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .02);
}

/* ---------- углы ---------- */
.corner { position: fixed; z-index: 30; top: 18px; display: flex; align-items: center; gap: 4px; }
.corner-tl { left: 22px; }
.corner-tr { right: 30px; }
.hud-clock { flex-direction: column; align-items: flex-end; gap: 0; font-family: var(--mono); line-height: 1.3; pointer-events: none; }
#clock-time { font-size: 20px; color: var(--ink-2); letter-spacing: .08em; }
#clock-date { font-size: 10.5px; color: var(--faint); letter-spacing: .26em; text-transform: uppercase; }
.mode-home #go-home { display: none; }

/* ---------- главный экран ---------- */
.home {
  position: fixed; z-index: 3; left: 0; right: 0; top: 10.5vh; text-align: center; pointer-events: none;
  transition: opacity .7s var(--ease), transform 1s var(--ease), filter .7s;
}
.greeting {
  margin: 0; font: 200 clamp(56px, 4.6vw, 104px)/1.05 var(--head); letter-spacing: -.005em;
  background: linear-gradient(180deg, #ffffff 20%, #d9c8ff 75%, #b78cff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 40px rgba(176, 75, 255, .25));
  animation: greetIn 1.6s var(--ease) both .15s;
}
.greeting b { font-weight: 400; }
.phrase {
  margin: 22px 0 0; font: 300 clamp(18px, 1.15vw, 24px)/1.5 var(--head); color: var(--muted); letter-spacing: .02em;
  animation: fadeUp 1.4s var(--ease) both .7s;
}
.home-hint {
  position: fixed; z-index: 3; left: 0; right: 0; bottom: 4.2vh; text-align: center;
  font: 400 11px var(--mono); letter-spacing: .24em; text-transform: uppercase; color: var(--faint);
  animation: fadeUp 1.4s var(--ease) both 1.4s; transition: opacity .5s;
}
.home-hint .key {
  display: inline-block; padding: 3px 9px; margin-right: 6px; border-radius: 7px; color: var(--ink-2);
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, .03); letter-spacing: .14em;
}
.home-hint .sep { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--faint); margin: 0 14px 2px; }

.mode-session .home { opacity: 0; transform: translateY(-40px) scale(.97); filter: blur(8px); }
.mode-session .home-hint { animation: none; opacity: 0; pointer-events: none; }

/* ---------- сфера ---------- */
#orb {
  --ox: 50vw; --oy: 58vh; --os: min(60vh, 48vw);
  position: fixed; z-index: 6; left: var(--ox); top: var(--oy); width: var(--os); height: var(--os);
  transform: translate(-50%, -50%); cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent;
  transition: left 1.2s var(--ease), top 1.2s var(--ease), width 1.2s var(--ease), height 1.2s var(--ease);
  animation: orbIn 2s var(--ease) backwards;
}
.orb-gl { position: absolute; inset: 0; width: 100%; height: 100%; }
.orb-hud { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; transition: opacity .6s; }
.orb-hud line, .orb-hud circle { fill: none; stroke: var(--hud); transition: stroke 1s; }
.orb-hud .hud-ticks line { stroke-width: 1.2; opacity: .35; }
.orb-hud .hud-ticks line.mid { opacity: .6; stroke-width: 1.6; }
.orb-hud .hud-ticks line.maj { opacity: 1; stroke-width: 2.6; }
.orb-hud .hud-arcs circle { stroke-width: 4; stroke-linecap: round; opacity: .9; }
.orb-hud .hud-arcs2 circle { stroke-width: 1.6; opacity: .55; }
.orb-hud .hud-dots { stroke-width: 2.4; stroke-linecap: round; opacity: .35; }
.orb-hud .hud-faint { stroke-width: 1; opacity: .16; }
.orb-hud .hud-notches line { stroke-width: 2; opacity: .5; }
.orb-hud .hud-orbit circle, .orb-hud .hud-orbit2 circle { fill: var(--hud); stroke: none; filter: drop-shadow(0 0 6px var(--hud)); }
#orb[data-state="listening"] { --hud: rgba(79, 227, 255, .95); }
#orb[data-state="thinking"] { --hud: rgba(150, 130, 255, .95); }
#orb[data-state="speaking"] { --hud: rgba(255, 110, 230, .95); }
#orb:hover .orb-hud .hud-arcs circle { opacity: 1; }
#orb .orb-hud { filter: drop-shadow(0 0 10px color-mix(in srgb, var(--hud) 50%, transparent)); }
.orb-fallback .orb-gl { border-radius: 50%; inset: 22%; width: 56%; height: 56%;
  background: radial-gradient(circle at 40% 35%, #f3fbff, #b46dff 55%, #2a0d55); box-shadow: 0 0 80px #9b3cff; }

/* ---------- экран сессии: голос + доска ---------- */
.session {
  position: fixed; inset: var(--top) 26px 26px; z-index: 4; display: grid; gap: 28px;
  grid-template-columns: minmax(0, var(--stage-w)) minmax(0, 1fr);
  opacity: 0; pointer-events: none; transition: opacity .8s var(--ease) .25s;
  perspective: 2400px;
}
.mode-session .session { opacity: 1; pointer-events: auto; }
.stage { position: relative; display: grid; grid-template-rows: 1fr auto 1fr; align-items: center; justify-items: center; min-height: 0; }
.orb-slot { grid-row: 2; width: min(100%, 64vh); aspect-ratio: 1; }
.agent-status {
  grid-row: 3; align-self: start; margin-top: 4px; display: flex; align-items: center; gap: 10px;
  font: 400 11.5px var(--mono); letter-spacing: .26em; text-transform: uppercase; color: var(--muted);
  transition: color .4s;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.status-sep { width: 18px; height: 1px; background: var(--line-2); }
.session-ended .status-sep, .session-ended #session-timer { display: none; }
body[data-orb="listening"] .status-dot { background: var(--cyan); box-shadow: 0 0 14px var(--cyan); animation: pulse 1.1s ease-in-out infinite; }
body[data-orb="thinking"] .status-dot { background: #9b8aff; box-shadow: 0 0 14px #9b8aff; animation: pulse .7s ease-in-out infinite; }
body[data-orb="speaking"] .status-dot { background: var(--magenta); box-shadow: 0 0 14px var(--magenta); animation: pulse .5s ease-in-out infinite; }
body[data-orb="listening"] .agent-status { color: var(--cyan); }
body[data-orb="thinking"] .agent-status { color: #b9adff; }
body[data-orb="speaking"] .agent-status { color: #ffb3ef; }

/* сфера и доска стоят под углом друг к другу, пока Адрен слушает и думает,
   и выпрямляются, когда он отвечает */
.mode-session #orb { transform: translate(-50%, -50%) perspective(1600px) rotateY(16deg); }
.mode-session .board-wrap { transform-origin: 100% 50%; transform: perspective(2600px) rotateY(-13deg); }
.mode-session[data-orb="speaking"] #orb { transform: translate(-50%, -50%) perspective(1600px) rotateY(0deg); }
.mode-session[data-orb="speaking"] .board-wrap { transform: perspective(2600px) rotateY(0deg) scale(1); }
#orb, .board-wrap { transition: left 1.2s var(--ease), top 1.2s var(--ease), width 1.2s var(--ease), height 1.2s var(--ease), transform 1.4s var(--ease); }

.toasts { position: fixed; z-index: 60; left: 50%; bottom: 28px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  padding: 10px 18px; border-radius: 14px; font-size: 14px; color: var(--ink);
  background: rgba(20, 15, 32, .92); border: 1px solid var(--line-2); backdrop-filter: blur(12px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5); animation: fadeUp .4s var(--ease) both; transition: opacity .5s, transform .5s;
}
.toast.error { border-color: rgba(255, 122, 149, .45); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- доска ---------- */
.board-wrap {
  position: relative; min-width: 0; min-height: 0; border-radius: 30px; overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(14, 11, 26, .55), rgba(8, 6, 16, .62));
  box-shadow: 0 30px 80px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .035);
  backdrop-filter: blur(6px);
  transform: translateX(30px); transition: transform 1.1s var(--ease);
}
.board-top {
  position: absolute; z-index: 3; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 24px 28px 40px; pointer-events: none;
  background: linear-gradient(180deg, rgba(8, 6, 16, .82), rgba(8, 6, 16, 0));
}
.board-top > * { pointer-events: auto; }
.board-date { font: 400 12px var(--mono); letter-spacing: .26em; text-transform: uppercase; color: var(--muted); }

.board { position: absolute; inset: 0; }
.board-viewport {
  position: absolute; inset: 0; overflow: hidden; cursor: grab; touch-action: none;
  background-image: radial-gradient(rgba(200, 180, 255, .16) 1px, transparent 1.3px);
  background-size: 28px 28px;
}
.board-viewport.panning { cursor: grabbing; }
.board-viewport.animate { transition: background-position .9s var(--ease), background-size .9s var(--ease); }
.board-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.board-world.animate { transition: transform .9s var(--ease); }

.board-empty {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px;
  text-align: center; pointer-events: none; transition: opacity .6s;
}
.board.has-cards .board-empty { opacity: 0; }
.board-empty-mark {
  width: 120px; height: 120px; margin-bottom: 18px; border-radius: 50%; position: relative;
  border: 1px solid var(--line-2);
  background: radial-gradient(circle, rgba(176, 75, 255, .14), transparent 65%);
}
.board-empty-mark::before, .board-empty-mark::after {
  content: ""; position: absolute; inset: -18px; border-radius: 50%; border: 1px dashed rgba(196, 170, 255, .14);
  animation: spin 40s linear infinite;
}
.board-empty-mark::after { inset: 26px; border-style: solid; border-color: rgba(219, 163, 255, .28); animation: breathe 4s ease-in-out infinite; }
.board-empty p { margin: 0; font: 300 24px var(--head); color: var(--ink-2); letter-spacing: .02em; }
.board-empty span { color: var(--faint); font-size: 14px; }

.board-controls {
  position: absolute; z-index: 3; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 2px; padding: 4px;
  background: rgba(14, 11, 26, .75); border: 1px solid var(--line); border-radius: 16px; backdrop-filter: blur(10px);
}
.board-controls button {
  width: 38px; height: 38px; border-radius: 12px; border: none; background: none; color: var(--muted);
  font-size: 20px; line-height: 1; display: grid; place-items: center; transition: background .2s, color .2s;
}
.board-controls button:hover { background: var(--glass-2); color: var(--ink); }
.board-controls svg { width: 18px; height: 18px; }

/* карточки */
.card {
  position: absolute; left: 0; top: 0; width: 580px;
  background: linear-gradient(180deg, rgba(31, 24, 52, .94), rgba(15, 12, 27, .96));
  border: 1px solid rgba(206, 178, 255, .14); border-radius: 24px;
  box-shadow: 0 40px 90px rgba(0, 0, 0, .5), 0 0 0 1px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .06);
  color: var(--ink);
}
.card.enter { animation: cardIn 1s var(--ease) both; }
.card.dragging { box-shadow: 0 60px 120px rgba(0, 0, 0, .6), 0 0 0 1px rgba(219, 163, 255, .35); z-index: 2; }
.card-glow {
  position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; pointer-events: none; opacity: 0;
  background: conic-gradient(from var(--sweep), transparent 0deg, transparent 220deg, var(--accent-2) 300deg, #fff 330deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.card.enter .card-glow, .card.updated .card-glow { animation: sweep 2.2s var(--ease) both; }
.card-head {
  display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 12px; row-gap: 6px;
  padding: 20px 26px 14px; cursor: grab; user-select: none;
}
.card.dragging .card-head { cursor: grabbing; }
.card-index { font: 400 11px var(--mono); color: var(--accent-2); letter-spacing: .12em; }
.card-kind { font: 400 10.5px var(--mono); color: var(--faint); letter-spacing: .26em; text-transform: uppercase; }
.card h3 { grid-column: 1 / -1; margin: 0; font: 400 24px/1.25 var(--head); letter-spacing: .005em; color: #fff; }
.card-body { padding: 4px 26px 26px; font-size: 16px; line-height: 1.65; color: var(--ink-2); cursor: auto; user-select: text; }
.card[data-kind="mermaid"] .card-body { display: grid; place-items: center; padding: 14px 24px 28px; }
.card-body svg { max-width: 100%; height: auto; }
.card-body h1, .card-body h2, .card-body h3, .card-body h4 { font-family: var(--head); font-weight: 500; color: #fff; margin: 1em 0 .4em; }
.card-body > :first-child { margin-top: 0; }
.card-body > :last-child { margin-bottom: 0; }
.card-body ul, .card-body ol { padding-left: 1.3em; }
.card-body li { margin: .25em 0; }
.card-body li::marker { color: var(--accent-2); }
.card-body strong { color: #fff; font-weight: 500; }
.card-body table { border-collapse: collapse; width: 100%; font-size: 15px; }
.card-body th, .card-body td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.card-body th { color: var(--accent-2); font: 400 11px var(--mono); letter-spacing: .18em; text-transform: uppercase; }
.card-body blockquote { margin: .8em 0; padding: 4px 0 4px 16px; border-left: 2px solid var(--accent); color: var(--ink); }
.card-body code { font-family: var(--mono); font-size: .88em; background: var(--glass-2); padding: 2px 6px; border-radius: 6px; }
.card[data-kind="summary"] { border-color: rgba(219, 163, 255, .32); background: linear-gradient(160deg, rgba(58, 28, 98, .95), rgba(18, 13, 32, .97)); }
.card[data-kind="html"] .card-body { padding: 6px 22px 22px; }
.card-frame { display: block; width: 100%; border: 0; background: transparent; color-scheme: dark; }
.card-error { color: var(--danger); white-space: pre-wrap; font: 12px var(--mono); }

/* ---------- история ---------- */
.drawer {
  position: fixed; z-index: 40; top: 26px; bottom: 26px; left: 26px; width: 400px;
  background: rgba(14, 11, 25, .94); border: 1px solid var(--line-2); border-radius: 26px; backdrop-filter: blur(20px);
  display: flex; flex-direction: column; padding: 18px; gap: 10px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, .6);
  transform: translateX(-30px); opacity: 0; pointer-events: none; transition: transform .45s var(--ease), opacity .35s;
}
.drawer.open { transform: none; opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; font: 300 22px var(--head); padding-left: 6px; }
.sessions { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -6px; padding: 0 6px; }
.session-item { display: flex; align-items: center; gap: 4px; border: 1px solid transparent; border-radius: 16px; transition: background .2s, border-color .2s; }
.session-item:hover { background: var(--glass-2); border-color: var(--line); }
.session-item.active { background: rgba(176, 75, 255, .12); border-color: rgba(219, 163, 255, .25); }
.session-item .open { flex: 1; min-width: 0; text-align: left; background: none; border: none; padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.session-item .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-size: 15px; }
.session-item .d { font: 400 11.5px var(--mono); color: var(--faint); letter-spacing: .04em; }
.session-item .ghost-btn { opacity: 0; margin-right: 6px; }
.session-item:hover .ghost-btn { opacity: 1; }

/* ---------- настройки ---------- */
dialog {
  width: min(1180px, calc(100vw - 48px)); height: min(86vh, 940px); padding: 0; color: var(--ink);
  background: rgba(14, 11, 25, .97); border: 1px solid var(--line-2); border-radius: 28px;
  box-shadow: 0 40px 120px rgba(0, 0, 0, .7);
}
dialog[open] { display: flex; flex-direction: column; animation: dialogIn .5s var(--ease) both; }
dialog::backdrop { background: rgba(4, 3, 9, .6); backdrop-filter: blur(6px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 16px 14px 18px; border-bottom: 1px solid var(--line); }
.dialog-meta { display: flex; align-items: center; gap: 10px; }
.version { font-size: 11.5px; color: var(--faint); letter-spacing: .12em; }
.tabs { display: flex; gap: 4px; }
.tabs button { background: none; border: 1px solid transparent; border-radius: 999px; padding: 7px 16px; color: var(--muted); }
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: #fff; background: rgba(176, 75, 255, .15); border-color: rgba(219, 163, 255, .3); }
.dialog-body { flex: 1; overflow: auto; padding: 22px; }
.tab { display: flex; flex-direction: column; gap: 16px; min-height: 100%; }
.tab p { margin: 0; }
.tab textarea {
  resize: vertical; border: 1px solid var(--line); border-radius: 16px; background: rgba(0, 0, 0, .3);
  padding: 14px 16px; font: 14px/1.6 "Inter", sans-serif; outline: none; color: var(--ink-2);
}
.tab textarea.doc { flex: 1; min-height: 320px; resize: none; font: 13px/1.65 var(--mono); }
.tab textarea:focus { border-color: rgba(219, 163, 255, .35); }
.tab > .pill { align-self: flex-start; }
.file-btn { align-self: flex-start; font-size: 13px; color: var(--accent-2); cursor: pointer; }
.file-btn input { display: none; }
.settings-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label { font: 400 11px var(--mono); letter-spacing: .22em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; }
.field .hint { font-size: 12.5px; color: var(--faint); }
.segmented { display: flex; padding: 4px; gap: 4px; border: 1px solid var(--line); border-radius: 14px; background: rgba(0, 0, 0, .25); }
.segmented button { flex: 1; border: none; background: none; color: var(--muted); padding: 9px 10px; border-radius: 10px; transition: background .2s, color .2s; }
.segmented button.active { background: rgba(176, 75, 255, .2); color: #fff; box-shadow: inset 0 0 0 1px rgba(219, 163, 255, .3); }
input[type=range] { accent-color: var(--accent); width: 100%; margin: 10px 0 2px; }
.voice-group { margin-top: 6px; }
.voice-group-title { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--faint); margin: 8px 0 10px; }
.voice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.voice {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; cursor: pointer;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .02); transition: background .2s, border-color .2s, box-shadow .2s;
}
.voice:hover { background: rgba(255, 255, 255, .045); border-color: var(--line-2); }
.voice.selected { border-color: rgba(219, 163, 255, .55); background: rgba(176, 75, 255, .12); box-shadow: 0 0 0 4px rgba(176, 75, 255, .08); }
.voice.unavailable { opacity: .4; }
.voice .play {
  width: 38px; height: 38px; flex: none; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .04);
  display: grid; place-items: center; color: var(--ink);
}
.voice .play svg { width: 15px; height: 15px; fill: currentColor; margin-left: 2px; }
.voice .play:hover { background: rgba(176, 75, 255, .25); }
.voice.loading .play { animation: pulse .8s ease-in-out infinite; }
.voice.loading .play svg, .voice.playing .play svg { margin-left: 0; }
.voice.playing { border-color: rgba(219, 163, 255, .4); }
.voice.playing .play { background: rgba(176, 75, 255, .35); border-color: rgba(219, 163, 255, .6); }
.voice-info { flex: 1; min-width: 0; }
.voice-name { display: flex; align-items: baseline; gap: 8px; color: #fff; font-weight: 500; }
.voice-name em { font: normal 400 10.5px var(--mono); color: var(--faint); letter-spacing: .1em; }
.voice-desc { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-check { color: var(--accent-2); opacity: 0; font-size: 15px; }
.voice.selected .voice-check { opacity: 1; }
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 16px 18px; border-radius: 18px; border: 1px solid var(--line); background: rgba(255, 255, 255, .02); display: flex; flex-direction: column; gap: 4px; }
.stat:first-child { border-color: rgba(219, 163, 255, .35); background: rgba(176, 75, 255, .1); }
.stat-label { font: 400 10.5px var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-size: 24px; color: #fff; }
.stat-sub { font-size: 12px; color: var(--faint); }
.model-line { font-size: 13px; }
.cost-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cost-table th { text-align: left; font: 400 10.5px var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--faint); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.cost-table td { padding: 10px; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.cost-table td:last-child, .cost-table th:last-child { text-align: right; }
.mem-file { border: 1px solid var(--line); background: rgba(255, 255, 255, .02); border-radius: 18px; padding: 14px 20px; margin-bottom: 14px; }
.mem-file h4 { margin: 0 0 8px; font: 400 12px var(--mono); color: var(--accent-2); letter-spacing: .04em; }
.log-item { border-bottom: 1px solid var(--line); padding: 12px 0; font-size: 13px; }
.log-item pre { white-space: pre-wrap; margin: 6px 0 0; color: var(--muted); font: 12px/1.55 var(--mono); }

/* ---------- вход ---------- */
.login-page { display: grid; place-items: center; }
.login-card { position: relative; z-index: 5; width: 360px; display: flex; flex-direction: column; gap: 12px; animation: fadeUp 1.2s var(--ease) both .3s; }
.login-orb { position: relative; width: 300px; height: 300px; margin: 0 auto 10px; }
.login-card input {
  border: 1px solid var(--line-2); border-radius: 16px; padding: 13px 18px; background: rgba(10, 8, 20, .7); outline: none;
  backdrop-filter: blur(10px); transition: border-color .25s, box-shadow .25s;
}
.login-card input:focus { border-color: rgba(219, 163, 255, .45); box-shadow: 0 0 0 5px rgba(176, 75, 255, .1); }
.login-card .pill { padding: 13px; font-size: 15px; margin-top: 4px; }
.error { color: var(--danger); min-height: 1.3em; margin: 0; text-align: center; font-size: 14px; }

/* ---------- анимации ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0%, 100% { opacity: .55; transform: scale(.96); } 50% { opacity: 1; transform: scale(1.04); } }
@keyframes pulse { 0%, 100% { opacity: .55; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.15); } }
@keyframes caret { 50% { opacity: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes greetIn {
  from { opacity: 0; letter-spacing: .08em; filter: blur(14px) drop-shadow(0 0 40px rgba(176, 75, 255, .25)); }
  to { opacity: 1; letter-spacing: -.005em; filter: blur(0) drop-shadow(0 0 40px rgba(176, 75, 255, .25)); }
}
@keyframes orbIn { from { opacity: 0; transform: translate(-50%, -50%) scale(.7); filter: blur(20px); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); filter: blur(0); } }
@keyframes cardIn {
  0% { opacity: 0; filter: blur(10px); scale: .9; translate: 0 26px; }
  60% { opacity: 1; filter: blur(0); }
  100% { opacity: 1; scale: 1; translate: 0 0; }
}
@keyframes sweep { 0% { opacity: 0; --sweep: 0deg; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; --sweep: 360deg; } }
@keyframes dialogIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes nebula { from { transform: translate3d(-2%, -1%, 0) scale(1); } to { transform: translate3d(2%, 1.5%, 0) scale(1.08); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01s !important; transition-duration: .01s !important; }
}

/* ---------- 27" и больше: всё чуть крупнее ---------- */
@media (min-width: 2200px) {
  :root { --top: 30px; }
  body { font-size: 16px; }
  .card h3 { font-size: 27px; }
  .card-body { font-size: 17.5px; }
  .card-body table { font-size: 16.5px; }
  .agent-status { font-size: 12.5px; }
  .pill { font-size: 15px; padding: 10px 20px; }
  #clock-time { font-size: 22px; }
  .board-date { font-size: 13px; }
}

/* ---------- 1.4: копирование, фокус, подключения ---------- */
.card-head { grid-template-columns: auto 1fr auto; }
.card h3 { grid-column: 1 / -1; }
.card-copy {
  justify-self: end; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 8px;
  border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); color: var(--muted);
  font: 400 11px var(--mono); letter-spacing: .08em; cursor: pointer; opacity: 0; transition: opacity .2s, color .2s, background .2s, border-color .2s;
}
.card:hover .card-copy, .card-copy.done, .card-copy.fail { opacity: 1; }
.card-copy:hover { color: #fff; background: rgba(42, 171, 238, .16); border-color: rgba(42, 171, 238, .45); }
.card-copy svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.card-copy.done { color: #8ff0c4; border-color: rgba(95, 242, 176, .45); }
.card-copy.fail { color: var(--danger); }
.card[data-kind="mermaid"] .card-copy { display: none; }
.card.spotlight { animation: spotlight 1.8s var(--ease); }
@keyframes spotlight {
  0% { box-shadow: 0 40px 90px rgba(0, 0, 0, .5), 0 0 0 1px rgba(219, 163, 255, .2); }
  30% { box-shadow: 0 40px 90px rgba(0, 0, 0, .5), 0 0 0 2px rgba(219, 163, 255, .9), 0 0 60px rgba(176, 75, 255, .45); }
  100% { box-shadow: 0 40px 90px rgba(0, 0, 0, .5), 0 0 0 1px rgba(0, 0, 0, .3); }
}
.agent-status { margin-top: 10px; }
.keys { font-size: 11px; color: var(--faint); letter-spacing: .08em; margin-right: 8px; }
.toast.ok { border-color: rgba(95, 242, 176, .4); }
.integration {
  border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; margin-bottom: 12px;
  background: rgba(255, 255, 255, .02); display: flex; flex-direction: column; gap: 12px;
}
.integration.connected { border-color: rgba(95, 242, 176, .3); background: rgba(95, 242, 176, .035); }
.integration-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.integration-name { font: 500 17px var(--head); color: #fff; }
.integration-desc { font-size: 13px; color: var(--muted); }
.integration-status { font-size: 11px; letter-spacing: .1em; color: var(--faint); white-space: nowrap; }
.integration.connected .integration-status { color: #8ff0c4; }
.integration-row { display: flex; gap: 8px; }
.integration-row input {
  flex: 1; border: 1px solid var(--line); border-radius: 12px; background: rgba(0, 0, 0, .3);
  padding: 9px 14px; outline: none; font: 13px var(--mono); color: var(--ink);
}
.integration-row input:focus { border-color: rgba(219, 163, 255, .4); }
.integration-links { display: flex; gap: 18px; font-size: 12.5px; }
.integration-links a { color: var(--accent-2); text-decoration: none; }
.integration-links a:hover { text-decoration: underline; }
