/* ============================================================
   World of Words — Telegram WebApp
   Вёрстка по БЭМ. Палитра: #fff / #fec400 / #313131
   ============================================================ */

:root {
  --wow-white: #ffffff;
  --wow-yellow: #fec400;
  --wow-yellow-dark: #e6b000;
  --wow-dark: #313131;
  --wow-gray: #6b6b6b;
  --wow-line: #ececec;
  --wow-bg: #f6f6f4;
  --wow-radius: 16px;
  --wow-radius-sm: 12px;
  --wow-shadow: 0 6px 20px rgba(49, 49, 49, 0.08);
  --wow-shadow-hover: 0 10px 28px rgba(49, 49, 49, 0.14);
  --wow-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--wow-font);
  color: var(--wow-dark);
  background: var(--wow-bg);
  line-height: 1.45;
  font-size: 16px;
}

/* ------------------------- Блок: app ------------------------- */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 640px;
  margin: 0 auto;
}

/* ----------------------- Блок: topbar ------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--wow-white);
  border-bottom: 1px solid var(--wow-line);
}

.topbar__back {
  border: 0;
  background: var(--wow-bg);
  color: var(--wow-dark);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  transition: background 0.15s;
}

.topbar__back:active {
  background: var(--wow-line);
}

/* Кнопка «назад» всегда занимает место — интерфейс не «прыгает» */
.topbar__back--hidden {
  visibility: hidden;
}

.topbar__icon {
  border: 1px solid var(--wow-line);
  background: var(--wow-white);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 17px;
  cursor: pointer;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar__logo {
  height: 26px;
  display: block;
}

.topbar__title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  flex: 1 1 auto;
}

.topbar__spacer {
  flex: 1 1 auto;
}

.topbar__lang {
  border: 1px solid var(--wow-line);
  background: var(--wow-white);
  color: var(--wow-dark);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ----------------------- Блок: screen ------------------------ */
.screen {
  flex: 1 1 auto;
  padding: 16px;
  animation: screen-in 0.22s ease;
}

@keyframes screen-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.screen__title {
  font-size: 22px;
  font-weight: 800;
  margin: 4px 0 14px;
}

.screen__subtitle {
  color: var(--wow-gray);
  margin: -8px 0 18px;
}

/* ------------------------- Блок: hero ------------------------ */
.hero {
  text-align: center;
  padding: 28px 16px 8px;
}

.hero__logo {
  width: 190px;
  max-width: 70%;
  height: auto;
  margin: 0 auto 20px;
  display: block;
}

.hero__badge {
  display: inline-block;
  background: var(--wow-yellow);
  color: var(--wow-dark);
  font-weight: 700;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 20px;
  margin-bottom: 14px;
}

.hero__title {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 8px;
}

.hero__text {
  color: var(--wow-gray);
  max-width: 440px;
  margin: 0 auto 22px;
}

/* ------------------------- Блок: btn ------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: var(--wow-radius-sm);
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s;
}

.btn:active {
  transform: translateY(1px) scale(0.995);
}

.btn--primary {
  background: var(--wow-yellow);
  color: var(--wow-dark);
  box-shadow: 0 6px 16px rgba(254, 196, 0, 0.35);
}

.btn--primary:hover {
  background: var(--wow-yellow-dark);
}

.btn--dark {
  background: var(--wow-dark);
  color: var(--wow-white);
}

.btn--ghost {
  background: var(--wow-white);
  color: var(--wow-dark);
  border: 1.5px solid var(--wow-line);
}

.btn--sm {
  width: auto;
  padding: 10px 16px;
  font-size: 14px;
}

.btn__group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 420px;
  margin: 0 auto;
}

/* ----------------------- Блок: profile ----------------------- */
.profile {
  background: linear-gradient(135deg, #313131 0%, #444 100%);
  border-radius: 22px;
  padding: 20px;
  color: var(--wow-white);
  margin-bottom: 22px;
  box-shadow: 0 12px 28px rgba(49, 49, 49, 0.22);
  position: relative;
  overflow: hidden;
}

.profile::after {
  content: "";
  position: absolute;
  top: -40px;
  right: -30px;
  width: 140px;
  height: 140px;
  background: var(--wow-yellow);
  opacity: 0.18;
  border-radius: 50%;
}

.profile__top {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.profile__avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--wow-yellow);
  color: var(--wow-dark);
  font-size: 26px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.profile__hello {
  font-size: 13px;
  opacity: 0.7;
}

.profile__name {
  font-size: 22px;
  font-weight: 800;
  margin: 2px 0 4px;
}

.profile__course {
  font-size: 13px;
  opacity: 0.85;
}

.profile__stats {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  position: relative;
  z-index: 1;
}

.profile__stat {
  flex: 1 1 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 12px 8px;
  text-align: center;
}

.profile__stat-value {
  display: block;
  font-size: 18px;
  font-weight: 800;
  color: var(--wow-yellow);
}

.profile__stat-label {
  display: block;
  font-size: 11px;
  opacity: 0.75;
  margin-top: 2px;
}

/* ----------------------- Блок: section ----------------------- */
.section {
  margin-bottom: 20px;
}

.section__title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--wow-gray);
  margin: 0 0 10px 2px;
}

/* ------------------------- Блок: menu ------------------------ */
.menu {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.menu-card {
  position: relative;
  background: var(--wow-white);
  border-radius: var(--wow-radius);
  padding: 16px 14px;
  text-align: left;
  border: 0;
  cursor: pointer;
  box-shadow: var(--wow-shadow);
  transition: transform 0.14s, box-shadow 0.16s;
  font-family: inherit;
  color: var(--wow-dark);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 108px;
}

.menu-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--wow-shadow-hover);
}

.menu-card__icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--wow-yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.menu-card__icon--yellow {
  background: rgba(254, 196, 0, 0.22);
}
.menu-card__icon--blue {
  background: rgba(59, 130, 246, 0.16);
}
.menu-card__icon--green {
  background: rgba(46, 160, 67, 0.16);
}
.menu-card__icon--purple {
  background: rgba(139, 92, 246, 0.16);
}

.menu-card__title {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.25;
}

.menu-card__arrow {
  position: absolute;
  top: 16px;
  right: 14px;
  color: var(--wow-line);
  font-size: 20px;
  font-weight: 700;
}

/* ------------------------- Блок: card ------------------------ */
.card {
  background: var(--wow-white);
  border-radius: var(--wow-radius);
  padding: 18px;
  box-shadow: var(--wow-shadow);
  margin-bottom: 12px;
}

.card__title {
  font-weight: 700;
  font-size: 17px;
  margin: 0 0 6px;
}

.card__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
}

.card__label {
  color: var(--wow-gray);
}

.card__value {
  font-weight: 700;
}

/* ------------------------- Блок: list ------------------------ */
.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-item {
  background: var(--wow-white);
  border-radius: var(--wow-radius-sm);
  padding: 14px 16px;
  box-shadow: var(--wow-shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  width: 100%;
  text-align: left;
  font-family: inherit;
  color: var(--wow-dark);
  transition: transform 0.12s;
}

.list-item:hover {
  transform: translateY(-2px);
}

.list-item__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--wow-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex: 0 0 auto;
}

.list-item__body {
  flex: 1 1 auto;
  min-width: 0;
}

.list-item__title {
  display: block;
  font-weight: 700;
  font-size: 15px;
}

.list-item__sub {
  color: var(--wow-gray);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item__arrow {
  color: var(--wow-gray);
  font-size: 18px;
  flex: 0 0 auto;
}

/* ------------------------- Блок: chip ------------------------ */
.chip {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

.chip--done {
  background: rgba(46, 160, 67, 0.14);
  color: #1a7f37;
}

.chip--pending {
  background: rgba(254, 196, 0, 0.2);
  color: var(--wow-yellow-dark);
}

.chip--price {
  background: var(--wow-dark);
  color: var(--wow-white);
}

.chip--free {
  background: rgba(46, 160, 67, 0.14);
  color: #1a7f37;
}

/* ------------------------ Блок: day-nav ---------------------- */
.day-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--wow-white);
  border-radius: var(--wow-radius-sm);
  padding: 8px;
  box-shadow: var(--wow-shadow);
  margin-bottom: 14px;
}

.day-nav__btn {
  border: 0;
  background: var(--wow-bg);
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  color: var(--wow-dark);
}

.day-nav__date {
  font-weight: 800;
  font-size: 15px;
  text-align: center;
}

.day-nav__weekday {
  display: block;
  font-size: 11px;
  color: var(--wow-gray);
  font-weight: 600;
}

/* ------------------------- Блок: field ----------------------- */
.field {
  margin-bottom: 14px;
}

.field__label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
}

.field__input,
.field__textarea {
  width: 100%;
  border: 1.5px solid var(--wow-line);
  border-radius: var(--wow-radius-sm);
  padding: 13px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--wow-dark);
  background: var(--wow-white);
  outline: none;
  transition: border-color 0.15s;
}

.field__input:focus,
.field__textarea:focus {
  border-color: var(--wow-yellow);
}

.field__textarea {
  resize: vertical;
  min-height: 96px;
}

.field__error {
  color: #d33;
  font-size: 13px;
  margin-top: 6px;
}

/* ------------------------- Блок: grid ------------------------ */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid__cell {
  border: 1.5px solid var(--wow-line);
  background: var(--wow-white);
  border-radius: var(--wow-radius-sm);
  padding: 12px 10px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  color: var(--wow-dark);
  transition: border-color 0.14s, background 0.14s;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1.2;
}

.grid__cell small {
  color: var(--wow-gray);
  font-weight: 600;
  font-size: 12px;
}

.grid__cell:hover,
.grid__cell--active {
  border-color: var(--wow-yellow);
  background: rgba(254, 196, 0, 0.1);
}

/* ------------------------- Блок: rate ------------------------ */
.rate {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 14px 0;
}

.rate__star {
  font-size: 40px;
  cursor: pointer;
  color: var(--wow-line);
  transition: transform 0.1s, color 0.1s;
}

.rate__star--active {
  color: var(--wow-yellow);
}

.rate__star:active {
  transform: scale(1.2);
}

/* ----------------------- Блок: notice ------------------------ */
.notice {
  background: rgba(254, 196, 0, 0.14);
  border: 1px solid rgba(254, 196, 0, 0.4);
  border-radius: var(--wow-radius-sm);
  padding: 16px;
  text-align: center;
  color: var(--wow-dark);
}

.notice__icon {
  font-size: 30px;
  display: block;
  margin-bottom: 6px;
}

/* ------------------------- Блок: empty ----------------------- */
.empty {
  text-align: center;
  color: var(--wow-gray);
  padding: 40px 16px;
}

.empty__icon {
  font-size: 40px;
  display: block;
  margin-bottom: 8px;
}

/* ------------------------- Блок: toast ----------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--wow-dark);
  color: var(--wow-white);
  padding: 12px 20px;
  border-radius: 22px;
  font-size: 14px;
  font-weight: 600;
  z-index: 100;
  box-shadow: var(--wow-shadow-hover);
  max-width: 90%;
  text-align: center;
  animation: toast-in 0.2s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* ------------------------- Блок: lang ------------------------ */
.lang {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
}

.lang__logo {
  width: 200px;
  max-width: 70%;
  margin-bottom: 10px;
}

.lang__title {
  font-weight: 700;
  font-size: 18px;
  margin: 0 0 6px;
}

.lang__options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
}

/* ------------------------- Блок: chat ------------------------ */
.screen--chat {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 63px);
}

.chat-ava {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--wow-yellow);
  color: var(--wow-dark);
  font-weight: 800;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.chat-course {
  background: var(--wow-bg);
  color: var(--wow-gray);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 10px;
  flex: 0 0 auto;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--wow-white);
  border-radius: var(--wow-radius-sm);
  padding: 10px 14px;
  box-shadow: var(--wow-shadow);
  margin-bottom: 12px;
}

.chat-head__info {
  display: flex;
  flex-direction: column;
}

.chat-head__name {
  font-weight: 700;
  font-size: 15px;
}

.chat-head__status {
  font-size: 12px;
  color: #1a7f37;
}

.chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 2px;
}

.chat__bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 15px;
}

.chat__bubble--in {
  background: var(--wow-white);
  box-shadow: var(--wow-shadow);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat__bubble--out {
  background: var(--wow-yellow);
  color: var(--wow-dark);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat__composer {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.chat__composer .field__input {
  margin: 0;
}

/* -------------------------- Блок: pin ------------------------ */
.pin {
  max-width: 340px;
  margin: 24px auto 0;
  text-align: center;
}

.pin__icon {
  font-size: 46px;
  display: block;
  margin-bottom: 8px;
}

.pin__title {
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 6px;
}

.pin__hint {
  color: var(--wow-gray);
  font-size: 14px;
  margin: 0 0 18px;
}

.pin__input {
  text-align: center;
  letter-spacing: 8px;
  font-size: 24px;
  font-weight: 700;
}

/* Профиль преподавателя — акцентный жёлтый градиент */
.profile--teacher {
  background: linear-gradient(135deg, #fec400 0%, #ffd84d 100%);
  color: var(--wow-dark);
}

.profile--teacher .profile__avatar {
  background: var(--wow-dark);
  color: var(--wow-yellow);
}

.profile--teacher::after {
  background: var(--wow-dark);
  opacity: 0.12;
}

/* ------------------------- Утилиты --------------------------- */
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mt {
  margin-top: 14px;
}

.link {
  color: var(--wow-yellow-dark);
  font-weight: 600;
  word-break: break-all;
}

.loader {
  text-align: center;
  padding: 50px;
  color: var(--wow-gray);
}
