:root {
  --navy: #0a2f7f;
  --navy-2: #0c2a6b;
  --blue: #1a6fe8;
  --blue-soft: #7fb2ff;
  --ink: #2b3445;
  --muted: #5a6475;
  --line: #dbe8f9;
  --bg: #ffffff;
  --bg-soft: #f4f8fe;
  --bg-tint: #eef4fd;
  --coral: #ff8562;
  --ok: #17a34a;
  --btn: radial-gradient(circle, #3699fd, #006cd9);
  --radius: 22px;
  --shadow: 0 10px 30px rgba(10, 47, 127, .08);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg-soft);
  color: var(--ink);
  font: 500 15px/1.55 Montserrat, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); }
.wrap { max-width: 760px; margin: 0 auto; padding: 18px 16px calc(40px + env(safe-area-inset-bottom)); }

.brand { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 17px; color: var(--navy); letter-spacing: -.01em; margin: 4px 4px 16px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--btn); box-shadow: 0 0 0 3px var(--bg-tint); }

.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card, .card + .tabs, .tabs + .card, .tabs + #lesson > .card:first-child { margin-top: 14px; }

/* Профиль және прогресс */
.me { display: flex; align-items: center; gap: 14px; }
.avatar { width: 54px; height: 54px; border-radius: 50%; background: var(--btn); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 22px; flex: none; }
.me .who { flex: 1; min-width: 0; }
.me .name { font-weight: 800; color: var(--navy); font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .user { color: var(--muted); font-size: 13px; }
.me .pct { font-weight: 900; color: var(--blue); font-size: 26px; }
.bar { height: 8px; background: var(--bg-tint); border-radius: 99px; margin: 16px 0 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--btn); border-radius: 99px; transition: width .6s ease; }
.hint { color: var(--muted); font-size: 13px; }

/* Сабақ қойындылары */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 3px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; border: 1.5px solid var(--line); background: var(--bg); color: var(--navy); font: 700 14px Montserrat, sans-serif; padding: 9px 16px; border-radius: 99px; cursor: pointer; }
.tab.on { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26, 111, 232, .18); }
.tab.done { color: var(--ok); }
.tab.locked { color: #9aa4b5; cursor: not-allowed; }

/* Сабақ */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--blue); background: var(--bg-tint); padding: 4px 10px; border-radius: 99px; }
.chip.ok { color: var(--ok); background: #e9f8ef; }
h1 { font-weight: 900; text-transform: uppercase; color: var(--navy); font-size: clamp(22px, 5.4vw, 30px); line-height: 1.08; letter-spacing: -.01em; margin: 10px 0 16px; }
h2 { font-weight: 900; text-transform: uppercase; color: var(--navy); font-size: 17px; letter-spacing: .01em; margin: 0 0 14px; }
.summary { margin: 16px 0 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; text-decoration: none; background: var(--btn); color: #fff; font: 800 16px Montserrat, sans-serif; padding: 15px 26px; border-radius: 16px; box-shadow: 0 4px 0 #0c4fb0, 0 12px 24px rgba(0, 108, 217, .25); transition: transform .1s, box-shadow .1s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #0c4fb0, 0 6px 12px rgba(0, 108, 217, .2); }
.btn.wide { width: 100%; }
.btn.ghost { background: var(--bg); color: var(--navy); border: 1.5px solid var(--line); box-shadow: none; font-weight: 700; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

ol.tasks { counter-reset: t; list-style: none; margin: 0; padding: 0; }
ol.tasks li { counter-increment: t; position: relative; padding: 0 0 14px 44px; }
ol.tasks li::before { content: counter(t); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 10px; background: var(--bg-tint); color: var(--blue); font-weight: 800; display: grid; place-items: center; font-size: 14px; }
ol.tasks li:last-child { padding-bottom: 0; }

.moments { display: grid; gap: 2px; }
.moment { display: flex; gap: 14px; align-items: baseline; text-align: left; background: none; border: 0; padding: 10px 8px; border-radius: 12px; font: inherit; color: inherit; cursor: pointer; }
.moment:hover { background: var(--bg-soft); }
.moment b { flex: none; min-width: 46px; color: var(--blue); font-weight: 800; font-variant-numeric: tabular-nums; }

.prompt { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.prompt + .prompt { margin-top: 12px; }
.prompt header { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; background: var(--bg-soft); font-weight: 800; color: var(--navy); font-size: 14px; }
.prompt pre { margin: 0; padding: 14px; white-space: pre-wrap; word-break: break-word; font: 500 14px/1.55 Montserrat, sans-serif; }
.copy { border: 0; background: var(--btn); color: #fff; font: 700 13px Montserrat, sans-serif; padding: 7px 12px; border-radius: 10px; cursor: pointer; flex: none; }

.links { display: grid; gap: 10px; }
.link { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; text-decoration: none; color: inherit; }
.link:hover { border-color: var(--blue-soft); }
.link .t { font-weight: 800; color: var(--navy); }
.link .d { color: var(--muted); font-size: 13px; }
.link .arr { margin-left: auto; color: var(--blue); font-weight: 800; }

details.guide { border-bottom: 1px solid var(--line); }
details.guide summary { cursor: pointer; padding: 14px 0; font-weight: 700; color: var(--navy); list-style: none; display: flex; justify-content: space-between; }
details.guide summary::after { content: '+'; color: var(--blue); font-weight: 800; }
details.guide[open] summary::after { content: '−'; }
details.guide div { padding: 0 0 14px; white-space: pre-wrap; }

.foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 22px; }
.foot button { background: none; border: 0; color: var(--muted); text-decoration: underline; font: inherit; cursor: pointer; }

/* Ақылы емес / кіру экраны */
.hero { text-align: center; padding: 34px 22px; }
.hero h1 { margin-top: 0; }
.hero p { color: var(--muted); max-width: 460px; margin: 0 auto 22px; }
.novideo { aspect-ratio: 16/9; border-radius: 18px; background: var(--bg-tint); display: grid; place-items: center; text-align: center; color: var(--muted); padding: 20px; font-weight: 600; }

.loading { display: grid; place-items: center; min-height: 50vh; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--navy); color: #fff; font-weight: 700; padding: 12px 18px; border-radius: 14px; box-shadow: var(--shadow); z-index: 50; max-width: calc(100% - 32px); text-align: center; }

/* ===== Плеер ===== */
.mx-player { position: relative; width: 100%; aspect-ratio: 16/9; background: #06122b; border-radius: 18px; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.mx-player video { width: 100%; height: 100%; display: block; background: #000; object-fit: contain; }
.mx-player.fs { border-radius: 0; aspect-ratio: auto !important; }
.mx-player.fake-fs { position: fixed; inset: 0; z-index: 100; border-radius: 0; aspect-ratio: auto !important; }
.mx-poster { position: absolute; inset: 0; background: center/cover no-repeat; transition: opacity .3s; }
.mx-poster::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(6, 18, 43, .1), rgba(6, 18, 43, .55)); }
.mx-player.started .mx-poster { opacity: 0; pointer-events: none; }
.mx-big { position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%; border: 0; background: var(--btn); box-shadow: 0 0 0 8px rgba(255, 255, 255, .18), 0 14px 30px rgba(0, 0, 0, .35); cursor: pointer; display: grid; place-items: center; z-index: 3; transition: transform .15s, opacity .2s; }
.mx-big:hover { transform: scale(1.06); }
.mx-big svg { width: 30px; height: 30px; margin-left: 4px; fill: #fff; }
.mx-player.playing .mx-big { opacity: 0; pointer-events: none; }
.mx-title { position: absolute; left: 18px; bottom: 64px; right: 18px; color: #fff; z-index: 2; transition: opacity .2s; }
.mx-title small { display: block; color: #9cc4f7; font-weight: 700; font-size: 12px; }
.mx-title b { font-weight: 900; font-size: clamp(16px, 3.6vw, 24px); text-transform: uppercase; line-height: 1.1; }
.mx-player.started .mx-title { opacity: 0; }
.mx-resume { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 8px; z-index: 3; }
.mx-resume button { border: 0; border-radius: 99px; padding: 8px 14px; font: 700 13px Montserrat, sans-serif; cursor: pointer; background: rgba(255, 255, 255, .92); color: var(--navy); white-space: nowrap; }
.mx-resume button + button { background: rgba(6, 18, 43, .55); color: #fff; }
.mx-player.started .mx-resume { display: none; }

.mx-ui { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 12px 10px; background: linear-gradient(180deg, transparent, rgba(4, 12, 30, .82)); color: #fff; z-index: 4; transition: opacity .25s; }
.mx-player:not(.started) .mx-ui { opacity: 0; pointer-events: none; }
.mx-player.idle .mx-ui { opacity: 0; }
.mx-player.idle { cursor: none; }
.mx-seek { position: relative; height: 18px; display: flex; align-items: center; cursor: pointer; margin: 0 4px 4px; touch-action: none; }
.mx-track { position: relative; width: 100%; height: 4px; background: rgba(255, 255, 255, .25); border-radius: 99px; transition: height .15s; }
.mx-seek:hover .mx-track, .mx-seek.drag .mx-track { height: 6px; }
.mx-buf, .mx-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; }
.mx-buf { background: rgba(255, 255, 255, .35); }
.mx-fill { background: #4aa3ff; }
.mx-knob { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(74, 163, 255, .45); }
.mx-tick { position: absolute; top: -1px; bottom: -1px; width: 3px; margin-left: -1.5px; background: rgba(255, 255, 255, .85); border-radius: 2px; }
.mx-tip { position: absolute; bottom: 22px; transform: translateX(-50%); background: rgba(4, 12, 30, .9); padding: 3px 8px; border-radius: 8px; font-size: 12px; font-weight: 700; white-space: nowrap; pointer-events: none; display: none; }
.mx-seek:hover .mx-tip, .mx-seek.drag .mx-tip { display: block; }
.mx-bar { display: flex; align-items: center; gap: 4px; }
.mx-b { background: none; border: 0; color: #fff; height: 38px; min-width: 38px; padding: 0 8px; border-radius: 10px; cursor: pointer; display: inline-grid; place-items: center; font: 800 13px Montserrat, sans-serif; }
.mx-b:hover { background: rgba(255, 255, 255, .14); }
.mx-b svg { width: 22px; height: 22px; fill: #fff; }
.mx-time { font: 700 13px Montserrat, sans-serif; font-variant-numeric: tabular-nums; padding: 0 8px; white-space: nowrap; opacity: .92; }
.mx-sp { flex: 1; }
.mx-mark { position: absolute; z-index: 2; color: rgba(255, 255, 255, .3); font-weight: 800; font-size: 12px; pointer-events: none; transition: all 1.2s ease; text-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.mx-flash { position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; background: rgba(4, 12, 30, .55); color: #fff; font-weight: 800; padding: 10px 16px; border-radius: 99px; opacity: 0; transition: opacity .25s; pointer-events: none; }
.mx-flash.l { left: 12%; } .mx-flash.r { right: 12%; }
.mx-flash.show { opacity: 1; }
.mx-spin { position: absolute; left: 50%; top: 50%; margin: -20px 0 0 -20px; width: 40px; height: 40px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .25); border-top-color: #fff; animation: spin .8s linear infinite; z-index: 3; display: none; }
.mx-player.wait .mx-spin { display: block; }
.mx-err { position: absolute; inset: 0; display: none; place-items: center; text-align: center; color: #fff; padding: 20px; background: rgba(6, 18, 43, .85); z-index: 5; font-weight: 700; }
.mx-player.err .mx-err { display: grid; }
@media (max-width: 520px) {
  .mx-b { min-width: 34px; padding: 0 5px; }
  .mx-hide-sm { display: none; }
  .mx-title { display: none; }
  .mx-big { width: 64px; height: 64px; margin: -32px 0 0 -32px; }
  .mx-resume button { padding: 7px 11px; font-size: 12px; }
  .card { padding: 16px; }
}
.tg-login { min-height: 46px; display: flex; justify-content: center; }
