:root {
  --bg: #14171f;
  --bg-2: #181c25;
  --card: #1f242f;
  --card-2: #262c38;
  --line: #333a48;
  --line-soft: #2a303c;
  --ink: #ede8dc;
  --text: #d3cdbf;
  --muted: #b8b3a6;
  --accent: #7cc4c9;
  --accent-2: #4f9ea3;
  --warn: #e39a6a;
  --ok: #7ec99a;
  --paper: #ede8dc;
  --serif: Literata, Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; position: relative; overflow-x: hidden; }
a { color: var(--accent); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* Фон: плитка из тематических иконок (монета, график, портфель, проценты, купюра, диаграмма),
   медленно плывёт; поверх — два мягких пятна света. */
body::before {
  content: ""; position: fixed; inset: -260px; z-index: 0; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='260' height='260' viewBox='0 0 260 260' fill='none' stroke='%23ede8dc' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' opacity='0.24'><g transform='translate(22 24) rotate(-8)'><circle cx='14' cy='14' r='13'/><circle cx='14' cy='14' r='8'/><path d='M14 8v12M10 11h6M10 14h7'/></g><g transform='translate(120 18) rotate(6)'><path d='M2 30V6M2 30h30'/><rect x='8' y='16' width='5' height='14' rx='1'/><rect x='16' y='10' width='5' height='20' rx='1'/><rect x='24' y='4' width='5' height='26' rx='1'/></g><g transform='translate(196 60) rotate(-5)'><rect x='2' y='9' width='30' height='22' rx='4'/><path d='M12 9V5a3 3 0 0 1 3-3h4a3 3 0 0 1 3 3v4M2 18h30'/></g><g transform='translate(56 118) rotate(10)'><circle cx='8' cy='8' r='5'/><circle cx='24' cy='24' r='5'/><path d='M28 4 4 28'/></g><g transform='translate(150 130) rotate(-4)'><rect x='2' y='6' width='34' height='20' rx='3'/><circle cx='19' cy='16' r='5'/><path d='M7 11v10M31 11v10'/></g><g transform='translate(20 196) rotate(4)'><path d='M2 30 12 18l8 6L32 6'/><path d='M24 6h8v8'/></g><g transform='translate(112 208) rotate(-7)'><circle cx='16' cy='16' r='14'/><path d='M16 2v14h14M16 16 6 26'/></g><g transform='translate(210 200) rotate(8)'><rect x='4' y='2' width='24' height='32' rx='3'/><rect x='8' y='6' width='16' height='7' rx='1'/><circle cx='11' cy='19' r='1.6'/><circle cx='16' cy='19' r='1.6'/><circle cx='21' cy='19' r='1.6'/><circle cx='11' cy='25' r='1.6'/><circle cx='16' cy='25' r='1.6'/><circle cx='21' cy='25' r='1.6'/></g></svg>");
  background-size: 260px 260px;
  animation: drift 120s linear infinite;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(70vmax 70vmax at 10% 0%, rgba(124, 196, 201, 0.16), transparent 60%),
    radial-gradient(60vmax 60vmax at 100% 100%, rgba(227, 154, 106, 0.12), transparent 60%);
  animation: breathe 26s ease-in-out infinite alternate;
}
@keyframes drift { from { background-position: 0 0; } to { background-position: 260px 260px; } }
@keyframes breathe { from { transform: translate3d(0, 0, 0) scale(1); opacity: .85; } to { transform: translate3d(-3%, 2%, 0) scale(1.06); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { body::before, body::after { animation: none; } }

/* Колонка приложения чуть темнее фона: узор виден, но текст не спорит с ним. */
.app { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom)); min-height: 100vh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(20, 23, 31, .78), rgba(20, 23, 31, .70)); box-shadow: 0 0 60px rgba(20, 23, 31, .8); }
.eyebrow, .sub, .muted, .footnote, .ghost, .stat, .lbl { text-shadow: 0 1px 2px rgba(0,0,0,.55); }
.title, .question, .cloze-text { text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.screen { display: flex; flex-direction: column; gap: 22px; flex: 1; }

.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #9fd0d4; }
.muted { color: var(--muted); font-size: 14px; }
.title { font-family: var(--serif); font-weight: 500; font-size: 30px; line-height: 1.1; }
.title.small { font-size: 24px; line-height: 1.2; }
.sub { font-size: 14px; color: var(--text); line-height: 1.45; }
.tab { font-variant-numeric: tabular-nums; }

.primary { display: flex; flex-direction: column; gap: 8px; background: var(--paper); color: var(--bg); padding: 20px 22px; border-radius: 8px; text-align: left; width: 100%; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.primary:active { transform: translateY(1px); }
.primary .row { display: flex; justify-content: space-between; align-items: baseline; }
.primary .big { font-family: var(--serif); font-size: 22px; font-weight: 500; }
.primary .hint { font-size: 13px; color: #4a4f5a; }

/* выбор объёма */
.primary-wrap { display: flex; flex-direction: column; gap: 10px; }
.seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.seg-btn { min-height: 40px; border-radius: 6px; border: 1px solid var(--line); background: rgba(255,255,255,.03); font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.seg-btn.on { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 600; }

/* наведение: подсветка и лёгкий подскок у всех кнопок-плиток */
.tile, .qbtn, .type-row, .type-toggle, .seg-btn, .row-item, .primary, .cta, .opt, .chip, .def, .bucket, .check {
  transition: transform .15s ease, border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
@media (hover: hover) {
  .tile:hover:not(:disabled), .qbtn:hover:not(:disabled), .type-row:hover:not(:disabled), .type-toggle:hover, .primary:hover, .cta:hover:not(:disabled), .seg-btn:hover {
    transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 8px 22px rgba(0, 0, 0, .35), 0 0 0 1px rgba(124, 196, 201, .25);
  }
  .opt:hover:not(:disabled), .chip:hover:not(:disabled), .def:hover:not(:disabled), .bucket:hover, .check:hover, button.row-item:hover { border-color: var(--accent); background: var(--card-2); }
}
.tile:active:not(:disabled), .qbtn:active, .type-row:active, .cta:active { transform: translateY(1px); }

/* быстрый заход */
.quick-row { display: flex; }
.qbtn { display: flex; flex: 1; flex-direction: row; align-items: baseline; gap: 10px; text-align: left; padding: 14px 16px; min-height: 52px; border-radius: 8px; background: rgba(124, 196, 201, 0.12); border: 1px solid rgba(124, 196, 201, 0.35); }
.qbtn b { font-size: 14px; font-weight: 600; color: var(--ink); }
.qbtn span { font-size: 13px; color: var(--text); }

/* четыре плитки два на два */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; align-items: flex-start; text-align: left; aspect-ratio: 1.15 / 1; padding: 16px; border-radius: 12px; background: linear-gradient(160deg, var(--card-2), var(--card)); border: 1px solid var(--line); }
.tile .qicon { color: var(--accent); margin-bottom: auto; }
.tile b { font-family: var(--serif); font-size: 19px; font-weight: 500; color: var(--ink); }
.tile span { font-size: 13px; color: var(--text); line-height: 1.3; }
.tile.dim { opacity: .45; cursor: default; }

/* выпадающий список типов */
.type-wrap { display: flex; flex-direction: column; gap: 10px; }
.type-toggle { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font-size: 15px; font-weight: 500; color: var(--ink); width: 100%; min-height: 50px; }
.type-toggle svg { transition: transform .2s ease; color: var(--accent); }
.type-toggle.open svg { transform: rotate(180deg); }
.type-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.type-list[hidden] { display: none; }
.type-row { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; text-align: left; padding: 12px 14px; min-height: 60px; border-radius: 8px; background: var(--card); border: 1px solid var(--line-soft); }
.type-row b { font-size: 14px; font-weight: 600; color: var(--ink); }
.type-row span { font-size: 12px; color: var(--text); }
.type-row.dim { opacity: .45; cursor: default; }

/* успехи: только полосы */
.panel { display: flex; flex-direction: column; gap: 14px; padding: 18px 18px; border-radius: 8px; background: var(--card); border: 1px solid var(--line-soft); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; }
.panel-head .title { font-size: 18px; }
.meter { display: flex; flex-direction: column; gap: 6px; }
.meter .lbl { display: flex; justify-content: space-between; font-size: 13px; color: var(--text); }
.meter .lbl b { color: var(--ink); font-weight: 500; }
.meter .lbl .pct { color: var(--muted); font-size: 12px; }
.bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.07); overflow: hidden; position: relative; }
.bar i { display: block; height: 100%; border-radius: 4px; background: var(--accent); width: 0; transition: width .9s cubic-bezier(.2,.7,.2,1); }
.bar i.ok { background: var(--ok); }
.bar i.mid { background: var(--accent); }
.bar i.low { background: var(--warn); }
.bar i.cover { background: var(--paper); opacity: .85; }
.bar.thin { height: 4px; }
.meter.sec .bar + .bar { margin-top: 3px; }
.legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; background: var(--accent); }
.legend span.c2::before { background: var(--paper); }

.sessions { display: flex; flex-direction: column; gap: 10px; }
.sess { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 10px; align-items: center; font-size: 12px; color: var(--muted); }
.sess .bar { height: 10px; }
.sess .bar i { border-radius: 4px; }

.list { display: flex; flex-direction: column; }
.list-head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.list-head .title { font-size: 18px; }
.row-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.row-item:last-child { border-bottom: 0; }
.row-item .name { font-size: 15px; }
.row-item .stat { font-size: 13px; color: var(--muted); white-space: nowrap; }
.row-item .stat.zero { color: var(--warn); }
button.row-item { width: 100%; text-align: left; }

.footnote { font-size: 12px; color: var(--muted); text-align: center; margin-top: auto; }

/* задание */
.progress { display: flex; gap: 4px; }
.progress i { flex: 1; height: 3px; border-radius: 2px; background: var(--line); }
.progress i.done { background: var(--paper); }
.task-head { display: flex; flex-direction: column; gap: 10px; }
.task-head .row { display: flex; justify-content: space-between; align-items: center; }
.icon-btn { width: 40px; height: 40px; margin: -10px; display: flex; align-items: center; justify-content: center; color: var(--muted); }

.question { font-family: var(--serif); font-size: 21px; line-height: 1.3; font-weight: 500; }
.options { display: flex; flex-direction: column; gap: 10px; }
.opt { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 14px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font-size: 15px; line-height: 1.4; width: 100%; }
.opt .k { font-size: 12px; color: var(--muted); min-width: 16px; padding-top: 2px; font-weight: 600; }
.opt.picked { border-color: var(--paper); background: var(--card-2); }
.opt.right { border-color: var(--ok); background: rgba(126, 201, 154, 0.14); }
.opt.wrong { border-color: var(--warn); background: rgba(227, 154, 106, 0.14); }
.opt:disabled { cursor: default; }

.explain { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; border-radius: 8px; background: var(--card-2); font-size: 14px; line-height: 1.5; color: var(--text); }
.explain .verdict { font-family: var(--serif); font-size: 17px; color: var(--ink); }
.explain .verdict.ok { color: var(--ok); }
.explain .verdict.bad { color: var(--warn); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 10px 14px; border-radius: 999px; border: 1px solid var(--paper); font-size: 14px; color: var(--ink); }
.chip.active { background: var(--paper); color: var(--bg); font-weight: 500; }
.chip.used { border-color: var(--line); background: var(--card); color: var(--muted); text-decoration: line-through; }
.defs { display: flex; flex-direction: column; gap: 10px; }
.def { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 14px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); width: 100%; }
.def .slot { font-size: 12px; color: var(--muted); flex: 0 0 96px; padding-top: 2px; overflow-wrap: anywhere; line-height: 1.3; }
.def .text { flex: 1; min-width: 0; font-size: 14px; line-height: 1.4; }
.def .slot.filled { color: var(--accent); font-weight: 600; }
.def.target { border-style: dashed; border-color: var(--paper); }
.def.filled { background: var(--card-2); border-color: var(--card-2); }
.def.right { border-color: var(--ok); background: rgba(126, 201, 154, 0.14); }
.def.wrong { border-color: var(--warn); background: rgba(227, 154, 106, 0.14); }

.actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: auto; padding-top: 8px; }
.ghost { font-size: 15px; color: var(--text); padding: 12px 4px; min-height: 44px; text-decoration: underline dotted; text-underline-offset: 4px; }
.cta { padding: 14px 22px; border-radius: 8px; background: var(--paper); color: var(--bg); font-size: 15px; font-weight: 600; min-height: 48px; }
.cta:disabled { background: var(--line); color: var(--muted); cursor: default; }

/* cloze */
.cloze-text { font-family: var(--serif); font-size: 21px; line-height: 1.45; font-weight: 500; }
.cloze-text .gap { display: inline-block; min-width: 96px; border-bottom: 2px solid var(--accent); padding: 0 6px; color: var(--accent); text-align: center; }
.cloze-text .gap.ok { color: var(--ok); border-color: var(--ok); }
.cloze-text .gap.bad { color: var(--warn); border-color: var(--warn); text-decoration: line-through; }

/* расчёт */
.intro { font-size: 15px; line-height: 1.55; color: var(--text); white-space: pre-line; padding: 14px 16px; border-radius: 8px; background: var(--card); border: 1px solid var(--line-soft); }
.steps { display: flex; flex-direction: column; gap: 12px; }
.step { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); }
.step.locked { opacity: .45; }
.step .q { font-size: 15px; line-height: 1.4; }
.step .inrow { display: flex; gap: 8px; align-items: center; }
.step input { flex: 1; min-width: 0; font: inherit; font-size: 17px; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-2); color: var(--ink); outline: none; font-variant-numeric: tabular-nums; }
.step input:focus { border-color: var(--accent); }
.step input:disabled { opacity: .8; }
.step .unit { color: var(--muted); font-size: 14px; min-width: 20px; }
.step .go { padding: 12px 16px; border-radius: 8px; background: var(--paper); color: var(--bg); font-weight: 600; min-height: 44px; }
.step .res { font-size: 14px; line-height: 1.5; color: var(--text); white-space: pre-line; }
.step .res b { color: var(--ink); }
.step.right { border-color: var(--ok); }
.step.wrong { border-color: var(--warn); }
.checklist { display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line-soft); background: var(--card); width: 100%; font-size: 14px; line-height: 1.4; }
.check .box { width: 20px; height: 20px; border-radius: 5px; border: 1.5px solid var(--muted); flex: 0 0 auto; margin-top: 1px; }
.check.on .box { background: var(--ok); border-color: var(--ok); }
.check.on { border-color: rgba(126, 201, 154, .5); }
.rubric { font-size: 13px; color: var(--muted); line-height: 1.5; }

/* корзины */
.buckets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.buckets.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bucket { display: flex; flex-direction: column; gap: 8px; min-height: 120px; padding: 12px; border-radius: 8px; border: 1px dashed var(--line); background: rgba(255,255,255,.03); text-align: left; }
.bucket .bname { font-size: 13px; font-weight: 600; color: var(--accent); }
.bucket.target { border-color: var(--paper); border-style: solid; }
.bucket .placed { font-size: 13px; padding: 8px 10px; border-radius: 6px; background: var(--card-2); }
.bucket .placed.ok { outline: 1px solid var(--ok); }
.bucket .placed.bad { outline: 1px solid var(--warn); text-decoration: line-through; }
.pool { display: flex; flex-wrap: wrap; gap: 8px; }
.pool .chip { border-color: var(--line); }

/* множественный выбор */
.opt.multi .k { width: 18px; height: 18px; border-radius: 4px; border: 1.5px solid var(--muted); padding: 0; min-width: 18px; }
.opt.multi.picked .k { background: var(--paper); border-color: var(--paper); }
.opt.multi.right .k { background: var(--ok); border-color: var(--ok); }
.opt.multi.missed { border-color: var(--ok); border-style: dashed; }
.score-line { font-size: 14px; color: var(--text); }

/* спринт */
.timer { font-family: var(--serif); font-size: 18px; font-variant-numeric: tabular-nums; color: var(--accent); }
.timer.low { color: var(--warn); }
.sprint-list { display: flex; flex-direction: column; gap: 8px; }
.sprint-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 6px; background: var(--card); font-size: 13px; line-height: 1.4; }
.sprint-row .n { color: var(--muted); min-width: 22px; font-variant-numeric: tabular-nums; }
.sprint-row.bad { border-left: 3px solid var(--warn); }
.sprint-row.good { border-left: 3px solid var(--ok); }
.sprint-row .ex { color: var(--text); font-size: 12px; margin-top: 4px; }

/* конспекты */
.card-view { display: flex; flex-direction: column; gap: 14px; padding: 20px; border-radius: 10px; background: var(--card); border: 1px solid var(--line-soft); min-height: 300px; }
.card-view .ct { font-family: var(--serif); font-size: 22px; line-height: 1.25; }
.card-view ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; line-height: 1.45; color: var(--text); }
.card-view .traps { padding: 12px 14px; border-radius: 8px; background: rgba(227, 154, 106, 0.12); border: 1px solid rgba(227, 154, 106, 0.35); }
.card-view .traps .tt { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--warn); margin-bottom: 6px; }
.card-view .traps ul { color: var(--ink); }
.card-nav { display: flex; justify-content: space-between; align-items: center; }
.card-nav .muted { font-variant-numeric: tabular-nums; }

/* календарь */
.cal { display: flex; flex-direction: column; gap: 12px; }
.cal-day { display: flex; flex-direction: column; gap: 6px; }
.cal-date { display: flex; align-items: baseline; gap: 10px; font-family: var(--serif); font-size: 17px; }
.cal-date .rel { font-family: var(--sans); font-size: 12px; color: var(--muted); }
.cal-date.today { color: var(--accent); }
.ev { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: var(--card); border: 1px solid var(--line-soft); font-size: 14px; line-height: 1.4; }
.ev .tag { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); min-width: 56px; padding-top: 2px; }
.ev.exam { border: 2px solid #e05a4f; background: rgba(224, 90, 79, 0.14); box-shadow: 0 0 0 3px rgba(224, 90, 79, 0.18); }
.ev.exam .tag { color: #ff7a6e; font-weight: 700; font-size: 13px; text-transform: none; letter-spacing: 0; }
.ev.exam .ex-title { font-weight: 600; color: #fff1ef; }
.exam-pill { display: inline-block; margin: 4px 0 6px; padding: 8px 12px; border-radius: 6px; border: 1.5px solid #e05a4f; background: rgba(224, 90, 79, 0.16); color: #ffd9d4; font-size: 13px; font-weight: 500; text-align: left; }
.ev.milestone { border-color: rgba(227, 154, 106, 0.45); }
.ev.milestone .tag { color: var(--warn); }
.ev.week .tag { color: var(--accent); }
.ev .t { color: var(--text); font-size: 13px; margin-top: 2px; }
.ev a { color: var(--accent); font-size: 13px; }

.red { color: var(--warn); }
.cod-row .lbl b { max-width: 70%; }

.summary { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; border-radius: 8px; background: var(--card); border: 1px solid var(--line-soft); }
.summary .line { display: flex; justify-content: space-between; font-size: 14px; color: var(--text); }
.summary .line b { color: var(--ink); font-weight: 500; }

@media (min-width: 720px) {
  .app { padding-top: 40px; }
  .title { font-size: 34px; }
  .question { font-size: 24px; }
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tile { aspect-ratio: 1 / 1; }
  .type-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
  .match-grid { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
  .match-grid .chips { flex-direction: column; }
  .match-grid .chip { border-radius: 8px; padding: 14px 16px; }
}
