/* ------------------------------------------------------------------
   klod-i-kot — стиль в духе ChatGPT
   Токены: светлая/тёмная тема, мягкие границы, спокойная типографика.
------------------------------------------------------------------ */

@font-face {
  font-family: "Zdravaya Misl";
  src: url("/assets/fonts/zdravaya-misl.woff2") format("woff2"),
       url("/assets/fonts/zdravaya-misl.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --font: "Söhne", "OpenAI Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont,
          "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: "Söhne Mono", ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;

  --bg: #ffffff;
  --bg-sidebar: #f9f9f9;
  --bg-elevated: #ffffff;
  --bg-subtle: #f4f4f4;
  --bg-hover: #ececec;
  --bg-active: #e6e6e6;
  --text: #0d0d0d;
  --text-2: #5d5d5d;
  --text-3: #8f8f8f;
  --border: rgba(13, 13, 13, .10);
  --border-strong: rgba(13, 13, 13, .18);
  --code-bg: #0d0d0d;
  --code-text: #ececec;
  --accent: #0d0d0d;
  --accent-text: #ffffff;
  --focus: rgba(13, 13, 13, .12);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-md: 0 4px 18px rgba(0, 0, 0, .06), 0 1px 3px rgba(0, 0, 0, .04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .10);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-pill: 999px;

  --sidebar-w: 264px;
  --topbar-h: 56px;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

[data-theme="dark"] {
  --bg: #212121;
  --bg-sidebar: #171717;
  --bg-elevated: #2a2a2a;
  --bg-subtle: #2f2f2f;
  --bg-hover: #2f2f2f;
  --bg-active: #383838;
  --text: #ececec;
  --text-2: #b4b4b4;
  --text-3: #8a8a8a;
  --border: rgba(255, 255, 255, .12);
  --border-strong: rgba(255, 255, 255, .20);
  --code-bg: #0d0d0d;
  --code-text: #ececec;
  --accent: #ffffff;
  --accent-text: #0d0d0d;
  --focus: rgba(255, 255, 255, .18);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 18px rgba(0, 0, 0, .35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
img { max-width: 100%; display: block; }
::selection { background: rgba(16, 163, 127, .22); }

:focus-visible {
  outline: 2px solid var(--border-strong);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------------------------------------------------------------- */
/* Каркас                                                           */
/* ---------------------------------------------------------------- */

.app { display: flex; height: 100dvh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 10px 8px 12px;
  gap: 2px;
  transition: margin-left .22s var(--ease), transform .22s var(--ease);
  z-index: 40;
}

.sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 6px 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -.01em;
  padding: 4px;
  border-radius: var(--r-sm);
}
.brand:hover { background: var(--bg-hover); }
.brand__mark { width: 24px; height: 24px; color: var(--text); display: grid; place-items: center; }
.brand__mark svg { width: 24px; height: 24px; }
.brand__mark img { width: 26px; height: 26px; border-radius: 8px; object-fit: cover; }
.brand__name {
  font-family: "Zdravaya Misl", var(--font);
  font-weight: 400;
  font-size: 20px;
  letter-spacing: 0;
  line-height: 1;
}

.sidebar__search {
  position: relative;
  display: flex;
  align-items: center;
  margin: 2px 4px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  height: 38px;
  padding: 0 10px;
  gap: 8px;
  transition: border-color .15s, box-shadow .15s;
}
.sidebar__search:focus-within { border-color: var(--border-strong); box-shadow: 0 0 0 3px var(--focus); }
.sidebar__search svg { width: 16px; height: 16px; color: var(--text-3); flex: none; }
.sidebar__search input {
  border: 0; background: none; outline: none; width: 100%; min-width: 0;
  font-size: 13.5px;
}
.sidebar__search input::placeholder { color: var(--text-3); }
.sidebar__search input::-webkit-search-cancel-button { display: none; }
.sidebar__search kbd {
  font-family: var(--font);
  font-size: 11px;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  line-height: 1.4;
}

.sidebar__nav { display: flex; flex-direction: column; gap: 1px; padding: 2px 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  color: var(--text);
  transition: background .12s;
  min-width: 0;
}
.nav-item svg { width: 17px; height: 17px; flex: none; color: var(--text-2); }
.nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: var(--bg-hover); }
.nav-item.is-active { background: var(--bg-active); font-weight: 500; }
.nav-item.is-active svg { color: var(--text); }

.sidebar__section { margin-top: 14px; min-height: 0; flex: 1; display: flex; flex-direction: column; }

.sidebar__label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-3);
  padding: 0 10px 6px;
  letter-spacing: .02em;
}

.project-nav {
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.project-nav::-webkit-scrollbar { width: 8px; }
.project-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

.project-nav__item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  color: var(--text-2);
  transition: background .12s, color .12s;
  min-width: 0;
}
.project-nav__item:hover { background: var(--bg-hover); color: var(--text); }
.project-nav__item.is-active { background: var(--bg-active); color: var(--text); font-weight: 500; }
.project-nav__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-3); flex: none; opacity: .6;
}
.project-nav__item.is-active .project-nav__dot { background: var(--text); opacity: 1; }
.project-nav__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-nav__empty { padding: 8px 10px; font-size: 12.5px; color: var(--text-3); }

.sidebar__foot {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sidebar__foot .nav-item { width: 100%; text-align: left; }

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 8px 2px;
  margin-top: 4px;
}
.sidebar__user-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; }
.sidebar__user-text strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__user-text span { font-size: 11.5px; color: var(--text-3); }

.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600; flex: none;
  user-select: none;
}
.avatar--sm { width: 26px; height: 26px; font-size: 11.5px; }

.icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--text-2);
  transition: background .12s, color .12s;
  flex: none;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

[data-theme="light"] .ic-moon { display: none; }
[data-theme="dark"] .ic-sun { display: none; }

/* ---------------------------------------------------------------- */
/* Основная область                                                 */
/* ---------------------------------------------------------------- */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }

.topbar {
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid transparent;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar.is-scrolled { border-bottom-color: var(--border); }
.topbar__menu { display: none; }
.topbar__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 11px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text-2);
  transition: background .12s, color .12s;
}
.ghost-btn:hover { background: var(--bg-hover); color: var(--text); }
.ghost-btn svg { width: 16px; height: 16px; }

.scroll { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.view { width: 100%; max-width: 792px; margin: 0 auto; padding: 0 20px 120px; }

/* ---------------------------------------------------------------- */
/* Главная                                                          */
/* ---------------------------------------------------------------- */

.hero {
  padding: clamp(28px, 9vh, 92px) 0 26px;
  text-align: center;
}
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-2);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 4px 10px 4px 8px;
  border-radius: var(--r-pill);
  margin-bottom: 18px;
}
.hero__eyebrow .pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: #19c37d; box-shadow: 0 0 0 3px rgba(25,195,125,.16);
}
.hero h1 {
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -.022em;
  margin: 0 0 10px;
}
.hero p {
  margin: 0 auto;
  max-width: 520px;
  color: var(--text-2);
  font-size: 14.5px;
}
.hero h1.hero__title-brand {
  font-family: "Zdravaya Misl", var(--font);
  font-weight: 400;
  font-size: clamp(32px, 5vw, 44px);
  letter-spacing: 0;
  line-height: 1.1;
}

.composer {
  margin: 26px auto 0;
  max-width: 720px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 8px 8px 8px 18px;
  box-shadow: var(--shadow-md);
  transition: border-color .18s, box-shadow .18s;
}
.composer:focus-within {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg), 0 0 0 3px var(--focus);
}
.composer input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: none;
  font-size: 15px;
  height: 36px;
}
.composer input::placeholder { color: var(--text-3); }
.composer__btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: grid; place-items: center;
  flex: none;
  transition: transform .15s, opacity .15s;
}
.composer__btn:hover { transform: scale(1.05); }
.composer__btn svg { width: 18px; height: 18px; }

.suggestions {
  margin: 14px auto 0;
  max-width: 720px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.suggestion {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  font-size: 13.5px;
  color: var(--text-2);
  text-align: left;
  transition: background .13s, border-color .13s, color .13s, transform .13s;
}
.suggestion:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  color: var(--text);
  transform: translateY(-1px);
}
.suggestion__icon { width: 16px; height: 16px; display: grid; place-items: center; flex: none; color: var(--text-3); }
.suggestion span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- */
/* Секции и карточки                                                */
/* ---------------------------------------------------------------- */

.section { margin-top: 44px; }
.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section__head h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  margin: 0;
}
.section__head .muted { font-size: 12.5px; color: var(--text-3); }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg);
  transition: border-color .15s, box-shadow .18s, transform .18s;
  min-height: 132px;
}
.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card__top { display: flex; align-items: flex-start; gap: 10px; }
.card__icon {
  width: 32px; height: 32px; flex: none;
  border-radius: 9px;
  display: grid; place-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 15px;
}
.card__icon svg { width: 17px; height: 17px; color: var(--text-2); }
.card__title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -.01em;
  margin: 0;
  padding-top: 2px;
  line-height: 1.35;
}
.card__arrow {
  margin-left: auto;
  color: var(--text-3);
  opacity: 0;
  transform: translate(-3px, 3px);
  transition: opacity .15s, transform .15s;
  flex: none;
}
.card__arrow svg { width: 16px; height: 16px; }
.card:hover .card__arrow { opacity: 1; transform: none; }
.card__desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__foot {
  margin-top: auto;
  padding-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  line-height: 1.4;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--bg-subtle);
  color: var(--text-2);
  white-space: nowrap;
}
.chip--outline { background: transparent; border: 1px solid var(--border); }
.chip--dot::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: .55;
}
.chip--draft { color: #b45309; background: rgba(217, 119, 6, .10); }
[data-theme="dark"] .chip--draft { color: #fbbf24; }
.chip--ver {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border-strong);
}
.chip--src { gap: 4px; padding: 2px 7px; font-family: var(--mono); font-size: 11px; }
.chip--src svg { width: 13px; height: 13px; }

.empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: 34px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13.5px;
}

/* ---------------------------------------------------------------- */
/* Страница проекта                                                 */
/* ---------------------------------------------------------------- */

.page { padding-top: 30px; }

.crumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-3);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.crumbs a { color: var(--text-2); }
.crumbs a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.crumbs span { color: var(--border-strong); }

.page-title {
  font-size: clamp(26px, 4.4vw, 36px);
  line-height: 1.15;
  letter-spacing: -.028em;
  font-weight: 600;
  margin: 0 0 12px;
}
.page-lead {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-2);
  margin: 0 0 18px;
  max-width: 640px;
}
.meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.cover {
  width: 100%;
  aspect-ratio: 16 / 8;
  object-fit: cover;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  margin-bottom: 28px;
  background: var(--bg-subtle);
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 28px 0 34px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .14s, border-color .14s, transform .14s, opacity .14s;
  border: 1px solid transparent;
}
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--accent); color: var(--accent-text); }
.btn--primary:hover { opacity: .88; }
.btn--secondary { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn--secondary:hover { background: var(--bg-subtle); }
.btn:active { transform: scale(.985); }
.btn--sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: var(--r-sm); gap: 5px; }
.btn--sm svg { width: 14px; height: 14px; }

.stack-box {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin: 30px 0 0;
  background: var(--bg-sidebar);
}
.stack-box h3 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--text-3);
}
.stack-box .chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* Версии проекта — вертикальный таймлайн */
.versions { margin-top: 40px; }
.timeline {
  position: relative;
  margin: 4px 0 0;
  padding-left: 22px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--border-strong);
}
.timeline__item { position: relative; padding-bottom: 22px; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__dot {
  position: absolute;
  left: -22px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--text-3);
  box-sizing: border-box;
}
.timeline__item:first-child .timeline__dot { background: var(--text); border-color: var(--text); }
.timeline__head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}
.timeline__date { font-size: 12.5px; color: var(--text-3); }
.timeline__body { min-width: 0; }
.timeline__notes { font-size: 14px; line-height: 1.6; color: var(--text-2); overflow-wrap: anywhere; }
.timeline__notes > :first-child { margin-top: 0; }
.timeline__notes > :last-child { margin-bottom: 0; }
.timeline__notes p { margin: 0 0 8px; }
.timeline__notes ul, .timeline__notes ol { margin: 0 0 8px; padding-left: 20px; }
.timeline__notes a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------------------------------------------------------------- */
/* Исходники проекта                                                */
/* ---------------------------------------------------------------- */

.code-meta { margin-bottom: 22px; font-size: 13.5px; color: var(--text-3); }

.code-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  min-height: 60vh;
  align-items: start;
}

.code-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  position: sticky;
  top: 8px;
  max-height: calc(100vh - 96px);
}

.code-search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  transition: border-color .15s, box-shadow .15s;
}
.code-search:focus-within { border-color: var(--border-strong); box-shadow: 0 0 0 3px var(--focus); }
.code-search svg { width: 15px; height: 15px; flex: none; color: var(--text-3); }
.code-search input {
  border: 0;
  background: none;
  outline: none;
  width: 100%;
  min-width: 0;
  font-size: 13px;
}
.code-search input::placeholder { color: var(--text-3); }
.code-search input::-webkit-search-cancel-button { display: none; }

.code-tree {
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(100vh - 190px);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-sidebar);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.code-tree::-webkit-scrollbar { width: 8px; }
.code-tree::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

.code-tree__dir { margin: 0; }
.code-tree__dir > summary { list-style: none; }
.code-tree__dir > summary::-webkit-details-marker { display: none; }
.code-tree__dir > summary::-moz-list-bullet { list-style: none; }
.code-tree__chev { transition: transform .15s var(--ease); }
.code-tree__dir:not([open]) > summary .code-tree__chev { transform: rotate(-90deg); }

.code-tree__row {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text-2);
  text-align: left;
  min-width: 0;
  transition: background .12s, color .12s;
}
.code-tree__row:hover { background: var(--bg-hover); color: var(--text); }
.code-tree__row.is-active { background: var(--bg-active); color: var(--text); font-weight: 500; }
.code-tree__row svg { width: 13px; height: 13px; flex: none; color: var(--text-3); }
.code-tree__row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-tree__row--dir { font-weight: 600; color: var(--text); font-size: 12px; cursor: pointer; }
.code-tree__row--dir svg { color: var(--text-2); }

.code-view {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg);
}
/* clip (в отличие от hidden) не создаёт скролл-контейнер, поэтому
   sticky-заголовок продолжает работать при прокрутке страницы */
@supports (overflow: clip) {
  .code-view { overflow: clip; }
}
.code-view--solo { min-height: 200px; }

.code-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 12px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
}
.code-head__path {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  min-width: 0;
  flex: 1 1 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.code-head__size { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }
.code-head__actions { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }

.code-pre {
  margin: 0;
  padding: 12px 0;
  overflow: auto;
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.65;
  tab-size: 2;
  color: var(--text);
  background: var(--bg);
  counter-reset: line;
}
.code-pre code { font-family: inherit; font-size: inherit; }
.code-line {
  display: block;
  white-space: pre;
  padding: 0 14px;
}
.code-line::before {
  counter-increment: line;
  content: counter(line);
  display: inline-block;
  width: 3ch;
  margin-right: 14px;
  color: var(--text-3);
  text-align: right;
  user-select: none;
}
.code-line:hover { background: var(--bg-subtle); }

.code-loading { display: flex; flex-direction: column; gap: 9px; padding: 20px; }
.code-empty {
  padding: 40px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}
.code-empty--small { padding: 14px 10px; font-size: 12.5px; text-align: left; }

/* ---------------------------------------------------------------- */
/* Markdown                                                         */
/* ---------------------------------------------------------------- */

.prose {
  font-size: 15.5px;
  line-height: 1.72;
  color: var(--text);
  overflow-wrap: anywhere;
}
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h2 {
  font-size: 20px;
  letter-spacing: -.018em;
  margin: 34px 0 10px;
  font-weight: 600;
}
.prose h3 {
  font-size: 16.5px;
  letter-spacing: -.012em;
  margin: 26px 0 8px;
  font-weight: 600;
}
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose li::marker { color: var(--text-3); }
.prose a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: currentColor; }
.prose strong { font-weight: 600; }
.prose blockquote {
  margin: 18px 0;
  padding: 2px 0 2px 15px;
  border-left: 2px solid var(--border-strong);
  color: var(--text-2);
}
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }
.prose code {
  font-family: var(--mono);
  font-size: .875em;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .12em .38em;
}
.prose pre {
  margin: 18px 0;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: var(--r-md);
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid rgba(255,255,255,.06);
}
.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: inherit;
}
.prose img { border-radius: var(--r-md); border: 1px solid var(--border); margin: 18px 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 18px 0; }
.prose th, .prose td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.prose th { background: var(--bg-subtle); font-weight: 600; }

/* ---------------------------------------------------------------- */
/* О сайте                                                          */
/* ---------------------------------------------------------------- */

.about-grid {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 34px;
  align-items: start;
  margin-top: 8px;
}
.contact-list { display: flex; flex-direction: column; gap: 2px; }
.contact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  color: var(--text-2);
}
.contact:hover { background: var(--bg-subtle); color: var(--text); }
.contact svg { width: 16px; height: 16px; flex: none; }
.contact span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- */
/* Служебное                                                        */
/* ---------------------------------------------------------------- */

.backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .35);
  z-index: 35;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.backdrop.is-open { opacity: 1; pointer-events: auto; }

.skeleton {
  background: linear-gradient(90deg, var(--bg-subtle) 0%, var(--bg-hover) 50%, var(--bg-subtle) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--r-md);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.fade-in { animation: fadeIn .32s var(--ease) both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.site-footer {
  margin-top: 54px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px 18px;
  font-size: 12px;
  color: var(--text-3);
}
.site-footer__left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.site-footer__note { color: var(--text-3); }
.site-footer__links { display: flex; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.site-footer__links a { color: var(--text-3); transition: color .12s; }
.site-footer__links a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* ---------------------------------------------------------------- */
/* Пустое состояние                                                 */
/* ---------------------------------------------------------------- */

.empty-state {
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-xl);
  padding: clamp(30px, 7vw, 52px) 24px;
  text-align: center;
  background: var(--bg);
}
.empty-state__logo {
  width: 150px;
  height: 150px;
  border-radius: 20px;
  object-fit: cover;
  margin: 0 auto 16px;
  box-shadow: var(--shadow-sm);
}
.noscript {
  max-width: 720px;
  margin: 40px auto;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text-2);
  line-height: 1.6;
}
.empty-state h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.015em;
  margin: 0 0 8px;
}
.empty-state p {
  margin: 0 auto;
  max-width: 420px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-2);
}

/* ---------------------------------------------------------------- */
/* Правовые страницы                                                */
/* ---------------------------------------------------------------- */

.legal-page { max-width: 720px; }
.legal-meta { margin: -4px 0 22px; font-size: 12.5px; color: var(--text-3); }
.legal-page .prose h2 { font-size: 17px; margin-top: 28px; }
.legal-page .prose ul { padding-left: 20px; }

/* ---------------------------------------------------------------- */
/* Cookie-баннер                                                    */
/* ---------------------------------------------------------------- */

.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  margin: 0 auto;
  max-width: 720px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}
.cookie-banner[hidden] { display: none; }
.cookie-banner__text {
  flex: 1 1 300px;
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-2);
}
.cookie-banner__text a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.cookie-banner__actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
body.has-cookie-banner .view { padding-bottom: 190px; }

@media (max-width: 560px) {
  .site-footer { grid-template-columns: 1fr; gap: 8px; }
  .site-footer__links { justify-content: flex-start; }
  .cookie-banner {
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    padding: 12px;
    gap: 10px;
  }
  .cookie-banner__text { flex: 1 1 100%; font-size: 12px; }
  .cookie-banner__actions { width: 100%; margin-left: 0; }
  .cookie-banner__actions .btn { flex: 1 1 0; }
}

/* ---------------------------------------------------------------- */
/* Адаптив                                                          */
/* ---------------------------------------------------------------- */

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-102%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: none; }
  .topbar__menu { display: grid; }
  .grid { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; gap: 22px; }
  .code-shell { grid-template-columns: 1fr; gap: 12px; min-height: 0; }
  .code-side { position: static; max-height: none; }
  .code-tree { flex: none; max-height: 260px; }
}

/* сворачивание сайдбара на десктопе */
@media (min-width: 901px) {
  .app.is-collapsed .sidebar { margin-left: calc(-1px - var(--sidebar-w)); }
  .app.is-collapsed .topbar__menu { display: grid; }
}

@media (max-width: 560px) {
  .view { padding: 0 14px 100px; }
  .topbar { padding: 0 10px; }
  .ghost-btn span { display: none; }
  .ghost-btn { width: 32px; padding: 0; justify-content: center; }
  .suggestions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .suggestion { padding: 9px 10px; font-size: 12.5px; gap: 7px; }
  .suggestion span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .composer { padding-left: 14px; }
  .hero { padding-top: 22px; }
  .hero p { font-size: 14px; }
  .card { min-height: 0; }
  .page { padding-top: 20px; }
  body.has-cookie-banner .view { padding-bottom: 220px; }
  .code-head { padding: 8px 10px; gap: 7px; }
  .code-head__actions { margin-left: 0; width: 100%; }
  .legal-page .prose h2 { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .scroll { scroll-behavior: auto; }
}

/* ------------------------------ реакции ------------------------------ */

.reactions { display: flex; align-items: center; gap: 10px; margin: 18px 0 4px; flex-wrap: wrap; }

.react-btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); background: var(--bg-subtle); color: var(--text-2);
  border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 13px;
  cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.react-btn:hover { border-color: var(--border-strong); color: var(--text); }
.react-btn.is-on { color: #b45309; border-color: rgba(180, 83, 9, .35); background: rgba(180, 83, 9, .08); }
.react-btn.is-on svg { fill: currentColor; }
[data-theme="dark"] .react-btn.is-on { color: #fbbf24; border-color: rgba(251, 191, 36, .35); background: rgba(251, 191, 36, .08); }
.react-btn:disabled { opacity: .6; cursor: progress; }
.react-btn span { font-variant-numeric: tabular-nums; }

.react-stat {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums;
}

/* ------------------------------ капча ------------------------------ */

.captcha-modal {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: 20px;
  background: rgba(20, 20, 20, .42); backdrop-filter: blur(3px);
}
.captcha-modal[hidden] { display: none; }
.captcha-modal__box {
  width: min(360px, 100%); background: var(--bg); border: 1px solid var(--border);
  border-radius: 16px; padding: 26px 24px; text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .22);
}
.captcha-modal__box h3 { font-size: 16px; margin: 14px 0 6px; }
.captcha-modal__box p { font-size: 12.5px; color: var(--text-3); margin-bottom: 18px; line-height: 1.5; }
.captcha-spinner {
  width: 30px; height: 30px; margin: 0 auto; border-radius: 50%;
  border: 2.5px solid var(--border); border-top-color: var(--text);
  animation: captcha-spin .8s linear infinite;
}
@keyframes captcha-spin { to { transform: rotate(360deg); } }

body.has-modal { overflow: hidden; }

.site-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 18px);
  background: var(--text); color: var(--bg); font-size: 13px;
  padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 90; max-width: calc(100vw - 40px);
}
.site-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

