/* Брендбук «Красный на графите»: графит, белый и один красный акцент. Inter. */
:root {
  --bg: #0F1012;
  --glow: #1D1E23;
  --card: #16171B;
  --line: #2C2E35;
  --white: #FFFFFF;
  --ink: #111214;
  --muted: #A0A3AB;
  --red: #E5322D;
  --red-dim: rgba(229, 50, 45, .14);
  --radius: 16px;
  --gutter: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background: var(--bg) radial-gradient(120% 60% at 50% 0%, var(--glow) 0%, var(--bg) 70%) no-repeat;
  color: var(--white);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; }

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--gutter) + var(--tg-content-safe-area-inset-top, 0px) + var(--tg-safe-area-inset-top, 0px)) var(--gutter) calc(32px + var(--tg-safe-area-inset-bottom, 0px));
}

/* --- типографика --- */
.overline {
  font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.overline .accent { color: var(--red); }
.h1 {
  margin: 6px 0 0; font-size: 34px; line-height: 1.02; font-weight: 800; letter-spacing: -.01em; text-transform: uppercase;
}
.h1 .red, .h2 .red { color: var(--red); display: block; }
.h2 { margin: 6px 0 0; font-size: 24px; line-height: 1.08; font-weight: 800; text-transform: uppercase; }
.lead { color: var(--muted); margin: 12px 0 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* --- карточки --- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.stack { display: grid; gap: 10px; }
.section { margin-top: 20px; }

/* --- таймер --- */
.timer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.timer-digits {
  font-size: 34px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1;
}
.timer.urgent .timer-digits { color: var(--red); }
.timer-caption { margin-top: 6px; font-size: 13px; color: var(--muted); }

.segments { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 14px; }
.segments i { height: 6px; border-radius: 3px; background: var(--line); }
.segments i.on { background: var(--white); }
.segments i.on:last-child, .segments.all i.on { background: var(--red); }

/* --- список уроков --- */
.lesson {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center;
  width: 100%; text-align: left; transition: border-color .15s, transform .1s;
}
.lesson:active:not(.locked) { transform: scale(.99); }
.lesson.current { border-color: var(--red); }
.lesson.locked { opacity: .55; cursor: default; }
.lesson-num { font-size: 26px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.lesson.current .lesson-num { color: var(--red); }
.lesson-title { font-weight: 700; line-height: 1.25; }
.lesson-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.lesson-bar { grid-column: 1 / -1; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.status svg { width: 18px; height: 18px; }
.status.done { color: var(--white); }
.status.go {
  background: var(--red); color: var(--white); padding: 6px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em;
}

/* --- полоса прогресса просмотра --- */
.bar { position: relative; height: 6px; border-radius: 3px; background: var(--line); overflow: visible; }
.bar-fill { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--white); transition: width .3s; }
.bar.done .bar-fill { background: var(--white); }
.bar-goal { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--red); border-radius: 1px; }
.bar-label { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--muted); }

/* --- финальный шаг --- */
.final { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; width: 100%; text-align: left; }
.final.open { border-color: var(--red); background: linear-gradient(180deg, var(--red-dim), transparent 80%), var(--card); }

/* --- плеер --- */
.player {
  position: relative; margin: 16px calc(-1 * var(--gutter)) 0; background: #000; aspect-ratio: 16 / 9; overflow: hidden;
}
@media (min-width: 592px) { .player { margin: 16px 0 0; border-radius: var(--radius); border: 1px solid var(--line); } }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.player:fullscreen { aspect-ratio: auto; border-radius: 0; border: 0; }
.player-big {
  position: absolute; inset: 0; margin: auto; width: 68px; height: 68px; border-radius: 50%;
  background: var(--red); display: grid; place-items: center; box-shadow: 0 0 0 8px rgba(229, 50, 45, .2);
}
.player-big svg { width: 28px; height: 28px; margin-left: 4px; }
.player.playing .player-big { display: none; }
.controls {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .75));
  display: grid; grid-template-columns: auto 1fr auto auto auto; gap: 10px; align-items: center;
  transition: opacity .25s;
}
.player.playing.idle .controls { opacity: 0; }
.ctrl { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; }
.ctrl svg { width: 20px; height: 20px; }
.ctrl-speed { width: auto; padding: 0 6px; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.time { font-size: 12px; font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, .85); }
.track { position: relative; height: 24px; display: flex; align-items: center; touch-action: none; }
.track-bg { position: absolute; left: 0; right: 0; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .22); }
.track-allowed { position: absolute; left: 0; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .4); }
.track-played { position: absolute; left: 0; height: 4px; border-radius: 2px; background: var(--red); }
.track-head { position: absolute; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--white); }

.watch-info { margin-top: 14px; }
.hint { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; font-size: 13px; color: var(--muted); }
.hint svg { flex: none; width: 16px; height: 16px; margin-top: 2px; }

/* --- кнопки --- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; padding: 14px 18px;
  border-radius: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em;
  background: var(--red); color: var(--white); transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.99); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--white); }
.btn.white { background: var(--white); color: var(--ink); }

/* --- «таблетки» --- */
.pill { display: inline-block; padding: 6px 12px; border-radius: 999px; font-weight: 800; font-size: 13px; text-transform: uppercase; }
.pill.white { background: var(--white); color: var(--ink); }
.pill.red { background: var(--red); color: var(--white); }

/* --- запись --- */
.agenda { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.agenda li { display: flex; gap: 10px; align-items: center; font-weight: 700; }
.agenda b {
  flex: none; width: 24px; height: 24px; border-radius: 6px; background: var(--line); display: grid; place-items: center; font-size: 12px;
}
.agenda li:last-child b { background: var(--red); }
.field { display: grid; gap: 6px; }
.field span { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.field input, .field textarea {
  width: 100%; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--white);
  font-size: 16px; outline: none; resize: none;
}
.field input:focus, .field textarea:focus { border-color: var(--white); }
.field input.invalid { border-color: var(--red); }
.error { color: var(--red); font-size: 13px; font-weight: 600; min-height: 18px; }

/* --- состояния --- */
.center { min-height: 70vh; display: grid; place-content: center; text-align: center; gap: 12px; padding: 24px 0; }
.big-num { font-size: 64px; font-weight: 800; color: var(--red); line-height: 1; }
.spinner {
  width: 28px; height: 28px; margin: 0 auto; border: 3px solid var(--line); border-top-color: var(--red); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--tg-safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px);
  width: calc(100% - 2 * var(--gutter)); max-width: 528px; padding: 14px 16px; border-radius: 14px;
  background: var(--white); color: var(--ink); font-weight: 700; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 10;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.red { background: var(--red); color: var(--white); }

.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.back svg { width: 18px; height: 18px; }
.tg .back { display: none; } /* в Telegram — системная кнопка «Назад» */

.demo-bar {
  margin-bottom: 12px; padding: 8px 12px; border-radius: 10px; border: 1px dashed var(--line); font-size: 12px; color: var(--muted);
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.demo-bar button { text-decoration: underline; }
.lesson-sub { font-size: 13px; color: var(--white); opacity: .8; margin-top: 2px; line-height: 1.3; }
.lesson.locked .lesson-sub { opacity: .6; }

/* --- шапка автора --- */
.author { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.author-photo { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid var(--white); flex: none; }
.author-name { display: grid; gap: 2px; flex: 1; min-width: 0; }
.author-name .overline { color: var(--white); }
.author-name .muted-2 { color: var(--muted); }
.help {
  flex: none; margin-left: auto; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--white); display: grid; place-items: center;
}
.help svg { width: 22px; height: 22px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.topbar .back { margin-bottom: 0; }

/* --- шаги --- */
.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 20px; }
.steps i { height: 6px; border-radius: 3px; background: var(--line); }
.steps i.on { background: var(--white); }
.steps i.now { background: var(--red); }
.steps-caption { margin-top: 8px; font-size: 13px; color: var(--muted); }
.steps-caption .accent { color: var(--white); font-weight: 600; }

/* --- цитата автора --- */
.quote {
  margin: 20px 0 0; padding: 2px 0 2px 14px; border-left: 3px solid var(--red);
  color: var(--white); opacity: .9; font-size: 15px; line-height: 1.5;
}
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); margin-right: 8px; vertical-align: 1px; }

/* --- предложение встречи --- */
.offer { padding: 20px 18px; border-style: dashed; }
.offer.open { border-style: solid; border-color: var(--red); background: linear-gradient(180deg, var(--red-dim), transparent 70%), var(--card); }
.offer-status { display: flex; align-items: center; }
.offer:not(.open) .offer-status .dot { background: var(--muted); }
.offer-title { margin-top: 10px; font-size: 22px; }
.offer-sub { margin: 8px 0 0; font-size: 14px; }
.accent-title { margin-top: 18px; color: var(--red); }
.bullets { list-style: none; padding: 0; margin: 10px 0 18px; display: grid; gap: 10px; }
.bullets li { position: relative; padding-left: 18px; font-size: 14px; line-height: 1.45; }
.bullets li::before { content: ""; position: absolute; left: 0; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.btn.locked { background: var(--line); color: var(--muted); }
.btn svg { width: 18px; height: 18px; }

/* --- окно поддержки --- */
.modal {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px;
  background: rgba(0, 0, 0, .6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: fade .15s ease-out;
}
.modal-card {
  width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: 22px 20px 18px; display: grid; gap: 10px;
}
.modal-card h3 { margin: 0; font-size: 18px; font-weight: 800; }
.modal-card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.45; }
.modal-card .btn { margin-top: 4px; min-height: 48px; }
@keyframes fade { from { opacity: 0; } }
