:root {
  --night-1: #17122a;
  --night-2: #0d0a18;
  --paper: #f2e9d5;
  --ink: #2a2338;
  --gold: #e0a75c;
  --gold-deep: #a4712f;
  --text: #e9e2d3;
  --muted: rgba(233, 226, 211, .62);
  --panel: rgba(32, 26, 50, .88);
  --panel-2: rgba(44, 36, 66, .92);
  --radius: 16px;
  --radius-s: 10px;
  --font-display: "Georgia", "Times New Roman", serif;
  --font-body: system-ui, "Segoe UI", Roboto, sans-serif;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; overscroll-behavior: none; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: radial-gradient(130% 100% at 50% 0%, var(--night-1) 0%, var(--night-2) 70%);
  user-select: none;
}

#app { position: absolute; inset: 0; overflow: hidden; }
#atmosphere { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
#screen-root { position: absolute; inset: 0; z-index: 1; }

/* ВНИМАНИЕ: position здесь менять нельзя. Экраны позиционируются через
   absolute + inset:0; relative обнуляет inset, и экран схлопнется по контенту. */
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  padding: calc(10px + var(--sat)) 12px calc(10px + var(--sab));
  animation: screenIn .32s ease both;
}
@keyframes screenIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Кнопки ---------- */
button { font-family: var(--font-body); cursor: pointer; border: none; color: inherit; }
.btn {
  min-height: 46px; padding: 11px 22px; border-radius: var(--radius);
  background: linear-gradient(180deg, #f0c078, var(--gold) 55%, var(--gold-deep));
  color: #2b1c08; font-size: 16px; font-weight: 700; letter-spacing: .2px;
  box-shadow: 0 3px 0 #7d5320, 0 8px 20px rgba(0,0,0,.4);
  transition: transform .1s ease, filter .15s ease;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #7d5320; }
.btn.secondary {
  background: linear-gradient(180deg, #4b4070, #362c56);
  color: var(--text); box-shadow: 0 3px 0 #221a3c, 0 8px 20px rgba(0,0,0,.4);
}
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px rgba(233,226,211,.32); }
.btn.small { min-height: 38px; padding: 8px 15px; font-size: 14px; }
.btn:disabled { filter: grayscale(.7) brightness(.65); cursor: default; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 18px;
  background: rgba(20,16,38,.6); box-shadow: inset 0 0 0 1.5px rgba(233,226,211,.22);
}

/* ---------- Лампа и заголовок ---------- */
.lamp {
  width: 74px; height: 74px; margin: 0 auto; border-radius: 50%;
  background: radial-gradient(circle at 42% 34%, #fff6df, var(--gold) 48%, transparent 72%);
  box-shadow: 0 0 46px 16px rgba(224,167,92,.34);
  animation: flicker 4.5s ease-in-out infinite;
}
@keyframes flicker {
  0%, 100% { opacity: .92; transform: scale(1); }
  38% { opacity: 1; transform: scale(1.035); }
  62% { opacity: .86; transform: scale(.985); }
}
.game-title {
  font-family: var(--font-display); font-weight: 400; letter-spacing: .5px;
  font-size: clamp(30px, 8vw, 46px); margin: 14px 0 4px; text-align: center;
  background: linear-gradient(180deg, #fbe9c4, var(--gold) 70%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { text-align: center; color: var(--muted); font-size: 14px; font-style: italic; }

/* ---------- Загрузка / меню ---------- */
.loading-screen, .menu-screen, .story-screen, .result-screen {
  align-items: center; justify-content: center; gap: 12px;
}
.loading-bar {
  width: min(240px, 70%); height: 4px; border-radius: 4px; margin-top: 18px;
  background: rgba(233,226,211,.16); overflow: hidden;
}
.loading-fill { height: 100%; width: 0; background: var(--gold); transition: width .3s ease; }

.menu-col { display: flex; flex-direction: column; gap: 10px; align-items: stretch; width: min(320px, 88%); margin-top: 8px; }
.menu-row { display: flex; gap: 8px; justify-content: center; }
.menu-row .btn { flex: 1; }

.night-screen {
  --scene-a: #211930;
  --scene-b: #0f0b18;
  --scene-glow: rgba(224,167,92,.16);
  --scene-spark: rgba(255,255,255,.10);
  overflow: hidden;
  isolation: isolate;
}
.night-screen::before {
  content: ''; position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(58% 36% at 50% 16%, var(--scene-glow) 0%, transparent 72%),
    radial-gradient(120% 92% at 50% 0%, var(--scene-a) 0%, var(--scene-b) 72%);
}
.night-screen::after {
  content: ''; position: absolute; inset: 0; z-index: 0; opacity: .9;
  background:
    radial-gradient(circle at 18% 14%, var(--scene-spark) 0 1px, transparent 2px),
    radial-gradient(circle at 77% 22%, var(--scene-spark) 0 1.2px, transparent 2.2px),
    radial-gradient(circle at 63% 10%, var(--scene-spark) 0 1px, transparent 2px),
    linear-gradient(180deg, transparent 0%, rgba(0,0,0,.08) 52%, rgba(0,0,0,.28) 100%);
  pointer-events: none;
}
.night-screen > * { position: relative; z-index: 1; }

/* ---------- Экран ночи ---------- */
.night-top {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase;
}
.night-label { padding-left: 4px; }

.stage {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; min-height: 0; padding: 10px 0 4px;
}
.guest-face {
  width: clamp(148px, 42vw, 220px); aspect-ratio: 4 / 5;
  position: relative; border-radius: 28px;
  display: grid; place-items: stretch;
  background: linear-gradient(180deg, rgba(255,244,222,.08), rgba(255,255,255,.02));
  box-shadow: 0 16px 50px rgba(0,0,0,.42), inset 0 0 0 1px rgba(233,226,211,.18);
  overflow: hidden;
  transition: opacity .5s ease, transform .5s ease, box-shadow .25s ease;
  animation: breathe 5s ease-in-out infinite;
}
.guest-face::before {
  content: ''; position: absolute; inset: 10px; border-radius: 22px;
  box-shadow: inset 0 0 0 1px rgba(233,226,211,.08); pointer-events: none;
}
.portrait-frame-inner { position: absolute; inset: 0; }
.portrait-frame-inner svg { width: 100%; height: 100%; display: block; }
.portrait-nameplate {
  position: absolute; left: 12px; right: 12px; bottom: 12px;
  border-radius: 999px; padding: 7px 12px; text-align: center;
  font-family: var(--font-display); font-size: 14px; letter-spacing: .5px;
  background: rgba(17,14,31,.62); backdrop-filter: blur(6px);
  box-shadow: inset 0 0 0 1px rgba(233,226,211,.16);
}
.portrait-seal {
  position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(17,14,31,.58); font-size: 16px;
  box-shadow: inset 0 0 0 1px rgba(233,226,211,.16);
}
@keyframes breathe { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.guest-face.talking {
  animation: breathe 5s ease-in-out infinite, talk .5s ease-in-out infinite alternate;
}
@keyframes talk { from { box-shadow: 0 16px 50px rgba(0,0,0,.42), inset 0 0 0 1px rgba(233,226,211,.18); }
                  to   { box-shadow: 0 20px 60px rgba(0,0,0,.5), 0 0 34px rgba(224,167,92,.18), inset 0 0 0 1px rgba(233,226,211,.28); } }
.guest-face.gone { opacity: 0; transform: scale(.92) translateY(10px); }
.guest-name { font-size: 12px; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; text-shadow: 0 2px 12px rgba(0,0,0,.38); }

.text-box {
  background: var(--panel); backdrop-filter: blur(8px);
  border-radius: var(--radius); padding: 14px 16px 12px;
  box-shadow: 0 -4px 30px rgba(0,0,0,.45), inset 0 0 0 1px rgba(233,226,211,.1);
  min-height: 132px; display: flex; flex-direction: column;
}
.text-box.wide { margin: auto; width: min(560px, 100%); }
.dialogue-box {
  position: relative;
  background: linear-gradient(180deg, rgba(34,27,52,.94), rgba(20,16,34,.98));
  min-height: 164px;
}
.dialogue-box::before {
  content: '“'; position: absolute; top: 8px; right: 16px;
  font-family: var(--font-display); font-size: 52px; color: rgba(224,167,92,.12);
}
.dialogue-history {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px;
}
.dialogue-history.empty { min-height: 2px; margin-bottom: 6px; }
.history-row {
  display: flex; flex-direction: column; gap: 2px; padding: 7px 10px;
  border-radius: 12px; background: rgba(255,255,255,.035);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}
.history-row.h-narrator { background: rgba(255,255,255,.02); }
.history-speaker {
  font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: rgba(233,226,211,.55);
}
.history-text { font-size: 12.5px; line-height: 1.45; color: rgba(233,226,211,.72); }
.speaker {
  display: inline-flex; align-items: center; align-self: flex-start;
  min-height: 18px; margin-bottom: 6px; padding: 4px 10px; border-radius: 999px;
  font-family: var(--font-display); font-size: 13px; letter-spacing: .6px;
  background: rgba(255,255,255,.06);
}
.sp-guest { color: var(--gold); }
.sp-you { color: #8fbfd0; }
.sp-narrator { color: rgba(233,226,211,.8); }
.line-text {
  margin: 0; font-size: clamp(15px, 4.1vw, 17px); line-height: 1.62;
  min-height: 3.2em; white-space: pre-wrap;
}
.line-narrator .speaker { background: rgba(255,255,255,.03); }
.line-narrator .line-text { font-style: italic; color: rgba(233,226,211,.88); }
.more-hint {
  align-self: flex-end; color: var(--gold); font-size: 17px; opacity: 0;
  transition: opacity .2s ease; animation: nudge 1.1s ease-in-out infinite;
}
@keyframes nudge { 0%,100% { transform: translateY(0); } 50% { transform: translateY(4px); } }

/* ---------- Полка выбора ---------- */
.shelf-panel {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
  max-height: 88%; display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(52,37,25,.98), rgba(31,22,17,.99) 20%, rgba(35,28,52,.98) 20.1%, rgba(24,19,42,.98));
  border-radius: 24px 24px 0 0; padding: 14px 12px calc(12px + var(--sab));
  box-shadow: 0 -12px 40px rgba(0,0,0,.6);
  transform: translateY(100%); transition: transform .32s cubic-bezier(.22,.9,.32,1);
}
.shelf-panel::after {
  content: ''; position: absolute; left: 0; right: 0; top: 62px; height: 6px;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(0,0,0,.18));
}
.shelf-panel.open { transform: none; }
.shelf-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; position: relative; z-index: 1; }
.shelf-title { flex: 1; font-family: var(--font-display); font-size: 16px; color: var(--gold); }
.hints { display: flex; flex-direction: column; gap: 6px; position: relative; z-index: 1; }
.hint {
  font-size: 13.5px; line-height: 1.5; color: rgba(233,226,211,.9);
  background: rgba(224,167,92,.1); border-left: 2px solid var(--gold);
  border-radius: 0 8px 8px 0; padding: 8px 10px;
  animation: screenIn .3s ease both;
}
.shelf-list {
  overflow-y: auto; overscroll-behavior: contain; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px;
  margin-top: 10px; padding: 8px 2px 6px; position: relative; z-index: 1;
}

.book-card {
  display: grid; grid-template-columns: 10px 64px 1fr; gap: 12px; align-items: start;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border-radius: 14px; padding: 12px 12px 10px 0; overflow: hidden; cursor: pointer;
  transition: background .18s ease, transform .12s ease, box-shadow .18s ease;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}
.book-card:active { transform: scale(.99); }
.book-card.expanded {
  background: linear-gradient(180deg, rgba(224,167,92,.16), rgba(255,255,255,.05));
  box-shadow: 0 10px 25px rgba(0,0,0,.26), inset 0 0 0 1px rgba(224,167,92,.25);
}
.book-spine {
  align-self: stretch; min-height: 96px; background: var(--spine); border-radius: 0 5px 5px 0;
  box-shadow: inset -2px 0 0 rgba(255,255,255,.12), inset -5px 0 0 rgba(0,0,0,.18);
}
.book-cover-wrap { align-self: stretch; display: flex; }
.book-cover {
  width: 64px; min-height: 96px; border-radius: 10px; position: relative; overflow: hidden;
  background: linear-gradient(160deg, var(--cover-main), var(--cover-shadow));
  box-shadow: 0 8px 20px rgba(0,0,0,.28), inset 0 0 0 1px rgba(255,255,255,.12);
  color: var(--cover-ink); padding: 8px 6px 7px; display: flex; flex-direction: column; text-align: center;
}
.book-cover::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 3px 0 0 var(--cover-edge), inset -8px 0 14px rgba(0,0,0,.12);
  pointer-events: none;
}
.book-cover-pattern { position: absolute; inset: 0; background: var(--cover-pattern); opacity: .95; }
.book-cover-topline, .book-cover-title, .book-cover-bottom, .book-cover-symbol { position: relative; z-index: 1; }
.book-cover-topline {
  font-size: 7px; line-height: 1.15; letter-spacing: .45px; text-transform: uppercase;
  opacity: .85; min-height: 16px;
}
.book-cover-symbol { font-size: 16px; line-height: 1; margin: 5px 0 6px; color: var(--cover-foil); }
.book-cover-title {
  margin: auto 0; font-family: var(--font-display); font-size: 10px; line-height: 1.12; letter-spacing: .2px;
  text-shadow: 0 1px 0 rgba(0,0,0,.18);
}
.book-cover-title span { display: block; margin-top: 2px; }
.book-cover-bottom {
  margin-top: auto; font-size: 9px; letter-spacing: 2px; color: var(--cover-foil);
}
.locked-cover {
  background: linear-gradient(180deg, rgba(82,72,104,.95), rgba(46,39,63,.95));
  display: grid; place-items: center; color: rgba(233,226,211,.66);
}
.locked-cover .book-cover-mystery {
  position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid rgba(233,226,211,.2); font-family: var(--font-display);
}
.book-info { min-width: 0; }
.book-title { font-family: var(--font-display); font-size: 15.5px; }
.book-author { font-size: 12px; color: var(--muted); margin-top: 1px; }
.book-blurb { font-size: 13px; line-height: 1.5; color: rgba(233,226,211,.78); margin-top: 6px; }
.book-mood {
  display: inline-block; margin-top: 6px; font-size: 11.5px; letter-spacing: .6px;
  color: var(--gold); background: rgba(224,167,92,.14); border-radius: 999px; padding: 2px 9px;
}
.book-card .give {
  grid-column: 3; justify-self: start; margin-top: 8px;
  max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; overflow: hidden;
  transition: max-height .24s ease, opacity .2s ease, padding .24s ease;
}
.book-card.expanded .give { max-height: 46px; opacity: 1; padding-top: 8px; padding-bottom: 8px; }
.book-card.static { cursor: default; }
.book-card.locked { opacity: .58; }
.book-label { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.pulse { animation: pulseRing 1.1s ease-in-out infinite; }
@keyframes pulseRing {
  0%,100% { box-shadow: inset 0 0 0 1.5px rgba(233,226,211,.32); transform: none; }
  50% { box-shadow: inset 0 0 0 1.5px rgba(224,167,92,.65), 0 0 0 4px rgba(224,167,92,.1); transform: translateY(-1px); }
}

@media (max-width: 460px) {
  .shelf-list { grid-template-columns: 1fr; }
  .book-card { grid-template-columns: 10px 56px 1fr; }
  .book-cover { width: 56px; min-height: 88px; }
}

/* ---------- Титульная карточка ночи ---------- */
.night-card {
  position: absolute; inset: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: rgba(13,10,24,.93); backdrop-filter: blur(4px);
  transition: opacity .4s ease; animation: fadeIn .35s ease;
}
.night-card.hide { opacity: 0; pointer-events: none; }
.nc-num {
  font-family: var(--font-display); font-size: 34px; letter-spacing: 3px;
  color: var(--gold); text-transform: uppercase;
}
.nc-sub { color: var(--muted); font-style: italic; font-size: 14px; animation: nudge 1.6s ease-in-out infinite; }
body.reduce-motion .nc-sub { animation: none; }

/* Пульс кнопки «Прислушаться» при первом обучении. */
.btn.pulse { animation: btnPulse 1.2s ease-in-out 3; }
@keyframes btnPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); box-shadow: 0 0 18px rgba(224,167,92,.5), inset 0 0 0 1.5px rgba(233,226,211,.5); }
}

/* ---------- Пауза ---------- */
.pause-panel {
  position: absolute; inset: 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 24px; text-align: center; background: rgba(13,10,24,.9); backdrop-filter: blur(6px);
  animation: screenIn .2s ease both;
}
.pause-title { font-family: var(--font-display); font-size: 22px; color: var(--gold); }

/* ---------- Результат ---------- */
.result-mark { font-size: 56px; animation: breathe 4s ease-in-out infinite; }
.result-title { font-family: var(--font-display); font-weight: 400; font-size: 26px; margin: 6px 0 2px; text-align: center; }
.mark-right { filter: drop-shadow(0 0 22px rgba(224,167,92,.7)); }
.lights-gain { font-size: 19px; color: var(--gold); font-weight: 700; }
.reward-card {
  display: grid; grid-template-columns: 8px 64px 1fr; gap: 12px; align-items: center;
  width: min(380px, 92%); background: rgba(255,255,255,.06); border-radius: var(--radius-s);
  padding: 10px 12px 10px 0; margin-top: 6px; animation: screenIn .4s .15s ease both;
}
.reward-card .book-spine { min-height: 64px; }
.reward-card .book-cover { width: 64px; min-height: 88px; }

/* ---------- Модальные окна ---------- */
#modal-root { position: absolute; inset: 0; pointer-events: none; z-index: 60; }
/* Всё, что кладётся в #modal-root напрямую, обязано вернуть себе pointer-events. */
.modal-backdrop {
  position: absolute; inset: 0; pointer-events: auto;
  background: rgba(8,6,18,.72); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: calc(14px + var(--sat)) 12px calc(14px + var(--sab));
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(440px, 100%); max-height: 100%; overflow: auto; overscroll-behavior: contain;
  background: linear-gradient(175deg, var(--panel-2), rgba(24,19,42,.96));
  border-radius: 20px; padding: 18px 16px calc(16px + var(--sab));
  box-shadow: 0 20px 60px rgba(0,0,0,.6), inset 0 0 0 1px rgba(233,226,211,.1);
  animation: screenIn .24s ease both;
}
.modal h2 { font-family: var(--font-display); font-weight: 400; font-size: 22px; margin: 0 0 4px; color: var(--gold); }
.modal h3 { font-family: var(--font-display); font-weight: 400; font-size: 17px; margin: 16px 0 2px; color: var(--gold); }
.modal-body { display: flex; flex-direction: column; }
.sub { font-size: 13.5px; color: var(--muted); line-height: 1.5; text-align: center; }
.modal .sub { text-align: left; }

.list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.collection-summary {
  margin-top: 10px; padding: 12px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(224,167,92,.08), rgba(255,255,255,.03));
  box-shadow: inset 0 0 0 1px rgba(224,167,92,.08);
}
.collection-meter {
  height: 8px; border-radius: 999px; overflow: hidden;
  background: rgba(255,255,255,.08); margin-bottom: 12px;
}
.collection-meter span {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, rgba(224,167,92,.9), rgba(245,212,146,.95));
  box-shadow: 0 0 18px rgba(224,167,92,.25);
}
.collection-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.collection-chip {
  padding: 10px 8px; border-radius: 12px; text-align: center;
  background: rgba(255,255,255,.04);
}
.collection-chip strong {
  display: block; font-family: var(--font-display); font-size: 18px; color: var(--gold);
}
.collection-chip span {
  display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); line-height: 1.35;
}
@media (max-width: 460px) {
  .collection-stats { grid-template-columns: repeat(2, 1fr); }
}

.card { background: rgba(255,255,255,.05); border-radius: var(--radius-s); padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.card .grow { flex: 1; min-width: 0; }
.card .t { font-size: 14.5px; font-family: var(--font-display); }
.card .dsc { font-size: 12px; color: var(--muted); margin-top: 1px; }
.card.locked { opacity: .42; }
.diary-mark { font-size: 19px; width: 26px; text-align: center; }

.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; font-size: 14px; }
.settings-row input[type=range] { flex: 1; max-width: 190px; accent-color: var(--gold); }
.settings-row select {
  background: rgba(255,255,255,.08); color: var(--text); border: none;
  border-radius: 8px; padding: 7px 10px; font-size: 14px;
}

.lb-summary { margin-top: 10px; background: linear-gradient(180deg, rgba(224,167,92,.12), rgba(255,255,255,.03)); }
.lb-podium {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px;
}
.lb-podium-card {
  flex-direction: column; text-align: center; padding: 12px 10px; min-height: 162px;
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.04));
}
.lb-podium-card.place-1 { transform: translateY(-4px); background: linear-gradient(180deg, rgba(224,167,92,.18), rgba(255,255,255,.04)); }
.lb-podium-card.place-2, .lb-podium-card.place-3 { background: linear-gradient(180deg, rgba(160,170,188,.1), rgba(255,255,255,.04)); }
.lb-podium-place { font-size: 22px; line-height: 1; }
.podium-photo { width: 46px; height: 46px; }
.podium-fallback { font-size: 22px; width: auto; }
.lb-list { margin-top: 12px; }
.lb-you-row, .lb-row.self { box-shadow: inset 0 0 0 1.5px var(--gold); background: rgba(224,167,92,.07); }
.lb-rank { min-width: 28px; text-align: center; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.lb-photo { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; background: rgba(255,255,255,.1); }
.lb-score { font-size: 13px; color: var(--gold); white-space: nowrap; }
@media (max-width: 460px) {
  .lb-podium { grid-template-columns: 1fr; }
  .lb-podium-card.place-1 { transform: none; }
}

/* ---------- Тосты ---------- */
#toast-root {
  position: absolute; left: 0; right: 0; bottom: calc(20px + var(--sab)); z-index: 80;
  display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none;
}
.toast {
  background: rgba(24,19,42,.95); color: var(--text); font-size: 13.5px;
  padding: 9px 15px; border-radius: 999px; box-shadow: 0 8px 24px rgba(0,0,0,.5);
  animation: screenIn .22s ease both;
}

/* ---------- Доступность ---------- */
@media (prefers-reduced-motion: reduce) {
  .lamp, .guest-face, .more-hint, .result-mark { animation: none; }
}
body.reduce-motion .lamp,
body.reduce-motion .guest-face,
body.reduce-motion .more-hint,
body.reduce-motion .result-mark { animation: none; }

/* ---------- Дополнения v1.5 ---------- */
.story-title {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--gold);
  text-align: center;
  margin-bottom: 6px;
}
.story-sub {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
  margin-bottom: 14px;
}
.result-echo,
.result-whisper {
  width: min(420px, 92%);
  text-align: center;
  border-radius: 16px;
  padding: 10px 14px;
  line-height: 1.55;
}
.result-echo {
  background: rgba(255,255,255,.05);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
  font-size: 13px;
  color: var(--text);
}
.result-whisper {
  background: linear-gradient(180deg, rgba(224,167,92,.08), rgba(255,255,255,.02));
  box-shadow: inset 0 0 0 1px rgba(224,167,92,.08);
  font-size: 12.5px;
  color: var(--muted);
}
.tier-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  margin-left: 6px;
  border-radius: 999px;
  background: rgba(224,167,92,.14);
  box-shadow: inset 0 0 0 1px rgba(224,167,92,.18);
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: 11px;
  vertical-align: middle;
}
.guest-name {
  font-size: 12.5px;
  color: rgba(233,226,211,.88);
  letter-spacing: 2.4px;
}

/* ---------- Атмосфера v1.6 ---------- */
.stage {
  position: relative;
}
.stage::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 22%;
  width: min(340px, 78vw);
  height: min(340px, 58vh);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, var(--scene-glow) 0%, transparent 68%);
  filter: blur(10px);
  opacity: .9;
  pointer-events: none;
}
.guest-face::after {
  content: '';
  position: absolute;
  inset: auto 16px 10px 16px;
  height: 34%;
  border-radius: 20px;
  background: linear-gradient(180deg, transparent 0%, rgba(10,8,16,.18) 18%, rgba(10,8,16,.55) 100%);
  pointer-events: none;
}

.book-special-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 6px 0 2px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--gold);
  opacity: .95;
}
.special-cover {
  box-shadow: 0 10px 24px rgba(0,0,0,.34), 0 0 0 1px rgba(240,201,126,.16), inset 0 0 0 1px rgba(255,255,255,.12);
}
.book-cover-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(240,201,126,.18);
  border: 1px solid rgba(240,201,126,.42);
  color: #f4d48f;
  font-size: 10px;
  line-height: 1;
}
.guest-aura {
  max-width: min(420px, 88vw);
  text-align: center;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(233,226,211,.72);
  letter-spacing: .25px;
  text-wrap: balance;
  text-shadow: 0 2px 12px rgba(0,0,0,.34);
  margin-top: -2px;
}
.nc-event-title {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(224,167,92,.9);
}
.nc-event-note {
  max-width: min(520px, 88vw);
  text-align: center;
  color: rgba(233,226,211,.76);
  font-size: 13px;
  line-height: 1.55;
  text-wrap: balance;
}

/* ---------- Развилки диалогов v2.0 ---------- */
.response-panel {
  position: absolute;
  inset: auto 12px calc(12px + var(--sab)) 12px;
  z-index: 48;
  max-height: min(76vh, 620px);
  overflow-y: auto;
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(35,28,53,.98), rgba(20,16,33,.99));
  box-shadow: 0 20px 58px rgba(0,0,0,.62), inset 0 0 0 1px rgba(233,226,211,.12);
  animation: responseIn .28s cubic-bezier(.22,.9,.32,1) both;
}
@keyframes responseIn {
  from { opacity: 0; transform: translateY(24px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.response-kicker,
.decision-kicker {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 10.5px;
}
.response-title {
  margin-top: 5px;
  font-family: var(--font-display);
  font-size: clamp(19px, 5vw, 24px);
  line-height: 1.22;
}
.response-panel > .sub { margin-top: 7px; text-align: left; }
.response-options {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 14px;
}
.response-options .btn {
  min-height: 48px;
  text-align: left;
  justify-content: flex-start;
  line-height: 1.35;
}
.decision-card {
  width: min(440px, 92%);
  padding: 11px 14px;
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(116,151,173,.12), rgba(255,255,255,.035));
  box-shadow: inset 0 0 0 1px rgba(143,191,208,.12);
  text-align: center;
}
.decision-text {
  margin-top: 5px;
  font-family: var(--font-display);
  font-size: 14px;
  color: rgba(233,226,211,.95);
}

/* ---------- Достижения v2.0 ---------- */
.achievement-progress {
  height: 9px;
  margin: 12px 0 4px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,.07);
}
.achievement-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(224,167,92,.86), rgba(246,214,149,.98));
  box-shadow: 0 0 18px rgba(224,167,92,.28);
}
.achievement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 9px;
  margin-top: 12px;
}
.achievement-card {
  position: relative;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  min-height: 88px;
  padding: 11px;
  border-radius: 15px;
  background: rgba(255,255,255,.045);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.045);
}
.achievement-card.unlocked {
  background: linear-gradient(180deg, rgba(224,167,92,.12), rgba(255,255,255,.035));
  box-shadow: inset 0 0 0 1px rgba(224,167,92,.18), 0 8px 22px rgba(0,0,0,.18);
}
.achievement-card.locked { opacity: .52; }
.achievement-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: rgba(12,10,22,.38);
  font-size: 21px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.07);
}
.achievement-copy { min-width: 0; padding-right: 3px; }
.achievement-title {
  font-family: var(--font-display);
  font-size: 14px;
  line-height: 1.25;
}
.achievement-desc {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}
.achievement-state {
  grid-column: 2;
  align-self: end;
  color: var(--gold);
  font-size: 10px;
  letter-spacing: .8px;
  text-transform: uppercase;
}
.achievement-card.locked .achievement-state { color: var(--muted); }
.achievement-unlock {
  width: min(460px, 94%);
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 11px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 17px;
  background: linear-gradient(135deg, rgba(224,167,92,.2), rgba(85,69,101,.16));
  box-shadow: 0 12px 28px rgba(0,0,0,.26), inset 0 0 0 1px rgba(240,201,126,.25);
  animation: achievementIn .45s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes achievementIn {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to { opacity: 1; transform: none; }
}
.achievement-unlock-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  font-size: 25px;
  background: rgba(16,12,25,.38);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.achievement-unlock-kicker {
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.achievement-unlock-title {
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 16px;
}
.achievement-unlock-desc {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}

@media (max-width: 460px) {
  .achievement-grid { grid-template-columns: 1fr; }
  .response-panel { left: 8px; right: 8px; }
}
