/* ==========================================================================
   VibeForge Academy — Единая дизайн-система курса
   Стиль: тёмная «магическая» тема, градиенты, glassmorphism
   Основа: VibeForge-Toolkit (тёмная тема GitHub) + креативное переосмысление
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ---- Палитра ---- */
  --bg: #0b0e14;
  --bg-soft: #0d1117;
  --bg-glow: #10151f;
  --card: #141a28;
  --card-2: #182034;
  --card-hover: #1b2540;
  --border: #243049;
  --border-soft: #1b2540;
  --accent: #58a6ff;
  --accent-2: #8b5cf6;
  --accent-3: #f472b6;
  --accent-4: #22d3ee;
  --success: #3fb950;
  --warning: #d29922;
  --danger: #f85149;
  --text: #c9d1d9;
  --heading: #f0f6fc;
  --muted: #8b949e;

  /* ---- Градиенты ---- */
  --grad-main: linear-gradient(135deg, #58a6ff 0%, #8b5cf6 50%, #f472b6 100%);
  --grad-blue: linear-gradient(135deg, #58a6ff, #22d3ee);
  --grad-purple: linear-gradient(135deg, #8b5cf6, #f472b6);
  --grad-green: linear-gradient(135deg, #3fb950, #22d3ee);
  --grad-amber: linear-gradient(135deg, #d29922, #f472b6);

  /* ---- Прочее ---- */
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 40px rgba(88, 166, 255, 0.15);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --mono: 'Consolas', 'SF Mono', 'Cascadia Code', 'Courier New', monospace;
  --header-h: 64px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Фоновое свечение */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(60% 40% at 15% 0%, rgba(139, 92, 246, 0.12), transparent 60%),
    radial-gradient(50% 35% at 90% 10%, rgba(34, 211, 238, 0.10), transparent 60%),
    radial-gradient(45% 30% at 50% 100%, rgba(88, 166, 255, 0.08), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

::selection { background: rgba(139, 92, 246, 0.35); color: var(--heading); }

/* ---- Скроллбар ---- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border-radius: 6px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ==========================================================================
   Типографика
   ========================================================================== */
h1, h2, h3, h4 { color: var(--heading); line-height: 1.25; font-weight: 700; }
h1 { font-size: clamp(1.9rem, 4vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.text-gradient {
  background: var(--grad-main);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.text-muted { color: var(--muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

code, .mono {
  font-family: var(--mono);
  font-size: 0.9em;
  background: rgba(88, 166, 255, 0.12);
  color: #79c0ff;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid rgba(88, 166, 255, 0.15);
  word-break: break-word;
}

pre {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  overflow-x: auto;
  line-height: 1.5;
  font-size: 13.5px;
}
pre code { background: none; border: none; padding: 0; color: var(--text); }

/* ==========================================================================
   Layout
   ========================================================================== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; position: relative; z-index: 1; }
.container-wide { max-width: 1400px; margin: 0 auto; padding: 0 20px; position: relative; z-index: 1; }

.section { padding: 64px 0; position: relative; }
.section-title { margin-bottom: 12px; }
.section-sub { color: var(--muted); max-width: 720px; margin-bottom: 36px; font-size: 1.05rem; }

/* ==========================================================================
   Шапка
   ========================================================================== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(11, 14, 20, 0.82);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--heading);
  white-space: nowrap;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--grad-main);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.35);
  flex-shrink: 0;
}

.header-spacer { flex: 1; }

/* ==========================================================================
   Кнопки
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--heading);
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--grad-main);
  border: none;
  color: #fff;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.35);
}
.btn-primary:hover { color: #fff; filter: brightness(1.1); }

.btn-success { background: var(--grad-green); border: none; color: #06231a; box-shadow: 0 4px 18px rgba(63, 185, 80, 0.3); }
.btn-success:hover { color: #06231a; filter: brightness(1.08); }

.btn-ghost { background: transparent; }
.btn-lg { padding: 14px 30px; font-size: 16px; border-radius: 12px; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ==========================================================================
   Карточки
   ========================================================================== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  position: relative;
}
.card:hover {
  border-color: rgba(88, 166, 255, 0.4);
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}

.card-glass {
  background: rgba(20, 26, 40, 0.6);
  border: 1px solid var(--border-soft);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

/* ==========================================================================
   Hero (главный экран)
   ========================================================================== */
.hero {
  position: relative;
  padding: 90px 0 80px;
  text-align: center;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -60%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 900px;
  background: radial-gradient(closest-side, rgba(139, 92, 246, 0.18), transparent);
  pointer-events: none;
  animation: heroPulse 6s ease-in-out infinite;
}

@keyframes heroPulse {
  0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.15); }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 100px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.35);
  color: #c4b5fd;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 24px;
}

.hero-title { font-size: clamp(2.2rem, 6vw, 4.2rem); font-weight: 800; margin-bottom: 20px; }
.hero-sub {
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  color: var(--muted);
  max-width: 720px;
  margin: 0 auto 36px;
}

.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ---- Анимированные "искры" ---- */
.sparkle { position: absolute; border-radius: 50%; pointer-events: none; opacity: 0.6; animation: float 8s ease-in-out infinite; }
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-22px) rotate(180deg); }
}

/* ==========================================================================
   Токен-вход
   ========================================================================== */
.token-panel {
  max-width: 560px;
  margin: 40px auto 0;
  text-align: left;
}
.token-input-row { display: flex; gap: 10px; margin-top: 8px; }
.token-input {
  flex: 1;
  padding: 14px 18px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--heading);
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 1px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.token-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2); }
.token-input::placeholder { color: var(--muted); letter-spacing: normal; font-family: var(--font); }

.form-field { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--heading); margin-bottom: 8px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--heading);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}
.form-textarea { resize: vertical; min-height: 90px; }

/* ==========================================================================
   Сетки фич / возможностей
   ========================================================================== */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.feature-card { text-align: left; }
.feature-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 16px;
  background: rgba(88, 166, 255, 0.12);
  border: 1px solid rgba(88, 166, 255, 0.2);
}
.feature-icon.violet { background: rgba(139, 92, 246, 0.14); border-color: rgba(139, 92, 246, 0.25); }
.feature-icon.green { background: rgba(63, 185, 80, 0.14); border-color: rgba(63, 185, 80, 0.25); }
.feature-icon.pink { background: rgba(244, 114, 182, 0.14); border-color: rgba(244, 114, 182, 0.25); }
.feature-icon.cyan { background: rgba(34, 211, 238, 0.14); border-color: rgba(34, 211, 238, 0.25); }
.feature-icon.amber { background: rgba(210, 153, 34, 0.14); border-color: rgba(210, 153, 34, 0.25); }

.feature-title { font-size: 17px; margin-bottom: 8px; }
.feature-desc { color: var(--muted); font-size: 14px; }

/* ==========================================================================
   Шаги / дорожная карта
   ========================================================================== */
.steps { display: flex; flex-direction: column; gap: 0; max-width: 760px; margin: 0 auto; }
.step { display: flex; gap: 20px; position: relative; padding-bottom: 32px; }
.step:last-child { padding-bottom: 0; }
.step::before {
  content: '';
  position: absolute;
  left: 23px;
  top: 48px;
  bottom: 4px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent-2), transparent);
}
.step:last-child::before { display: none; }

.step-num {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--grad-main);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.35);
  z-index: 1;
}
.step-body { padding-top: 6px; }
.step-title { font-size: 18px; margin-bottom: 6px; }
.step-text { color: var(--muted); font-size: 14.5px; }

/* ==========================================================================
   Уровни сложности
   ========================================================================== */
.level-card { text-align: center; padding: 28px 20px; }
.level-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
  text-transform: uppercase;
}
.level-1 .level-badge { background: rgba(63, 185, 80, 0.15); color: var(--success); }
.level-2 .level-badge { background: rgba(34, 211, 238, 0.15); color: var(--accent-4); }
.level-3 .level-badge { background: rgba(210, 153, 34, 0.15); color: var(--warning); }
.level-4 .level-badge { background: rgba(244, 114, 182, 0.15); color: var(--accent-3); }
.level-5 .level-badge { background: rgba(139, 92, 246, 0.18); color: #c4b5fd; }

/* ==========================================================================
   Прогресс
   ========================================================================== */
.progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-soft);
  border-radius: 6px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--grad-main);
  border-radius: 6px;
  transition: width 0.6s ease;
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  animation: shimmer 2s infinite;
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* ==========================================================================
   Модули курса (course.html)
   ========================================================================== */
.course-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: start;
  margin-top: 24px;
}
@media (max-width: 900px) {
  .course-layout { grid-template-columns: 1fr; }
}

.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  max-height: calc(100vh - var(--header-h) - 32px);
  overflow-y: auto;
  padding-right: 6px;
}
@media (max-width: 900px) { .sidebar { position: static; max-height: none; } }

.module-list { display: flex; flex-direction: column; gap: 8px; }
.module-item {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border-soft);
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-user-select: none;
  user-select: none;
}
.module-item:hover { border-color: var(--accent); background: var(--card-hover); }
.module-item.active {
  border-color: var(--accent-2);
  background: linear-gradient(135deg, rgba(139,92,246,0.14), rgba(88,166,255,0.08));
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.15);
}
.module-item.completed { border-left: 3px solid var(--success); }
.module-item.locked { opacity: 0.5; cursor: not-allowed; }

.module-item-top { display: flex; align-items: center; gap: 10px; }
.module-item-icon { font-size: 18px; flex-shrink: 0; }
.module-item-title { font-size: 14px; font-weight: 600; color: var(--heading); flex: 1; }
.module-item-status { font-size: 13px; }
.module-item-desc { font-size: 12px; color: var(--muted); margin-top: 4px; padding-left: 28px; }

/* ==========================================================================
   Карта приключения (сайдбар)
   ========================================================================== */
.adventure-map { position: relative; padding-left: 34px; }
.adventure-track {
  position: absolute;
  left: 15px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 3px;
  background: var(--border-soft);
  overflow: hidden;
}
.adventure-track-fill {
  width: 100%;
  height: 0%;
  background: linear-gradient(180deg, var(--accent-2), var(--success));
  transition: height 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.map-node {
  position: relative;
  margin-bottom: 16px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.map-marker {
  position: absolute;
  left: -34px;
  top: 6px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 2px solid var(--border);
  font-size: 15px;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.map-node.current .map-marker {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.22), 0 2px 12px rgba(139, 92, 246, 0.5);
  transform: scale(1.1);
}
.map-node.done .map-marker { border-color: var(--success); }
.map-flag {
  position: absolute;
  top: -9px;
  right: -10px;
  font-size: 14px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}
.map-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border-soft);
  transition: all 0.25s;
}
.map-node.current .map-card {
  border-color: rgba(139, 92, 246, 0.55);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(88, 166, 255, 0.06));
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.16);
}
.map-node.done .map-card { border-color: rgba(34, 197, 94, 0.35); }
.map-node:hover .map-card { border-color: var(--accent); }
.map-land { font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--accent-2); }
.map-module { font-size: 13.5px; font-weight: 600; color: var(--heading); margin-top: 2px; }
.map-lessons { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.map-lesson {
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}
.map-lesson:hover { border-color: var(--accent); color: var(--heading); }
.map-lesson.done { background: rgba(34, 197, 94, 0.14); border-color: rgba(34, 197, 94, 0.4); color: var(--success); }
.map-lesson.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 3px 10px rgba(139, 92, 246, 0.4);
}
.map-bar { height: 5px; border-radius: 5px; background: var(--border-soft); margin-top: 9px; overflow: hidden; }
.map-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent-2), var(--success)); transition: width 0.5s; border-radius: 5px; }
.map-sub { font-size: 11.5px; color: var(--muted); margin-top: 6px; line-height: 1.4; }

.user-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border-soft);
  margin-bottom: 18px;
}
.lesson-link { transition: all 0.18s ease; border-radius: 8px; }
.lesson-link:hover { filter: brightness(1.2); }

/* ---- Контентная область ---- */
.content-area { min-width: 0; }

.lesson-head { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border-soft); }
.lesson-eyebrow { font-size: 13px; color: var(--accent); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; margin-bottom: 8px; }
.lesson-title { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 10px; }
.lesson-intro { color: var(--muted); font-size: 1.05rem; }

.lesson-section { margin-bottom: 32px; }
.lesson-section h3 { margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.lesson-section h3 .sec-num {
  font-size: 12px;
  background: var(--grad-main);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lesson-section p { margin-bottom: 12px; }
.lesson-section ul, .lesson-section ol { padding-left: 22px; margin-bottom: 14px; }
.lesson-section li { margin-bottom: 6px; }

/* ---- Выделенные блоки ---- */
.callout {
  padding: 16px 18px;
  border-radius: 12px;
  border-left: 4px solid;
  margin: 16px 0;
  font-size: 14.5px;
}
.callout p { margin-bottom: 0; }
.callout.tip { background: rgba(63, 185, 80, 0.08); border-left-color: var(--success); }
.callout.magic { background: rgba(139, 92, 246, 0.10); border-left-color: var(--accent-2); }
.callout.warn { background: rgba(210, 153, 34, 0.08); border-left-color: var(--warning); }
.callout.info { background: rgba(88, 166, 255, 0.08); border-left-color: var(--accent); }

/* ---- Метафора / история ---- */
.story-block {
  padding: 22px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(139,92,246,0.12), rgba(88,166,255,0.06));
  border: 1px solid rgba(139, 92, 246, 0.2);
  margin: 20px 0;
  font-style: italic;
}
.story-block::before { content: '✨ '; }

/* ---- Схемы (слои) ---- */
.layers { display: flex; flex-direction: column; gap: 8px; margin: 18px 0; }
.layer {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  transition: transform 0.2s;
}
.layer:hover { transform: translateX(6px); }
.layer-num {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--grad-main);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.layer-name { font-weight: 600; color: var(--heading); min-width: 150px; }
.layer-desc { color: var(--muted); font-size: 13.5px; }
.layer .layer-emoji { font-size: 20px; }

/* ==========================================================================
   Викторины
   ========================================================================== */
.quiz { margin: 20px 0; }
.quiz-question { font-size: 16px; font-weight: 600; color: var(--heading); margin-bottom: 14px; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-option {
  padding: 13px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14.5px;
}
.quiz-option:hover { border-color: var(--accent); background: var(--card-hover); }
.quiz-option.selected { border-color: var(--accent-2); background: rgba(139, 92, 246, 0.12); }
.quiz-option.correct { border-color: var(--success); background: rgba(63, 185, 80, 0.12); }
.quiz-option.wrong { border-color: var(--danger); background: rgba(248, 81, 73, 0.12); }
.quiz-option .opt-letter {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.quiz-feedback { margin-top: 12px; font-size: 14px; padding: 12px 16px; border-radius: 10px; display: none; }
.quiz-feedback.show { display: block; animation: fadeIn 0.3s ease; }
.quiz-feedback.correct { background: rgba(63, 185, 80, 0.1); border: 1px solid rgba(63, 185, 80, 0.3); color: var(--success); }
.quiz-feedback.wrong { background: rgba(248, 81, 73, 0.1); border: 1px solid rgba(248, 81, 73, 0.3); color: var(--danger); }
.quiz-actions { margin-top: 14px; }

/* ==========================================================================
   Чек-листы (практические задания)
   ========================================================================== */
.checklist { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  transition: all 0.2s;
}
.check-item:hover { border-color: var(--accent); }
.check-item.done { border-color: rgba(63, 185, 80, 0.4); background: rgba(63, 185, 80, 0.06); }
.check-item.done .check-text { color: var(--muted); text-decoration: line-through; }
.check-box {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  transition: all 0.2s;
  font-size: 13px;
  color: transparent;
}
.check-item.done .check-box { background: var(--grad-green); border-color: transparent; color: #06231a; }
.check-text { font-size: 14px; flex: 1; }
.check-hint { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* ==========================================================================
   Галерея проектов
   ========================================================================== */
.project-card { overflow: hidden; }
.project-card .project-cover {
  height: 130px;
  border-radius: 10px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  position: relative;
  overflow: hidden;
}
.project-card .project-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(11,14,20,0.85));
}
.project-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  margin: 0 6px 6px 0;
}
.project-name { font-size: 16px; margin-bottom: 6px; }
.project-desc { font-size: 13.5px; color: var(--muted); }

/* ==========================================================================
   Таблицы
   ========================================================================== */
.table-wrap { overflow-x: auto; margin: 16px 0; border-radius: 12px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left;
  padding: 12px 16px;
  background: var(--card-2);
  color: var(--heading);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 11px 16px; border-bottom: 1px solid var(--border-soft); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(88, 166, 255, 0.04); }

/* ==========================================================================
   Админ-панель
   ========================================================================== */
.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
@media (max-width: 900px) { .admin-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .admin-stats { grid-template-columns: 1fr; } }
.stat-card { text-align: center; padding: 20px; }
.stat-value { font-size: 32px; font-weight: 800; }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

.filter-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 12px;
}
.empty-state .emoji { display: block; font-size: 34px; margin-bottom: 10px; }

.token-table td { font-family: var(--mono); }
.token-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}
.token-chip.active { background: rgba(63, 185, 80, 0.15); color: var(--success); }
.token-chip.blocked { background: rgba(248, 81, 73, 0.15); color: var(--danger); }
.token-chip.used { background: rgba(88, 166, 255, 0.15); color: var(--accent); }

/* ==========================================================================
   Toast-уведомления
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  padding: 13px 18px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  animation: slideIn 0.3s ease forwards;
  max-width: 380px;
}
.toast.success { border-color: rgba(63, 185, 80, 0.4); color: var(--success); background: rgba(63, 185, 80, 0.1); }
.toast.error { border-color: rgba(248, 81, 73, 0.4); color: var(--danger); background: rgba(248, 81, 73, 0.1); }
.toast.info { border-color: rgba(88, 166, 255, 0.4); color: var(--accent); background: rgba(88, 166, 255, 0.1); }
@keyframes slideIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
.toast.out { animation: slideOut 0.3s ease forwards; }
@keyframes slideOut { to { opacity: 0; transform: translateX(24px); } }

/* ==========================================================================
   Модальное окно
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, 0.7);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.show { display: flex; animation: fadeIn 0.25s ease; }
.modal {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-title { font-size: 20px; margin-bottom: 8px; }
.modal-desc { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ==========================================================================
   Дневник Архитектора
   ========================================================================== */
.journal-modal { max-width: 640px; position: relative; }
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--card);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.modal-close:hover { border-color: var(--danger); color: var(--danger); }
.journal-head { margin-bottom: 16px; }
.journal-head h2 { margin-bottom: 4px; }
.journal-meta { color: var(--muted); font-size: 13px; }
.journal-cert {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: var(--success);
  font-weight: 600;
  font-size: 14px;
  text-align: center;
}
.journal-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 18px; }
@media (max-width: 640px) { .journal-grid { grid-template-columns: repeat(3, 1fr); } }
.journal-stat {
  padding: 12px 8px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border-soft);
  text-align: center;
}
.journal-stat-icon { font-size: 20px; }
.journal-stat-val { font-size: 20px; font-weight: 800; color: var(--heading); margin-top: 2px; }
.journal-stat-label { font-size: 11px; color: var(--muted); margin-top: 2px; }
.journal-title { font-size: 15px; margin: 16px 0 10px; color: var(--heading); }
.journal-modules { display: flex; flex-direction: column; gap: 8px; }
.journal-module { display: flex; align-items: center; gap: 12px; }
.journal-module-name { width: 230px; font-size: 13px; color: var(--heading); flex-shrink: 0; }
@media (max-width: 640px) { .journal-module-name { width: 150px; } }
.journal-module-bar { flex: 1; height: 8px; border-radius: 5px; background: var(--border-soft); overflow: hidden; }
.journal-module-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--success)); }
.journal-module-pct { width: 48px; text-align: right; font-size: 12px; color: var(--muted); }
.journal-achs { display: flex; flex-wrap: wrap; gap: 8px; }
.journal-ach {
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(210, 153, 34, 0.1);
  border: 1px solid rgba(210, 153, 34, 0.35);
  color: var(--heading);
  font-size: 12.5px;
}
.journal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
@media (max-width: 640px) { .journal-actions { flex-wrap: wrap; } }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ==========================================================================
   Награды / ачивки
   ========================================================================== */
.achievements { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.achievements-counter { text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 14px; letter-spacing: 0.5px; }
.achievement {
  position: relative;
  text-align: center;
  padding: 20px 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border-soft);
  transition: all 0.25s;
}
.achievement.unlocked { border-color: rgba(210, 153, 34, 0.5); background: rgba(210, 153, 34, 0.06); }
.achievement.secret { border-style: dashed; border-color: var(--border); background: rgba(120, 120, 140, 0.04); }
.achievement.secret .achievement-icon { filter: grayscale(1) blur(1.2px); opacity: 0.55; }
.achievement-badge {
  position: absolute;
  top: -9px;
  right: -7px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #1a1204;
  background: linear-gradient(135deg, #ffd86b, #f5a623);
  padding: 3px 8px;
  border-radius: 20px;
  box-shadow: 0 3px 10px rgba(210, 153, 34, 0.4);
}
.achievement-icon { font-size: 34px; margin-bottom: 8px; filter: grayscale(1); opacity: 0.4; }
.achievement.unlocked .achievement-icon { filter: none; opacity: 1; }
.achievement-title { font-size: 13px; font-weight: 600; color: var(--heading); }
.achievement-desc { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* ==========================================================================
   Сертификат
   ========================================================================== */
.certificate {
  max-width: 700px;
  margin: 0 auto;
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(139,92,246,0.12), transparent 60%),
    var(--card);
  border: 2px solid transparent;
  border-image: linear-gradient(135deg, var(--accent), var(--accent-2), var(--accent-3)) 1;
  position: relative;
}
.certificate::before {
  content: '🏆';
  font-size: 56px;
  display: block;
  margin-bottom: 12px;
}
.certificate h2 { margin-bottom: 8px; }
.certificate .cert-name { font-size: 22px; font-weight: 800; color: var(--heading); margin: 12px 0; }
.certificate .cert-date { color: var(--muted); font-size: 13px; margin-top: 16px; }

/* ==========================================================================
   Футер
   ========================================================================== */
.footer {
  border-top: 1px solid var(--border-soft);
  padding: 28px 0;
  margin-top: 60px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  position: relative;
  z-index: 1;
}
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.footer a { color: var(--accent-2); }

/* ==========================================================================
   Прочее
   ========================================================================== */
.flex { display: flex; align-items: center; gap: 12px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }
.hidden { display: none !important; }
[hidden] { display: none !important; }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--grad-main);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--border), transparent); margin: 28px 0; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge.blue { background: rgba(88, 166, 255, 0.15); color: var(--accent); }
.badge.violet { background: rgba(139, 92, 246, 0.16); color: #c4b5fd; }
.badge.green { background: rgba(63, 185, 80, 0.15); color: var(--success); }
.badge.amber { background: rgba(210, 153, 34, 0.15); color: var(--warning); }

/* ---- Анимация появления при скролле ---- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ---- Нав-табы в курсе ---- */
.lesson-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
}

/* ---- Мелкие чипы технологий ---- */
.tech-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  margin: 0 4px 4px 0;
}

/* ==========================================================================
   Агент-практикум (плавающий чат)
   ========================================================================== */
.agent-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1200;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  font-size: 26px;
  cursor: pointer;
  background: linear-gradient(135deg, #8b5cf6, #58a6ff);
  color: #fff;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.5);
  transition: transform 0.2s, box-shadow 0.2s;
}
.agent-fab:hover { transform: scale(1.08); box-shadow: 0 10px 30px rgba(139, 92, 246, 0.65); }
.agent-widget {
  position: fixed;
  right: 22px;
  bottom: 92px;
  z-index: 1200;
  width: 360px;
  max-width: calc(100vw - 32px);
  max-height: min(560px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: fadeIn 0.25s ease;
}
.agent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
}
.agent-close {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}
.agent-close:hover { background: rgba(255, 255, 255, 0.32); }
.agent-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 160px;
}
.agent-msg {
  max-width: 86%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
}
.agent-bot {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border-soft);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.agent-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #8b5cf6, #58a6ff);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.agent-score {
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--heading);
}
.agent-checks { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.agent-check {
  display: flex;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 9px;
  font-size: 12.5px;
}
.agent-check.ok { background: rgba(34, 197, 94, 0.1); }
.agent-check.warn { background: rgba(245, 158, 11, 0.1); }
.agent-check-mark { flex-shrink: 0; }
.agent-check b { display: block; color: var(--heading); }
.agent-check-tip { color: var(--muted); margin-top: 2px; }
.agent-advice { font-size: 12px; color: var(--muted); margin-top: 6px; }
.agent-code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 6px;
  white-space: normal;
}
.agent-input-row { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border-soft); }
.agent-input-row input {
  flex: 1;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
}
.agent-input-row input:focus { outline: none; border-color: var(--accent); }
.agent-hints { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 12px; }
.agent-hint {
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.2s;
}
.agent-hint:hover { border-color: var(--accent); color: var(--heading); }

@media print {
  .agent-fab, .agent-widget { display: none !important; }
}

/* ---- Печать ---- */
@media print {
  body { background: #fff; color: #111; }
  .header, .toast-container, .lesson-nav, .sidebar { display: none !important; }
  .card, .certificate { background: #fff !important; border: 1px solid #ddd !important; color: #111; }
  .certificate { border-image: none; border: 2px solid #8b5cf6 !important; }
}

/* ==========================================================================
   Адаптивность: планшеты и телефоны
   ========================================================================== */

/* ---- Планшет (≤1024px) ---- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .header-inner, .container, .container-wide, .footer-inner { padding-left: 16px; padding-right: 16px; }
}

/* ---- Планшет/портрет (≤768px) ---- */
@media (max-width: 768px) {
  .section { padding: 48px 0; }
  .hero { padding: 64px 0 56px; }
  .preview-section { padding: 48px 0 64px; }
  .hero-actions .btn { flex: 1 1 auto; min-width: 150px; }
  .course-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .journal-grid { grid-template-columns: repeat(3, 1fr); }
  .achievements { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .layer-name { min-width: 110px; }
}

/* ---- Телефон (≤640px) ---- */
@media (max-width: 640px) {
  /* Шапка */
  .header { height: auto; min-height: var(--header-h); }
  .header-inner { flex-wrap: wrap; gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .logo { font-size: 15px; }
  .logo-icon { width: 30px; height: 30px; font-size: 15px; border-radius: 8px; }
  .header .btn-sm { padding: 6px 10px; font-size: 12px; }
  .logo-text { display: none; }

  /* Секции и заголовки */
  .section { padding: 40px 0; }
  .section-sub { font-size: 1rem; }
  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.35rem; }

  /* Hero */
  .hero { padding: 48px 0 40px; }
  .hero-title { font-size: 2rem; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn { width: 100%; min-width: 0; }
  .hero-badge { font-size: 12px; padding: 5px 12px; }

  /* Сетки — всё в один столбец на телефоне */
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .admin-stats { grid-template-columns: 1fr; }

  /* Токен-вход */
  .token-input-row { flex-direction: column; }
  .token-input-row .btn { width: 100%; }
  .token-panel { padding: 20px 16px; }

  /* Карточки и контент урока */
  .card { padding: 18px; }
  .step { gap: 14px; }
  .step-num { width: 42px; height: 42px; font-size: 16px; }
  .step::before { left: 20px; top: 44px; }
  .layer { flex-wrap: wrap; gap: 6px; }
  .layer-name { min-width: 100%; }
  .layer-desc { width: 100%; }

  /* Схемы слоёв */
  .story-block { padding: 16px; }

  /* Модальное окно */
  .modal-overlay { padding: 12px; align-items: flex-end; }
  .modal { padding: 20px 16px; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 100%; }
  .journal-actions { flex-wrap: wrap; }
  .journal-actions .btn { flex: 1 1 100%; }
  .journal-module-name { width: 130px; font-size: 12px; }

  /* Таблицы */
  .filter-bar { align-items: stretch; }
  .filter-bar input, .filter-bar .btn { flex: 1 1 100%; }

  /* Toast на телефоне — на всю ширину снизу */
  .toast-container { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: 100%; width: 100%; }

  /* Навигация урока */
  .lesson-nav { flex-direction: column-reverse; }
  .lesson-nav .btn { width: 100%; }

  /* Агент-практикум на мобильных */
  .agent-fab { right: 14px; bottom: 14px; width: 52px; height: 52px; font-size: 24px; }
  .agent-widget { right: 10px; left: 10px; bottom: 80px; width: auto; max-width: none; max-height: calc(100vh - 96px); }
  .agent-body { min-height: 120px; }

  /* Кнопки */
  .btn-lg { padding: 12px 24px; font-size: 15px; }
  .btn-block { width: 100%; }

  /* Прочее */
  .cta-band { padding: 32px 20px; }
  .achievements { grid-template-columns: repeat(2, 1fr); }
  .certificate { padding: 28px 16px; }
  .certificate h2 { font-size: 1.4rem; }
  .certificate .cert-name { font-size: 18px; }
  .preview-screen { height: 220px; }
  .preview-float { font-size: 12px; padding: 7px 12px; white-space: normal; }
  .preview-float-1 { left: 0; top: -16px; }
  .preview-float-2 { right: 0; bottom: -16px; }
  .footer { padding: 20px 0; margin-top: 40px; }
}

/* ---- Очень узкий телефон (≤400px) ---- */
@media (max-width: 400px) {
  .hero-title { font-size: 1.7rem; }
  .hero-badge { font-size: 11px; white-space: normal; }
  .token-note { font-size: 11.5px; }
  .preview-url { font-size: 11px; }
  .journal-grid { grid-template-columns: repeat(2, 1fr); }
  .achievements { grid-template-columns: 1fr; }
  .agent-hints .agent-hint { flex: 1 1 100%; }
}

/* ---- Маленькие экраны: безопасная зона для тач-элементов ---- */
@media (max-width: 640px) {
  .module-item { padding: 12px 12px; }
  .map-card { padding: 10px 12px; }
  .quiz-option { padding: 12px 14px; }
  .check-item { padding: 12px 14px; }
  .callout { padding: 14px 14px; }
}
