/* Тренажёр ГАК — soft mint, white cards, lime accent (after the user's reference). */
:root {
  --bg: #EDF0EF;
  --glow: #DDF0CF;
  --surface: #FFFFFF;
  --surface-2: #F4F6F5;
  --line: #E3E7E5;
  --ink: #111513;
  --ink-2: #67706B;
  --ink-3: #A1A9A5;
  --lime: #B6F06A;
  --lime-grad: linear-gradient(135deg, #D2F7A0 0%, #A7E85C 100%);
  --lime-deep: #4F8A1F;
  --lime-ink: #1C320A;
  --lime-soft: #ECF8DD;
  --dark: #161817;
  --on-dark: #FFFFFF;
  --ok: #1E9E5C;  --ok-bg: #E3F5E9;
  --bad: #E1484C; --bad-bg: #FDECEC;
  --violet: #8565E3; --violet-bg: #EEE8FD;
  --mint: #2A9C6E;   --mint-bg: #E1F4EA;
  --teal: #2A8A97;   --teal-bg: #E0EFF1;
  --peach: #E2733D;  --peach-bg: #FCEDE4;
  --sky: #4876E0;    --sky-bg: #E6EDFC;
  --shadow: 0 1px 2px rgba(17, 21, 19, .04), 0 12px 32px -16px rgba(17, 21, 19, .16);
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0E100F;
  --glow: #1A2A12;
  --surface: #191C1A;
  --surface-2: #222624;
  --line: #2B302D;
  --ink: #F1F4F2;
  --ink-2: #A4ACA8;
  --ink-3: #6C746F;
  --lime-soft: #223016;
  --dark: #B6F06A;
  --on-dark: #1C320A;
  --ok: #4CD38A;  --ok-bg: rgba(76, 211, 138, .13);
  --bad: #FF6B6E; --bad-bg: rgba(255, 107, 110, .13);
  --violet: #A991FF; --violet-bg: rgba(169, 145, 255, .14);
  --mint: #4CCB97;   --mint-bg: rgba(76, 203, 151, .13);
  --teal: #55C0CD;   --teal-bg: rgba(85, 192, 205, .13);
  --peach: #FF9A66;  --peach-bg: rgba(255, 154, 102, .13);
  --sky: #7DA2FF;    --sky-bg: rgba(125, 162, 255, .14);
  --shadow: 0 1px 0 rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: radial-gradient(120% 50% at 50% -8%, var(--glow) 0%, transparent 62%) no-repeat, var(--bg);
  min-height: 100vh;
  color: var(--ink);
  font: 400 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--lime-deep); outline-offset: 2px; }

#app { max-width: 560px; margin: 0 auto; padding: 14px 16px calc(120px + env(safe-area-inset-bottom)); }

/* ---------- icon circles ---------- */
.ic { display: inline-grid; place-items: center; flex: none; border-radius: 50%; width: 44px; height: 44px; background: var(--surface); color: var(--ink); }
.ic svg { width: 20px; height: 20px; }
.ic.sm { width: 36px; height: 36px; } .ic.sm svg { width: 18px; height: 18px; }
.ic.violet { background: var(--violet-bg); color: var(--violet); }
.ic.mint { background: var(--mint-bg); color: var(--mint); }
.ic.teal { background: var(--teal-bg); color: var(--teal); }
.ic.peach { background: var(--peach-bg); color: var(--peach); }
.ic.sky { background: var(--sky-bg); color: var(--sky); }
.ic.lime { background: var(--lime-soft); color: var(--lime-deep); }
.ic.deep { background: var(--lime-deep); color: #fff; }

.round {
  width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center; flex: none;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
.round svg { width: 20px; height: 20px; }
.round.lime { background: var(--lime); color: var(--lime-ink); }
.round:active, .pill:active, .tile:active, .item:active, .opt:active { transform: scale(.98); }

/* ---------- top bars ---------- */
.top { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.top .grow { flex: 1; min-width: 0; }
.hello {
  display: inline-flex; align-items: center; gap: 10px; padding: 5px 14px 5px 5px;
  border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); max-width: 100%;
  font-weight: 500; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--lime-grad); color: var(--lime-ink); font-weight: 700; font-size: 15px; }
.title-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow); font-weight: 500; font-size: 15px;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.title-pill svg { width: 18px; height: 18px; flex: none; }
.top.sub { justify-content: space-between; }
.top.sub .center { flex: 1; display: flex; justify-content: center; min-width: 0; }
.counter { font-weight: 600; font-size: 14px; padding: 0 6px; min-width: 46px; text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- headings ---------- */
.h1 { font-size: 34px; line-height: 1.08; font-weight: 500; letter-spacing: -.025em; margin: 6px 0 18px; }
.h1 .mute { color: var(--ink-3); }
.h2 { font-size: 26px; line-height: 1.12; font-weight: 600; letter-spacing: -.02em; margin: 4px 0 6px; }
.sec { display: flex; align-items: baseline; justify-content: space-between; margin: 24px 2px 10px; }
.sec b { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.sec button { background: none; border: 0; padding: 0; color: var(--ink-2); font-size: 14px; }
.muted { color: var(--ink-2); }
.small { font-size: 13.5px; }
p { margin: 0; }

/* ---------- home blocks ---------- */
.quick { display: flex; gap: 8px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px; border-radius: 999px;
  background: var(--surface); border: 1.5px solid var(--lime); color: var(--ink); font-weight: 500; font-size: 15px;
  box-shadow: var(--shadow); white-space: nowrap;
}
.pill.grow { flex: 1; justify-content: flex-start; color: var(--ink-2); min-width: 0; }
.pill svg { width: 18px; height: 18px; flex: none; }

.promo {
  margin-top: 16px; padding: 18px; border-radius: 26px; background: var(--lime-grad); color: var(--lime-ink);
  box-shadow: 0 16px 30px -18px rgba(79, 138, 31, .7);
}
.promo .row1 { display: flex; gap: 14px; align-items: flex-start; }
.promo b { display: block; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.promo p { font-size: 14px; opacity: .8; margin-top: 2px; }
.promo .go {
  margin-top: 14px; width: 100%; height: 46px; border: 0; border-radius: 999px; background: #fff; color: #111513;
  font-weight: 600; font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.promo .go svg { width: 18px; height: 18px; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 6px 14px;
  border-radius: 22px; border: 0; background: var(--surface); box-shadow: var(--shadow); text-align: center;
}
.tile b { font-weight: 500; font-size: 14.5px; line-height: 1.2; }
.tile span { font-size: 12px; color: var(--ink-3); margin-top: -6px; }

.items { display: grid; gap: 8px; }
.item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 12px 12px 12px; text-align: left;
  border-radius: 22px; border: 0; background: var(--surface); box-shadow: var(--shadow);
}
.item .tx { flex: 1; min-width: 0; }
.item .tx b { display: block; font-weight: 500; font-size: 15.5px; }
.item .tx span { display: block; font-size: 13px; color: var(--ink-2); margin-top: 1px; }
.item .go { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; flex: none; color: var(--ink); }
.item .go svg { width: 16px; height: 16px; }
.item .badge { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--peach-bg); color: var(--peach); white-space: nowrap; }
.item .badge.lime { background: var(--lime-soft); color: var(--lime-deep); }
.item .badge.mute { background: var(--surface-2); color: var(--ink-2); }
.bar { height: 5px; border-radius: 99px; background: var(--surface-2); margin-top: 8px; overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; background: var(--lime-deep); border-radius: 99px; }
.bar i.x { background: var(--bad); opacity: .45; border-radius: 0; }

/* ---------- progress / profile ---------- */
.card { background: var(--surface); border-radius: 24px; box-shadow: var(--shadow); padding: 16px; }
.profile { display: grid; grid-template-columns: 1.15fr 1fr; gap: 10px; }
.profile .me { display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; padding: 16px; }
.profile .me .avatar { width: 64px; height: 64px; font-size: 26px; margin-bottom: 6px; }
.profile .me b { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.lvl { display: inline-flex; align-self: flex-start; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; padding: 3px 10px;
  border-radius: 999px; background: var(--mint-bg); color: var(--mint); }
.mini { display: grid; gap: 10px; }
.mini .card { padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.num { font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.num small { font-size: 13px; font-weight: 500; color: var(--ink-2); margin-left: 2px; }
.trio { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 10px; padding: 14px 6px; }
.trio > div { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.trio > div + div { border-left: 1px solid var(--line); }
.trio span { font-size: 12.5px; color: var(--ink-2); }
.dots { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); }
.dots i.x { background: var(--bad); }
.dots i.e { background: var(--surface-2); }

/* ---------- question ---------- */
.progress { height: 6px; border-radius: 99px; background: var(--surface); margin: -6px 0 14px; overflow: hidden; box-shadow: var(--shadow); }
.progress i { display: block; height: 100%; background: var(--lime-grad); border-radius: 99px; transition: width .3s; }
.qcard { background: var(--surface); border-radius: 24px; box-shadow: var(--shadow); padding: 18px; margin-bottom: 12px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag { font-size: 12.5px; font-weight: 500; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.tag.real { background: var(--lime-soft); color: var(--lime-deep); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.bad { background: var(--peach-bg); color: var(--peach); }
.filters { display: flex; gap: 6px; overflow-x: auto; margin: 16px -16px 12px; padding: 2px 16px 6px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters .chip { flex: none; height: 38px; padding: 0 12px 0 14px; font-size: 14px; }
.filters .chip .cnt { font-size: 12.5px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.filters .chip.on .cnt { background: rgba(255, 255, 255, .55); color: var(--lime-ink); }
.qrow { align-items: flex-start; }
.qrow .stat { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex: none; margin: 6px 2px 0 4px; }
.qrow .stat.x { background: var(--peach); }
.qrow .stat.e { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.item.qrow .tx .qline { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 14.5px; color: var(--ink); }
.qtext { font-size: 17px; line-height: 1.5; white-space: pre-wrap; }
.qimg { display: block; width: 100%; border-radius: 16px; margin-top: 12px; background: var(--surface-2); }

.opts { display: grid; gap: 8px; }
.opt {
  display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; width: 100%; padding: 13px 14px;
  text-align: left; background: var(--surface); border: 1.5px solid transparent; border-radius: 18px; box-shadow: var(--shadow);
  transition: border-color .15s, background .15s;
}
.opt .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); }
.opt .t { padding-top: 4px; }
.opt .w { grid-column: 2; font-size: 13.5px; color: var(--ink-2); line-height: 1.4; }
.opt.picked { border-color: var(--ink); }
.opt.picked .n { background: var(--ink); color: var(--surface); }
.opt.right { border-color: var(--ok); background: var(--ok-bg); }
.opt.right .n { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt.wrong .n { background: var(--bad); color: #fff; }
.opt.dim { opacity: .8; }
.opts.locked .opt { cursor: default; }

.verdict { display: inline-flex; align-items: center; gap: 8px; margin: 16px 0 10px; padding: 8px 14px 8px 8px; border-radius: 999px; font-weight: 600; }
.verdict .ic { width: 28px; height: 28px; } .verdict .ic svg { width: 16px; height: 16px; }
.verdict.ok { background: var(--ok-bg); color: var(--ok); } .verdict.ok .ic { background: var(--ok); color: #fff; }
.verdict.no { background: var(--bad-bg); color: var(--bad); } .verdict.no .ic { background: var(--bad); color: #fff; }
.panel { background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); padding: 16px; margin-top: 10px; }
.panel .ph { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 8px; }
.panel p + p { margin-top: 8px; }
.panel.warn { background: var(--peach-bg); box-shadow: none; }
.panel.warn .ph { color: var(--peach); }
.answer-big { font-size: 17px; font-weight: 600; }
.tip { margin-top: 12px; padding: 12px 14px; border-radius: 16px; background: var(--lime-soft); color: var(--lime-ink); font-size: 14.5px; }
:root[data-theme="dark"] .tip { color: var(--ink); }
.tip b { font-weight: 600; }
.actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: 999px; border: 0;
  background: var(--surface); box-shadow: var(--shadow); font-size: 14.5px; font-weight: 500; }
.chip svg { width: 17px; height: 17px; }
.chip.on { background: var(--lime); color: var(--lime-ink); }
.src { font-size: 13px; color: var(--ink-3); margin: 12px 4px 0; }

/* ---------- buttons ---------- */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 52px; padding: 0 20px;
  border: 0; border-radius: 999px; background: var(--dark); color: var(--on-dark); font-weight: 600; font-size: 16px; }
.btn.lime { background: var(--lime); color: var(--lime-ink); }
.btn.ghost { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn.small { height: 42px; font-size: 14.5px; padding: 0 14px; }
.btn[disabled] { opacity: .4; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-row { display: flex; gap: 8px; }
.btn-row > * { flex: 1 1 0; min-width: 0; }

/* ---------- exam ---------- */
.timer { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 999px; background: var(--dark); color: var(--on-dark);
  font-weight: 600; font-variant-numeric: tabular-nums; font-size: 15px; }
.timer.low { background: var(--bad); color: #fff; }
.timer svg { width: 16px; height: 16px; }
.grid-nav { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; margin: 0 0 14px; }
.grid-nav button { aspect-ratio: 1; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--shadow);
  font-size: 11.5px; font-weight: 600; color: var(--ink-2); padding: 0; }
.grid-nav button.done { background: var(--dark); color: var(--on-dark); }
.grid-nav button.cur { outline: 2px solid var(--lime-deep); outline-offset: 1px; }
.grid-nav button.ok { background: var(--ok); color: #fff; }
.grid-nav button.bad { background: var(--bad); color: #fff; }
.score { font-size: 64px; font-weight: 600; letter-spacing: -.04em; line-height: 1; }
.score small { font-size: 24px; color: var(--ink-2); }

/* ---------- flashcards ---------- */
.flash { min-height: 44vh; border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); padding: 22px 20px; display: flex; flex-direction: column; gap: 16px; }
.flash .face { white-space: pre-wrap; font-size: 19px; line-height: 1.45; font-weight: 500; }
.flash .back { border-top: 1.5px dashed var(--line); padding-top: 16px; white-space: pre-wrap; color: var(--ink); }
.flash .hint { margin-top: auto; text-align: center; font-size: 13px; color: var(--ink-3); }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.grades button { padding: 10px 2px; border-radius: 18px; border: 0; font-weight: 600; font-size: 14px; line-height: 1.2; }
.grades button small { display: block; font-size: 11.5px; font-weight: 500; opacity: .75; margin-top: 3px; }
.grades .g1 { background: var(--bad-bg); color: var(--bad); }
.grades .g2 { background: var(--peach-bg); color: var(--peach); }
.grades .g3 { background: var(--sky-bg); color: var(--sky); }
.grades .g4 { background: var(--lime); color: var(--lime-ink); }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 14px; font-weight: 500; color: var(--ink-2); margin: 0 4px 6px; }
.field textarea, .field input, .inp {
  width: 100%; padding: 14px 16px; border-radius: 20px; border: 1.5px solid transparent; background: var(--surface); box-shadow: var(--shadow);
  font-size: 16px; resize: vertical;
}
.field textarea { min-height: 120px; }
.field textarea:focus, .field input:focus, .inp:focus { outline: none; border-color: var(--lime-deep); }
.inline-form { display: flex; gap: 8px; margin-top: 12px; }
.inline-form .inp { border-radius: 999px; height: 50px; padding: 0 18px; }

.searchbox { position: sticky; top: 0; z-index: 3; padding: 4px 0 12px; }
.searchbox .inp { height: 52px; border-radius: 999px; padding: 0 18px 0 48px; border-color: var(--lime); }
.searchbox svg { position: absolute; left: 17px; top: 20px; width: 20px; height: 20px; color: var(--ink-3); pointer-events: none; }
.hit .q { font-size: 14px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.hit .a { font-weight: 600; margin-top: 6px; font-size: 15px; }
.hit .eyebrow { font-size: 12px; color: var(--ink-3); font-weight: 500; }
mark { background: var(--lime-soft); color: inherit; border-radius: 4px; padding: 0 2px; }

.empty { text-align: center; padding: 40px 16px; color: var(--ink-2); }
.empty .ic { width: 64px; height: 64px; margin-bottom: 14px; } .empty .ic svg { width: 28px; height: 28px; }
.empty .h2 { color: var(--ink); }
.empty .btn { margin-top: 18px; }
.skeleton { height: 64px; border-radius: 22px; background: var(--surface); margin: 10px 0; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* ---------- floating tab bar ---------- */
.tabbar {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30;
  display: flex; gap: 4px; padding: 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px -10px rgba(17, 21, 19, .28), 0 0 0 1px var(--line);
}
.tabbar button { display: flex; align-items: center; gap: 8px; height: 48px; border: 0; border-radius: 999px; padding: 0; background: none; color: var(--ink); }
.tabbar button .ic { width: 48px; height: 48px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.tabbar button.on { background: var(--dark); color: var(--on-dark); padding-right: 18px; font-weight: 600; font-size: 15px; }
.tabbar button.on .ic { background: var(--surface); color: var(--ink); box-shadow: none; width: 40px; height: 40px; margin-left: 4px; }

.toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  background: var(--dark); color: var(--on-dark); padding: 11px 18px; border-radius: 999px; font-size: 14.5px; font-weight: 500;
  max-width: calc(100% - 32px); box-shadow: var(--shadow); }
.fallback-main { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); z-index: 20;
  background: linear-gradient(transparent, var(--bg) 35%); }
.fallback-main button { display: block; max-width: 528px; margin: 0 auto; width: 100%; height: 54px; border: 0; border-radius: 999px;
  background: var(--lime); color: var(--lime-ink); font-weight: 600; font-size: 16px; }
.viewer { position: fixed; inset: 0; background: rgba(8, 10, 9, .94); z-index: 60; overflow: auto; display: grid; place-items: center; }
.viewer img { max-width: 100%; transition: max-width .2s; }
.viewer.zoom img { max-width: 220%; }
.viewer-close { position: fixed; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.16); color: #fff; font-size: 24px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
