/* Отель на Хеллоуин — экраны игры: знакомство, вход, ночь, итоги, призы, ещё */

body.app main { position: relative; overflow-x: clip; }
/* Шапка с нижней панелью разделов — поверх контента, но под сценами и шторкой */
body.app .masthead { z-index: 20; }

.view { padding-bottom: 72px; }
.view.entering { animation: view-in 0.42s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.narrow { max-width: 800px; }
.block { margin-top: 56px; }

@keyframes view-in {
  from { opacity: 0; transform: translateY(14px); }
}
@keyframes fade-in {
  from { opacity: 0; }
}
@keyframes pop {
  0% { transform: scale(0.8); opacity: 0.4; }
  60% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
.swap { animation: pop 0.45s cubic-bezier(0.3, 1.4, 0.5, 1); }
.shake { animation: shake 0.4s; }

/* ---------- Разделы ---------- */

.masthead .tabs { margin-left: auto; display: flex; gap: 4px; font-size: 15px; }
.tabs a {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; color: var(--paper-3); text-decoration: none; font-weight: 600;
  transition: color 0.2s;
}
.tabs a:hover { color: var(--paper); }
.tabs svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current="page"] { color: var(--brass-light); }
.tabs a::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: -11px; height: 2px;
  background: var(--brass); transform: scaleX(0); transition: transform 0.25s;
}
.tabs a[aria-current="page"]::after { transform: scaleX(1); }

/* ---------- Сцена с Бустиком ---------- */

.vn {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  padding: 0 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--ink);
  overflow: hidden; cursor: pointer; outline: none;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.view.vn.entering, .vn.entering { animation: fade-in 0.4s ease-out both; }
.vn.leaving { animation: fade-out 0.26s ease-in both; }
@keyframes fade-out {
  to { opacity: 0; }
}
.vn-overlay { background: rgba(9, 8, 7, 0.9); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

.vn-stage { position: absolute; inset: 0; pointer-events: none; }

/* Пол коридора: дорожка уходит вглубь, плинтус латунный */
#view-intro .vn-stage::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 38%;
  border-top: 1px solid var(--brass-2);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpolygon points='40,0 60,0 88,100 12,100' fill='%234a0c16'/%3E%3Cpolyline points='41,0 14,100' fill='none' stroke='%238e7040' stroke-width='.6' vector-effect='non-scaling-stroke'/%3E%3Cpolyline points='59,0 86,100' fill='none' stroke='%238e7040' stroke-width='.6' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") center / 100% 100% no-repeat,
    linear-gradient(#1d1511, #0e0a08);
}
/* Свет бра сверху и виньетка по краям */
.vn-stage::after {
  content: ""; position: absolute; inset: 0; z-index: 2;
  background:
    radial-gradient(ellipse 50% 32% at 50% 0%, rgba(255, 216, 150, 0.14), transparent),
    radial-gradient(ellipse 75% 70% at 50% 45%, transparent 45%, rgba(0, 0, 0, 0.7) 100%);
}
.vn-overlay .vn-stage::after {
  background: radial-gradient(ellipse 40% 45% at 50% 62%, rgba(255, 216, 150, 0.12), transparent 70%);
}

.vn-doors {
  position: absolute; z-index: 1; left: 50%; bottom: 38%; transform: translateX(-50%);
  display: flex; gap: clamp(28px, 16vmin, 180px);
}
.vn-doors span {
  position: relative; display: block; width: clamp(48px, 12vmin, 112px); aspect-ratio: 5 / 9;
  background: linear-gradient(90deg, var(--door), var(--door-2) 50%, var(--door));
  border: 1px solid var(--door-edge); border-bottom: 0;
  box-shadow: 0 0 0 3px #1e1a17, 0 0 0 4px var(--line-2);
}
.vn-doors span::before {
  content: ""; position: absolute; top: 9%; left: 32%; right: 32%; height: 8%; background: var(--brass-2);
}
.vn-doors span::after {
  content: ""; position: absolute; left: 50%; top: -48%; width: 220%; height: 70%; transform: translateX(-50%);
  background: radial-gradient(ellipse 50% 55% at 50% 0%, rgba(255, 216, 150, 0.18), transparent 70%);
}
.vn-doors .r237 { box-shadow: 0 0 0 3px #1e1a17, 0 0 0 4px var(--line-2), 0 12px 28px -6px rgba(255, 9, 48, 0.7); border-bottom: 2px solid var(--red); }
.vn-doors .r237::after { animation: flicker 7s infinite steps(1, end); }

.vn-prop {
  position: absolute; z-index: 3; top: 13%; right: 8%; width: clamp(120px, 30vmin, 260px);
}
.vn-prop .glow { width: 100%; animation: prop-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes prop-in {
  from { opacity: 0; transform: translateY(18px) scale(0.7) rotate(-8deg); }
}

.vn-sprite {
  position: absolute; z-index: 3; left: 50%; bottom: 128px;
  height: min(44vh, 420px); width: auto; max-width: 86vw; object-fit: contain;
  transform: translateX(-50%); transform-origin: 50% 100%;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.55));
  animation: idle 4.5s ease-in-out infinite;
}
.vn-sprite[data-kind="face"] { height: min(30vh, 300px); bottom: 150px; }
.vn-sprite.swap { animation: sprite-swap 0.5s cubic-bezier(0.3, 1.4, 0.5, 1), idle 4.5s ease-in-out 0.5s infinite; }
@keyframes idle {
  0%, 100% { transform: translateX(-50%) scale(1, 1); }
  50% { transform: translateX(-50%) scale(1.012, 0.988); }
}
@keyframes sprite-swap {
  0% { transform: translateX(-50%) translateY(16px) scale(0.92); opacity: 0.3; }
  55% { transform: translateX(-50%) translateY(-10px) scale(1.03); opacity: 1; }
  100% { transform: translateX(-50%) translateY(0) scale(1); }
}

.vn-box {
  position: relative; z-index: 5; width: 100%; max-width: 760px; min-height: 150px;
  padding: 26px 24px 20px;
  background: linear-gradient(180deg, rgba(31, 28, 25, 0.95), rgba(20, 19, 18, 0.97));
  border: 1px solid var(--line-2); border-top: 2px solid var(--brass); border-radius: 2px;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5);
  animation: box-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s both;
}
@keyframes box-in {
  from { opacity: 0; transform: translateY(24px); }
}
.vn-name {
  position: absolute; top: -15px; left: 18px;
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 6px 12px 5px; background: var(--red); color: #fff;
  font: 700 15px/1 var(--sans); letter-spacing: 0.02em;
}
.vn-name span { font: italic 500 16px/1 var(--serif); color: #ffd3da; }
.vn-text { font: 400 18px/1.55 var(--sans); color: var(--paper); min-height: 4.65em; }
.vn-next {
  position: absolute; right: 20px; bottom: 16px;
  width: 0; height: 0; border: 7px solid transparent; border-top: 9px solid var(--brass); border-bottom: 0;
  opacity: 0; transition: opacity 0.2s;
}
.vn.typed:not(.last) .vn-next { opacity: 1; animation: nudge 0.9s ease-in-out infinite; }
@keyframes nudge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}
.vn-hint {
  margin-top: 8px; font: 600 11px/1.2 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--paper-3);
  opacity: 0; transition: opacity 0.3s;
}
.vn.first.typed .vn-hint { opacity: 0.9; }
.vn.last .vn-hint { display: none; }
.vn-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; margin-top: 16px; animation: rise 0.35s both; }

/* Говорит Чудище РКН: красный дым, крупная фигура справа, рамка реплики красная */
.vn-overlay[data-speaker="rkn"] {
  background: radial-gradient(ellipse 70% 60% at 72% 58%, rgba(255, 9, 48, 0.2), transparent 70%), rgba(10, 6, 7, 0.92);
}
.vn-overlay[data-speaker="rkn"] .vn-stage::after {
  background: radial-gradient(ellipse 40% 45% at 74% 60%, rgba(255, 70, 70, 0.16), transparent 70%);
}
.vn-sprite[data-kind="rkn"] {
  left: auto; right: max(-3vw, calc(50% - 660px)); bottom: 64px;
  width: min(62vw, 820px); height: auto; max-width: none; max-height: 74vh;
  object-fit: contain; object-position: right bottom;
  transform: none; transform-origin: 60% 100%;
  filter: drop-shadow(0 0 40px rgba(255, 9, 48, 0.3));
  animation: rkn-breathe 3.2s ease-in-out infinite;
}
.vn-sprite[data-kind="rkn"].swap { animation: rkn-smoke-in 0.65s cubic-bezier(0.2, 0.8, 0.2, 1), rkn-breathe 3.2s ease-in-out 0.65s infinite; }
@keyframes rkn-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.015, 0.985); }
}
@keyframes rkn-smoke-in {
  from { opacity: 0; transform: translateY(5%) scale(0.86); filter: blur(12px) drop-shadow(0 0 40px rgba(255, 9, 48, 0.6)); }
}
.vn[data-speaker="rkn"] .vn-box {
  border-top-color: var(--red);
  background: linear-gradient(180deg, rgba(38, 14, 19, 0.95), rgba(21, 12, 14, 0.97));
  box-shadow: 0 0 0 1px rgba(255, 9, 48, 0.4), 0 0 48px rgba(255, 9, 48, 0.28), 0 -12px 40px rgba(0, 0, 0, 0.5);
}
.vn[data-speaker="rkn"] .vn-name {
  background: #2a0910; border: 1px solid var(--red); color: #ffd3da; font-family: var(--serif); font-size: 18px; font-weight: 600;
  box-shadow: 0 0 16px rgba(255, 9, 48, 0.5);
}
.vn[data-speaker="rkn"] .vn-name::before,
.vn[data-speaker="rkn"] .vn-name::after { content: "✦"; color: var(--red); font-size: 12px; }
.vn[data-speaker="rkn"] .vn-next { border-top-color: var(--red); }

.vn-skip {
  position: absolute; z-index: 6; top: calc(14px + env(safe-area-inset-top)); right: 16px;
  padding: 9px 14px; border: 1px solid var(--line-2); border-radius: 2px;
  background: rgba(20, 19, 18, 0.6); color: var(--paper-2);
  font: 600 12px/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer;
}
.vn-skip:hover { color: var(--paper); border-color: var(--brass-2); }
.vn.last .vn-skip { visibility: hidden; }
.vn-progress { position: absolute; z-index: 6; top: calc(30px + env(safe-area-inset-top)); left: 16px; display: flex; gap: 6px; }
.vn-progress span { display: block; width: 16px; height: 3px; background: var(--line-2); transition: background 0.3s, width 0.3s; }
.vn-progress span.done { background: var(--brass-2); }
.vn-progress span.current { background: var(--brass); width: 28px; }

/* ---------- Вход ---------- */

.login-page {
  /* Чудище РКН выглядывает справа из-за стойки. --rkn-w — его ширина; справа от стойки ему нужно
     ~0.9 ширины. Сколько не хватает за краем страницы — столько стойка отдаёт отступом справа */
  --rkn-w: 200px;
  --desk-room: max(0px, calc(var(--rkn-w) * 0.92 + 12px - max(0px, (100vw - var(--page)) / 2) - var(--gutter)));
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, calc(440px + var(--desk-room))); gap: 56px; align-items: end;
  padding-top: 64px;
}
.login-hero .kicker { margin-bottom: 20px; }
.login-hero .lead { margin-top: 22px; font-size: 18px; }
.login-hero .how { margin-top: 22px; font-size: 16px; }

.desk { position: relative; margin-top: 80px; margin-right: var(--desk-room); padding: 28px; border: 1px solid var(--line-2); border-top: 3px solid var(--brass); background: var(--ink-2); }
.login-hero .bank { margin-top: 18px; color: var(--paper-2); font-size: 16px; }
.bank-label { display: inline-block; margin-right: 6px; font: 600 11px/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--brass); }
.bank-num { font-variant-numeric: tabular-nums lining-nums; }

/* ---------- Чудище РКН выглядывает из-за края карточки ----------
   На картинке слева ровный срез — это край, из-за которого он выглядывает. Срез — на 9% ширины от левого
   края картинки: ставим его ровно на правую границу карточки, рука ложится на неё сверху. Двигаем Чудище
   только вверх-вниз и масштабом от точки на срезе — так срез всегда остаётся на краю карточки */
.rkn-peek {
  position: absolute; z-index: 3; top: 18px; left: calc(100% - var(--rkn-w) * 0.09 + 1px);
  width: var(--rkn-w); padding: 0; margin: 0; border: 0; background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.rkn-peek img {
  display: block; width: 100%; height: auto; transform-origin: 9% 100%;
  filter: drop-shadow(0 0 18px rgba(255, 9, 48, 0.28));
  animation: rkn-rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) 0.6s both, rkn-twitch 6.5s ease-in-out 2s infinite;
  transition: filter 0.25s;
}
.rkn-peek:hover img, .rkn-peek:focus-visible img { filter: drop-shadow(0 0 22px rgba(255, 9, 48, 0.6)) brightness(1.08); }
.rkn-peek:focus-visible { outline: none; }
.rkn-peek:active img { transform: scale(0.96, 1.03); }
@keyframes rkn-rise {
  from { opacity: 0; transform: translateY(30%) scale(0.9); }
}
/* Иногда дёргается: хихикает, подпрыгивает и снова замирает */
@keyframes rkn-twitch {
  0%, 74%, 100% { transform: none; }
  76% { transform: translateY(-4%) scale(1.04, 0.96); }
  78% { transform: translateY(2%) scale(0.97, 1.04); }
  80% { transform: translateY(-6%) scale(1.02, 0.98); }
  82% { transform: translateY(0) scale(1.03, 0.97); }
  85% { transform: none; }
}
.rkn-bubble {
  position: absolute; left: 62%; top: -14px; padding: 6px 10px 5px; white-space: nowrap;
  background: var(--red); color: #fff; font: 700 13px/1 var(--sans); letter-spacing: 0.02em;
  border-radius: 10px 10px 10px 2px; box-shadow: 0 6px 18px rgba(255, 9, 48, 0.35);
  opacity: 0; transform-origin: 0 100%; pointer-events: none;
  animation: rkn-bubble 6.5s ease-in-out 2s infinite;
}
@keyframes rkn-bubble {
  0%, 74%, 92%, 100% { opacity: 0; transform: scale(0.6); }
  77%, 89% { opacity: 1; transform: scale(1); }
}
.desk-title { font: 500 28px/1.1 var(--serif); margin-bottom: 18px; }
.desk > .notice.error { margin-bottom: 14px; }

.step { display: grid; gap: 14px; }
.step.entering { animation: rise 0.35s both; }
.step-lead { color: var(--paper-2); font-size: 15px; }
.step .back { justify-self: start; font-size: 14px; }
.step-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 20px; font-size: 14px; }
.step-links .link-button { font-size: 14px; }

.choice {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 16px; align-items: center;
  width: 100%; padding: 14px 16px; text-align: left;
  background: var(--ink); color: var(--paper-2);
  border: 1px solid var(--line-2); border-radius: 2px;
  font: 15px/1.4 var(--sans); cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
}
.choice b { display: block; margin-bottom: 4px; font: 600 22px/1.15 var(--serif); color: var(--paper); }
.choice > img { width: 64px; height: auto; justify-self: center; }
.choice:hover { border-color: var(--brass-2); background: #191715; transform: translateY(-2px); }
.choice:active { transform: translateY(0); }

.dev-hint { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--line-2); font-size: 13px; color: var(--paper-3); }
.dev-hint button { font-size: 13px; }

#view-login .corridor { margin-top: 64px; }

/* ---------- Ночь ---------- */

#view-night { position: relative; overflow-x: clip; }
.night-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 40px; min-height: 76px; }
.clock {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px;
  border: 1px solid var(--line-2); border-radius: 999px;
  font: 600 13px/1 var(--sans); color: var(--paper-2); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.clock::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brass); }
.clock.urgent { border-color: var(--red); color: var(--red-text); }
.clock.urgent::before { background: var(--red); animation: glow-pulse 1.2s ease-in-out infinite; }

.speech { position: relative; z-index: 4; display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 18px; align-items: end; margin-top: 16px; max-width: 820px; }
.speech-face { width: 96px; }
.speech-bubble {
  position: relative; padding: 16px 20px 18px;
  background: var(--ink-2); border: 1px solid var(--line-2); border-left: 3px solid var(--brass);
}
.speech-bubble::before {
  content: ""; position: absolute; left: -12px; bottom: 18px;
  border: 9px solid transparent; border-right: 9px solid var(--brass); border-left: 0;
}
.speech.entering .speech-bubble { animation: rise 0.4s both; }
.speech-bubble { --rkn-w: 118px; }
/* Ровный срез на картинке идёт от 19% высоты до низа. Чудище стоит на нижнем крае реплики, а реплика не ниже
   его высоты с запасом на подпрыгивание — иначе срез торчит над карточкой и лицо выглядит обрезанным */
.speech-bubble:has(.rkn-peek) { min-height: calc(var(--rkn-w) * 1.66 * 0.9); }
.speech-bubble .rkn-peek { top: auto; bottom: 0; }
.speech-bubble .rkn-bubble { top: -4px; font-size: 12px; }
/* Справа от реплики — место под Чудище */
.speech { padding-right: calc(118px * 0.92); }
.speech-title { font: 500 clamp(26px, 3.6vw, 40px)/1.1 var(--serif); font-variant-numeric: lining-nums; }
.speech-text { margin-top: 8px; color: var(--paper-2); font-size: 16px; min-height: 1.55em; }

/* Летучая мышь иногда пролетает по коридору */
.bat {
  position: absolute; z-index: 3; top: 130px; left: 0; width: 84px; height: auto;
  pointer-events: none; opacity: 0;
  filter: drop-shadow(0 0 12px rgba(255, 9, 48, 0.45));
  animation: bat-fly 18s linear 3s infinite, bat-flap 0.35s ease-in-out infinite alternate;
}
@keyframes bat-fly {
  0% { transform: translate(-140px, 60px) scale(0.7); opacity: 0; }
  2% { opacity: 1; }
  28% { transform: translate(calc(100vw + 40px), -20px) scale(1); opacity: 1; }
  29%, 100% { transform: translate(calc(100vw + 40px), -20px); opacity: 0; }
}
@keyframes bat-flap {
  from { rotate: -6deg; }
  to { rotate: 6deg; }
}

#view-night .corridor { margin-top: 28px; }
.corridor.choosing .door:not(:disabled) .plate { animation: plate-glow 2.4s ease-in-out infinite; }
.corridor.choosing .slot:nth-child(2n) .plate { animation-delay: 0.6s; }
.corridor.choosing .slot:nth-child(3n) .plate { animation-delay: 1.2s; }
@keyframes plate-glow {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 216, 150, 0); }
  50% { box-shadow: 0 0 14px rgba(255, 216, 150, 0.55); }
}
.corridor-hint { margin-top: 14px; min-height: 1.5em; text-align: center; color: var(--paper-3); font-size: 14px; }

/* Банк отеля */
.bank-card {
  margin-top: 18px; padding: 16px 18px;
  display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 16px; align-items: center;
  background: linear-gradient(90deg, rgba(201, 162, 90, 0.08), transparent 70%), var(--ink-2);
  border: 1px solid var(--line-2); border-left: 3px solid var(--brass);
  animation: rise 0.5s 0.2s both;
}
.bank-icon { width: 56px; }
.bank-value { margin-top: 6px; font: 500 clamp(26px, 3.4vw, 34px)/1.05 var(--serif); font-variant-numeric: lining-nums; color: var(--brass-light); }
.bank-note { margin-top: 6px; color: var(--paper-2); font-size: 14px; }

.me-strip {
  margin-top: 20px; padding: 16px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 36px;
  color: var(--paper-2); font-size: 15px;
}
.me-strip:empty { display: none; }
.me-role { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.role-icon { width: 28px; height: auto; filter: drop-shadow(0 0 8px rgba(255, 9, 48, 0.5)); }
.me-stat b { color: var(--paper); font-weight: 600; }
.pill { padding: 4px 8px 3px; border: 1px solid var(--line-2); border-radius: 999px; font: 600 11px/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--paper-3); }
.meter { display: block; width: 180px; height: 4px; margin-top: 8px; background: var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--brass); transform-origin: 0 50%; transform: scaleX(var(--value, 0)); animation: grow 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.3s both; }
@keyframes grow {
  from { transform: scaleX(0); }
}

.cta-card {
  margin-top: 24px; padding: 18px;
  display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 16px; align-items: start;
  background: var(--ink-2); border: 1px solid var(--line-2);
  animation: rise 0.5s 0.3s both;
}
.cta-card .bustik { width: 64px; }
.cta-card p { color: var(--paper-2); }
.cta-actions { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; }

/* Пока данные едут: вместо Бустика — пульсирующий кружок, вместо текста — полоски */
#view-night.loading .speech-face { opacity: 0; }
#view-night.loading .speech::before {
  content: ""; position: absolute; left: 4px; bottom: 4px; width: 80px; height: 80px; border-radius: 50%;
  background: var(--ink-3); animation: glow-pulse 1.3s ease-in-out infinite;
}
#view-night.loading .speech-title .skeleton { height: 0.7em; margin: 0.25em 0; }
.placeholder { display: grid; gap: 4px; }
.placeholder-card { margin: 18px 0; padding: 20px; background: var(--ink-2); border: 1px solid var(--line-2); border-left: 3px solid var(--line-2); }

/* Нет связи: тонкая плашка сверху, данные на экране остаются */
.net-status {
  position: fixed; z-index: 25; left: 50%; top: calc(64px + env(safe-area-inset-top)); transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px);
  padding: 8px 14px; border: 1px solid var(--line-2); border-left: 3px solid var(--red);
  background: rgba(20, 19, 18, 0.95); color: var(--paper-2); font-size: 13px; line-height: 1.4;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  animation: rise 0.3s both;
}

/* ---------- Подтверждение выбора ---------- */

.sheet-backdrop { position: fixed; inset: 0; z-index: 34; background: rgba(8, 7, 6, 0.62); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.sheet-backdrop.entering { animation: fade-in 0.25s both; }
.sheet {
  position: fixed; z-index: 35; left: 50%; bottom: 0; width: min(520px, 100%);
  transform: translateX(-50%);
  display: grid; gap: 12px; justify-items: center; text-align: center;
  padding: 0 24px calc(24px + env(safe-area-inset-bottom));
  background: var(--ink-2); border: 1px solid var(--line-2); border-top: 3px solid var(--brass); border-bottom: 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6);
}
.sheet.entering { animation: sheet-in 0.38s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes sheet-in {
  from { transform: translate(-50%, 100%); }
}
.sheet-room {
  margin-top: -30px; padding: 10px 20px 7px;
  background: var(--brass); color: #2a1d0c;
  font: 700 clamp(30px, 8vw, 40px)/1 var(--serif); font-variant-numeric: lining-nums;
  box-shadow: 0 0 0 4px var(--ink-2), 0 0 0 5px var(--brass-2), 0 0 30px rgba(255, 216, 150, 0.3);
  animation: pop 0.45s cubic-bezier(0.3, 1.4, 0.5, 1) 0.15s both;
}
.sheet-lore { max-width: 420px; margin-top: 8px; font: italic 400 19px/1.45 var(--serif); color: var(--paper); }
.sheet-title { margin-top: 2px; font: 600 15px/1.3 var(--sans); color: var(--paper-2); }
.sheet-note { margin-top: -2px; font-size: 13px; color: var(--paper-3); }
.sheet-actions { display: flex; gap: 12px; width: 100%; margin-top: 8px; }
.sheet-actions .button { flex: 1; }

/* На большом экране — диалог по центру */
@media (min-width: 721px) {
  .sheet { top: 50%; bottom: auto; transform: translate(-50%, -50%); border-bottom: 1px solid var(--line-2); padding-bottom: 28px; }
  .sheet.entering { animation: dialog-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
}
@keyframes dialog-in {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.96); }
}

/* ---------- Итоги ---------- */

#view-results .page,
#view-prizes .page,
#view-more .page { padding-top: 40px; }
#view-results .headline { margin-top: 8px; }

.outcome-card {
  margin: 24px 0 8px; padding: 20px;
  display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 20px; align-items: center;
  background: var(--ink-2); border: 1px solid var(--line-2); border-left: 3px solid var(--brass);
}
.outcome-card .bustik { width: 96px; animation: pop 0.5s cubic-bezier(0.3, 1.4, 0.5, 1) 0.15s both; }
.outcome-card p { color: var(--paper-2); }
.outcome-line { font: 500 24px/1.25 var(--serif); font-variant-numeric: lining-nums; color: var(--paper) !important; }
.outcome-line + .outcome-line { margin-top: 4px; }
.outcome-card .link-button { margin-top: 10px; font-size: 14px; }

.ledger tbody tr { animation: rise 0.4s both; }
.ledger tbody tr:nth-child(2) { animation-delay: 0.05s; }
.ledger tbody tr:nth-child(3) { animation-delay: 0.1s; }
.ledger tbody tr:nth-child(4) { animation-delay: 0.15s; }
.ledger tbody tr:nth-child(5) { animation-delay: 0.2s; }
.ledger tbody tr:nth-child(6) { animation-delay: 0.25s; }
.ledger tbody tr:nth-child(7) { animation-delay: 0.3s; }
.bar-cell { white-space: nowrap; }
.bar { display: inline-block; width: min(160px, 30vw); height: 6px; margin-right: 10px; vertical-align: middle; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--ghost); opacity: 0.55; transform-origin: 0 50%; transform: scaleX(var(--value, 0)); animation: grow 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.3s both; }
.ledger tr.blocked .bar span { background: var(--red); opacity: 1; }

.history { list-style: none; margin: 0; padding: 0; font-size: 15px; }
.history li { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.history .when { color: var(--paper-3); }

/* ---------- Призы ---------- */

.prizes-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: center; margin-bottom: 32px; }
.prizes-head .glow-lg { width: 180px; }
.prizes-head .lead { margin-top: 12px; font-size: 17px; }
#upsell { margin-bottom: 28px; }
#upsell .codes { margin-top: 16px; }

.raffle { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--line); }
.raffle-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: start; margin-bottom: 24px; }
.raffle-head .section-title { margin-bottom: 10px; }

/* ---------- Ещё ---------- */

.account-card {
  display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 18px; align-items: center;
  padding: 20px; background: var(--ink-2); border: 1px solid var(--line-2); border-top: 3px solid var(--brass);
}
.account-card .bustik { width: 72px; }
.account-role { font: 500 28px/1.1 var(--serif); }
.account-email { margin-top: 4px; color: var(--paper-2); overflow-wrap: anywhere; }
.account-card .muted { margin-top: 10px; font-size: 14px; }

.menu { margin-top: 24px; display: grid; }
.menu-item {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  width: 100%; padding: 14px 4px; margin: 0;
  background: none; border: 0; border-bottom: 1px solid var(--line);
  color: var(--paper-3); font: 15px/1.4 var(--sans); text-align: left; text-decoration: none; cursor: pointer;
}
.menu-item::after { content: "›"; font: 400 28px/1 var(--serif); color: var(--paper-3); transition: transform 0.2s, color 0.2s; }
.menu-item img { width: 46px; height: auto; justify-self: center; }
.menu-item b { display: block; font: 600 21px/1.2 var(--serif); color: var(--paper); }
.menu-item:hover { color: var(--paper-2); }
.menu-item:hover::after { color: var(--brass); transform: translateX(4px); }
.logout { margin-top: 32px; }

/* ---------- Адаптив ---------- */

@media (max-width: 960px) {
  .login-page { --rkn-w: 150px; grid-template-columns: 1fr; gap: 0; padding-top: 40px; }
}
@media (min-width: 961px) and (max-width: 1200px) {
  .login-page { --rkn-w: 150px; gap: 40px; }
}

@media (max-width: 720px) {
  /* Разделы — нижней панелью, как в приложении */
  .masthead .tabs {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; margin: 0;
    justify-content: space-around; gap: 0;
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    background: rgba(20, 19, 18, 0.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
  }
  .tabs a { flex: 1; flex-direction: column; gap: 3px; padding: 8px 4px; font-size: 11px; letter-spacing: 0.02em; }
  .tabs svg { width: 22px; height: 22px; }
  .tabs a::after { top: -5px; bottom: auto; left: 30%; right: 30%; }
  .net-status { top: calc(62px + env(safe-area-inset-top)); }
  body.has-tabs main { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  body.has-tabs .sheet { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

  .view { padding-bottom: 40px; }
  .vn { padding: 0 10px calc(10px + env(safe-area-inset-bottom)); }
  .vn-box { padding: 24px 18px 16px; min-height: 160px; }
  .vn-text { font-size: 17px; }
  .vn-sprite { bottom: 140px; height: min(40vh, 340px); }
  .vn-sprite[data-kind="face"] { height: min(28vh, 240px); bottom: 160px; }
  .vn-prop { top: 9%; right: 4%; }

  .login-hero .lead { margin-top: 16px; font-size: 16px; }
  .login-hero .bank { font-size: 15px; }
  .login-page { --rkn-w: 84px; }
  .desk { padding: 22px 18px; margin-top: 40px; }
  .rkn-peek { top: 10px; }
  .rkn-bubble { left: 40%; top: -22px; font-size: 11px; padding: 5px 8px 4px; }
  .choice { grid-template-columns: 52px minmax(0, 1fr); gap: 14px; padding: 12px; }
  .choice > img, .choice .glow-xs { width: 52px; }
  .choice b { font-size: 20px; }
  #view-login .corridor { margin-top: 48px; }

  .night-head { padding-top: 24px; min-height: 0; }
  .speech { grid-template-columns: 64px minmax(0, 1fr); gap: 12px; margin-top: 12px; }
  .speech-face { width: 64px; }
  #view-night.loading .speech::before { width: 56px; height: 56px; }
  .speech-bubble { padding: 12px 14px 14px; --rkn-w: 72px; }
  .speech { padding-right: calc(72px * 0.86); }
  .speech-bubble .rkn-bubble { display: none; }
  .bank-card { grid-template-columns: 44px minmax(0, 1fr); gap: 12px; padding: 14px; }
  .bank-icon { width: 44px; }
  .speech-text { font-size: 15px; }
  .bat { width: 60px; top: 110px; }
  #view-night .corridor { margin-top: 20px; }

  .sheet { padding-left: 16px; padding-right: 16px; }
  .sheet-lore { font-size: 17px; }
  .vn-sprite[data-kind="rkn"] { width: 108vw; right: -6vw; bottom: 150px; max-height: 54vh; }
  .vn[data-speaker="rkn"] .vn-name { font-size: 16px; }

  .outcome-card { grid-template-columns: 64px minmax(0, 1fr); gap: 14px; padding: 16px; }
  .outcome-card .bustik { width: 64px; }
  .outcome-line { font-size: 21px; }
  .bar { width: 22vw; }
  .ledger { font-size: 14px; }
  .ledger th:last-child, .ledger td:last-child { display: none; }
  .ledger tr.blocked .room { color: var(--red-text); }
  .ledger tr.mine .room::after { content: " ·ты"; font-size: 12px; }
  .history li { grid-template-columns: 64px minmax(0, 1fr); }
  .history li .muted { grid-column: 2; }

  .prizes-head { grid-template-columns: 96px minmax(0, 1fr); gap: 16px; }
  .prizes-head .glow-lg { width: 96px; }
  .raffle-head { grid-template-columns: 72px minmax(0, 1fr); gap: 14px; }
  .raffle-head .glow-md { width: 72px; }
}

@media (max-height: 640px) {
  .vn-sprite { height: 34vh; }
  .vn-doors { display: none; }
}
