/* Веб-версия в том же виде, что приложение: палитры из Theme.swift, шрифты
   Onest (заголовки и крупные числа) и Golos Text (всё остальное), строки на
   фоне вместо карточек, заголовки разделов обычными буквами. Цвета задаёт
   theme.js переменными, здесь только их использование. */

/* Те же файлы, что в приложении: шрифты ставятся только со своего адреса. */
@font-face { font-family: "Onest"; font-weight: 600; font-display: swap; src: url("/fonts/Onest-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Golos Text"; font-weight: 400; font-display: swap; src: url("/fonts/GolosText-Regular.ttf") format("truetype"); }
@font-face { font-family: "Golos Text"; font-weight: 500; font-display: swap; src: url("/fonts/GolosText-Medium.ttf") format("truetype"); }
@font-face { font-family: "Golos Text"; font-weight: 600 700; font-display: swap; src: url("/fonts/GolosText-SemiBold.ttf") format("truetype"); }

:root {
  --bg: #0B1120;
  --surface: #131C31;
  --raised: #1D2944;
  --text: #EAF0FB;
  --text2: #9DAAC4;
  --text3: #6F7D99;
  --accent: #5E9BFF;
  --accent-text: #5E9BFF;
  --danger: #FF453A;
  /* Оттенки нового макета; theme.js подменяет их у других палитр. */
  --text-soft: #C9D2E3;
  --accent-soft: #8DB8FF;
  --accent-pale: #B5D0FF;
  --warn: #F2C46D;
  --cancel: #FF8A7A;
  --line: rgba(157, 170, 196, 0.12);
  /* Те же размеры, что в приложениях (Tokens.swift): скругления 12/16/24,
     шрифты 34/20/17/15/13/11. Других чисел в вёрстке быть не должно. */
  --radius-s: 12px;
  --radius: 16px;
  --radius-l: 24px;
  --fs-display: 34px;
  --fs-title: 20px;
  --fs-headline: 17px;
  --fs-body: 15px;
  --fs-caption: 13px;
  --fs-label: 11px;
  --gap: 16px;
  --tabbar: 64px;
  --sidebar: 248px;
  --heading: "Onest", "Golos Text", -apple-system, BlinkMacSystemFont, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 "Golos Text", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
h1, h2, p { margin: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.icon {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -4px;
}

/* ---------- Каркас ---------- */

/* На компьютере меню слева, на телефоне вкладки снизу. */
.main {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 16px calc(112px + env(safe-area-inset-bottom));
}

/* У гостя нет таб-бара внизу. */
.main.guest { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

.sidebar { display: none; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex;
  padding: 4px 8px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 97%, transparent);
  border-top: 1px solid rgba(157, 170, 196, 0.14);
}
.tabbar a {
  flex: 1 1 0; min-width: 0; height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; line-height: 14px; font-weight: 500;
  color: var(--text2);
}
.tabbar a:hover { text-decoration: none; }
.tabbar a.active { color: var(--accent-soft); font-weight: 600; }
.tabbar .nav-icon { display: flex; }
.tabbar .icon { width: 24px; height: 24px; vertical-align: 0; }

@media (min-width: 900px) {
  .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 24px;
    position: fixed; top: 0; bottom: 0; left: 0; width: var(--sidebar);
    padding: 24px 16px;
    border-right: 1px solid var(--line);
  }
  .side-nav { display: flex; flex-direction: column; gap: 4px; }
  .side-nav a {
    height: 44px; padding: 0 14px 0 12px; border-radius: 12px;
    display: flex; align-items: center; gap: 12px;
    color: var(--text-soft); font-size: 15px; font-weight: 500;
  }
  .side-nav .nav-icon { display: flex; }
  .side-nav .icon { width: 22px; height: 22px; vertical-align: 0; }
  .side-nav a:hover { background: rgba(255, 255, 255, 0.05); text-decoration: none; }
  .side-nav a.active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--text); font-weight: 600; }
  .side-nav a.active:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
  .side-nav a.active .nav-icon { color: var(--accent-soft); }
  .side-user {
    margin-top: auto; padding: 10px; border-radius: 16px;
    display: flex; align-items: center; gap: 12px; color: inherit;
  }
  .side-user:hover { background: rgba(255, 255, 255, 0.04); text-decoration: none; }
  .side-user-text { min-width: 0; display: flex; flex-direction: column; }
  .side-user-name { font-size: 14px; line-height: 19px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-user-role { font-size: 12px; line-height: 16px; color: var(--text2); }
  .main { margin-left: var(--sidebar); max-width: none; padding: 32px 40px 48px; }
  .main > .stack { max-width: 680px; margin: 0 auto; }
  .main > .wide { max-width: 1320px; margin: 0 auto; }
  /* У гостя нет меню слева. */
  .main.guest { margin-left: 0; }
}

/* На широком экране «Инфо» в две колонки: лента и сегодняшний день рядом. */
.info-layout { display: block; }
.info-layout .side-column { display: none; }
@media (min-width: 1200px) {
  .info-layout {
    display: grid; grid-template-columns: minmax(0, 680px) 340px; gap: 32px;
    justify-content: center; align-items: start;
  }
  .info-layout .side-column { display: flex; position: sticky; top: 32px; }
  .aside-title { padding-top: 58px; }
}

.stack { display: flex; flex-direction: column; gap: 20px; }
section { display: flex; flex-direction: column; gap: 8px; }

.page-header { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; }
.page-header h1 { font-family: var(--heading); font-size: 34px; line-height: 1.15; font-weight: 600; letter-spacing: -0.02em; }
.page-header .caption { color: var(--text2); font-size: 14px; font-weight: 500; }

.offline {
  margin-bottom: 12px; padding: 8px 12px; border-radius: 10px;
  background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--text);
  font-size: 13px;
}

/* Предупреждение, которое можно закрыть: «в группе нет старосты». */
.notice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 12px 14px 16px; border-radius: var(--radius); background: var(--surface);
}
.notice > .icon { color: var(--accent-text); flex: none; margin-top: 1px; }
.notice p { flex: 1; color: var(--text2); font-size: var(--fs-caption); line-height: 1.45; }
.notice .icon-button { flex: none; margin: -10px -4px -10px 0; color: var(--text3); }

/* Гостю сверху и снизу: можно войти в свою группу. */
.notice.invite { align-items: center; }
.notice.invite .primary {
  flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 8px 18px;
  font-size: var(--fs-caption); text-decoration: none;
}

/* Пометка «староста» рядом с именем. */
.role { margin-left: 6px; color: var(--accent-text); font-size: var(--fs-label); font-weight: 500; }

/* «Тебя удалили из группы»: кто, за что и жалоба. */
.removal { display: flex; flex-direction: column; gap: 6px; }
.removal h2 { font-size: var(--fs-headline); font-weight: 600; }

/* ---------- Текст ---------- */

/* Заголовок раздела — обычными буквами, как в приложении. */
.section-title { font-family: var(--heading); font-size: 20px; font-weight: 600; color: var(--text); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; min-height: 32px; }
.section-head:hover { text-decoration: none; }
.section-head .accent { font-size: 15px; font-weight: 500; }
/* Мелкая подпись внутри блока: «Расписание» на плашке, «Домашка» в записи. */
.label { font-size: var(--fs-caption); font-weight: 500; color: var(--text2); }
.headline { font-size: var(--fs-headline); font-weight: 600; }
.secondary { color: var(--text2); }
.hint { color: var(--text3); font-size: var(--fs-caption); }
.meta { color: var(--text3); font-size: var(--fs-caption); }
.center { text-align: center; }
.accent { color: var(--accent-text); }
.big { font-family: var(--heading); font-size: 32px; font-weight: 600; letter-spacing: -0.02em; }
.display { font-family: var(--heading); font-size: var(--fs-display); font-weight: 600; letter-spacing: -0.02em; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; }
.error { color: var(--danger); min-height: 1.4em; font-size: 13px; }

/* ---------- Карточки ---------- */

.card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  color: var(--text);
}
a.card:hover { text-decoration: none; background: var(--raised); }
.card.group { gap: 0; padding: 0 16px; }
.card.group > * + * { border-top: 1px solid color-mix(in srgb, var(--text3) 22%, transparent); }
/* Строки прямо на фоне, разделённые линиями: карточка у каждой делала экран тяжёлым. */
.list { display: flex; flex-direction: column; }
.list > * + * { border-top: 1px solid color-mix(in srgb, var(--text3) 22%, transparent); }
.card.muted { color: var(--text3); font-size: 14px; }
.card.empty { gap: 4px; }

.row {
  display: flex; align-items: center; gap: 12px;
  min-height: 48px; padding: 10px 0;
  color: var(--text); background: none; border: 0; width: 100%; text-align: left;
}
.row.link:hover { text-decoration: none; }
.row.link:hover .subject, .row.link:hover > span { color: var(--accent-text); }
.row .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row .chevron { margin-left: auto; color: var(--text3); }
.row.danger { color: var(--danger); cursor: pointer; font-weight: 600; }
.row .day { width: 32px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.row .left { color: var(--text2); font-size: 13px; }
.left.accent { color: var(--accent-text); font-weight: 600; }
.subject { font-weight: 600; }
.details { color: var(--text2); font-size: 13px; }

.skeleton-row { display: flex; flex-direction: column; gap: 6px; padding: 14px 0; }
.bar { display: block; height: 10px; border-radius: 5px; background: var(--raised); }
.bar.wide { width: 70%; }
.bar.narrow { width: 40%; }

/* ---------- Пары ---------- */

.lesson { display: flex; gap: 12px; padding: 12px 0; align-items: baseline; }
.lesson .time { display: flex; flex-direction: column; min-width: 48px; font-variant-numeric: tabular-nums; }
.lesson .time span { color: var(--text3); font-size: 13px; }
.lesson .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lesson .time strong { font-weight: 500; }
.lesson .subject { font-size: 17px; font-weight: 500; }
.lesson .kind { color: var(--pair); font-weight: 600; }
.lesson .campus { color: var(--text3); font-size: 13px; }
.lesson .note, .lesson .edited { color: var(--text3); font-size: 12px; font-weight: 500; }
.lesson.past { opacity: 0.5; }
.progress { height: 4px; border-radius: 2px; background: var(--raised); overflow: hidden; margin-top: 4px; }
.progress span { display: block; height: 100%; background: var(--accent); }

/* Карточка текущей или следующей пары — единственная на «Сегодня». */
.status { gap: 12px; border-radius: 22px; }
.status .lesson { padding: 0; }
.status hr { width: 100%; margin: 0; border: 0; border-top: 1px solid color-mix(in srgb, var(--text3) 22%, transparent); }
.countdown { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.countdown .secondary { font-size: 15px; }

/* Дни недели над расписанием: число и переход по дням в одной строке. */
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.week-strip button {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 4px 0; border: 0; background: none; cursor: pointer; color: var(--text);
}
.week-strip .wd { font-size: 13px; font-weight: 500; color: var(--text3); }
.week-strip .num {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  font-size: 17px; font-weight: 500;
}
.week-strip .free .num { color: var(--text3); }
.week-strip .today .wd, .week-strip .today .num { color: var(--accent-text); }
.week-strip .shown .wd { color: var(--accent-text); }
.week-strip .shown .num { background: var(--accent); color: var(--bg); }
.week-strip button:hover .num { background: var(--raised); }
.week-strip .shown:hover .num { background: var(--accent); }

.segmented { display: flex; padding: 3px; gap: 3px; background: var(--surface); border-radius: 10px; }
.segmented button {
  flex: 1; padding: 8px; border: 0; border-radius: 8px; background: none;
  color: var(--text2); font-weight: 600; cursor: pointer;
}
.segmented button.active { background: var(--raised); color: var(--text); }

.plates { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
/* Две плашки рядом и на телефоне, как в приложении: длинный текст переносится. */
.plate { gap: 4px; border-radius: var(--radius); min-width: 0; overflow-wrap: anywhere; }
.plate .label { display: flex; justify-content: space-between; align-items: center; }
.plate .label .icon { width: 14px; height: 14px; color: var(--text3); }

/* ---------- Лента ---------- */

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; flex-wrap: nowrap; }
.chips::-webkit-scrollbar { display: none; }
.settings .chips { flex-wrap: wrap; overflow: visible; }
.chip {
  flex: none; display: inline-flex; gap: 6px; align-items: center;
  padding: 7px 12px; border: 0; border-radius: 999px;
  background: var(--surface); color: var(--text2); font-size: 13px; font-weight: 500; cursor: pointer;
}
.chip:hover { color: var(--text); }
/* Выбранный фильтр — светлая «таблетка»: его видно сразу, не вчитываясь в цвет. */
.chip.active { background: var(--text); color: var(--bg); font-weight: 600; }
/* Отметка в форме: выбранная — цвета акцента, как в приложениях. */
.chip.toggle { background: var(--raised); color: var(--text); }
.chip.toggle.active { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-text); font-weight: 500; }

/* Записи лежат на фоне, между ними линия: фото автора слева, всё остальное колонкой. */
.feed { gap: 8px; }
.posts > * + * { border-top: 1px solid color-mix(in srgb, var(--text3) 22%, transparent); }
.post { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 16px 0; }
.post > .body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.post.nested { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 16px; background: var(--surface); }
.post-head { display: flex; gap: 8px; align-items: baseline; }
.post-head .name { font-weight: 500; font-size: 17px; }
.post-head .meta { margin-left: auto; font-size: 13px; white-space: nowrap; }
.pinned { color: var(--text3); }
.post .headline { font-family: var(--heading); font-size: 20px; font-weight: 600; }
.homework, .poll {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px; border-radius: 16px; background: var(--surface);
}
.repost { display: flex; flex-direction: column; gap: 6px; }
.birthday-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; margin: 8px 0; border-radius: var(--radius); background: var(--surface); }
.birthday-card .post-head { align-items: center; }
.birthday-card .post-head .meta { margin-left: 0; color: var(--accent-text); }
.due { color: var(--accent-text); font-weight: 600; font-size: 14px; }

.file {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border: 0; border-radius: 16px; background: var(--surface); cursor: pointer; text-align: left;
}
.file .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.file .size { color: var(--text3); font-size: 13px; }
.file.failed { outline: 1px solid var(--danger); }
/* Видео и аудио из файла записи: кнопка «играть», имя и вид. Открывается просмотр. */
.media-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; text-align: left;
  border: 0; border-radius: 14px; background: var(--raised); color: var(--text); cursor: pointer;
}
.media-play {
  flex: none; width: 36px; height: 36px; border-radius: 18px; display: grid; place-items: center;
  background: var(--accent); color: #0B1120;
}
.media-play .icon { width: 18px; height: 18px; vertical-align: 0; }
.media-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.media-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-meta { font-size: 13px; color: var(--text2); }

.photos { display: grid; gap: 4px; border-radius: 12px; overflow: hidden; }
.photos.count-1 { grid-template-columns: 1fr; }
.photos.count-2, .photos.count-4 { grid-template-columns: 1fr 1fr; }
.photos.count-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.photos.count-3 .photo:first-child { grid-row: span 2; }
.photo {
  position: relative; display: block; padding: 0; border: 0; cursor: zoom-in;
  aspect-ratio: 4 / 3; background: var(--raised); overflow: hidden;
}
.photos.count-1 .photo { aspect-ratio: auto; max-height: 520px; }
.photos.count-3 .photo:first-child { aspect-ratio: auto; }
.picture { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos.count-1 .picture { object-fit: contain; max-height: 520px; }
.picture.loading, .picture.missing { opacity: 0; }
.photo .more {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.45); color: #fff; font-size: 22px; font-weight: 700;
}

.option { position: relative; display: flex; gap: 8px; padding: 8px 10px; border-radius: 8px; overflow: hidden; }
.option .fill { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--accent) 22%, transparent); }
.option .text, .option .share { position: relative; }
.option .text { flex: 1; }
.option .share { color: var(--text2); font-variant-numeric: tabular-nums; }
.option.mine .text { font-weight: 600; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { border: 0; padding: 0; background: none; color: var(--accent-text); cursor: pointer; font-size: 14px; font-weight: 500; }
.tag:hover { text-decoration: underline; }
.tag.more-tags { color: var(--text3); }

/* Метки слева, реакции и комментарии справа — одной строкой, как в приложении. */
.post-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.reaction { padding: 4px 10px; border-radius: 999px; background: var(--surface); font-size: 13px; }
.reaction.mine { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.comments {
  margin-left: auto; display: inline-flex; gap: 6px; align-items: center;
  border: 0; background: none; color: var(--text2); cursor: pointer; padding: 6px 4px;
}
.comments:hover { color: var(--accent-text); }

.more, .link-button {
  align-self: center; padding: 10px 20px; border: 0; border-radius: 999px;
  background: var(--surface); color: var(--accent-text); font-weight: 600; cursor: pointer;
}
.link-button { align-self: flex-start; padding: 6px 0; background: none; }

/* ---------- Группа и профиль ---------- */

.joined { display: flex; align-items: center; gap: 12px; }
.faces { display: flex; }
.faces .avatar + .avatar { margin-left: -8px; }
.faces .avatar { box-shadow: 0 0 0 2px var(--bg); }

.note { flex-direction: row; gap: 12px; }
.note > .icon { color: var(--accent-text); margin-top: 2px; }
.note > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.section-link { display: flex; justify-content: space-between; align-items: center; min-height: 32px; }
.section-link:hover { text-decoration: none; }
.section-link .accent { font-size: 13px; font-weight: 600; }

/* Полоса дней рождения без плашек: фото, имя и сколько осталось. */
.strip { display: flex; gap: 12px; overflow-x: auto; padding: 4px 0; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.person { flex: none; width: 84px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.person .avatar { box-shadow: 0 0 0 3px var(--bg); }
.person.today .avatar { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); }
.person .name { font-size: 13px; font-weight: 500; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .left { font-size: 11px; font-weight: 600; color: var(--text3); min-height: 2.8em; }
.person .left.accent { color: var(--accent-text); }

.avatar {
  position: relative; flex: none; display: inline-grid; place-items: center;
  width: var(--size); height: var(--size); border-radius: 50%; overflow: hidden;
  background: var(--raised); color: var(--text2);
}
.avatar .initials { font-size: calc(var(--size) * 0.4); font-weight: 600; }
.avatar .icon { width: 55%; height: 55%; }
.avatar .face { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar .face.loading, .avatar .face.missing { opacity: 0; }

.presence { position: relative; display: inline-flex; flex: none; }
.presence .dot {
  position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%;
  background: #30D158; box-shadow: 0 0 0 2px var(--surface);
}
.details.accent { color: var(--accent-text); }
.mention { color: var(--accent-text); font-weight: 600; }

.profile-head { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cover {
  align-self: stretch; height: 140px; border-radius: var(--radius); overflow: hidden;
  margin-bottom: -48px;
}
.cover .picture { object-fit: cover; }
/* На телефоне обложка во всю ширину и до верха, как в приложениях. */
@media (max-width: 899px) {
  .cover { margin: -12px -16px -48px; border-radius: 0; height: 160px; }
}
.profile-avatar .avatar { box-shadow: 0 0 0 4px var(--bg); }
.profile-name { font-family: var(--heading); font-size: 24px; font-weight: 600; text-align: center; }
.socials { display: flex; gap: 8px; margin-top: 4px; }
.pill { padding: 6px 14px; border-radius: 999px; background: var(--surface); font-weight: 600; }
.pill:hover { text-decoration: none; background: var(--raised); }

.settings { gap: 16px; }
.setting { display: flex; flex-direction: column; gap: 8px; }
.setting > span { font-weight: 600; }

/* ---------- Окна ---------- */

.backdrop {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, 0.55);
}
.modal {
  position: relative; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 20px; border-radius: 18px; background: var(--bg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.modal.wide { width: min(1100px, 100%); }
/* На телефоне окно во весь экран: рамка вокруг окна съедала ширину, и
   комментарии шли узкой колонкой. */
@media (max-width: 600px) {
  .backdrop { padding: 0; place-items: stretch; }
  .modal:not(.dark) {
    width: 100%; height: 100dvh; max-height: none; border-radius: 0;
    padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  }
  .modal:not(.dark) .modal-close { top: calc(8px + env(safe-area-inset-top)); right: 8px; }
  .modal:not(.dark) .modal-body { min-height: 100%; display: flex; flex-direction: column; }
  .modal-body > .thread { flex: 1; }
  .thread .thread-list { flex: 1; }
  .thread .card.group { padding: 0 12px; }
  .thread .comment-bottom { bottom: calc(-16px - env(safe-area-inset-bottom)); }
}
.modal.dark { background: #000; padding: 0; }
.modal-close { position: absolute; top: 10px; right: 10px; z-index: 1; }
.icon-button {
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 50%; background: var(--surface); color: var(--text); cursor: pointer;
}
.modal.dark .icon-button { background: rgba(255, 255, 255, 0.14); color: #fff; }
.thread { display: flex; flex-direction: column; gap: 12px; }
.modal-body .title, .thread .title { font-family: var(--heading); font-size: 20px; font-weight: 600; padding-right: 44px; }
.modal.support-report:not(.dark) {
  position: fixed; inset: 0; margin: auto;
  width: min(460px, calc(100% - 32px)); height: fit-content; max-height: calc(100dvh - 32px);
  padding: 20px; border: 1px solid var(--line); border-radius: 20px; color: var(--text);
}
.support-report::backdrop { background: rgb(0 0 0 / 60%); }
body:has(.support-report[open]) { overflow: hidden; }
.support-report .modal-body { display: grid; min-height: 0; gap: 12px; overflow-wrap: anywhere; }
.support-report .modal-body p { margin: 0; }
.support-report .modal-body [role='status']:empty { display: none; }
.support-report [hidden] { display: none; }
.support-diagnostics {
  display: grid; gap: 5px; padding: 12px; border-radius: 14px; background: var(--surface);
}
.about { overflow-wrap: anywhere; }
.comment { display: flex; gap: 10px; padding: 12px 0; }
.comment > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.comment strong { color: var(--text); }
.comment-more { flex: none; color: var(--text3); align-self: flex-start; }
.comment-reactions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }
.comment-reactions .reaction { padding: 2px 8px; font-size: 12px; background: var(--raised); }
.comment-actions { margin-top: 6px; padding: 6px; border-radius: 12px; background: var(--raised); display: flex; flex-direction: column; gap: 4px; }
.comment-actions .reaction-row { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.comment-actions .reaction-row .reaction { font-size: 18px; padding: 6px 0; background: transparent; }
.comment-actions .reaction-row .reaction.mine { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.comment-actions .row { display: flex; gap: 16px; align-items: center; padding: 2px 6px; }
.comment-actions .secondary { padding: 2px 6px; }
.editing-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--accent-text); font-size: 13px; }
.editing-bar[hidden] { display: none; }

/* Галерея фото — на весь экран и на телефоне, и на компьютере. Крестик ниже
   выреза экрана: под строкой состояния его было не нажать. */
.backdrop:has(.modal.dark) { padding: 0; place-items: stretch; background: #000; }
.modal.dark {
  width: 100vw; height: 100dvh; max-height: none; border-radius: 0; box-shadow: none; overflow: hidden;
}
.modal.dark .modal-close {
  top: calc(12px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right));
  width: 44px; height: 44px;
}
.modal.dark .modal-body { height: 100%; }
.viewer { position: relative; height: 100%; }
.viewer-track {
  display: flex; height: 100%; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; overscroll-behavior: contain; scrollbar-width: none;
}
.viewer-track::-webkit-scrollbar { display: none; }
.viewer-slide { flex: 0 0 100%; height: 100%; display: grid; place-items: center; scroll-snap-align: center; }
.viewer .picture { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.viewer .prev, .viewer .next { position: absolute; top: 50%; transform: translateY(-50%); }
.viewer .prev { left: 12px; }
.viewer .next { right: 12px; }
/* На телефоне листают пальцем, стрелки только закрывали бы фото. */
@media (hover: none) { .viewer .prev, .viewer .next { display: none; } }
.viewer .counter {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom)); color: #fff; font-size: 13px;
}

/* ---------- Вход ---------- */

.signin-page { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
.signin-header { min-height: 72px; padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left)); display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
.signin-guest { text-align: right; }
.signin-layout { width: 100%; max-width: 1160px; flex: 1; margin: 0 auto; padding: 32px 40px 72px; display: grid; grid-template-columns: minmax(0, 460px) minmax(0, 440px); align-content: center; justify-content: center; gap: clamp(40px, 7vw, 96px); }
.signin-panel { width: 100%; min-width: 0; }
.signin-intro { display: flex; flex-direction: column; gap: 24px; }
.signin-intro h2 { max-width: 440px; font-family: var(--heading); font-size: clamp(30px, 3.2vw, 40px); line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; }
.signin-intro p { margin-top: 8px; max-width: 420px; font-size: 16px; line-height: 1.45; color: var(--text2); }
.signin-benefits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.signin-benefits li { display: flex; align-items: flex-start; gap: 14px; }
.signin-benefit-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-soft); }
.signin-benefits li > span:last-child { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.signin-benefits strong { font-size: 16px; line-height: 21px; font-weight: 600; }
.signin-benefits li > span:last-child > span { color: var(--text2); font-size: 14px; line-height: 19px; }
.signin { width: 100%; gap: 16px; padding: 28px; border-radius: 28px; }
.signin h1 { font-family: var(--heading); font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -0.02em; }
.signin .secondary { font-size: 15px; line-height: 21px; }
.signin-label { color: var(--text2); font-size: 13px; line-height: 18px; font-weight: 600; }
@media (max-width: 800px) {
  .signin-header { min-height: 64px; }
  .signin-layout { max-width: 520px; padding: 24px 16px 48px; display: flex; flex-direction: column; gap: 40px; }
  .signin-panel { order: -1; }
  .signin-intro h2 { font-size: 28px; }
}
@media (max-width: 360px) {
  .signin-header { gap: 8px; }
  .signin-guest { font-size: 13px; }
  .signin { padding: 22px 18px; }
}
/* Поле — строка на подложке без рамки, как строка формы в приложениях. */
.signin input, .form input:not([type="checkbox"]):not([type="range"]):not([type="file"]),
.form select, .form textarea, .comment-form textarea {
  width: 100%; min-height: 48px; padding: 12px 16px; border-radius: var(--radius-s);
  border: 0; background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-headline);
}
.signin input { background: var(--raised); }
.form ::placeholder, .comment-form ::placeholder, .signin ::placeholder { color: var(--text3); }
.form textarea, .comment-form textarea { resize: vertical; min-height: 44px; }
.signin input:focus, .form input:focus, .form select:focus, .form textarea:focus, .comment-form textarea:focus {
  outline: 2px solid var(--accent); border-color: transparent;
}
/* Главная кнопка — таблетка во всю ширину, как большая кнопка в приложении. */
.primary {
  min-height: 50px; padding: 12px 20px; border: 0; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: var(--fs-headline); font-weight: 600; cursor: pointer;
}
.primary:disabled { opacity: 0.6; cursor: default; }

@media (prefers-reduced-motion: no-preference) {
  .picture, .avatar .face { transition: opacity 0.2s ease; }
}

/* ---------- «Сегодня» ---------- */

.today-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 40px; }
.today-nav { display: flex; align-items: center; gap: 8px; }
.today-nav .link-button { padding: 6px 4px; }
.day-date { font-size: 13px; font-weight: 500; }
/* Дата дня в неделе — в одной строке с его названием. */
.section-head h2 { display: inline; }

/* ---------- Правка с сайта ---------- */

.form { display: flex; flex-direction: column; gap: 12px; }
.form .primary { margin-top: 4px; }
.form .label { margin-top: 4px; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
/* Кнопки вложений делят строку поровну: на телефоне по две в ряд. */
.attach-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 480px) { .attach-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Таблетки, как кнопки вложений в приложении; сетка делит строку поровну. */
.attach {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 12px;
  border: 0; border-radius: 999px;
  background: var(--raised); color: var(--text); font: inherit; font-size: var(--fs-caption); font-weight: 500; cursor: pointer;
}
.attach:hover { background: color-mix(in srgb, var(--accent) 10%, var(--raised)); }
.attach.active { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-text); }
.attach-sections { display: flex; flex-direction: column; gap: 12px; }
.attach-sections:empty { display: none; }
.attach-section { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: var(--surface); }
.attach-section input[hidden] { display: none; }
/* Поля внутри блока вложения — на тон светлее блока, как строки в шторке. */
.form .attach-section input:not([type="checkbox"]), .form .attach-section select { background: var(--raised); }
.file-picked { display: flex; align-items: center; gap: 8px; min-width: 0; }
.file-picked .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Второстепенная кнопка: та же таблетка, но прозрачным акцентом —
   как «Создать аккаунт» в приложении. */
.secondary-button {
  min-height: 50px; padding: 12px 20px; border: 0; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-text);
  font: inherit; font-weight: 600; cursor: pointer;
}
.secondary-button:disabled { opacity: 0.6; cursor: default; }
.custom-topic { display: flex; gap: 12px; align-items: center; }
.custom-topic input { flex: 1; }
.check { display: flex; gap: 8px; align-items: center; color: var(--text2); }
.poll-edit { display: flex; flex-direction: column; gap: 8px; }
.link-button.danger, .row.action.danger { color: var(--danger); }
.link-button.small { font-size: 13px; padding: 2px 0; font-weight: 500; }
.link-button.write { display: inline-flex; gap: 6px; align-items: center; }

.photo-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.pick { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface); }
.pick .picture { width: 100%; height: 100%; object-fit: cover; }
.pick .remove { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; background: rgba(0, 0, 0, 0.55); color: #fff; }
.pick.add {
  display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center;
  border: 1px dashed color-mix(in srgb, var(--text3) 50%, transparent); color: var(--text2); cursor: pointer; font: inherit;
}

.icon-button.small { width: 32px; height: 32px; background: none; color: var(--text2); }
.icon-button.small:hover { background: var(--surface); color: var(--text); }
.post-head .post-menu { margin-left: auto; margin-top: -6px; }
button.reaction { border: 0; color: inherit; cursor: pointer; font: inherit; font-size: 13px; }
button.reaction:hover { background: var(--raised); }
.reaction-picker { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }
.reaction-picker .reaction { font-size: 18px; padding: 4px 8px; }
/* Вариант опроса — плашка на тон светлее блока, выбранный — цвета акцента,
   как в приложении. */
.option.choice {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-radius: var(--radius-s);
  background: var(--raised); color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.option.choice:hover { background: color-mix(in srgb, var(--accent) 12%, var(--raised)); }
.option.choice.mine { background: color-mix(in srgb, var(--accent) 22%, transparent); }

.sheet { display: flex; flex-direction: column; gap: 4px; }
.row.action { border: 0; background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; padding: 14px 0; }
.row.action:hover { color: var(--accent-text); }
.thread-list { display: flex; flex-direction: column; }
.comment-bottom { position: sticky; bottom: -20px; padding: 8px 0; background: var(--bg); display: flex; flex-direction: column; gap: 6px; }
.comment-form { display: flex; gap: 8px; align-items: flex-end; }
.comment-form textarea { flex: 1; }
.icon-button.send { flex: none; background: var(--accent); color: #fff; }
.icon-button:disabled { opacity: 0.5; cursor: default; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field .label { margin-top: 0; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.field { min-width: 0; }
.exam-stage-editor { min-width: 0; margin: 0; padding: 0; border: 0; }
.exam-stage-editor legend { padding: 0; margin: 0 0 8px; }
.exam-stage-list { display: grid; gap: 8px; }
.exam-stage-draft { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
.exam-stage-editor .link-button { min-height: 44px; justify-self: start; }
.row.exam.staged { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.exam-stage-summary { display: grid; grid-column: 1 / -1; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.exam-stage-line { display: grid; grid-template-columns: minmax(4em, auto) minmax(0, 1fr); gap: 8px; font-size: 0.875em; overflow-wrap: anywhere; }
.exam-stage-line time { color: var(--accent-text); }
.exam-stage-line .details { display: block; }
.settings .reminder-settings-link { border-top: 1px solid color-mix(in srgb, var(--text3) 22%, transparent); padding-bottom: 0; }
.reminder-panel { display: grid; gap: 12px; }
.reminder-message:empty, .reminder-details[hidden] { display: none; }
.reminder-panel fieldset { min-width: 0; border: 0; margin: 0; padding: 0; }
.reminder-category-list legend { padding: 0; margin-bottom: 4px; }
.reminder-categories { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; }
.reminder-panel .check { min-height: 44px; cursor: pointer; }
.reminder-panel .check input { flex: none; width: 18px; height: 18px; accent-color: var(--accent); }
@media (max-width: 360px) {
  .reminder-categories { grid-template-columns: 1fr; gap: 0; }
}
/* Safari на телефоне не даёт полям даты и времени сжиматься уже своей
   встроенной ширины, и они вылезали из колонки. */
.form input[type="date"], .form input[type="time"] {
  min-width: 0; max-width: 100%; -webkit-appearance: none; appearance: none; min-height: 46px;
}
.lesson.editable { cursor: pointer; border-radius: 10px; }
.lesson.editable:hover .subject { color: var(--accent-text); }
.lesson.editable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.row.exam { width: 100%; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
button.row.exam:hover .subject { color: var(--accent-text); }
.hidden-lessons { display: flex; flex-direction: column; gap: 2px; padding-top: 4px; }
.page-header .link-button.write { margin-top: 4px; }
.note .link-button.small { margin-top: 6px; }
.avatar-edit { display: flex; gap: 16px; align-items: center; }
.avatar-actions { display: flex; gap: 16px; flex-wrap: wrap; }
.cover-line { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.field.bottom { justify-content: flex-end; padding-bottom: 12px; }
.link-button.center-button { align-self: center; }

.wishes { display: flex; flex-direction: column; }
.wishes > * + * { border-top: 1px solid color-mix(in srgb, var(--text3) 22%, transparent); }
.wish { display: flex; gap: 12px; padding: 12px 0; }
.wish.editable { cursor: pointer; }
.wish.editable:hover .subject { color: var(--accent-text); }
.wish-photo { width: 64px; height: 64px; flex: none; border-radius: 10px; overflow: hidden; background: var(--surface); }
.wish-photo .picture { width: 100%; height: 100%; object-fit: cover; }
.wish-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.want { display: flex; gap: 8px; align-items: center; }
.want .bar { flex: 1; max-width: 160px; height: 4px; border-radius: 2px; background: var(--raised); overflow: hidden; }
.want .bar span { display: block; height: 100%; background: var(--accent); }
.wish-link { font-size: 13px; font-weight: 500; align-self: flex-start; }
.range { display: flex; gap: 12px; align-items: center; }
.range input { flex: 1; accent-color: var(--accent); }

/* Переключение между входом, новым аккаунтом и новым паролем. */
.signin .field { gap: 2px; }
.signin .field .error:empty { min-height: 0; }
.signin-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; }
.signin-links .link-button { font-size: 15px; }
.signin .divider { width: 100%; margin: 4px 0; border: 0; border-top: 1px solid color-mix(in srgb, var(--text3) 25%, transparent); }
.join { gap: 12px; }

.comment-gif {
  display: block;
  max-width: min(220px, 100%);
  max-height: 180px;
  border-radius: 12px;
  object-fit: contain;
}
.comment-form .secondary-button { min-height: 44px; padding: 8px 12px; flex-shrink: 0; }
.comment-form textarea { min-width: 0; }
.thread-list .comment { scroll-margin-bottom: 110px; }
.group-header { padding: 24px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); }
.group-identity { display: flex; align-items: center; gap: 20px; min-width: 0; }
.group-identity-text { min-width: 0; }
.group-eyebrow { display: block; margin-bottom: 4px; color: var(--text2); font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .08em; }
.group-identity h1 { margin: 0 0 10px; overflow-wrap: anywhere; font-family: var(--heading); font-size: clamp(25px, 3vw, 34px); line-height: 1.15; letter-spacing: -.02em; }
.group-identity .joined { flex-wrap: wrap; gap: 10px; font-size: 14px; }
.group-identity .faces .avatar { box-shadow: 0 0 0 2px var(--surface); }
.group-avatar { width: 88px; height: 88px; flex: none; display: grid; place-items: center; border-radius: 24px; overflow: hidden; background: var(--raised); color: var(--accent-text); }
.group-avatar > .icon { width: 36px; height: 36px; }
.group-avatar img { width: 100%; height: 100%; object-fit: cover; }
.group-controls { display: flex; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.group-action { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 14px; border: 0; border-radius: 12px; background: var(--raised); color: var(--accent-text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.group-action .icon { width: 18px; height: 18px; }
.group-action:hover { filter: brightness(1.12); }
.group-action:disabled { opacity: .6; cursor: default; }
.group-settings { gap: 8px; }
.group-settings h2 { margin-bottom: 12px; }
.group-settings .group-action { width: 100%; justify-content: flex-start; }
.group-action-danger { margin-top: 8px; background: color-mix(in srgb, var(--danger) 8%, transparent); color: var(--danger); }
@media (max-width: 480px) {
  .group-header { padding: 18px; border-radius: 20px; }
  .group-identity { gap: 14px; }
  .group-avatar { width: 72px; height: 72px; border-radius: 20px; }
  .group-controls { margin-top: 16px; padding-top: 12px; }
  .group-action { padding-inline: 11px; }
}
