/* Комната здания: картина наверху, хозяин с репликой, ниже — бумажный лист с содержимым. */

.room {
  min-height: 100vh;
  min-height: 100svh;
  background: var(--night);
}

.room-backdrop {
  position: fixed;
  inset: -6%;
  z-index: 0;
  background-color: #241844;
  background-position: center;
  background-size: cover;
  filter: saturate(1.2) brightness(0.72);
  pointer-events: none;
}
.room-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(27, 18, 51, 0.1) 20%, rgba(18, 10, 36, 0.72) 100%);
}

.room-col {
  position: relative;
  z-index: 1;
  width: min(100%, 780px);
  margin: 0 auto;
}

/* ── Верх: картина комнаты ── */
.room-top {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: clamp(330px, 56vh, 470px);
  padding: max(10px, env(safe-area-inset-top)) 14px 0;
  overflow: hidden;
  isolation: isolate;
  color: #fff;
}
.room-art {
  position: absolute;
  left: 0;
  top: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% var(--focus, 12%);
  animation: room-in 0.7s var(--ease) both;
}
@keyframes room-in {
  from {
    transform: scale(1.12);
    filter: brightness(0.3);
  }
}
.room-top::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to bottom, rgba(30, 21, 17, 0.72) 0, rgba(30, 21, 17, 0.42) 76px, rgba(30, 21, 17, 0) 150px),
    linear-gradient(to top, rgba(30, 21, 17, 0.5) 0, rgba(30, 21, 17, 0) 46%);
}

.room-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.room-nav .plaque {
  font-size: 14.5px;
  text-decoration: none;
}
.back-arrow {
  font: 800 15px/1 var(--display);
  margin-right: 1px;
}
a.plaque {
  transition: transform 0.2s var(--pop), filter 0.2s;
}
a.plaque:hover,
a.plaque:focus-visible {
  transform: scale(1.05);
  filter: drop-shadow(0 0 8px rgba(255, 214, 120, 0.9)) drop-shadow(0 3px 4px rgba(20, 8, 30, 0.55));
}
/* Зона нажатия не меньше 44 точек при плашке в 34. */
.room-nav a {
  position: relative;
}
.room-nav a::after {
  content: "";
  position: absolute;
  inset: -11px -8px;
}

.room-title {
  margin: 16px 2px 0;
}
.room-building {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 5px;
  font: 800 11.5px/1.1 var(--display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 1px 0 var(--ink), 0 0 8px rgba(30, 21, 17, 0.9);
}
.room-building img {
  width: 24px;
  height: 24px;
}
.room-title h1 {
  margin: 0;
  font: 800 clamp(24px, 6.6vw, 38px) / 1.08 var(--display);
  letter-spacing: -0.01em;
  text-shadow: 0 1.5px 0 var(--ink), 0 0 3px var(--ink), 0 0 12px rgba(30, 21, 17, 0.6);
  text-wrap: balance;
}

/* Хозяин комнаты и его реплика. */
.host {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 4px;
  margin-top: auto;
  padding-top: 14px;
}
.host .say {
  margin: 0 0 26px;
  animation: say-in 0.5s 0.25s var(--pop) both;
}
.host .say::after {
  content: "";
  position: absolute;
  right: -9px;
  bottom: 22px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--ink);
  border-width: 2px 2px 0 0;
  background: var(--white);
  transform: rotate(45deg);
}
@keyframes say-in {
  from {
    opacity: 0;
    transform: translateX(14px) scale(0.94);
  }
}
.host-fig {
  display: block;
  width: auto;
  height: auto;
  max-width: min(45vw, 300px);
  max-height: clamp(168px, 31vh, 250px);
  margin: 0 -6px 0 0;
  transform-origin: 50% 100%;
  animation: host-in 0.6s 0.1s var(--ease) both, breathe-fig 4.6s 0.8s ease-in-out infinite;
  filter: drop-shadow(0 6px 8px rgba(20, 8, 30, 0.5));
}
.host-fig.blub-fig {
  max-height: clamp(110px, 20vh, 150px);
  margin: 0 6px 14px 4px;
}
@keyframes host-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}
@keyframes breathe-fig {
  50% {
    transform: scale(1.006, 1.016) rotate(0.4deg);
  }
}

/* ── Бумажный лист ── */
.sheet {
  position: relative;
  z-index: 2;
  margin-top: -18px;
  padding: 8px 18px 30px;
  border: 2px solid var(--ink);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 8px 0 rgba(30, 21, 17, 0.55);
  animation: sheet-in 0.55s 0.05s var(--ease) both;
}
@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(26px);
  }
}
.sheet > section {
  padding: 20px 0 6px;
  scroll-margin-top: 12px;
}
.sheet > section + section {
  border-top: 2px dashed #d9c8ae;
  margin-top: 16px;
}
.sheet h2 {
  margin: 0 0 12px;
  font: 800 clamp(18px, 4.8vw, 23px) / 1.15 var(--display);
  letter-spacing: -0.005em;
  text-wrap: balance;
}
.sheet h3 {
  margin: 0 0 4px;
  font: 800 14.5px/1.2 var(--display);
}
.sheet p {
  margin: 0 0 12px;
}
.sheet p.lead {
  font-size: 19px;
  line-height: 1.45;
  font-weight: 700;
}
.sheet p.small {
  color: var(--note);
  font-size: 14.5px;
}
.sheet a:not(.btn):not(.store):not(.chip) {
  color: var(--ink);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--mustard-deep);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.sheet strong {
  font-weight: 700;
}

.list {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}
.list li {
  position: relative;
  margin: 0 0 10px;
  padding-left: 22px;
}
.list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.55em;
  width: 9px;
  height: 9px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  background: var(--mustard);
  transform: rotate(45deg);
}

/* Заметки: честная строка, совет, планы. */
.note {
  margin: 0 0 14px;
  padding: 13px 15px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: #fdeecb;
}
.note p:last-child,
.note ul:last-child {
  margin-bottom: 0;
}
.note.honest {
  background: #e3f1e6;
}
.note.plan {
  border-style: dashed;
  background: #efe7f7;
}
.note.honest .list li::before {
  top: 0.38em;
  width: 7px;
  height: 12px;
  border: solid var(--herb);
  border-width: 0 3px 3px 0;
  border-radius: 0;
  background: none;
}
.note.plan .list li::before {
  border-radius: 50%;
  background: #b9a3dd;
  transform: none;
}
.note-label {
  display: inline-block;
  margin: 0 0 8px;
  padding: 3px 9px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--white);
  font: 800 10.5px/1.25 var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Карточки. */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 12px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}
.card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 4px 13px;
  align-items: start;
  padding: 13px 14px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 3px 0 rgba(30, 21, 17, 0.85);
}
.card-pic {
  grid-row: span 3;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 40%, #4a3a86, var(--indigo));
  box-shadow: inset 0 0 0 2px rgba(255, 210, 122, 0.55);
}
.card-pic img {
  display: block;
  max-width: 54px;
  max-height: 54px;
  width: auto;
  height: auto;
  filter: drop-shadow(0 2px 2px rgba(10, 4, 24, 0.5));
}
.card-pic.tall {
  overflow: hidden;
}
.card-pic.tall img {
  max-width: none;
  max-height: none;
  height: 84px;
  transform: rotate(38deg);
}
.card p {
  margin: 0;
  font-size: 15px;
  line-height: 1.42;
}
.card .more {
  margin-top: 6px;
  font-size: 14px;
}
.cards.chip {
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}
.cards.chip .card {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 6px;
  padding: 11px 6px 9px;
  text-align: center;
}
.cards.chip .card-pic {
  grid-row: auto;
  width: 60px;
  height: 60px;
}
.cards.chip h3 {
  margin: 0;
  font: 700 13px/1.2 var(--text);
}
.cards.figure {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
}
.cards.figure .card {
  grid-template-columns: 78px minmax(0, 1fr);
}
.cards.figure .card-pic {
  width: 78px;
  height: 112px;
  align-items: end;
  overflow: hidden;
  padding-top: 6px;
}
.cards.figure .card-pic img {
  max-width: none;
  max-height: none;
  height: 104px;
}
.cards.wide {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
}

/* Шаги. */
.steps {
  counter-reset: step;
  display: grid;
  gap: 12px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}
.steps li {
  counter-increment: step;
  position: relative;
  min-height: 40px;
  padding-left: 52px;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--mustard);
  box-shadow: 0 3px 0 var(--ink);
  font: 800 15px/1 var(--display);
}
.steps p {
  margin: 0;
  font-size: 15.5px;
}

/* Телефон со снимком или записью. */
.phone {
  position: relative;
  display: block;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 26px;
  background: #120c22;
  box-shadow: 0 5px 0 rgba(30, 21, 17, 0.85), 0 0 0 1px rgba(255, 210, 122, 0.4) inset;
}
.phone img,
.phone video {
  display: block;
  width: 100%;
  height: auto;
}
/* Снимки приходят из разных источников и чуть разной высоты: в ряду у всех одна пропорция
   экрана телефона, лишнее по бокам срезается. */
.shots .phone img {
  aspect-ratio: 440 / 956;
  object-fit: cover;
  object-position: 50% 0;
}
.shots .phone.squat img {
  aspect-ratio: 320 / 568;
}
.shots {
  display: flex;
  gap: 14px;
  margin: 0 -18px 14px;
  padding: 4px 18px 12px;
  overflow-x: auto;
  list-style: none;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 18px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--mustard-deep) transparent;
}
.shots li {
  flex: 0 0 min(58%, 222px);
  scroll-snap-align: start;
}
.shots figure,
.clip {
  margin: 0;
}
.shots figcaption {
  margin-top: 11px;
  font-size: 13.5px;
  line-height: 1.35;
  font-weight: 700;
  text-wrap: balance;
}
.shots figcaption small {
  display: block;
  margin-top: 2px;
  color: var(--note);
  font-weight: 400;
}

.clip {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin: 0 0 14px;
}
.clip .phone {
  width: min(100%, 236px);
  margin: 0 auto;
}
.clip figcaption {
  margin-top: 10px;
  color: var(--note);
  font-size: 13.5px;
  line-height: 1.35;
  text-align: center;
}
.clip-toggle {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--mustard);
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
}
.js .clip-toggle {
  display: grid;
}
.clip-toggle::before {
  content: "";
  width: 0;
  height: 0;
  margin-left: 3px;
  border: 8px solid transparent;
  border-left: 13px solid var(--ink);
  border-right-width: 0;
}
.clip-toggle.on::before {
  width: 12px;
  height: 14px;
  margin: 0;
  border: 0;
  border-left: 4px solid var(--ink);
  border-right: 4px solid var(--ink);
}
@media (min-width: 620px) {
  .clip {
    grid-template-columns: 236px minmax(0, 1fr);
    align-items: center;
    gap: 26px;
  }
}

/* Ряд картинок: эликсиры, ступени камня. */
.strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  /* Картинки стоят на полке, каждая в своих пропорциях: по высоте соседки не растягиваются. */
  align-items: flex-end;
  gap: 8px 4px;
  margin: 0 0 14px;
  padding: 10px 10px 6px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: radial-gradient(ellipse at 50% 30%, #4a3a86, var(--indigo));
}
.strip img {
  display: block;
  width: auto;
  height: calc(var(--k, 1) * clamp(46px, 15vw, 80px));
  filter: drop-shadow(0 3px 3px rgba(10, 4, 24, 0.6));
}
.strip.large img {
  height: calc(var(--k, 1) * clamp(38px, 13vw, 104px));
  margin: 2px;
}

/* Реплика второго персонажа внутри листа. */
.npc-aside {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  gap: 2px;
  margin: 0 0 14px -6px;
}
.npc-aside img {
  display: block;
  width: auto;
  height: 168px;
  filter: drop-shadow(0 4px 5px rgba(20, 8, 30, 0.35));
}
.npc-aside .say {
  margin-bottom: 18px;
}
.npc-aside .say::after {
  content: "";
  position: absolute;
  left: -9px;
  bottom: 22px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--ink);
  border-width: 0 0 2px 2px;
  background: var(--white);
  transform: rotate(45deg);
}

/* Витрина героев и стражей. */
.showcase {
  margin: 0 0 16px;
}
.show-stage {
  display: none;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: 4px 14px;
  min-height: 250px;
  margin: 0 0 12px;
  padding: 14px 14px 12px;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: radial-gradient(ellipse at 30% 100%, rgba(120, 190, 255, 0.3), rgba(120, 190, 255, 0) 55%), radial-gradient(ellipse at 50% 20%, #4a3a86, var(--indigo));
  box-shadow: 0 4px 0 rgba(30, 21, 17, 0.85);
  color: #fff;
}
.js .show-stage {
  display: grid;
}
.showcase .sprite img {
  height: clamp(210px, 44vh, 330px);
  filter: drop-shadow(0 8px 10px rgba(8, 4, 24, 0.55));
}
.showcase[data-kind="bosses"] .sprite img {
  height: clamp(150px, 30vh, 230px);
}
.show-info h3 {
  margin: 0;
  font: 800 clamp(17px, 4.6vw, 22px) / 1.15 var(--display);
  color: #fff;
}
.show-sub {
  margin: 5px 0 9px !important;
  color: var(--gold);
  font: 700 13px/1.3 var(--text);
  letter-spacing: 0.02em;
}
.show-text {
  margin: 0 !important;
  font-size: 15px;
  line-height: 1.45;
  color: #f1eaff;
}
.roster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.roster li {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 2px 12px;
  align-items: center;
}
.pick {
  grid-row: span 2;
  display: grid;
  justify-items: center;
  gap: 3px;
  width: 100%;
  min-height: 44px;
  padding: 6px 2px 5px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--white);
  box-shadow: 0 3px 0 rgba(30, 21, 17, 0.85);
  color: var(--ink);
  font: 700 12px/1.15 var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pick img {
  display: block;
  width: auto;
  height: 62px;
  max-width: 100%;
  object-fit: contain;
}
.pick small {
  color: var(--note);
  font: 400 11px/1.1 var(--text);
}
.pick[aria-pressed="true"] {
  background: var(--mustard);
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(30, 21, 17, 0.85);
}
.pick-text {
  margin: 0 !important;
  font-size: 14.5px;
  line-height: 1.4;
}
/* Со скриптами список сжимается в ряд кнопок, а текст уходит на сцену. */
.js .roster {
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 8px;
}
.js .roster li {
  display: block;
}
.js .roster .pick-text,
.js .roster .pick-title {
  display: none;
}
.pick-title {
  margin: 0;
  align-self: end;
  font: 800 13.5px/1.2 var(--display);
}

/* Новости. */
.news {
  display: grid;
  gap: 12px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}
.news li {
  position: relative;
  padding: 16px 16px 13px;
  border: 2px solid var(--ink);
  border-radius: 6px 14px 10px 16px;
  background: var(--white);
  box-shadow: 0 3px 0 rgba(30, 21, 17, 0.85);
}
.news li:nth-child(odd) {
  transform: rotate(-0.4deg);
}
.news li:nth-child(even) {
  transform: rotate(0.35deg);
}
.news li::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -8px;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--tomato);
}
.news time,
.news .when {
  display: block;
  margin-bottom: 4px;
  color: var(--note);
  font: 700 11.5px/1.2 var(--text);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.news p {
  margin: 0;
  font-size: 15.5px;
}

/* Ссылки-кнопки и контакты. */
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}
.contact {
  margin: 0 0 14px;
  padding: 16px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 3px 0 rgba(30, 21, 17, 0.85);
}
.contact .label {
  margin: 0 0 4px;
  color: var(--note);
  font: 700 11.5px/1.2 var(--text);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.contact .value {
  margin: 0;
  font: 800 clamp(15px, 4.4vw, 20px) / 1.25 var(--display);
  overflow-wrap: anywhere;
}
.contact .value.wait {
  font: 700 17px/1.35 var(--text);
}
.store-box {
  display: grid;
  justify-items: start;
  gap: 9px;
  margin: 4px 0 6px;
  scroll-margin-top: 16px;
}
.store-box p {
  margin: 0;
  color: var(--note);
  font-size: 14.5px;
}

/* ── Низ комнаты: куда дальше и подвал ── */
.elsewhere {
  position: relative;
  z-index: 1;
  margin: 26px 0 0;
  padding: 0 14px;
}
.elsewhere h2 {
  margin: 0 0 12px;
  color: #fff;
  font: 800 15px/1.2 var(--display);
  letter-spacing: 0.02em;
  text-align: center;
}
.elsewhere ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.elsewhere a {
  position: relative;
  font-size: 14px;
  text-decoration: none;
}
.elsewhere a::after {
  content: "";
  position: absolute;
  inset: -11px -4px;
}
.elsewhere li {
  padding: 11px 0;
}
.room-foot {
  position: relative;
  z-index: 1;
  padding: 26px 18px max(30px, env(safe-area-inset-bottom));
  color: #d9cdf5;
  font-size: 13.5px;
  line-height: 1.5;
  text-align: center;
}
.room-foot p {
  margin: 0 0 8px;
}
.room-foot nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 18px;
  margin: 0 0 10px;
}
.room-foot a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #fff;
  font-weight: 700;
  text-underline-offset: 3px;
}
.room-foot .fine {
  max-width: 520px;
  margin: 0 auto;
  color: #b8a9dd;
  font-size: 12.5px;
}

/* ── Широкий экран ── */
@media (min-width: 820px) {
  .room-col {
    padding-top: 26px;
  }
  .room-top {
    min-height: 440px;
    padding: 16px 22px 0;
    border: 3px solid #e8b860;
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 0 0 2px #2b1408;
  }
  .host-fig {
    max-width: 300px;
    max-height: 270px;
  }
  .host .say {
    max-width: 440px;
    justify-self: end;
    font-size: 16px;
  }
  .sheet {
    padding: 12px 34px 40px;
  }
  .shots {
    margin: 0 -34px 14px;
    padding: 4px 34px 12px;
    scroll-padding: 0 34px;
  }
  .shots li {
    flex-basis: 204px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .room-art,
  .host .say,
  .host-fig,
  .sheet {
    animation: none;
  }
}
