/* Implant-Line Education — фирменный тёмный стиль (navy + голубой + золото). */
:root {
  --bg: #0b1120;
  --bg-2: #101a2e;
  --card: #16233c;
  --card-2: #1c2c49;
  --line: #24365a;
  --text: #eaf0fb;
  --muted: #8ea3c4;
  --accent: #60a5ff;
  --accent-dim: #2f6fd0;
  --gold: #e4b860;
  --ok: #4ade80;
  --warn: #fbbf24;
  --fail: #f87171;
  --radius: 18px;
  --tabbar: 68px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* градиент на body закреплён по экрану — под ним должен быть тот же тёмный
   фон, иначе на длинных страницах снизу проступает белое */
html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(178deg, #0b1120 0%, #101d36 55%, #0b1120 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px));
}

.screen { padding: 20px 16px 8px; max-width: 640px; margin: 0 auto; }
.screen[hidden] { display: none; }

h1 { font-size: 30px; line-height: 1.15; margin: 6px 0 2px; letter-spacing: -0.5px; }
h2 { font-size: 20px; margin: 0 0 10px; }
.sub { color: var(--muted); font-size: 15px; margin: 0 0 20px; }

/* ─── карточки ─── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card-title { font-size: 19px; font-weight: 700; }
.card-count { font-size: 18px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.card-count.done { color: var(--gold); }
.card-note { color: var(--muted); font-size: 14px; margin-top: 10px; }

.bar { height: 9px; border-radius: 6px; background: #24365a; margin-top: 14px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; background: var(--accent); transition: width .4s ease; }
.bar.gold > i { background: var(--gold); }

.status { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.fail { background: var(--fail); }

/* ─── кнопки ─── */
.btn {
  display: block; width: 100%; border: 0; border-radius: 14px;
  padding: 17px 20px; font-size: 18px; font-weight: 700;
  font-family: inherit; cursor: pointer; margin: 18px 0;
  background: var(--accent); color: #08111f;
}
.btn:active { transform: scale(.99); }
.btn.ghost { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn.gold { background: transparent; color: var(--gold); border: 1.5px solid var(--gold); }
.btn.small { display: inline-block; width: auto; padding: 9px 18px; font-size: 15px; margin: 12px 0 0; border-radius: 11px; }
.btn[disabled] { opacity: .45; }

/* ─── результат ─── */
.result-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.result-box .label { color: var(--muted); font-size: 15px; }
.result-big { font-size: 32px; font-weight: 800; margin: 4px 0 2px; letter-spacing: -1px; }

/* ─── список разделов ─── */
.list-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 14px; padding: 15px 16px; margin-bottom: 10px;
  font-size: 16px; font-family: inherit; text-align: left; cursor: pointer;
}
.list-item .num { color: var(--muted); font-size: 14px; min-width: 24px; flex: none; }
.list-item .ttl { flex: 1; }
.list-item .mark { color: var(--ok); flex: none; font-size: 15px; }
.list-item.read { border-color: #1e4a33; }

.block-head { color: var(--muted); font-size: 13px; text-transform: uppercase;
  letter-spacing: .6px; margin: 22px 0 10px; }

/* ─── чтение раздела ─── */
.reader h2 { font-size: 23px; line-height: 1.2; margin-bottom: 6px; }
.reader .text { white-space: pre-wrap; font-size: 16.5px; line-height: 1.6; color: #dce6f7; }
.reader img { width: 100%; border-radius: 14px; margin: 16px 0; display: block; cursor: zoom-in; }
.reader .zoom-hint { color: var(--muted); font-size: 13px; text-align: center; margin: -6px 0 4px; }

/* просмотр слайда во весь экран: на телефоне мелкий текст иначе не прочитать */
.lightbox {
  position: fixed; inset: 0; z-index: 60; background: #05080f;
  overflow: auto; -webkit-overflow-scrolling: touch;
  /* именно block: при flex-центрировании левый край уезжает за границу
     прокрутки и до него не добраться */
  display: block;
}
.lightbox[hidden] { display: none; }
.lightbox img { display: block; width: 200%; max-width: none; height: auto; }
.lightbox-close {
  position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); right: 14px;
  z-index: 61; width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: rgba(22, 35, 60, .92); color: var(--text); font-size: 19px;
  cursor: pointer; font-family: inherit;
}
.reader-nav { display: flex; gap: 10px; margin: 22px 0 8px; }
.reader-nav .btn { margin: 0; flex: 1; }

/* ─── тест ─── */
.test-head { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.test-head .bar { flex: 1; margin: 0; }
.counter { font-size: 18px; font-weight: 700; white-space: nowrap; }
.timer {
  display: inline-flex; align-items: center; gap: 6px; float: right;
  background: #2a2417; color: var(--gold); font-weight: 700;
  padding: 6px 14px; border-radius: 999px; margin: 12px 0 4px; font-variant-numeric: tabular-nums;
}
.timer.low { background: #3a1d1d; color: var(--fail); }
.qbox { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 14px 0 18px; }
.qbox .qnum { color: var(--accent); font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.qbox .qtext { font-size: 19px; font-weight: 700; line-height: 1.35; }

.option {
  display: flex; gap: 14px; align-items: flex-start; width: 100%;
  background: var(--card); border: 1.5px solid transparent; color: var(--text);
  border-radius: 14px; padding: 15px 16px; margin-bottom: 11px;
  font-size: 16px; font-family: inherit; text-align: left; cursor: pointer; line-height: 1.35;
}
.option .letter {
  width: 30px; height: 30px; border-radius: 50%; background: #24365a; color: var(--muted);
  display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none;
}
.option.sel { border-color: var(--accent); background: var(--card-2); }
.option.sel .letter { background: var(--accent); color: #08111f; }

textarea {
  width: 100%; min-height: 190px; background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 14px; padding: 15px;
  font-family: inherit; font-size: 16px; line-height: 1.45; resize: vertical;
}
textarea:focus { outline: none; border-color: var(--accent); }
.checklist { background: var(--card-2); border-radius: 14px; padding: 15px 18px; margin-bottom: 14px; }
.checklist b { font-size: 14px; color: var(--gold); display: block; margin-bottom: 8px; }
.checklist ul { margin: 0; padding-left: 20px; color: var(--muted); font-size: 15px; }
.checklist li { margin-bottom: 5px; }

/* ─── команда ─── */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin-bottom: 18px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 15px 8px; text-align: center; }
.tile .n { font-size: 30px; font-weight: 800; line-height: 1.1; }
.tile .l { color: var(--muted); font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 4px; }
.row { display: flex; align-items: center; gap: 12px; margin-bottom: 13px; font-size: 15px; }
.row .nm { width: 92px; flex: none; color: #cbd8ee; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .bar { flex: 1; margin: 0; }
.row .pct { width: 40px; text-align: right; font-weight: 700; flex: none; font-variant-numeric: tabular-nums; }
.weak { margin-bottom: 15px; }
.weak .wname { font-size: 15px; margin-bottom: 6px; }
.weak .bar { margin: 0 0 4px; }
.weak .wpct { text-align: right; font-weight: 700; font-size: 15px; }

/* ─── табы ─── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; background: rgba(11, 17, 32, .93);
  backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
/* display:flex перебивает атрибут hidden — гасим явно */
.tabbar[hidden] { display: none; }
.tabbar button {
  flex: 1; background: none; border: 0; color: var(--muted); cursor: pointer;
  font-family: inherit; font-size: 12px; padding: 9px 0 10px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.tabbar button .pip { width: 7px; height: 7px; border-radius: 50%; background: #33456b; }
.tabbar button.active { color: var(--accent); }
.tabbar button.active .pip { background: var(--accent); }

.center { text-align: center; padding: 60px 20px; color: var(--muted); }
.center h2 { color: var(--text); }
.hint { color: var(--muted); font-size: 14px; text-align: center; margin-top: 14px; }
.badge { display: inline-block; background: #2a2417; color: var(--gold); font-size: 13px;
  padding: 4px 12px; border-radius: 999px; margin-bottom: 12px; }
