/* ПЯТЬ ЗВОНКОВ — экраны, которых не было в Лингограде:
   открытка, вызов Эталона, лента времени, карточка эпохи, дуэль,
   возвращение и почётная грамота. Всё на токенах из tokens.css. */

/* ------------------------------------------------------- ОТКРЫТКА */

.screen--museum {
  justify-content: center;
  align-items: center;
  text-align: center;
  background: radial-gradient(circle at 50% 12%, #FBF0D4 0%, var(--paper) 62%);
}

.holiday__card {
  width: 100%;
  max-width: 640px;
  min-width: 0;
  margin: 0 auto;
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--sh-3);
}
.hday { display: block; width: 100%; max-width: 100%; height: auto; }
.hday__bell { transform-origin: 512px 236px; animation: hday-ring 3.6s ease-in-out infinite; }
.hday__bouquet { transform-origin: 112px 392px; animation: hday-sway 6s ease-in-out infinite; }
.hday__title { animation: hday-in 1.1s var(--ease) both; }
.hday__fall { animation: hday-sway 7.5s ease-in-out infinite reverse; }

@keyframes hday-ring {
  0%, 70%, 100% { transform: rotate(0); }
  78% { transform: rotate(7deg); }
  86% { transform: rotate(-6deg); }
  93% { transform: rotate(3deg); }
}
@keyframes hday-sway {
  0%, 100% { transform: rotate(-1.2deg); }
  50% { transform: rotate(1.6deg); }
}
@keyframes hday-in {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------- ЭТАЛОН */

.robot { display: block; width: 100%; }
.robot__head { transform-origin: 160px 130px; animation: robot-tilt 5.2s ease-in-out infinite; }
.robot__beam { animation: robot-beam 2.4s ease-in-out infinite; }
.robot__scan { animation: robot-scan 2.4s ease-in-out infinite; }
.robot__halo { animation: robot-breathe 3.6s ease-in-out infinite; transform-origin: 160px 150px; }
.robot__grid { animation: robot-grid 6s linear infinite; }
.robot.is-friendly .robot__head { animation-duration: 8s; }
.robot.is-friendly .robot__beam { animation: none; opacity: 1; }
.robot.is-friendly .robot__scan { animation: none; opacity: 0; }

@keyframes robot-tilt {
  0%, 100% { transform: rotate(-1.5deg) translateY(0); }
  50% { transform: rotate(1.5deg) translateY(-4px); }
}
@keyframes robot-beam {
  0%, 100% { opacity: .75; }
  50% { opacity: 1; }
}
@keyframes robot-scan {
  0% { transform: translateX(0); opacity: .35; }
  50% { transform: translateX(70px); opacity: .6; }
  100% { transform: translateX(0); opacity: .35; }
}
@keyframes robot-breathe {
  0%, 100% { opacity: .12; transform: scale(.94); }
  50% { opacity: .24; transform: scale(1.06); }
}
@keyframes robot-grid {
  0% { opacity: .18; } 50% { opacity: .3; } 100% { opacity: .18; }
}

.story__name { color: var(--teal-ink); }
.screen--story { background: radial-gradient(circle at 50% 40%, #E0F4F6 0%, var(--paper) 70%); }
.story__line--bell { background: var(--yellow-soft); color: var(--brass-ink); font-weight: 800; }

/* -------------------------------------------------- ЛЕНТА ВРЕМЕНИ */

.screen--map { gap: 12px; }

.timeline {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-2);
  background: var(--white);
  padding: 22px 14px;
}
.timeline__bg { position: absolute; inset: 0; opacity: .8; }
.timeline__bg .art { width: 100%; height: 100%; display: block; }
.timeline__stops {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.stop {
  --z-label: var(--brass-ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px 10px;
  border-radius: var(--r-md);
  background: rgba(255,255,255,.94);
  box-shadow: var(--sh-2);
  text-align: center;
  min-width: 0;
  transition: transform .3s var(--ease), filter .3s;
  color: var(--ink);
}
.stop__year {
  font-size: clamp(18px, 2.4vw, 26px);
  font-weight: 800;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  color: var(--z-label);
}
.stop__icon { width: 40px; height: 40px; display: block; line-height: 0; }
.stop__icon .aicon { width: 100%; height: 100%; display: block; }
.stop__title { font-size: 12px; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.stop__state { font-size: 11px; font-weight: 700; color: var(--ink-55); text-transform: uppercase; letter-spacing: .04em; overflow-wrap: anywhere; }

.stop--locked { filter: grayscale(1); opacity: .5; }
.stop--demo { filter: grayscale(1); opacity: .42; border: 2px dashed rgba(35,32,58,.25); }
.stop--demo .stop__state { font-weight: 800; }
.stop--done { border: 2px solid var(--green-ink); }
.stop--done .stop__state { color: var(--green-ink); }
.stop--active {
  border: 3px solid var(--orange);
  transform: scale(1.06);
  animation: nodepulse 2.2s var(--ease) infinite;
}
.stop--active .stop__state { color: var(--orange-ink); }
/* остановка в будущем на тёмном фоне ленты — оставляем белой карточкой,
   но год подсвечиваем бирюзой */
.stop.zone-future { --z-label: var(--teal-ink); }

.mapfoot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mapfoot .mini { flex: 1; min-width: 220px; margin: 0; }

/* ------------------------------------------------- КАРТОЧКА ЭПОХИ */

.intro__wrap { display: flex; flex-direction: column; gap: 12px; }
.intro--era { gap: 8px; }
.intro__year {
  font-size: clamp(44px, 9vw, 84px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.04em;
  color: var(--z-label, var(--brass-ink));
  font-variant-numeric: tabular-nums;
}
.intro--era .display { font-size: clamp(24px, 5.4vw, 44px); }
.chip--artifact { display: inline-flex; align-items: center; gap: 6px; }
.chip__icon { width: 20px; height: 20px; display: inline-block; line-height: 0; }
.chip__icon .aicon { width: 100%; height: 100%; display: block; }
/* заставка на тёмных эпохах: чипы и подписи по токенам зоны */
.zone--dark .intro .chip--artifact { background: var(--z-card); color: var(--z-ink); }
.teacherq--intro.zone--dark { background: var(--z-bg); color: var(--z-ink); }
.teacherq--intro.zone--dark .intro { box-shadow: none; }

/* --------------------------------------------------------- ДУЭЛЬ */

.robotbar__fill { background: linear-gradient(90deg, #7FE3EE 0%, #FF4D5E 100%); }
.robot__art { display: flex; justify-content: center; }
.robot__art .art { width: min(230px, 52vw); animation: float 4s ease-in-out infinite; }
.zone-future .qtop__where { background: rgba(0,0,0,.4); }

.robotreply {
  border-radius: var(--r-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #0F1330;
  color: #F4F7FF;
  border: 2px solid rgba(127,227,238,.35);
  box-shadow: var(--sh-2);
}
.robotreply__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.robotreply__icon { width: 26px; height: 26px; display: inline-block; line-height: 0; }
.robotreply__label { font-size: 12px; font-weight: 800; letter-spacing: .14em; color: #7FE3EE; }
.robotreply__verdict {
  margin-left: auto;
  font-size: 13px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--r-pill);
}
.robotreply.is-wrong .robotreply__verdict { background: rgba(255,77,94,.22); color: #FFB3BA; }
.robotreply.is-right .robotreply__verdict { background: rgba(78,154,106,.3); color: #B9F0CC; }
.robotreply__text {
  margin: 0;
  font-family: "Manrope", monospace;
  font-size: 16px;
  font-weight: 600;
  color: #F4F7FF;
}
.robotreply__note { margin: 0; font-size: 13px; color: rgba(244,247,255,.72); }
/* блок робота на проекторе: он стоит на белой панели, цвета свои */
.screen--live .robotreply__text { color: #F4F7FF; }
.screen--live .robotreply__note { color: rgba(244,247,255,.72); }
.screen--live .robotreply__label { color: #7FE3EE; }

.reveal__note { margin: 0; font-size: 14px; color: var(--brass-ink); font-style: italic; }

/* ----------------------------------------------- ЭПОХА ПРОЙДЕНА */

.done__artifact { width: 84px; height: 84px; margin: 0 auto; line-height: 0; }
.done__artifact .aicon { width: 100%; height: 100%; display: block; animation: artifact-pop .8s var(--ease) both; }
@keyframes artifact-pop {
  0% { transform: scale(.4) rotate(-20deg); opacity: 0; }
  60% { transform: scale(1.12) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}
.done__bell { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 4px; }
.done__bellart { width: 46px; height: 50px; display: inline-block; line-height: 0; animation: swing 1.6s var(--ease) infinite; transform-origin: 50% 8%; }
.done__bellart .art { width: 100%; height: 100%; display: block; }
.done__next { font-size: 15px; font-weight: 800; color: var(--brass-ink); }
.zone--dark.screen--done .done__next { color: var(--z-label); }
.zone--dark.screen--done .done__progress { color: var(--z-muted); }
.zone--dark.screen--done .lead { color: var(--z-ink); }
.zone--dark.screen--done .display { background: var(--grad-brass); -webkit-background-clip: text; background-clip: text; }
.zone--dark.screen--done { background: var(--z-bg); border-radius: var(--r-lg); color: var(--z-ink); }

/* ----------------------------------------------------- ВОЗВРАЩЕНИЕ */

.screen--victory { gap: 12px; }
.victory__robot { width: min(200px, 48vw); max-width: 100%; min-width: 0; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--sh-2); }
.story__lines--victory { width: min(620px, 100%); }
.victory__caption { color: var(--orange-ink); font-weight: 800; }
.victory__head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: center; }
.victory__head .victory__robot { width: 180px; }
.victory__head .story__lines { flex: 1; min-width: min(320px, 100%); text-align: left; }

.teachers {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  width: min(760px, 100%);
}
.teacher { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.teacher__fig { width: 100%; max-width: 92px; display: block; line-height: 0; animation: teacher-in .7s var(--ease) both; }
.teacher__fig .tfig { width: 100%; height: auto; display: block; }
.teacher:nth-child(2) .teacher__fig { animation-delay: .15s; }
.teacher:nth-child(3) .teacher__fig { animation-delay: .3s; }
.teacher:nth-child(4) .teacher__fig { animation-delay: .45s; }
.teacher:nth-child(5) .teacher__fig { animation-delay: .6s; }
.teacher:nth-child(6) .teacher__fig { animation-delay: .9s; }
.teacher__name { font-size: 12px; font-weight: 800; text-align: center; line-height: 1.1; }
.teacher__year { font-size: 11px; font-weight: 700; color: var(--ink-55); font-variant-numeric: tabular-nums; }
.teacher--you .teacher__name { color: var(--orange-ink); }
@keyframes teacher-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------- ГРАМОТА */

.screen--gratitude { justify-content: flex-start; align-items: center; text-align: center; gap: 12px; }
.screen--gratitude .display { font-size: clamp(24px, 5vw, 40px); }

.thanks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(640px, 100%);
}
.thank {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 56px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 3px solid var(--ink-12);
  background: var(--white);
  font-size: 16px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: transform .16s var(--ease), border-color .16s, background .16s;
}
.thank:active { transform: scale(.985); }
.thank.is-on { border-color: var(--brass); background: var(--yellow-soft); color: var(--brass-ink); }
.thank__count {
  min-width: 26px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--brass-ink);
  background: rgba(201,154,59,.18);
  border-radius: var(--r-pill);
  padding: 3px 8px;
  font-variant-numeric: tabular-nums;
}
.thank__count:empty { display: none; }
.thanks--late { margin-top: 10px; }

/* Safari: у flex-элемента с svg внутри минимальная ширина равна viewBox
   (800px), и грамота уезжала за правый край телефона. Поэтому min-width: 0,
   ширина в процентах и ограничение сверху вместо min(). */
.letter__box {
  width: 100%;
  max-width: 800px;
  min-width: 0;
  margin: 0 auto;
  line-height: 0;
  overflow: hidden;
  filter: drop-shadow(0 12px 28px rgba(122,74,20,.25));
}
.letter__box .letter { width: 100%; max-width: 100%; height: auto; display: block; }
.letter__box--student { max-width: 560px; }
.letter__box--final { max-width: 640px; margin: 0; }
.awards__thanks, .thanks { min-width: 0; max-width: 100%; }
.awards__thanks { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* грамота на проекторе */
.screen--tgratitude { max-width: var(--content); gap: 14px; }
.tgrat { display: grid; grid-template-columns: 1fr minmax(250px, 300px); gap: 18px; align-items: start; }
.tgrat__main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
  padding: clamp(18px, 3vw, 30px);
}
.tgrat__main .lead { font-size: 17px; }

/* ----------------------------------------------------- ЛЕНДИНГ */

.logo__sub { color: var(--brass-ink); }
.wait__emoji { width: 56px; height: 56px; margin: 0 auto; line-height: 0; }
.wait__emoji .tdot { width: 100%; height: 100%; }
.tboard__gem { color: var(--brass); }

/* ---------------------------------------------------- АДАПТИВНОСТЬ */

@media (max-width: 1199px) {
  .tgrat { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  .timeline { padding: 12px 8px; }
  .timeline__stops { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .stop { padding: 8px 3px 6px; gap: 2px; border-radius: var(--r-sm); }
  .stop__year { font-size: 14px; }
  .stop__icon { width: 26px; height: 26px; }
  /* название эпохи в узкую колонку не влезает и ломается по буквам:
     на телефоне остаются год, знак и состояние, имя есть в подписи ниже */
  .stop__title, .stop__artifact { display: none; }
  .stop__state { font-size: 9px; letter-spacing: 0; }
  .stop--active { transform: scale(1.04); }
  .screen--map .mini { padding: 8px 10px; margin-top: 8px; }
  .screen--map .mini__row { font-size: 13px; }

  .intro__year { font-size: 40px; }
  .intro--era .display { font-size: 22px; }

  .screen--question .robot__art {
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    z-index: 0;
    margin: 0;
    opacity: .45;
    pointer-events: none;
  }
  .screen--question .robot__art .art { width: 140px; }
  .robotbar { gap: 3px; }
  .robotbar__label { font-size: 11px; letter-spacing: .06em; }
  .robotbar__track { height: 10px; }
  .robotreply { padding: 12px 14px; }
  .robotreply__text { font-size: 15px; }

  .teachers { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .teacher__fig { max-width: 76px; }
  .teacher__name { font-size: 11px; }
  .victory__robot { width: 150px; }
  .victory__head .story__lines { text-align: center; }

  .thanks { grid-template-columns: 1fr; gap: 8px; }
  .thank { min-height: 52px; font-size: 15px; }
}

/* Проектор на тёмных эпохах: заголовки боковой панели лежат прямо на фоне
   зоны, а не на белой карточке, поэтому берут светлый акцент зоны. */
.screen--live.zone--dark .side__title { color: var(--z-label); }
.screen--live.zone--dark .latejoin { background: rgba(255,255,255,.94); }

/* ------------------------------------------------ КОНТРАСТ НА ТЁМНЫХ ЭПОХАХ */

/* Белые строки таблицы команд на тёмном экране «свидетельство получено»
   наследовали светлые чернила зоны: текст пропадал на белом. */
.zone--dark .board__row { color: var(--ink); }
.zone--dark .board__row .board__place { color: var(--ink-55); }
/* Заголовок карточки эпохи на проекторе красился сине-фиолетовым градиентом
   и сливался с ночным фоном Академии и будущего: там нужен латунный. */
.screen--live.zone--dark .intro .display,
.zone--dark .intro .display {
  background: var(--grad-brass);
  -webkit-background-clip: text;
  background-clip: text;
}
/* подпись шкалы уверенности на проекторе лежит прямо на фоне зоны */
.screen--live.zone--dark .robotbar__label,
.screen--live.zone--dark .duel__hint { color: var(--z-label); }
.zone--dark .robotbar__label { color: var(--z-label); }
/* подписи под HUD на тёмных экранах задания */
.zone--dark .qtop__no { color: var(--z-muted); }
/* прогресс-полоса на тёмном фоне */
.zone--dark .phase-bar { background: rgba(255,255,255,.18); }

/* -------------------------------------------- ДУЭЛЬ НА ПРОЕКТОРЕ */

/* Робот стоит рядом с заданием, а не в боковой панели: раньше он отодвигал
   кнопки управления в самый низ экрана. */
.duel {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--r-lg);
  background: var(--z-card, rgba(255,255,255,.12));
}
.duel__robot { width: 150px; line-height: 0; }
.duel__robot .art { width: 100%; height: auto; display: block; }
.duel__body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.duel__body .robotbar--teacher { margin-top: 0; }
.duel__hint { margin: 0; font-size: 14px; color: var(--z-muted, var(--ink-70)); }

@media (max-width: 767px) {
  .duel { grid-template-columns: 90px minmax(0, 1fr); gap: 10px; padding: 10px; }
  .duel__robot { width: 90px; }
}
