:root {
  color-scheme: light;
  --ink: #111237;
  --muted: #696b99;
  --purple: #6036f7;
  --purple-dark: #4720df;
  --purple-soft: #eee9ff;
  --soft: #eee9ff;
  --lime: #dfff00;
  --surface: rgba(255, 255, 255, 0.94);
  --line: rgba(79, 56, 170, 0.12);
  --grid-line: #efedf7;
  --control-line: #e4e0f2;
  --event-line: #cdc2fb;
  --shadow: 0 14px 40px rgba(64, 45, 139, 0.08);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  scrollbar-gutter: stable;
  background: #f4f2ff;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: clip;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% 12%, rgba(205, 200, 255, 0.5), transparent 29rem),
    radial-gradient(circle at 16% 92%, rgba(221, 228, 255, 0.72), transparent 32rem),
    linear-gradient(135deg, #f3f2ff 0%, #f8f8ff 48%, #eff1ff 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.new-lesson-modal-open {
  overflow: hidden;
}

button,
input { font: inherit; }

button {
  border: 0;
  padding: 0;
  color: inherit;
  background: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(96, 54, 247, 0.3);
  outline-offset: 3px;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p { margin: 0; }

.app-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
  padding: 24px 28px 26px 20px;
  gap: 38px;
}

.sidebar {
  position: sticky;
  top: 24px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 50px);
  min-height: 660px;
  padding: 25px 14px 22px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.91);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  gap: 8px;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.045em;
  transform: translateX(-8px);
  white-space: nowrap;
}

.brand > span > span { color: var(--purple); }

.brand__mark {
  width: 35px;
  height: 29px;
  flex: 0 0 auto;
  object-fit: contain;
}

.main-nav {
  display: grid;
  gap: 13px;
  margin-top: 52px;
}

.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 61px;
  padding: 0 16px;
  gap: 17px;
  border-radius: 13px;
  color: #555886;
  font-size: 14px;
  font-weight: 650;
  text-align: left;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.nav-item:hover {
  color: var(--purple);
  background: #f7f5ff;
}

.nav-item:active { transform: translateY(1px); }

.nav-item--active {
  color: var(--purple);
  background: linear-gradient(135deg, #f2eeff, #e9e3ff);
}

.nav-item__icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  object-fit: contain;
}

.support-card {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  min-height: 82px;
  margin-top: auto;
  padding: 13px 12px;
  gap: 10px;
  border: 1px solid #e6e2f8;
  border-radius: 13px;
  background: linear-gradient(135deg, #faf9ff, #f4f1ff);
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.support-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(73, 48, 157, 0.08);
}

.support-card__icon {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(145deg, #b2a5ff, #7356ff);
  box-shadow: 0 7px 16px rgba(95, 64, 247, 0.24);
  font-weight: 800;
}

.support-card strong,
.support-card small { display: block; }

.support-card strong {
  margin-bottom: 6px;
  font-size: 13px;
}

.support-card small {
  color: var(--muted);
  font-size: 11px;
}

.content {
  min-width: 0;
  width: 100%;
  margin: 0 auto;
}

.content--home { max-width: 1180px; }
.content--library { max-width: 1590px; }
.content--lesson-drafts { max-width: 1180px; }
.mobile-header { display: none; }

.welcome-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 112px;
  padding: 4px 3px 7px 10px;
  gap: 28px;
}

.welcome-row h1 {
  margin-bottom: 8px;
  font-size: clamp(25px, 2.1vw, 33px);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.welcome-row p {
  color: var(--muted);
  font-size: 16px;
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 26px;
}

.notification-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  transition: background 160ms ease;
}

.notification-button:hover { background: rgba(255, 255, 255, 0.7); }

.notification-button svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notification-button span {
  position: absolute;
  top: 3px;
  right: 2px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 2px solid #f5f4ff;
  border-radius: 20px;
  color: #fff;
  background: #ff342e;
  font-size: 10px;
  font-weight: 800;
}

.profile-button {
  display: grid;
  grid-template-columns: 62px auto 24px;
  align-items: center;
  min-width: 230px;
  padding: 4px 3px;
  gap: 12px;
  border-radius: 40px;
  text-align: left;
  transition: background 160ms ease;
}

.profile-button:hover { background: rgba(255, 255, 255, 0.68); }

.profile-button img {
  width: 62px;
  height: 62px;
  object-fit: contain;
}

.profile-button strong,
.profile-button small { display: block; }

.profile-button strong {
  margin-bottom: 7px;
  font-size: 15px;
}

.profile-button small {
  color: var(--muted);
  font-size: 14px;
}

.profile-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu-button { display: none; }
.nav-overlay { display: none; }

.toast {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 100;
  max-width: min(390px, calc(100vw - 32px));
  padding: 13px 18px;
  border: 1px solid rgba(112, 78, 244, 0.18);
  border-radius: 12px;
  color: #fff;
  background: rgba(24, 20, 58, 0.94);
  box-shadow: 0 16px 36px rgba(25, 15, 75, 0.24);
  font-size: 14px;
  font-weight: 650;
  opacity: 0;
  pointer-events: none;
  transform: translateY(15px);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

.new-lesson-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  visibility: hidden;
  opacity: 0;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.new-lesson-modal--visible {
  visibility: visible;
  opacity: 1;
}

.new-lesson-modal__backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(231, 230, 248, 0.74);
  backdrop-filter: blur(7px);
  cursor: default;
}

.new-lesson-dialog {
  position: relative;
  width: min(900px, calc(100vw - 48px));
  max-height: calc(100dvh - 48px);
  padding: 44px 50px 32px;
  overflow-y: auto;
  border: 1px solid rgba(87, 59, 183, 0.1);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 30px 90px rgba(47, 31, 115, 0.22);
  transform: translateY(14px) scale(0.985);
  transition: transform 200ms ease;
}

.new-lesson-modal--visible .new-lesson-dialog {
  transform: translateY(0) scale(1);
}

.new-lesson-dialog__close {
  position: absolute;
  z-index: 1;
  top: 30px;
  right: 35px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #626487;
  transition: color 160ms ease, background 160ms ease;
}

.new-lesson-dialog__close:hover {
  color: var(--ink);
  background: #f4f1ff;
}

.new-lesson-dialog__close svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.new-lesson-dialog__header {
  display: flex;
  align-items: center;
  min-height: 70px;
  gap: 14px;
}

.new-lesson-dialog__header h2 {
  font-size: clamp(31px, 3vw, 39px);
  line-height: 1.1;
  letter-spacing: -0.045em;
}

.new-lesson-dialog__header img {
  width: 94px;
  height: 94px;
  margin: -12px 0 -12px 2px;
  object-fit: contain;
}

.new-lesson-form {
  margin-top: 27px;
}

.new-lesson-field {
  display: block;
}

.new-lesson-field + .new-lesson-field {
  margin-top: 32px;
}

.new-lesson-field > span:first-child {
  display: block;
  margin-bottom: 12px;
  color: #6b6d98;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.new-lesson-choice-field {
  min-width: 0;
  padding: 0;
  border: 0;
}

.new-lesson-choice-field legend {
  width: 100%;
  margin-bottom: 12px;
  padding: 0;
  color: #6b6d98;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.new-lesson-choice-grid {
  display: grid;
  gap: 10px;
}

.new-lesson-choice-grid--age {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.new-lesson-choice-grid--level {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.new-lesson-choice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 46px;
  padding: 0 14px;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #62617e;
  background: #fff;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.new-lesson-choice__icon {
  display: inline-flex;
  flex: 0 0 auto;
  color: #8b89a6;
}

.new-lesson-choice__icon svg {
  width: 18px;
  height: 18px;
}

.new-lesson-choice:hover {
  color: var(--purple);
  border-color: #cfc4ff;
}

.new-lesson-choice:hover .new-lesson-choice__icon,
.new-lesson-choice[aria-pressed="true"] .new-lesson-choice__icon {
  color: var(--purple);
}

.new-lesson-choice[aria-pressed="true"] {
  color: var(--purple);
  border-color: #d6ccff;
  background: var(--purple-soft);
  box-shadow: 0 4px 10px rgba(93, 43, 242, 0.08);
}

.new-lesson-field input,
.new-lesson-select__trigger {
  width: 100%;
  height: 68px;
  padding: 0 24px;
  border: 1px solid #deddea;
  border-radius: 12px;
  outline: none;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 20px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.new-lesson-field input::placeholder {
  color: #a3a4b8;
  opacity: 1;
}

.new-lesson-field input:focus,
.new-lesson-select__trigger:focus-visible,
.new-lesson-select--open .new-lesson-select__trigger {
  border-color: var(--purple);
  box-shadow: 0 0 0 5px rgba(96, 54, 247, 0.11);
}

.new-lesson-select {
  position: relative;
  display: block;
}

.new-lesson-select__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-right: 20px;
  text-align: left;
  cursor: pointer;
}

.new-lesson-select__value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.new-lesson-select__trigger svg {
  flex: 0 0 auto;
  width: 25px;
  height: 25px;
  fill: none;
  stroke: var(--purple);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 160ms ease;
}

.new-lesson-select--open .new-lesson-select__trigger svg {
  transform: rotate(180deg);
}

.new-lesson-select__list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 2;
  margin: 0;
  padding: 8px;
  list-style: none;
  border: 1px solid rgba(87, 59, 183, 0.12);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(47, 31, 115, 0.14);
}

.new-lesson-select__list[hidden] {
  display: none;
}

.new-lesson-select__option {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 10px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.new-lesson-select__option:hover,
.new-lesson-select__option:focus-visible {
  outline: none;
  background: var(--purple-soft);
  color: var(--purple-dark);
}

.new-lesson-select__option[aria-selected="true"] {
  background: linear-gradient(135deg, rgba(96, 54, 247, 0.12), rgba(96, 54, 247, 0.08));
  color: var(--purple-dark);
  font-weight: 750;
}

.new-lesson-select__option[aria-selected="true"]::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--purple);
}

.new-lesson-synthetic {
  display: flex;
  align-items: center;
  margin-top: 28px;
  gap: 13px;
  color: var(--ink);
  cursor: pointer;
}

.new-lesson-synthetic input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.new-lesson-synthetic__control {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 2px solid #d3d0df;
  border-radius: 8px;
  color: #fff;
  background: #fff;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.new-lesson-synthetic__control svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

.new-lesson-synthetic input:checked + .new-lesson-synthetic__control {
  border-color: var(--purple);
  background: var(--purple);
}

.new-lesson-synthetic input:checked + .new-lesson-synthetic__control svg { opacity: 1; }
.new-lesson-synthetic input:focus-visible + .new-lesson-synthetic__control {
  box-shadow: 0 0 0 5px rgba(96, 54, 247, 0.11);
}
.new-lesson-synthetic strong { display: block; font-size: 16px; }
.new-lesson-synthetic small { display: block; margin-top: 3px; color: #85839d; font-size: 12px; }

.new-lesson-dialog__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 35px;
  padding-top: 24px;
  border-top: 1px solid #e8e7ef;
}

.new-lesson-dialog__cancel {
  min-height: 52px;
  padding: 0 8px;
  color: #696b91;
  font-size: 18px;
  font-weight: 700;
}

.new-lesson-dialog__create {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 250px;
  min-height: 61px;
  padding: 0 28px;
  gap: 18px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(105deg, #5121ed, #7027ff);
  box-shadow: 0 12px 27px rgba(88, 38, 229, 0.27);
  font-size: 18px;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.new-lesson-dialog__create:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(88, 38, 229, 0.32);
}

.new-lesson-dialog__create svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 224px minmax(0, 1fr);
    padding-right: 20px;
    gap: 24px;
  }

  .sidebar { padding-inline: 13px; }

  .brand {
    min-height: 72px;
    gap: 10px;
    font-size: 34px;
  }

  .brand__mark {
    width: 34px;
    height: 28px;
  }
}

@media (max-width: 860px) {
  body.nav-open { overflow: hidden; }

  .app-shell {
    display: block;
    padding: 0 16px 24px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(256px, calc(100vw - 46px));
    height: 100dvh;
    min-height: 0;
    border-radius: 0 18px 18px 0;
    transform: translateX(-105%);
    transition: transform 220ms ease;
  }

  body.nav-open .sidebar { transform: translateX(0); }

  .nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: block;
    width: 100%;
    height: 100%;
    background: rgba(20, 14, 50, 0.38);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
  }

  body.nav-open .nav-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .content { max-width: none; }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 76px;
  }

  .brand--mobile {
    min-height: auto;
    font-size: 21px;
    transform: none;
  }

  .brand--mobile .brand__mark {
    width: 20px;
    height: 17px;
  }

  .menu-button {
    display: grid;
    place-content: center;
    width: 42px;
    height: 42px;
    gap: 5px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.78);
  }

  .menu-button span {
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: var(--ink);
  }

  .mobile-avatar {
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .mobile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .welcome-row {
    min-height: 112px;
    padding: 11px 2px 21px;
  }

  .welcome-row h1 { font-size: 27px; }

  .welcome-row p {
    font-size: 14px;
    line-height: 1.5;
  }

  .account-actions { display: none; }
}

@media (max-width: 560px) {
  .app-shell { padding-inline: 12px; }
  .welcome-row h1 { font-size: 24px; }

  .toast {
    right: 16px;
    bottom: 16px;
    left: 16px;
    max-width: none;
  }

  .new-lesson-modal {
    align-items: end;
    padding: 0;
  }

  .new-lesson-dialog {
    width: 100%;
    max-height: 94dvh;
    padding: 29px 20px 20px;
    overflow-y: auto;
    border-radius: 23px 23px 0 0;
  }

  .new-lesson-dialog__close {
    top: 19px;
    right: 16px;
  }

  .new-lesson-dialog__header {
    min-height: 56px;
    padding-right: 42px;
    gap: 8px;
  }

  .new-lesson-dialog__header h2 {
    font-size: 29px;
  }

  .new-lesson-dialog__header img {
    width: 72px;
    height: 72px;
  }

  .new-lesson-form {
    margin-top: 21px;
  }

  .new-lesson-field + .new-lesson-field {
    margin-top: 24px;
  }

  .new-lesson-field > span:first-child {
    font-size: 16px;
  }

  .new-lesson-choice-field legend {
    font-size: 16px;
  }

  .new-lesson-choice-grid--age,
  .new-lesson-choice-grid--level {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .new-lesson-choice-grid--age .new-lesson-choice:last-child {
    grid-column: 1 / -1;
  }

  .new-lesson-choice {
    min-height: 42px;
    padding-inline: 10px;
    font-size: 13px;
  }

  .new-lesson-field input,
  .new-lesson-select__trigger {
    height: 58px;
    padding-left: 17px;
    font-size: 16px;
  }

  .new-lesson-select__option {
    min-height: 44px;
    font-size: 16px;
  }

  .new-lesson-dialog__footer {
    margin-top: 27px;
    padding-top: 18px;
    gap: 16px;
  }

  .new-lesson-dialog__cancel {
    font-size: 16px;
  }

  .new-lesson-dialog__create {
    min-width: 0;
    min-height: 55px;
    padding-inline: 19px;
    gap: 10px;
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
.profile-menu-wrap {
  position: relative;
}

.mobile-profile-wrap {
  position: relative;
}

.profile-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  padding: 8px;
  border: 1px solid rgba(63, 46, 110, 0.12);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(51, 36, 92, 0.16);
}

.profile-menu[hidden] {
  display: none;
}

.mobile-profile-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 9px);
  right: 0;
  min-width: 220px;
  padding: 8px;
  border: 1px solid rgba(63, 46, 110, 0.12);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(51, 36, 92, 0.16);
}

.mobile-profile-menu[hidden] {
  display: none;
}

.mobile-profile-menu__identity {
  display: grid;
  gap: 3px;
  padding: 8px 12px 11px;
  border-bottom: 1px solid rgba(63, 46, 110, 0.1);
  margin-bottom: 4px;
}

.mobile-profile-menu__identity small {
  overflow: hidden;
  color: #746a8b;
  text-overflow: ellipsis;
}

.profile-menu a,
.profile-menu button,
.mobile-profile-menu a,
.mobile-profile-menu button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #352b54;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.profile-menu a:hover,
.profile-menu button:hover,
.mobile-profile-menu a:hover,
.mobile-profile-menu button:hover {
  background: #f4f0ff;
}

body[data-auth-state="authenticated"] .profile-menu__login,
body[data-auth-state="guest"] .profile-menu__logout {
  display: none;
}
