/* Расписание · КТ МТУСИ — mini app styles.
   Tokens first; Telegram's theme (--tg-theme-*) wins over our defaults (--d-*), the brand stays the accent. */

@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("./fonts/montserrat-cyrillic-400-normal.woff2") format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("./fonts/montserrat-cyrillic-500-normal.woff2") format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("./fonts/montserrat-cyrillic-600-normal.woff2") format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("./fonts/montserrat-cyrillic-700-normal.woff2") format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("./fonts/montserrat-latin-400-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: "Montserrat"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("./fonts/montserrat-latin-500-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: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("./fonts/montserrat-latin-600-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: "Montserrat"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("./fonts/montserrat-latin-700-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; }

/* ---------------------------------------------------------------- tokens */

:root {
  --brand: #372579;
  --black: #151515;

  /* spacing: 4-step scale */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;
  /* type scale */
  --fs-xs: 11px; --fs-s: 12.5px; --fs-m: 14px; --fs-b: 15px; --fs-l: 17px; --fs-xl: 21px; --fs-xxl: 27px; --fs-hero: 34px;
  /* radii by hierarchy: big surfaces round more */
  --r-xl: 22px; --r-lg: 18px; --r-md: 14px; --r-sm: 10px; --r-pill: 999px;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --t-fast: 150ms; --t: 220ms; --t-slow: 320ms;

  --safe-top: max(env(safe-area-inset-top, 0px), calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --nav-h: 64px;

  /* light defaults */
  --d-bg: #F2F1F7;
  --d-surface: #FFFFFF;
  --d-text: #151515;
  --d-hint: #6B677B;
  --accent: #372579;          /* text / icons in accent */
  --accent-fill: #372579;     /* solid fills (selected tile, primary buttons) */
  --on-accent: #FFFFFF;
  --accent-soft: rgba(55, 37, 121, .08);
  --accent-soft-2: rgba(55, 37, 121, .14);
  --hero: #372579;
  --hero-2: #4A35A0;
  --line: rgba(21, 21, 21, .07);
  --line-strong: rgba(21, 21, 21, .12);
  --skeleton: rgba(21, 21, 21, .06);
  --shadow-1: 0 1px 2px rgba(21, 21, 21, .04), 0 6px 18px -10px rgba(55, 37, 121, .22);
  --shadow-2: 0 2px 6px rgba(21, 21, 21, .05), 0 16px 40px -16px rgba(55, 37, 121, .35);
  --glass: rgba(255, 255, 255, .72);
  --scrim: rgba(16, 12, 36, .38);

  /* status: bar colour + readable ink + soft background */
  --amber: #E8A23A; --amber-ink: #935700; --amber-soft: rgba(232, 162, 58, .15);
  --red: #E5484D;   --red-ink: #BF2A30;   --red-soft: rgba(229, 72, 77, .12);
  --blue: #2E9BE6;  --blue-ink: #13699F;  --blue-soft: rgba(46, 155, 230, .13);
  --violet: #8E5CF0; --violet-ink: #6A3DCC; --violet-soft: rgba(142, 92, 240, .12);
  --grey: #9C98AA;  --grey-ink: #5E5A6E;  --grey-soft: rgba(94, 90, 110, .1);
  --green-ok: #2E9E5B;

  /* subject palette: muted, away from the status hues; ink >= 4.5:1 on the surface */
  --p0: #2AA198; --p0-ink: #0F6E66;
  --p1: #4E9F5C; --p1-ink: #2B6A37;
  --p2: #9AA435; --p2-ink: #5A6312;
  --p3: #4C72E0; --p3-ink: #2E4FB5;
  --p4: #7A8BA6; --p4-ink: #4A5A73;
  --p5: #B98152; --p5-ink: #83542A;
  --p6: #D0649B; --p6-ink: #A2366B;
  --p7: #B09A5E; --p7-ink: #6B5A2E;
  --p8: #3E95B3; --p8-ink: #21667D;
  --p9: #6E73D9; --p9-ink: #4A4FB0;

  color-scheme: light;
}

/* Dark tokens: app.js sets data-theme from Telegram's colorScheme, or from prefers-color-scheme outside it. */
:root[data-theme="dark"] {
  --d-bg: #111016;
  --d-surface: #1D1C24;
  --d-text: #F3F2F8;
  --d-hint: #9C98AE;
  --accent: #B4A6FF;
  --accent-fill: #5440C0;
  --on-accent: #FFFFFF;
  --accent-soft: rgba(180, 166, 255, .1);
  --accent-soft-2: rgba(180, 166, 255, .18);
  --hero: #3B2A8F;
  --hero-2: #5440C0;
  --line: rgba(255, 255, 255, .07);
  --line-strong: rgba(255, 255, 255, .12);
  --skeleton: rgba(255, 255, 255, .07);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 18px 40px -18px rgba(0, 0, 0, .7);
  --glass: rgba(29, 28, 36, .72);
  --scrim: rgba(0, 0, 0, .55);
  --amber: #F5B85C; --amber-ink: #F5B85C; --amber-soft: rgba(245, 184, 92, .14);
  --red: #FF7A7F;   --red-ink: #FF8A8E;   --red-soft: rgba(255, 122, 127, .13);
  --blue: #5BB6F2;  --blue-ink: #6CC0F5;  --blue-soft: rgba(91, 182, 242, .13);
  --violet: #B394FF; --violet-ink: #BFA2FF; --violet-soft: rgba(179, 148, 255, .14);
  --grey: #77738A;  --grey-ink: #B3AFC3;  --grey-soft: rgba(179, 175, 195, .1);
  --p0: #4FC2B7; --p0-ink: #5FD3C7;
  --p1: #6DBB7A; --p1-ink: #7DCB8A;
  --p2: #B4BD5C; --p2-ink: #C3CC6A;
  --p3: #7E9CF5; --p3-ink: #93AEFF;
  --p4: #95A3BA; --p4-ink: #A9B6CC;
  --p5: #CF9A6B; --p5-ink: #DDA97A;
  --p6: #E57FB1; --p6-ink: #F08DBE;
  --p7: #C3AE78; --p7-ink: #D2BD86;
  --p8: #62B2CD; --p8-ink: #74C3DD;
  --p9: #9599F5; --p9-ink: #A9ACFF;
  color-scheme: dark;
}

:root {
  --bg: var(--tg-theme-secondary-bg-color, var(--d-bg));
  --surface: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, var(--d-surface)));
  --text: var(--tg-theme-text-color, var(--d-text));
  --hint: var(--tg-theme-hint-color, var(--d-hint));
}

/* ---------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: var(--fs-b);
  line-height: 1.4;
  font-feature-settings: "tnum" 1, "lnum" 1;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; text-align: inherit; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 1em; height: 1em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app { max-width: 480px; margin: 0 auto; position: relative; min-height: 100vh; min-height: 100dvh; }
.view {
  padding: calc(var(--safe-top) + var(--s4)) var(--s4) calc(var(--nav-h) + var(--safe-bottom) + var(--s8));
  min-height: 100vh;
}

/* ---------------------------------------------------------------- header */

.wordmark {
  display: flex; align-items: center; gap: var(--s2);
  font-size: var(--fs-s); font-weight: 600; color: var(--hint); letter-spacing: .01em;
  margin: var(--s1) 0 var(--s3);
}
.wordmark__glyph { display: grid; grid-template-columns: repeat(3, 4px); gap: 2px; }
.wordmark__glyph span { width: 4px; height: 4px; border-radius: 1.5px; background: var(--accent); opacity: .9; }
.wordmark__glyph span:nth-child(2n) { opacity: .45; }

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s3); }
.head__title {
  margin: 0; font-size: var(--fs-xxl); font-weight: 700; line-height: 1.1; letter-spacing: -.025em;
  min-width: 0;
}
.head__sub { margin: var(--s1) 0 0; color: var(--hint); font-size: var(--fs-m); font-weight: 500; }
.head__arrows { display: flex; gap: var(--s2); flex: none; }

.round-btn {
  width: 44px; height: 44px; border-radius: var(--r-pill); display: grid; place-items: center;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); font-size: 20px;
  transition: transform var(--t-fast) var(--ease), opacity var(--t-fast);
}
.round-btn:active { transform: scale(.92); }
.round-btn:disabled { opacity: .35; cursor: default; box-shadow: none; }

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 var(--s3);
  border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--shadow-1);
  font-size: var(--fs-m); font-weight: 600; white-space: nowrap;
}
.chip svg.i { font-size: 15px; color: var(--hint); }
button.chip { min-height: 36px; transition: transform var(--t-fast) var(--ease); }
button.chip:active { transform: scale(.96); }
.chip--quiet { background: var(--accent-soft); box-shadow: none; color: var(--accent); }

/* ---------------------------------------------------------------- tiles */

.tiles {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2);
  margin-top: var(--s5);
}
.tile {
  position: relative; display: flex; flex-direction: column; gap: var(--s2);
  min-height: 112px; padding: var(--s3) var(--s3) 10px; border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow-1);
  transition: transform var(--t-fast) var(--ease), background-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.tile:active { transform: scale(.965); }
.tile__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s1); }
.tile__num { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.tile__wd { font-size: var(--fs-s); font-weight: 600; color: var(--hint); }
.tile__foot { display: flex; flex-direction: column; font-size: var(--fs-xs); font-weight: 500; color: var(--hint); line-height: 1.3; margin-top: auto; }
.tile__foot span:first-child { font-weight: 600; }
.tile__bars { display: flex; align-items: flex-end; gap: 4px; height: 30px; }
.bar {
  flex: 1 1 0; max-width: 9px; height: 100%; border-radius: 3px; background: var(--c, var(--grey));
  transform-origin: bottom;
}
.bar.is-empty { height: 4px; background: var(--line-strong); }
.bar.is-teacher { box-shadow: 0 0 0 1.5px var(--surface), 0 0 0 3px var(--violet); }
.bar.is-dropped { background: repeating-linear-gradient(-45deg, var(--red) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1.5px var(--red); }
.tile__badge {
  position: absolute; top: -5px; right: -4px; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--r-pill); display: grid; place-items: center;
  background: var(--amber); color: #2A1A00; font-size: var(--fs-xs); font-weight: 700;
  box-shadow: 0 0 0 2px var(--bg);
}
.tile.is-today { box-shadow: 0 0 0 2px var(--accent), 0 8px 22px -10px var(--accent); }
.tile.is-today .tile__wd { color: var(--accent); display: inline-flex; align-items: center; gap: 4px; }
.tile.is-today .tile__wd::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tile.is-selected { background: var(--accent-fill); color: var(--on-accent); box-shadow: var(--shadow-2); }
.tile.is-selected.is-today { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-fill), var(--shadow-2); }
.tile.is-selected .tile__wd, .tile.is-selected .tile__foot { color: rgba(255, 255, 255, .78); }
.tile.is-selected .bar.is-empty { background: rgba(255, 255, 255, .22); }
.tile.is-selected .bar.is-teacher { box-shadow: 0 0 0 1.5px var(--accent-fill), 0 0 0 3px #fff; }
.tile.is-selected .tile__badge { box-shadow: 0 0 0 2px var(--bg); }
.tile.is-free .tile__bars { opacity: .6; }

/* ---------------------------------------------------------------- day details */

.day { margin-top: var(--s8); }
.day__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }
.day__title { margin: 0; font-size: var(--fs-l); font-weight: 700; letter-spacing: -.01em; }
.day__meta { color: var(--hint); font-size: var(--fs-s); font-weight: 600; white-space: nowrap; }
.callout {
  display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s3) var(--s4); margin-bottom: var(--s3);
  border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent); font-size: var(--fs-m); font-weight: 500;
}
.callout svg.i { font-size: 18px; margin-top: 1px; }
.list { display: flex; flex-direction: column; gap: 10px; }

/* ---------------------------------------------------------------- lesson card */

.lesson {
  position: relative; display: grid; grid-template-columns: 58px 1fr; gap: var(--s3);
  width: 100%; padding: 14px var(--s4) 14px 14px; border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden;
  transition: transform var(--t-fast) var(--ease), opacity var(--t) var(--ease);
}
.lesson:active { transform: scale(.985); }
.lesson::before {  /* subject strip */
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0;
  background: var(--c, var(--grey));
}
.lesson__time { display: flex; flex-direction: column; padding-left: 6px; }
.lesson__start { font-size: var(--fs-l); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.lesson__end { font-size: var(--fs-s); font-weight: 500; color: var(--hint); }
.lesson__num { margin-top: auto; padding-top: var(--s2); font-size: var(--fs-xs); font-weight: 600; color: var(--hint); }
.lesson__body { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.lesson__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s2); }
.lesson__code { font-size: var(--fs-b); font-weight: 700; color: var(--ink, var(--text)); letter-spacing: -.005em; overflow-wrap: anywhere; }
.lesson__name { font-size: var(--fs-m); font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.lesson__was { font-size: var(--fs-s); color: var(--hint); line-height: 1.35; }
.lesson__was s { text-decoration-thickness: 1.5px; text-decoration-color: var(--red); }
.lesson__meta { display: flex; align-items: center; gap: 6px; font-size: var(--fs-s); color: var(--hint); font-weight: 500; }
.lesson__meta svg.i { font-size: 14px; }
.lesson__note {
  display: flex; gap: 6px; align-items: flex-start; margin-top: 2px; padding: 6px 10px; border-radius: var(--r-sm);
  background: var(--accent-soft); color: var(--accent); font-size: var(--fs-s); font-weight: 500;
}
.lesson__note svg.i { font-size: 14px; margin-top: 2px; }
.lesson__note span { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.room {
  flex: none; display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px;
  border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent);
  font-size: var(--fs-s); font-weight: 700; white-space: nowrap;
}
.room svg.i { font-size: 13px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .01em; white-space: nowrap;
}
.badge--amber { background: var(--amber-soft); color: var(--amber-ink); }
.badge--red { background: var(--red-soft); color: var(--red-ink); }
.badge--blue { background: var(--blue-soft); color: var(--blue-ink); }
.badge--violet { background: var(--violet-soft); color: var(--violet-ink); }
.badge--grey { background: var(--grey-soft); color: var(--grey-ink); }
.badge--now { background: var(--accent-fill); color: var(--on-accent); }
.badge--next { background: var(--accent-soft-2); color: var(--accent); }
.badge--now::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.6s ease-in-out infinite;
}

.lesson.is-past { opacity: .5; box-shadow: none; }
.lesson.is-now { box-shadow: 0 0 0 2px var(--accent), var(--shadow-2); }
.lesson.is-dropped .lesson__code, .lesson.is-dropped .lesson__name { text-decoration: line-through; text-decoration-color: var(--red); color: var(--hint); }
.lesson.is-dropped { background: color-mix(in srgb, var(--surface) 92%, var(--red)); }
.progress { height: 4px; border-radius: 2px; background: var(--accent-soft-2); overflow: hidden; margin-top: 6px; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); width: var(--p, 0%); transition: width 600ms var(--ease); }

/* ---------------------------------------------------------------- hero (today) */

.hero {
  position: relative; overflow: hidden; margin-top: var(--s5); padding: var(--s5); border-radius: var(--r-xl);
  background: var(--hero); color: #fff; box-shadow: var(--shadow-2); isolation: isolate;
}
.hero::after {  /* the tile grid motif, faint, in the corner */
  content: ""; position: absolute; z-index: -1; right: -14px; top: -14px; width: 132px; height: 92px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 132 92'%3E%3Cg fill='%23fff'%3E%3Crect x='0' y='0' width='40' height='42' rx='10' opacity='.025'/%3E%3Crect x='46' y='0' width='40' height='42' rx='10' opacity='.045'/%3E%3Crect x='92' y='0' width='40' height='42' rx='10' opacity='.025'/%3E%3Crect x='0' y='48' width='40' height='42' rx='10' opacity='.045'/%3E%3Crect x='46' y='48' width='40' height='42' rx='10' opacity='.025'/%3E%3Crect x='92' y='48' width='40' height='42' rx='10' opacity='.045'/%3E%3C/g%3E%3C/svg%3E") no-repeat;
}
.hero__label {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .14); font-size: var(--fs-s); font-weight: 600;
}
.hero__label.is-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #7CF0B0; animation: pulse 1.6s ease-in-out infinite; }
.hero__row { display: flex; gap: var(--s4); align-items: flex-start; justify-content: space-between; margin-top: var(--s4); }
.hero__main { min-width: 0; }
.hero__title { margin: 0; font-size: var(--fs-xxl); font-weight: 700; letter-spacing: -.025em; line-height: 1.1; overflow-wrap: anywhere; }
.hero__name { margin-top: 6px; font-size: var(--fs-b); font-weight: 500; line-height: 1.35; color: rgba(255, 255, 255, .86); overflow-wrap: anywhere; }
.hero__facts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-top: var(--s4); }
.hero__room {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: var(--r-md);
  background: #fff; color: var(--brand); font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.02em;
}
.hero__room svg.i { font-size: 18px; }
.hero__teacher { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-m); font-weight: 500; color: rgba(255, 255, 255, .86); }
.hero__foot {
  display: flex; align-items: center; gap: var(--s2); margin-top: var(--s5); padding-top: var(--s4);
  border-top: 1px solid rgba(255, 255, 255, .14); font-size: var(--fs-m); font-weight: 500; color: rgba(255, 255, 255, .86);
}
.hero__foot b { color: #fff; font-weight: 700; }
.hero__big { font-size: var(--fs-hero); font-weight: 700; letter-spacing: -.035em; line-height: 1; }
.ring { position: relative; width: 84px; height: 84px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring .ring__track { stroke: rgba(255, 255, 255, .16); }
.ring .ring__value { stroke: #fff; stroke-linecap: round; transition: stroke-dashoffset 800ms var(--ease); }
.ring__text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.05; }
.ring__text b { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.03em; }
.ring__text span { font-size: var(--fs-xs); font-weight: 500; color: rgba(255, 255, 255, .75); }

.section-title { margin: var(--s8) 0 var(--s3); font-size: var(--fs-l); font-weight: 700; letter-spacing: -.01em; }

/* ---------------------------------------------------------------- search */

.search {
  position: relative; display: flex; align-items: center; margin-top: var(--s5);
}
.search svg.i.search__icon { position: absolute; left: 16px; font-size: 20px; color: var(--hint); pointer-events: none; }
.search input {
  width: 100%; height: 52px; padding: 0 48px 0 48px; border: 0; border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow-1); font-size: 16px; font-weight: 500;
  transition: box-shadow var(--t) var(--ease);
}
.search input::placeholder { color: var(--hint); font-weight: 500; }
.search input:focus { box-shadow: 0 0 0 2px var(--accent), var(--shadow-1); }
.search input::-webkit-search-cancel-button { display: none; }
.search__clear {
  position: absolute; right: 4px; width: 44px; height: 44px; display: grid; place-items: center;
  color: var(--hint); font-size: 18px; border-radius: var(--r-pill);
}
.hints { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.hint-text { margin: var(--s4) 2px 0; color: var(--hint); font-size: var(--fs-m); line-height: 1.5; }
.result-day { margin-top: var(--s6); }
.result-day__title { display: flex; justify-content: space-between; align-items: baseline; margin: 0 2px var(--s3); font-size: var(--fs-b); font-weight: 700; }
.result-day__title span { color: var(--hint); font-size: var(--fs-s); font-weight: 600; }
.result {
  position: relative; display: flex; flex-direction: column; gap: 4px; width: 100%;
  padding: 14px var(--s4) 14px 18px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1);
  overflow: hidden; transition: transform var(--t-fast) var(--ease);
}
.result:active { transform: scale(.985); }
.result::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c); }
.result__line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: var(--fs-s); font-weight: 600; color: var(--hint); }
.result__line b { color: var(--text); font-size: var(--fs-m); font-weight: 700; }
.result__line .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }
.result__subject { font-size: var(--fs-m); font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.result__subject b { color: var(--ink); font-weight: 700; }
.result__teacher { font-size: var(--fs-s); color: var(--hint); font-weight: 500; }
mark { background: var(--amber-soft); color: inherit; border-radius: 4px; padding: 0 2px; margin: 0 -2px; }

/* ---------------------------------------------------------------- settings */

.group-card { margin-top: var(--s5); }
.settings-section { margin-top: var(--s6); }
.settings-section__title { margin: 0 4px var(--s2); font-size: var(--fs-s); font-weight: 700; color: var(--hint); }
.card { border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden; }
.row { display: flex; flex-direction: column; gap: var(--s3); padding: 14px var(--s4); }
.row + .row { border-top: 1px solid var(--line); }
.row__main { display: flex; align-items: center; gap: var(--s3); }
.row__text { flex: 1; min-width: 0; }
.row__title { font-size: var(--fs-b); font-weight: 600; }
.row__desc { margin-top: 2px; font-size: var(--fs-s); color: var(--hint); line-height: 1.4; }
.row__extra { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.row.is-off .row__extra { opacity: .45; }

.switch {
  position: relative; flex: none; width: 52px; height: 32px; border-radius: var(--r-pill);
  background: var(--line-strong); transition: background-color var(--t) var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: transform var(--t) var(--ease-out);
}
.switch[aria-checked="true"] { background: var(--accent-fill); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.switch::before { content: ""; position: absolute; inset: -6px; }  /* 44px hit area */

.seg {
  display: flex; padding: 3px; border-radius: var(--r-md); background: var(--bg); gap: 2px; width: 100%;
}
.seg button {
  flex: 1 1 0; min-height: 38px; padding: 0 var(--s2); border-radius: 11px; font-size: var(--fs-m); font-weight: 600;
  color: var(--hint); text-align: center; transition: background-color var(--t) var(--ease), color var(--t) var(--ease), box-shadow var(--t);
}
.seg button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg--big button { min-height: 48px; font-size: var(--fs-l); font-weight: 700; }
.seg--small button { min-height: 32px; font-size: var(--fs-s); }
.sound {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--r-pill);
  background: var(--bg); font-size: var(--fs-s); font-weight: 600; color: var(--hint);
  transition: background-color var(--t), color var(--t);
}
.sound[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.sound svg.i { font-size: 15px; }
.sound::before { content: ""; position: absolute; }
.small-print a { color: inherit; text-decoration: underline; }
.small-print { margin: var(--s8) 0 0; text-align: center; color: var(--hint); font-size: var(--fs-xs); font-weight: 500; line-height: 1.6; }

/* ---------------------------------------------------------------- states */

.state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: var(--s10) var(--s5) var(--s8); }
.state__art {
  position: relative; width: 88px; height: 88px; border-radius: 28px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 40px; margin-bottom: var(--s5);
}
.state__art::after {
  content: ""; position: absolute; inset: -10px; border-radius: 36px; border: 1.5px dashed var(--accent-soft-2);
}
.state__title { margin: 0; font-size: var(--fs-l); font-weight: 700; }
.state__text { margin: var(--s2) 0 0; max-width: 300px; color: var(--hint); font-size: var(--fs-m); line-height: 1.5; }
.state .btn { margin-top: var(--s5); }
.state--card { margin-top: var(--s5); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1); padding: var(--s8) var(--s5); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 48px; padding: 0 var(--s5);
  border-radius: var(--r-md); background: var(--accent-fill); color: var(--on-accent); font-size: var(--fs-b); font-weight: 700;
  transition: transform var(--t-fast) var(--ease), opacity var(--t-fast);
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; }
.btn--ghost { background: var(--accent-soft); color: var(--accent); }
.btn--danger { background: var(--red-soft); color: var(--red-ink); }
.btn--block { width: 100%; }

.notice {
  display: flex; gap: var(--s3); align-items: flex-start; margin-top: var(--s4); padding: var(--s3) var(--s4);
  border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-1);
  font-size: var(--fs-s); color: var(--hint); font-weight: 500; line-height: 1.45;
}
.notice svg.i { font-size: 18px; color: var(--accent); margin-top: 1px; }

.foot { margin-top: var(--s8); text-align: center; color: var(--hint); font-size: var(--fs-xs); font-weight: 500; line-height: 1.7; }

.steps { margin: var(--s5) 0 0; padding: 0; list-style: none; text-align: left; display: flex; flex-direction: column; gap: var(--s3); width: 100%; max-width: 320px; }
.steps li { display: flex; gap: var(--s3); align-items: flex-start; font-size: var(--fs-m); line-height: 1.45; }
.steps li b { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: var(--fs-s); }

/* skeleton */
.sk { background: var(--skeleton); border-radius: var(--r-sm); position: relative; overflow: hidden; }
.sk::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
  animation: shimmer 1.3s ease-in-out infinite;
}
:root[data-theme="dark"] .sk::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent); }
.sk-tile { height: 112px; border-radius: var(--r-lg); }
.sk-card { height: 104px; border-radius: var(--r-lg); }
.sk-line { height: 14px; }

/* ---------------------------------------------------------------- nav */

.nav {
  position: fixed; z-index: 20; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 480px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 6px var(--s2) calc(6px + var(--safe-bottom));
  background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(1.8); backdrop-filter: blur(22px) saturate(1.8);
  border-top: 1px solid var(--line);
}
.nav__item {
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 52px; padding-top: 4px;
  color: var(--hint); font-size: var(--fs-xs); font-weight: 600; text-align: center;
  transition: color var(--t) var(--ease);
}
.nav__icon {
  width: 56px; height: 30px; display: grid; place-items: center; border-radius: var(--r-pill); font-size: 22px;
  transition: background-color var(--t) var(--ease), transform var(--t-fast) var(--ease);
}
.nav__item:active .nav__icon { transform: scale(.9); }
.nav__item[aria-current="page"] { color: var(--accent); }
.nav__item[aria-current="page"] .nav__icon { background: var(--accent-soft-2); }

/* ---------------------------------------------------------------- bottom sheet */

.scrim {
  position: fixed; inset: 0; z-index: 40; background: var(--scrim);
  opacity: 0; transition: opacity var(--t-slow) var(--ease);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.scrim.is-open { opacity: 1; }
.sheet {
  position: fixed; z-index: 41; left: 50%; bottom: 0; width: 100%; max-width: 480px;
  max-height: calc(var(--tg-viewport-height, 100vh) - var(--safe-top) - 24px);
  display: flex; flex-direction: column;
  border-radius: 26px 26px 0 0; background: var(--surface); box-shadow: 0 -12px 40px -12px rgba(0, 0, 0, .3);
  transform: translate(-50%, 100%); transition: transform var(--t-slow) var(--ease-out);
  will-change: transform;
}
.sheet.is-open { transform: translate(-50%, 0); }
.sheet.is-dragging { transition: none; }
.sheet__grab { flex: none; display: grid; place-items: center; height: 26px; touch-action: none; cursor: grab; }
.sheet__grab::before { content: ""; width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); }
.sheet__body { overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--s5) calc(var(--s6) + var(--safe-bottom)); }
.sheet .notice { background: var(--bg); box-shadow: none; }
.sheet__close {
  position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: var(--bg); color: var(--hint); font-size: 18px;
}
.sheet__close::before { content: ""; position: absolute; inset: -4px; }
.sheet h2 { margin: var(--s3) 48px 0 0; font-size: var(--fs-xxl); font-weight: 700; letter-spacing: -.025em; line-height: 1.12; color: var(--ink, var(--text)); overflow-wrap: anywhere; }
.sheet__name { margin: 6px 0 0; font-size: var(--fs-b); font-weight: 500; line-height: 1.4; overflow-wrap: anywhere; }
.sheet .badges { margin-top: var(--s2); padding-right: 48px; }
.facts { margin: var(--s5) 0 0; display: flex; flex-direction: column; border-radius: var(--r-md); background: var(--bg); }
.fact { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); }
.fact + .fact { border-top: 1px solid var(--line); }
.fact svg.i { font-size: 18px; color: var(--hint); margin-top: 1px; }
.fact__label { font-size: var(--fs-xs); font-weight: 600; color: var(--hint); }
.fact__value { font-size: var(--fs-b); font-weight: 600; overflow-wrap: anywhere; }
.fact__value s { text-decoration-color: var(--red); text-decoration-thickness: 1.5px; color: var(--hint); }
.fact__value small { display: block; font-size: var(--fs-s); font-weight: 500; color: var(--hint); }
.note-box { margin-top: var(--s5); }
.note-box__title { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 var(--s2); font-size: var(--fs-b); font-weight: 700; }
.note-box__title span { font-size: var(--fs-xs); font-weight: 600; color: var(--hint); }
.note-box textarea {
  width: 100%; min-height: 96px; resize: none; padding: var(--s3) var(--s4); border-radius: var(--r-md);
  border: 0; background: var(--bg); font-size: 16px; line-height: 1.45; font-weight: 500;
  transition: box-shadow var(--t);
}
.note-box textarea:focus { box-shadow: 0 0 0 2px var(--accent); }
.note-box__actions { display: flex; gap: var(--s2); margin-top: var(--s3); }
.note-box__actions .btn { flex: 1; }
.note-box__text { padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent); font-weight: 500; white-space: pre-wrap; overflow-wrap: anywhere; }
.pick { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s4); }
.pick button {
  display: flex; align-items: center; justify-content: space-between; min-height: 56px; padding: 0 var(--s4);
  border-radius: var(--r-md); background: var(--bg); font-size: var(--fs-l); font-weight: 700;
}
.pick button[aria-checked="true"] { background: var(--accent-fill); color: var(--on-accent); }
.pick button svg.i { font-size: 20px; }

/* the other subgroup's lessons: muted */
.lesson.is-other { opacity: .5; }
.bar.is-other { opacity: .3; }

/* group picker sheet: search, course segments, groups by direction */
.gp__search { margin-top: var(--s4); }
.gp__search input { background: var(--bg); box-shadow: none; height: 48px; }
.gp__search input:focus { box-shadow: 0 0 0 2px var(--accent); }
.gp__courses { margin-top: var(--s3); }
.gp__mine::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
.gp__list { margin-top: var(--s2); min-height: 40vh; }
.gp__group { margin-top: var(--s4); }
.gp__dir { margin: 0 2px var(--s2); font-size: var(--fs-s); font-weight: 700; color: var(--hint); letter-spacing: .02em; }
.gp__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.gp__item {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 48px; padding: 0 var(--s3) 0 var(--s4);
  border-radius: var(--r-md); background: var(--bg); font-size: var(--fs-m); font-weight: 700; text-align: left;
  transition: transform var(--t-fast) var(--ease);
}
.gp__item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp__item:active { transform: scale(.97); }
.gp__item[aria-checked="true"] { background: var(--accent-fill); color: var(--on-accent); }
.gp__item svg.i { flex: none; font-size: 18px; }
.gp__empty { margin: var(--s5) 2px; color: var(--hint); font-size: var(--fs-m); }
.group-card__name { font-size: var(--fs-l); font-weight: 700; }

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed; z-index: 60; left: 0; right: 0; margin: 0 auto; bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  width: fit-content; max-width: min(448px, calc(100% - 32px)); display: flex; align-items: center; gap: var(--s2);
  padding: 12px 18px; border-radius: var(--r-pill); background: var(--black); color: #fff;
  font-size: var(--fs-m); font-weight: 600; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5);
  transform: translateY(16px); opacity: 0; transition: transform var(--t) var(--ease-out), opacity var(--t);
}
:root[data-theme="dark"] .toast { background: #F3F2F8; color: var(--black); }
.toast.is-on { transform: none; opacity: 1; }
.toast svg.i { font-size: 18px; }
.toast--error svg.i { color: var(--red); }
.toast--ok svg.i { color: var(--green-ok); }

/* ---------------------------------------------------------------- motion */

@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleY(.2); opacity: 0; } to { transform: none; opacity: 1; } }
.enter { animation: rise var(--t) var(--ease-out) both; }
.tiles.is-fresh .bar:not(.is-empty) { animation: grow 420ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 22ms); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

@media (max-width: 350px) {
  :root { --fs-xxl: 24px; }
  .tile { padding: 10px 10px 8px; min-height: 104px; }
  .tile__foot { font-size: 10px; }
  .lesson { grid-template-columns: 52px 1fr; gap: 10px; }
  .lesson__start { font-size: var(--fs-b); }
}

/* Donations and the author's signature */
.donate .row { flex-direction: column; align-items: stretch; gap: var(--s3); }
.donate__stars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s2); }
.donate__stars .btn { padding-left: 0; padding-right: 0; justify-content: center; }
.sig { white-space: nowrap; }
.sig b { color: var(--accent); font-weight: 700; }

/* Accuracy disclaimer in the footer */
.foot__link { margin: 0; padding: 2px 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
