/* НМТ-тренер — мінімалістична темна тема */
@font-face { font-family: "Suisse"; src: url(fonts/SuisseIntl-Book.otf) format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Suisse"; src: url(fonts/SuisseIntl-Regular.otf) format("opentype"); font-weight: 500; font-display: swap; }

:root {
  --bg: #0e1012;
  --panel: #15181c;
  --panel-2: #1c2026;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f7f9fb;
  --muted: rgba(222, 230, 238, 0.56);
  --soft: rgba(222, 230, 238, 0.34);
  --accent: #bdb2fd;
  --accent-ink: #0f0c1f;
  --accent-12: rgba(189, 178, 253, 0.12);
  --accent-24: rgba(189, 178, 253, 0.24);
  --accent-50: rgba(189, 178, 253, 0.5);
  --ok: #6fdc9b;
  --ok-12: rgba(111, 220, 155, 0.12);
  --bad: #ff8a8a;
  --bad-12: rgba(255, 138, 138, 0.12);
  --warn: #f5c46b;
  --warn-12: rgba(245, 196, 107, 0.12);
  --radius: 18px;
  /* безпечні зони: системні + від Telegram (повноекранний режим, вирізи) */
  --safe-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --vh: var(--tg-viewport-stable-height, 100dvh);
}

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

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.45 "Suisse", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior: none;
  overflow-x: hidden;
}
b, strong { font-weight: 500; }
button {
  font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0;
  -webkit-appearance: none; appearance: none; touch-action: manipulation;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
/* 16px — інакше iOS масштабує сторінку при фокусі на полі */
input, select, textarea { font: inherit; font-size: 16px; color: var(--text); -webkit-appearance: none; appearance: none; }
img { -webkit-user-drag: none; }
.bg-orbs { display: none; }

#app {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(18px + var(--safe-top)) 16px calc(100px + var(--safe-bottom));
  min-height: var(--vh);
  overflow-wrap: break-word;
}
#app.no-nav { padding-bottom: calc(24px + var(--safe-bottom)); }
/* відкрита клавіатура: ховаємо нижню навігацію, щоб не перекривала поля */
body.kb-open .nav { display: none; }
body.kb-open #app { padding-bottom: 24px; }

/* ---------- splash ---------- */
.splash { min-height: 80vh; display: grid; place-content: center; text-align: center; gap: 10px; }
.splash-logo { font-size: 34px; letter-spacing: 1px; color: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.splash-text { color: var(--muted); font-size: 13px; }
@keyframes pulse { 50% { opacity: 0.45; } }

/* ---------- базові ---------- */
.screen { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeUp { from { opacity: 0.4; transform: translateY(6px); } }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
}
.card.tight { padding: 6px 14px; }
.card.grad { border-color: var(--accent-24); background: linear-gradient(180deg, var(--accent-12), var(--panel) 70%); }
.card.warm { border-color: var(--accent-24); background: var(--accent-12); }

h1 { font-size: 26px; line-height: 1.1; margin: 0 0 4px; font-weight: 400; letter-spacing: -0.2px; }
h2 { font-size: 19px; line-height: 1.2; margin: 0 0 8px; font-weight: 400; }
h3 { font-size: 15px; margin: 0 0 4px; font-weight: 500; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.gap { height: 12px; }
.hidden { display: none !important; }
.accent { color: var(--accent); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--accent); font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase; margin-bottom: 8px;
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--accent); }
.page-head { margin: 6px 0 18px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }

.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin: 22px 2px 10px; color: var(--muted); font-size: 11.5px; letter-spacing: 0.8px; text-transform: uppercase;
}
.section-title .link { color: var(--accent); text-transform: none; letter-spacing: 0; }

/* ---------- кнопки ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 50px; padding: 0 18px; border-radius: 14px;
  background: var(--accent); color: var(--accent-ink); font-weight: 500; font-size: 15px;
  transition: transform 0.12s ease, opacity 0.2s, background 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.35; }
.btn.secondary { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.btn.ghost { background: transparent; color: var(--accent); min-height: 40px; }
.btn.warm { background: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--bad-12); color: var(--bad); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; width: auto; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }
.hint { margin-top: 8px; text-align: center; color: var(--soft); font-size: 12px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: 999px; font-size: 13.5px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); transition: all 0.15s;
}
.chip.on { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.badge-pill {
  display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; background: rgba(255, 255, 255, 0.06); color: var(--muted); white-space: nowrap;
}
.badge-pill.ok { background: var(--ok-12); color: var(--ok); }
.badge-pill.bad { background: var(--bad-12); color: var(--bad); }
.badge-pill.warn { background: var(--warn-12); color: var(--warn); }
.badge-pill.acc { background: var(--accent-12); color: var(--accent); }

/* ---------- шапка ---------- */
.hero { display: flex; align-items: center; gap: 12px; margin: 2px 0 18px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 17px; color: var(--text);
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line);
}
.avatar, .pod .ava { position: relative; overflow: hidden; }
.avatar img, .pod .ava img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.avatar.mini { width: 28px; height: 28px; font-size: 12px; }
.hero .hello { font-size: 12.5px; color: var(--muted); }
.hero .name { font-size: 18px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); color: var(--muted);
}
.icon-btn svg, .ico { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- статистика ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.stat .v { font-size: 22px; line-height: 1.1; }
.stat .l { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.stat .e { display: none; }
.stats.two, .stats.four { grid-template-columns: repeat(2, 1fr); }

/* ---------- прогрес ---------- */
.bar { height: 6px; background: rgba(255, 255, 255, 0.07); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.5s ease; }
.bar.ok > i { background: var(--ok); }
.bar.thin { height: 4px; }

.segments { display: flex; gap: 6px; margin: 12px 0 4px; }
.segments i { flex: 1; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); }
.segments i.ok { background: var(--ok); }
.segments i.bad { background: var(--bad); }
.segments i.cur { background: var(--accent); }

.ring { --p: 0; --size: 76px; width: var(--size); height: var(--size); border-radius: 50%; flex: none;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), rgba(255,255,255,0.08) 0); display: grid; place-items: center; }
.ring > div { width: calc(var(--size) - 10px); height: calc(var(--size) - 10px); border-radius: 50%;
  background: var(--panel); display: grid; place-items: center; text-align: center; }
.ring b { font-size: 20px; font-weight: 400; line-height: 1; }
.ring span { font-size: 10.5px; color: var(--muted); }

.timer { font-variant-numeric: tabular-nums; color: var(--text); }

/* ---------- списки-меню ---------- */
.menu { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 10px; }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.menu-item:last-child { border-bottom: 0; }
.menu-item:active { background: rgba(255, 255, 255, 0.03); }
.menu-item .mi { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-12); color: var(--accent); flex: none; }
.menu-item .mi svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.menu-item .mt { flex: 1; min-width: 0; }
.menu-item .mt div:last-child { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.chev { color: var(--soft); font-size: 20px; line-height: 1; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; text-align: left; display: flex; flex-direction: column; gap: 3px; }
.tile .ti { display: none; }
.tile .tt { font-weight: 500; }
.tile .ts { font-size: 12px; color: var(--muted); }

/* ---------- завдання ---------- */
.task-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px; margin-bottom: 8px; text-align: left;
}
.task-item:active { background: var(--panel-2); }
.task-item .num {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 14px; border: 1px solid var(--line-strong); color: var(--muted);
}
.task-item.done-ok .num { background: var(--ok-12); border-color: transparent; color: var(--ok); }
.task-item.done-bad .num { background: var(--bad-12); border-color: transparent; color: var(--bad); }
.task-item.next .num { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.task-item.locked { opacity: 0.5; }
.task-item .ttl { font-weight: 500; }
.task-item .arrow { color: var(--soft); font-size: 20px; }

.q-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.q-text { font-size: 18px; line-height: 1.5; white-space: pre-wrap; }
.options { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.opt {
  display: flex; align-items: flex-start; gap: 12px; text-align: left; width: 100%;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px;
  transition: border-color 0.15s, background 0.15s;
}
.opt .l {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line-strong); font-size: 13px; color: var(--muted);
}
.opt .t { padding-top: 3px; flex: 1; }
.opt.sel { border-color: var(--accent); background: var(--accent-12); }
.opt.sel .l { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.opt.right { border-color: rgba(111, 220, 155, 0.5); background: var(--ok-12); }
.opt.right .l { background: var(--ok); border-color: transparent; color: #08150d; }
.opt.wrong { border-color: rgba(255, 138, 138, 0.5); background: var(--bad-12); animation: shake 0.35s; }
.opt.wrong .l { background: var(--bad); border-color: transparent; color: #1d0909; }
.opt.dim { opacity: 0.45; }
.hl { font-weight: 500; color: var(--accent); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.opt.right .hl, .opt.wrong .hl, .opt.sel .hl { color: inherit; }
.opt .tag { font-size: 11.5px; margin-top: 4px; color: var(--warn); }
@keyframes shake { 25%, 75% { transform: translateX(-4px); } 50% { transform: translateX(4px); } }

.result-card { animation: fadeUp 0.25s ease; }
.result-card.ok { border-color: rgba(111, 220, 155, 0.35); }
.result-card.bad { border-color: rgba(255, 138, 138, 0.35); }
.result-big { font-size: 18px; margin-bottom: 6px; }
.result-card.ok .result-big { color: var(--ok); }
.result-card.bad .result-big { color: var(--bad); }
.trap-box { background: var(--warn-12); border-radius: 12px; padding: 10px 12px; margin-top: 12px; font-size: 14px; }
.trap-box b { color: var(--warn); }
.explain { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14.5px; }
.explain b { display: block; margin-bottom: 3px; color: var(--muted); font-weight: 400; font-size: 11.5px; letter-spacing: 0.8px; text-transform: uppercase; }
.plus-points { color: var(--accent); font-size: 18px; }

/* ---------- вкладки ---------- */
.tabs { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 3px; margin-bottom: 14px; }
.tabs button { flex: 1; min-height: 34px; border-radius: 9px; color: var(--muted); font-size: 13.5px; }
.tabs button.on { background: var(--accent); color: var(--accent-ink); }
.tabs.scroll { overflow-x: auto; scrollbar-width: none; }
.tabs.scroll::-webkit-scrollbar { display: none; }
.tabs.scroll button { flex: none; padding: 0 12px; white-space: nowrap; }

/* ---------- рейтинг ---------- */
.podium { display: grid; grid-template-columns: 1fr 1.1fr 1fr; gap: 8px; align-items: end; margin: 8px 0 14px; }
.pod { text-align: center; }
.pod .ava { width: 44px; height: 44px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,0.06); border: 1px solid var(--line); }
.pod.p1 .ava { background: var(--accent); color: var(--accent-ink); border: 0; }
.pod .block { border-radius: 14px 14px 6px 6px; padding: 10px 4px; background: var(--panel); border: 1px solid var(--line); }
.pod.p1 .block { height: 104px; border-color: var(--accent-24); }
.pod.p2 .block { height: 84px; }
.pod.p3 .block { height: 70px; }
.pod .medal { font-size: 13px; color: var(--muted); }
.pod.p1 .medal { color: var(--accent); }
.pod .nm { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.pod .sc { font-size: 12px; color: var(--muted); }

.lb-row { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.lb-row:last-child { border-bottom: 0; }
.lb-row .pl { width: 26px; text-align: center; color: var(--muted); font-size: 13px; }
.lb-row .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .sc { color: var(--text); }
.lb-row.me { background: var(--accent-12); border-radius: 10px; padding-left: 8px; padding-right: 8px; }

/* ---------- банда ---------- */
.ladder { position: relative; padding-left: 24px; }
.ladder::before { content: ""; position: absolute; left: 7px; top: 14px; bottom: 14px; width: 1px; background: var(--line-strong); }
.step { position: relative; padding: 8px 0 10px; }
.step::before {
  content: ""; position: absolute; left: -22px; top: 13px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--line-strong);
}
.step.done::before { background: var(--ok); border-color: var(--ok); }
.step.next::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-12); }
.link-box {
  display: flex; align-items: center; gap: 8px; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; font-size: 13px; word-break: break-all; margin: 12px 0; color: var(--muted);
}

/* ---------- підписка ---------- */
.tariff {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 8px;
}
.tariff:active { background: var(--panel-2); }
.tariff.best, .tariff.legend { border-color: var(--accent-50); }
.tariff .tn { font-size: 16px; }
.tariff .price { font-size: 19px; white-space: nowrap; }
.tariff .flag {
  position: absolute; top: -9px; right: 14px; padding: 2px 10px; border-radius: 99px;
  font-size: 11px; background: var(--accent); color: var(--accent-ink);
}

.input {
  width: 100%; min-height: 46px; padding: 0 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line); outline: none; font-size: 15px;
}
.input:focus { border-color: var(--accent-50); }
textarea.input { min-height: 110px; padding: 12px 14px; resize: vertical; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
select.input option { background: var(--panel); }
select.input { padding-right: 36px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
label.lbl { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 2px 6px; }

/* ---------- профіль ---------- */
.level-card { display: flex; gap: 14px; align-items: center; }
.level-emoji { font-size: 26px; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-12); flex: none; }
.badges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.bdg { text-align: center; padding: 10px 4px; border-radius: 14px; background: rgba(255,255,255,0.03); border: 1px solid var(--line); }
.bdg .be { font-size: 22px; }
.bdg .bn { font-size: 10.5px; margin-top: 4px; line-height: 1.2; color: var(--muted); }
.bdg.off { opacity: 0.28; filter: grayscale(1); }
.heat { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; }
.heat i { aspect-ratio: 1; border-radius: 4px; background: rgba(255,255,255,0.05); }
.heat i.l1 { background: rgba(189, 178, 253, 0.3); }
.heat i.l2 { background: rgba(189, 178, 253, 0.6); }
.heat i.l3 { background: var(--accent); }
.subj-row { margin-bottom: 12px; }
.subj-row:last-child { margin-bottom: 0; }
.subj-row .row { margin-bottom: 6px; font-size: 14px; }
.hist { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.hist:last-child { border: 0; }

/* ---------- онбординг ---------- */
.onb { min-height: calc(var(--vh) - 50px - var(--safe-top) - var(--safe-bottom)); display: flex; flex-direction: column; }
.onb .body { flex: 1; }
.onb-hero { padding: 24px 0 8px; }
.onb-hero .big { display: none; }
.onb-hero h1 { font-size: 30px; }
.dots { display: flex; gap: 6px; margin: 14px 0 18px; }
.dots i { width: 18px; height: 3px; border-radius: 99px; background: rgba(255,255,255,0.1); transition: all 0.2s; }
.dots i.on { width: 32px; background: var(--accent); }
.pick {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 8px;
}
.pick.on { border-color: var(--accent-50); background: var(--accent-12); }
.pick .pe { font-size: 20px; width: 26px; text-align: center; }
.pick .check { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; font-size: 12px; flex: none; }
.pick.on .check { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.feature { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; }
.feature + .feature { border-top: 1px solid var(--line); }
.feature .fe { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-12); color: var(--accent); font-size: 12px; flex: none; margin-top: 1px; }

/* ---------- навігація ---------- */
.nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(10px + var(--safe-bottom)); z-index: 20;
  width: calc(100% - 24px); max-width: 536px; display: flex; justify-content: space-around;
  background: rgba(14, 16, 18, 0.88); border: 1px solid var(--line); border-radius: 20px; padding: 6px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 0 6px; border-radius: 14px; color: var(--soft); transition: color 0.15s, background 0.15s; }
.nav button svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav button b { font-size: 10.5px; font-weight: 400; }
.nav button.on { color: var(--accent); background: var(--accent-12); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; top: calc(12px + var(--safe-top)); transform: translate(-50%, -200%); z-index: 50;
  opacity: 0; visibility: hidden;
  background: var(--panel-2); border: 1px solid var(--line-strong); color: var(--text);
  padding: 11px 16px; border-radius: 12px; font-size: 13.5px; max-width: 90%; text-align: center;
  transition: transform 0.3s ease, opacity 0.3s, visibility 0.3s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.toast.bad { border-color: rgba(255, 138, 138, 0.4); }
.toast.ok { border-color: rgba(111, 220, 155, 0.4); }
#confetti { display: none; }

/* ---------- скелетон ---------- */
.skel { background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%); background-size: 200% 100%;
  animation: skel 1.2s infinite; border-radius: 16px; height: 68px; margin-bottom: 10px; }
@keyframes skel { to { background-position: -200% 0; } }

/* ---------- адмінка ---------- */
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kv .stat .v { font-size: 19px; }
.key-code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; letter-spacing: 0.3px; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.list-row:last-child { border: 0; }
.q-preview { font-size: 13.5px; padding: 12px 14px; }
.q-preview ol { margin: 6px 0 0; padding-left: 20px; color: var(--muted); }
.q-preview li.c { color: var(--ok); }
.q-preview li.t { color: var(--warn); }
.empty { text-align: center; padding: 32px 10px; color: var(--muted); }
.empty .ee { font-size: 30px; margin-bottom: 8px; opacity: 0.8; }
.empty h2, .empty h3 { color: var(--text); }

/* ---------- анімації ---------- */
:root { --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1); --spring: cubic-bezier(0.34, 1.56, 0.64, 1); }

/* каскадна поява елементів екрана (індекс --d ставить JS) */
.in { animation: rise 0.5s var(--ease-out) both; animation-delay: calc(var(--d, 0) * 45ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.985); } }

/* смуги прогресу заповнюються зліва */
.bar > i { transform-origin: left center; animation: growX 0.9s var(--ease-out) both; animation-delay: 0.15s; }
@keyframes growX { from { transform: scaleX(0); } }
.segments i { transform-origin: left center; animation: growX 0.5s var(--ease-out) both; }
.segments i:nth-child(1) { animation-delay: 0.10s; } .segments i:nth-child(2) { animation-delay: 0.16s; }
.segments i:nth-child(3) { animation-delay: 0.22s; } .segments i:nth-child(4) { animation-delay: 0.28s; }
.segments i:nth-child(5) { animation-delay: 0.34s; } .segments i:nth-child(6) { animation-delay: 0.40s; }
.segments i:nth-child(7) { animation-delay: 0.46s; } .segments i:nth-child(8) { animation-delay: 0.52s; }
.segments i.cur { animation: growX 0.5s var(--ease-out) both, curPulse 1.8s ease-in-out 0.8s infinite; }
@keyframes curPulse { 50% { opacity: 0.45; } }
.anim-done .bar > i, .anim-done .segments i:not(.cur) { animation: none; }

/* головна картка: м'який відблиск, що пробігає раз на кілька секунд */
.card.grad { position: relative; overflow: hidden; }
.card.grad::after {
  content: ""; position: absolute; inset: -40% auto -40% -60%; width: 45%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(189, 178, 253, 0.10), transparent);
  transform: skewX(-18deg); animation: sheen 6s ease-in-out 1.2s infinite;
}
@keyframes sheen { 0% { left: -60%; } 30%, 100% { left: 130%; } }

/* кнопки й картки, на які можна натиснути */
.btn, .menu-item, .task-item, .tariff, .pick, .chip, .opt, .tile, .icon-btn, .pod, .lb-row {
  transition: transform 0.18s var(--spring), background-color 0.2s, border-color 0.2s, opacity 0.2s, box-shadow 0.25s;
}
.btn:active, .menu-item:active, .task-item:active, .tariff:active, .pick:active, .chip:active,
.opt:not(:disabled):active, .icon-btn:active, .pod:active { transform: scale(0.97); }
.btn:not(.secondary):not(.ghost):not(.danger) { box-shadow: 0 6px 22px -10px rgba(189, 178, 253, 0.55); }
.btn:not(.secondary):not(.ghost):not(.danger):active { box-shadow: 0 2px 10px -6px rgba(189, 178, 253, 0.6); }
.btn:disabled { box-shadow: none !important; }
.chip.on, .pick.on .check { animation: pop 0.3s var(--spring); }
@keyframes pop { 0% { transform: scale(0.85); } 100% { transform: scale(1); } }

/* варіанти відповіді */
.opt.sel { animation: pop 0.28s var(--spring); }
.opt.right { animation: okGlow 1s var(--ease-out); }
@keyframes okGlow {
  0% { box-shadow: 0 0 0 0 rgba(111, 220, 155, 0.55); transform: scale(1); }
  30% { transform: scale(1.02); }
  100% { box-shadow: 0 0 0 14px rgba(111, 220, 155, 0); transform: scale(1); }
}
.opt.right .l, .opt.wrong .l { animation: pop 0.4s var(--spring); }
.result-card { animation: rise 0.45s var(--ease-out) both; animation-delay: 0.15s; }
.plus-points { display: inline-block; animation: floatIn 0.7s var(--spring) both; animation-delay: 0.3s; }
@keyframes floatIn { from { opacity: 0; transform: translateY(10px) scale(0.6); } }
.trap-box { animation: rise 0.45s var(--ease-out) both; animation-delay: 0.35s; }
.explain { animation: rise 0.45s var(--ease-out) both; animation-delay: 0.45s; }

/* іскри при правильній відповіді */
.spark {
  position: fixed; width: 6px; height: 6px; border-radius: 50%; pointer-events: none; z-index: 60;
  background: var(--c, var(--accent)); animation: spark 0.75s var(--ease-out) forwards;
}
@keyframes spark { to { transform: translate(var(--x), var(--y)) scale(0.2); opacity: 0; } }

/* навігація */
.nav button.on svg { animation: navPop 0.4s var(--spring); }
@keyframes navPop { 0% { transform: scale(0.8) translateY(2px); } 100% { transform: scale(1) translateY(0); } }

/* дрібні «живі» деталі */
.level-emoji { animation: float 3.6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-4px); } }
.pod.p1 .ava { animation: float 3.2s ease-in-out infinite; }
.step.next::before { animation: ring 1.8s ease-out infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(189, 178, 253, 0.5); } 100% { box-shadow: 0 0 0 9px rgba(189, 178, 253, 0); } }
.badge-pill.acc { transition: transform 0.2s var(--spring); }
.toast { transition: transform 0.45s var(--spring), opacity 0.3s, visibility 0.3s; }
.splash-logo { animation: pulse 1.4s ease-in-out infinite, rise 0.6s var(--ease-out) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- мобільні дрібниці ---------- */
.pod { display: block; width: 100%; min-width: 0; }
.menu-item .mt div { overflow: hidden; text-overflow: ellipsis; }
.menu-item .mt div:last-child { white-space: nowrap; }
.q-text, .opt .t, .explain, .trap-box, .link-box, .key-code { overflow-wrap: anywhere; }
.list-row .grow { min-width: 0; overflow-wrap: anywhere; }
.task-item .grow { min-width: 0; }
.task-item .ttl, .task-item .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row > .badge-pill, .task-item .badge-pill { flex: none; }
.lb-row .nm { min-width: 0; }
.chips .chip { max-width: 100%; }
@media (hover: hover) {
  .menu-item:hover, .task-item:hover, .tariff:hover { background: var(--panel-2); }
}
@media (max-width: 380px) {
  #app { padding-left: 12px; padding-right: 12px; }
  h1 { font-size: 23px; }
  .onb-hero h1 { font-size: 26px; }
  .card { padding: 14px; }
  .stats { gap: 6px; }
  .stat { padding: 10px; }
  .stat .v { font-size: 19px; }
  .stat .l { font-size: 10.5px; }
  .q-text { font-size: 16.5px; }
  .opt { padding: 12px; }
  .tariff { padding: 14px; }
  .tariff .price { font-size: 17px; }
  .pod .ava { width: 38px; height: 38px; }
  .btn-row { flex-wrap: wrap; }
  .btn-row .btn.sm { flex: 1 1 30%; }
  .nav button b { font-size: 9.5px; }
  .badges { grid-template-columns: repeat(3, 1fr); }
}
