:root {
  color-scheme: light;
  --navy: #17233f;
  --navy-2: #223151;
  --ink: #172036;
  --muted: #6b768b;
  --surface: #ffffff;
  --canvas: #f1f4f8;
  --line: #dce3ec;
  --accent: #2bc7b9;
  --accent-dark: #0f8f84;
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --shadow: 0 18px 50px rgba(23, 35, 63, 0.1);
  font-family: Inter, Roboto, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 4%, rgba(43, 199, 185, 0.12), transparent 24rem),
    var(--canvas);
  font-size: 16px;
  line-height: 1.45;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  width: min(100%, 1320px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) max(14px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 76px;
  padding: 12px 4px;
  background: color-mix(in srgb, var(--canvas) 90%, transparent);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px;
  color: var(--navy);
  background: var(--accent);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -0.04em;
  box-shadow: 0 8px 22px rgba(43, 199, 185, 0.24);
}

.brand-copy {
  display: grid;
  min-width: 0;
}

.brand-copy strong {
  font-size: 15px;
  line-height: 1.15;
}

.brand-copy small {
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.network-state {
  align-items: center;
  gap: 7px;
  color: #a33c47;
  font-size: 13px;
  font-weight: 800;
}

.network-state:not([hidden]) {
  display: inline-flex;
}

.network-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #dc4f5e;
}

.install-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  padding: 0 15px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: var(--navy);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(23, 35, 63, 0.17);
}

.install-button svg {
  width: 19px;
  height: 19px;
}

.workspace {
  display: grid;
  gap: 16px;
}

.live-panel,
.schedule-panel {
  overflow: hidden;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.live-panel {
  position: relative;
  padding: 25px;
  color: #fff;
  background:
    radial-gradient(circle at 110% -4%, rgba(43, 199, 185, 0.78) 0 15%, transparent 15.2%),
    radial-gradient(circle at 104% 29%, rgba(43, 199, 185, 0.75) 0 7%, transparent 7.2%),
    linear-gradient(145deg, var(--navy), #202f50 72%);
}

.live-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow,
.section-label {
  margin: 0;
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.09em;
}

.eyebrow {
  color: #cbd5e4;
}

.digital-clock {
  margin: 3px 0 0;
  color: #fff;
  font-size: clamp(58px, 17vw, 82px);
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: -0.065em;
  font-variant-numeric: tabular-nums;
}

.school-state {
  flex: 0 0 auto;
  max-width: 145px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #dfe6f0;
  background: rgba(255, 255, 255, 0.09);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}

.now-card {
  margin-top: 23px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.now-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.now-kicker {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 11px;
  border-radius: 999px;
  color: var(--navy);
  background: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.now-period {
  color: #cbd5e4;
  font-size: 14px;
  font-weight: 750;
}

.now-card h1 {
  margin: 17px 0 7px;
  font-size: clamp(27px, 7.8vw, 38px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.now-teacher {
  min-height: 24px;
  margin: 0;
  color: #cbd5e4;
  font-size: 16px;
}

.now-time-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.now-time-row strong {
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.now-time-row span {
  color: #d7dfeb;
  font-size: 14px;
  font-weight: 700;
  text-align: right;
}

.lesson-progress {
  height: 7px;
  overflow: hidden;
  margin-top: 14px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.13);
}

.lesson-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 500ms ease;
}

.next-card {
  display: grid;
  grid-template-columns: 43px 1fr;
  gap: 13px;
  align-items: center;
  margin-top: 14px;
  padding: 17px 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  background: rgba(7, 14, 31, 0.2);
}

.next-icon {
  display: grid;
  width: 43px;
  height: 43px;
  place-items: center;
  border-radius: 14px;
  color: var(--accent);
  background: rgba(43, 199, 185, 0.12);
}

.next-icon svg {
  width: 22px;
  height: 22px;
}

.next-card div:last-child {
  display: grid;
  min-width: 0;
}

.next-card span {
  color: #9facbe;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.next-card strong {
  overflow: hidden;
  margin-top: 2px;
  font-size: 17px;
  line-height: 1.22;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.next-card small {
  margin-top: 3px;
  color: #cbd5e4;
  font-size: 13px;
}

.schedule-panel {
  padding: 22px 16px 18px;
  background: var(--surface);
}

.schedule-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 3px 5px 17px;
}

.section-label {
  color: var(--accent-dark);
}

.schedule-header h2 {
  margin: 4px 0 0;
  font-size: clamp(31px, 9vw, 46px);
  line-height: 1;
  letter-spacing: -0.045em;
}

.schedule-header p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.day-arrows {
  display: flex;
  gap: 8px;
}

.day-arrows button {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--navy);
  background: #fff;
  cursor: pointer;
}

.day-arrows svg {
  width: 22px;
  height: 22px;
}

.day-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(54px, 1fr));
  gap: 7px;
  padding: 7px;
  border-radius: 18px;
  background: var(--canvas);
}

.day-tab {
  min-height: 48px;
  padding: 0 6px;
  border: 0;
  border-radius: 13px;
  color: var(--muted);
  background: transparent;
  font-size: 15px;
  font-weight: 850;
  cursor: pointer;
}

.day-tab[aria-selected="true"] {
  color: #fff;
  background: var(--navy);
  box-shadow: 0 7px 16px rgba(23, 35, 63, 0.17);
}

.schedule-list {
  display: grid;
  gap: 10px;
  margin-top: 15px;
  outline: none;
}

.lesson-card {
  --subject: #65758b;
  position: relative;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  gap: 15px;
  min-height: 118px;
  overflow: hidden;
  align-items: center;
  padding: 17px 15px 17px 18px;
  border: 1px solid var(--line);
  border-left: 7px solid var(--subject);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(23, 35, 63, 0.055);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.lesson-card.is-current {
  border-color: var(--subject);
  background: color-mix(in srgb, var(--subject) 7%, #fff);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--subject) 20%, transparent);
  transform: translateY(-1px);
}

.lesson-card.is-next:not(.is-current)::after {
  position: absolute;
  top: 11px;
  right: 11px;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--subject);
  background: color-mix(in srgb, var(--subject) 11%, #fff);
  content: "СЛЕДВА";
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.07em;
}

.lesson-card.free {
  border-left-color: #aab3c0;
  border-style: dashed;
  background: #f5f7fa;
  box-shadow: none;
}

.period-block {
  align-self: stretch;
  display: grid;
  align-content: center;
  padding-right: 12px;
  border-right: 1px solid var(--line);
}

.period-number {
  color: var(--subject);
  font-size: 36px;
  font-weight: 950;
  line-height: 0.95;
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
}

.period-label {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.period-times {
  display: grid;
  gap: 0;
  margin-top: 9px;
  color: var(--ink);
  line-height: 1;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.period-times strong {
  font-size: 20px;
  font-weight: 950;
}

.period-times span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 850;
}

.lesson-copy {
  min-width: 0;
}

.lesson-copy h3 {
  margin: 0;
  font-size: clamp(20px, 5.7vw, 27px);
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.lesson-copy p {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.lesson-code {
  align-self: start;
  min-width: 51px;
  margin-top: 1px;
  padding: 7px 9px;
  border-radius: 999px;
  color: #fff;
  background: var(--subject);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.swipe-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 17px 0 1px;
  color: var(--muted);
  font-size: 12px;
}

.swipe-hint svg {
  width: 18px;
  height: 18px;
}

.install-dialog {
  width: min(calc(100% - 30px), 410px);
  padding: 0;
  border: 0;
  border-radius: 26px;
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(9, 16, 35, 0.3);
}

.install-dialog::backdrop {
  background: rgba(10, 16, 30, 0.63);
  backdrop-filter: blur(5px);
}

.install-dialog form {
  display: grid;
  justify-items: center;
  padding: 29px;
  text-align: center;
}

.dialog-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 19px;
  color: var(--navy);
  background: var(--accent);
}

.dialog-icon svg {
  width: 28px;
  height: 28px;
}

.install-dialog h2 {
  margin: 19px 0 8px;
  font-size: 25px;
  letter-spacing: -0.03em;
}

.install-dialog p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.install-dialog button {
  width: 100%;
  min-height: 50px;
  margin-top: 24px;
  border: 0;
  border-radius: 15px;
  color: #fff;
  background: var(--navy);
  font-weight: 850;
  cursor: pointer;
}

.toast {
  position: fixed;
  z-index: 50;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  left: 18px;
  max-width: 420px;
  margin: auto;
  padding: 13px 16px;
  border-radius: 14px;
  color: #fff;
  background: #111b32;
  font-size: 14px;
  font-weight: 750;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

button:focus-visible,
a:focus-visible,
.schedule-list:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 70%, #fff);
  outline-offset: 3px;
}

@media (max-width: 520px) {
  .app-shell {
    padding-right: 10px;
    padding-left: 10px;
  }

  .topbar {
    min-height: 68px;
  }

  .brand-mark {
    flex-basis: 42px;
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }

  .brand-copy strong {
    font-size: 14px;
  }

  .brand-copy small {
    max-width: 152px;
    font-size: 11px;
  }

  .install-button {
    width: 44px;
    padding: 0;
    justify-content: center;
  }

  .install-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .network-state {
    font-size: 12px;
  }

  .live-panel {
    padding: 23px 18px 19px;
    border-radius: 27px;
  }

  .school-state {
    max-width: 112px;
  }

  .now-card {
    padding: 19px;
  }

  .schedule-panel {
    border-radius: 27px;
  }

  .day-arrows button {
    width: 43px;
    height: 43px;
  }

  .day-tabs {
    gap: 5px;
    padding: 6px;
  }

  .day-tab {
    min-height: 45px;
    font-size: 14px;
  }

  .lesson-card {
    grid-template-columns: 86px minmax(0, 1fr) auto;
    gap: 12px;
    min-height: 116px;
    padding: 15px 12px 15px 15px;
  }

  .period-block {
    padding-right: 9px;
  }

  .period-number {
    font-size: 39px;
  }

  .lesson-copy h3 {
    font-size: clamp(19px, 5.6vw, 24px);
  }

  .lesson-copy p {
    font-size: 14px;
  }

  .lesson-code {
    min-width: 46px;
    padding: 6px 8px;
    font-size: 11px;
  }
}

@media (min-width: 900px) {
  .app-shell {
    padding: 0 24px 34px;
  }

  .topbar {
    min-height: 88px;
    padding-right: 2px;
    padding-left: 2px;
  }

  .workspace {
    grid-template-columns: minmax(340px, 0.78fr) minmax(560px, 1.32fr);
    align-items: start;
    gap: 20px;
  }

  .live-panel {
    position: sticky;
    top: 102px;
    min-height: 610px;
    padding: 31px;
  }

  .schedule-panel {
    padding: 27px 24px 20px;
  }

  .lesson-card {
    grid-template-columns: 105px minmax(0, 1fr) auto;
    min-height: 124px;
    padding: 18px 18px 18px 20px;
  }

  .period-number {
    font-size: 46px;
  }

  .period-times strong {
    font-size: 22px;
  }

  .period-times span {
    font-size: 17px;
  }

  .swipe-hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
