/* Приложение: то же определитель-настроение, но плотнее и под палец. */

html, body { height: 100%; }
body.app { overflow-x: hidden; }

.shell { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; min-height: 100%; padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
.shell--bare { padding-bottom: 0; }

/* ---------- шапка ---------- */
.app-head {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem 1rem;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.app-head .theme-bird { width: 40px; height: 40px; flex: none; }
.app-head .theme-bird .bird { width: 30px; height: 30px; }
.head-title {
  appearance: none; border: 0; background: none; padding: .25rem .4rem; margin: 0; text-align: left;
  display: grid; min-width: 0; flex: 1; cursor: pointer; border-radius: var(--radius-s);
}
.head-title:disabled { cursor: default; }
.head-title b { font-size: 1.1rem; font-weight: 600; color: var(--ink); line-height: 1.2; }
.head-title span { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip {
  appearance: none; flex: none; cursor: pointer;
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  border-radius: var(--radius-pill); min-height: 34px; padding: 0 .85rem;
  font-size: .85rem; font-weight: 500; white-space: nowrap;
}
.chip[aria-pressed="true"], .chip.is-on { background: var(--ink); color: var(--paper); }

/* ---------- полоса недели ---------- */
.week-nav { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1rem .4rem; }
.week-nav__label { font-size: .9rem; color: var(--muted); }
.icon-btn {
  appearance: none; border: 0; background: none; cursor: pointer; color: var(--ink);
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
}
.icon-btn:hover { background: var(--paper-2); }
.icon-btn svg { width: 22px; height: 22px; }

.days { display: grid; grid-template-columns: repeat(6, 1fr); gap: .35rem; padding: 0 .75rem .75rem; }
.day-btn {
  appearance: none; cursor: pointer; border: 1px solid transparent; background: none;
  border-radius: var(--radius-m); padding: .5rem 0 .55rem;
  display: grid; justify-items: center; gap: .1rem; color: var(--text); position: relative;
}
.day-btn small { font-size: .72rem; color: var(--muted); }
.day-btn b { font-size: 1.15rem; font-weight: 600; }
.day-btn.is-today::after { content: ""; position: absolute; bottom: .3rem; width: 4px; height: 4px; border-radius: 50%; background: var(--live); }
.day-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.day-btn[aria-pressed="true"] small { color: color-mix(in srgb, var(--paper) 70%, transparent); }
.day-btn[aria-pressed="true"].is-today::after { background: var(--paper); }
.day-btn.is-empty b { opacity: .45; }

/* ---------- день ---------- */
.day-head { padding: .75rem 1.25rem .5rem; }
.day-head h2 { font-family: var(--ff-display); font-style: italic; font-weight: 500; font-size: 2.6rem; line-height: 1; margin: 0; color: var(--ink); }
.day-head p { margin: .35rem 0 0; color: var(--muted); font-size: .9rem; }

.notice { margin: .5rem 1rem; padding: .75rem 1rem; border: 1px dashed var(--rule); border-radius: var(--radius-m); font-size: .88rem; color: var(--muted); }

.lessons { list-style: none; margin: 0; padding: 0 0 1rem; }
.lesson {
  display: grid; grid-template-columns: 3.6rem minmax(0, 1fr); gap: .9rem;
  padding: 1rem 1.25rem; border-top: 1px solid var(--rule); position: relative;
}
.lessons .lesson:first-child { border-top: 0; }
.lesson__time { display: grid; align-content: start; gap: .1rem; font-variant-numeric: tabular-nums; }
.lesson__time b { font-size: 1.5rem; font-weight: 600; color: var(--ink); line-height: 1; font-family: var(--ff-display); }
.lesson__time span { font-size: .78rem; color: var(--muted); line-height: 1.3; }
.lesson__subject { margin: 0; font-size: 1.02rem; font-weight: 600; color: var(--ink); line-height: 1.3; }
.lesson__meta { display: flex; flex-wrap: wrap; gap: .3rem .7rem; margin-top: .35rem; font-size: .86rem; color: var(--muted); align-items: center; }
.lesson__meta .room { color: var(--text); font-weight: 500; }
.tag { display: inline-block; border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 0 .4rem; font-size: .75rem; line-height: 1.5rem; color: var(--text); }
.lesson__note { margin: .55rem 0 0; padding: .45rem .7rem; background: var(--paper-2); border-radius: var(--radius-s); font-size: .86rem; color: var(--text); }
.lesson__warn { margin: .45rem 0 0; font-size: .84rem; color: var(--study); }
.lesson__groups { margin: .35rem 0 0; font-size: .84rem; color: var(--muted); }
.lesson.is-past { opacity: .5; }
.lesson.is-same { border-top: 1px dashed var(--rule); padding-top: .6rem; }
.lesson.is-same .lesson__time { visibility: hidden; }
.lesson.is-now::before { content: ""; position: absolute; left: 0; top: .9rem; bottom: .9rem; width: 3px; border-radius: 2px; background: var(--live); }
.lesson__state { display: inline-block; margin-bottom: .3rem; font-size: .78rem; font-weight: 600; color: var(--live); }
.variants { margin: .5rem 0 0; padding: 0; list-style: none; border-left: 1px solid var(--rule); }
.variants li { padding: .35rem 0 .35rem .8rem; font-size: .88rem; }
details.lesson__more summary { cursor: pointer; font-size: .86rem; color: var(--muted); margin-top: .35rem; }

.empty { padding: 3rem 1.5rem; text-align: center; color: var(--muted); }
.empty .bird { width: 72px; height: 72px; margin: 0 auto 1rem; opacity: .9; }
.empty h3 { font-family: var(--ff-display); font-weight: 500; font-size: 1.8rem; color: var(--ink); margin: 0 0 .25rem; }
.empty p { margin: 0 auto; max-width: 32ch; }

/* ---------- поиск ---------- */
.search { padding: 1rem; }
.search form { display: flex; gap: .5rem; }
.field {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 1rem;
  border: 1.5px solid var(--rule); border-radius: var(--radius-pill);
  background: var(--paper); color: var(--ink); font: inherit;
}
.field:focus { outline: none; border-color: var(--ink); }
.hints { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .8rem; }
.hints .chip { border-width: 1px; border-color: var(--rule); color: var(--text); }
.hints .chip:hover { border-color: var(--ink); }
.result-title { padding: .75rem 1.25rem .25rem; }
.result-title h2 { margin: 0; font-family: var(--ff-display); font-weight: 500; font-size: 2rem; line-height: 1.05; color: var(--ink); }
.result-title p { margin: .3rem 0 0; color: var(--muted); font-size: .88rem; }
.day-label { margin: 1.1rem 1.25rem .2rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.rooms { display: flex; flex-wrap: wrap; gap: .4rem; padding: .25rem 1.25rem 1rem; }
.rooms .tag { font-size: .85rem; line-height: 1.9rem; padding: 0 .6rem; }
.free-slot { padding: .8rem 1.25rem; border-top: 1px solid var(--rule); }
.free-slot b { color: var(--ink); }
.free-slot p { margin: .2rem 0 0; color: var(--muted); font-size: .88rem; }

/* ---------- сравнение ---------- */
.compare-bar { display: flex; gap: .45rem; padding: 1rem 1rem .25rem; overflow-x: auto; scrollbar-width: none; }
.compare-bar .chip { display: inline-flex; gap: .4rem; align-items: center; }
.compare-bar .chip .x { opacity: .7; }
.grid-wrap { overflow-x: auto; padding: .25rem 0 1.25rem; -webkit-overflow-scrolling: touch; }
.cgrid { display: grid; gap: 0; min-width: 100%; }
.cgrid__head, .cgrid__slot, .cgrid__cell { padding: .65rem .6rem; border-top: 1px solid var(--rule); }
.cgrid__head { border-top: 0; font-weight: 600; color: var(--ink); font-size: .92rem; position: sticky; top: 0; background: var(--paper); }
.cgrid__head small { display: block; font-weight: 400; color: var(--muted); font-size: .75rem; }
.cgrid__slot { font-variant-numeric: tabular-nums; position: sticky; left: 0; background: var(--paper); z-index: 1; }
.cgrid__slot b { font-family: var(--ff-display); font-size: 1.3rem; color: var(--ink); display: block; line-height: 1; }
.cgrid__slot span { font-size: .72rem; color: var(--muted); }
.cgrid__cell { font-size: .84rem; min-width: 150px; }
.cgrid__cell b { display: block; color: var(--ink); font-weight: 600; line-height: 1.25; }
.cgrid__cell span { color: var(--muted); }
.cgrid__cell + .cgrid__cell, .cgrid__head + .cgrid__head { border-left: 1px solid var(--rule); }
.cgrid__cell.is-free { color: var(--muted); font-style: italic; }
.cgrid__cell .one + .one { margin-top: .45rem; padding-top: .45rem; border-top: 1px dashed var(--rule); }

/* ---------- профиль ---------- */
.panel { padding: 1.25rem; border-top: 1px solid var(--rule); }
.panel:first-child { border-top: 0; }
.panel h3 { margin: 0 0 .8rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.hello { font-family: var(--ff-display); font-weight: 500; font-size: 2.3rem; line-height: 1.05; color: var(--ink); margin: 0 0 .3rem; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; }
.row + .row { border-top: 1px dashed var(--rule); }
.row__label { display: grid; flex: 1; min-width: 0; }
.row > :last-child:not(.row__label) { flex: none; }
.row__label span { color: var(--ink); }
.row__label small { color: var(--muted); font-size: .82rem; }
.link-btn { appearance: none; border: 0; background: none; padding: .3rem 0; cursor: pointer; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; font-size: .92rem; }
.seg { display: inline-flex; border: 1.5px solid var(--ink); border-radius: var(--radius-pill); overflow: hidden; }
.seg button { appearance: none; min-width: 2.6rem; border: 0; background: none; cursor: pointer; padding: .45rem .85rem; font-size: .85rem; color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.switch { appearance: none; width: 48px; height: 28px; border-radius: 14px; border: 1.5px solid var(--ink); background: transparent; position: relative; cursor: pointer; flex: none; transition: background-color .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: var(--ink); transition: transform .2s, background-color .2s; }
.switch:checked { background: var(--ink); }
.switch:checked::after { transform: translateX(20px); background: var(--paper); }
select.field { border-radius: var(--radius-m); min-height: 44px; }
.name-form { display: flex; gap: .5rem; }
.soon { color: var(--muted); font-size: .85rem; }

/* ---------- экраны входа / онбординга ---------- */
.center { min-height: 100vh; display: grid; align-content: center; padding: 2rem 1.5rem; max-width: 460px; margin: 0 auto; }
.center .bird--dove.big { width: 112px; height: 112px; margin-bottom: 1.75rem; }
.center h1 { font-family: var(--ff-display); font-weight: 500; font-size: 2.6rem; line-height: 1.02; color: var(--ink); margin: 0 0 .8rem; }
.center p { color: var(--muted); margin: 0 0 1.5rem; }
.center .btn { width: 100%; }
.center .stack { display: grid; gap: .6rem; }
.choice {
  appearance: none; width: 100%; text-align: left; cursor: pointer;
  border: 1.5px solid var(--rule); background: var(--paper); color: var(--ink);
  border-radius: var(--radius-m); padding: .85rem 1rem; display: grid; gap: .1rem;
}
.choice:hover, .choice:focus-visible { border-color: var(--ink); }
.choice b { font-weight: 600; }
.choice small { color: var(--muted); }
.progress { font-size: .8rem; color: var(--muted); margin-bottom: .75rem; }
.back { margin-top: 1rem; }
.hover .bird { animation: hover 1.6s ease-in-out infinite; }
@keyframes hover { 50% { transform: translateY(-8px); } }

/* ---------- нижняя навигация ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--rule);
}
.tabbar__in { max-width: 720px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.tab {
  appearance: none; border: 0; background: none; cursor: pointer; color: var(--muted);
  display: grid; justify-items: center; gap: .15rem; padding: .55rem 0 .6rem; font-size: .72rem;
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--ink); font-weight: 600; }

/* ---------- лист снизу ---------- */
.sheet-back { position: fixed; inset: 0; z-index: 40; background: rgb(0 0 0 / .35); opacity: 0; transition: opacity .25s; }
.sheet-back.is-open { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  max-width: 720px; margin: 0 auto; max-height: 82vh; display: flex; flex-direction: column;
  background: var(--paper); border-radius: 20px 20px 0 0; border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transform: translateY(100%); transition: transform .3s cubic-bezier(.3, .9, .3, 1);
}
.sheet.is-open { transform: none; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem .5rem; }
.sheet__head h3 { margin: 0; font-family: var(--ff-display); font-weight: 500; font-size: 1.7rem; color: var(--ink); }
.sheet__body { overflow-y: auto; padding: 0 1.25rem 1.25rem; }
.sheet .courses { display: flex; gap: .4rem; overflow-x: auto; padding: .25rem 0 .9rem; scrollbar-width: none; }
.sheet .stack { display: grid; gap: .5rem; }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--paper); padding: .65rem 1.1rem; border-radius: var(--radius-pill);
  font-size: .88rem; transition: opacity .25s, transform .25s; max-width: calc(100% - 2rem);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.loading { min-height: 60vh; display: grid; place-items: center; text-align: center; padding: 2rem; color: var(--muted); }
.loading .bird { width: 64px; height: 64px; margin: 0 auto 1rem; }
.loading p { max-width: 34ch; margin: 0 auto; }
