/* Дизайн-система курса и сайта «ALX AI». Тёмная тема по умолчанию, светлая - [data-theme="light"]. */
@import url("https://fonts.googleapis.com/css2?family=Unbounded:wght@500;700;800&family=Manrope:wght@400;500;600;700&display=swap");

:root {
  --bg: #08080d;
  --bg-2: #0f0f17;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.09);
  --text: #f3f2f7;
  --muted: #a3a1b4;
  --faint: #6d6b80;
  --violet: #8b6cff;
  --coral: #ff6b57;
  --mint: #2fd8a7;
  --sun: #ffc24a;
  --sky: #4ab8ff;
  --grad: linear-gradient(120deg, #8b6cff 0%, #d35cff 45%, #ff6b57 100%);
  --grad-soft: linear-gradient(120deg, rgba(139,108,255,.18), rgba(255,107,87,.14));
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.7);
  --font-head: "Unbounded", system-ui, sans-serif;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f5fb;
  --bg-2: #ffffff;
  --surface: rgba(20, 16, 50, 0.035);
  --surface-2: rgba(20, 16, 50, 0.07);
  --border: rgba(20, 16, 50, 0.1);
  --text: #15131f;
  --muted: #5d5a70;
  --faint: #8d8aa0;
  --shadow: 0 30px 60px -30px rgba(40, 30, 90, 0.25);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 17px/1.65 var(--font); -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(900px 500px at 85% -10%, rgba(139,108,255,.16), transparent 60%),
    radial-gradient(700px 400px at -10% 20%, rgba(255,107,87,.10), transparent 60%);
  background-attachment: fixed;
  overflow-x: hidden;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 .5em; overflow-wrap: break-word; hyphens: auto; }
h1 { font-size: clamp(32px, 5.4vw, 64px); font-weight: 800; }
h2 { font-size: clamp(24px, 3.2vw, 36px); font-weight: 700; margin-top: 1.6em; }
h3 { font-size: 20px; font-weight: 700; margin-top: 1.4em; }
p { margin: 0 0 1em; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.muted { color: var(--muted); }
.eyebrow { font: 600 13px/1 var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* ── Верхняя панель ─────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px); backdrop-filter: blur(18px) saturate(1.4);
  background: color-mix(in srgb, var(--bg) 72%, transparent); border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 10px; font: 700 16px/1 var(--font-head); text-decoration: none; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--grad); display: grid; place-items: center; color: #fff; font-size: 15px; }
.topbar .spacer { flex: 1; }
.progress-pill { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.progress-bar { width: 120px; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--grad); border-radius: 99px; transition: width .4s; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; display: grid; place-items: center; font-size: 17px; }
.menu-btn { display: none; }

/* ── Кнопки ─────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 10px; padding: 14px 24px; border-radius: 16px; font: 700 16px/1 var(--font); text-decoration: none; border: 0; cursor: pointer; transition: transform .15s, box-shadow .2s; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 14px 40px -12px rgba(211,92,255,.6); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }

/* ── Главная курса ──────────────────────────────────────────────── */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; padding: clamp(48px, 9vw, 110px) 0 60px; }
.hero p.lead { font-size: clamp(18px, 2vw, 21px); color: var(--muted); max-width: 560px; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-visual { position: relative; aspect-ratio: 1 / 1; border-radius: 32px; overflow: hidden; background: var(--grad-soft); border: 1px solid var(--border); box-shadow: var(--shadow); }
.hero-visual img { width: 100%; height: 100%; object-fit: cover; }
.stats { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 36px; }
.stat b { display: block; font: 800 28px/1 var(--font-head); }
.stat span { font-size: 14px; color: var(--muted); }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 30px 0 22px; }
.modules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; padding-bottom: 80px; }
.module-card {
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 24px; min-height: 230px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  text-decoration: none; overflow: hidden; transition: transform .2s, border-color .2s;
}
.module-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent, var(--violet)) 60%, transparent); }
.module-card::before { content: ""; position: absolute; inset: auto -40% -60% auto; width: 260px; height: 260px; border-radius: 50%; background: var(--accent, var(--violet)); opacity: .16; filter: blur(30px); }
.module-card .num { font: 800 54px/1 var(--font-head); color: var(--accent, var(--violet)); opacity: .9; }
.module-card h3 { margin: 0; font-size: 21px; }
.module-card .res { color: var(--muted); font-size: 15px; }
.module-card .meta { margin-top: auto; display: flex; justify-content: space-between; font-size: 14px; color: var(--faint); }
.module-card.wide { grid-column: span 2; }
.module-card .cover { position: absolute; inset: 0; opacity: .22; background-size: cover; background-position: center; mix-blend-mode: luminosity; }

/* ── Страница урока ─────────────────────────────────────────────── */
.layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100vh - 67px); }
.sidebar { position: sticky; top: 67px; height: calc(100vh - 67px); overflow-y: auto; padding: 24px 18px 40px; border-right: 1px solid var(--border); }
.sidebar .mod { margin-bottom: 18px; }
.sidebar .mod-title { display: flex; gap: 10px; align-items: center; font: 700 13px/1.3 var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 6px 8px; }
.sidebar .mod-title i { font-style: normal; width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--text); font-size: 12px; }
.sidebar a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; text-decoration: none; font-size: 15px; color: var(--muted); }
.sidebar a:hover { background: var(--surface); color: var(--text); }
.sidebar a.active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.sidebar a .dot { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; font-size: 11px; }
.sidebar a.done .dot { background: var(--mint); border-color: var(--mint); color: #062; }
.sidebar a.done .dot::after { content: "✓"; color: #04110c; font-weight: 800; }

.lesson { max-width: 820px; padding: clamp(28px, 5vw, 56px) clamp(16px, 5vw, 64px) 80px; }
.lesson-hero { position: relative; border-radius: var(--radius); overflow: hidden; margin: 18px 0 30px; aspect-ratio: 16 / 7; background: var(--grad-soft); border: 1px solid var(--border); }
.lesson-hero img { width: 100%; height: 100%; object-fit: cover; }
.lesson-hero .fallback { position: absolute; inset: 0; display: grid; place-items: center; font: 800 clamp(60px, 12vw, 140px)/1 var(--font-head); color: rgba(255,255,255,.08); }
.lesson-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.chip { padding: 6px 12px; border-radius: 99px; background: var(--surface-2); font-size: 13px; color: var(--muted); }
.lesson ul, .lesson ol { padding-left: 1.3em; }
.lesson li { margin: .35em 0; }

.card { position: relative; border-radius: var(--radius); padding: 22px 24px; margin: 26px 0; background: var(--surface); border: 1px solid var(--border); }
.card h3 { margin-top: 0; display: flex; align-items: center; gap: 10px; font-size: 18px; }
.card .ico { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-size: 17px; background: var(--surface-2); }
.card.result { background: var(--grad-soft); }
.card.agent { border-color: color-mix(in srgb, var(--violet) 45%, transparent); }
.card.task { border-color: color-mix(in srgb, var(--mint) 50%, transparent); }
.card.task::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 4px; border-radius: 4px; background: var(--mint); }
.card.warn { border-color: color-mix(in srgb, var(--coral) 50%, transparent); }
.card.tip { border-color: color-mix(in srgb, var(--sun) 45%, transparent); }

.steps { counter-reset: s; list-style: none; padding: 0 !important; margin: 20px 0; }
.steps > li { counter-increment: s; position: relative; padding: 4px 0 18px 58px; margin: 0; }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font: 700 16px/1 var(--font-head); background: var(--grad); color: #fff; }
.steps > li::after { content: ""; position: absolute; left: 19px; top: 46px; bottom: 4px; width: 2px; background: var(--border); }
.steps > li:last-child::after { display: none; }
.steps > li > b:first-child { display: block; margin-bottom: 4px; }

.prompt { position: relative; margin: 16px 0; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--border); }
.prompt .label { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.prompt pre { margin: 0; padding: 14px 16px; white-space: pre-wrap; word-break: break-word; font: 500 15px/1.6 ui-monospace, "Cascadia Code", Consolas, monospace; color: var(--text); }
.copy-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 9px; padding: 5px 10px; font: 600 12px/1 var(--font); cursor: pointer; }
.copy-btn.ok { background: var(--mint); color: #04110c; border-color: var(--mint); }

.chat { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; padding: 18px; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--border); }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.5; }
.msg.me { align-self: flex-end; background: var(--grad); color: #fff; border-bottom-right-radius: 5px; }
.msg.bot { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 5px; }

.figure { margin: 26px 0; }
.figure img { border-radius: var(--radius); border: 1px solid var(--border); }
.figure figcaption { margin-top: 8px; font-size: 14px; color: var(--muted); text-align: center; }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0; }
.compare > div { padding: 16px 18px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); }
.compare .bad { border-color: color-mix(in srgb, var(--coral) 45%, transparent); }
.compare .good { border-color: color-mix(in srgb, var(--mint) 45%, transparent); }
.compare .tag { font: 700 12px/1 var(--font); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 8px; display: block; }
.compare .bad .tag { color: var(--coral); } .compare .good .tag { color: var(--mint); }

.done-box { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; margin: 40px 0 0; padding: 20px 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.pager a { padding: 16px 18px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); text-decoration: none; }
.pager a small { display: block; color: var(--faint); font-size: 13px; }
.pager a.next { text-align: right; }

.footer { padding: 40px 0; border-top: 1px solid var(--border); color: var(--faint); font-size: 14px; }

/* ── Телефон ────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
  .hero-visual { max-width: 460px; }
  .modules { grid-template-columns: 1fr 1fr; }
  .module-card.wide { grid-column: span 2; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 30; top: 67px; left: 0; width: min(320px, 86vw); background: var(--bg); transform: translateX(-105%); transition: transform .25s; box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: none; }
  .menu-btn { display: grid; }
  .progress-bar { width: 70px; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  h1 { font-size: clamp(26px, 8vw, 34px); }
  .modules { grid-template-columns: 1fr; }
  .module-card.wide { grid-column: auto; }
  .compare, .pager { grid-template-columns: 1fr; }
  .msg { max-width: 92%; }
  .progress-pill .txt { display: none; }
}
@media print { .topbar, .sidebar, .done-box, .pager { display: none; } .layout { display: block; } body { background: #fff; color: #000; } }

/* ── Векторные иллюстрации (рисует app.js) ── */
.lesson-hero svg, .hero-visual svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.lesson-hero .fallback { z-index: 1; left: auto; right: 4%; top: auto; bottom: 2%; place-items: end; font-size: clamp(40px, 8vw, 90px); color: rgba(255,255,255,.1); }
.module-card .cover { position: absolute; inset: 0; opacity: .55; mix-blend-mode: normal; pointer-events: none; }
.module-card .cover svg { width: 100%; height: 100%; }
.module-card > :not(.cover) { position: relative; z-index: 1; }
.module-card::before { z-index: 0; }
:root[data-theme="light"] .lesson-hero, :root[data-theme="light"] .hero-visual { background: #14121f; }
:root[data-theme="light"] .module-card .cover { opacity: .18; }
/* Картинки Gemini поверх векторной графики: плавно проявляются после загрузки */
.lesson-hero .photo, .hero-visual .photo, .module-card .cover .photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .5s ease; }
.lesson-hero .photo.on, .hero-visual .photo.on, .module-card .cover .photo.on { opacity: 1; }
.module-card .cover:has(.photo.on) { opacity: .5; }
.module-card .cover .photo { -webkit-mask: linear-gradient(200deg, #000 30%, transparent 85%); mask: linear-gradient(200deg, #000 30%, transparent 85%); }
img.logo-mark { display: block; background: none; }
