@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600&family=Outfit:wght@400;500;600;700;800&display=swap');

:root,
[data-theme="dark"] {
  --bg: #07080f;
  --bg-card: rgba(18, 22, 36, 0.72);
  --bg-elevated: rgba(28, 34, 54, 0.85);
  --border: rgba(108, 92, 231, 0.22);
  --text: #eef2ff;
  --text-muted: #8b95b8;
  --accent: #7c6cf0;
  --accent-light: #a89bff;
  --accent-glow: rgba(124, 108, 240, 0.45);
  --cyan: #00e5cc;
  --cyan-glow: rgba(0, 229, 204, 0.35);
  --success: #00e5a8;
  --error: #ff6b8a;
  --warning: #ffd166;
  --gradient: linear-gradient(135deg, #7c6cf0 0%, #00e5cc 50%, #7c6cf0 100%);
  --gradient-size: 200% 200%;
  --radius: 14px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 30px rgba(124, 108, 240, 0.15);
  --navbar-bg: rgba(7, 8, 15, 0.78);
  --hero-glow-1: rgba(124, 108, 240, 0.22);
  --hero-glow-2: rgba(0, 229, 204, 0.14);
  --font: 'Outfit', 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
  --grid-color: rgba(124, 108, 240, 0.06);
}

[data-theme="light"] {
  --bg: #f0f3fc;
  --bg-card: rgba(255, 255, 255, 0.88);
  --bg-elevated: rgba(238, 242, 252, 0.95);
  --border: rgba(91, 76, 219, 0.18);
  --text: #12182b;
  --text-muted: #5c6680;
  --accent: #5b4cdb;
  --accent-light: #6c5ce7;
  --accent-glow: rgba(91, 76, 219, 0.25);
  --cyan: #00b894;
  --cyan-glow: rgba(0, 184, 148, 0.2);
  --success: #00a884;
  --error: #e55050;
  --warning: #e1a100;
  --gradient: linear-gradient(135deg, #6c5ce7 0%, #00b894 50%, #6c5ce7 100%);
  --shadow: 0 12px 40px rgba(26, 31, 46, 0.1);
  --shadow-glow: 0 0 24px rgba(91, 76, 219, 0.08);
  --navbar-bg: rgba(255, 255, 255, 0.88);
  --hero-glow-1: rgba(108, 92, 231, 0.14);
  --hero-glow-2: rgba(0, 184, 148, 0.1);
  --grid-color: rgba(91, 76, 219, 0.05);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  opacity: 0;
  transition: opacity 0.5s ease;
}

body.page-loaded { opacity: 1; }

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, var(--hero-glow-1), transparent 55%),
    radial-gradient(ellipse 60% 40% at 85% 20%, var(--hero-glow-2), transparent 50%),
    radial-gradient(ellipse 50% 30% at 50% 100%, var(--hero-glow-1), transparent 60%),
    var(--bg);
  animation: auroraShift 18s ease-in-out infinite alternate;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, black 20%, transparent 75%);
  animation: gridDrift 24s linear infinite;
}

.bg-canvas { position: fixed; inset: 0; z-index: -1; pointer-events: none; }

a { color: var(--accent-light); text-decoration: none; transition: color 0.2s, text-shadow 0.2s; }
a:hover { text-decoration: none; color: var(--cyan); text-shadow: 0 0 12px var(--cyan-glow); }

/* ── Layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ── Nav ── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--navbar-bg);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  animation: navSlideDown 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.navbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--cyan), var(--accent), transparent);
  background-size: 200% 100%;
  animation: borderFlow 4s linear infinite;
  opacity: 0.7;
}

.theme-toggle {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text);
  cursor: pointer; font-size: 1.1rem;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  flex-shrink: 0;
  transform: none;
}

@media (hover: hover) {
  .theme-toggle:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
    transform: scale(1.05);
  }
}

.theme-toggle:active {
  transform: scale(0.97);
}

.navbar .container {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}

.logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.25rem; font-weight: 800; color: var(--text);
  text-decoration: none; letter-spacing: -0.02em;
}

.logo-icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--gradient);
  background-size: var(--gradient-size);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  animation: gradientPulse 4s ease infinite, logoFloat 3s ease-in-out infinite;
  box-shadow: 0 0 24px var(--accent-glow);
}

.nav-links { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.nav-links a {
  color: var(--text-muted); padding: 8px 14px; border-radius: 10px;
  font-size: 0.9rem; font-weight: 500; text-decoration: none;
  transition: all 0.25s; position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute; bottom: 4px; left: 50%; width: 0; height: 2px;
  background: var(--gradient); border-radius: 2px;
  transition: width 0.25s, left 0.25s;
}

.nav-links a:hover::after, .nav-links a.active::after {
  width: 60%; left: 20%;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--text); background: var(--bg-elevated);
  text-decoration: none;
  box-shadow: inset 0 0 0 1px var(--border);
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 22px; border-radius: 12px; border: none; cursor: pointer;
  font-size: 0.9rem; font-weight: 600; transition: all 0.3s; font-family: inherit;
  position: relative; overflow: hidden;
}

.btn-primary {
  background: var(--gradient);
  background-size: var(--gradient-size);
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
  animation: gradientPulse 5s ease infinite;
}

.btn-primary::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.25) 50%, transparent 60%);
  transform: translateX(-120%);
  transition: transform 0.5s;
}

.btn-primary:hover::before { transform: translateX(120%); }

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 32px var(--accent-glow), 0 0 20px var(--cyan-glow);
}

.btn-secondary {
  background: var(--bg-elevated); color: var(--text);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.btn-secondary:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-danger { background: rgba(255, 107, 138, 0.12); color: var(--error); border: 1px solid var(--error); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

/* ── Hero ── */
.hero {
  padding: 90px 0 70px;
  position: relative;
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { order: -1; max-height: 280px; }
}

.hero-content { position: relative; z-index: 1; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 0.8rem; font-weight: 600; color: var(--accent-light);
  margin-bottom: 20px;
  animation: badgePulse 3s ease-in-out infinite;
}

.hero-badge-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
  animation: blink 2s ease infinite;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 800; line-height: 1.12; margin-bottom: 20px;
  letter-spacing: -0.03em;
  animation: heroFadeUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

.hero h1 span, .gradient-text {
  background: var(--gradient);
  background-size: var(--gradient-size);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientPulse 4s ease infinite;
}

.hero h1 .typing-cursor::after {
  content: '|';
  -webkit-text-fill-color: var(--cyan);
  animation: cursorBlink 0.8s step-end infinite;
  margin-left: 2px;
}

.hero p {
  font-size: 1.12rem; color: var(--text-muted); max-width: 540px;
  margin-bottom: 32px;
  animation: heroFadeUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.25s both;
}

.hero-actions {
  display: flex; gap: 12px; flex-wrap: wrap;
  animation: heroFadeUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.4s both;
}

.hero-visual {
  position: relative;
  animation: heroFadeUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

.terminal-window {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow), var(--shadow-glow);
  backdrop-filter: blur(12px);
}

.terminal-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.terminal-dot { width: 10px; height: 10px; border-radius: 50%; }
.terminal-dot.red { background: #ff5f57; }
.terminal-dot.yellow { background: #febc2e; }
.terminal-dot.green { background: #28c840; }

.terminal-title {
  margin-left: 8px; font-size: 0.75rem; color: var(--text-muted);
  font-family: var(--mono);
}

.terminal-body {
  padding: 20px;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.7;
  min-height: 220px;
}

.terminal-line { opacity: 0; animation: termLineIn 0.4s ease forwards; }
.terminal-line:nth-child(1) { animation-delay: 0.6s; }
.terminal-line:nth-child(2) { animation-delay: 1.1s; }
.terminal-line:nth-child(3) { animation-delay: 1.6s; }
.terminal-line:nth-child(4) { animation-delay: 2.1s; }
.terminal-line:nth-child(5) { animation-delay: 2.6s; }
.terminal-line:nth-child(6) { animation-delay: 3.1s; }

.terminal-prompt { color: var(--cyan); }
.terminal-key { color: var(--accent-light); }
.terminal-str { color: var(--warning); }
.terminal-comment { color: var(--text-muted); }
.terminal-success { color: var(--success); }

.floating-chip {
  position: absolute;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 0.8rem; font-weight: 600;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-glow);
  animation: chipFloat 5s ease-in-out infinite;
}

.floating-chip.chip-1 { top: -12px; right: -8px; animation-delay: 0s; }
.floating-chip.chip-2 { bottom: 20px; left: -20px; animation-delay: 1.5s; }
.floating-chip.chip-3 { top: 40%; right: -24px; animation-delay: 3s; }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--accent-glow), transparent 50%, var(--cyan-glow));
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
}

.card:hover::before { opacity: 0.08; }

.card:hover {
  border-color: rgba(124, 108, 240, 0.5);
  transform: translateY(-4px);
  box-shadow: var(--shadow), var(--shadow-glow);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* ── Features ── */
.section { padding: 70px 0; position: relative; }
.section-alt {
  background: linear-gradient(180deg, transparent, rgba(124, 108, 240, 0.04), transparent);
}

.section-title {
  font-size: 1.85rem; font-weight: 800; margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.section-subtitle { color: var(--text-muted); margin-bottom: 36px; font-size: 1.02rem; }

.feature-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(124, 108, 240, 0.2), rgba(0, 229, 204, 0.1));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; margin-bottom: 16px;
  animation: iconBob 4s ease-in-out infinite;
  box-shadow: 0 0 20px var(--accent-glow);
}

.card:nth-child(2) .feature-icon { animation-delay: 0.5s; }
.card:nth-child(3) .feature-icon { animation-delay: 1s; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block; font-size: 0.85rem; color: var(--text-muted);
  margin-bottom: 6px; font-weight: 500;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 12px 14px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; color: var(--text); font-size: 0.95rem;
  font-family: inherit; transition: all 0.25s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px var(--accent-glow);
}

.form-group textarea { min-height: 100px; resize: vertical; }

.auth-card {
  max-width: 420px; margin: 60px auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px;
  box-shadow: var(--shadow), var(--shadow-glow);
  backdrop-filter: blur(16px);
  animation: cardPopIn 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-card h2 { font-size: 1.5rem; margin-bottom: 8px; font-weight: 800; }
.auth-card .subtitle { color: var(--text-muted); margin-bottom: 28px; font-size: 0.9rem; }

/* ── Alerts ── */
.alert {
  padding: 12px 16px; border-radius: 12px; font-size: 0.9rem; margin-bottom: 16px;
  animation: alertIn 0.4s ease;
}

.alert-error { background: rgba(255, 107, 138, 0.1); border: 1px solid var(--error); color: var(--error); }
.alert-success { background: rgba(0, 229, 168, 0.1); border: 1px solid var(--success); color: var(--success); }
.alert-info { background: rgba(124, 108, 240, 0.1); border: 1px solid var(--accent); color: var(--accent-light); }

/* ── Site notifications (toast) ── */
.site-notify-root {
  position: fixed; top: 88px; right: 24px; z-index: 500;
  display: flex; flex-direction: column; gap: 12px;
  max-width: min(400px, calc(100vw - 48px));
  pointer-events: none;
}
.site-notify {
  pointer-events: auto;
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 18px; border-radius: 14px;
  background: var(--bg-card); border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  transform: translateX(120%) scale(0.9); opacity: 0;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s;
}
.site-notify-show { transform: translateX(0) scale(1); opacity: 1; }
.site-notify-hide { transform: translateX(120%) scale(0.9); opacity: 0; }
.site-notify-icon { font-size: 1.4rem; line-height: 1; flex-shrink: 0; margin-top: 2px; }
.site-notify-content { flex: 1; min-width: 0; }
.site-notify-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 4px; color: var(--text); }
.site-notify-message { font-size: 0.88rem; color: var(--text-muted); line-height: 1.45; }
.site-notify-action {
  display: inline-block; margin-top: 10px; font-size: 0.85rem; font-weight: 600;
  color: var(--accent-light); text-decoration: none;
}
.site-notify-action:hover { text-decoration: underline; }
.site-notify-close {
  background: transparent; border: none; color: var(--text-muted);
  font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 0 4px;
}
.site-notify-close:hover { color: var(--text); }
.site-notify-info { border-color: rgba(124, 108, 240, 0.45); }
.site-notify-warning { border-color: rgba(255, 209, 102, 0.5); }
.site-notify-warning .site-notify-title { color: var(--warning); }
.site-notify-success { border-color: rgba(0, 229, 168, 0.45); }
.site-notify-error { border-color: rgba(255, 107, 138, 0.45); }

/* ── Course ── */
.chapter-card { cursor: pointer; }
.chapter-card .chapter-header { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.chapter-card .chapter-icon {
  font-size: 2rem;
  animation: iconBob 3s ease-in-out infinite;
}
.chapter-card h3 { font-size: 1.1rem; }
.chapter-card p { color: var(--text-muted); font-size: 0.85rem; }

.progress-bar {
  height: 8px; background: var(--bg); border-radius: 4px;
  overflow: hidden; margin-top: 12px; position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--gradient);
  background-size: var(--gradient-size);
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  animation: gradientPulse 4s ease infinite;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  animation: progressShine 2s ease infinite;
}

.progress-text { font-size: 0.8rem; color: var(--text-muted); margin-top: 6px; }

/* ── Lesson page ── */
.lesson-layout {
  display: grid; grid-template-columns: 280px 1fr; gap: 24px;
  padding: 24px 0 60px; min-height: calc(100vh - 70px);
}

@media (max-width: 900px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-sidebar { order: 2; }
}

.lesson-sidebar {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; height: fit-content;
  position: sticky; top: 80px;
  backdrop-filter: blur(12px);
}

.lesson-sidebar h3 { font-size: 0.95rem; margin-bottom: 12px; color: var(--text-muted); }

.lesson-list { list-style: none; }
.lesson-list li a {
  display: block; padding: 8px 12px; border-radius: 8px;
  color: var(--text-muted); font-size: 0.85rem; text-decoration: none;
  transition: all 0.2s;
}

.lesson-list li a:hover, .lesson-list li a.active {
  background: var(--bg-elevated); color: var(--text);
  box-shadow: inset 2px 0 0 var(--accent);
}

.lesson-list li a.completed { color: var(--success); }
.lesson-list li a.completed::before { content: '✓ '; }

.lesson-main { display: flex; flex-direction: column; gap: 20px; }

.lesson-task {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  backdrop-filter: blur(12px);
}

.lesson-task h2 { font-size: 1.3rem; margin-bottom: 12px; }
.lesson-task .task-text {
  background: var(--bg-elevated); padding: 16px; border-radius: 12px;
  border-left: 3px solid var(--accent); margin: 16px 0;
}

.editor-wrap {
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-glow);
}

#editor { height: 400px; width: 100%; }

.editor-actions { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }

.check-result {
  padding: 16px; border-radius: 12px; margin-top: 16px; font-size: 0.9rem;
  animation: alertIn 0.4s ease;
}

.check-result.error { background: rgba(255, 107, 138, 0.1); border: 1px solid var(--error); }
.check-result.success { background: rgba(0, 229, 168, 0.1); border: 1px solid var(--success); }
.check-result ul { margin-top: 8px; padding-left: 20px; }

/* ── Profile ── */
.profile-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 24px 0 60px;
}

@media (max-width: 768px) { .profile-grid { grid-template-columns: 1fr; } }

.stat-card { text-align: center; padding: 28px; }
.stat-value {
  font-size: 2.5rem; font-weight: 800;
  background: var(--gradient);
  background-size: var(--gradient-size);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientPulse 4s ease infinite;
}

.stat-label { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }

.chapter-progress-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}

.chapter-progress-item:last-child { border-bottom: none; }

/* ── Materials ── */
.material-card .platform-tag {
  display: inline-block; padding: 4px 10px; border-radius: 6px;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
  background: rgba(124, 108, 240, 0.15); color: var(--accent-light); margin-bottom: 10px;
}

.material-links { display: flex; gap: 12px; margin-top: 12px; flex-wrap: wrap; }

.material-links a {
  font-size: 0.85rem; padding: 6px 12px;
  background: var(--bg-elevated); border-radius: 8px; text-decoration: none;
  transition: all 0.2s;
}

.material-links a:hover { box-shadow: 0 0 12px var(--accent-glow); }

.add-material-form { margin-bottom: 32px; }

/* ── Footer (legacy simple) ── */
.footer {
  border-top: 1px solid var(--border);
  padding: 36px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ── Site footer (multi-column) ── */
.site-footer {
  margin-top: 48px;
  background: rgba(10, 12, 20, 0.92);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}

[data-theme="light"] .site-footer {
  background: rgba(22, 26, 40, 0.96);
  color: rgba(255, 255, 255, 0.75);
}

[data-theme="light"] .site-footer h4,
[data-theme="light"] .site-footer a,
[data-theme="light"] .site-footer .footer-social-title,
[data-theme="light"] .site-footer .footer-copy {
  color: rgba(255, 255, 255, 0.9);
}

.site-footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px 24px;
  padding: 48px 24px 36px;
}

.footer-col h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links a {
  font-size: 0.88rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
  line-height: 1.4;
}

.footer-links a:hover {
  color: var(--accent-light);
  text-shadow: none;
}

.footer-contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.footer-contact-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.footer-contact-icon {
  flex-shrink: 0;
  width: 22px;
  text-align: center;
  opacity: 0.85;
}

.footer-contacts a {
  color: var(--accent-light);
  word-break: break-all;
}

/* ── Footer: Нам доверяют ── */
.footer-trust {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 36px 0 40px;
  background: rgba(0, 0, 0, 0.15);
}

.footer-trust-head {
  text-align: center;
  margin-bottom: 28px;
}

.footer-trust-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.footer-trust-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.5;
}

[data-theme="light"] .footer-trust-title {
  color: rgba(255, 255, 255, 0.95);
}

[data-theme="light"] .footer-trust-sub {
  color: rgba(255, 255, 255, 0.65);
}

.footer-trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.footer-trust-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  grid-column: 1 / -1;
  padding: 12px 0;
}

.partner-edit-row .form-group { margin-bottom: 12px; }

.trust-badge {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}

.trust-badge:hover {
  border-color: rgba(124, 108, 240, 0.45);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(124, 108, 240, 0.12);
}

.trust-badge-seal {
  position: relative;
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(124, 108, 240, 0.25), rgba(0, 229, 204, 0.12));
  border: 1px solid rgba(124, 108, 240, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.trust-badge-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.trust-badge-check {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(10, 12, 20, 0.9);
  box-shadow: 0 0 8px rgba(0, 229, 168, 0.4);
}

.trust-badge-body {
  min-width: 0;
  flex: 1;
}

.trust-badge-org {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 4px;
}

.trust-badge-type {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-bottom: 6px;
}

.trust-badge-year {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(124, 108, 240, 0.15);
  color: var(--accent-light);
  border: 1px solid rgba(124, 108, 240, 0.25);
}

[data-theme="light"] .trust-badge-org {
  color: rgba(255, 255, 255, 0.92);
}

[data-theme="light"] .trust-badge-type {
  color: rgba(255, 255, 255, 0.6);
}

.site-footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 28px 0 32px;
}

.site-footer-bottom-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-social-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-social-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.footer-social {
  display: flex;
  gap: 10px;
}

.footer-social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff !important;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none !important;
  transition: background 0.2s, transform 0.2s;
}

.footer-social-btn:hover {
  background: var(--accent);
  transform: translateY(-2px);
  text-shadow: none;
}

.footer-copy {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
  text-align: right;
}

/* ── Stats banner on hero ── */
.stats-row {
  display: flex; gap: 24px; margin-top: 48px; flex-wrap: wrap;
  animation: heroFadeUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.55s both;
}

.stats-row .stat {
  text-align: center;
  padding: 16px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  min-width: 100px;
  transition: all 0.3s;
}

.stats-row .stat:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
  border-color: var(--accent);
}

.stats-row .stat strong {
  display: block; font-size: 1.9rem; font-weight: 800;
  background: var(--gradient);
  background-size: var(--gradient-size);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hidden { display: none !important; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 8px;
  font-size: 0.75rem; font-weight: 600;
}

.badge-success { background: rgba(0, 229, 168, 0.12); color: var(--success); }
.badge-error { background: rgba(255, 107, 138, 0.12); color: var(--error); }
.badge-muted { background: var(--bg-elevated); color: var(--text-muted); }

.page-header { padding: 36px 0 16px; }
.page-header h1 {
  font-size: 1.85rem; font-weight: 800;
  letter-spacing: -0.02em;
}

.tabs { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }

.tab {
  padding: 8px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; color: var(--text-muted); cursor: pointer;
  font-family: inherit; transition: all 0.25s;
}

.tab.active {
  background: var(--gradient);
  background-size: var(--gradient-size);
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 16px var(--accent-glow);
}

/* ── Course picker ── */
.course-picker { display: flex; gap: 12px; flex-wrap: wrap; }
.course-btn {
  padding: 12px 20px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text);
  cursor: pointer; font-family: inherit; font-size: 0.95rem;
  transition: all 0.25s;
}
.course-btn:hover { border-color: var(--accent); box-shadow: 0 0 16px var(--accent-glow); }
.course-btn.active {
  background: var(--gradient);
  background-size: var(--gradient-size);
  color: #fff; border-color: transparent;
  animation: gradientPulse 4s ease infinite;
}

/* ── Difficulty & premium ── */
.badge-easy { background: rgba(0, 229, 168, 0.12); color: var(--success); }
.badge-medium { background: rgba(255, 209, 102, 0.15); color: var(--warning); }
.badge-hard { background: rgba(255, 107, 138, 0.12); color: var(--error); }
.badge-premium { background: rgba(124, 108, 240, 0.18); color: var(--accent-light); }

.text-lesson {
  background: var(--bg-elevated); padding: 20px; border-radius: 12px;
  margin: 16px 0; font-size: 0.95rem; line-height: 1.7;
}
.text-lesson h3 { margin-bottom: 8px; font-size: 1.1rem; }
.text-lesson h4 { margin: 12px 0 6px; font-size: 0.95rem; color: var(--accent-light); }

/* ── Legal docs ── */
.legal-doc h1 { margin-bottom: 8px; }
.legal-doc h2 { margin: 24px 0 8px; font-size: 1.1rem; }
.legal-doc p, .legal-doc li { color: var(--text-muted); margin-bottom: 8px; }
.legal-doc ul { padding-left: 24px; margin-bottom: 16px; }
.legal-date { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 24px; }

/* ── Profile info ── */
.info-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px;
}
.info-grid div {
  background: var(--bg-elevated); padding: 14px; border-radius: 12px;
  border: 1px solid var(--border);
  transition: all 0.25s;
}
.info-grid div:hover { border-color: var(--accent); box-shadow: var(--shadow-glow); }
.info-grid span { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }

/* ── Guide (theory course) ── */
.guide-layout {
  display: grid; grid-template-columns: 300px 1fr; gap: 24px;
  padding: 24px 0 60px; min-height: calc(100vh - 70px);
}
@media (max-width: 900px) { .guide-layout { grid-template-columns: 1fr; } }

.guide-sidebar { position: sticky; top: 80px; height: fit-content; max-height: calc(100vh - 100px); overflow-y: auto; }
.guide-chapter { margin-bottom: 16px; }
.guide-chapter-title { font-size: 0.85rem; font-weight: 600; margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.guide-lesson-list { list-style: none; }
.guide-lesson-list a {
  display: block; padding: 6px 10px; border-radius: 8px; font-size: 0.82rem;
  color: var(--text-muted); text-decoration: none; transition: all 0.2s;
}
.guide-lesson-list a:hover, .guide-lesson-list a.active {
  background: var(--bg-elevated); color: var(--text);
  box-shadow: inset 2px 0 0 var(--accent);
}
.guide-lesson-list a.completed { color: var(--success); }
.guide-lesson-list a.locked-link { opacity: 0.55; }
.guide-lesson-vertical { display: flex; flex-direction: column; gap: 2px; }
.guide-nav-vertical { display: flex; flex-direction: column; }
.course-picker-vertical { flex-direction: column; }
.course-picker-vertical .course-btn { width: 100%; text-align: left; }
.guide-section-label {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  color: var(--accent-light); margin: 16px 0 8px; letter-spacing: 0.05em;
}
.guide-section-advanced { color: var(--warning); }
.guide-chapter-locked { opacity: 0.85; }

.nav-more { position: relative; }
.nav-more-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); padding: 8px 14px; border-radius: 10px;
  cursor: pointer; font-family: inherit; transition: all 0.2s;
}
.nav-more-btn:hover { border-color: var(--accent); color: var(--text); }
.nav-more-dropdown {
  position: absolute; right: 0; top: 100%; margin-top: 6px; min-width: 240px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); z-index: 200; padding: 8px 0;
  backdrop-filter: blur(16px);
  animation: dropdownIn 0.25s ease;
}
.nav-more-dropdown a { display: block; padding: 10px 16px; color: var(--text); text-decoration: none; font-size: 0.9rem; }
.nav-more-dropdown a:hover { background: var(--bg-elevated); }
.nav-more-dropdown.hidden { display: none; }

.hb-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.hb-table th, .hb-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: 0.9rem; }
.hb-table th { color: var(--text-muted); font-weight: 600; }
.hb-table code {
  background: var(--bg-elevated); padding: 2px 6px; border-radius: 4px;
  font-size: 0.85rem; font-family: var(--mono);
}

/* ── Trainer ── */
.trainer-filters { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; }
.trainer-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.trainer-item-head { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.trainer-item.locked { opacity: 0.75; }

/* ── Admin ── */
.admin-tabs { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.admin-tab {
  padding: 10px 18px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-muted); cursor: pointer;
  font-family: inherit; transition: all 0.25s;
}
.admin-tab:hover { border-color: var(--accent); }
.admin-tab.active {
  border-color: var(--accent); color: var(--text);
  background: var(--bg-elevated);
  box-shadow: 0 0 16px var(--accent-glow);
}
.admin-toolbar { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.admin-search {
  flex: 1; min-width: 220px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
  transition: all 0.25s;
}
.admin-search:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.admin-table-wrap {
  overflow-x: auto; border: 1px solid var(--border);
  border-radius: var(--radius); backdrop-filter: blur(8px);
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th, .admin-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; }
.admin-table th { color: var(--text-muted); font-weight: 600; background: var(--bg-elevated); }
.admin-table tr { transition: background 0.2s; }
.admin-table tr:hover td { background: var(--bg-elevated); }

.modal { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.modal-card {
  position: relative; width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow), var(--shadow-glow);
  backdrop-filter: blur(16px);
  animation: cardPopIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.modal-card h2 { margin-bottom: 16px; font-size: 1.25rem; }
.admin-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.admin-form .form-checks { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.admin-form .form-checks label { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
@media (max-width: 600px) {
  .admin-form .form-row { grid-template-columns: 1fr; }
}

/* ── Scroll reveal ── */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1) var(--reveal-delay, 0s),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1) var(--reveal-delay, 0s);
}
.reveal.revealed { opacity: 1; transform: translateY(0); }

/* ── Platform pills ── */
.platform-pills {
  display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px;
}
.platform-pill {
  padding: 8px 16px; border-radius: 999px;
  background: var(--bg-card); border: 1px solid var(--border);
  font-size: 0.85rem; font-weight: 600;
  transition: all 0.3s;
  animation: chipFloat 6s ease-in-out infinite;
}
.platform-pill:nth-child(2) { animation-delay: 1s; }
.platform-pill:nth-child(3) { animation-delay: 2s; }
.platform-pill:hover {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
  transform: scale(1.05);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--accent), var(--cyan));
  border-radius: 4px;
}

/* ── Keyframes ── */
@keyframes auroraShift {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(12deg); }
}

@keyframes gridDrift {
  0% { transform: translateY(0); }
  100% { transform: translateY(48px); }
}

@keyframes gradientPulse {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes borderFlow {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@keyframes navSlideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes heroFadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 20px 2px var(--accent-glow); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes iconBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes chipFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33% { transform: translateY(-8px) rotate(1deg); }
  66% { transform: translateY(4px) rotate(-1deg); }
}

@keyframes termLineIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes progressShine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

@keyframes cardPopIn {
  from { opacity: 0; transform: scale(0.95) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes alertIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  body { opacity: 1; }
  .reveal { opacity: 1; transform: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE & TABLET
   ═══════════════════════════════════════════════════════════════════════════ */

/* iOS: не зумить при фокусе на полях */
.form-group input,
.form-group select,
.form-group textarea,
.admin-search {
  font-size: max(16px, 0.95rem);
}

/* ── Burger & drawer nav ── */
.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  flex-shrink: 0;
  z-index: 160;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.nav-burger span {
  display: block;
  height: 3px;
  width: 100%;
  background: var(--accent-light);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}

.nav-logout {
  color: var(--error) !important;
  font-weight: 600;
}

.nav-logout:hover {
  background: rgba(255, 107, 138, 0.12) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 107, 138, 0.35) !important;
}

.nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  transition: opacity 0.25s;
}

.nav-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.nav-open { overflow: hidden; }

body.nav-open .navbar {
  z-index: 300;
}

.sidebar-toggle { display: none; }

/* ── Tablet (≤900px) ── */
@media (max-width: 900px) {
  .container { padding: 0 18px; }

  .hero { padding: 56px 0 48px; }
  .section { padding: 48px 0; }

  .guide-sidebar,
  .lesson-sidebar {
    position: static;
    max-height: none;
  }

  .card-grid { grid-template-columns: 1fr; }
  .trainer-list { grid-template-columns: 1fr; }

  .floating-chip.chip-3 { display: none; }
}

/* ── Phone (≤768px) ── */
@media (max-width: 768px) {
  body {
    opacity: 1;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .navbar {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--bg);
    border-bottom-color: var(--border);
  }

  body.nav-open .nav-overlay {
    z-index: 200;
    right: min(320px, 90vw);
    left: 0;
    background: rgba(0, 0, 0, 0.4);
  }

  body.nav-open .navbar {
    z-index: 300;
  }

  .container {
    padding-left: max(16px, env(safe-area-inset-left, 16px));
    padding-right: max(16px, env(safe-area-inset-right, 16px));
  }

  .navbar {
    padding-top: max(10px, env(safe-area-inset-top, 10px));
    padding-bottom: 10px;
  }

  .navbar .container { gap: 12px; flex-wrap: nowrap; }

  .logo { font-size: 1.1rem; flex: 1; min-width: 0; }
  .logo-icon { width: 36px; height: 36px; font-size: 1rem; }

  .nav-burger {
    display: flex !important;
    margin-left: auto;
    order: 2;
    position: relative;
    z-index: 320;
    box-shadow: 0 0 0 1px var(--border);
    flex-shrink: 0;
    background: var(--bg-elevated);
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    width: min(320px, 90vw);
    height: 100dvh;
    height: 100vh;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: max(72px, calc(env(safe-area-inset-top, 0px) + 64px)) 16px 24px;
    background: var(--bg);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.45);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transform: translateX(105%);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 310;
    pointer-events: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-links.open { transform: translateX(0); }

  .nav-links > a,
  .nav-links > span > a,
  .nav-links .nav-more-btn,
  .nav-links .theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
    padding: 14px 16px !important;
    margin: 0 !important;
    border-radius: 12px;
    font-size: 1.25rem;
    font-weight: 600;
    min-height: 48px;
    text-decoration: none !important;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text) !important;
    box-shadow: none !important;
    transform: none !important;
    transition: border-color 0.2s, background 0.2s;
  }

  .nav-links .theme-toggle:hover,
  .nav-links .theme-toggle:active,
  .nav-links .theme-toggle:focus {
    transform: none !important;
    border-color: var(--accent);
    box-shadow: none !important;
  }

  .nav-links > a::after,
  .nav-links > span > a::after {
    display: none;
  }

  .nav-links > a:active,
  .nav-links > span > a:active,
  .nav-links .nav-more-btn:active {
    transform: scale(0.98);
    border-color: var(--accent);
  }

  .nav-links .btn-primary {
    background: var(--gradient) !important;
    background-size: var(--gradient-size);
    border: none !important;
    color: #fff !important;
    animation: gradientPulse 4s ease infinite;
  }

  .nav-links .nav-logout {
    margin-top: 4px;
    justify-content: center;
    background: rgba(255, 107, 138, 0.1) !important;
    border: 1px solid rgba(255, 107, 138, 0.45) !important;
    color: var(--error) !important;
  }

  .nav-links #auth-links,
  .nav-links #user-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  .nav-more { width: 100%; }
  .nav-more-btn { width: 100%; text-align: center; }

  .nav-more-dropdown {
    position: static;
    margin-top: 4px;
    box-shadow: none;
    border: none;
    border-radius: 0;
    min-width: 0;
    padding: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .nav-more-dropdown a {
    padding: 14px 16px;
    min-height: 48px;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
  }

  .nav-more-dropdown.hidden { display: none; }

  [data-theme="light"] .nav-overlay { background: rgba(240, 243, 252, 0.88); }

  /* Hero */
  .hero h1 { font-size: clamp(1.65rem, 7vw, 2.2rem); }
  .hero p { font-size: 1rem; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; min-height: 48px; }

  .stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 32px;
  }

  .stats-row .stat {
    min-width: 0;
    padding: 14px 12px;
  }

  .stats-row .stat strong { font-size: 1.5rem; }

  .hero-visual { max-height: none; }
  .terminal-body { min-height: 180px; font-size: 0.75rem; padding: 14px; }
  .floating-chip { font-size: 0.72rem; padding: 6px 10px; }
  .floating-chip.chip-1 { top: 0; right: 0; }
  .floating-chip.chip-2 { bottom: 8px; left: 0; }

  .platform-pills { gap: 8px; }
  .platform-pill { flex: 1; text-align: center; min-width: calc(50% - 4px); }

  /* Cards & forms */
  .card { padding: 18px; }
  .auth-card {
    margin: 32px 16px;
    padding: 24px 20px;
    max-width: none;
  }

  .btn { min-height: 44px; padding: 12px 18px; }
  .btn-sm { min-height: 40px; }

  .page-header { padding: 24px 0 12px; }
  .page-header h1 { font-size: 1.5rem; }

  /* Sidebars: collapsible */
  .sidebar-toggle {
    display: flex;
    width: 100%;
    justify-content: center;
    margin-bottom: 12px;
    min-height: 48px;
  }

  .guide-sidebar,
  .lesson-sidebar {
    display: none;
    order: -1;
  }

  .guide-sidebar.sidebar-open,
  .lesson-sidebar.sidebar-open {
    display: block;
  }

  .guide-layout,
  .lesson-layout {
    padding: 16px 0 40px;
    gap: 16px;
  }

  #editor { height: min(50vh, 320px); }

  .editor-actions { flex-direction: column; }
  .editor-actions .btn { width: 100%; }

  /* Trainer filters */
  .trainer-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .trainer-filters .form-group {
    min-width: 0 !important;
    width: 100%;
  }

  /* Profile */
  .profile-grid { gap: 16px; padding: 16px 0 40px; }
  .info-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 2rem; }

  /* Tabs */
  .tabs,
  .admin-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    margin-bottom: 16px;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar,
  .admin-tabs::-webkit-scrollbar { display: none; }

  .tab,
  .admin-tab {
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Tables */
  .admin-table-wrap { margin: 0 -4px; }
  .admin-table { font-size: 0.82rem; min-width: 560px; }
  .admin-table th,
  .admin-table td { padding: 10px 10px; }

  .hb-table { display: block; overflow-x: auto; }

  /* Modals */
  .modal {
    padding: 0;
    align-items: flex-end;
  }

  .modal-card {
    max-height: 92dvh;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    padding: 20px 16px max(20px, env(safe-area-inset-bottom));
  }

  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }

  /* Toasts */
  .site-notify-root {
    top: auto;
    bottom: max(16px, env(safe-area-inset-bottom, 16px));
    left: 16px;
    right: 16px;
    max-width: none;
  }

  .site-notify {
    transform: translateY(120%);
  }

  .site-notify-show { transform: translateY(0); }
  .site-notify-hide { transform: translateY(120%); }

  /* Footer */
  .footer { padding: 28px 0; font-size: 0.8rem; }

  .site-footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 28px 16px;
    padding: 36px 16px 28px;
  }

  .footer-col.footer-contacts {
    grid-column: 1 / -1;
  }

  .site-footer-bottom-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-copy { text-align: left; }

  .footer-trust { padding: 28px 0 32px; }
  .footer-trust-grid { grid-template-columns: 1fr; }

  /* Course picker */
  .course-picker { flex-direction: column; }
  .course-btn { width: 100%; text-align: center; }

  .chapter-progress-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  #add-student-form { flex-direction: column; }
  #add-student-form input,
  #add-student-form button { width: 100%; min-height: 48px; }
}

/* ── Small phone (≤400px) ── */
@media (max-width: 400px) {
  .info-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .logo span:not(.logo-icon) { display: none; }
  .section-title { font-size: 1.5rem; }
  .site-footer-grid { grid-template-columns: 1fr; }
}
