:root {
  --bg-top: #11253a;
  --bg-bottom: #081019;
  --paper: rgba(255, 246, 225, 0.12);
  --paper-strong: rgba(255, 246, 225, 0.2);
  --line: rgba(255, 239, 204, 0.18);
  --line-strong: rgba(255, 239, 204, 0.36);
  --ink: #fdf4e5;
  --muted: rgba(255, 244, 221, 0.8);
  --gold: #f5c96d;
  --gold-soft: rgba(245, 201, 109, 0.18);
  --mint: #b9f2cf;
  --mint-soft: rgba(135, 226, 171, 0.18);
  --red: #ff8a7a;
  --shadow: 0 32px 70px rgba(0, 0, 0, 0.34);
  --panel-bg:
    linear-gradient(180deg, rgba(255, 247, 232, 0.12), rgba(255, 247, 232, 0.04)),
    rgba(12, 24, 35, 0.78);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  min-height: 100%;
}

html {
  background: var(--bg-bottom);
}

body {
  overflow-x: hidden;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(245, 201, 109, 0.14), transparent 34%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

body.body--active-case {
  height: 100dvh;
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.14;
  background-image:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px),
    radial-gradient(circle at 72% 28%, rgba(255, 255, 255, 0.14) 0 1px, transparent 1px),
    radial-gradient(circle at 40% 70%, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px);
  background-size: 22px 22px, 30px 30px, 26px 26px;
}

.shell {
  position: relative;
  max-width: none;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 18px clamp(16px, 1.8vw, 28px) 24px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(320px, 0.7fr) minmax(320px, 1fr);
  align-items: end;
  gap: 24px;
  min-height: clamp(132px, 17vh, 190px);
}

.hero__eyebrow,
.board__eyebrow,
.quest-panel__eyebrow,
.summary-chip__label,
.inventory__eyebrow {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 230, 177, 0.76);
}

.hero__title,
.board__title,
.quest-panel__title,
.board__victory h2 {
  margin: 0;
  font-family: "Russo One", sans-serif;
  line-height: 0.98;
  letter-spacing: 0.03em;
}

.hero__title {
  font-size: clamp(3rem, 4.4rem, 4.4rem);
  text-transform: uppercase;
}

.hero__body {
  max-width: 40rem;
  margin: 8px 0 0;
  font-size: 0.94rem;
  line-height: 1.45;
  color: rgba(255, 244, 220, 0.86);
}

.hero__mascots {
  position: relative;
  min-height: clamp(120px, 15vh, 160px);
  isolation: isolate;
}

.hero__mascots::before {
  content: "";
  position: absolute;
  inset: auto 7% 8% 7%;
  height: 68%;
  border-radius: 38px;
  background:
    radial-gradient(circle at top, rgba(245, 201, 109, 0.28), transparent 58%),
    linear-gradient(180deg, rgba(242, 223, 183, 0.18), rgba(242, 223, 183, 0.04));
}

.hero__mascot {
  position: absolute;
  bottom: 0;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 18px 26px rgba(0, 0, 0, 0.28));
  animation: floatIn 900ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.hero__mascot--petr {
  left: 3%;
  height: 92%;
}

.hero__mascot--wolf {
  right: 6%;
  height: 62%;
  animation-delay: 120ms;
}

.summary-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  margin-top: 12px;
  align-items: stretch;
}

.summary-chip,
.summary-bar__button,
.board__intro,
.board__victory,
.quest-panel__section,
.quest-stage-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.summary-chip {
  padding: 10px 14px;
}

.summary-chip strong {
  display: block;
  margin-top: 5px;
  font-size: 0.98rem;
  color: var(--ink);
}

.summary-bar__button,
.scene__button,
.hero-switch__button,
.quest-character,
.scene-object,
.inventory-item {
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    opacity 180ms ease,
    box-shadow 180ms ease;
}

.summary-bar__button,
.scene__button {
  padding: 0 20px;
  border: 1px solid var(--line);
  color: #fff0cf;
  font-weight: 800;
  background: var(--panel-bg);
}

.summary-bar__button:hover,
.scene__button:hover {
  transform: translateY(-1px);
}

.scene__button--ghost {
  background: rgba(255, 247, 232, 0.08);
}

.app-shell {
  margin-top: 18px;
}

body.body--active-case .hero,
body.body--active-case .summary-bar {
  display: none;
}

body.body--active-case .shell {
  padding: 0;
}

body.body--active-case .app-shell {
  margin-top: 0;
}

.board {
  display: grid;
  gap: 14px;
}

.board__intro {
  padding: 16px 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.board__intro p,
.board__victory p,
.quest-panel__body,
.quest-panel__section--message p,
.scene-track__item span,
.quest-steps__item span,
.inventory__hint,
.inventory__status span {
  margin: 0;
  line-height: 1.62;
  color: var(--muted);
}

.board__title {
  font-size: 1.8rem;
}

.board__notice {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(245, 201, 109, 0.12);
  border: 1px solid rgba(245, 201, 109, 0.24);
}

.board__notice--success {
  background: rgba(135, 226, 171, 0.14);
  border-color: rgba(167, 225, 161, 0.26);
}

.board__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  align-items: stretch;
  gap: 18px;
  height: max(540px, calc(100dvh - 360px));
  min-height: 540px;
}

.case-card {
  position: relative;
  width: 100%;
  height: 100%;
  justify-self: stretch;
  overflow: hidden;
  border: none;
  padding: 0;
  border-radius: 18px;
  background: transparent;
  box-shadow: var(--shadow);
}

.case-card:hover {
  transform: translateY(-3px);
}

.case-card--locked {
  filter: saturate(0.68) brightness(0.9);
}

.case-card__poster {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background: #0a1016;
}

.case-card__poster-bg,
.case-card__poster-main {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
}

.case-card__poster-bg {
  object-fit: cover;
  object-position: center center;
  filter: blur(18px) saturate(1.15) brightness(0.72);
  transform: scale(1.08);
}

.case-card__poster-main {
  object-fit: contain;
  object-position: center center;
}

.case-card__shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(6, 11, 16, 0.04) 0%, rgba(5, 11, 15, 0.08) 48%, rgba(4, 8, 12, 0.36) 100%);
}

.case-card__badge,
.case-card__stamp,
.scene-object__hero,
.quest-scene__title-chip,
.quest-scene__objective {
  position: absolute;
  z-index: 2;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.case-card__badge {
  top: 18px;
  left: 18px;
  padding: 10px 14px;
  background: rgba(245, 201, 109, 0.92);
  color: #23150a;
}

.case-card__badge--locked {
  background: rgba(255, 247, 232, 0.82);
}

.case-card__stamp {
  top: 18px;
  right: 18px;
  padding: 12px 16px;
  background: rgba(206, 72, 58, 0.92);
  color: #fff5ef;
  transform: rotate(8deg);
}

.case-card__meta {
  position: absolute;
  inset: auto 16px 14px 16px;
  z-index: 2;
  display: grid;
  gap: 8px;
  padding: 10px 10px 12px;
  border-radius: 14px;
  background: rgba(4, 8, 12, 0.58);
  backdrop-filter: blur(8px);
}

.case-card__progress {
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 247, 232, 0.12);
  color: rgba(255, 245, 226, 0.86);
  font-size: 0.82rem;
  font-weight: 700;
}

.case-card__title {
  margin: 0;
  font-family: "Russo One", sans-serif;
  font-size: 1.45rem;
  line-height: 1.04;
  color: var(--ink);
}

.case-card__subtitle {
  margin: 8px 0 0;
  color: rgba(255, 244, 221, 0.82);
  line-height: 1.35;
  font-size: 0.86rem;
}

.board__victory {
  padding: 24px;
}

.case-opening {
  position: relative;
  min-height: calc(100dvh - 84px);
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1fr);
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(255, 247, 232, 0.14), rgba(255, 247, 232, 0.04)),
    rgba(8, 16, 24, 0.92);
  box-shadow: var(--shadow);
}

.case-opening::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(245, 201, 109, 0.1), transparent 36%, rgba(185, 242, 207, 0.08));
}

.case-opening__poster {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  background: rgba(4, 8, 12, 0.62);
}

.case-opening__poster-bg {
  position: absolute;
  inset: -18px;
  width: calc(100% + 36px);
  height: calc(100% + 36px);
  object-fit: cover;
  filter: saturate(1.04) brightness(0.58) blur(8px);
}

.case-opening__glow {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 247, 232, 0.1), transparent 38%, rgba(5, 10, 15, 0.48)),
    linear-gradient(90deg, rgba(5, 10, 15, 0.2), transparent 46%, rgba(5, 10, 15, 0.18));
}

.case-opening__hero {
  position: absolute;
  z-index: 2;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 24px 28px rgba(0, 0, 0, 0.34));
  animation: splashHero 720ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.case-opening__hero--petya {
  left: 8%;
  bottom: 4%;
  width: min(56%, 300px);
}

.case-opening__hero--wolf {
  right: 7%;
  bottom: 9%;
  width: min(42%, 220px);
  animation-delay: 120ms;
}

.case-opening__copy {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  gap: 14px;
  padding: clamp(30px, 5vw, 72px);
}

.case-opening__eyebrow,
.case-opening__label {
  margin: 0;
  width: fit-content;
  padding: 9px 13px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.case-opening__eyebrow {
  background: rgba(245, 201, 109, 0.9);
  color: #241507;
}

.case-opening__label {
  background: rgba(255, 247, 232, 0.1);
  color: rgba(255, 236, 196, 0.86);
}

.case-opening__brand,
.case-opening__title {
  margin: 0;
  font-family: "Russo One", sans-serif;
  color: var(--ink);
}

.case-opening__brand {
  font-size: clamp(3.4rem, 7vw, 6.5rem);
  line-height: 0.9;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.case-opening__title {
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 0.98;
  letter-spacing: 0.01em;
}

.case-opening__subtitle {
  max-width: 42rem;
  margin: 0;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.48;
}

.case-opening__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.case-opening__actions .scene__button {
  min-height: 48px;
}

.quest-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.78fr);
  gap: 18px;
  align-items: start;
}

.quest-stage-card {
  padding: 18px;
  display: grid;
  gap: 16px;
}

body.body--active-case .quest-layout {
  height: 100dvh;
  min-height: 100dvh;
  grid-template-columns: minmax(0, 1fr) clamp(260px, 16vw, 320px);
  gap: 0;
  align-items: stretch;
}

body.body--active-case .quest-stage-card {
  height: 100dvh;
  min-height: 100dvh;
  padding: 8px 8px 8px 10px;
  border-radius: 0;
  border: none;
  box-shadow: none;
  background:
    linear-gradient(180deg, rgba(255, 247, 232, 0.08), rgba(255, 247, 232, 0.03)),
    rgba(7, 14, 22, 0.92);
  grid-template-rows: auto minmax(0, 1fr) 128px;
}

body.body--active-case .quest-panel {
  height: 100dvh;
  min-height: 100dvh;
  padding: 10px;
  gap: 10px;
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(255, 247, 232, 0.08), rgba(255, 247, 232, 0.03)),
    rgba(7, 14, 22, 0.94);
  border-left: 1px solid var(--line);
}

body.body--active-case .quest-panel__section {
  box-shadow: none;
  padding: 12px;
  gap: 8px;
}

.quest-toolbar,
.inventory__head,
.quest-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quest-toolbar__cluster {
  display: flex;
  gap: 10px;
}

.quest-scene {
  position: relative;
  min-height: 660px;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid rgba(255, 247, 232, 0.14);
  background: rgba(5, 12, 18, 0.5);
}

body.body--active-case .quest-scene {
  min-height: 420px;
  height: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
}

.quest-scene__artwork,
.quest-scene__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.quest-scene__artwork {
  object-fit: cover;
}

.quest-scene__overlay {
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(4, 9, 14, 0.06), rgba(4, 9, 14, 0.1) 40%, rgba(4, 9, 14, 0.24) 100%),
    radial-gradient(circle at 50% 10%, rgba(255, 255, 255, 0.08), transparent 30%);
}

.quest-scene--night-room .quest-scene__overlay {
  background:
    linear-gradient(180deg, rgba(3, 8, 16, 0.08), rgba(3, 8, 16, 0.12) 40%, rgba(3, 8, 16, 0.3) 100%),
    radial-gradient(circle at 78% 24%, rgba(255, 245, 196, 0.22), transparent 24%);
}

.quest-scene--dream .quest-scene__overlay {
  background:
    linear-gradient(180deg, rgba(8, 10, 28, 0.08), rgba(8, 10, 28, 0.12) 46%, rgba(8, 10, 28, 0.26) 100%),
    radial-gradient(circle at 50% 14%, rgba(183, 205, 255, 0.26), transparent 30%);
}

.quest-scene--moon .quest-scene__overlay {
  background:
    linear-gradient(180deg, rgba(5, 8, 21, 0.04), rgba(5, 8, 21, 0.1) 42%, rgba(5, 8, 21, 0.2) 100%),
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.12), transparent 26%);
}

.quest-scene--nightmare .quest-scene__overlay {
  background:
    linear-gradient(180deg, rgba(10, 4, 12, 0.14), rgba(10, 4, 12, 0.18) 44%, rgba(10, 4, 12, 0.34) 100%),
    radial-gradient(circle at 26% 28%, rgba(255, 114, 110, 0.18), transparent 20%);
}

.quest-scene--metro .quest-scene__overlay {
  background:
    linear-gradient(180deg, rgba(5, 10, 18, 0.08), rgba(5, 10, 18, 0.12) 44%, rgba(5, 10, 18, 0.28) 100%),
    radial-gradient(circle at 24% 18%, rgba(183, 209, 238, 0.2), transparent 26%);
}

.quest-scene--warehouse .quest-scene__overlay {
  background:
    linear-gradient(180deg, rgba(8, 10, 12, 0.08), rgba(8, 10, 12, 0.1) 42%, rgba(8, 10, 12, 0.24) 100%),
    radial-gradient(circle at 64% 24%, rgba(243, 200, 108, 0.16), transparent 24%);
}

.quest-scene--witch-room .quest-scene__overlay {
  background:
    linear-gradient(180deg, rgba(10, 6, 12, 0.08), rgba(10, 6, 12, 0.12) 42%, rgba(10, 6, 12, 0.28) 100%),
    radial-gradient(circle at 38% 22%, rgba(255, 244, 218, 0.24), transparent 26%);
}

.quest-scene--animal-yard .quest-scene__overlay {
  background:
    linear-gradient(180deg, rgba(5, 18, 20, 0.06), rgba(5, 18, 20, 0.1) 42%, rgba(5, 18, 20, 0.26) 100%),
    radial-gradient(circle at 18% 26%, rgba(255, 232, 178, 0.18), transparent 24%);
}

.quest-scene--old-park .quest-scene__overlay {
  background:
    linear-gradient(180deg, rgba(8, 24, 15, 0.06), rgba(8, 24, 15, 0.12) 44%, rgba(8, 24, 15, 0.3) 100%),
    radial-gradient(circle at 78% 18%, rgba(255, 215, 112, 0.2), transparent 24%);
}

.quest-scene--vet-clinic .quest-scene__overlay {
  background:
    linear-gradient(180deg, rgba(4, 24, 28, 0.04), rgba(4, 24, 28, 0.09) 42%, rgba(4, 24, 28, 0.22) 100%),
    radial-gradient(circle at 42% 22%, rgba(210, 255, 255, 0.2), transparent 26%);
}

.quest-scene--animal-return .quest-scene__overlay {
  background:
    linear-gradient(180deg, rgba(18, 11, 9, 0.06), rgba(18, 11, 9, 0.12) 46%, rgba(18, 11, 9, 0.3) 100%),
    radial-gradient(circle at 84% 20%, rgba(255, 220, 132, 0.22), transparent 28%);
}

.quest-scene__title-chip {
  top: 18px;
  left: 18px;
  padding: 10px 14px;
  background: rgba(8, 17, 25, 0.68);
  backdrop-filter: blur(8px);
  color: rgba(255, 245, 221, 0.9);
}

.quest-scene__objective {
  top: 18px;
  right: 18px;
  max-width: min(58%, 560px);
  padding: 10px 14px;
  background: rgba(255, 247, 232, 0.12);
  color: rgba(255, 245, 221, 0.88);
}

.scene-object {
  position: absolute;
  z-index: 3;
  display: block;
  border: 1px solid transparent;
  border-radius: 18px;
  background: transparent;
  box-shadow: none;
}

.scene-object:hover,
.scene-object:focus-visible {
  transform: translateY(-2px);
  outline: none;
  border-color: transparent;
  background: transparent;
}

.scene-object:hover .scene-object__icon,
.scene-object:focus-visible .scene-object__icon {
  border-color: rgba(255, 231, 164, 0.96);
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.24),
    0 0 0 10px rgba(245, 201, 109, 0.16);
}

.scene-object--inspect {
  border-style: solid;
  border-color: transparent;
  background: transparent;
}

.scene-object--hero-action {
  border-color: transparent;
}

.scene-object--use-item {
  border-color: transparent;
}

.scene-object--done {
  border-color: transparent;
  background: transparent;
}

.scene-object--focus {
  border-color: transparent;
  box-shadow: none;
  animation: pulseHotspot 1.35s ease-in-out infinite;
}

.scene-object__label,
.scene-object__hero,
.scene-object__guide {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  pointer-events: none;
}

.scene-object__icon {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  display: grid;
  place-items: center;
  width: var(--scene-object-icon-size, 66px);
  height: var(--scene-object-icon-size, 66px);
  padding: var(--scene-object-icon-padding, 10px);
  border-radius: 999px;
  background: rgba(255, 247, 232, 0.18);
  border: 2px solid rgba(255, 231, 164, 0.75);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.22),
    0 0 0 8px rgba(245, 201, 109, 0.1);
  transform: translate(-50%, -50%);
}

.scene-object__icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.scene-object__label {
  bottom: calc(100% + 10px);
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(8, 17, 25, 0.76);
  color: rgba(255, 245, 221, 0.96);
  font-size: 0.88rem;
  font-weight: 700;
  opacity: 0;
}

.scene-object:hover .scene-object__label,
.scene-object:focus-visible .scene-object__label,
.scene-object--focus .scene-object__label {
  opacity: 1;
}

.scene-object__hero {
  top: calc(100% + 8px);
  padding: 6px 10px;
  background: rgba(12, 25, 36, 0.72);
  color: rgba(255, 236, 196, 0.88);
  opacity: 0;
}

.scene-object:hover .scene-object__hero,
.scene-object:focus-visible .scene-object__hero,
.scene-object--focus .scene-object__hero {
  opacity: 1;
}

.scene-object__guide {
  bottom: calc(100% + 44px);
  max-width: min(320px, 56vw);
  padding: 10px 14px;
  border-radius: 16px;
  white-space: normal;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: #23150a;
  background: rgba(245, 201, 109, 0.96);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.22);
}

.quest-character {
  position: absolute;
  bottom: 8%;
  z-index: 4;
  width: 152px;
  padding: 0;
  border: none;
  background: transparent;
  transform: translateX(-50%);
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.28));
  transition:
    left var(--move-duration, 360ms) linear,
    transform 180ms ease,
    filter 180ms ease;
}

.quest-character img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  transform-origin: center bottom;
}

.quest-character span {
  display: none;
  margin: 6px auto 0;
  width: fit-content;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(8, 17, 25, 0.78);
  color: rgba(255, 245, 221, 0.92);
  font-size: 0.92rem;
  font-weight: 800;
}

.quest-character--petya {
  width: clamp(220px, 15vw, 300px);
}

.quest-character--wolf {
  width: clamp(170px, 11.5vw, 230px);
}

.quest-character--active {
  filter:
    drop-shadow(0 18px 24px rgba(0, 0, 0, 0.28))
    drop-shadow(0 0 18px rgba(245, 201, 109, 0.2));
}

.quest-character--moving img {
  animation: walkBob 230ms ease-in-out infinite alternate;
}

.quest-character[data-facing="left"] img {
  transform: scaleX(-1);
}

.quest-scene__message,
.inventory,
.inventory__status {
  border: 1px solid rgba(255, 247, 232, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 247, 232, 0.12), rgba(255, 247, 232, 0.03)),
    rgba(10, 20, 30, 0.62);
  backdrop-filter: blur(10px);
}

.quest-scene__message {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 5;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
}

.quest-scene__message strong,
.inventory__status strong {
  font-size: 1rem;
}

.quest-scene__message span {
  color: var(--muted);
  line-height: 1.55;
}

.quest-scene__solved {
  position: absolute;
  inset: auto 20px 120px auto;
  z-index: 6;
  max-width: 360px;
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid rgba(185, 242, 207, 0.3);
  background: rgba(9, 21, 30, 0.86);
  box-shadow: 0 22px 34px rgba(0, 0, 0, 0.28);
}

.quest-scene__solved span {
  color: var(--muted);
  line-height: 1.55;
}

.inventory {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 24px;
}

body.body--active-case .inventory {
  grid-template-columns: 112px minmax(0, 1fr) minmax(220px, 280px);
  grid-template-rows: 1fr;
  align-items: center;
  gap: 10px;
  height: 128px;
  max-height: 128px;
  padding: 8px 10px;
  overflow: visible;
  border-radius: 14px;
}

body.body--active-case .inventory__head {
  display: block;
  align-self: center;
}

body.body--active-case .inventory__hint {
  display: none;
}

body.body--active-case .inventory h3 {
  margin-top: 2px;
  font-size: 0.98rem;
}

.inventory--focus {
  border-color: rgba(245, 201, 109, 0.32);
  box-shadow: 0 0 0 1px rgba(245, 201, 109, 0.16), inset 0 0 24px rgba(245, 201, 109, 0.08);
}

.inventory h3,
.quest-panel h3 {
  margin: 4px 0 0;
  font-size: 1.14rem;
}

.inventory__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

body.body--active-case .inventory__grid {
  grid-auto-flow: column;
  grid-auto-columns: 88px;
  grid-template-columns: none;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

body.body--active-case .inventory-item {
  min-height: 88px;
  padding: 8px;
  grid-template-columns: 1fr;
  grid-template-rows: 58px 1fr;
  gap: 5px;
  align-items: center;
  justify-items: center;
  text-align: center;
  border-radius: 12px;
}

body.body--active-case .inventory-item__art {
  width: 58px;
  height: 58px;
  padding: 5px;
  border-radius: 12px;
}

body.body--active-case .inventory-item__copy {
  display: grid;
  gap: 4px;
  align-self: center;
}

body.body--active-case .inventory-item__copy strong {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.05;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.body--active-case .inventory-item__copy span {
  display: none;
}

.inventory-item {
  min-height: 132px;
  padding: 14px;
  border: 1px solid rgba(255, 247, 232, 0.12);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 247, 232, 0.08), rgba(255, 247, 232, 0.03)),
    rgba(10, 20, 30, 0.42);
  color: var(--ink);
  text-align: left;
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.inventory-item__art {
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  padding: 13px;
  border-radius: 18px;
  background: rgba(255, 247, 232, 0.08);
  border: 1px solid rgba(255, 247, 232, 0.12);
}

.inventory-item__art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.inventory-item__copy {
  display: block;
  min-width: 0;
}

.inventory-item strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.02rem;
}

.inventory-item span {
  display: block;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.94rem;
}

.inventory-item:hover,
.inventory-item:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(255, 247, 232, 0.26);
}

.inventory-item--selected {
  border-color: rgba(245, 201, 109, 0.62);
  background:
    linear-gradient(180deg, rgba(245, 201, 109, 0.16), rgba(245, 201, 109, 0.06)),
    rgba(15, 26, 36, 0.7);
  box-shadow: 0 0 0 1px rgba(245, 201, 109, 0.18);
}

.inventory-item--selected .inventory-item__art {
  background: rgba(245, 201, 109, 0.16);
  border-color: rgba(245, 201, 109, 0.26);
}

.inventory__empty,
.inventory__status {
  padding: 14px 16px;
  border-radius: 18px;
}

body.body--active-case .inventory__empty,
body.body--active-case .inventory__status {
  padding: 8px 10px;
  border-radius: 12px;
}

body.body--active-case .inventory__status strong,
body.body--active-case .inventory__empty,
body.body--active-case .inventory__status span {
  font-size: 0.82rem;
  line-height: 1.24;
}

.inventory__empty {
  color: var(--muted);
  line-height: 1.58;
  background: rgba(255, 247, 232, 0.06);
  border: 1px dashed rgba(255, 247, 232, 0.14);
}

.quest-panel {
  display: grid;
  gap: 14px;
}

.quest-panel__section {
  padding: 16px 18px;
  display: grid;
  gap: 10px;
}

.quest-panel__section strong {
  font-size: 1rem;
}

.quest-panel__title {
  font-size: clamp(1.5rem, 2.2vw, 2.05rem);
  line-height: 1.02;
}

body.body--active-case .quest-panel__title {
  font-size: 1.35rem;
}

body.body--active-case .quest-panel__body,
body.body--active-case .quest-panel__section--message p,
body.body--active-case .scene-track__item span,
body.body--active-case .quest-steps__item span {
  font-size: 0.84rem;
  line-height: 1.35;
}

body.body--active-case .quest-panel__section strong,
body.body--active-case .quest-panel__head h3,
body.body--active-case .quest-panel__head span {
  font-size: 0.9rem;
}

.quest-panel__section--goal {
  border-color: rgba(245, 201, 109, 0.24);
}

.quest-panel__section--message {
  border-color: rgba(255, 247, 232, 0.2);
  background:
    linear-gradient(180deg, rgba(245, 201, 109, 0.12), rgba(245, 201, 109, 0.04)),
    rgba(12, 24, 35, 0.78);
}

.quest-panel__head span,
.scene-track__item strong,
.quest-steps__item strong {
  color: var(--ink);
}

.hero-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.hero-switch__button {
  padding: 9px 10px;
  border: 1px solid rgba(255, 247, 232, 0.14);
  border-radius: 12px;
  background: rgba(255, 247, 232, 0.06);
  color: var(--ink);
  font-weight: 800;
}

.hero-switch__button--active {
  border-color: rgba(245, 201, 109, 0.6);
  background: rgba(245, 201, 109, 0.16);
}

.quest-panel__role {
  font-size: 0.95rem;
}

.quest-steps,
.scene-track {
  margin: 0;
  padding: 0;
  list-style: none;
}

.quest-steps {
  display: grid;
  gap: 10px;
}

.quest-steps__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 247, 232, 0.1);
  background: rgba(255, 247, 232, 0.05);
}

body.body--active-case .quest-panel__section--route {
  min-height: 0;
}

body.body--active-case .quest-panel__section--route .scene-track {
  gap: 8px;
}

body.body--active-case .quest-panel__section--case {
  background: rgba(255, 247, 232, 0.08);
}

body.body--active-case .quest-panel__role {
  display: none;
}

.quest-steps__item--done {
  border-color: rgba(185, 242, 207, 0.24);
  background: rgba(135, 226, 171, 0.1);
}

.quest-steps__hero {
  align-self: start;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(8, 17, 25, 0.66);
  color: rgba(255, 236, 196, 0.84);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scene-track {
  display: grid;
  gap: 12px;
}

.scene-track__item {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.scene-track__dot {
  width: 14px;
  height: 14px;
  margin-top: 4px;
  border-radius: 999px;
  border: 2px solid rgba(255, 247, 232, 0.22);
  background: rgba(255, 247, 232, 0.08);
}

.scene-track__item--active .scene-track__dot {
  border-color: rgba(245, 201, 109, 0.82);
  background: rgba(245, 201, 109, 0.82);
}

.scene-track__item--done .scene-track__dot {
  border-color: rgba(185, 242, 207, 0.86);
  background: rgba(185, 242, 207, 0.86);
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes walkBob {
  from {
    transform: translateY(-2px);
  }

  to {
    transform: translateY(2px);
  }
}

@keyframes pulseHotspot {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(245, 201, 109, 0.18),
      0 0 18px rgba(245, 201, 109, 0.18);
  }

  50% {
    box-shadow:
      0 0 0 1px rgba(245, 201, 109, 0.3),
      0 0 34px rgba(245, 201, 109, 0.34);
  }
}

@keyframes splashHero {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body.body--case-opening {
  height: 100dvh;
  overflow: hidden;
}

body.body--case-opening .hero,
body.body--case-opening .summary-bar {
  display: none;
}

body.body--case-opening .shell {
  min-height: 100dvh;
  display: grid;
  align-items: stretch;
  padding: 18px;
}

body.body--case-opening .app-shell {
  width: 100%;
  margin: 0;
}

@media (max-width: 1180px) {
  .quest-layout {
    grid-template-columns: 1fr;
  }

  .quest-scene {
    min-height: 580px;
  }

  body.body--active-case .quest-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
  }

  body.body--active-case .quest-stage-card,
  body.body--active-case .quest-panel {
    height: auto;
    min-height: auto;
  }

  body.body--active-case .quest-panel {
    padding: 0 14px 14px;
    border-left: none;
    overflow: visible;
    background: transparent;
  }

  body.body--active-case .quest-scene {
    min-height: 68vh;
  }

  body.body--active-case {
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.body--active-case .inventory__grid {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    overflow: visible;
    padding-bottom: 0;
  }

  body.body--active-case .inventory {
    grid-template-rows: none;
    max-height: none;
  }

  body.body--active-case .inventory-item {
    min-height: 110px;
    grid-template-columns: 84px minmax(0, 1fr);
  }

  body.body--active-case .inventory-item__art {
    width: 84px;
    height: 84px;
    padding: 10px;
  }

  body.body--active-case .inventory-item span {
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
    overflow: visible;
    font-size: 0.9rem;
    line-height: 1.45;
  }
}

@media (max-width: 1440px), (max-height: 850px) {
  .shell {
    padding-top: 14px;
  }

  .hero {
    min-height: 130px;
  }

  .hero__title {
    font-size: 3.6rem;
  }

  .hero__mascots {
    min-height: 120px;
  }

  .board__grid {
    height: max(460px, calc(100dvh - 330px));
    min-height: 460px;
  }

  body.body--active-case .quest-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
  }

  body.body--active-case .quest-panel {
    padding: 8px;
    gap: 8px;
  }

  body.body--active-case .quest-panel__section {
    padding: 10px;
  }
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: auto;
  }

  .hero__title {
    font-size: 2.9rem;
    line-height: 0.96;
  }

  .hero__body {
    font-size: 0.9rem;
    line-height: 1.45;
  }

  .hero__mascots {
    min-height: 120px;
  }

  .summary-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-bar__button {
    min-height: 54px;
  }

  .board__grid {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  .case-card__poster {
    min-height: 520px;
  }

  .quest-scene {
    min-height: 500px;
  }

  .quest-scene__objective {
    max-width: calc(100% - 36px);
    top: auto;
    bottom: 120px;
  }

  .quest-character--petya {
    width: clamp(232px, 33vw, 290px);
  }

  .quest-character--wolf {
    width: clamp(178px, 25vw, 228px);
  }

  .scene-object__icon {
    width: min(var(--scene-object-icon-size, 64px), 72px);
    height: min(var(--scene-object-icon-size, 64px), 72px);
  }

  .case-opening {
    grid-template-columns: 1fr;
  }

  .case-opening__poster {
    min-height: 330px;
  }

  .case-opening__copy {
    padding: 24px;
  }
}

@media (max-width: 640px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .shell {
    padding: 12px 10px 18px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .hero,
  .hero__copy,
  .summary-bar,
  .board,
  .board__intro,
  .board__intro > *,
  .board__grid,
  .case-card,
  .quest-layout,
  .quest-stage-card,
  .quest-panel,
  .inventory,
  .inventory__grid {
    min-width: 0;
  }

  .hero__eyebrow {
    font-size: 0.65rem;
    letter-spacing: 0.14em;
  }

  .hero__title {
    font-size: clamp(2rem, 11.5vw, 2.35rem);
    overflow-wrap: anywhere;
    letter-spacing: 0.01em;
  }

  .hero__body {
    display: none;
  }

  .hero__mascots {
    display: none;
  }

  .summary-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
  }

  .summary-chip,
  .summary-bar__button {
    border-radius: 14px;
  }

  .summary-chip {
    padding: 10px 11px;
    overflow: hidden;
  }

  .summary-chip__label {
    display: block;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    overflow-wrap: anywhere;
  }

  .summary-chip strong {
    font-size: 0.96rem;
  }

  .summary-bar__button {
    grid-column: 1 / -1;
    min-height: 42px;
    padding: 0 12px;
  }

  .board__intro {
    display: grid;
    padding: 14px;
    overflow: hidden;
  }

  .board__intro > p {
    display: none;
  }

  .board__title {
    font-size: 1.35rem;
    letter-spacing: 0.01em;
  }

  .board__intro p,
  .board__notice,
  .case-card__subtitle {
    overflow-wrap: anywhere;
  }

  .case-card__poster {
    min-height: clamp(380px, 112vw, 470px);
  }

  .case-card__poster-main {
    object-fit: cover;
  }

  .quest-stage-card,
  .quest-panel__section,
  .board__intro,
  .board__victory {
    border-radius: 20px;
  }

  body.body--active-case .shell {
    padding: 0;
    overflow-x: hidden;
  }

  body.body--case-opening .shell {
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
  }

  .case-opening {
    min-height: calc(100dvh - 20px);
    border-radius: 20px;
  }

  .case-opening__poster {
    min-height: min(46dvh, 360px);
  }

  .case-opening__hero--petya {
    left: 9%;
    width: min(55%, 210px);
  }

  .case-opening__hero--wolf {
    right: 7%;
    width: min(40%, 154px);
  }

  .case-opening__copy {
    align-content: start;
    gap: 10px;
    padding: 18px;
  }

  .case-opening__eyebrow,
  .case-opening__label {
    font-size: 0.66rem;
    letter-spacing: 0.1em;
  }

  .case-opening__brand {
    font-size: clamp(2.15rem, 11vw, 2.9rem);
    letter-spacing: 0.01em;
  }

  .case-opening__title {
    font-size: clamp(1.55rem, 8vw, 2.2rem);
  }

  .case-opening__subtitle {
    font-size: 0.92rem;
    line-height: 1.38;
  }

  .case-opening__actions {
    display: grid;
    grid-template-columns: 1fr;
    margin-top: 6px;
  }

  body.body--active-case .quest-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    width: 100%;
    min-height: 100dvh;
    height: auto;
    overflow-x: hidden;
  }

  body.body--active-case .quest-stage-card,
  body.body--active-case .quest-panel__section {
    border-radius: 0;
  }

  body.body--active-case .quest-stage-card {
    min-height: auto;
    height: auto;
    grid-template-rows: auto auto auto;
    gap: 10px;
    padding: max(10px, env(safe-area-inset-top)) 10px 10px;
  }

  body.body--active-case .quest-panel {
    min-height: auto;
    height: auto;
    width: 100%;
    padding: 0 10px max(12px, env(safe-area-inset-bottom));
    border-left: none;
    overflow: visible;
    background: transparent;
  }

  .quest-scene {
    min-height: 430px;
    border-radius: 22px;
  }

  body.body--active-case .quest-scene {
    width: 100%;
    min-height: min(470px, 62dvh);
    height: min(470px, 62dvh);
    aspect-ratio: auto;
    border-radius: 18px;
  }

  .quest-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
  }

  .quest-toolbar .scene__button,
  .quest-toolbar__cluster,
  .quest-toolbar__cluster .scene__button {
    min-height: 42px;
    padding: 0 14px;
    width: 100%;
  }

  .quest-toolbar__cluster {
    margin-left: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .quest-scene__title-chip,
  .quest-scene__objective {
    font-size: 0.68rem;
    letter-spacing: 0.06em;
  }

  .quest-scene__title-chip {
    top: 12px;
    left: 12px;
    max-width: calc(100% - 24px);
  }

  .quest-scene__objective {
    display: none;
  }

  .quest-scene__message {
    left: 12px;
    right: 12px;
    bottom: 12px;
    padding: 11px 12px;
  }

  .quest-scene__message strong,
  .inventory__status strong {
    display: block;
    font-size: 0.92rem;
    overflow-wrap: anywhere;
  }

  .quest-scene__message span {
    font-size: 0.84rem;
    line-height: 1.36;
    overflow-wrap: anywhere;
  }

  .quest-scene__solved {
    inset: auto 12px 108px 12px;
    max-width: none;
  }

  .scene-object__label,
  .scene-object__guide {
    white-space: normal;
    width: max-content;
    max-width: min(180px, 52vw);
    text-align: center;
  }

  .scene-object__guide {
    display: none;
  }

  .scene-object__icon {
    width: min(var(--scene-object-icon-size, 58px), 58px);
    height: min(var(--scene-object-icon-size, 58px), 58px);
    padding: min(var(--scene-object-icon-padding, 8px), 8px);
  }

  .quest-character--petya {
    width: clamp(170px, 51vw, 220px);
  }

  .quest-character--wolf {
    width: clamp(136px, 40vw, 176px);
  }

  body.body--active-case .inventory {
    display: grid;
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
    padding: 12px;
    border-radius: 18px;
  }

  .inventory__grid {
    grid-template-columns: 1fr;
  }

  .inventory__head {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 8px;
  }

  .inventory-item {
    grid-template-columns: 84px minmax(0, 1fr);
    min-height: 104px;
  }

  .inventory-item__art {
    width: 84px;
    height: 84px;
    padding: 10px;
  }

  .hero-switch {
    grid-template-columns: 1fr;
  }

  .quest-panel__section--route {
    max-height: none;
  }
}
