/* Зарядка — «спортивный контраст»: чёрный фон, огромные цифры, лаймовый акцент.
   Шрифты: Unbounded и Onest, SIL Open Font License 1.1 (fonts/*-OFL.txt). */

html, body { background: #000; color: #e9eae4; margin: 0; }

@font-face {
  font-family: 'Unbounded'; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url('/fonts/unbounded-cyrillic-wght-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Unbounded'; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url('/fonts/unbounded-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Onest'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/fonts/onest-cyrillic-wght-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Onest'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/fonts/onest-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  --bg: #000;
  --surface: #121410;
  --surface-2: #1c1f19;
  --line: #2b2f27;
  --text: #e9eae4;
  --muted: #8f948a;
  --accent: #c8f135;
  --accent-deep: #1d2606;
  --accent-edge: #3c4f10;
  --rest: #7fb2ff;
  --rest-bg: #050b14;
  --danger: #ff6b5e;
  --signal: #34460a;
  --display: 'Unbounded', 'Arial Black', system-ui, sans-serif;
  --sans: 'Onest', -apple-system, system-ui, sans-serif;
  --gx: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));
  --top: max(12px, env(safe-area-inset-top));
  --bottom: max(12px, env(safe-area-inset-bottom));
}
:root[data-accent='orange'] { --accent: #ff8a24; --accent-deep: #2a1503; --accent-edge: #5a2d08; --signal: #4a2504; }
:root[data-signal='bright'] { --signal: var(--accent); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 17px; line-height: 1.45;
  min-height: 100dvh; overscroll-behavior: none; -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { touch-action: manipulation; cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ── Оболочка с вкладками ─────────────────────────────── */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.page { flex: 1; padding: var(--top) var(--gx) calc(176px + var(--bottom)); max-width: 640px; width: 100%; margin: 0 auto; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: center; gap: 4px;
  padding: 8px var(--gx) var(--bottom); background: linear-gradient(to top, #000 70%, rgba(0, 0, 0, 0));
}
.tabbar a {
  flex: 1; max-width: 200px; text-align: center; padding: 12px 6px; border-radius: 14px; color: var(--muted);
  text-decoration: none; font-weight: 600; font-size: 15px;
}
.tabbar a[aria-current='page'] { color: var(--text); background: var(--surface); }

.banner {
  margin: 0 0 14px; padding: 12px 14px; border-radius: 14px; background: #2a1310; color: #ffd9d4;
  border: 1px solid #5a2620; font-size: 15px; display: flex; gap: 12px; align-items: center; justify-content: space-between;
}
.banner.info { background: var(--surface); color: var(--text); border-color: var(--line); }
.banner button, .linkbtn { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.toast {
  position: fixed; top: calc(var(--top) + 4px); left: var(--gx); right: var(--gx); z-index: 30; max-width: 600px; margin: 0 auto;
  padding: 12px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 600;
}

/* ── Сегодня ──────────────────────────────────────────── */
.today-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 4px 0 2px; color: var(--muted); }
.today-head .streak { color: var(--text); font-weight: 600; }
.hero { display: grid; grid-template-columns: auto 1fr; gap: 0 18px; align-items: end; margin: 6px 0 18px; }
.hero .letter {
  font-family: var(--display); font-weight: 900; font-size: min(46vw, 260px); line-height: .82; color: var(--accent);
  letter-spacing: -.04em; grid-row: span 3;
}
.hero .subtitle { font-weight: 600; font-size: 19px; line-height: 1.25; }
.hero .est { font-family: var(--display); font-weight: 700; font-size: 26px; margin-top: 10px; }
.hero .last { color: var(--muted); font-size: 15px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.badge { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--accent-edge); color: var(--accent); font-size: 14px; font-weight: 600; }

.seg { display: flex; gap: 6px; padding: 4px; border-radius: 16px; background: var(--surface); margin: 0 0 10px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1 0 auto; min-height: 44px; padding: 0 14px; border-radius: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.seg button[aria-pressed='true'] { background: var(--surface-2); color: var(--text); }
.mode-note { color: var(--muted); font-size: 15px; margin: -2px 2px 12px; }

.plan { margin: 6px 0 0; }
.plan h3 { font-size: 15px; font-weight: 600; color: var(--muted); margin: 18px 0 6px; display: flex; justify-content: space-between; }
.plan ol { list-style: none; margin: 0; padding: 0; }
.plan li { display: grid; grid-template-columns: 1fr auto; gap: 2px 14px; padding: 11px 0; border-top: 1px solid var(--line); }
.plan li:first-child { border-top: 0; }
.plan .nm { font-weight: 600; }
.plan .en { color: var(--muted); font-size: 14px; grid-column: 1; }
.plan .dose { font-family: var(--display); font-weight: 600; font-size: 16px; text-align: right; white-space: nowrap; grid-row: 1; grid-column: 2; }
.plan .side { color: var(--muted); font-size: 13px; text-align: right; grid-column: 2; }
.plan .flag { color: var(--accent); font-size: 13px; grid-column: 1 / -1; }

.cta {
  position: fixed; left: 0; right: 0; bottom: calc(60px + var(--bottom)); z-index: 4; padding: 18px var(--gx) 6px;
  display: flex; justify-content: center; pointer-events: none; background: linear-gradient(to top, #000 62%, rgba(0, 0, 0, 0));
}
.cta .inner { width: 100%; max-width: 640px; display: grid; gap: 8px; pointer-events: auto; }
.btn-main {
  width: 100%; min-height: 64px; border-radius: 20px; background: var(--accent); color: #0d1102;
  font-family: var(--display); font-weight: 800; font-size: 22px;
}
.btn-quiet { min-height: 48px; border-radius: 14px; background: var(--surface); color: var(--text); font-weight: 600; padding: 0 16px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.links { display: flex; flex-wrap: wrap; gap: 18px; margin: 26px 0 0; }
.card { background: var(--surface); border-radius: 18px; padding: 14px 16px; margin: 0 0 14px; }
.card h4 { margin: 0 0 4px; font-size: 16px; }
.card .btn-quiet { background: var(--surface-2); }
.card p { margin: 0 0 10px; color: var(--muted); font-size: 15px; }
.sug { display: grid; gap: 4px; padding: 10px 0; border-top: 1px solid var(--line); }
.sug:first-of-type { border-top: 0; }
.sug .what { font-weight: 600; }
.sug .ch { font-family: var(--display); font-weight: 700; color: var(--accent); }

/* ── Сессия ───────────────────────────────────────────── */
.session {
  position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; background: var(--bg);
  padding: var(--top) var(--gx) var(--bottom); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.session.rest { background: var(--rest-bg); }
.session.flash { background: var(--signal); }
.progress { height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; }
.s-top { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.s-top .where { flex: 1; color: var(--muted); font-size: 15px; display: flex; gap: 10px; flex-wrap: wrap; }
.s-top .where b { color: var(--text); font-weight: 600; }
.iconbtn { width: 48px; height: 48px; border-radius: 14px; background: var(--surface); display: grid; place-items: center; }
.iconbtn svg { width: 22px; height: 22px; stroke: var(--text); fill: none; stroke-width: 2.2; stroke-linecap: round; }
.s-body { flex: 1; display: flex; flex-direction: column; justify-content: center; justify-content: safe center; min-height: 0; gap: 4px; overflow: hidden; }
.enter { border: 1px solid var(--accent-edge); color: var(--text); border-radius: 16px; padding: 12px 14px; font-size: 16px; margin: 6px 0 4px; }
.bignum {
  font-family: var(--display); font-weight: 800; line-height: .9; letter-spacing: -.03em; color: var(--text);
  font-size: min(46vw, 290px, 18dvh); margin: 0; font-variant-numeric: tabular-nums;
}
.bignum.d3 { font-size: min(32vw, 210px, 14dvh); }
.bignum.time { font-size: min(26vw, 170px, 13dvh); }
.unit { font-size: 20px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.s-name { font-weight: 700; font-size: clamp(26px, 8.4vw, 36px); line-height: 1.12; margin-top: 14px; text-wrap: balance; }
.s-en { color: var(--muted); font-size: 18px; margin-top: 2px; }
.s-meta { color: var(--muted); font-size: 16px; margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.s-meta .on { color: var(--accent); }
.side-tag { font-family: var(--display); font-weight: 800; font-size: 40px; color: var(--accent); }
.hint { color: var(--muted); font-size: 15px; text-align: center; margin: 6px 0 8px; }
.s-actions { display: grid; gap: 10px; }
.off { justify-self: end; min-height: 56px; padding: 0 20px; border-radius: 16px; background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 17px; }
.done {
  height: 42dvh; min-height: 180px; width: 100%; border-radius: 28px; background: var(--accent-deep); color: var(--accent);
  border: 2px solid var(--accent-edge); font-family: var(--display); font-weight: 800; font-size: clamp(40px, 13vw, 76px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 0 16px;
}
.done small { font-family: var(--sans); font-weight: 600; font-size: 16px; color: var(--muted); }
.done.go { background: var(--surface); color: var(--text); border-color: var(--line); }
.session.rest .done { background: #0a1626; color: var(--rest); border-color: #17304f; }
.rest-num { color: var(--rest); }
.rest-row { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.chain-state { font-family: var(--display); font-weight: 700; font-size: 22px; color: var(--accent); }
.wl { color: var(--muted); font-size: 13px; text-align: center; }

/* ── Листы и меню ─────────────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .72); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 640px; max-height: 88dvh; overflow-y: auto; background: var(--surface); border-radius: 24px 24px 0 0;
  padding: 18px var(--gx) calc(18px + var(--bottom)); user-select: text; -webkit-user-select: text;
}
.sheet h2 { font-size: 22px; margin: 2px 0 12px; line-height: 1.2; }
.sheet h3 { font-size: 15px; color: var(--muted); font-weight: 600; margin: 16px 0 6px; }
.sheet p, .sheet li { font-size: 16px; }
.sheet ul, .sheet ol { padding-left: 20px; margin: 0; }
.sheet .menu { display: grid; gap: 8px; }
.sheet .menu button { min-height: 54px; border-radius: 14px; background: var(--surface-2); text-align: left; padding: 0 16px; font-weight: 600; }
.sheet .menu .danger { color: var(--danger); }
.figs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; margin: 4px 0 6px; }
.figs .arrow { color: var(--muted); font-size: 22px; }
.fig { width: 100%; height: auto; display: block; }
.fig .floor { stroke: var(--muted); stroke-width: 1.5; }
.fig .prop { stroke: #5d6357; stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.fig .propfill { fill: #2b2f27; stroke: #5d6357; stroke-width: 2; }
.fig .roll { fill: #3a3f35; stroke: var(--muted); stroke-width: 1.5; }
.fig .limb { stroke: var(--text); stroke-width: 8; stroke-linecap: round; fill: none; }
.fig .far { opacity: .4; }
.fig .hl { stroke: var(--accent); }
.fig .head { fill: var(--text); }
.fig .mv { stroke: var(--accent); stroke-width: 2; fill: none; stroke-dasharray: 3 3; }
.stepper { display: grid; grid-template-columns: 72px 1fr 72px; align-items: center; gap: 10px; margin: 8px 0 16px; }
.stepper button { height: 72px; border-radius: 18px; background: var(--surface-2); font-family: var(--display); font-weight: 700; font-size: 32px; }
.stepper output { text-align: center; font-family: var(--display); font-weight: 800; font-size: 64px; font-variant-numeric: tabular-nums; }
.sheet textarea { width: 100%; min-height: 120px; border-radius: 12px; background: #000; border: 1px solid var(--line); padding: 10px; font-size: 14px; }
.sheet input[type='text'] { width: 100%; min-height: 48px; border-radius: 12px; background: #000; border: 1px solid var(--line); padding: 0 12px; }

/* ── Итог ─────────────────────────────────────────────── */
.summary { padding: calc(var(--top) + 12px) var(--gx) calc(24px + var(--bottom)); max-width: 640px; margin: 0 auto; }
.summary .check { width: 96px; height: 96px; stroke: var(--accent); stroke-width: 9; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.summary h1 { font-family: var(--display); font-weight: 800; font-size: 40px; margin: 10px 0 14px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 18px; }
.stat { background: var(--surface); border-radius: 16px; padding: 12px; }
.stat b { display: block; font-family: var(--display); font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }

/* ── Календарь ────────────────────────────────────────── */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 14px; }
.cal-head h2 { font-size: 22px; margin: 0; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .wd { text-align: center; color: var(--muted); font-size: 13px; padding-bottom: 4px; }
.cal button { aspect-ratio: 1; border-radius: 12px; display: grid; place-items: center; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); }
.cal button.full { background: var(--accent); color: #0d1102; }
.cal button.counted { box-shadow: inset 0 0 0 2px var(--accent); color: var(--text); }
.cal button.attempt { color: var(--text); background: radial-gradient(circle at 50% 78%, var(--accent) 0 3px, transparent 3.5px); }
.cal button.today { outline: 2px solid var(--text); outline-offset: -2px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin: 16px 0 0; color: var(--muted); font-size: 14px; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; }
.legend .full { background: var(--accent); }
.legend .counted { box-shadow: inset 0 0 0 2px var(--accent); }
.legend .attempt { background: radial-gradient(circle, var(--accent) 0 3px, transparent 3.5px); }

/* ── Профиль ──────────────────────────────────────────── */
.section { margin: 0 0 22px; }
.section h2 { font-size: 15px; font-weight: 600; color: var(--muted); margin: 0 0 8px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.kv:first-of-type { border-top: 0; }
.stack { display: grid; gap: 8px; }
.prose li { margin: 0 0 10px; }
.errors { color: var(--danger); }

/* ── Схемы (галерея для проверки) ─────────────────────── */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.gallery figure { margin: 0; background: var(--surface); border-radius: 14px; padding: 8px; }
.gallery figcaption { font-size: 12px; color: var(--muted); }
.gallery .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }

@media (orientation: landscape) and (max-height: 500px) {
  .session { flex-direction: row; gap: 18px; }
  .session .s-body { flex: 1.2; }
  .session .s-actions { flex: 1; align-content: center; }
  .done { height: 64dvh; }
}
.has-enter .bignum { font-size: min(36vw, 13dvh); }
.has-enter .s-name { font-size: clamp(22px, 7vw, 28px); margin-top: 4px; }
.has-enter .s-meta { margin-top: 2px; }
.has-enter .done { height: 40dvh; }
@media (max-height: 720px) {
  .done { height: 32dvh; min-height: 150px; }
  .bignum { font-size: min(46vw, 16dvh); }
  .bignum.d3 { font-size: min(32vw, 12dvh); }
  .bignum.time { font-size: min(26vw, 11dvh); }
  .s-body { gap: 2px; }
  .s-name { font-size: 24px; margin-top: 4px; }
  .s-en { font-size: 15px; }
  .s-meta { margin-top: 2px; font-size: 15px; }
  .unit { font-size: 16px; margin-top: 0; }
  .enter { font-size: 13px; line-height: 1.3; padding: 6px 10px; margin: 2px 0; }
  .hint { margin: 2px 0 4px; font-size: 14px; }
  .off { min-height: 48px; }
  .s-actions { gap: 8px; }
  .has-enter .done { height: 32dvh; }
  .has-enter .bignum { font-size: min(32vw, 11dvh); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
