/* Витрина сервиса БХВ — светлая «книжная» тема.
   Тёмные рабочие экраны (стрим, ИИ) получат отдельный слой поверх этих же
   переменных, поэтому цвета вынесены наверх и нигде не зашиты в правила. */

:root {
  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --fg: #14181f;
  --fg-muted: #5b6572;
  --line: #e2e7ee;
  --accent: #1b4fa0;          /* заменить на фирменный цвет БХВ */
  --accent-dark: #143a76;
  --accent-fg: #ffffff;
  --radius: 14px;
  --wrap: 1120px;
  --shadow: 0 1px 2px rgba(20, 24, 31, .06), 0 8px 24px rgba(20, 24, 31, .06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

img { max-width: 100%; display: block; }

a { color: var(--accent); }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 20px;
}

.narrow { max-width: 720px; }

/* --- шапка --- */

.topbar {
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 64px;
}

/* Ссылки на сайт издательства */
.topnav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.topnav a {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 15px;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
}

.topnav a:hover {
  color: var(--accent);
  background: rgba(27, 79, 160, .07);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.brand { align-items: center; }

.brand__logo {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  flex: none;
}

.brand__text {
  color: var(--fg-muted);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- кнопки --- */

.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn--primary { background: var(--accent); color: var(--accent-fg); }
.btn--primary:hover { background: var(--accent-dark); }

.btn--ghost { border-color: var(--line); color: var(--fg); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

/* --- первый экран --- */

.hero {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  padding: 72px 0;
}

.hero__title {
  margin: 0 0 20px;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.15;
  letter-spacing: -.02em;
}

.hero__lead {
  margin: 0;
  max-width: 620px;
  font-size: 18px;
  color: var(--fg-muted);
}

/* --- секции и плитки --- */

.section { padding: 48px 0; }

.section__title {
  margin: 0 0 24px;
  font-size: 24px;
  letter-spacing: -.01em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.card {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}

.card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: #cfd8e4;
}

.card__media { aspect-ratio: 4 / 3; background: var(--bg-soft); }
.card__media img { width: 100%; height: 100%; object-fit: cover; }

.card__body { padding: 18px 20px 22px; }
.card__title { margin: 0 0 8px; font-size: 19px; }
.card__lead { margin: 0; color: var(--fg-muted); font-size: 15px; }

/* Заглушка вместо фотографии: пока у наборов нет снимков, страница не должна
   выглядеть сломанной. */
.ph {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #e8eef7, #d8e2f1);
  color: var(--accent);
}

.ph span { font-size: 56px; font-weight: 800; opacity: .55; }
.ph--wide { aspect-ratio: 21 / 9; }

/* --- страница набора --- */

.kit-hero { background: var(--bg-soft); border-bottom: 1px solid var(--line); }

.kit-hero__img {
  width: 100%;
  max-height: 460px;
  object-fit: cover;
}

.crumbs {
  margin: 24px 0 0;
  font-size: 14px;
  color: var(--fg-muted);
}

.crumbs a { text-decoration: none; }
.crumbs span { margin: 0 6px; }

.kit__title {
  margin: 12px 0 12px;
  font-size: clamp(26px, 4vw, 38px);
  letter-spacing: -.02em;
}

.kit__lead {
  margin: 0;
  font-size: 18px;
  color: var(--fg-muted);
  max-width: 720px;
}

.features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
  max-width: 760px;
}

.features li {
  position: relative;
  padding-left: 30px;
}

.features li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: .55em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* --- видео --- */

.video { margin: 0 0 28px; max-width: 840px; }

.video__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}

.video__frame iframe,
.video__frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

figcaption {
  margin-top: 8px;
  font-size: 14px;
  color: var(--fg-muted);
}

/* --- текст из редактора админки --- */

.prose { max-width: 760px; }
.prose h2 { font-size: 22px; margin: 32px 0 12px; }
.prose h3 { font-size: 18px; margin: 24px 0 10px; }
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; }
.prose img { border-radius: var(--radius); margin: 20px 0; }

.prose pre {
  background: #10151d;
  color: #e6edf6;
  padding: 16px 18px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 14px;
}

.prose code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: .93em;
}

.prose :not(pre) > code {
  background: var(--bg-soft);
  padding: 2px 6px;
  border-radius: 6px;
}

/* --- галерея --- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.gallery figure { margin: 0; }

.gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

/* --- переход в закрытую часть --- */

.cta {
  margin: 24px 0 72px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  max-width: 760px;
}

.cta h2 { margin: 0 0 10px; font-size: 22px; }
.cta p { margin: 0 0 20px; color: var(--fg-muted); }

.empty { color: var(--fg-muted); }

/* --- подвал --- */

.footer {
  border-top: 1px solid var(--line);
  padding: 32px 0;
  font-size: 14px;
  color: var(--fg-muted);
}

.footer__inner p { margin: 0 0 6px; }
.footer__muted { opacity: .8; }

/* --- формы входа и активации --- */

.topbar__actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.inline { display: inline; margin: 0; }

.linkbtn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--fg-muted);
  cursor: pointer;
  text-decoration: underline;
}

.linkbtn:hover { color: var(--accent); }
.linkbtn--danger:hover { color: #b3261e; }

.form-page {
  max-width: 460px;
  padding-top: 56px;
  padding-bottom: 72px;
}

.form-page__title { margin: 0 0 12px; font-size: 28px; letter-spacing: -.02em; }
.form-page__lead { margin: 0 0 28px; color: var(--fg-muted); }

.form { display: grid; gap: 18px; }

.field { display: block; }

.field__label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}

.field__input {
  width: 100%;
  padding: 11px 14px;
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.field__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(27, 79, 160, .14);
}

.field__input--mono {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.field__hint {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--fg-muted);
}

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.5;
}

.check input { margin-top: 3px; flex: none; }

.form__row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.form__aside { font-size: 14px; }

.btn--wide { display: block; text-align: center; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.alert {
  margin: 0 0 20px;
  padding: 12px 16px;
  border-radius: 10px;
  background: #fdecea;
  border: 1px solid #f4c7c3;
  color: #8c1d18;
  font-size: 15px;
}

.note {
  margin-top: 32px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  font-size: 15px;
}

.note p { margin: 0 0 14px; color: var(--fg-muted); }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--fg-muted);
  font-size: 14px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* --- личный кабинет --- */

.cabinet {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 40px;
  padding-top: 32px;
  padding-bottom: 72px;
  align-items: start;
}

.cabinet__nav {
  position: sticky;
  top: 88px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--bg-soft);
}

.cabinet__kitname { font-weight: 700; line-height: 1.3; }

.cabinet__serial {
  margin: 4px 0 14px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  color: var(--fg-muted);
}

.cabinet__link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 9px;
  text-decoration: none;
  color: var(--fg);
  font-size: 15px;
}

.cabinet__link:hover { background: rgba(27, 79, 160, .08); }
.cabinet__link.is-active { background: var(--accent); color: var(--accent-fg); }

.cabinet__other { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }

.cabinet__othertitle {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--fg-muted);
  margin-bottom: 6px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  margin-left: auto;
}

.dot--on { background: #2e7d32; }
.dot--off { background: #b6bfca; }

.cabinet__title { margin: 0 0 10px; font-size: 30px; letter-spacing: -.02em; }
.cabinet__lead { margin: 0 0 28px; color: var(--fg-muted); max-width: 640px; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.tile {
  display: block;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: box-shadow .18s ease, border-color .18s ease;
}

.tile:hover { box-shadow: var(--shadow); border-color: #cfd8e4; }
.tile__title { display: block; font-weight: 700; margin-bottom: 6px; }
.tile__text { display: block; font-size: 14px; color: var(--fg-muted); }

/* Ключ устройства — тёмный блок: это кусок кода, а не текст страницы. */

.keybox {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--bg-soft);
}

.keybox__title { margin: 0 0 8px; font-size: 20px; }
.keybox__text { margin: 0 0 16px; color: var(--fg-muted); font-size: 15px; }

.keybox__code {
  background: #10151d;
  color: #e6edf6;
  padding: 14px 16px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 14px;
  margin: 0 0 16px;
}

.keybox__actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }

.keybox__warn {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--fg-muted);
}

/* --- список файлов в кабинете --- */

.filelist { display: grid; gap: 10px; max-width: 760px; }

.filerow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.filerow__name { font-weight: 600; text-decoration: none; }
.filerow__name:hover { text-decoration: underline; }
.filerow__text { margin-top: 4px; font-size: 14px; color: var(--fg-muted); }

.filerow__meta {
  display: flex;
  gap: 14px;
  font-size: 13px;
  color: var(--fg-muted);
  white-space: nowrap;
}

.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .93em; }

/* --- инструкция --- */
/* Читают с телефона рядом с деталями: строка узкая, шрифт крупнее обычного. */

.manual { max-width: 760px; }

.manual__title {
  margin: 0 0 24px;
  font-size: clamp(24px, 3.4vw, 32px);
  letter-spacing: -.02em;
}

.manual .prose { font-size: 17px; }

.manual__figure { margin: 24px 0; }

.manual__figure img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.manual__cut {
  margin: 28px 0 0;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--bg-soft);
  border: 1px dashed #c5d1e2;
  color: var(--fg-muted);
  font-size: 15px;
}

.manual__nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 36px 0 0;
  max-width: 760px;
}

.pager {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.pager__item {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 9px;
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--fg);
  font-size: 15px;
}

.pager__item:hover { border-color: var(--accent); color: var(--accent); }

.pager__item.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.pager__label { margin-left: 8px; font-size: 14px; color: var(--fg-muted); }

/* --- редактор инструкций --- */

.modes { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.modes legend { padding: 0; margin-bottom: 4px; }

.mode {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.mode:hover { border-color: #cfd8e4; }
.mode input { margin-top: 4px; flex: none; }
.mode b { display: block; font-weight: 600; }
.mode em { display: block; margin-top: 2px; font-style: normal; font-size: 14px; color: var(--fg-muted); }

.blocks { display: grid; gap: 16px; }

.block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.block__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.block__num { font-size: 13px; color: var(--fg-muted); }
.block__tools { margin-left: auto; display: flex; gap: 12px; }

.block__form { display: grid; gap: 12px; }
.block__media { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.block__media .field__input { flex: 1 1 240px; }
.block__media video.adm__thumb { object-fit: cover; background: #10151d; }

.block__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* --- приветственный блок над инструкцией --- */

.welcome {
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  overflow: hidden;
}

.welcome__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 18px;
  background: none;
  border: 0;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.welcome__chevron { transition: transform .18s ease; color: var(--fg-muted); }
.welcome.is-collapsed .welcome__chevron { transform: rotate(-90deg); }

.welcome__body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  padding: 0 18px 18px;
}

.welcome__card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: box-shadow .18s ease, border-color .18s ease;
}

.welcome__card:hover { box-shadow: var(--shadow); border-color: var(--accent); }

.welcome__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 19px;
  font-weight: 700;
}

.welcome__text b { display: block; line-height: 1.3; }
.welcome__text em { display: block; margin-top: 4px; font-style: normal; font-size: 14px; color: var(--fg-muted); }

/* --- среда программирования --- */
/* Раскладка и палитра повторяют Arduino IDE 2: строка меню, панель с круглыми
   бирюзовыми кнопками, вкладки скетча, белый редактор, тёмный вывод и узкая
   строка состояния. Ребёнок, открывший потом настольную программу, должен
   узнать её с первого взгляда. */

.ide {
  /* Фирменные цвета Arduino */
  --ard-teal: #008184;
  --ard-teal-dark: #005c5f;
  --ard-teal-soft: #d7ebeb;
  --ard-bar: #f7f9f9;
  --ard-line: #dae3e3;
  --ard-ink: #4e5b61;
  --ard-orange: #e47128;
  --ard-console: #1a1a1a;

  display: flex;
  flex-direction: column;
  /* Шапки сайта на этой странице нет — среда занимает экран целиком. */
  height: 100vh;
  background: #fff;
  color: var(--ard-ink);
}

/* --- строка меню --- */

.ide__menubar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  background: #fff;
  border-bottom: 1px solid var(--ard-line);
}

.ide__logo {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ard-teal);
  color: #fff;
  font-size: 17px;
  line-height: 1;
  text-decoration: none;
}

.ide__logo:hover { background: var(--ard-teal-dark); }

/* Эмблема сервиса слева от знака среды: человек должен видеть, что он всё
   ещё в сервисе БХВ, а не в чужой программе. */
.ide__bhv {
  flex: none;
  display: grid;
  place-items: center;
  padding: 2px;
  border-radius: 6px;
  text-decoration: none;
}

.ide__bhv img { width: 26px; height: 26px; border-radius: 5px; display: block; }
.ide__bhv:hover { background: var(--ard-teal-soft); }

.menubar { display: flex; flex-wrap: wrap; }

.ide__toplink {
  padding: 5px 10px;
  border: 0;
  border-radius: 4px;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--ard-ink);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.ide__toplink:hover { background: var(--ard-teal-soft); color: var(--ard-teal-dark); }

/* --- масштаб кода --- */

.zoom {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 6px;
  padding: 2px;
  border: 1px solid var(--ard-line);
  border-radius: 20px;
}

.zoom__btn {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ard-ink);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.zoom__btn:hover { background: var(--ard-teal); color: #fff; }
.zoom__value { min-width: 46px; text-align: center; font-size: 12px; color: #8a969c; }

.ide__sketchname {
  margin-left: auto;
  font-size: 13px;
  color: #8a969c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.menu { position: relative; }

.menu__title {
  padding: 6px 12px;
  background: none;
  border: 0;
  border-radius: 4px;
  font: inherit;
  font-size: 14px;
  color: var(--ard-ink);
  cursor: pointer;
  white-space: nowrap;
}

.menu__title:hover { background: var(--ard-teal-soft); }
.menu.is-open > .menu__title { background: var(--ard-teal); color: #fff; }

.menu__list {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 30;
  min-width: 272px;
  margin: 2px 0 0;
  padding: 4px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--ard-line);
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(30, 45, 50, .18);
}

.menu.is-open .menu__list { display: block; }

.menu__list button,
.menu__list a {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  padding: 6px 10px;
  background: none;
  border: 0;
  border-radius: 3px;
  font: inherit;
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  color: var(--ard-ink);
  cursor: pointer;
}

.menu__list button:hover,
.menu__list a:hover { background: var(--ard-teal); color: #fff; }

.menu__list button[disabled] {
  opacity: .45;
  cursor: default;
}

.menu__list button[disabled]:hover { background: none; color: var(--ard-ink); }

/* Вложенные примеры внутри «Файла» */
.menu__nest { display: block; padding: 0 0 4px; }
.menu__nest button { padding-left: 22px; }

.menu__nesttitle {
  padding: 5px 10px 2px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #9aa6ac;
}
.menu__list button:hover kbd { color: rgba(255, 255, 255, .8); }
.menu__list button.is-danger { color: #c0392b; }
.menu__list button.is-danger:hover { background: #c0392b; color: #fff; }
.menu__list kbd { color: #9aa6ac; font-size: 12px; font-family: inherit; }
.menu__sep { height: 1px; margin: 4px 6px; background: var(--ard-line); }

.menu__group {
  padding: 6px 10px 2px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #9aa6ac;
}

.menu__quick { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 6px 4px; }

.menu__quick button {
  width: auto;
  padding: 4px 9px;
  border: 1px solid var(--ard-line);
  border-radius: 20px;
  font-size: 13px;
}

/* --- панель инструментов --- */

.ide__toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 12px;
  background: var(--ard-bar);
  border-bottom: 1px solid var(--ard-line);
  flex-wrap: wrap;
}

.tb {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--ard-teal);
  color: #fff;
  cursor: pointer;
  transition: background .15s ease;
}

.tb:hover { background: var(--ard-teal-dark); }
.tb__glyph { font-size: 17px; line-height: 1; }

.tb--upload .tb__glyph { font-size: 19px; }

.tb--ghost { background: transparent; color: var(--ard-ink); }
.tb--ghost:hover { background: var(--ard-teal-soft); color: var(--ard-teal-dark); }

.tb__board select,
.tb__port select {
  min-width: 200px;
  max-width: 280px;
  padding: 7px 12px;
  border: 1px solid var(--ard-line);
  border-radius: 20px;
  background: #fff;
  color: var(--ard-ink);
  font: inherit;
  font-size: 14px;
}

.tb__port select { min-width: 160px; max-width: 220px; }

.tb__modes {
  display: inline-flex;
  border: 1px solid var(--ard-line);
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
}

.tb__mode {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ard-ink);
  cursor: pointer;
}

.tb__mode + .tb__mode { border-left: 1px solid var(--ard-line); }

.tb__mode.is-active {
  background: var(--ard-teal);
  color: #fff;
}

.tb__mode:hover:not(.is-active) { background: var(--ard-teal-soft); }

.tb__flash {
  font-weight: 600 !important;
  padding: 6px 10px !important;
  border: 1px solid var(--ard-teal) !important;
  border-radius: 16px !important;
}

.tb__link {
  background: none;
  border: 0;
  padding: 4px 2px;
  font: inherit;
  font-size: 14px;
  color: var(--ard-teal);
  cursor: pointer;
}

.tb__link:hover { color: var(--ard-teal-dark); text-decoration: underline; }
.tb__space { flex: 1; }

/* --- рабочая область: боковая панель + редактор --- */

.ide__work { flex: 1; min-height: 0; display: flex; }
.ide__col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Менеджер библиотек сбоку — как в Arduino IDE 2 */
.libpanel {
  width: 320px;
  flex: none;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--ard-line);
  background: var(--ard-bar);
}

.libpanel[hidden] { display: none; }

.libpanel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--ard-line);
  font-size: 14px;
}

.libpanel__close {
  background: none;
  border: 0;
  font-size: 20px;
  line-height: 1;
  color: #8a969c;
  cursor: pointer;
}

.libpanel__close:hover { color: #c0392b; }

.libpanel__tools { display: grid; gap: 8px; padding: 10px 12px; }

.libpanel__tools input,
.libpanel__tools select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--ard-line);
  border-radius: 4px;
  background: #fff;
  font: inherit;
  font-size: 14px;
  color: var(--ard-ink);
}

.libpanel__list { flex: 1; min-height: 0; overflow: auto; padding: 0 12px 12px; }

.libpanel__group {
  margin: 12px 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #9aa6ac;
}

.libpanel__empty { margin: 0 0 8px; font-size: 13px; color: #8a969c; line-height: 1.45; }
.libpanel__foot { padding: 12px; border-top: 1px solid var(--ard-line); }

.libpanel .liblist__row {
  display: block;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fff;
  border: 1px solid var(--ard-line);
  border-radius: 4px;
}

.libpanel .liblist__author { font-size: 12px; color: #8a969c; }
.libpanel .liblist__text { font-size: 13px; color: #6d787e; margin-top: 4px; line-height: 1.4; }
.libpanel .liblist__tools { display: flex; gap: 12px; margin-top: 8px; }
.libpanel .linkbtn { font-size: 13px; color: var(--ard-teal); }
.libpanel .linkbtn--danger { color: #c0392b; }

.libpanel .dropzone {
  padding: 14px;
  border: 2px dashed #c3d4d4;
  border-radius: 4px;
  background: #fff;
  font-size: 13px;
}

.libpanel .dropzone b { display: block; font-size: 13px; }
.libpanel .dropzone span { display: block; margin: 4px 0 8px; color: #8a969c; }
.libpanel .dropzone input { font-size: 12px; }

/* --- ползунок высоты панели вывода --- */

.ide__grip {
  height: 6px;
  flex: none;
  background: var(--ard-line);
  cursor: row-resize;
  position: relative;
}

.ide__grip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 2px;
  width: 46px;
  height: 2px;
  margin-left: -23px;
  border-radius: 2px;
  background: #b3c2c2;
}

.ide__grip:hover { background: var(--ard-teal-soft); }
.ide__grip:focus-visible { outline: 2px solid var(--ard-teal); outline-offset: -2px; }
body.is-resizing { cursor: row-resize; user-select: none; }

/* --- вкладки скетча --- */

.ide__tabsbar {
  background: var(--ard-bar);
  border-bottom: 1px solid var(--ard-line);
  padding: 0 8px;
}

.ide__tabs { display: flex; gap: 0; overflow-x: auto; }

.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 0;
  border-top: 2px solid transparent;
  background: none;
  font: inherit;
  font-size: 14px;
  color: var(--ard-ink);
  cursor: pointer;
  white-space: nowrap;
}

.tab:hover { background: rgba(0, 129, 132, .08); }

.tab.is-active {
  background: #fff;
  border-top-color: var(--ard-teal);
  font-weight: 600;
}

.tab__close { color: #9aa6ac; }
.tab__close:hover { color: #c0392b; }
.tab--add { color: #9aa6ac; font-size: 17px; }

/* --- редактор --- */

.ide__editor { flex: 1; min-height: 0; background: #fff; --code-size: 14px; }

.ide__editor .CodeMirror {
  height: 100%;
  font-size: var(--code-size);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: #212121;
}

.ide__editor .CodeMirror-gutters { background: var(--ard-bar); border-right: 1px solid var(--ard-line); }
.ide__editor .CodeMirror-linenumber { color: #9aa6ac; }
.ide__editor .CodeMirror-activeline-background { background: #f2f8f8; }
/* Подсветка в духе Arduino: бирюзовые ключевые слова, оранжевые типы. */
.ide__editor .cm-keyword { color: var(--ard-teal); font-weight: 600; }
.ide__editor .cm-builtin { color: var(--ard-teal); }
.ide__editor .cm-type, .ide__editor .cm-variable-3 { color: var(--ard-orange); }
.ide__editor .cm-number { color: #7b3fbf; }
.ide__editor .cm-string { color: #297a29; }
.ide__editor .cm-comment { color: #95a5a6; font-style: italic; }
.ide__editor .cm-meta { color: var(--ard-orange); }

/* --- вывод и монитор --- */

.ide__panel {
  height: 220px;
  flex: none;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--ard-line);
  background: var(--ard-console);
  color: #e8eced;
}

.ide__paneltabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: #232323;
  border-bottom: 1px solid #333;
}

.ide__panelspace { flex: 1; }
.ide__paneltabs .linkbtn { color: #9aa6ac; font-size: 13px; }
.ide__paneltabs .linkbtn:hover { color: #fff; }

.paneltab {
  padding: 4px 12px;
  background: none;
  border: 0;
  border-radius: 3px;
  color: #9aa6ac;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.paneltab:hover { color: #fff; }
.paneltab.is-active { background: var(--ard-teal); color: #fff; }

.pane { display: none; flex: 1; min-height: 0; flex-direction: column; padding: 10px 14px 12px; }
.pane.is-active { display: flex; }

.pane__summary { font-size: 14px; line-height: 1.5; padding-bottom: 6px; }
.pane__summary.is-ok { color: #7bd88f; }
.pane__summary.is-bad { color: #ff8a80; }
.pane__summary.is-work { color: #ffd479; }
.pane__jump { color: #6ec7cb; margin-left: 10px; font-size: 13px; }

.pane__details { min-height: 0; overflow: auto; }
.pane__details summary { cursor: pointer; color: #9aa6ac; font-size: 13px; }

.ide__panel pre {
  margin: 6px 0 0;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow: auto;
  flex: 1;
  min-height: 0;
  color: #d7dbdd;
}

.pane__monitorbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.pane__monitorbar input[type="text"],
.pane__monitorbar select {
  padding: 5px 10px;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  background: #101010;
  color: #e8eced;
  font: inherit;
  font-size: 13px;
}

.pane__monitorbar .tb__link { color: #6ec7cb; }
.pane__monitorbar .tb__link:hover { color: #fff; }
.pane__filter { width: 110px; }
.pane__check { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #9aa6ac; }
.pane__hint { margin: 6px 0 0; font-size: 12px; color: #9aa6ac; }

/* --- строка состояния --- */

.ide__status {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 26px;
  padding: 0 14px;
  background: var(--ard-teal);
  color: #fff;
  font-size: 12px;
}

.ide__space { flex: 1; }
.ide__statusitem { white-space: nowrap; opacity: .95; }
.ide__copy { opacity: .8; }
.ide__save { opacity: .95; }
.ide__save.is-ok::before,
.ide__save.is-dirty::before,
.ide__save.is-bad::before { content: "● "; }
.ide__save.is-dirty { color: #ffe08a; }
.ide__save.is-bad { color: #ffc2bd; }

@media (max-width: 860px) {
  .ide { height: auto; }
  .ide__menubar { flex-wrap: wrap; padding: 6px 8px; }
  .ide__sketchname { display: none; }
  .ide__work { flex-direction: column; }
  .libpanel { width: 100%; border-right: 0; border-bottom: 1px solid var(--ard-line); max-height: 60vh; }
  .ide__editor { height: 52vh; }
  .ide__panel { height: 240px; }
  .ide__grip { display: none; }
  .tb__board select { min-width: 160px; }
  .ide__status { flex-wrap: wrap; padding: 6px 12px; gap: 10px; }
}

/* --- окно поверх страницы --- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 21, 29, .55);
}

.modal[hidden] { display: none; }

.modal__box {
  position: relative;
  width: min(620px, 100%);
  max-height: 80vh;
  overflow: auto;
  padding: 26px 28px;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.modal__close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: 0;
  font-size: 26px;
  line-height: 1;
  color: var(--fg-muted);
  cursor: pointer;
}

.modal__title { margin: 0 0 14px; font-size: 21px; }
.modal__body p { margin: 0 0 12px; }
.modal__group { margin: 20px 0 8px; font-size: 15px; }
.modal__empty { color: var(--fg-muted); font-size: 14px; }
.modal__list { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.modal__files { margin: 12px 0; padding-left: 18px; font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.modal__status { margin: 0 0 12px; font-size: 15px; line-height: 1.45; }
.modal__progress {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f0f4f4;
}
.modal__bar {
  height: 8px;
  width: 0%;
  border-radius: 4px;
  background: var(--accent, #008184);
  transition: width 0.2s ease;
  margin-bottom: 8px;
}
.modal__progress .modal__status { margin: 0; font-size: 14px; color: #334; }
.modal__body .btn { margin-top: 8px; }

/* Контекстное меню среды (Arduino-подобное, не браузерное) */
.ctxmenu {
  position: fixed;
  z-index: 10000;
  min-width: 220px;
  padding: 6px 0;
  margin: 0;
  background: #fff;
  border: 1px solid #c5d0d0;
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(15, 40, 40, 0.18);
  font-size: 14px;
  color: #1a2a2a;
  user-select: none;
}

.ctxmenu__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 7px 14px;
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.ctxmenu__item:hover,
.ctxmenu__item:focus {
  background: #e6f4f4;
  color: #00666a;
  outline: none;
}

.ctxmenu__item kbd {
  font: 12px/1 ui-monospace, Consolas, monospace;
  color: #7a8a8a;
  font-weight: 400;
}

.ctxmenu__item:hover kbd,
.ctxmenu__item:focus kbd {
  color: #4a7a7c;
}

.ctxmenu__sep {
  height: 1px;
  margin: 5px 10px;
  background: #e0e8e8;
}

/* В IDE не показываем системный I-beam menu на тачпадах как «сайт» */
.ide {
  -webkit-touch-callout: none;
}

.liblist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.liblist__row {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.liblist__author { font-size: 13px; color: var(--fg-muted); }
.liblist__text { font-size: 14px; color: var(--fg-muted); margin-top: 4px; }
.liblist__tools { display: flex; gap: 12px; flex: none; }

.dropzone {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 20px;
  border: 2px dashed #c5d1e2;
  border-radius: var(--radius);
  text-align: center;
  background: var(--bg-soft);
}

.dropzone span { font-size: 14px; color: var(--fg-muted); }
.dropzone.is-over { border-color: var(--accent); background: #eaf1fb; }
.dropzone.is-busy { opacity: .6; pointer-events: none; }
.dropzone input { margin-top: 8px; justify-self: center; }

@media (max-width: 860px) {
  .ide { height: auto; }
  .ide__body { flex-direction: column; }
  .ide__menu { width: 100%; display: flex; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); }
  .menu__title { width: auto; padding: 8px 12px; }
  .menu__list { left: 0; top: 100%; }
  .ide__editor { height: 50vh; }
  .ide__panel { height: 260px; }
}

/* --- админка --- */
/* Плотнее и суше публичной части: здесь работают, а не читают. */

.adm { background: #f7f8fa; }

.adm__top {
  background: #10151d;
  color: #e6edf6;
  position: sticky;
  top: 0;
  z-index: 10;
}

.adm__wrap { max-width: 1360px; margin: 0 auto; padding: 0 24px; }

.adm__top .adm__wrap {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 56px;
}

.adm__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}

.adm__brand img { border-radius: 5px; display: block; }

.adm__nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }

.adm__nav a {
  color: #b8c4d4;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 15px;
}

.adm__nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.adm__nav a.is-active { background: rgba(255, 255, 255, .16); color: #fff; }

.adm__user {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  color: #b8c4d4;
  white-space: nowrap;
}

.adm__user a { color: #b8c4d4; }
.adm__user .linkbtn { color: #b8c4d4; }

.adm__main { padding-top: 28px; padding-bottom: 72px; }

.adm__title { margin: 0 0 6px; font-size: 26px; letter-spacing: -.02em; }
.adm__subtitle { margin: 40px 0 14px; font-size: 19px; }
.adm__h3 { margin: 22px 0 10px; font-size: 16px; }
.adm__sub { margin: 0 0 20px; color: var(--fg-muted); font-size: 15px; }

.adm__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.adm__headactions { display: flex; align-items: center; gap: 16px; }

.adm__message,
.adm__warn {
  margin: 0 0 20px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 15px;
  background: #e8f0fb;
  border: 1px solid #c5d8f2;
  color: #143a76;
}

.adm__warn { background: #fff4e5; border-color: #f3d6a8; color: #7a4a06; }

.adm__stats { display: flex; gap: 16px; flex-wrap: wrap; margin: 20px 0 8px; }

.stat {
  flex: 1 1 160px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.stat__num { display: block; font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.stat__cap { display: block; margin-top: 4px; font-size: 14px; color: var(--fg-muted); }

.adm__table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 15px;
}

.adm__table th {
  text-align: left;
  padding: 11px 14px;
  background: #eef1f5;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--fg-muted);
  font-weight: 600;
}

.adm__table td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.adm__table--tight { font-size: 14px; }
.adm__table--tight td { padding: 8px 12px; }
.adm__cell--right { text-align: right; white-space: nowrap; }
.adm__empty { color: var(--fg-muted); }

.adm__actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }
.adm__key { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #e7ebf1;
  color: var(--fg-muted);
  white-space: nowrap;
}

.tag--ok { background: #e3f2e5; color: #1e6023; }
.tag--bad { background: #fdecea; color: #8c1d18; }

.adm__form {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.adm__form--row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.adm__form--row .field { flex: 1 1 180px; }
.adm__form--row .field__input { min-width: 140px; }

.adm__cols { display: flex; gap: 16px; flex-wrap: wrap; }
.adm__cols .field { flex: 1 1 200px; }

.field__input--code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

textarea.field__input { resize: vertical; }

.adm__publish {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.adm__publish .field__input { flex: 1 1 260px; }

.adm__toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.adm__toolbar .adm__form { margin-top: 0; }
.adm__issue { align-items: center; }
.adm__issuelabel { font-weight: 600; }

.adm__media { display: flex; gap: 24px; flex-wrap: wrap; }
.adm__mediacol { flex: 1 1 340px; }

.adm__thumb {
  width: 140px;
  height: 105px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.adm__thumb--wide { width: 100%; max-width: 420px; height: auto; }

.adm__gallery { display: flex; gap: 14px; flex-wrap: wrap; }
.adm__gallery figure { margin: 0; width: 140px; font-size: 13px; }
.adm__gallery figcaption { margin: 6px 0 2px; color: var(--fg-muted); }

/* Четыре ссылки в строку помещаются не всегда: на узком экране они уезжают
   под логотип отдельной прокручиваемой строкой, а не ломают шапку. */
@media (max-width: 1060px) {
  .topbar__inner { flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  .topnav {
    order: 3;
    width: 100%;
    flex: none;
    overflow-x: auto;
    margin-left: -10px;
    scrollbar-width: thin;
  }
}

@media (max-width: 860px) {
  .cabinet { grid-template-columns: 1fr; gap: 24px; }
  .cabinet__nav { position: static; }
  .cabinet__nav nav { display: flex; flex-wrap: wrap; gap: 6px; }
  .adm__top .adm__wrap { height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  .adm__table { display: block; overflow-x: auto; }
}

@media (max-width: 640px) {
  .hero { padding: 48px 0; }
  .section { padding: 36px 0; }
  .brand__text { display: none; }
  .cta { padding: 24px 20px; }
  .form-page { padding-top: 36px; }
}
