/* ===== Оформление по образцу платформы NeoFamily (neofamily.ru/task-bank) =====
   Шрифт Comfortaa, текст #302A3E, светлый фон, белая рабочая панель со скруглением,
   кнопки-«таблетки», пастельные плашки разделов как у предметов. */

:root {
  --bg: #f9f8fb;
  --panel: #ffffff;
  --surface-2: #f9f8fb;
  --surface-3: #f2f1f6;
  --hover: rgba(48, 42, 62, 0.06);
  --text: #302a3e;
  --text-2: rgba(48, 42, 62, 0.8);
  --muted: rgba(48, 42, 62, 0.6);
  --disabled: #c1c0c6;
  --border: #efedf2;
  --border-input: #c1c0c6;
  --dark: #302a3e;
  --on-dark: #ffffff;

  --pink: #e8558c;
  --pink-hover: #d63d77;
  --pink-chip: rgba(245, 177, 178, 0.6);
  --pink-soft: #fdeaf0;

  /* палитра предметов платформы */
  --tone-1: rgba(205, 224, 164, 0.6); /* биология */
  --tone-2: rgba(249, 228, 137, 0.6); /* русский */
  --tone-3: rgba(212, 221, 238, 0.6); /* химия */
  --tone-4: rgba(179, 212, 228, 0.6); /* математика */
  --tone-5: rgba(173, 162, 205, 0.6); /* обществознание */
  --tone-6: rgba(245, 198, 170, 0.6); /* история */
  --tone-7: rgba(118, 193, 193, 0.6); /* физика */
  --tone-8: rgba(244, 190, 154, 0.6); /* литература */
  --tone-9: rgba(243, 177, 178, 0.6); /* география */
  --tone-10: rgba(124, 184, 224, 0.6); /* английский */
  --green: #7fa53a;
  --amber: #e2a10f;
  --purple: #7d6fb3;
  --danger: #d63d4a;

  --shadow: 0 8px 30px rgba(48, 42, 62, 0.08);
  --shadow-lg: 0 20px 60px rgba(48, 42, 62, 0.2);
  --radius-panel: 32px;
  --radius-lg: 20px;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 272px;
  --rail-w: 104px;

  --font: 'Comfortaa', 'Mulish', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='112' viewBox='0 0 140 112' fill='%23302A3E' fill-opacity='.045'%3E%3Cpath d='M14 18h22a6 6 0 0 1 6 6v12a6 6 0 0 1-6 6H24l-7 6v-6h-3a6 6 0 0 1-6-6V24a6 6 0 0 1 6-6z'/%3E%3Ccircle cx='78' cy='26' r='9'/%3E%3Ccircle cx='96' cy='34' r='5'/%3E%3Crect x='112' y='14' width='18' height='18' rx='5' transform='rotate(12 121 23)'/%3E%3Cpath d='M48 76c6-10 22-10 28 0-6 10-22 10-28 0zm14-4a4 4 0 1 0 0 8 4 4 0 0 0 0-8z'/%3E%3Crect x='96' y='70' width='22' height='14' rx='7'/%3E%3Ccircle cx='20' cy='86' r='6'/%3E%3C/svg%3E");
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #1b1922;
    --panel: #24212d;
    --surface-2: #2c2936;
    --surface-3: #33303e;
    --hover: rgba(255, 255, 255, 0.06);
    --text: #ecebf1;
    --text-2: rgba(236, 235, 241, 0.82);
    --muted: rgba(236, 235, 241, 0.6);
    --disabled: #5b5868;
    --border: #383445;
    --border-input: #4d495a;
    --dark: #ecebf1;
    --on-dark: #24212d;
    --pink: #f27aa6;
    --pink-hover: #ff93ba;
    --pink-chip: rgba(245, 177, 178, 0.25);
    --pink-soft: rgba(242, 122, 166, 0.14);
    --tone-1: rgba(205, 224, 164, 0.16);
    --tone-2: rgba(249, 228, 137, 0.14);
    --tone-3: rgba(212, 221, 238, 0.14);
    --tone-4: rgba(179, 212, 228, 0.16);
    --tone-5: rgba(173, 162, 205, 0.2);
    --tone-6: rgba(245, 198, 170, 0.16);
    --tone-7: rgba(118, 193, 193, 0.18);
    --tone-8: rgba(244, 190, 154, 0.16);
    --tone-9: rgba(243, 177, 178, 0.18);
    --tone-10: rgba(124, 184, 224, 0.18);
    --green: #a9cf62;
    --amber: #f2c14c;
    --purple: #b0a5e0;
    --danger: #ff7a85;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.55);
    --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='112' viewBox='0 0 140 112' fill='%23FFFFFF' fill-opacity='.05'%3E%3Cpath d='M14 18h22a6 6 0 0 1 6 6v12a6 6 0 0 1-6 6H24l-7 6v-6h-3a6 6 0 0 1-6-6V24a6 6 0 0 1 6-6z'/%3E%3Ccircle cx='78' cy='26' r='9'/%3E%3Ccircle cx='96' cy='34' r='5'/%3E%3Crect x='112' y='14' width='18' height='18' rx='5' transform='rotate(12 121 23)'/%3E%3Cpath d='M48 76c6-10 22-10 28 0-6 10-22 10-28 0zm14-4a4 4 0 1 0 0 8 4 4 0 0 0 0-8z'/%3E%3Crect x='96' y='70' width='22' height='14' rx='7'/%3E%3Ccircle cx='20' cy='86' r='6'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #1b1922;
  --panel: #24212d;
  --surface-2: #2c2936;
  --surface-3: #33303e;
  --hover: rgba(255, 255, 255, 0.06);
  --text: #ecebf1;
  --text-2: rgba(236, 235, 241, 0.82);
  --muted: rgba(236, 235, 241, 0.6);
  --disabled: #5b5868;
  --border: #383445;
  --border-input: #4d495a;
  --dark: #ecebf1;
  --on-dark: #24212d;
  --pink: #f27aa6;
  --pink-hover: #ff93ba;
  --pink-chip: rgba(245, 177, 178, 0.25);
  --pink-soft: rgba(242, 122, 166, 0.14);
  --tone-1: rgba(205, 224, 164, 0.16);
  --tone-2: rgba(249, 228, 137, 0.14);
  --tone-3: rgba(212, 221, 238, 0.14);
  --tone-4: rgba(179, 212, 228, 0.16);
  --tone-5: rgba(173, 162, 205, 0.2);
  --tone-6: rgba(245, 198, 170, 0.16);
  --tone-7: rgba(118, 193, 193, 0.18);
  --tone-8: rgba(244, 190, 154, 0.16);
  --tone-9: rgba(243, 177, 178, 0.18);
  --tone-10: rgba(124, 184, 224, 0.18);
  --green: #a9cf62;
  --amber: #f2c14c;
  --purple: #b0a5e0;
  --danger: #ff7a85;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.55);
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='112' viewBox='0 0 140 112' fill='%23FFFFFF' fill-opacity='.05'%3E%3Cpath d='M14 18h22a6 6 0 0 1 6 6v12a6 6 0 0 1-6 6H24l-7 6v-6h-3a6 6 0 0 1-6-6V24a6 6 0 0 1 6-6z'/%3E%3Ccircle cx='78' cy='26' r='9'/%3E%3Ccircle cx='96' cy='34' r='5'/%3E%3Crect x='112' y='14' width='18' height='18' rx='5' transform='rotate(12 121 23)'/%3E%3Cpath d='M48 76c6-10 22-10 28 0-6 10-22 10-28 0zm14-4a4 4 0 1 0 0 8 4 4 0 0 0 0-8z'/%3E%3Crect x='96' y='70' width='22' height='14' rx='7'/%3E%3Ccircle cx='20' cy='86' r='6'/%3E%3C/svg%3E");
  color-scheme: dark;
}

.tone-1 { --tone: var(--tone-1); }
.tone-2 { --tone: var(--tone-2); }
.tone-3 { --tone: var(--tone-3); }
.tone-4 { --tone: var(--tone-4); }
.tone-5 { --tone: var(--tone-5); }
.tone-6 { --tone: var(--tone-6); }
.tone-7 { --tone: var(--tone-7); }
.tone-8 { --tone: var(--tone-8); }
.tone-9 { --tone: var(--tone-9); }
.tone-10 { --tone: var(--tone-10); }

/* ===== База ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 90px;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
  text-decoration: none;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
[hidden] {
  display: none !important;
}
.icon {
  width: 20px;
  height: 20px;
  flex: none;
}
.muted {
  color: var(--muted);
}
.accent {
  color: var(--pink);
}
kbd {
  font: 700 11px/1 var(--font);
  padding: 4px 7px;
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-3);
}
:focus-visible {
  outline: 2px solid var(--dark);
  outline-offset: 2px;
}
::selection {
  background: var(--pink-chip);
}

/* ===== Каркас: боковое меню + рабочая панель ===== */
.app {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: var(--sidebar-w);
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 18px 16px 16px;
  overflow: hidden;
  transition: width 0.25s ease;
}
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-right: 20px;
}
.panel {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 32px 40px 64px;
  border-radius: var(--radius-panel) var(--radius-panel) 0 0;
  background: var(--panel);
}

/* ===== Логотип ===== */
.sb-head {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 44px;
  padding-left: 4px;
  margin-bottom: 26px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}
.brand-mark {
  width: 32px;
  height: 32px;
  flex: none;
}
.brand-logo-img {
  height: 30px;
  flex: none;
  color: var(--text);
}
.brand-name {
  font-weight: 700;
  font-size: 20px;
  white-space: nowrap;
}
.brand-sep,
.brand-product {
  display: none;
}
.rail-btn {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text);
}
.rail-btn:hover {
  background: var(--hover);
}
.rail-btn .icon {
  width: 18px;
  height: 18px;
  transition: transform 0.25s;
}

/* ===== Пункты меню: иконка в кружке + подпись (как на платформе) ===== */
.sb-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  text-align: left;
  font-size: 15px;
  line-height: 1.3;
}
.nav-ico {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  font-size: 19px;
  transition: background 0.15s, color 0.15s;
}
.nav-ico.tone {
  background: var(--tone);
}
.nav-item:hover .nav-ico {
  background: var(--surface-3);
}
.nav-item:hover .nav-ico.tone {
  background: var(--tone);
  box-shadow: 0 0 0 2px var(--dark);
}
.nav-item.active .nav-ico {
  background: var(--dark);
  color: var(--on-dark);
}
.nav-item.active .nav-ico.tone {
  background: var(--tone);
  box-shadow: 0 0 0 2px var(--dark);
}
.nav-item.active .nav-label {
  font-weight: 700;
}
.nav-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.nav-badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 16px;
  background: var(--pink-chip);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}
.nav-item kbd {
  margin-right: 4px;
}
.sb-label {
  margin: 22px 0 8px 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.sb-sections {
  flex: 1;
  overflow-y: auto;
  margin: 0 -16px;
  padding: 2px 16px 12px;
  scrollbar-width: none;
}
.sb-foot {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 10px;
}

/* свёрнутое меню — узкая полоса иконок */
html.rail .sidebar {
  width: var(--rail-w);
  padding-left: 30px;
  padding-right: 30px;
}
html.rail .nav-label,
html.rail .nav-badge,
html.rail .nav-item kbd,
html.rail .sb-label {
  display: none;
}
html.rail .sb-head {
  flex-direction: column;
  align-items: flex-start;
  height: auto;
  padding-left: 6px;
  gap: 14px;
}
html.rail .brand {
  width: 32px;
}
html.rail .brand-logo-img {
  margin-right: -100px;
}
html.rail .rail-btn {
  margin-left: 0;
}
html.rail .rail-btn .icon {
  transform: rotate(180deg);
}
html.rail .sb-sections {
  border-top: 1.5px solid var(--border);
  margin-top: 14px;
  padding-top: 14px;
}

/* ===== Верхняя строка ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 80px;
  padding: 16px 0;
  background: var(--bg);
}
.topbar-brand {
  display: none;
}
.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--panel);
  color: var(--text);
}
.icon-btn:hover {
  background: var(--surface-3);
}
.menu-btn {
  display: none;
}
.search-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  min-width: 260px;
  padding: 0 14px 0 18px;
  border: 0;
  border-radius: 160px;
  background: var(--panel);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}
.search-pill span {
  flex: 1;
  text-align: left;
}
.search-pill:hover {
  color: var(--text);
}

/* переключатель разделов — как выбор предмета на платформе */
.switcher {
  position: relative;
}
.switcher > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  min-width: 260px;
  max-width: 380px;
  padding: 0 16px 0 12px;
  border-radius: 160px;
  background: var(--panel);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.switcher > summary::-webkit-details-marker {
  display: none;
}
.switcher-emoji {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: var(--tone, var(--surface-3));
  font-size: 15px;
}
.switcher-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.switcher > summary .icon {
  width: 18px;
  height: 18px;
  transform: rotate(90deg);
  transition: transform 0.15s;
}
.switcher[open] > summary .icon {
  transform: rotate(-90deg);
}
.switcher-pop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  width: min(420px, calc(100vw - 32px));
  max-height: min(70vh, 640px);
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
}
.switcher-group + .switcher-group {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.switcher-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 14px;
}
.switcher-item:hover {
  background: var(--surface-2);
}
.switcher-item.active {
  background: var(--surface-3);
  font-weight: 700;
}
.switcher-item.top {
  font-weight: 700;
}
.switcher-item.sub {
  padding-left: 18px;
  color: var(--text-2);
}
.switcher-item .switcher-emoji {
  width: 28px;
  height: 28px;
  font-size: 14px;
}

/* главный оффер — плашка в верхней строке, как баннер на платформе */
.top-offer {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 10px;
  height: 48px;
  min-width: 180px;
  max-width: 560px;
  padding: 0 18px 0 8px;
  border-radius: 160px;
  background: var(--pink-chip) var(--pattern);
  background-size: auto, 140px;
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
}
.top-offer-badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 160px;
  background: var(--dark);
  color: var(--on-dark);
  font-size: 12px;
}
.top-offer-badge .icon {
  width: 14px;
  height: 14px;
}
.top-offer-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-offer-deadline {
  flex: none;
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}

/* ===== Хлебные крошки ===== */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
}
.crumbs a:hover {
  color: var(--text);
}
.crumb-sep {
  opacity: 0.6;
}

/* ===== Кнопки и поля (как на платформе) ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  border: 2px solid var(--dark);
  border-radius: 160px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.btn:hover {
  background: var(--surface-2);
}
.btn .icon {
  width: 18px;
  height: 18px;
}
.btn-primary {
  background: var(--dark);
  color: var(--on-dark);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--dark) 85%, var(--panel));
}
.btn-ghost,
.btn-soft {
  border-color: transparent;
  background: var(--surface-2);
}
.btn-ghost:hover,
.btn-soft:hover {
  background: var(--surface-3);
}
.btn-danger {
  border-color: var(--danger);
  color: var(--danger);
}
.btn-danger:hover {
  background: color-mix(in srgb, var(--danger) 8%, var(--panel));
}
.btn-small {
  height: 36px;
  padding: 0 16px;
  font-size: 13px;
  border-width: 1.5px;
}
.btn-block {
  width: 100%;
}
.btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.input {
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--border-input);
  border-radius: 16px;
  background: var(--panel);
  font-weight: 700;
  font-size: 14px;
}
.input::placeholder {
  font-weight: 400;
  color: var(--muted);
}
.input:focus {
  outline: none;
  border-color: var(--dark);
}
textarea.input {
  resize: vertical;
  line-height: 1.5;
}
select.input {
  padding-right: 36px;
}

/* бейджи-«таблетки», как №315 / «1 линия» */
.chip,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}
.chip {
  border-color: var(--border-input);
  background: var(--panel);
  color: var(--text);
  height: 36px;
  font-size: 13px;
}
.chip:hover {
  border-color: var(--dark);
}
.chip.active {
  background: var(--dark);
  border-color: var(--dark);
  color: var(--on-dark);
}
.tag {
  height: 24px;
  padding: 0 10px;
  font-size: 11px;
  background: var(--surface-3);
  color: var(--text);
}
.tag-outline {
  background: none;
  border-color: var(--dark);
}
.tag-hot {
  background: var(--pink-chip);
}
.tag-active {
  background: var(--tone-1);
}
.tag-upcoming {
  background: var(--tone-4);
}
.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  flex: none;
}
.dot-red { background: var(--pink); }
.dot-orange { background: var(--amber); }
.dot-green { background: var(--green); }
.dot-blue { background: var(--purple); }
.dot-purple { background: #b08be0; }
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

/* ===== Заголовки страниц ===== */
.page-title {
  margin: 0;
  font-size: 32px;
  line-height: 1.35;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.lead {
  margin: 10px 0 0;
  max-width: 720px;
  font-size: 16px;
  color: var(--text-2);
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px 24px;
  margin-bottom: 24px;
}
.page-head > div:first-child {
  flex: 1 1 360px;
  min-width: 0;
}
.page-head h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.35;
  font-weight: 700;
}
.page-head > p {
  flex-basis: 100%;
  margin: 0;
}
.page-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.block {
  margin-top: 40px;
}
.block-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.block-head h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.3;
  font-weight: 700;
}
.block-more {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
}
.block-more:hover {
  color: var(--pink);
}
.block-more .icon {
  width: 16px;
  height: 16px;
}

/* ===== Главная ===== */
.ask-box {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 860px;
  margin-top: 26px;
  padding: 6px 6px 6px 20px;
  border: 1px solid var(--border-input);
  border-radius: 160px;
  background: var(--panel);
}
.ask-box:focus-within {
  border-color: var(--dark);
}
.ask-box-icon {
  display: grid;
  color: var(--pink);
}
.ask-box input {
  flex: 1;
  min-width: 0;
  padding: 12px 4px;
  border: 0;
  background: none;
  outline: none;
  font-size: 15px;
  font-weight: 700;
}
.ask-box input::placeholder {
  color: var(--muted);
  font-weight: 400;
}
.ask-box .btn {
  height: 48px;
}

/* плашки разделов — как предметы в банке заданий */
.banner-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.banner {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  min-height: 96px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--tone, var(--tone-3)) var(--pattern);
  background-size: auto, 140px;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.banner:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.banner-big {
  min-height: 120px;
}
.banner-emoji {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 50%;
  background: var(--panel);
  font-size: 23px;
}
.banner-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.banner-title {
  font-size: 22px;
  line-height: 1.3;
  font-weight: 700;
}
.banner-big .banner-title {
  font-size: 24px;
}
.banner-meta {
  font-size: 13px;
  color: var(--text-2);
}
.banner > .icon {
  align-self: center;
  width: 22px;
  height: 22px;
  opacity: 0.55;
}
.banner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.banner-grid .banner {
  min-height: 88px;
}
.banner-grid .banner-title {
  font-size: 17px;
}

/* карточки статей */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card:hover {
  border-color: var(--border-input);
  box-shadow: var(--shadow);
}
.card-emoji {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  background: var(--tone, var(--surface-3));
  font-size: 20px;
}
.card-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 2px;
}
.card-title {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.35;
}
.card-meta {
  font-size: 12px;
  color: var(--muted);
}

/* недавние */
.recent {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.recent a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.recent a:hover {
  border-color: var(--border-input);
}
.recent-emoji {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-3);
  font-size: 15px;
}
.recent-title {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-path {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-date {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* ===== Акции ===== */
.promo {
  --tone: var(--tone-2);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}
.promo-red { --tone: var(--tone-9); }
.promo-orange { --tone: var(--tone-2); }
.promo-green { --tone: var(--tone-1); }
.promo-blue { --tone: var(--tone-4); }
.promo-purple { --tone: var(--tone-5); }
.promo-big {
  padding: 28px;
  margin-bottom: 12px;
  border: 0;
  background: var(--tone) var(--pattern);
  background-size: auto, 140px;
}
.promo-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.promo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 16px;
  background: var(--tone);
  font-size: 11px;
  font-weight: 700;
}
.promo-big .promo-badge {
  background: var(--dark);
  color: var(--on-dark);
}
.promo-badge .icon {
  width: 13px;
  height: 13px;
}
.promo-deadline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border: 1px solid var(--dark);
  border-radius: 16px;
  font-size: 11px;
  font-weight: 700;
}
.promo-deadline .icon {
  width: 13px;
  height: 13px;
}
.promo-deadline.urgent {
  border-color: var(--danger);
  color: var(--danger);
}
.promo-title {
  margin: 4px 0 0;
  font-size: 18px;
  line-height: 1.35;
  font-weight: 700;
}
.promo-big .promo-title {
  font-size: 28px;
  line-height: 1.25;
  max-width: 720px;
}
.promo-desc {
  font-size: 14px;
  color: var(--text-2);
}
.promo-big .promo-desc {
  font-size: 15px;
  max-width: 680px;
}
.promo-desc p {
  margin: 0 0 6px;
}
.promo-desc ul {
  margin: 0;
  padding-left: 18px;
}
.promo-more {
  margin-top: auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 18px;
  border: 2px solid var(--dark);
  border-radius: 160px;
  font-size: 13px;
  font-weight: 700;
}
.promo-more:hover {
  background: var(--surface-2);
}
.promo-big .promo-more {
  height: 48px;
  padding: 0 24px;
  background: var(--dark);
  color: var(--on-dark);
}
.promo-more .icon {
  width: 16px;
  height: 16px;
}
.promo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.promo-expired {
  opacity: 0.6;
  filter: grayscale(0.8);
}

/* ===== Статья ===== */
.article-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px 24px;
}
.article-head-main {
  flex: 1 1 420px;
  min-width: 0;
  display: flex;
  gap: 18px;
  align-items: flex-start;
}
.article-emoji {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex: none;
  border-radius: 50%;
  background: var(--tone, var(--surface-3));
  font-size: 30px;
  line-height: 1;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}
.article-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.article-cover {
  height: 150px;
  margin-bottom: 24px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-3);
}
.article-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
  margin-top: 28px;
}
.article-layout.has-side {
  grid-template-columns: minmax(0, 1fr) 280px;
}
/* правая колонка: темы раздела и оглавление статьи */
.article-side {
  position: sticky;
  top: 96px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.article-side .toc {
  position: static;
  max-height: none;
  overflow: visible;
}
.topics {
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.topics > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}
.topics > summary::-webkit-details-marker {
  display: none;
}
.topics > summary .icon {
  width: 18px;
  height: 18px;
  flex: none;
  transform: rotate(90deg);
  transition: transform 0.15s;
}
.topics[open] > summary .icon {
  transform: rotate(-90deg);
}
.topics-head {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topics-title {
  font-size: 14px;
  font-weight: 700;
}
.topics-parent {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topics-list {
  list-style: none;
  margin: 0;
  padding: 0 8px 4px;
}
.topics-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.35;
}
.topics-list a:hover {
  background: var(--surface-2);
}
.topics-list a.active {
  background: var(--dark);
  color: var(--on-dark);
  font-weight: 700;
}
.topics-emoji {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  background: var(--tone, var(--surface-3));
  font-size: 14px;
}
.topics-name {
  flex: 1;
  min-width: 0;
}
.topics-count {
  flex: none;
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.topics-up {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 8px 10px;
  padding: 8px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.topics-up:hover {
  color: var(--text);
}
.topics-up .icon {
  width: 16px;
  height: 16px;
}
.promo-empty .promo-badge {
  background: var(--dark);
  color: var(--on-dark);
}
.article {
  min-width: 0;
  max-width: 860px;
}
.empty {
  color: var(--muted);
}
.subpages {
  margin-top: 36px;
}
.subpages-title {
  margin: 0 0 14px;
  font-size: 20px;
  font-weight: 700;
}
.article-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 44px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 14px;
}
.article-foot .btn {
  margin-left: auto;
}

/* ===== Доска: карточки по категориям, как в Yonote ===== */
.board-topics {
  max-width: 520px;
  margin-top: 20px;
}
.board-intro {
  margin-top: 20px;
  max-width: 860px;
  color: var(--text-2);
}
.board-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 24px 0 16px;
}
.board-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 360px;
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border-input);
  border-radius: 160px;
  color: var(--muted);
}
.board-search:focus-within {
  border-color: var(--dark);
}
.board-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  outline: none;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}
.board-jump {
  margin: 0;
}
.board-jump .dot {
  background: var(--tone);
  box-shadow: inset 0 0 0 1px rgba(48, 42, 62, 0.15);
}
.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  scroll-snap-type: x proximity;
  align-items: start;
}
.board-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--tone) 45%, transparent);
  scroll-snap-align: start;
}
.board-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px 4px;
}
.board-pill {
  padding: 3px 12px;
  border-radius: 160px;
  background: var(--tone);
  font-size: 13px;
  font-weight: 700;
}
.board-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.board-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.board-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.board-card:hover {
  border-color: var(--border-input);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.board-card-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}
.board-card-text {
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.board-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border: 1.5px dashed var(--border-input);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.board-add:hover {
  border-color: var(--dark);
  color: var(--text);
}
.board-add .icon {
  width: 16px;
  height: 16px;
}
.tag-tone {
  background: var(--tone);
}

/* ===== Тесты ===== */
.test-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  margin-top: 40px;
  padding: 22px 24px;
  border-radius: var(--radius-lg);
  background: var(--tone) var(--pattern);
  background-size: auto, 140px;
}
.test-card-text {
  flex: 1 1 320px;
  min-width: 0;
}
.test-card-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
}
.test-card-kicker .icon {
  width: 16px;
  height: 16px;
}
.test-card h3 {
  margin: 4px 0 4px;
  font-size: 20px;
}
.test-card p {
  margin: 0;
  font-size: 14px;
  color: var(--text-2);
}
.test-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.test-card .btn:not(.btn-primary) {
  background: var(--panel);
}
.test-banner .test-status {
  align-self: center;
}
.test-status:empty {
  display: none;
}
.test-status {
  flex: none;
  padding: 4px 10px;
  border-radius: 16px;
  background: var(--panel);
  font-size: 12px;
  font-weight: 700;
}
.test-status.ok {
  color: var(--green);
}
.test-status.retry {
  color: var(--amber);
}
.quiz {
  max-width: 760px;
  margin: 0 auto;
}
.quiz-intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding-top: 12px;
}
.quiz-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--tone);
  font-size: 34px;
}
.quiz-start {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
}
.quiz-start .field {
  flex: 1 1 280px;
}
.quiz-note {
  margin: 0;
  font-size: 13px;
}
.quiz-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.quiz-bar {
  flex: 1;
  height: 8px;
  border-radius: 8px;
  background: var(--surface-3);
  overflow: hidden;
}
.quiz-bar i {
  display: block;
  height: 100%;
  border-radius: 8px;
  background: var(--dark);
  transition: width 0.3s;
}
.quiz-card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.quiz-q {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.45;
}
.quiz-hint {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  background: var(--panel);
  text-align: left;
  font-size: 15px;
  line-height: 1.45;
  transition: border-color 0.15s, background 0.15s;
}
.quiz-option:not(:disabled):hover {
  border-color: var(--dark);
}
.quiz-mark {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 2px solid var(--border-input);
  border-radius: 50%;
}
.quiz-option.picked {
  border-color: var(--dark);
}
.quiz-option.picked .quiz-mark {
  border-color: var(--dark);
  background: radial-gradient(var(--dark) 45%, transparent 50%);
}
.quiz-option.right {
  border-color: var(--green);
  background: var(--tone-1);
}
.quiz-option.right .quiz-mark {
  border-color: var(--green);
  background: var(--green);
}
.quiz-option.wrong {
  border-color: var(--danger);
  background: var(--tone-9);
}
.quiz-option.wrong .quiz-mark {
  border-color: var(--danger);
  background: var(--danger);
}
.quiz-option:disabled {
  cursor: default;
  color: var(--text);
}
.quiz-feedback {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.55;
}
.quiz-feedback.ok {
  background: var(--tone-1);
}
.quiz-feedback.bad {
  background: var(--tone-2);
}
.quiz-feedback p {
  margin: 6px 0;
}
.quiz-feedback a {
  font-weight: 700;
  text-decoration: underline;
}
.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.quiz-result {
  padding: 28px;
  border-radius: var(--radius-lg);
  text-align: center;
  background: var(--tone-2) var(--pattern);
  background-size: auto, 140px;
}
.quiz-result.ok {
  background-color: var(--tone-1);
}
.quiz-score {
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
}
.quiz-result h2 {
  margin: 12px 0 6px;
}
.quiz-result p {
  margin: 0;
}
.quiz-mistakes,
.miss-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quiz-mistakes li {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}
.quiz-mistakes span {
  color: var(--green);
  font-weight: 700;
}
.quiz-mistakes a {
  font-weight: 700;
  text-decoration: underline;
}
.miss-list li {
  font-size: 14px;
}
.results-filter {
  flex-wrap: wrap;
  max-width: 760px;
}
.results-filter .input {
  flex: 1 1 220px;
  width: auto;
}
.quiz-edit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.quiz-edit .field {
  margin-bottom: 14px;
}
.quiz-edit-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.quiz-edit-opt input[type='checkbox'] {
  width: 20px;
  height: 20px;
  flex: none;
  accent-color: var(--green);
}
.quiz-edit-opt .input {
  flex: 1;
}

/* оглавление */
.toc {
  position: sticky;
  top: 96px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
}
.toc-title {
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 14px;
}
.toc-link {
  display: block;
  padding: 5px 0 5px 12px;
  border-left: 2px solid var(--border);
  color: var(--muted);
  line-height: 1.4;
}
.toc-link:hover {
  color: var(--text);
}
.toc-link.active {
  color: var(--text);
  border-left-color: var(--dark);
  font-weight: 700;
}
.toc-3 {
  padding-left: 24px;
}

/* ===== Текст статьи ===== */
.prose {
  font-size: 16px;
  line-height: 1.75;
  overflow-wrap: break-word;
}
.prose > :first-child {
  margin-top: 0;
}
.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  position: relative;
  margin: 1.8em 0 0.6em;
  line-height: 1.35;
  font-weight: 700;
}
.prose h1 { font-size: 1.6em; }
.prose h2 { font-size: 1.35em; }
.prose h3 { font-size: 1.15em; }
.prose h4 { font-size: 1em; }
.prose .anchor {
  margin-left: 8px;
  color: var(--muted);
  opacity: 0;
  font-weight: 400;
}
.prose h1:hover .anchor,
.prose h2:hover .anchor,
.prose h3:hover .anchor,
.prose h4:hover .anchor {
  opacity: 1;
}
.prose p {
  margin: 0.7em 0;
}
.prose strong {
  font-weight: 700;
}
.prose a {
  color: var(--pink);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.prose a:hover {
  color: var(--pink-hover);
}
.prose ul,
.prose ol {
  padding-left: 1.5em;
  margin: 0.6em 0;
}
.prose li {
  margin: 0.3em 0;
}
.prose li > p {
  margin: 0.2em 0;
}
.prose li::marker {
  color: var(--muted);
  font-weight: 700;
}
.prose li:has(> input[type='checkbox']) {
  list-style: none;
  margin-left: -1.4em;
}
.prose input[type='checkbox'] {
  width: 17px;
  height: 17px;
  margin: 0 10px 0 0;
  vertical-align: -3px;
  accent-color: var(--dark);
}
.prose blockquote {
  margin: 1em 0;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.prose blockquote > :first-child {
  margin-top: 0;
}
.prose blockquote > :last-child {
  margin-bottom: 0;
}
.prose code {
  font: 0.86em var(--mono);
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-3);
}
.prose pre {
  margin: 1em 0;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface-3);
  overflow-x: auto;
  line-height: 1.55;
}
.prose pre code {
  padding: 0;
  background: none;
}
.prose img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.8em 0;
}
.prose mark {
  background: rgba(249, 228, 137, 0.75);
  color: inherit;
  padding: 0 3px;
  border-radius: 4px;
}
:root[data-theme='dark'] .prose mark {
  background: rgba(249, 228, 137, 0.25);
}
.table-wrap {
  margin: 1em 0;
  overflow-x: auto;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.55;
}
.prose th,
.prose td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-input);
  text-align: left;
  vertical-align: top;
}
.prose th + th,
.prose td + td {
  border-left: 1px solid var(--border-input);
}
.prose th {
  background: var(--surface-2);
  font-weight: 700;
}
.prose tr:last-child td {
  border-bottom: 0;
}
.callout {
  --tone: var(--tone-3);
  margin: 1.1em 0;
  padding: 16px 20px;
  border-radius: var(--radius);
  background: var(--tone);
}
.callout > :first-child {
  margin-top: 0;
}
.callout > :last-child {
  margin-bottom: 0;
}
.callout-tip,
.callout-success { --tone: var(--tone-1); }
.callout-warning { --tone: var(--tone-2); }
.callout-danger { --tone: var(--tone-9); }
.callout-notice { --tone: var(--tone-5); }
.prose details {
  margin: 0.9em 0;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
}
.prose details > summary {
  position: relative;
  padding: 12px 16px 12px 42px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}
.prose details > summary::-webkit-details-marker {
  display: none;
}
.prose details > summary::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-70%) rotate(-45deg);
  transition: transform 0.15s;
}
.prose details[open] > summary::before {
  transform: translateY(-60%) rotate(45deg);
}
.prose details[open] > summary {
  border-bottom: 1px solid var(--border);
}
.prose details > :not(summary) {
  margin-left: 16px;
  margin-right: 16px;
}
.prose details > :last-child {
  margin-bottom: 14px;
}

/* ===== Поиск (палитра) ===== */
.palette {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh 16px 16px;
}
.palette-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(48, 42, 62, 0.4);
}
.palette-box {
  position: relative;
  width: 100%;
  max-width: 680px;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.palette-input {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
}
.palette-input input {
  flex: 1;
  min-width: 0;
  padding: 20px 0;
  border: 0;
  background: none;
  outline: none;
  font-size: 17px;
  font-weight: 700;
}
.palette-input input::placeholder {
  color: var(--muted);
  font-weight: 400;
}
.palette-input input::-webkit-search-cancel-button {
  display: none;
}
.palette-results {
  overflow-y: auto;
  padding: 8px;
}
.palette-empty {
  padding: 22px 14px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}
.pr-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  cursor: pointer;
}
.pr-item.selected {
  background: var(--surface-2);
}
.pr-emoji {
  font-size: 18px;
  line-height: 1.4;
}
.pr-body {
  min-width: 0;
  flex: 1;
}
.pr-title {
  font-weight: 700;
  font-size: 15px;
}
.pr-path {
  font-size: 12px;
  color: var(--muted);
}
.pr-snippet,
.sr-snippet {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pr-snippet mark,
.sr-snippet mark {
  background: rgba(249, 228, 137, 0.75);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}
.pr-ask {
  align-items: center;
  margin-top: 4px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  font-weight: 700;
}
.pr-ask .icon {
  color: var(--pink);
}
.search-form {
  display: flex;
  gap: 8px;
  max-width: 720px;
  margin-bottom: 24px;
}
.search-form input {
  flex: 1;
  height: 48px;
  padding: 0 20px;
  border: 1px solid var(--border-input);
  border-radius: 160px;
  background: var(--panel);
  font-weight: 700;
}
.search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.search-results a {
  display: block;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.search-results a:hover {
  border-color: var(--border-input);
}
.sr-title {
  display: block;
  font-weight: 700;
}
.sr-path {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

/* ===== Спросить базу ===== */
.page-ask .panel {
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}
.ask-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
}
.ask-intro {
  padding: 6vh 0 24px;
  text-align: center;
}
.ask-intro h1 {
  margin: 18px 0 8px;
  font-size: 32px;
  line-height: 1.3;
}
.ask-intro > p {
  margin: 0;
}
.ask-intro .chips {
  justify-content: center;
  margin-top: 22px;
}
.ask-intro .notice {
  text-align: left;
}
.ask-intro-icon {
  display: inline-grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--tone-5) var(--pattern);
  color: var(--text);
}
.ask-intro-icon .icon {
  width: 32px;
  height: 32px;
}
.thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 16px 0 24px;
}
.msg-q {
  align-self: flex-end;
  max-width: 85%;
  padding: 12px 18px;
  border-radius: 20px 20px 6px 20px;
  background: var(--dark);
  color: var(--on-dark);
  font-weight: 700;
  font-size: 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg-a {
  display: flex;
  gap: 12px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 6px 20px 20px 20px;
}
.msg-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: var(--tone-5);
}
.msg-avatar .icon {
  width: 18px;
  height: 18px;
}
.msg-body {
  flex: 1;
  min-width: 0;
}
.msg-body.prose {
  font-size: 15px;
}
.msg-body .typing {
  display: inline-flex;
  gap: 5px;
  padding: 10px 0;
}
.typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: blink 1.2s infinite both;
}
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}
.prose a.cite,
.cite {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  margin: 0 1px;
  border-radius: 16px;
  background: var(--pink-chip);
  color: var(--text) !important;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none !important;
  vertical-align: 1px;
  line-height: 1;
}
.sources {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.prose a.source,
.source {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  height: 36px;
  padding: 0 14px 0 6px;
  border: 1px solid var(--border-input);
  border-radius: 160px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.source:hover {
  border-color: var(--dark);
}
.source b {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--pink-chip);
  font-size: 11px;
}
.source span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prose a.fallback-item,
.fallback-item {
  display: block;
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-weight: 400;
}
.fallback-item:hover {
  border-color: var(--border-input);
}
.fallback-title {
  margin-bottom: 4px;
  font-weight: 700;
}
.fallback-text {
  font-size: 14px;
  color: var(--text-2);
}
.msg-error {
  margin-bottom: 8px;
  color: var(--danger);
  font-size: 14px;
  font-weight: 700;
}
.composer {
  position: sticky;
  bottom: 12px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: auto;
  padding: 6px 6px 6px 20px;
  border: 1px solid var(--border-input);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.composer:focus-within {
  border-color: var(--dark);
}
.composer textarea {
  flex: 1;
  min-width: 0;
  max-height: 200px;
  padding: 12px 0;
  border: 0;
  background: none;
  resize: none;
  outline: none;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
}
.composer textarea::placeholder {
  color: var(--muted);
  font-weight: 400;
}
.composer-send {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--dark);
  color: var(--on-dark);
}
.composer-send:disabled {
  opacity: 0.3;
}
.composer-note {
  margin: 12px 0 16px;
  min-height: 1em;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ===== Сообщения, пустые состояния ===== */
.notice {
  margin-top: 24px;
  padding: 16px 20px;
  border-radius: var(--radius);
  background: var(--tone-2);
  font-size: 14px;
  line-height: 1.55;
}
.notice a {
  font-weight: 700;
  text-decoration: underline;
}
.notice .btn {
  margin-left: 8px;
}
.empty-state {
  padding: 36px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border-input);
  border-radius: var(--radius);
}
.empty-state a {
  color: var(--text);
  font-weight: 700;
  text-decoration: underline;
}
.empty-state.big {
  border: 0;
  padding: 10vh 16px;
}
.empty-state.big h1 {
  margin: 14px 0 6px;
  color: var(--text);
}
.big-emoji {
  font-size: 60px;
}

/* ===== Подвал ===== */
.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding: 20px 40px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-left: auto;
}
.footer-links a {
  color: var(--text);
  font-weight: 700;
}
.footer-links a:hover {
  color: var(--pink);
}
.page-ask .footer,
.page-editor .footer {
  display: none;
}

/* ===== Вход ===== */
.page-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 40px 32px;
  border-radius: var(--radius-panel);
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: center;
}
.login-card .brand {
  justify-content: center;
  margin-bottom: 8px;
}
.login-card h1 {
  margin: 0;
  font-size: 24px;
}
.login-card p {
  margin: 0 0 6px;
  font-size: 14px;
}
.login-card .input {
  border-radius: 160px;
  text-align: center;
}
.form-error {
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--pink-soft);
  color: var(--danger);
  font-size: 14px;
  font-weight: 700;
}

/* ===== Управление ===== */
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 24px;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.tab {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border-input);
  border-radius: 160px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.tab:hover {
  border-color: var(--dark);
}
.tab.active {
  background: var(--dark);
  border-color: var(--dark);
  color: var(--on-dark);
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--tone, var(--tone-3)) var(--pattern);
  background-size: auto, 140px;
}
.stat:nth-child(1) { --tone: var(--tone-1); }
.stat:nth-child(2) { --tone: var(--tone-2); }
.stat:nth-child(3) { --tone: var(--tone-4); }
.stat:nth-child(4) { --tone: var(--tone-9); }
.stat-num {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 13px;
  color: var(--text-2);
}
.hl {
  background: none;
}
.status-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.status {
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}
.status::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
}
.status.ok::before {
  background: var(--green);
}
.status.off::before {
  background: var(--amber);
}
.status a {
  font-weight: 700;
  text-decoration: underline;
}
.table {
  width: 100%;
  margin-top: 16px;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 14px;
}
.table th {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td {
  border-bottom: 0;
}
.table .dot {
  margin-right: 8px;
}
.nowrap {
  white-space: nowrap;
}
.row-actions {
  text-align: right;
  white-space: nowrap;
}
.row-actions .btn + .btn {
  margin-left: 4px;
}
.card-form {
  max-width: 860px;
  margin: 16px 0;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
}
.field small {
  font-weight: 400;
  color: var(--muted);
}
.field-wide {
  grid-column: 1 / -1;
}
.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}
.prop-check {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 10px;
  font-weight: 400;
  cursor: pointer;
}
.prop-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--dark);
}
.filter-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.narrow {
  max-width: 760px;
}
.page-admin .prose.narrow {
  margin-top: 14px;
  padding: 20px 24px;
  border-radius: var(--radius);
  background: var(--surface-2);
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 200;
  transform: translateX(-50%);
  padding: 12px 22px;
  border-radius: 160px;
  background: var(--dark);
  color: var(--on-dark);
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.2s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
}

/* справка редактора */
.help h2 {
  margin-top: 1.6em;
}
.help-steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
}
.help-steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 44px;
  margin: 14px 0;
}
.help-steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--dark);
  color: var(--on-dark);
  font-size: 13px;
  font-weight: 700;
}

/* ===== Редактор ===== */
.page-editor .panel {
  padding-top: 8px;
}
.editor-page {
  max-width: 900px;
}
.editor-bar {
  position: sticky;
  top: 80px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
  background: var(--panel);
}
.editor-status {
  flex: 1;
  font-size: 13px;
  color: var(--muted);
}
.editor-status.dirty {
  color: var(--amber);
}
.editor-head {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-top: 8px;
}
.emoji-picker {
  position: relative;
}
.emoji-btn {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-3);
  font-size: 30px;
  line-height: 1;
}
.emoji-btn:hover {
  box-shadow: 0 0 0 2px var(--dark);
}
.emoji-pop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  width: 340px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}
.emoji-grid button {
  padding: 4px;
  border: 0;
  border-radius: 10px;
  background: none;
  font-size: 22px;
}
.emoji-grid button:hover {
  background: var(--surface-2);
}
.emoji-own {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.emoji-own input {
  flex: 1;
}
.title-input {
  flex: 1;
  width: 100%;
  padding: 10px 0 0;
  border: 0;
  background: none;
  resize: none;
  overflow: hidden;
  outline: none;
  font-size: 32px;
  line-height: 1.35;
  font-weight: 700;
}
.title-input::placeholder {
  color: var(--disabled);
}
.editor-props {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  margin: 18px 0 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.prop {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}
.prop select {
  max-width: 360px;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border-input);
  border-radius: 16px;
  background: var(--panel);
  font-weight: 700;
  font-size: 13px;
}
.editor-danger {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 40px;
  font-size: 13px;
}
#editor .toastui-editor-defaultUI {
  border: 0;
  font-family: var(--font);
}
#editor .toastui-editor-defaultUI-toolbar,
#editor .toastui-editor-toolbar {
  position: sticky;
  top: 160px;
  z-index: 10;
}
#editor .toastui-editor-defaultUI-toolbar {
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 160px;
  background: var(--surface-2);
}
#editor .toastui-editor-toolbar-icons {
  border-radius: 50%;
}
#editor .toastui-editor-main {
  border: 0;
}
#editor .toastui-editor-ww-container,
#editor .toastui-editor-md-container,
#editor .toastui-editor-main-container {
  background: var(--panel);
}
#editor .toastui-editor-contents {
  padding: 20px 2px 40px;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
}
#editor .toastui-editor-contents p {
  margin: 0.6em 0;
  line-height: 1.75;
  color: var(--text);
}
#editor .toastui-editor-contents h1,
#editor .toastui-editor-contents h2,
#editor .toastui-editor-contents h3 {
  border-bottom: 0;
  font-family: var(--font);
  color: var(--text);
}
#editor .ProseMirror {
  min-height: 420px;
}
#editor .toastui-editor-mode-switch {
  border-top: 1px solid var(--border);
  background: var(--panel);
}
#editor .toastui-editor-dark.toastui-editor-defaultUI,
#editor .toastui-editor-dark .toastui-editor-main-container {
  background: var(--panel);
}

/* ===== Адаптив ===== */
@media (max-width: 1440px) {
  /* поиск — кнопкой-лупой (он есть и в меню), чтобы оффер в верхней строке помещался */
  .search-pill {
    min-width: 0;
    width: 48px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
  .search-pill span,
  .search-pill kbd {
    display: none;
  }
  .switcher > summary {
    max-width: 320px;
  }
  .top-offer {
    flex: 1 1 auto;
  }
}
@media (max-width: 1200px) {
  .article-layout.has-side {
    grid-template-columns: minmax(0, 1fr);
  }
  /* на узком экране темы раздела — над статьёй, оглавление прячем */
  .article-side {
    position: static;
    order: -1;
    max-height: none;
    overflow: visible;
  }
  .article-side .toc {
    display: none;
  }
  .top-offer {
    display: none;
  }
}
@media (max-width: 960px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    width: min(300px, 86vw) !important;
    padding: 18px 16px 16px !important;
    background: var(--bg);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  html.rail .nav-label,
  html.rail .sb-label {
    display: block;
  }
  html.rail .nav-badge {
    display: inline-flex;
  }
  .rail-btn {
    display: none;
  }
  body.sidebar-open .sidebar {
    transform: none;
    box-shadow: var(--shadow-lg);
  }
  .sb-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(48, 42, 62, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }
  body.sidebar-open .sb-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .main {
    padding-right: 0;
  }
  .topbar {
    flex-wrap: wrap;
    gap: 8px;
    min-height: 0;
    padding: 10px 12px;
  }
  .menu-btn {
    display: grid;
  }
  .topbar-brand {
    display: flex;
    flex: 1;
    min-width: 0;
  }
  .search-pill {
    min-width: 0;
    width: 44px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
  .search-pill span,
  .search-pill kbd {
    display: none;
  }
  .switcher {
    order: 10;
    flex-basis: 100%;
  }
  .switcher > summary {
    max-width: none;
    min-width: 0;
  }
  .panel {
    padding: 22px 16px 48px;
    border-radius: 24px 24px 0 0;
  }
  .footer {
    padding: 18px 16px;
  }
  .footer-links {
    margin-left: 0;
  }
  .editor-bar {
    top: 0;
  }
}
@media (max-width: 640px) {
  /* на телефоне кнопки в одну строку, статус сохранения — под ними; «Назад» и так ведёт к статье */
  .editor-bar {
    flex-wrap: wrap;
    row-gap: 4px;
  }
  .editor-bar .editor-status {
    order: 1;
    flex-basis: 100%;
  }
  .editor-bar #open-link {
    display: none;
  }
  .editor-bar #save-btn {
    margin-left: auto;
  }
  .editor-props .prop:not(.prop-check) {
    width: 100%;
  }
  .prop select {
    flex: 1;
    min-width: 0;
    max-width: none;
  }
  .board {
    grid-auto-columns: 82%;
  }
  .board-search {
    flex-basis: 100%;
  }
  .page-title,
  .page-head h1,
  .title-input {
    font-size: 24px;
  }
  .article-head-main {
    gap: 12px;
  }
  .article-emoji,
  .emoji-btn {
    width: 52px;
    height: 52px;
    font-size: 25px;
  }
  .article-actions {
    width: 100%;
  }
  .article-actions .btn {
    flex: 1;
  }
  .ask-box {
    flex-wrap: wrap;
    padding: 8px;
    border-radius: 24px;
  }
  .ask-box-icon {
    display: none;
  }
  .ask-box input {
    flex-basis: 100%;
    padding: 10px 12px;
  }
  .ask-box .btn {
    width: 100%;
  }
  .banner {
    min-height: 84px;
    padding: 14px 16px;
  }
  .banner-title,
  .banner-big .banner-title {
    font-size: 18px;
  }
  .banner-emoji {
    width: 40px;
    height: 40px;
    font-size: 19px;
  }
  .promo-big {
    padding: 20px;
  }
  .promo-big .promo-title {
    font-size: 22px;
  }
  .recent-path {
    display: none;
  }
  .recent-title {
    flex: 1;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .table thead {
    display: none;
  }
  .table tr {
    display: block;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
  }
  .table tr:last-child {
    border-bottom: 0;
  }
  .table td {
    display: block;
    padding: 3px 0;
    border: 0;
  }
  .row-actions {
    text-align: left;
    padding-top: 8px !important;
  }
  .palette {
    padding-top: 8px;
  }
  .palette-box {
    max-height: 85vh;
  }
  .msg-q {
    max-width: 92%;
  }
  .msg-a {
    padding: 14px;
  }
  .msg-avatar {
    display: none;
  }
  .ask-intro h1 {
    font-size: 24px;
  }
  .article-foot .btn {
    margin-left: 0;
  }
}
