:root {
  --bg: #000;
  --card: #141416;
  --card-2: #1c1c1f;
  --field: #232326;
  --field-2: #2c2c30;
  --line: rgba(255, 255, 255, .07);
  --text: #fff;
  --text-2: #8e8e93;
  --text-3: #5b5b60;
  --ok: #34c759;
  --bad: #ff453a;
  --warn: #ffb340;
  --glow: 168, 84, 15;
  --r-card: 22px;
  --r-tile: 18px;
  --r-field: 14px;
  --pad: 16px;
  --tabbar-h: 64px;
  --safe-b: max(env(safe-area-inset-bottom), 10px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.35 -apple-system, "SF Pro Text", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  min-height: 100vh;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { display: block; }

#app { min-height: 100vh; }
.page { padding: 12px var(--pad) calc(var(--tabbar-h) + var(--safe-b) + 28px); animation: fade .22s ease; }
.page.no-tabs { padding-bottom: calc(var(--safe-b) + 24px); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- glow (как экраны входа ABR) ---------- */
.glow::before {
  content: ""; position: fixed; inset: 0 0 auto 0; height: 46vh; pointer-events: none; z-index: -1;
  background: radial-gradient(120% 90% at 85% -10%, rgba(var(--glow), .55), rgba(var(--glow), .12) 45%, transparent 75%);
}

/* ---------- typography ---------- */
.caption { color: var(--text-2); font-size: 13px; }
.title { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin: 2px 0 0; }
.h2 { font-size: 20px; font-weight: 650; letter-spacing: -.01em; margin: 26px 2px 12px; }
.h-center { text-align: center; font-size: 24px; font-weight: 650; margin: 0 0 22px; letter-spacing: -.01em; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; color: var(--text-2); }
.center { text-align: center; }

/* ---------- header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin-bottom: 14px; }
.top .grow { flex: 1; min-width: 0; }
.top .name { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.round {
  width: 40px; height: 40px; border-radius: 50%; background: var(--card-2); display: grid; place-items: center;
  flex: none; transition: transform .15s;
}
.round:active { transform: scale(.92); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--field-2); display: grid; place-items: center;
  font-weight: 600; font-size: 15px; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.pill-btn {
  height: 36px; padding: 0 14px; border-radius: 999px; background: var(--card-2); display: inline-flex;
  align-items: center; gap: 6px; font-size: 14px; font-weight: 500; white-space: nowrap;
}
.pill-btn:active { opacity: .7; }

/* ---------- search pill ---------- */
.search {
  height: 48px; border-radius: 999px; background: var(--card-2); display: flex; align-items: center;
  justify-content: center; gap: 8px; color: var(--text); font-size: 15px; width: 100%;
}
.search input { background: none; border: 0; outline: none; flex: 1; height: 100%; padding: 0 4px; }
.search.left { justify-content: flex-start; padding: 0 16px; }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--r-card); padding: 16px; }
.card + .card { margin-top: 10px; }
.card.tap:active { transform: scale(.985); }
.card.tap { transition: transform .15s; }
.card.outline { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); }
.stack > * + * { margin-top: 10px; }

/* hero carousel */
.carousel { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 calc(-1 * var(--pad));
  padding: 0 var(--pad); scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.hero {
  flex: 0 0 82%; scroll-snap-align: center; height: 230px; border-radius: var(--r-card); padding: 18px;
  display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
  background: #17120d;
}
.hero::before { content: ""; position: absolute; inset: 0; z-index: 0;
  background: radial-gradient(90% 80% at 100% 0%, rgba(var(--glow), .85), transparent 70%),
              radial-gradient(70% 60% at 0% 100%, rgba(255, 255, 255, .06), transparent 70%); }
.hero.cool { background: #0d1117; }
.hero.cool::before { background: radial-gradient(90% 80% at 100% 0%, rgba(55, 95, 160, .75), transparent 70%); }
.hero.mono { background: #111; }
.hero.mono::before { background: radial-gradient(90% 80% at 100% 0%, rgba(255, 255, 255, .16), transparent 70%); }
.hero > * { position: relative; z-index: 1; }
.hero .badge { align-self: flex-start; }
.hero .big { font-size: 25px; font-weight: 700; line-height: 1.12; letter-spacing: -.02em; }
.hero .meta { color: rgba(255, 255, 255, .72); font-size: 14px; margin-top: 8px; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 26px; white-space: nowrap; flex: none; padding: 0 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .12); font-size: 12.5px; font-weight: 600; backdrop-filter: blur(10px); }
.badge.white { background: #fff; color: #000; }
.badge.ok { background: rgba(52, 199, 89, .16); color: var(--ok); }
.badge.bad { background: rgba(255, 69, 58, .16); color: var(--bad); }
.badge.warn { background: rgba(255, 179, 64, .16); color: var(--warn); }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.tile { text-align: center; }
.tile .box { height: 84px; border-radius: var(--r-tile); background: var(--card); display: grid; place-items: center;
  font-size: 36px; transition: transform .15s; position: relative; }
.tile:active .box { transform: scale(.94); }
.tile .lbl { margin-top: 9px; font-size: 13.5px; font-weight: 500; }
.dot { position: absolute; top: 9px; right: 9px; min-width: 18px; height: 18px; border-radius: 9px; background: #fff;
  color: #000; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 5px; }

/* progress card */
.progress-card { background: linear-gradient(180deg, #2b3640 0%, #1b2128 100%); }
.progress-card.warm { background: linear-gradient(180deg, #3a2b1f 0%, #1f1813 100%); }
.segments { display: flex; gap: 6px; margin: 16px 0 10px; }
.segments i { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .22); }
.segments i.on { background: #fff; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* list menu (профиль ABR) */
.menu { background: var(--card); border-radius: var(--r-card); padding: 4px 0; }
.menu + .menu { margin-top: 10px; }
.item { display: flex; align-items: center; gap: 13px; padding: 13px 16px; min-height: 52px; width: 100%; text-align: left; }
.item:active { background: rgba(255, 255, 255, .04); }
.item .ic { color: var(--text); opacity: .9; flex: none; }
.item .body { flex: 1; min-width: 0; }
.item .t { font-size: 15px; }
.item .s { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.item .end { color: var(--text-2); display: flex; align-items: center; gap: 6px; font-size: 14px; flex: none; }
.item.danger .t, .item.danger .ic { color: var(--bad); }
.menu .item + .item { border-top: 1px solid var(--line); }

/* ---------- lessons ---------- */
.week { display: flex; gap: 6px; margin: 4px 0 16px; }
.day-chip { flex: 1; height: 58px; border-radius: 16px; background: var(--card); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; position: relative; transition: background .15s; }
.day-chip .wd { font-size: 11.5px; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.day-chip .dn { font-size: 17px; font-weight: 600; }
.day-chip.on { background: #fff; color: #000; }
.day-chip.on .wd { color: rgba(0, 0, 0, .55); }
.day-chip .pip { position: absolute; bottom: 6px; width: 4px; height: 4px; border-radius: 2px; background: var(--text-3); }
.day-chip.on .pip { background: rgba(0, 0, 0, .35); }
.day-chip.today:not(.on) { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }

.lesson { display: flex; gap: 14px; background: var(--card); border-radius: var(--r-card); padding: 15px 16px; }
.lesson + .lesson { margin-top: 8px; }
.lesson .time { width: 44px; flex: none; font-variant-numeric: tabular-nums; }
.lesson .time b { display: block; font-size: 15px; font-weight: 600; }
.lesson .time span { font-size: 12.5px; color: var(--text-2); }
.lesson .info { flex: 1; min-width: 0; }
.lesson .subj { font-size: 15.5px; font-weight: 600; line-height: 1.25; }
.lesson .meta { color: var(--text-2); font-size: 13px; margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.lesson .note { margin-top: 7px; font-size: 12.5px; color: var(--warn); }
.lesson.now { box-shadow: inset 0 0 0 1.5px #fff; }
.lesson.past { opacity: .45; }
.type { display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-2); margin-bottom: 4px; }
.type.lec { color: #8fb5ff; }
.type.prac { color: #7fd99a; }
.type.pe { color: #ff9fd1; }
.type.info { color: var(--warn); }

/* ---------- segmented ---------- */
.seg { display: flex; background: var(--card-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { flex: 1; height: 34px; border-radius: 999px; font-size: 13.5px; font-weight: 500; color: var(--text-2);
  transition: all .18s; white-space: nowrap; padding: 0 10px; }
.seg button.on { background: #fff; color: #000; }
.seg.inline { display: inline-flex; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad);
  scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { height: 36px; padding: 0 14px; border-radius: 999px; background: var(--card-2); font-size: 14px; flex: none;
  display: inline-flex; align-items: center; gap: 6px; transition: all .15s; }
.chip.on { background: #fff; color: #000; }

/* ---------- toggle rows ---------- */
.check { width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 1.6px var(--text-3); flex: none;
  display: grid; place-items: center; transition: all .15s; }
.check.on { background: #fff; box-shadow: none; color: #000; }
.check.bad.on { background: var(--bad); color: #fff; }
.pair-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; width: 100%; text-align: left; }
.menu .pair-row + .pair-row { border-top: 1px solid var(--line); }
.pair-row .n { width: 22px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------- forms ---------- */
.field { width: 100%; height: 50px; border-radius: var(--r-field); background: var(--field); border: 0; outline: none;
  padding: 0 16px; font-size: 15px; transition: box-shadow .15s; }
textarea.field { height: auto; min-height: 110px; padding: 14px 16px; resize: vertical; line-height: 1.4; }
.field::placeholder { color: var(--text-3); }
.field:focus { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .35); }
input[type=date].field, input[type=datetime-local].field { -webkit-appearance: none; appearance: none; }
.form > * + * { margin-top: 10px; }
.label { font-size: 13px; color: var(--text-2); margin: 16px 4px 8px; }
.hint { font-size: 12px; color: var(--text-2); margin: 10px 4px 0; line-height: 1.4; }
.file-pick { display: flex; align-items: center; gap: 10px; height: 50px; border-radius: var(--r-field);
  background: var(--field); padding: 0 16px; color: var(--text-2); }
.file-pick input { display: none; }

.btn { height: 52px; border-radius: 999px; width: 100%; font-size: 15.5px; font-weight: 600; display: flex;
  align-items: center; justify-content: center; gap: 8px; transition: transform .12s, opacity .15s; }
.btn:active { transform: scale(.98); }
.btn.primary { background: #fff; color: #000; }
.btn.secondary { background: var(--card-2); color: var(--text); }
.btn.danger { background: var(--card-2); color: var(--bad); }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btns { display: flex; gap: 10px; }
.btns .btn { flex: 1; }
.sticky-cta { position: sticky; bottom: calc(var(--safe-b) + 8px); margin-top: 20px; }

/* ---------- tab bar (плавающая капсула) ---------- */
.tabbar {
  position: fixed; left: var(--pad); right: var(--pad); bottom: var(--safe-b); height: var(--tabbar-h);
  border-radius: 999px; background: rgba(30, 30, 33, .82); backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%); display: flex; align-items: center; padding: 6px; z-index: 20;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.tabbar button { flex: 1; height: 100%; border-radius: 999px; display: grid; place-items: center; color: var(--text-2);
  transition: all .2s; position: relative; }
.tabbar button.on { background: rgba(255, 255, 255, .13); color: #fff; }
.tabbar .dot { top: 7px; right: calc(50% - 20px); }

/* ---------- sheet ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 40; animation: ov .2s ease; }
@keyframes ov { from { opacity: 0; } }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto; z-index: 41;
  background: #121214; border-radius: 26px 26px 0 0; padding: 10px var(--pad) calc(var(--safe-b) + 18px);
  animation: up .28s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 -1px 0 rgba(255, 255, 255, .06); }
@keyframes up { from { transform: translateY(100%); } }
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--field-2); margin: 0 auto 14px; }
.sheet h3 { font-size: 21px; margin: 4px 0 6px; letter-spacing: -.01em; }

/* ---------- empty / states ---------- */
.empty { text-align: center; padding: 46px 20px; color: var(--text-2); }
.empty .em { font-size: 44px; margin-bottom: 12px; }
.empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 6px; }
.state { min-height: calc(100vh - 140px); display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: 20px; }
.state .ring { width: 60px; height: 60px; border-radius: 50%; box-shadow: inset 0 0 0 2px #fff; display: grid;
  place-items: center; font-size: 28px; font-weight: 300; margin-bottom: 22px; }
.state h1 { font-size: 23px; font-weight: 650; line-height: 1.22; margin: 0 0 12px; letter-spacing: -.01em; }
.state p { color: var(--text-2); margin: 0; line-height: 1.45; max-width: 320px; }

.skeleton { background: linear-gradient(90deg, var(--card) 0%, var(--card-2) 50%, var(--card) 100%);
  background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r-card); }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px); transform: translateX(-50%);
  background: #fff; color: #000; padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 500;
  z-index: 60; animation: toast .25s ease; max-width: calc(100% - 40px); text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .4); }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 8px); } }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.kv:first-child { border-top: 0; }
.kv .k { color: var(--text-2); }
.kv .v { text-align: right; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--card); border-radius: var(--r-tile); padding: 14px; }
.stat b { display: block; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.stat span { font-size: 12.5px; color: var(--text-2); }
.queue-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; }
.queue-row .pos { width: 30px; height: 30px; border-radius: 50%; background: var(--field); display: grid;
  place-items: center; font-size: 13px; font-weight: 600; flex: none; }
.queue-row.me .pos { background: #fff; color: #000; }
.menu .queue-row + .queue-row { border-top: 1px solid var(--line); }
.desc { white-space: pre-wrap; line-height: 1.45; }
.link-out { color: #fff; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .3); }
.spacer { height: 12px; }
.mt { margin-top: 18px; }

.lesson.skip { box-shadow: inset 0 0 0 1px rgba(255, 69, 58, .35); }
.lesson.skip .subj { color: var(--text-2); }
.skip-lbl { margin-top: 7px; font-size: 12.5px; font-weight: 600; color: var(--bad); }
