/* ПДД Экзамен — дизайн-система тренажёра.
   Единственный стилевой файл: токены, тема, шелл, тренажёр, класс ГАИ, справочники.
   Mobile-first: базовые правила = телефон, медиа-запросы вверх = планшет/десктоп. */

/* Шрифты объявлены в static/css/fonts.css (собирается tools/fetch_fonts.py)
   и подключаются отдельным <link> до этого файла. */

/* ============================================================
   2. Токены темы
   ============================================================ */
:root {
  color-scheme: light;

  --bg: #eaeff7;
  --bg-deep: #dfe6f1;
  --surface: #ffffff;
  --surface-2: #f4f7fc;
  --surface-3: #eaf0f8;
  --surface-glass: rgba(255, 255, 255, 0.82);
  --border: #dbe3f0;
  --border-strong: #c3cfe2;

  --ink: #0c1726;
  --ink-2: #4b5d76;
  --ink-3: #7c8da5;

  --accent: #1668ff;
  --accent-hi: #0b53d8;
  --accent-soft: #e6efff;
  --accent-ink: #ffffff;
  --cyan: #0b93b5;

  --ok: #0f8a4a;
  --ok-soft: #e4f7ec;
  --ok-line: #97dcb4;
  --bad: #d32436;
  --bad-soft: #fdeaec;
  --bad-line: #f2acb4;
  --warn: #a35c00;
  --warn-soft: #fff4e2;
  --warn-line: #f0cd94;

  --shadow-1: 0 1px 2px rgba(12, 23, 38, 0.05), 0 6px 18px rgba(12, 23, 38, 0.06);
  --shadow-2: 0 2px 6px rgba(12, 23, 38, 0.07), 0 18px 44px rgba(12, 23, 38, 0.12);
  --ring: 0 0 0 3px rgba(22, 104, 255, 0.28);

  --grid-line: rgba(12, 23, 38, 0.045);
  --blob-1: rgba(44, 123, 255, 0.16);
  --blob-2: rgba(56, 224, 245, 0.14);
  --blob-3: rgba(91, 75, 255, 0.1);

  --r-xs: 8px;
  --r-sm: 12px;
  --r: 16px;
  --r-lg: 20px;
  --r-xl: 26px;
  --tap: 46px;
  --header-h: 58px;
  --nav-h: 50px;

  --font: "Manrope", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --display: "Unbounded", "Manrope", ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #070a11;
  --bg-deep: #04060b;
  --surface: #111825;
  --surface-2: #161e2d;
  --surface-3: #1d2637;
  --surface-glass: rgba(11, 16, 25, 0.78);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);

  --ink: #e9eff8;
  --ink-2: #a3b3c9;
  --ink-3: #71849c;

  --accent: #4d8dff;
  --accent-hi: #6ba1ff;
  --accent-soft: rgba(77, 141, 255, 0.16);
  --accent-ink: #04101f;
  --cyan: #38e0f5;

  --ok: #3ddc91;
  --ok-soft: rgba(61, 220, 145, 0.14);
  --ok-line: rgba(61, 220, 145, 0.45);
  --bad: #ff7a8a;
  --bad-soft: rgba(255, 122, 138, 0.14);
  --bad-line: rgba(255, 122, 138, 0.42);
  --warn: #ffc95c;
  --warn-soft: rgba(255, 201, 92, 0.14);
  --warn-line: rgba(255, 201, 92, 0.4);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.55), 0 26px 60px rgba(0, 0, 0, 0.6);
  --ring: 0 0 0 3px rgba(77, 141, 255, 0.35);

  --grid-line: rgba(255, 255, 255, 0.04);
  --blob-1: rgba(44, 123, 255, 0.22);
  --blob-2: rgba(56, 224, 245, 0.16);
  --blob-3: rgba(120, 75, 255, 0.2);
}

/* ============================================================
   3. База
   ============================================================ */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--nav-h) + 12px);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

/* Технологичный фон: мягкие световые пятна + тонкая сетка */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(72vw 60vh at 8% -8%, var(--blob-1), transparent 62%),
    radial-gradient(58vw 48vh at 104% 6%, var(--blob-2), transparent 60%),
    radial-gradient(70vw 62vh at 52% 108%, var(--blob-3), transparent 64%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  pointer-events: none;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(120vh 100vh at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(120vh 100vh at 50% 0%, #000 20%, transparent 78%);
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { font: inherit; }

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--r-xs);
}

::selection { background: var(--accent); color: var(--accent-ink); }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.18;
  color: var(--ink);
  margin: 0 0 10px;
}
h1 { font-size: 25px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p { margin: 0 0 12px; color: var(--ink-2); }

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

/* ============================================================
   4. Каркас приложения
   ============================================================ */
.local-app {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* --- Шапка --- */
.pdd-top {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--header-h);
  padding: 0 12px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  background: var(--surface-glass);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.pdd-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-right: auto;
}
.pdd-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(44, 123, 255, 0.35);
}
.pdd-brand-stack { display: flex; flex-direction: column; min-width: 0; }
.pdd-brand-name {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  white-space: nowrap;
}
.pdd-brand-tag {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Кнопки в шапке */
.pdd-top-actions { display: flex; align-items: center; gap: 6px; }

.pdd-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.pdd-icon-btn svg { width: 20px; height: 20px; display: block; }
@media (hover: hover) {
  .pdd-icon-btn:hover { color: var(--accent); border-color: var(--accent); }
}
.pdd-icon-btn:active { transform: scale(0.96); }

/* Иконка темы: видна только одна — та, что описывает текущий режим */
.pdd-icon-btn .icon-theme-dark { display: none; }
[data-theme="dark"] .pdd-icon-btn .icon-theme-dark { display: block; }
[data-theme="dark"] .pdd-icon-btn .icon-theme-light { display: none; }

/* --- Навигация разделами (чипсы) --- */
.main-menu-container { display: contents; }
.main-menu-c-sub { display: contents; }

#menu {
  position: sticky;
  top: var(--header-h);
  z-index: 80;
  background: var(--surface-glass);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--border);
}
#menu ul {
  display: flex;
  gap: 6px;
  align-items: center;
  height: var(--nav-h);
  margin: 0;
  padding: 0 12px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  list-style: none;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  /* растворяем правый край — видно, что полосу можно прокрутить */
  mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 26px), transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 26px), transparent 100%);
}
#menu ul::-webkit-scrollbar { display: none; }
#menu ul li { flex: 0 0 auto; }
#menu ul li a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  transition: color 0.16s var(--ease), background 0.16s var(--ease), border-color 0.16s var(--ease);
}
@media (hover: hover) {
  #menu ul li a:hover { color: var(--ink); border-color: var(--border-strong); }
}
#menu ul li a.active {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
  box-shadow: 0 6px 18px rgba(22, 104, 255, 0.3);
}

/* Единые line-иконки через mask + currentColor */
.pdd-ico {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask: var(--ico) center / contain no-repeat;
  mask: var(--ico) center / contain no-repeat;
}

/* --- Колонка режимов --- */
.examen-menu-container { order: 1; }
.examen-menu-c-sub { display: block; }

#menu-buttons, #buttons-show { display: block; }

.menu-modes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 14px 12px 0;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}

.menu-modes > a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1);
  transition: border-color 0.16s var(--ease), transform 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
@media (hover: hover) {
  .menu-modes > a:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-2);
  }
}
.menu-modes > a:active { transform: scale(0.99); }

.menu-modes > a.exam-active {
  border-color: var(--accent);
  background:
    linear-gradient(135deg, var(--accent-soft), transparent 70%),
    var(--surface);
  box-shadow: 0 8px 24px rgba(22, 104, 255, 0.18);
}

.mode-ico {
  display: inline-block;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  background-color: var(--ink-3);
  -webkit-mask: var(--ico) center / contain no-repeat;
  mask: var(--ico) center / contain no-repeat;
  transition: background-color 0.16s var(--ease);
}
.menu-modes > a.exam-active .mode-ico { background-color: var(--accent); }

.mode-title {
  display: block;
  font-size: 15px;
  font-weight: 750;
  color: var(--ink);
}
.mode-desc {
  display: block;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink-3);
  margin-top: 1px;
}

.mywrongscounter, .myfavcounter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--bad);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  vertical-align: 1px;
}
.mywrongscounter-gray, .myfavcounter-gray {
  background: var(--surface-3);
  color: var(--ink-3);
}

/* Настройки и категория */
.menu-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 12px 0;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}
#settings-options-button,
#settings-category-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.16s var(--ease), color 0.16s var(--ease);
}
@media (hover: hover) {
  #settings-options-button:hover,
  #settings-category-button:hover { border-color: var(--accent); color: var(--accent); }
}
#settings-options-button .mode-ico { width: 18px; height: 18px; background-color: currentColor; }
#buttonTextCategory {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent);
}

/* --- Основная область --- */
.content-container {
  order: 2;
  flex: 1 1 auto;
  min-width: 0;
  padding: 14px 12px calc(28px + env(safe-area-inset-bottom));
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}

/* ============================================================
   5. Панели и карточки
   ============================================================ */
.right-card,
.box-menu-dialog,
.local-panel-block {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  padding: 18px 16px 20px;
  max-width: 860px;
}
.box-menu-dialog,
.local-panel-block { display: none; }
.box-menu-dialog.show,
.local-panel-block.show { display: block; }

.crumbs {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.pdd-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 11px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Плитка «что внутри» на главной */
.pdd-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.pdd-fact {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.pdd-fact b {
  display: block;
  font-family: var(--display);
  font-size: 20px;
  color: var(--ink);
  line-height: 1.1;
}
.pdd-fact span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
}

.pdd-hint {
  margin: 0;
  font-size: 13px;
  color: var(--ink-3);
}

/* Кнопки */
.local-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 15px;
  font-weight: 750;
  cursor: pointer;
  transition: background 0.16s var(--ease), transform 0.16s var(--ease);
}
@media (hover: hover) {
  .local-btn:hover { background: var(--accent-hi); }
}
.local-btn:active { transform: scale(0.98); }
.local-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.local-btn.secondary {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--ink);
}
@media (hover: hover) {
  .local-btn.secondary:hover { border-color: var(--accent); color: var(--accent); background: var(--surface-2); }
}

.forum-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
}
.forum-item strong { display: block; font-size: 15px; }
.forum-item span { font-size: 13px; color: var(--ink-3); }

/* ============================================================
   6. Билеты и темы
   ============================================================ */
.tickets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.button-bilet-item {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.button-bilet-item-sub { display: contents; }
@media (hover: hover) {
  .button-bilet-item:hover {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
  }
}
.button-bilet-item:active { transform: scale(0.96); }

.button-thema-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--tap);
  padding: 11px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 650;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}
@media (hover: hover) {
  .button-thema-item:hover { border-color: var(--accent); background: var(--surface-3); }
}
.button-thema-count {
  flex-shrink: 0;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
}

/* ============================================================
   7. Тренажёр (вопрос-ответ)
   ============================================================ */
#view-quiz { display: none; max-width: 860px; }

.quiz-hero {
  position: relative;
  overflow: hidden;
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background:
    linear-gradient(135deg, var(--accent-soft), transparent 62%),
    var(--surface);
  box-shadow: var(--shadow-1);
}
.quiz-hero h1 { font-size: 18px; margin: 0 0 4px; }
.quiz-hero p { margin: 0; font-size: 13px; color: var(--ink-3); }

.timer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.box_num_bil_vop { display: flex; flex-direction: column; min-width: 0; }
#nomerb {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#nomerq { font-size: 12px; font-weight: 650; color: var(--ink-3); }
#timer {
  flex-shrink: 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.local-statline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-bottom: 10px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-3);
}
.local-statline .ok { color: var(--ok); }
.local-statline .bad { color: var(--bad); }

.quiz-stack { display: block; }
#blking-examen {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
#blking-examen > div { padding: 14px !important; }

.quest-image {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.quest-image.is-empty { display: none; }

#quest-block {
  margin: 12px 0 14px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}

/* Варианты ответа. JS полностью заменяет className, поэтому каждое
   состояние описано самостоятельным правилом. */
.answer,
.answer_red,
.answer_green,
.answer_yellow,
.answer_gray {
  display: block;
  min-height: var(--tap);
  padding: 11px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.answer_red, .answer_green, .answer_yellow, .answer_gray { cursor: default; }
@media (hover: hover) {
  .answer:hover { border-color: var(--accent); background: var(--surface-3); }
}
.answer:active { transform: scale(0.995); }

.answer ol,
.answer_red ol,
.answer_green ol,
.answer_yellow ol,
.answer_gray ol {
  margin: 0;
  padding-left: 22px;
}
.answer ol li,
.answer_red ol li,
.answer_green ol li,
.answer_yellow ol li,
.answer_gray ol li { padding-left: 2px; }

.answer_green {
  border-color: var(--ok-line);
  background: var(--ok-soft);
  color: var(--ink);
  font-weight: 650;
}
.answer_red {
  border-color: var(--bad-line);
  background: var(--bad-soft);
  color: var(--ink);
}
.answer_yellow {
  border-color: var(--warn-line);
  background: var(--warn-soft);
}
.answer_gray { opacity: 0.62; }

#tip-quest {
  display: none;
  padding: 12px 14px;
  margin-top: 12px;
  border: 1px solid var(--ok-line);
  border-left: 3px solid var(--ok);
  border-radius: var(--r-sm);
  background: var(--ok-soft);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
}
#tip-quest.show { display: block; }
#tip-quest.bad {
  border-color: var(--bad-line);
  border-left-color: var(--bad);
  background: var(--bad-soft);
}
#tip-quest b { color: var(--ink); }

.local-next-row {
  display: none;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.local-next-row.show { display: flex; }
.local-next-row .local-btn { flex: 1 1 auto; }

#blking-quests {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 6px;
  margin-top: 12px;
}
.q-number,
.q-number-active,
.q-number-red,
.q-number-green,
.q-number-gray {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s var(--ease), border-color 0.16s var(--ease);
}
@media (hover: hover) {
  .q-number:hover, .q-number-gray:hover, .q-number-green:hover, .q-number-red:hover {
    border-color: var(--accent);
  }
}
.q-number-green {
  border-color: var(--ok-line);
  background: var(--ok-soft);
  color: var(--ok);
}
.q-number-red {
  border-color: var(--bad-line);
  background: var(--bad-soft);
  color: var(--bad);
}
.q-number-gray { color: var(--ink-3); }
.q-number-active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 4px 14px rgba(22, 104, 255, 0.35);
}

/* Подсказка про клавиши бессмысленна на телефоне — только для десктопа */
.local-keys-hint { display: none; }

/* ============================================================
   8. Итог тренировки (модальное окно)
   ============================================================ */
#result-examen-shadow {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 295;
  background: rgba(4, 8, 16, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
#result-examen-shadow.show { display: block; }

#result-examen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 296;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#result-examen.show { display: flex; }
.result-examen-box { width: min(420px, 100%); }
.result-examen-upper {
  padding: 24px 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  text-align: center;
}
.svg-rezult-exam,
.svg-rezult-exam-good {
  display: none;
  width: 84px;
  height: 84px;
  margin: 0 auto 12px;
}
.svg-rezult-exam.show,
.svg-rezult-exam-good.show { display: block; }
.svg-rezult-exam circle,
.svg-rezult-exam path { stroke: var(--bad); stroke-width: 5; fill: none; }
.svg-rezult-exam-good path { fill: var(--ok); }

.rezult {
  display: none;
  font-family: var(--display);
  font-size: 27px;
  line-height: 1.15;
  color: var(--ink);
}
.rezult.show { display: block; }
#textresultGood.rezult { color: var(--ok); }
#textresultBad.rezult { color: var(--bad); }
.resultCountBlock {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 650;
  color: var(--ink-2);
}
#reswrongscounter-print, #restime-print {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--ink);
}

/* ============================================================
   9. Класс ГАИ (полный экран)
   ============================================================ */
.gibdd-start {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 30000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background:
    radial-gradient(70vw 50vh at 50% -10%, var(--blob-1), transparent 60%),
    var(--bg-deep);
}
.gibdd-start.show { display: flex; }
.gibdd-start-card {
  width: min(560px, 100%);
  max-height: 88vh;
  overflow: auto;
  padding: 22px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-2);
}
.gibdd-start-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-family: var(--display);
  font-size: 15px;
  color: var(--ink);
}
.gibdd-start-brand img { width: 32px; height: 32px; border-radius: 9px; }
.gibdd-start-card h1 { font-size: 24px; margin-bottom: 10px; }
.gibdd-start-card p { font-size: 14px; }
.gibdd-start-card .warn {
  padding: 10px 12px;
  border: 1px solid var(--warn-line);
  border-radius: var(--r-sm);
  background: var(--warn-soft);
  color: var(--ink);
  font-weight: 650;
}
.gibdd-start-cta { font-weight: 750; color: var(--ink); }
.gibdd-start-cats { display: flex; gap: 10px; margin-top: 6px; }
.gibdd-start-cats button {
  flex: 1;
  min-height: 56px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--display);
  font-size: 19px;
  cursor: pointer;
  transition: background 0.16s var(--ease);
}
.gibdd-start-cats button:last-child {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--ink);
}
@media (hover: hover) {
  .gibdd-start-cats button:hover { background: var(--accent-hi); }
  .gibdd-start-cats button:last-child:hover { border-color: var(--accent); color: var(--accent); }
}
.gibdd-back {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: 16px;
  z-index: 30001;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface-glass);
  border: 1px solid var(--border);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
}

.full-examen-pdd {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20000;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  background:
    radial-gradient(70vw 50vh at 50% -10%, var(--blob-1), transparent 60%),
    var(--bg-deep);
  user-select: none;
  overflow: auto;
}
.full-examen-pdd.show { display: block; }

.full-exam-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.full-exam-numbers {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.full-exam-numbers::-webkit-scrollbar { display: none; }
.full-exam-logo { width: 30px; height: 30px; border-radius: 9px; display: block; }
.full-exam-num,
#quest-mini-list {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.full-exam-num.answered { opacity: 0.75; }
.full-exam-num.ok { border-color: var(--ok-line); background: var(--ok-soft); color: var(--ok); }
.full-exam-num.wrong { border-color: var(--bad-line); background: var(--bad-soft); color: var(--bad); }
.full-exam-num-active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--ring);
}
#quest-mini-list { color: var(--ink-2); }
#quest-mini-list svg { width: 16px; height: 16px; }

.full-exam-extras { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.full-exam-timer {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.full-exam-extra, .full-exam-user {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 15px;
  cursor: pointer;
}
.full-exam-user { display: none; }

/* Сетка вопросов: на телефоне 2 колонки, блоки прозрачны для раскладки */
.full-container {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.full-block { display: contents; }
.full-exam-cell { position: relative; }
.full-exam-item-sub {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}
.full-exam-item-res { display: none; }
.full-exam-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  min-height: 118px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.16s var(--ease);
}
@media (hover: hover) {
  .full-exam-item:hover { border-color: var(--accent); }
}
.full-exam-item.has-answer { opacity: 0.9; }
.full-exam-item.has-ok { border-color: var(--ok-line); background: var(--ok-soft); }
.full-exam-item.has-wrong { border-color: var(--bad-line); background: var(--bad-soft); }
.full-exam-item-padding { height: 62px; padding: 0; }
.full-exam-item-image {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: var(--r-xs);
  background-size: cover;
  background-position: center;
}
.full-exam-quest {
  display: block;
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--ink-2);
  padding-top: 18px;
}
.full-exam-item-padding + .full-exam-quest { padding-top: 0; }

/* Открытый вопрос класса ГАИ */
.full-quest {
  display: none;
  flex-direction: column;
  gap: 12px;
}
.full-quest.show { display: flex; }
.full-quest-content {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.full-quest-text {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
  margin-bottom: 12px;
}
.full-quest-image img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.full-quest-answers { margin-top: 12px; }
.full-quest-answers .ans {
  min-height: var(--tap);
  padding: 11px 14px;
  margin: 0 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.4;
  list-style: decimal inside;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}
@media (hover: hover) {
  .full-quest-answers .ans:hover { border-color: var(--accent); }
}
.full-quest-answers .ans.picked {
  border-color: var(--warn);
  background: var(--warn-soft);
  font-weight: 700;
}
.full-quest-answers .ans.correct { border-color: var(--ok-line); background: var(--ok-soft); }
.full-quest-answers .ans.bad { border-color: var(--bad-line); background: var(--bad-soft); }

.full-quest-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.full-quest-but {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}
#buttonback { grid-column: 1 / -1; order: 3; }
@media (hover: hover) {
  .full-quest-but:hover { border-color: var(--accent); color: var(--accent); }
}

.full-result-examen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 30050;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(4, 8, 16, 0.68);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.full-result-examen.show { display: flex; }
.full-result-examen > div {
  width: min(460px, 100%);
  padding: 24px 20px !important;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  color: var(--ink) !important;
}
#resultText {
  font-family: var(--display);
  font-size: 24px !important;
  line-height: 1.15;
  margin-bottom: 10px !important;
}
#resultDesc { font-size: 14px !important; color: var(--ink-2); }
.full-result-examen.result-green #resultText { color: var(--ok); }
.full-result-examen.result-red #resultText { color: var(--bad); }

/* ============================================================
   10. Справочники: знаки и текст ПДД
   ============================================================ */
.ref-search {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.ref-search input {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}
.ref-search input::placeholder { color: var(--ink-3); }
.ref-search input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.ref-search .local-btn { min-width: 104px; }

/* --- Знаки: фильтры по категориям --- */
.sign-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 22px), transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 22px), transparent 100%);
}
.sign-filters::-webkit-scrollbar { display: none; }
.sign-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  height: 38px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.sign-chip span {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-3);
}
@media (hover: hover) {
  .sign-chip:hover { border-color: var(--accent); color: var(--ink); }
}
.sign-chip.is-on {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
}
.sign-chip.is-on span { color: rgba(255, 255, 255, 0.78); }

/* --- Знаки: сетка плиток --- */
.signs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(63px, 1fr));
  gap: 6px;
}
.sign-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 88px;
  padding: 8px 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.16s var(--ease), transform 0.16s var(--ease);
}
.sign-tile[hidden] { display: none; }
.sign-tile img {
  width: 100%;
  max-width: 50px;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 7px;
  background: #fff;
  padding: 3px;
}
.sign-tile-noimg { font-size: 10px; color: var(--ink-3); }
.sign-tile-code {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-2);
}
.sign-tile-name { display: none; }
.sign-tile:active { transform: scale(0.96); }

/* Наведение мышью: подсказка с названием над плиткой */
@media (hover: hover) and (min-width: 1024px) {
  .sign-tile:hover { border-color: var(--accent); z-index: 6; }
  .sign-tile:hover .sign-tile-name {
    display: block;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 210px;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--ink);
    color: var(--surface);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.35;
    text-align: center;
    box-shadow: var(--shadow-2);
    pointer-events: none;
  }
}

.signs-empty {
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--ink-3);
  font-size: 14px;
  text-align: center;
}

/* --- Знаки: карточка с пояснением --- */
body.sheet-open { overflow: hidden; }
.sign-sheet {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: flex-end;
}
.sign-sheet[hidden] { display: none; }
.sign-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 16, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.sign-sheet-card {
  position: relative;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-2);
  animation: sheet-up 0.22s var(--ease);
}
@keyframes sheet-up {
  from { transform: translateY(12%); opacity: 0.5; }
  to { transform: none; opacity: 1; }
}
.sign-sheet-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
#sign-sheet-img {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  padding: 5px;
}
.sign-sheet-headtext { flex: 1; min-width: 0; }
.sign-sheet-cat {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}
.sign-sheet-card h2 { margin: 4px 0 0; font-size: 18px; }
.sign-sheet-close { flex-shrink: 0; }
.sign-sheet-body {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-2);
  white-space: pre-line;
}
.sign-penalty {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--warn-line);
  border-radius: var(--r-sm);
  background: var(--warn-soft);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
}
.sign-penalty b {
  display: block;
  margin-bottom: 4px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--warn);
}

.sign-sheet-nav {
  position: sticky;
  bottom: -1px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 18px;
  padding-top: 12px;
  background: linear-gradient(180deg, transparent, var(--surface) 40%);
}
.sign-sheet-nav .local-btn { min-width: 0; }
.sign-sheet-nav .local-btn:disabled { opacity: 0.45; }

.rules-list { display: grid; gap: 8px; }
.rule-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 650;
  transition: border-color 0.16s var(--ease);
}
@media (hover: hover) {
  .rule-link:hover { border-color: var(--accent); }
}
.rule-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 700;
}

/* Текст правил приходит готовым HTML — задаём типографику */
.rule-body { font-size: 15px; line-height: 1.65; color: var(--ink-2); }
.rule-body h2, .rule-body h3, .rule-body h4 {
  font-family: var(--font);
  font-weight: 750;
  color: var(--ink);
  margin: 22px 0 8px;
  font-size: 16px;
  letter-spacing: 0;
}
.rule-body p { margin: 0 0 12px; }
.rule-body ul, .rule-body ol { margin: 0 0 12px; padding-left: 20px; }
.rule-body li { margin-bottom: 6px; }
.rule-body a { color: var(--accent); font-weight: 650; }
.rule-body img {
  height: auto;
  border-radius: var(--r-xs);
  background: #fff;
  padding: 4px;
  margin: 6px 0;
}
.rule-body table {
  width: 100%;
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 0 0 14px;
  font-size: 14px;
}
.rule-body th, .rule-body td {
  padding: 8px 10px;
  border: 1px solid var(--border);
  text-align: left;
}
.rule-body th { background: var(--surface-2); color: var(--ink); font-weight: 750; }
.rule-body blockquote {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  border-radius: var(--r-xs);
  background: var(--surface-2);
}

/* ============================================================
   11. Планшет и десктоп
   ============================================================ */
@media (min-width: 640px) {
  h1 { font-size: 30px; }
  .right-card, .box-menu-dialog, .local-panel-block { padding: 24px 26px 28px; }
  .content-container { padding: 20px 20px 56px; }
  .menu-modes, .menu-tools { padding-left: 20px; padding-right: 20px; }
  .signs-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; }
  .sign-tile { min-height: 98px; padding: 9px 6px; }
  .sign-tile img { max-width: 56px; }
  .sign-sheet { align-items: center; justify-content: center; padding: 20px; }
  .sign-sheet-card {
    width: min(640px, 100%);
    max-height: 82vh;
    border-bottom: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 22px 24px 24px;
  }
  .full-container { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .full-quest-buttons { grid-template-columns: repeat(3, 1fr); }
  #buttonback { grid-column: auto; order: 2; }
  #buttonnext { order: 3; }
  .pdd-facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .quest-image { max-height: 320px; }
  #quest-block { font-size: 19px; }
}

@media (min-width: 1024px) {
  :root { --header-h: 66px; }

  .local-app {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    grid-template-areas:
      "top top"
      "nav nav"
      "modes main";
    grid-template-rows: auto auto 1fr;
  }
  #menu { grid-area: nav; }
  .pdd-top { grid-area: top; padding: 0 24px; gap: 16px; }
  .pdd-mark { width: 40px; height: 40px; border-radius: 12px; }
  .pdd-brand-name { font-size: 19px; }
  .pdd-brand-tag { font-size: 11px; }

  .examen-menu-container { top: calc(var(--header-h) + var(--nav-h)); }
  .local-keys-hint {
    display: block;
    margin-top: 12px;
    font-size: 12.5px;
    color: var(--ink-3);
    text-align: center;
  }

  .examen-menu-container {
    grid-area: modes;
    position: sticky;
    top: var(--header-h);
    align-self: start;
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    padding-bottom: 24px;
  }
  .menu-modes { padding: 20px 8px 0 24px; }
  .menu-tools { padding: 10px 8px 0 24px; }

  .content-container { grid-area: main; padding: 24px 28px 64px; }
  #view-quiz, .right-card, .box-menu-dialog, .local-panel-block { max-width: 900px; }

  .full-examen-pdd { padding: 14px 22px 20px; }
  .full-container { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
  .full-exam-item { min-height: 150px; }
  .full-exam-item-padding { height: 82px; }
  .full-exam-quest { font-size: 12px; }
  .full-exam-logo { width: 34px; height: 34px; }
  .full-quest-text { font-size: 20px; text-align: center; }
  .full-quest-content { padding: 20px; }
  .local-next-row .local-btn { flex: 0 0 auto; min-width: 170px; }
}

/* Широкий экран: навигация переезжает в шапку, к кнопке темы */
@media (min-width: 1280px) {
  #menu {
    position: absolute;
    grid-area: auto;
    top: 0;
    right: 76px;
    z-index: 95;
    display: flex;
    align-items: center;
    height: var(--header-h);
    max-width: calc(100% - 400px);
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 0;
  }
  #menu ul {
    height: auto;
    padding: 0;
    mask-image: none;
    -webkit-mask-image: none;
  }
  .examen-menu-container { top: var(--header-h); }
}

@media (min-width: 1440px) {
  .full-quest-answers, .full-quest-image { max-width: 900px; margin-left: auto; margin-right: auto; }
}

/* Мобильный тренажёр: список режимов не мешает вопросу */
@media (max-width: 1023px) {
  html[data-view="quiz"] .examen-menu-container { display: none; }
}
