/* Подготовка в МГИК — мини-приложение. Объёмные кнопки и «тропа» уроков в духе Duolingo, но в театральных декорациях:
   бумага афиши, бархатный фиолетовый, золотая маска. Цвета — в переменных, тёмная тема ниже. */
:root {
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Yeseva One', 'Nunito', serif;
  --bg: #FFF8EC; --surface: #FFFFFF; --ink: #2B2140; --ink-2: #6B6280; --ink-3: #A8A0B8;
  --line: #EBE1CF; --line-lip: #DACDB4;
  --brand: #7C4DFF; --brand-lip: #5B30D6; --brand-soft: #F0E9FF; --brand-line: #CFBEFF; --brand-ink: #5B30D6;
  --good: #35C653; --good-lip: #259B3F; --good-soft: #DFF8E3; --good-line: #A5E6B1; --good-ink: #1E8436;
  --bad: #FF4F60; --bad-lip: #D83346; --bad-soft: #FFE3E6; --bad-line: #FFB3BB; --bad-ink: #C92A3D;
  --gold: #FFC42E; --gold-lip: #E29F00; --gold-soft: #FFF4CF; --gold-ink: #A66F00;
  --flame: #FF8A1F; --flame-lip: #DB6B00; --flame-soft: #FFEAD3;
  --spot: rgba(255, 196, 46, .22);
  --mc: var(--brand); --mc-lip: var(--brand-lip);
}
:root[data-theme="dark"] {
  --bg: #16101F; --surface: #211831; --ink: #F5F0FF; --ink-2: #B5AACB; --ink-3: #7C7194;
  --line: #382C4E; --line-lip: #2A2040;
  --brand: #9B78FF; --brand-lip: #6B45E0; --brand-soft: #2B2148; --brand-line: #5A46A3; --brand-ink: #C3ADFF;
  --good: #3DD25C; --good-lip: #27A043; --good-soft: #173624; --good-line: #2C6B3D; --good-ink: #7BE693;
  --bad: #FF5C6C; --bad-lip: #D93A4C; --bad-soft: #401C26; --bad-line: #7A2E3B; --bad-ink: #FF98A3;
  --gold-soft: #3B3013; --gold-ink: #FFD86B; --flame-soft: #3D2710;
  --spot: rgba(155, 120, 255, .20);
}
[data-m="0"] { --mc: #7C4DFF; --mc-lip: #5B30D6; }
[data-m="A"] { --mc: #F04E7C; --mc-lip: #C6325D; }
[data-m="B"] { --mc: #2A9DF4; --mc-lip: #1B7ACC; }
[data-m="C"] { --mc: #FF8A1F; --mc-lip: #DB6B00; }
[data-m="D"] { --mc: #12B5A0; --mc-lip: #0B8D7C; }
[data-m="E"] { --mc: #F0AE00; --mc-lip: #BF8600; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--ink); font: 700 16px/1.4 var(--font);
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
svg { display: block; }
.hide { display: none !important; }
/* свет рампы сверху */
.spot { position: fixed; inset: 0; pointer-events: none; z-index: 0; background: radial-gradient(120% 46% at 50% -8%, var(--spot), transparent 70%); }
#app { position: relative; z-index: 1; max-width: 520px; margin: 0 auto; }
#view { padding-bottom: calc(92px + env(safe-area-inset-bottom)); min-height: 100vh; }

/* ───── кнопки ───── */
.btn {
  --c: var(--brand); --c-lip: var(--brand-lip); --c-ink: #fff;
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; padding: 0 18px;
  border-radius: 16px; background: var(--c); color: var(--c-ink); box-shadow: 0 4px 0 var(--c-lip);
  font-weight: 900; font-size: 15px; letter-spacing: .05em; text-transform: uppercase; text-align: center;
  transition: transform .06s, box-shadow .06s, background .15s; user-select: none; margin-bottom: 4px;
}
.btn:active:not([disabled]) { transform: translateY(4px); box-shadow: 0 0 0 var(--c-lip); }
.btn-good { --c: var(--good); --c-lip: var(--good-lip); }
.btn-bad { --c: var(--bad); --c-lip: var(--bad-lip); }
.btn-gold { --c: var(--gold); --c-lip: var(--gold-lip); --c-ink: #4A3400; }
.btn-ghost { --c: var(--surface); --c-lip: var(--line); --c-ink: var(--brand-ink); border: 2px solid var(--line); min-height: 50px; }
.btn-ghost.bad { --c-ink: var(--bad-ink); }
.btn-ghost.gold { --c-ink: var(--gold-ink); }
.btn-ghost.good { --c-ink: var(--good-ink); }
.btn[disabled] { --c: var(--line); --c-lip: var(--line); --c-ink: var(--ink-3); cursor: default; }
.btn.busy { opacity: .6; pointer-events: none; }
.btn svg { width: 22px; height: 22px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; padding: 0 8px; }

/* ───── полоса прогресса ───── */
.bar { flex: 1; height: 16px; border-radius: 10px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; min-width: 16px; border-radius: 10px; background: var(--c, var(--gold)); position: relative; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.bar > i::after { content: ''; position: absolute; left: 7px; right: 7px; top: 4px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .38); }
.bar.empty > i { display: none; }

/* ───── шапка главного экрана ───── */
.topbar { position: sticky; top: 0; z-index: 20; padding: 10px 16px; background: var(--bg); border-bottom: 2px solid var(--line); }
.stats { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat { display: flex; align-items: center; gap: 6px; font-weight: 900; font-size: 17px; }
.stat svg { width: 26px; height: 26px; }
.stat.logo svg { width: 34px; height: 34px; }
.stat.logo span { font-family: var(--display); font-weight: 400; font-size: 17px; letter-spacing: .01em; }
.stat.flame { color: var(--flame); }
.stat.flame.off { color: var(--ink-3); }
.stat.xp { color: var(--gold-ink); }
.stat.xp svg { color: var(--gold); }
.stat.lvl { color: var(--brand-ink); }
.stat.lvl svg { color: var(--brand); }
.goal { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.goal b { font-size: 12px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
.goal span { font-size: 13px; font-weight: 900; color: var(--gold-ink); white-space: nowrap; }
.goal.done span { color: var(--good-ink); }
.goal.done .bar > i { background: var(--good); }

/* ───── карточка «сегодня» ───── */
.hero { margin: 16px 16px 0; padding: 16px; border-radius: 22px; background: var(--surface); border: 2px solid var(--line); border-bottom-width: 5px; }
.hero-row { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.hero-row > svg { width: 70px; height: 70px; flex: none; }
.hero h1 { font-family: var(--display); font-weight: 400; font-size: 23px; line-height: 1.15; }
.hero p { margin-top: 4px; color: var(--ink-2); font-size: 14px; line-height: 1.35; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { padding: 3px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); font-size: 12px; font-weight: 900; white-space: nowrap; }
.chip.gold { background: var(--gold-soft); color: var(--gold-ink); }
.chip.good { background: var(--good-soft); color: var(--good-ink); }
.chip.flame { background: var(--flame-soft); color: var(--flame-lip); }
.chip.mute { background: var(--line); color: var(--ink-2); }

/* ───── тропа: модули-занавесы и недели-кнопки ───── */
.unit { margin-top: 22px; }
.unit-head {
  --sc: 24px; position: relative; margin: 0 16px 22px; padding: 15px 18px 18px; border-radius: 18px 18px 0 0; color: #fff;
  background: repeating-linear-gradient(90deg, rgba(0, 0, 0, .075) 0 2px, transparent 2px var(--sc)) center / var(--sc) 100%, var(--mc);
}
/* фестоны ламбрекена */
.unit-head::after {
  content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 13px; margin-top: -1px;
  background: radial-gradient(circle at 50% 0, var(--mc) calc(var(--sc) / 2 - .5px), transparent calc(var(--sc) / 2)) center top / var(--sc) 13px repeat-x;
}
.unit-kicker { font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; opacity: .88; }
.unit-head h2 { font-family: var(--display); font-weight: 400; font-size: 22px; line-height: 1.15; margin-top: 3px; text-wrap: balance; }
.unit-prog { display: flex; align-items: center; gap: 10px; margin-top: 11px; font-size: 13px; font-weight: 900; }
.unit-prog .bar { height: 10px; background: rgba(255, 255, 255, .28); }
.unit-prog .bar > i { background: #fff; min-width: 10px; }
.unit-prog .bar > i::after { display: none; }

.unit-path { display: flow-root; }
.step { position: relative; height: 104px; }
.step.is-focus { margin-top: 44px; }
.node {
  position: absolute; top: 14px; left: calc(50% + var(--dx) - 35px); width: 70px; height: 62px; border-radius: 50%;
  background: var(--mc); box-shadow: 0 8px 0 var(--mc-lip); color: #fff; display: grid; place-items: center;
  transition: transform .07s, box-shadow .07s; z-index: 1;
}
.node::before { content: ''; position: absolute; left: 13%; top: 9%; width: 52%; height: 30%; border-radius: 50%; background: rgba(255, 255, 255, .22); transform: rotate(-20deg); }
.node:active { transform: translateY(8px); box-shadow: 0 0 0 var(--mc-lip); }
.node svg { width: 34px; height: 34px; position: relative; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .14)); }
.node.is-locked { --mc: var(--line); --mc-lip: var(--line-lip); color: var(--ink-3); }
.node.is-locked::before, .node.is-locked svg { filter: none; opacity: .9; }
.node.is-gold { --mc: var(--gold); --mc-lip: var(--gold-lip); }
.ring { position: absolute; top: 2px; left: calc(50% + var(--dx) - 47px); width: 94px; height: 94px; transform: rotate(-90deg); pointer-events: none; }
.ring circle { fill: none; stroke-width: 7; }
.ring .ring-bg { stroke: var(--line); }
.ring .ring-fg { stroke: var(--mc); stroke-linecap: round; transition: stroke-dashoffset .6s; }
.ring.gold .ring-fg { stroke: var(--gold); }
.bubble {
  position: absolute; top: -34px; left: calc(50% + var(--dx)); transform: translateX(-50%); z-index: 2; padding: 9px 13px;
  border-radius: 13px; background: var(--surface); border: 2px solid var(--line); color: var(--mc);
  font-size: 14px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
  animation: bob 1.5s ease-in-out infinite; pointer-events: none;
}
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -8px; width: 12px; height: 12px; margin-left: -6px; background: var(--surface); border: solid var(--line); border-width: 0 2px 2px 0; transform: rotate(45deg); }
@keyframes bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -6px); } }
.step-label { position: absolute; top: 15px; display: flex; flex-direction: column; gap: 1px; }
.step[data-side="r"] .step-label { left: calc(50% + var(--dx) + 53px); right: 16px; }
.step[data-side="l"] .step-label { right: calc(50% - var(--dx) + 53px); left: 16px; text-align: right; align-items: flex-end; }
.step-label b { font-size: 11.5px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; color: var(--mc); }
.step-label span { font-size: 14px; font-weight: 800; line-height: 1.22; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.step-label em { font-style: normal; font-size: 12px; font-weight: 800; color: var(--ink-3); margin-top: 1px; }
.step.locked .step-label b, .step.locked .step-label span { color: var(--ink-3); }
.path-end { text-align: center; padding: 26px 24px 8px; color: var(--ink-2); font-size: 14px; }
.path-end svg { width: 84px; height: 84px; margin: 0 auto 8px; }
.path-end b { display: block; font-family: var(--display); font-weight: 400; font-size: 21px; color: var(--ink); }
.jump {
  position: fixed; right: max(16px, calc(50% - 244px)); bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 25; width: 52px; height: 48px;
  border-radius: 16px; background: var(--surface); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); color: var(--brand-ink); display: grid; place-items: center;
}
.jump svg { width: 26px; height: 26px; transition: transform .2s; }
.jump.up svg { transform: rotate(180deg); }
.jump:active { transform: translateY(4px); box-shadow: none; }

/* ───── нижние вкладки ───── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; max-width: 520px; margin: 0 auto; display: flex; justify-content: space-around; gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 2px solid var(--line);
}
.tab {
  flex: 1; max-width: 104px; height: 56px; border-radius: 14px; border: 2px solid transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  color: var(--ink-3); font-size: 10px; font-weight: 900; letter-spacing: .02em; text-transform: uppercase;
}
.tab svg { width: 27px; height: 27px; }
.tab.on { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-ink); }
.tab:active { transform: scale(.95); }

/* ───── шторки и уведомления ───── */
.backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(27, 18, 43, .58); opacity: 0; transition: opacity .22s; }
.backdrop.in { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-width: 520px; margin: 0 auto; max-height: 88vh; overflow: auto;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom)); border-radius: 26px 26px 0 0; background: var(--surface);
  transform: translateY(105%); transition: transform .3s cubic-bezier(.2, .9, .25, 1);
}
.sheet.in { transform: none; }
.sheet-grip { width: 46px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 16px; }
.sheet .btn + .btn { margin-top: 12px; }
.ws-kicker { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; color: var(--mc); }
.ws-kicker i { width: 12px; height: 12px; border-radius: 50%; background: var(--mc); }
.ws h3 { font-family: var(--display); font-weight: 400; font-size: 25px; line-height: 1.15; margin-top: 6px; text-wrap: balance; }
.ws-focus { margin-top: 8px; color: var(--ink-2); font-size: 15px; }
.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 6px; }
.trio > div { padding: 10px 6px; border-radius: 14px; border: 2px solid var(--line); text-align: center; }
.trio b { display: block; font-size: 20px; font-weight: 900; line-height: 1.1; }
.trio span { font-size: 11px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.note { margin: 12px 0 16px; color: var(--ink-2); font-size: 13.5px; line-height: 1.4; }
.ask { text-align: center; padding-top: 4px; }
.ask svg { width: 96px; height: 96px; margin: 0 auto 8px; }
.ask h3 { font-family: var(--display); font-weight: 400; font-size: 25px; }
.ask p { margin: 6px 0 18px; color: var(--ink-2); font-size: 15px; }
#toasts { position: fixed; left: 0; right: 0; top: 12px; z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  max-width: 440px; padding: 11px 16px; border-radius: 16px; background: var(--ink); color: var(--bg); font-size: 14.5px; font-weight: 800; text-align: center;
  opacity: 0; transform: translateY(-14px) scale(.96); transition: opacity .25s, transform .25s cubic-bezier(.2, 1.4, .4, 1);
}
.toast.in { opacity: 1; transform: none; }
.toast.gold { background: var(--gold); color: #4A3400; box-shadow: 0 4px 0 var(--gold-lip); }
.toast.bad { background: var(--bad); color: #fff; box-shadow: 0 4px 0 var(--bad-lip); }

/* ───── занятие ───── */
.lesson { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; background: var(--bg); animation: rise .28s cubic-bezier(.2, .9, .25, 1); }
.lesson > * { width: 100%; max-width: 520px; margin-left: auto; margin-right: auto; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
.lesson-top { display: flex; align-items: center; gap: 14px; padding: 14px 16px 8px; }
.lesson-x { width: 34px; height: 34px; flex: none; color: var(--ink-3); display: grid; place-items: center; }
.lesson-x svg { width: 26px; height: 26px; }
.lesson-top .bar > i { background: var(--good); }
.lesson-xp { display: flex; align-items: center; gap: 3px; font-weight: 900; color: var(--gold-ink); min-width: 46px; justify-content: flex-end; }
.lesson-xp svg { width: 22px; height: 22px; color: var(--gold); }
.lesson-xp.pop { animation: pop .4s; }
@keyframes pop { 40% { transform: scale(1.35); } }
.lesson-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 20px 20px; display: flex; flex-direction: column; }
.lesson-body.in { animation: slide .3s cubic-bezier(.2, .9, .25, 1); }
@keyframes slide { from { transform: translateX(36px); opacity: 0; } }
.lesson-foot { flex: none; padding: 14px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 2px solid var(--line); }
.kind { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; color: var(--mc); margin-bottom: 10px; }
.kind i { width: 26px; height: 26px; border-radius: 9px; background: var(--mc); color: #fff; display: grid; place-items: center; }
.kind i svg { width: 16px; height: 16px; }
.kind em { font-style: normal; color: var(--ink-3); letter-spacing: .02em; text-transform: none; font-size: 12.5px; font-weight: 800; flex-basis: 100%; }
.kind .chip { letter-spacing: .04em; }
.lesson-body h1 { font-size: 22px; font-weight: 900; line-height: 1.25; margin-bottom: 18px; text-wrap: pretty; }

.flip { flex: 1; min-height: 250px; max-height: 440px; perspective: 1400px; }
.flip-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.3, 1.2, .4, 1); }
.flip.on .flip-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 22px; border-radius: 24px; background: var(--surface); border: 2px solid var(--line); border-bottom-width: 6px; text-align: center;
}
.face small { font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--mc); }
.face h2 { font-family: var(--display); font-weight: 400; font-size: 27px; line-height: 1.15; margin: 12px 0 14px; text-wrap: balance; }
.face em { font-style: normal; font-size: 14px; color: var(--ink-3); }
.face.back { transform: rotateY(180deg); align-items: stretch; justify-content: flex-start; text-align: left; overflow-y: auto; border-color: var(--brand-line); background: var(--brand-soft); }
.face.back p { margin-top: 10px; font-size: 18px; font-weight: 700; line-height: 1.45; }
.foot-q { text-align: center; font-size: 13px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 10px; }

.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 16px; text-align: left; background: var(--surface);
  border: 2px solid var(--line); border-bottom-width: 4px; font-size: 16px; font-weight: 800; line-height: 1.3; transition: transform .06s, background .12s, border-color .12s;
}
.opt:active:not([disabled]) { transform: translateY(2px); border-bottom-width: 2px; margin-bottom: 2px; }
.opt kbd { flex: none; width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--line); display: grid; place-items: center; font: 900 13px var(--font); color: var(--ink-3); }
.opt.sel { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-ink); }
.opt.sel kbd { border-color: var(--brand-line); color: var(--brand-ink); }
.opt.good { background: var(--good-soft); border-color: var(--good-line); color: var(--good-ink); }
.opt.good kbd { border-color: var(--good-line); color: var(--good-ink); }
.opt.bad { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad-ink); animation: shake .35s; }
.opt.bad kbd { border-color: var(--bad-line); color: var(--bad-ink); }
.opt[disabled] { cursor: default; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.draft { width: 100%; min-height: 110px; padding: 14px 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); font: 700 16px/1.4 var(--font); resize: none; outline: none; }
.draft:focus { border-color: var(--brand-line); }
.draft::placeholder { color: var(--ink-3); }
.hint { margin-top: 10px; color: var(--ink-3); font-size: 13.5px; }
.points { margin-top: 18px; animation: slideUp .35s cubic-bezier(.2, .9, .25, 1); }
.points > b { display: block; font-size: 12px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 8px; }
.point { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; margin-bottom: 8px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); text-align: left; font-size: 15.5px; font-weight: 800; }
.point i { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--ink-3); display: grid; place-items: center; color: transparent; }
.point i svg { width: 16px; height: 16px; }
.point.on { background: var(--good-soft); border-color: var(--good-line); color: var(--good-ink); }
.point.on i { background: var(--good); border-color: var(--good); color: #fff; }
@keyframes slideUp { from { transform: translateY(18px); opacity: 0; } }

.lesson-foot.good { background: var(--good-soft); border-top-color: transparent; }
.lesson-foot.bad { background: var(--bad-soft); border-top-color: transparent; }
.fb { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; animation: slideUp .3s cubic-bezier(.2, .9, .25, 1); }
.fb > svg { width: 56px; height: 56px; flex: none; }
.fb-text { flex: 1; min-width: 0; }
.fb h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 22px; font-weight: 900; line-height: 1.2; }
.good .fb h3, .good .fb p b { color: var(--good-ink); }
.bad .fb h3, .bad .fb p b { color: var(--bad-ink); }
.fb h3 span { font-size: 13px; padding: 2px 9px; border-radius: 999px; background: var(--surface); }
.fb h3 span:empty { display: none; }
.fb p { margin-top: 4px; font-size: 15px; line-height: 1.35; }
.fb p + p { color: var(--ink-2); font-size: 14px; }

.sum { flex: 1; min-height: 0; overflow-y: auto; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 20px; text-align: center; }
.sum > svg { width: 150px; height: 150px; animation: cheer 1.1s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes cheer { from { transform: scale(.3) rotate(-18deg); opacity: 0; } }
.sum h1 { font-family: var(--display); font-weight: 400; font-size: 40px; line-height: 1.1; margin-top: 10px; color: var(--gold-ink); }
.sum p { margin-top: 8px; color: var(--ink-2); font-size: 16px; max-width: 330px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; margin-top: 24px; }
.tile { --c: var(--gold); padding: 2px; border-radius: 16px; background: var(--c); animation: slideUp .45s backwards cubic-bezier(.2, .9, .25, 1); }
.tile:nth-child(2) { animation-delay: .12s; } .tile:nth-child(3) { animation-delay: .24s; }
.tile b { display: block; padding: 3px 0 4px; color: #fff; font-size: 10.5px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.tile.gold b { color: #4A3400; }
.tile div { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 13px 4px; border-radius: 14px; background: var(--surface); font-size: 21px; font-weight: 900; color: var(--c-ink, var(--c)); }
.tile div svg { width: 22px; height: 22px; color: var(--c); }
.tile.gold { --c: var(--gold); --c-ink: var(--gold-ink); } .tile.good { --c: var(--good); --c-ink: var(--good-ink); } .tile.flame { --c: var(--flame); --c-ink: var(--flame-lip); }
.sum .goal { width: 100%; margin-top: 22px; }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -24px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--x), 110vh) rotate(var(--r)); } }

/* ───── страницы ───── */
.page { padding: 18px 16px 8px; }
.page-title { font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1.1; margin-bottom: 14px; }
.sec { margin: 22px 2px 10px; font-size: 12.5px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.card { padding: 16px; border-radius: 20px; background: var(--surface); border: 2px solid var(--line); border-bottom-width: 5px; }
.card + .card { margin-top: 12px; }
.weeknav { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.weeknav button { flex: none; width: 46px; height: 44px; border-radius: 14px; background: var(--surface); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); color: var(--brand-ink); display: grid; place-items: center; }
.weeknav button:active:not([disabled]) { transform: translateY(4px); box-shadow: none; }
.weeknav button[disabled] { color: var(--line-lip); box-shadow: none; }
.weeknav button svg { width: 24px; height: 24px; }
.weeknav div { flex: 1; text-align: center; }
.weeknav b { display: block; font-size: 18px; font-weight: 900; }
.weeknav span { font-size: 13px; color: var(--ink-3); }
.wk { border-color: var(--mc); background: var(--mc); color: #fff; border-bottom-color: var(--mc-lip); }
.wk .unit-kicker { display: flex; justify-content: space-between; gap: 8px; }
.wk h2 { font-family: var(--display); font-weight: 400; font-size: 23px; line-height: 1.15; margin: 4px 0 6px; text-wrap: balance; }
.wk p { font-size: 14.5px; opacity: .93; }
.wk .unit-prog { margin-top: 12px; }
.task { display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 14px; margin-bottom: 10px; border-radius: 18px; text-align: left; background: var(--surface); border: 2px solid var(--line); border-bottom-width: 4px; transition: transform .06s; }
.task:active { transform: translateY(2px); }
.task > i { flex: none; width: 30px; height: 30px; border-radius: 10px; border: 2px solid var(--ink-3); display: grid; place-items: center; color: transparent; margin-top: 1px; transition: background .15s, border-color .15s; }
.task > i svg { width: 18px; height: 18px; }
.task > span { flex: 1; font-size: 15.5px; font-weight: 700; line-height: 1.38; }
.task > span b { margin-right: 4px; font-weight: 400; }
.task.done { background: var(--good-soft); border-color: var(--good-line); }
.task.done > i { background: var(--good); border-color: var(--good); color: #fff; }
.task.done > span { color: var(--good-ink); }
.quote { position: relative; padding: 16px 16px 16px 20px; border-radius: 18px; background: var(--brand-soft); border: 2px solid var(--brand-line); font-size: 16px; font-weight: 800; line-height: 1.4; }
.quote small { display: block; margin-top: 8px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 13px 14px; margin-bottom: 12px; border-radius: 16px; background: var(--gold-soft); color: var(--gold-ink); font-size: 14.5px; font-weight: 800; line-height: 1.35; }
.callout.good { background: var(--good-soft); color: var(--good-ink); }
.callout.warn { background: var(--flame-soft); color: var(--flame-lip); }
.callout > span:first-child { font-size: 20px; line-height: 1.1; }

.level { display: flex; gap: 14px; align-items: center; }
.shield { flex: none; position: relative; width: 62px; height: 66px; display: grid; place-items: center; color: #fff; font-size: 24px; font-weight: 900; }
.shield svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.shield span { position: relative; margin-top: -6px; }
.level-info { flex: 1; min-width: 0; }
.level-info b { font-size: 19px; font-weight: 900; }
.level-info .bar { margin: 7px 0 5px; --c: var(--brand); }
.level-info span { font-size: 13px; color: var(--ink-3); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.kpi { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 18px; background: var(--surface); border: 2px solid var(--line); border-bottom-width: 4px; }
.kpi svg { width: 30px; height: 30px; flex: none; color: var(--c); }
.kpi b { display: block; font-size: 19px; font-weight: 900; line-height: 1.1; }
.kpi span { font-size: 12px; font-weight: 800; color: var(--ink-3); }
.chart { display: flex; align-items: flex-end; gap: 5px; height: 132px; position: relative; padding-top: 6px; }
.chart .col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; }
.chart .col i { width: 100%; max-width: 22px; min-height: 5px; border-radius: 7px 7px 4px 4px; background: var(--line); }
.chart .col.hit i { background: var(--gold); box-shadow: inset 0 -4px 0 var(--gold-lip); }
.chart .col.some i { background: var(--brand-line); }
.chart .col span { font-size: 10.5px; font-weight: 900; color: var(--ink-3); text-transform: uppercase; }
.chart .col.today span { color: var(--brand-ink); }
.chart .goal-line { position: absolute; left: 0; right: 0; height: 0; border-top: 2px dashed var(--gold-lip); opacity: .55; }
.chart .goal-line em { position: absolute; left: 0; top: -19px; font-style: normal; font-size: 10.5px; font-weight: 900; color: var(--gold-ink); background: var(--surface); padding: 0 3px; }
.card-foot { margin-top: 12px; font-size: 13.5px; color: var(--ink-2); }
.mod { display: flex; align-items: center; gap: 12px; }
.mod + .mod { margin-top: 14px; }
.mod > i { flex: none; width: 34px; height: 34px; border-radius: 11px; background: var(--mc); box-shadow: 0 3px 0 var(--mc-lip); color: #fff; display: grid; place-items: center; font-style: normal; font-weight: 900; }
.mod > div { flex: 1; min-width: 0; }
.mod b { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 800; line-height: 1.25; }
.mod b em { font-style: normal; color: var(--ink-3); white-space: nowrap; }
.mod .bar { height: 12px; margin-top: 5px; --c: var(--mc); }
.mod .bar > i::after { top: 3px; height: 3px; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 30px; }
.row + .row { margin-top: 14px; padding-top: 14px; border-top: 2px solid var(--line); }
.row > div b { display: block; font-size: 15.5px; font-weight: 800; }
.row > div span { font-size: 13px; color: var(--ink-3); }
.row input[type="time"] { padding: 8px 10px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); font: 900 16px var(--font); outline: none; }
.row input[type="time"]:focus { border-color: var(--brand-line); }
.switch { flex: none; position: relative; width: 58px; height: 34px; border-radius: 999px; background: var(--ink-3); transition: background .18s; }
.switch::after { content: ''; position: absolute; left: 4px; top: 4px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 0 rgba(0, 0, 0, .12); transition: transform .2s cubic-bezier(.3, 1.4, .5, 1); }
.switch.on { background: var(--good); }
.switch.on::after { transform: translateX(24px); }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day { height: 46px; border-radius: 13px; background: var(--surface); border: 2px solid var(--line); border-bottom-width: 4px; font-size: 13px; font-weight: 900; text-transform: uppercase; color: var(--ink-2); }
.day.on { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-ink); }
.day:active { transform: translateY(2px); }
.opt .opt-main { flex: 1; }
.opt .opt-main small { display: block; font-size: 13px; font-weight: 700; color: var(--ink-3); }
.opt.sel .opt-main small { color: var(--brand-ink); opacity: .8; }
.opt .opt-xp { font-weight: 900; white-space: nowrap; }

/* ───── загрузка и ошибки ───── */
.center { min-height: 72vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.center svg { width: 120px; height: 120px; }
.center.loading svg { animation: bob2 1.2s ease-in-out infinite; }
@keyframes bob2 { 50% { transform: translateY(-10px) rotate(4deg); } }
.center h2 { font-family: var(--display); font-weight: 400; font-size: 26px; margin-top: 12px; }
.center p { margin: 6px 0 18px; color: var(--ink-2); max-width: 320px; }
.center .btn { max-width: 260px; }

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