/* Цифровая грамотность 2026 — стили. Строгий деловой стиль, без внешних зависимостей (работает офлайн). */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --ink: #111827;
  --ink-2: #4b5563;
  --ink-3: #6b7280;
  --line: #dfe3ea;
  --navy: #14213d;
  --accent: #1d4ed8;
  --accent-soft: #e6edfc;
  --ok: #15803d;
  --ok-soft: #e7f5ec;
  --bad: #b91c1c;
  --bad-soft: #fbeaea;
  --warn: #a16207;
  --warn-soft: #fbf3e2;
  --gold: #a17a2b;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .06), 0 4px 16px rgba(17, 24, 39, .05);
  --fs: 17px;
  --font: "Segoe UI", "Inter", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1420; --surface: #171d2b; --surface-2: #1e2636; --ink: #e8ebf2; --ink-2: #b4bccb; --ink-3: #8b94a6;
    --line: #2a3346; --navy: #0b1222; --accent: #6b9bff; --accent-soft: #1c2a4a; --ok: #4ade80; --ok-soft: #12301f;
    --bad: #f87171; --bad-soft: #3a1717; --warn: #fbbf24; --warn-soft: #3a2d10; --gold: #d4a94f; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1420; --surface: #171d2b; --surface-2: #1e2636; --ink: #e8ebf2; --ink-2: #b4bccb; --ink-3: #8b94a6;
  --line: #2a3346; --navy: #0b1222; --accent: #6b9bff; --accent-soft: #1c2a4a; --ok: #4ade80; --ok-soft: #12301f;
  --bad: #f87171; --bad-soft: #3a1717; --warn: #fbbf24; --warn-soft: #3a2d10; --gold: #d4a94f; color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: var(--fs); }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button { font: inherit; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Заставка ---------- */
/* Лоадер: From Uiverse.io by SelfMadeSystem - https://uiverse.io/SelfMadeSystem/giant-bird-69
   MIT License, Copyright (c) SelfMadeSystem (SelfMadeSystem) */
.splash {
  position: fixed; inset: 0; z-index: 100; background: #fff; color: #111;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  transition: opacity .6s ease, visibility .6s;
}
.splash.hide { opacity: 0; visibility: hidden; }
.splash-loader { width: 12em; height: 12em; }
.splash-loader path {
  stroke: #000; stroke-width: 0.6px;
  animation: splashDashArray 4s ease-in-out infinite, splashDashOffset 4s linear infinite;
}
@keyframes splashDashArray {
  0% { stroke-dasharray: 0 1 359 0; }
  50% { stroke-dasharray: 0 359 1 0; }
  100% { stroke-dasharray: 359 1 0 0; }
}
@keyframes splashDashOffset {
  0% { stroke-dashoffset: 365; }
  100% { stroke-dashoffset: 5; }
}
.splash-title { font-size: 1.5rem; font-weight: 700; letter-spacing: .02em; color: #14213d; text-align: center; padding: 0 16px; }
.splash-title span { color: #1d4ed8; }
.splash-sub { font-size: .95rem; color: #6b7280; letter-spacing: .08em; text-transform: uppercase; }

/* ---------- Шапка ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; background: var(--navy); color: #fff;
  display: flex; align-items: center; gap: 24px; padding: 10px 24px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-size: 1rem; }
.brand-text small { font-size: .75rem; opacity: .7; letter-spacing: .12em; }
.topnav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topnav a { color: #cdd5e4; text-decoration: none; padding: 6px 12px; border-radius: 6px; font-size: .92rem; }
.topnav a:hover, .topnav a.active { background: rgba(255,255,255,.1); color: #fff; }
.tools { display: flex; gap: 8px; align-items: center; }
.seg { display: inline-flex; border: 1px solid rgba(255,255,255,.25); border-radius: 6px; overflow: hidden; }
.seg button { background: transparent; color: #cdd5e4; border: 0; padding: 4px 10px; cursor: pointer; font-size: .82rem; font-weight: 600; }
.seg button.on { background: #fff; color: var(--navy); }
.icon-btn { background: transparent; color: #cdd5e4; border: 1px solid rgba(255,255,255,.25); border-radius: 6px; padding: 3px 9px; cursor: pointer; font-size: .82rem; font-weight: 600; }
.icon-btn:hover, .seg button:hover:not(.on) { color: #fff; }

/* ---------- Каркас ---------- */
.app { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 32px 24px 64px; outline: none; }
.footer { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 18px 24px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: .85rem; background: var(--surface); }
.crumbs { font-size: .88rem; color: var(--ink-3); margin-bottom: 16px; display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.muted { color: var(--ink-3); }
.kicker { font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--accent); background: var(--accent); color: #fff;
  padding: 10px 18px; border-radius: 8px; cursor: pointer; text-decoration: none; font-weight: 600; font-size: .95rem;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.quiet { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn[disabled] { opacity: .5; cursor: not-allowed; filter: none; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }

/* ---------- Главная ---------- */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; margin-bottom: 36px; }
.hero h1 { font-size: 2.2rem; }
.hero p { color: var(--ink-2); font-size: 1.05rem; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.stat { background: var(--surface-2); border-radius: 8px; padding: 12px 14px; }
.stat b { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: .8rem; color: var(--ink-3); }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
.part-head { display: flex; align-items: baseline; gap: 12px; margin: 36px 0 14px; border-bottom: 2px solid var(--navy); padding-bottom: 8px; }
.part-head h2 { margin: 0; }
.part-head .muted { font-size: .9rem; }
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.mod-card {
  display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.mod-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.mod-card.soon { opacity: .6; pointer-events: none; box-shadow: none; }
.mod-top { display: flex; gap: 12px; align-items: flex-start; }
.mod-icon { flex: none; width: 44px; height: 44px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.mod-icon svg { width: 24px; height: 24px; }
.mod-num { font-size: .75rem; color: var(--ink-3); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.mod-title { font-weight: 700; font-size: 1.02rem; line-height: 1.3; }
.mod-desc { font-size: .88rem; color: var(--ink-2); flex: 1; }
.mod-meta { display: flex; justify-content: space-between; font-size: .8rem; color: var(--ink-3); }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.soon { background: var(--warn-soft); color: var(--warn); }

/* ---------- Модуль ---------- */
.mod-head { display: flex; gap: 18px; align-items: center; margin-bottom: 24px; }
.mod-head .mod-icon { width: 64px; height: 64px; }
.mod-head .mod-icon svg { width: 34px; height: 34px; }
.mod-head p { margin: 0; color: var(--ink-2); }
.steps-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.steps-list a {
  display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 16px; text-decoration: none; color: var(--ink);
}
.steps-list a:hover { border-color: var(--accent); }
.step-n { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: .82rem; font-weight: 700; color: var(--ink-3); }
.steps-list .done .step-n { background: var(--ok); border-color: var(--ok); color: #fff; }
.step-t { flex: 1; font-weight: 600; }
.step-k { font-size: .78rem; color: var(--ink-3); }
.section-title { margin: 28px 0 12px; font-size: .82rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- Урок ---------- */
.lesson-wrap { display: grid; grid-template-columns: 240px 1fr; gap: 28px; align-items: start; }
.side { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 4px; font-size: .9rem; }
.side a { color: var(--ink-2); text-decoration: none; padding: 7px 10px; border-radius: 6px; border-left: 3px solid transparent; }
.side a:hover { background: var(--surface); }
.side a.cur { background: var(--surface); border-left-color: var(--accent); color: var(--ink); font-weight: 600; }
.side a.done::after { content: " ✓"; color: var(--ok); }
.lesson { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 36px 44px; box-shadow: var(--shadow); }
.lesson h1 { font-size: 1.75rem; }
.lesson h3 { margin-top: 1.6em; }
.lesson p, .lesson li { color: var(--ink); }
.lesson ul, .lesson ol { padding-left: 1.3em; }
.lesson li { margin: .3em 0; }
.box { border-radius: 8px; padding: 14px 18px; margin: 1.2em 0; border-left: 4px solid; }
.box b.box-t { display: block; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 4px; }
.box.tip { background: var(--accent-soft); border-color: var(--accent); }
.box.tip .box-t { color: var(--accent); }
.box.warn { background: var(--warn-soft); border-color: var(--warn); }
.box.warn .box-t { color: var(--warn); }
.box.danger { background: var(--bad-soft); border-color: var(--bad); }
.box.danger .box-t { color: var(--bad); }
.box p { margin: 0; }
.defs { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 1em 0; }
.defs dt { font-weight: 700; }
.defs dd { margin: 0; color: var(--ink-2); }
.tbl { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .93rem; }
.tbl th, .tbl td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
.tbl th { background: var(--surface-2); }
kbd { font-family: var(--font); font-size: .85em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px; background: var(--surface-2); }
.audio { display: flex; align-items: center; gap: 12px; background: var(--surface-2); border-radius: 8px; padding: 10px 14px; margin: 0 0 24px; }
.audio .lbl { font-size: .82rem; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.audio audio { flex: 1; height: 36px; min-width: 0; }
.lesson-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---------- Задания и тест ---------- */
.q { margin-bottom: 26px; }
.q-text { font-weight: 600; margin-bottom: 10px; }
.q-hint { font-size: .85rem; color: var(--ink-3); margin: -6px 0 10px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 11px 14px; cursor: pointer; color: var(--ink); width: 100%;
}
.opt:hover { border-color: var(--accent); }
.opt input { margin-top: 5px; accent-color: var(--accent); }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.order-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.order-list li { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface); }
.order-list li span { flex: 1; }
.order-list button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 6px; width: 32px; height: 30px; cursor: pointer; color: var(--ink); }
.match-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: center; margin-bottom: 8px; }
.match-row select { font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 100%; }
.match-row.right select { border-color: var(--ok); background: var(--ok-soft); }
.match-row.wrong select { border-color: var(--bad); background: var(--bad-soft); }
.feedback { border-radius: 8px; padding: 10px 14px; margin-top: 10px; font-size: .92rem; }
.feedback.ok { background: var(--ok-soft); color: var(--ok); }
.feedback.bad { background: var(--bad-soft); color: var(--bad); }
.result { text-align: center; padding: 36px 24px; }
.result .score { font-size: 3.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.result.pass .score { color: var(--ok); }
.result.fail .score { color: var(--bad); }
.test-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; font-size: .88rem; color: var(--ink-3); }
.test-progress .progress { flex: 1; }

/* ---------- Об авторе / литература ---------- */
.author { display: grid; grid-template-columns: 300px 1fr; gap: 32px; align-items: start; }
.author img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 20%; border-radius: var(--radius); box-shadow: var(--shadow); }
.lit-group { margin-bottom: 28px; }
.lit { list-style: none; padding: 0; margin: 0; counter-reset: lit; }
.lit li { counter-increment: lit; display: grid; grid-template-columns: 36px 1fr; padding: 12px 0; border-bottom: 1px solid var(--line); }
.lit li::before { content: counter(lit) "."; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.lit .lit-a { font-weight: 700; }
.lit .lit-n { display: block; font-size: .88rem; color: var(--ink-2); }

/* ---------- Сертификат ---------- */
.cert-form { max-width: 560px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: .9rem; }
.field input { font: inherit; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.cert-status { list-style: none; padding: 0; margin: 12px 0; columns: 2; font-size: .9rem; }
.cert-status li { break-inside: avoid; padding: 3px 0; }
.cert-status .y { color: var(--ok); }
.cert-status .n { color: var(--ink-3); }
.certificate {
  position: relative; width: 100%; max-width: 1000px; aspect-ratio: 297 / 210; margin: 24px auto; background: #fff; color: #14213d;
  padding: 5.5% 7%; border: 1px solid #d8d2c2; box-shadow: var(--shadow); font-family: var(--font); overflow: hidden;
}
.certificate::before { content: ""; position: absolute; inset: 2.2%; border: 2px solid #14213d; pointer-events: none; }
.certificate::after { content: ""; position: absolute; inset: 3.1%; border: 1px solid #a17a2b; pointer-events: none; }
.cert-inner { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; text-align: center; }
.cert-kicker { font-size: clamp(9px, 1.2vw, 13px); letter-spacing: .3em; text-transform: uppercase; color: #a17a2b; font-weight: 700; }
.cert-h { font-size: clamp(26px, 5vw, 54px); font-weight: 800; letter-spacing: .12em; margin: .15em 0 0; color: #14213d; }
.cert-sub { font-size: clamp(10px, 1.4vw, 15px); color: #4b5563; margin-top: .3em; }
.cert-name { font-size: clamp(20px, 3.6vw, 40px); font-weight: 700; margin: .6em 0 .1em; padding: 0 1em .15em; border-bottom: 1px solid #a17a2b; min-width: 60%; }
.cert-text { font-size: clamp(10px, 1.45vw, 15px); color: #374151; max-width: 80%; margin: .7em 0 0; line-height: 1.5; }
.cert-course { font-weight: 700; color: #14213d; }
.cert-meta { display: flex; gap: 4%; justify-content: center; margin-top: 1.1em; font-size: clamp(9px, 1.2vw, 13px); color: #374151; width: 100%; }
.cert-meta div { border: 1px solid #e5e1d6; border-radius: 6px; padding: .5em 1em; min-width: 18%; }
.cert-meta b { display: block; font-size: 1.35em; color: #14213d; }
.cert-foot { margin-top: auto; width: 100%; display: flex; justify-content: space-between; align-items: flex-end; font-size: clamp(9px, 1.2vw, 13px); color: #4b5563; }
.cert-sign { text-align: left; }
.cert-sign .line { display: block; width: 14em; border-top: 1px solid #14213d; margin-bottom: .3em; }
.cert-seal {
  width: clamp(54px, 9vw, 96px); height: clamp(54px, 9vw, 96px); border-radius: 50%; border: 2px solid #a17a2b; color: #a17a2b;
  display: grid; place-items: center; font-weight: 800; font-size: clamp(10px, 1.5vw, 16px); letter-spacing: .05em; line-height: 1.1; text-align: center;
  box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 5px #a17a2b;
}
.cert-id { text-align: right; }

/* ---------- Адаптив ---------- */
@media (max-width: 900px) {
  .hero, .author, .lesson-wrap { grid-template-columns: 1fr; }
  .side { position: static; flex-direction: row; flex-wrap: wrap; }
  .author img { max-width: 280px; }
}
@media (max-width: 640px) {
  :root { --fs: 16px; }
  .app { padding: 20px 16px 48px; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .topnav { order: 3; flex: 0 0 100%; overflow-x: auto; flex-wrap: nowrap; }
  .topnav a { white-space: nowrap; }
  .lesson { padding: 22px 18px; }
  .hero h1 { font-size: 1.7rem; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .match-row { grid-template-columns: 1fr; gap: 4px; }
  .defs { grid-template-columns: 1fr; gap: 2px; }
  .defs dd { margin-bottom: 8px; }
  .cert-status { columns: 1; }
}

/* ---------- Печать сертификата ---------- */
@media print {
  @page { size: A4 landscape; margin: 0; }
  body { background: #fff; }
  body.printing .topbar, body.printing .footer, body.printing .no-print, body.printing .splash { display: none !important; }
  body.printing .app { padding: 0; max-width: none; }
  body.printing .certificate { box-shadow: none; border: 0; margin: 0; width: 297mm; height: 210mm; max-width: none; aspect-ratio: auto; }
  .certificate, .certificate * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
