/* =======================
   DESIGN CONSTANTS
   ======================= */

:root {
  --design-w: 1920;
  --design-h: 1080;
  --scale: 1;

  --bg-page: #0a0a0a;
  --bg-panel: rgba(22, 14, 14, 0.8);
  --bg-panel-strong: rgba(22, 14, 14, 0.95);

  --gold: #c0a65d;
  --white: #ffffff;
  
  --color-mio: #E19B9C;
  --color-aya: #693D69;
  --color-kira: #C0530B;
  --color-host: #DFDFDF;
  --color-player: #FFFFFF;

  --font: 'Montserrat', sans-serif;

  --radius-xl: 50px;
  --radius-lg: 30px;
  --radius-md: 12px;
  --radius-sm: 10px;

  --shadow-gold: 0px 0px 15px 0px rgba(192, 166, 93, 0.4);
}

/* =======================
   GLOBAL RESET
   ======================= */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { width: 100%; height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg-page);
  overflow: hidden;
}

button, input, textarea, select { font: inherit; }
button {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: inherit;
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

img { display: block; max-width: 100%; }

@supports not selector(:focus-visible) {
  button:focus { box-shadow: var(--shadow-gold); }
}

/* =======================
   APP (1920x1080 canvas)
   ======================= */

.app {
  width: calc(var(--design-w) * 1px);
  height: calc(var(--design-h) * 1px);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(var(--scale));
  transform-origin: center center;
  background: #000;
  overflow: hidden;
}

.view {
  display: none;
  position: absolute;
  inset: 0;
}
.view--active { display: block; }

.bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  pointer-events: none;
  user-select: none;
}

/* =======================
   MENU
   ======================= */

.menu__content {
  position: absolute;
  left: 129px;
  top: 50%;
  transform: translateY(-50%);
  width: 534px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 37px;
}

.menu__logo {
  width: 396px;
  height: 264px;
  overflow: hidden;
}
.menu__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.menu__actions {
  width: 534px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.menu__btn-wrap {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.menu__btn {
  width: 534px;
  height: 118px;
  background: var(--bg-panel);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  position: relative;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.menu__btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-radius: 24px;
  pointer-events: none;
  transition: border-color .18s ease;
}

.menu__btn-text {
  font-weight: 700;
  font-size: 48px;
  color: var(--gold);
  letter-spacing: .48px;
  white-space: nowrap;
}

.menu__btn:hover,
.menu__btn:focus-visible {
  transform: scale(1.02);
  box-shadow: var(--shadow-gold);
}

.menu__btn:hover::before,
.menu__btn:focus-visible::before {
  border-color: var(--gold);
}

.menu__btn:active {
  transform: scale(0.99);
  background: var(--bg-panel-strong);
  box-shadow: 0 0 0 2px rgba(192, 166, 93, .9), 0 4px 14px rgba(0,0,0,.25) inset;
}

.menu__btn:disabled {
  cursor: not-allowed;
  opacity: .45;
  transform: none;
  box-shadow: none;
}
.menu__btn:disabled::before {
  border-color: transparent;
}

.menu__decor {
  position: absolute;
  width: 186px;
  height: 186px;
  top: -7px;
  pointer-events: none;
  user-select: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity .18s ease, filter .18s ease;
}

.menu__decor img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: 50% 50%;
  transition: transform .18s ease;
}

.menu__decor--left { left: -100px; }
.menu__decor--right { right: -100px; }

.menu__decor--left img {
  transform: none;
}

.menu__btn:hover ~ .menu__decor,
.menu__btn:focus-visible ~ .menu__decor {
  opacity: 1;
  filter: brightness(1.15);
}

.menu__btn:hover ~ .menu__decor img,
.menu__btn:focus-visible ~ .menu__decor img {
  transform: scale(1.08);
}

.menu__btn:disabled ~ .menu__decor {
  opacity: 0;
  filter: none;
}

/* =======================
   STORY CARDS
   ======================= */

.story__cards {
  position: absolute;
  left: 50%;
  top: calc(50% + 88px);
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 51px;
  width: calc(420px * 3 + 51px * 2);
}

.story-card {
  position: relative;
  width: 420px;
  height: 400px;
  flex: 0 0 420px;
  border-radius: var(--radius-xl);
  overflow: visible;
  transition: transform .2s ease, filter .2s ease;
  text-align: left;
}

.story-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg-panel);
  border-radius: var(--radius-xl);
  z-index: 0;
  border: 2px solid transparent;
  transition: border-color .2s ease;
}

.story-card:hover {
  transform: scale(1.01);
}

.story-card:hover::before {
  border-color: var(--gold);
}

.story-card:focus-visible::before {
  border-color: var(--gold);
}

.story-card__image {
  position: absolute;
  left: 48px;
  top: -160px;
  width: 332px;
  height: 560px;
  z-index: 2;
  pointer-events: none;
  user-select: none;
  clip-path: inset(0 0 160px 0);
}

.story-card__image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 50% 100%;
}

.story-card__info,
.story-card__lock {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 235px;
  background: linear-gradient(
    to bottom,
    rgba(22, 14, 14, 0) 0%,
    rgba(22, 14, 14, 0.95) 28.365%,
    rgba(22, 14, 14, 1) 77.404%
  );
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 40px 20px;
  gap: 25px;
  z-index: 3;
}

.story-card__text {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 4;
}

.story-card__name {
  font-weight: 700;
  font-size: 40px;
  color: var(--color-mio);
  letter-spacing: .4px;
  white-space: nowrap;
}

.story-card__subtitle {
  font-weight: 700;
  font-size: 20px;
  color: var(--gold);
  letter-spacing: .2px;
  white-space: nowrap;
}

.story-card__progress {
  width: 380px;
  height: 30px;
  background: #160e0e;
  border: 1px solid var(--gold);
  border-radius: 40px;
  overflow: hidden;
  position: relative;
  z-index: 4;
}

.story-card__progress-bar {
  height: 100%;
  width: 0%;
  background: var(--gold);
  border-radius: 56px;
}

.story-card__lock[hidden] { display: none !important; }
.story-card__lock { display: flex; align-items: center; justify-content: center; }
.story-card__lock img { width: 115px; height: 115px; object-fit: contain; }

.story-card--locked {
  cursor: not-allowed;
  filter: grayscale(0.15) brightness(0.9);
}
.story-card--locked:hover { transform: none; }
.story-card--locked:hover::before { border-color: transparent; }
.story-card--locked .story-card__info { display: none; }
.story-card--locked .story-card__lock { display: flex; }

/* =======================
   CHAPTERS
   ======================= */

.story__chapters {
  position: absolute;
  left: 279px;
  top: 863px;
  width: 420px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px 10px;
}

.chapter-btn {
  width: 133px;
  height: 60px;
  background: var(--bg-panel);
  border-radius: var(--radius-md);
  font-weight: 400;
  font-size: 24px;
  color: var(--gold);
  letter-spacing: .24px;
  position: relative;
  transition: transform .2s ease;
}

.chapter-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  pointer-events: none;
  transition: border-color .2s ease;
}

.chapter-btn:not(.chapter-btn--locked):not(:disabled):hover {
  transform: scale(1.05);
}

.chapter-btn:not(.chapter-btn--locked):not(:disabled):hover::before {
  border-color: var(--gold);
}

.chapter-btn--active::before {
  border-color: var(--gold);
}

.chapter-btn--locked,
.chapter-btn:disabled {
  background: rgba(40, 31, 31, 0.8);
  color: #3b2c2c;
  cursor: not-allowed;
}

.story__back {
  position: absolute;
  left: 44px;
  top: 44px;
  padding: 12px 28px;
  background: var(--bg-panel);
  border-radius: var(--radius-sm);
  color: var(--gold);
  font-weight: 700;
  letter-spacing: .2px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.story__back:hover { transform: scale(1.03); }
.story__back:focus-visible { box-shadow: var(--shadow-gold); }

/* =======================
   GAMEPLAY BG + ПЕРСОНАЖИ
   ======================= */

.game__bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 1955px;
  height: 1955px;
  transform: translate(-12px, -699px);
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  z-index: 1;
}

.scene-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
  user-select: none;
  z-index: 10;
}

.scene-char {
  position: absolute;
  width: 834px;
  height: 1070px;
  top: 43px;
  display: none;
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
  z-index: 10;
}

.scene-char img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
}

.scene-char--left {
  left: 10px;
}

.scene-char--center {
  left: 543px;
}

.scene-char--right {
  left: 1076px;
}

.scene-char img:not([src]),
.scene-char img[src=""] {
  display: none;
}

/* =======================
   DIALOG
   ======================= */

.dialog {
  position: absolute;
  left: 0;
  top: 644px;
  width: 1920px;
  height: 439px;
  background: linear-gradient(
    -0.147896deg,
    rgba(22, 14, 14, 0.9) 41.476%,
    rgba(22, 14, 14, 0.804) 61.918%,
    rgba(22, 14, 14, 0.494) 79.214%,
    rgba(22, 14, 14, 0) 97.035%
  );
  padding: 24px 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  z-index: 100;
}

.dialog__layout {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dialog__text {
  width: 1139px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.dialog__name {
  font-weight: 700;
  font-size: 40px;
  letter-spacing: .4px;
  text-shadow: 
    -2px -2px 0 #160e0e,
    2px -2px 0 #160e0e,
    -2px 2px 0 #160e0e,
    2px 2px 0 #160e0e,
    0px -2px 0 #160e0e,
    0px 2px 0 #160e0e,
    -2px 0px 0 #160e0e,
    2px 0px 0 #160e0e,
    0 0 10px rgba(0, 0, 0, 0.5);
}

.dialog__name--mio {
  color: var(--color-mio);
}

.dialog__name--aya {
  color: var(--color-aya);
}

.dialog__name--kira {
  color: var(--color-kira);
}

.dialog__name--host {
  color: var(--color-host);
}

.dialog__name--player {
  color: var(--color-player);
}

.dialog__verse {
  font-weight: 400;
  font-size: 40px;
  color: var(--white);
  letter-spacing: .4px;
}

.dialog__aside {
  font-weight: 300;
  font-style: italic;
  font-size: 40px;
  color: var(--white);
  letter-spacing: .4px;
}

/* =======================
   CONTROLS
   ======================= */

.controls {
  width: 192px;
  height: auto;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.controls__btn {
  background: var(--bg-panel);
  border-radius: var(--radius-sm);
  height: 50px;
  width: 192px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
  transition: transform .2s ease;
  position: relative;
}
.controls__btn:hover { transform: scale(1.05); }

.controls__btn--active::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--gold);
  border-radius: var(--radius-sm);
  pointer-events: none;
}

.controls__icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  object-fit: contain;
}

.controls__btn-text {
  font-weight: 700;
  font-size: 20px;
  color: var(--gold);
  letter-spacing: .2px;
  white-space: nowrap;
  line-height: normal;
}

/* =======================
   CHOICE
   ======================= */

.choice {
  position: absolute;
  inset: 0;
  z-index: 200;
}

.choice__overlay {
  position: absolute;
  inset: 0;
  background: rgba(22, 14, 14, 0.8);
}

.choice__panel {
  position: absolute;
  left: 410px;
  top: 192px;
  width: 1112px;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.choice__title {
  font-weight: 700;
  font-size: 48px;
  color: var(--gold);
  letter-spacing: .48px;
  text-transform: uppercase;
}

.choice__option {
  position: relative;
  background: var(--bg-panel);
  border-radius: var(--radius-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 25px;
  transition: transform .2s ease, box-shadow .2s ease;
  margin-bottom: 25px;
}
.choice__option:hover {
  transform: translateX(5px);
  box-shadow: var(--shadow-gold);
}

.choice__option--selected::before {
  content: '';
  position: absolute;
  inset: -2px;
  border: 2px solid var(--gold);
  border-radius: 12px;
  pointer-events: none;
}

.choice__option-title {
  font-weight: 500;
  font-style: italic;
  font-size: 36px;
  color: var(--gold);
  letter-spacing: .36px;
  white-space: nowrap;
}

.choice__option-text {
  font-weight: 700;
  font-size: 36px;
  color: var(--white);
  letter-spacing: .36px;
  display: flex;
  align-items: stretch;
  gap: 10px;
  position: relative;
  padding-left: 20px; /* Отступ для полоски */
}

/* Полоска через ::before - растягивается на всю высоту */
.choice__option-text::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--white);
  border-radius: 2px;
}

/* Убираем span с полоской, оставляем только текст */
.choice__option-text span:first-child[aria-hidden="true"] {
  display: none;
}

/* Текст растягивается */
.choice__option-text span:last-child {
  flex: 1;
  line-height: 1.3;
}


/* =======================
   HISTORY
   ======================= */

.history {
  position: absolute;
  inset: 0;
  z-index: 200;
}

.history__overlay {
  position: absolute;
  inset: 0;
  background: rgba(22, 14, 14, 0.8);
}

.history__modal {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 1512px;
  background: var(--bg-panel-strong);
  border-radius: var(--radius-lg);
  padding: 40px;
}

.history__modal::before {
  content: '';
  position: absolute;
  inset: -2px;
  border: 2px solid var(--gold);
  border-radius: 32px;
  pointer-events: none;
}

.history__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.history__title {
  font-weight: 700;
  font-size: 48px;
  color: var(--gold);
  letter-spacing: .48px;
}

.history__close {
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s ease;
}
.history__close:hover { transform: rotate(90deg); }

.history__body {
  margin-top: 40px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.history__list {
  flex: 1;
  height: 607px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  scrollbar-width: none;
}
.history__list::-webkit-scrollbar { display: none; }

.history__name {
  font-weight: 700;
  font-size: 36px;
  letter-spacing: .36px;
  white-space: nowrap;
  text-shadow: 
    -1px -1px 0 #160e0e,
    1px -1px 0 #160e0e,
    -1px 1px 0 #160e0e,
    1px 1px 0 #160e0e;
}

.history__name--mio {
  color: var(--color-mio);
}

.history__name--aya {
  color: var(--color-aya);
}

.history__name--kira {
  color: var(--color-kira);
}

.history__name--host {
  color: var(--color-host);
}

.history__name--player {
  color: var(--color-player);
}

.history__choice-label {
  font-weight: 400;
  font-style: italic;
  font-size: 36px;
  color: var(--white);
  letter-spacing: .36px;
}

.history__text {
  font-weight: 500;
  font-size: 36px;
  color: var(--white);
  letter-spacing: .36px;
}

.history__scrollbar {
  width: 20px;
  height: 607px;
  background: #160e0e;
  border-radius: 62px;
  position: relative;
  flex-shrink: 0;
}

.history__thumb {
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 566px;
  background: var(--gold);
  border-radius: 62px;
}

/* =======================
   SAVES - ПОЛНАЯ ВЕРСИЯ (FIX: save-wrapper + delete)
   ======================= */

.view[data-view="menu"] {
  z-index: 1;
}

.view[data-view="story"],
.view[data-view="endings"],
.view[data-view="game"],
.view[data-view="choice"],
.view[data-view="history"],
.view[data-view="ending"] {
  z-index: 100;
}

.view[data-view="saves"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 1920px;
  height: 1080px;
  z-index: 200;
  display: none;
}

.view[data-view="saves"].view--active {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
}

.saves {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.saves__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 1;
  cursor: pointer;
}

.saves__modal {
  position: relative;
  width: 1512px;
  height: 839px;
  background: rgba(22, 14, 14, 0.98);
  border: 2px solid var(--gold);
  border-radius: 30px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  z-index: 2;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8);
}

.saves__header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 70px;
  flex-shrink: 0;
}

.saves__title {
  font-weight: 700;
  font-size: 48.5455px;
  line-height: 59px;
  letter-spacing: 0.01em;
  color: var(--gold);
  flex: 1;
}

.saves__close {
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .3s ease, opacity .2s ease;
  padding: 0;
  flex-shrink: 0;
  opacity: 0.9;
}

.saves__close:hover {
  transform: rotate(90deg);
  opacity: 1;
}

.saves__close svg {
  width: 48px;
  height: 48px;
}

.saves__body {
  display: flex;
  flex-direction: row;
  gap: 0;
  width: 100%;
  height: 649px;
  flex-shrink: 0;
  justify-content: center;
  align-items: flex-start;
}

.saves__list {
  width: 1292px;
  height: 649px;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  grid-template-columns: repeat(2, 631px);
  grid-auto-rows: 200px;
  gap: 30px;
  align-content: start;
  justify-content: center;
  padding-right: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.saves__list::-webkit-scrollbar {
  display: none;
}

/* === FIX: обёртка для карточки + кнопки удаления === */
.save-wrapper {
  position: relative;
  width: 631px;
  height: 200px;
}

/* Карточка сохранения (кнопка "load-save") */
.save {
  width: 100%;
  height: 100%;
  background: #1a1212;
  border-radius: 30px;
  padding: 20px 22px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  transition: background .2s ease, border-color .2s ease;
  text-align: left;
  box-sizing: border-box;
  border: 2px solid transparent;
}

.save:hover {
  background: #1e1414;
  border-color: var(--gold);
}

.save__preview {
  width: 220px;
  height: 156px;
  flex-shrink: 0;
  border-radius: 20px;
  overflow: hidden;
  background: #0a0a0a;
}

.save__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .25s ease;
}

.save:hover .save__preview img {
  transform: scale(1.05);
}

.save__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.save__slot-name {
  font-weight: 700;
  font-size: 32px;
  line-height: 39px;
  letter-spacing: 0.01em;
  color: var(--gold);
  margin: 0;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.save__details {
  font-weight: 500;
  font-size: 20px;
  line-height: 24px;
  letter-spacing: 0.01em;
  color: var(--gold);
  opacity: 0.85;
  margin: 0;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* КНОПКА УДАЛЕНИЯ (теперь позиционируется от .save-wrapper) */
.save__delete {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  background: rgba(192, 166, 93, 0.1);
  border: 2px solid transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s ease, background .2s ease, border-color .2s ease, transform .2s ease;
  z-index: 10;
}

/* === FIX: hover должен быть на wrapper, а не на .save === */
.save-wrapper:hover .save__delete {
  opacity: 1;
}

.save__delete:hover {
  background: rgba(192, 166, 93, 0.2);
  border-color: var(--gold);
  transform: scale(1.1);
}

.save__delete svg {
  width: 20px;
  height: 20px;
}

/* Кнопка "Новая игра" (без wrapper, как у тебя) */
.save--new {
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 15px;
  padding: 0;
}

.save__icon {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .25s ease;
  flex-shrink: 0;
}

.save--new:hover .save__icon {
  transform: rotate(90deg) scale(1.1);
}

.save__icon svg {
  width: 50px;
  height: 50px;
}

.save__new-text {
  font-weight: 700;
  font-size: 36px;
  line-height: 44px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0;
  text-align: center;
}

/* =======================
   DELETE SAVE CONFIRMATION
   ======================= */

.delete-confirmation {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}

.delete-confirmation.delete-confirmation--active {
  display: flex;
}

.delete-confirmation__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1;
}

.delete-confirmation__modal {
  position: relative;
  width: 800px;
  background: rgba(22, 14, 14, 0.98);
  border: 2px solid var(--gold);
  border-radius: 30px;
  padding: 60px 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 50px;
  z-index: 2;
}

.delete-confirmation__title {
  font-weight: 700;
  font-size: 48px;
  color: var(--gold);
  letter-spacing: 0.48px;
  text-align: center;
  line-height: 1.3;
}

.delete-confirmation__buttons {
  display: flex;
  gap: 30px;
  width: 100%;
  justify-content: center;
}

.delete-confirmation__btn {
  position: relative;
  background: var(--bg-panel);
  border-radius: var(--radius-sm);
  padding: 20px 50px;
  transition: transform .2s ease, box-shadow .2s ease;
  user-select: none;
  min-width: 200px;
}

.delete-confirmation__btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  pointer-events: none;
  transition: border-color .2s ease;
}

.delete-confirmation__btn:hover {
  transform: scale(1.03);
}

.delete-confirmation__btn:hover::before {
  border-color: var(--gold);
}

.delete-confirmation__btn--confirm {
  background: rgba(192, 93, 93, 0.2);
}

.delete-confirmation__btn--confirm:hover {
  box-shadow: 0px 0px 15px 0px rgba(192, 93, 93, 0.4);
}

.delete-confirmation__btn--cancel:hover::before {
  border-color: rgba(192, 166, 93, 0.5);
}

.delete-confirmation__btn-text {
  font-weight: 700;
  font-size: 36px;
  color: var(--gold);
  letter-spacing: 0.36px;
  white-space: nowrap;
  text-align: center;
}


/* =======================
   ENDING
   ======================= */

.ending__title {
  position: absolute;
  left: 44px;
  top: 58px;
  font-weight: 700;
  font-size: 40px;
  color: var(--gold);
  letter-spacing: .4px;
}

.ending__panel {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 1920px;
  padding: 50px 44px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 60px;
  background: linear-gradient(
    -0.205842deg,
    rgba(22, 14, 14, 0.9) 41.476%,
    rgba(22, 14, 14, 0.804) 61.918%,
    rgba(22, 14, 14, 0.494) 83.407%,
    rgba(22, 14, 14, 0) 99.131%
  );
}

.ending__text {
  width: 100%;
  font-weight: 500;
  font-size: 40px;
  color: var(--white);
  letter-spacing: .4px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  white-space: pre-line;
}

.ending__btn {
  position: relative;
  background: var(--bg-panel);
  border-radius: var(--radius-sm);
  padding: 12px 40px;
  transition: transform .2s ease;
  user-select: none;
  margin-right: auto;
}
.ending__btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--gold);
  border-radius: var(--radius-sm);
  pointer-events: none;
}
.ending__btn:hover { transform: scale(1.02); }

.ending__btn-text {
  font-weight: 700;
  font-size: 36px;
  color: var(--gold);
  letter-spacing: .36px;
  white-space: nowrap;
}

#endingText {
  white-space: pre-line;
}

/* =======================
   NOTIFICATION (Toast)
   ======================= */

.notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(var(--scale));
  transform-origin: center center;
  
  width: 500px;
  height: 120px;
  background: rgba(22, 14, 14, 0.98);
  border: 2px solid var(--gold);
  border-radius: 20px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 30px 40px;
  
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  
  z-index: 9999;
  pointer-events: none;
  user-select: none;
  
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6),
              0 0 20px rgba(192, 166, 93, 0.3);
}

.notification--show {
  opacity: 1;
  visibility: visible;
  animation: notification-show 0.3s ease;
}

.notification__icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(192, 166, 93, 0.15);
  border-radius: 50%;
  animation: notification-icon-pulse 0.5s ease;
}

@keyframes notification-icon-pulse {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.notification__icon svg {
  width: 32px;
  height: 32px;
}

.notification__text {
  font-weight: 700;
  font-size: 36px;
  color: var(--gold);
  letter-spacing: 0.36px;
  white-space: nowrap;
}

@keyframes notification-show {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(var(--scale)) translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(var(--scale)) translateY(0);
  }
}

/* =======================
   CONFIRMATION MODAL
   ======================= */

.confirmation {
  position: absolute;
  inset: 0;
  z-index: 300;
  display: none;
}

.confirmation--active {
  display: flex;
}

.confirmation__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

.confirmation__modal {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 800px;
  background: rgba(22, 14, 14, 0.98);
  border: 2px solid var(--gold);
  border-radius: 30px;
  padding: 60px 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 50px;
  z-index: 1;
}

.confirmation__title {
  font-weight: 700;
  font-size: 48px;
  color: var(--gold);
  letter-spacing: 0.48px;
  text-align: center;
  line-height: 1.3;
}

.confirmation__buttons {
  display: flex;
  gap: 30px;
  width: 100%;
  justify-content: center;
}

.confirmation__btn {
  position: relative;
  background: var(--bg-panel);
  border-radius: var(--radius-sm);
  padding: 20px 50px;
  transition: transform .2s ease, box-shadow .2s ease;
  user-select: none;
  min-width: 200px;
}

.confirmation__btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  pointer-events: none;
  transition: border-color .2s ease;
}

.confirmation__btn:hover {
  transform: scale(1.03);
}

.confirmation__btn:hover::before {
  border-color: var(--gold);
}

.confirmation__btn--confirm {
  background: rgba(192, 166, 93, 0.15);
}

.confirmation__btn--confirm:hover {
  box-shadow: var(--shadow-gold);
}

.confirmation__btn--cancel:hover::before {
  border-color: rgba(192, 166, 93, 0.5);
}

.confirmation__btn-text {
  font-weight: 700;
  font-size: 36px;
  color: var(--gold);
  letter-spacing: 0.36px;
  white-space: nowrap;
  text-align: center;
}

/* =======================
   ENDINGS (БЕЗ ТЕНИ, ОБВОДКА ПРИ НАВЕДЕНИИ)
   ======================= */

.endings {
  position: relative;
  width: 1920px;
  height: 1080px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.endings__container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0px;
  gap: 45px;
  width: 1065px;
  height: 990px;
}

.endings__back {
  position: absolute;
  width: 48px;
  height: 48px;
  left: 40px;
  top: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform .2s ease;
  z-index: 10;
}

.endings__back:hover {
  transform: scale(1.1);
}

.endings__back::after {
  content: '';
  position: absolute;
  width: 32px;
  height: 4px;
  background: var(--gold);
  left: 8px;
  top: 22px;
}

.endings__back::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-left: 4px solid var(--gold);
  border-bottom: 4px solid var(--gold);
  transform: rotate(45deg);
  left: 4px;
  top: 16px;
}

.endings__grid {
  display: flex;
  flex-direction: column;
  gap: 45px;
  width: 100%;
}

.endings__row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  padding: 0px;
  gap: 60px;
  width: 1065px;
  height: 300px;
  flex: none;
  flex-grow: 0;
}

.ending-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px 15px;
  gap: 18.75px;
  width: 315px;
  height: 300px;
  background: rgba(22, 14, 14, 0.95);
  border-radius: 37.5px;
  transition: transform .2s ease, border-color .2s ease;
  position: relative;
  flex: none;
  flex-shrink: 0;
  flex-grow: 0;
  border: 2px solid transparent;
}

.ending-card--unlocked:hover {
  transform: scale(1.02);
  cursor: pointer;
  border-color: var(--gold);
}

.ending-card__preview {
  width: 285px;
  height: 213.75px;
  background: #0a0a0a;
  border-radius: 24px;
  overflow: hidden;
  flex: none;
  order: 0;
  align-self: stretch;
  flex-grow: 0;
}

.ending-card__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ending-card__lock-icon {
  width: 80px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  order: 0;
  flex-grow: 0;
}

.ending-card__lock-icon img {
  width: 80px;
  height: 100px;
  object-fit: contain;
}

.ending-card__title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0px;
  width: 193px;
  height: 37px;
  flex: none;
  order: 1;
  flex-grow: 0;
}

.ending-card__title {
  width: 193px;
  height: 37px;
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 700;
  font-size: 30px;
  line-height: 37px;
  letter-spacing: 0.01em;
  color: #C0A65D;
  text-align: center;
  text-shadow: 
    -3px -3px 0 #160e0e,
    3px -3px 0 #160e0e,
    -3px 3px 0 #160e0e,
    3px 3px 0 #160e0e;
  flex: none;
  order: 0;
  flex-grow: 0;
}

.endings__placeholder {
  font-weight: 500;
  font-size: 32px;
  color: var(--gold);
  opacity: 0.6;
  text-align: center;
  margin-top: 100px;
}

/* =======================
   SAVES - МОДАЛЬНОЕ ОКНО (ПОВЕРХ МЕНЮ)
   ======================= */

.view[data-view="saves"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 1920px;
  height: 1080px;
  z-index: 200;
  display: none;
}

.view[data-view="saves"].view--active {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
}

.saves {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.saves__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 1;
  cursor: pointer;
}

.saves__modal {
  position: relative;
  width: 1512px;
  height: 839px;
  background: rgba(22, 14, 14, 0.98);
  border: 2px solid var(--gold);
  border-radius: 30px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  z-index: 2;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8);
}

.saves__header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 70px;
  flex-shrink: 0;
}

.saves__title {
  font-weight: 700;
  font-size: 48.5455px;
  line-height: 59px;
  letter-spacing: 0.01em;
  color: var(--gold);
  flex: 1;
}

.saves__close {
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .3s ease, opacity .2s ease;
  padding: 0;
  flex-shrink: 0;
  opacity: 0.9;
}
.saves__close:hover {
  transform: rotate(90deg);
  opacity: 1;
}
.saves__close svg {
  width: 48px;
  height: 48px;
}

.saves__body {
  display: flex;
  flex-direction: row;
  gap: 0;
  width: 100%;
  height: 649px;
  flex-shrink: 0;
  justify-content: center;
  align-items: flex-start;
}

.saves__list {
  width: 1292px;
  height: 649px;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  grid-template-columns: repeat(2, 631px);
  grid-auto-rows: 200px;
  gap: 30px;
  align-content: start;
  justify-content: center;
  padding-right: 0;
  
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.saves__list::-webkit-scrollbar {
  display: none;
}

.save {
  width: 631px;
  height: 200px;
  background: #1a1212;
  border-radius: 30px;
  padding: 20px 22px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  transition: background .2s ease, border-color .2s ease;
  position: relative;
  text-align: left;
  box-sizing: border-box;
  border: 2px solid transparent;
}
.save:hover {
  background: #1e1414;
  border-color: var(--gold);
}

.save__preview {
  width: 220px;
  height: 156px;
  flex-shrink: 0;
  border-radius: 20px;
  overflow: hidden;
  background: #0a0a0a;
}
.save__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .25s ease;
}
.save:hover .save__preview img {
  transform: scale(1.05);
}

.save__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.save__slot-name {
  font-weight: 700;
  font-size: 32px;
  line-height: 39px;
  letter-spacing: 0.01em;
  color: var(--gold);
  margin: 0;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.save__details {
  font-weight: 500;
  font-size: 20px;
  line-height: 24px;
  letter-spacing: 0.01em;
  color: var(--gold);
  opacity: 0.85;
  margin: 0;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.save--new {
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 15px;
  padding: 0;
}

.save__icon {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .25s ease;
  flex-shrink: 0;
}
.save--new:hover .save__icon {
  transform: rotate(90deg) scale(1.1);
}
.save__icon svg {
  width: 50px;
  height: 50px;
}

.save__new-text {
  font-weight: 700;
  font-size: 36px;
  line-height: 44px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0;
  text-align: center;
}

/* =======================
   SAVES - МОДАЛЬНОЕ ОКНО (ПОВЕРХ МЕНЮ) - ФИНАЛЬНАЯ ВЕРСИЯ
   ======================= */

/* Меню всегда на заднем плане */
.view[data-view="menu"] {
  z-index: 1;
}

/* Остальные view выше меню */
.view[data-view="story"],
.view[data-view="endings"],
.view[data-view="game"],
.view[data-view="choice"],
.view[data-view="history"],
.view[data-view="ending"] {
  z-index: 100;
}

/* Сохранения - самый высокий приоритет */
.view[data-view="saves"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 1920px;
  height: 1080px;
  z-index: 200;
  display: none;
}

.view[data-view="saves"].view--active {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
}

.saves {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.saves__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 1;
  cursor: pointer;
}

.saves__modal {
  position: relative;
  width: 1512px;
  height: 839px;
  background: rgba(22, 14, 14, 0.98);
  border: 2px solid var(--gold);
  border-radius: 30px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  z-index: 2;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8);
}

.saves__header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 70px;
  flex-shrink: 0;
}

.saves__title {
  font-weight: 700;
  font-size: 48.5455px;
  line-height: 59px;
  letter-spacing: 0.01em;
  color: var(--gold);
  flex: 1;
}

.saves__close {
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .3s ease, opacity .2s ease;
  padding: 0;
  flex-shrink: 0;
  opacity: 0.9;
}
.saves__close:hover {
  transform: rotate(90deg);
  opacity: 1;
}
.saves__close svg {
  width: 48px;
  height: 48px;
}

.saves__body {
  display: flex;
  flex-direction: row;
  gap: 0;
  width: 100%;
  height: 649px;
  flex-shrink: 0;
  justify-content: center;
  align-items: flex-start;
}

.saves__list {
  width: 1292px;
  height: 649px;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  grid-template-columns: repeat(2, 631px);
  grid-auto-rows: 200px;
  gap: 30px;
  align-content: start;
  justify-content: center;
  padding-right: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.saves__list::-webkit-scrollbar {
  display: none;
}

.save {
  width: 631px;
  height: 200px;
  background: #1a1212;
  border-radius: 30px;
  padding: 20px 22px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  transition: background .2s ease, border-color .2s ease;
  position: relative;
  text-align: left;
  box-sizing: border-box;
  border: 2px solid transparent;
}
.save:hover {
  background: #1e1414;
  border-color: var(--gold);
}

.save__preview {
  width: 220px;
  height: 156px;
  flex-shrink: 0;
  border-radius: 20px;
  overflow: hidden;
  background: #0a0a0a;
}
.save__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .25s ease;
}
.save:hover .save__preview img {
  transform: scale(1.05);
}

.save__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.save__slot-name {
  font-weight: 700;
  font-size: 32px;
  line-height: 39px;
  letter-spacing: 0.01em;
  color: var(--gold);
  margin: 0;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.save__details {
  font-weight: 500;
  font-size: 20px;
  line-height: 24px;
  letter-spacing: 0.01em;
  color: var(--gold);
  opacity: 0.85;
  margin: 0;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.save--new {
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 15px;
  padding: 0;
}

.save__icon {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .25s ease;
  flex-shrink: 0;
}
.save--new:hover .save__icon {
  transform: rotate(90deg) scale(1.1);
}
.save__icon svg {
  width: 50px;
  height: 50px;
}

.save__new-text {
  font-weight: 700;
  font-size: 36px;
  line-height: 44px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0;
  text-align: center;
}

/* Меню всегда остаётся в DOM, но под другими view */
.view[data-view="menu"] {
  z-index: 1;
}

/* Когда сохранения активны, меню остаётся видимым */
.view[data-view="saves"].view--active {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
  z-index: 200;
}

/* Все остальные view выше меню, но ниже сохранений */
.view[data-view="story"],
.view[data-view="endings"],
.view[data-view="game"],
.view[data-view="choice"],
.view[data-view="history"],
.view[data-view="ending"] {
  z-index: 100;
}

/* Плавные переходы для персонажей */
.scene-char {
  opacity: 0;
  transition: opacity 0.6s ease-in-out, transform 0.6s ease-out;
  transform: translateY(20px) scale(0.95);
}

.scene-char--visible {
  opacity: 1 !important;
  transform: translateY(0) scale(1);
}

/* Задержки для каскадного эффекта */
.scene-char--left {
  transition-delay: 0s;
}

.scene-char--center {
  transition-delay: 0.15s;
}

.scene-char--right {
  transition-delay: 0.3s;
}

/* базовое положение */
.save__delete{
  top: 0;
  right: 0;
  transform: translate(-50%, 50%) scale(1);
  transition: transform .2s ease, background .2s ease, border-color .2s ease, opacity .2s ease;
}

/* только небольшое увеличение + без сдвига */
.save__delete:hover{
  transform: translate(-50%, 50%) scale(1.08);
  background: rgba(192, 166, 93, 0.2);
  border-color: var(--gold);
}

.scene-char--visible {
  opacity: 1;
}

/* =======================
   SCENE CHAR CROSS-FADE (2 img per slot)
   ======================= */

/* Контейнер позиции (left/center/right) остаётся как у тебя.
   ВАЖНО: убери/переопредели старое `display: none` у .scene-char,
   иначе анимация будет часто "снапаться". */
.scene-char {
  display: block; /* переопределяем твой старый display:none */
  opacity: 1;
}

/* Два слоя-картинки внутри позиции */
.scene-char__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;

  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.6s ease-in-out, transform 0.6s ease-out; /* плавный переход свойств */
  will-change: opacity, transform;
}

/* Когда слой активен */
.scene-char__img.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Если src пустой — не рисуем img, чтобы не ловить "битые" иконки */
.scene-char__img:not([src]),
.scene-char__img[src=""] {
  display: none;
}

/* плавное исчезновение слота перед удалением */
.save-wrapper {
  transition: opacity .2s ease, transform .2s ease;
}

.save-wrapper--removing {
  opacity: 0;
  transform: scale(0.97);
  pointer-events: none;
}

.saves__list {
  grid-auto-flow: dense;
}

/* =======================
   STORY CARDS (with play button)
   ======================= */

.story__cards {
  position: absolute;
  left: 50%;
  top: calc(50% + 88px);
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 51px;
  width: calc(420px * 3 + 51px * 2);
}

.story-card {
  position: relative;
  width: 420px;
  height: 400px;
  flex: 0 0 420px;
  border-radius: var(--radius-xl);
  overflow: visible;
  transition: transform .2s ease, filter .2s ease;
  text-align: left;
}

.story-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg-panel);
  border-radius: var(--radius-xl);
  z-index: 0;
  border: 2px solid transparent;
  transition: border-color .2s ease;
}

.story-card:hover {
  transform: scale(1.01);
}

.story-card:hover::before,
.story-card:focus-visible::before {
  border-color: var(--gold);
}

.story-card__image {
  position: absolute;
  left: 48px;
  top: -160px;
  width: 332px;
  height: 560px;
  z-index: 2;
  pointer-events: none;
  user-select: none;
  clip-path: inset(0 0 160px 0);
}

.story-card__image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 50% 100%;
}

/* ПАНЕЛЬ ИНФО (увеличили высоту, добавили место под кнопку) */
.story-card__info,
.story-card__lock {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 270px; /* было 235px */
  background: linear-gradient(
    to bottom,
    rgba(22, 14, 14, 0) 0%,
    rgba(22, 14, 14, 0.95) 28.365%,
    rgba(22, 14, 14, 1) 77.404%
  );
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 30px 20px; /* было 40px 20px */
  gap: 16px;          /* было 25px */
  z-index: 3;
}

.story-card__text {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 4;
}

.story-card__name {
  font-weight: 700;
  font-size: 40px;
  color: var(--color-mio);
  letter-spacing: .4px;
  white-space: nowrap;
}

.story-card[data-story="aya"] .story-card__name { color: var(--color-aya); }
.story-card[data-story="kira"] .story-card__name { color: var(--color-kira); }

.story-card__subtitle {
  font-weight: 700;
  font-size: 20px;
  color: var(--gold);
  letter-spacing: .2px;
  white-space: nowrap;
}

.story-card__progress {
  width: 380px;
  height: 30px;
  background: #160e0e;
  border: 1px solid var(--gold);
  border-radius: 40px;
  overflow: hidden;
  position: relative;
  z-index: 4;
}

.story-card__progress-bar {
  height: 100%;
  width: 0%;
  background: var(--gold);
  border-radius: 56px;
}

/* КНОПКА "ПРОДОЛЖИТЬ" ВНУТРИ КАРТОЧКИ */
.story-card__play {
  width: 320px;
  height: 58px;
  background: var(--bg-panel);
  border-radius: 14px;
  position: relative;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
  z-index: 4;
}

.story-card__play::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-radius: 14px;
  pointer-events: none;
  transition: border-color .18s ease;
}

.story-card__play-text {
  font-weight: 700;
  font-size: 26px;
  color: var(--gold);
  letter-spacing: .2px;
  white-space: nowrap;
}

.story-card__play:hover,
.story-card__play:focus-visible {
  transform: scale(1.03);
  box-shadow: var(--shadow-gold);
}

.story-card__play:hover::before,
.story-card__play:focus-visible::before {
  border-color: var(--gold);
}

.story-card__play:active {
  transform: scale(0.99);
  background: var(--bg-panel-strong);
}

/* LOCK overlay */
.story-card__lock[hidden] { display: none !important; }
.story-card__lock { display: flex; align-items: center; justify-content: center; }
.story-card__lock img { width: 115px; height: 115px; object-fit: contain; }

/* ЗАЛОЧЕННАЯ КАРТОЧКА:
   - оставляем прогресс и инфо видимыми (если хочешь)
   - прячем кнопку "Продолжить"
   - показываем замок */
.story-card--locked {
  cursor: not-allowed;
  filter: grayscale(0.15) brightness(0.9);
}

.story-card--locked:hover { transform: none; }
.story-card--locked:hover::before { border-color: transparent; }

/* ВАЖНО: раньше ты скрывал .story-card__info — теперь НЕ скрываем */
.story-card--locked .story-card__play {
  display: none;
}

.story-card--locked .story-card__lock {
  display: flex;
}

/* =======================
   NO-SHADOW HOVER PATCH
   (keep only gold outline)
   Place at END of styles.css
   ======================= */

/* 1) MENU buttons */
.menu__btn:hover,
.menu__btn:focus-visible {
  box-shadow: none;
}

/* 2) Back buttons / small buttons where you used shadow on focus */
.story__back:focus-visible {
  box-shadow: none;
}

/* 3) Controls buttons (если где-то добавлялась тень — выключаем глобально) */
.controls__btn:hover,
.controls__btn:focus-visible {
  box-shadow: none;
}

/* 4) Card-level hover: оставляем обводку (у тебя она через .story-card::before) */
.story-card:hover::before,
.story-card:focus-visible::before {
  border-color: var(--gold);
}

/* 5) Play button inside cards */
.story-card__play:hover,
.story-card__play:focus-visible {
  box-shadow: none;
}
.story-card__play:hover::before,
.story-card__play:focus-visible::before {
  border-color: var(--gold);
}

/* 6) Choice option: убрать тень и добавить обводку */
.choice__option:hover {
  box-shadow: none;
}

.choice__option:hover::before {
  content: '';
  position: absolute;
  inset: -2px;
  border: 2px solid var(--gold);
  border-radius: 12px;
  pointer-events: none;
}

/* 7) Generic modal buttons (confirmation / delete-confirmation / ending) */
.confirmation__btn:hover,
.confirmation__btn:focus-visible,
.delete-confirmation__btn:hover,
.delete-confirmation__btn:focus-visible,
.ending__btn:hover,
.ending__btn:focus-visible {
  box-shadow: none;
}

/* (Опционально) если хочешь везде только outline-рамку на hover,
   можно добавить обводку на этих кнопках тоже: */
.confirmation__btn:hover::before,
.confirmation__btn:focus-visible::before,
.delete-confirmation__btn:hover::before,
.delete-confirmation__btn:focus-visible::before {
  border-color: var(--gold);
}

/* 8) Saves карточки: убрать тень (если появится) и оставить обводку */
.save:hover {
  box-shadow: none;
}

/* (У save уже есть border-color на hover) */

/* =======================
   STORY CARD PLAY: fill 25%
   ======================= */

/* убираем обводку и делаем заливку */
.story-card__play::before {
  border-color: transparent !important; /* на hover не рисуем рамку */
}

/* базовое состояние */
.story-card__play {
  background: rgba(192, 166, 93, 0.25) !important; /* gold @ 25% */
  box-shadow: none !important;
}

/* hover/focus: можно чуть усилить заливку, но без обводки */
.story-card__play:hover,
.story-card__play:focus-visible {
  background: rgba(192, 166, 93, 0.25) !important; /* оставить ровно 0.25 как просили */
  box-shadow: none !important;
}

/* active: можно слегка плотнее, если надо (если нет — удали этот блок) */
.story-card__play:active {
  background: rgba(192, 166, 93, 0.35) !important;
}

/* Общая стрелка "назад" для всех экранов */
.view__back,
.endings__back {
  width: 64px;
  height: 64px;
  border: 0;
  background-color: transparent;

  /* путь поставь тот же, что у твоей стрелки в концовках */
  background-image: url("./assets/ui/back_arrow.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;

  cursor: pointer;
}

/* Единый стиль стрелки "назад" для всех экранов */
.endings__back,
.view__back {
  position: absolute;
  width: 48px;
  height: 48px;
  left: 40px;
  top: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform .2s ease;
  z-index: 10;
}

.endings__back:hover,
.view__back:hover {
  transform: scale(1.1);
}

.endings__back::after,
.view__back::after {
  content: '';
  position: absolute;
  width: 32px;
  height: 4px;
  background: var(--gold);
  left: 8px;
  top: 22px;
}

.endings__back::before,
.view__back::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-left: 4px solid var(--gold);
  border-bottom: 4px solid var(--gold);
  transform: rotate(45deg);
  left: 4px;
  top: 16px;
}

.endings__back,
.story__back {
  position: absolute;
  width: 48px;
  height: 48px;
  left: 40px;
  top: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform .2s ease;
  z-index: 10;
}

.endings__back:hover,
.story__back:hover {
  transform: scale(1.1);
}

.endings__back::after,
.story__back::after {
  content: '';
  position: absolute;
  width: 32px;
  height: 4px;
  background: var(--gold);
  left: 8px;
  top: 22px;
}

.endings__back::before,
.story__back::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-left: 4px solid var(--gold);
  border-bottom: 4px solid var(--gold);
  transform: rotate(45deg);
  left: 4px;
  top: 16px;
}

/* 1. Отключаем выделение текста во всем приложении */
body {
  -webkit-user-select: none; /* Chrome, Safari, Opera */
  -moz-user-select: none;    /* Firefox */
  -ms-user-select: none;     /* IE 10+ */
  user-select: none;         /* Стандарт */
}

/* 2. Отключаем перетаскивание картинок мышкой */
img {
  -webkit-user-drag: none;
  user-drag: none;
}
/* =========================
   FIX: Saves text is black
   (support JS legacy classnames)
   Paste at end of styles.css
   ========================= */

/* old -> new mappings (preview/info/text) */
.savepreview { 
  width: 220px;
  height: 156px;
  flex-shrink: 0;
  border-radius: 20px;
  overflow: hidden;
  background: #0a0a0a;
}
.savepreview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.saveinfo {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.saveslot-name {
  font-weight: 700;
  font-size: 32px;
  line-height: 39px;
  letter-spacing: 0.01em;
  color: var(--gold);
  margin: 0;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.savedetails {
  font-weight: 500;
  font-size: 20px;
  line-height: 24px;
  letter-spacing: 0.01em;
  color: var(--gold);
  opacity: 0.85;
  margin: 0;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* delete button: old classname from JS */
.savedelete {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  background: rgba(192, 166, 93, 0.1);
  border: 2px solid transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s ease, background .2s ease, border-color .2s ease, transform .2s ease;
  z-index: 10;
}

.save-wrapper:hover .savedelete {
  opacity: 1;
}

.savedelete:hover {
  background: rgba(192, 166, 93, 0.2);
  border-color: var(--gold);
  transform: scale(1.1);
}

.savedelete svg {
  width: 20px;
  height: 20px;
}

/* =========================
   FIX: Endings text color
   ========================= */

.ending-cardtitle,
.ending-card__title,
.ending-title,
.endings-title {
  color: var(--gold) !important;
}

/* если под замками есть подписи/лейблы */
.ending-card,
.ending-card * {
  color: inherit;
}

/* =========================
   Endings: 3x3 grid layout
   ========================= */

.endingsgrid {
  display: grid !important;
  grid-template-columns: repeat(3, 315px);
  grid-auto-rows: 300px;
  gap: 60px;
  justify-content: center;
  align-content: start;
}

/* JS сейчас создаёт .endingsrow — чтобы не ломало сетку, “обнулим” ряд */
.endingsrow {
  display: contents !important;
}

/* ==== CHOICE final fix ==== */

/* Панель и заголовок */
.choicepanel {
  position: absolute;
  left: 410px;
  top: 192px;
  width: 1112px;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.choicetitle {
  font-weight: 700;
  font-size: 48px;
  color: var(--gold);
  letter-spacing: .48px;
  text-transform: uppercase;
}

/* Опции */
.choiceoption {
  position: relative;
  background: var(--bg-panel);
  border-radius: var(--radius-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 25px;
  transition: transform .2s ease, box-shadow .2s ease;
  margin-bottom: 25px;
}

.choiceoption:hover {
  transform: translateX(5px);
  box-shadow: var(--shadow-gold);
}

/* Рамка выбранной опции */
.choiceoption--selected::before {
  content: '';
  position: absolute;
  inset: -2px;
  border: 2px solid var(--gold);
  border-radius: 12px;
  pointer-events: none;
}

/* Заголовок опции */
.choiceoption-title {
  font-weight: 500;
  font-style: italic;
  font-size: 36px;
  color: var(--gold);
  letter-spacing: .36px;
  white-space: nowrap;
}

/* Текст опции + вертикальная полоска */
.choiceoption-text {
  font-weight: 700;
  font-size: 36px;
  color: var(--white);
  letter-spacing: .36px;
  display: flex;
  align-items: stretch;
  gap: 10px;
  position: relative;
  padding-left: 20px;
}

.choiceoption-text::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--white);
  border-radius: 2px;
}

/* Убираем старую полоску-спан, растягиваем текст */
.choiceoption-text span:first-child[aria-hidden="true"] {
  display: none;
}

.choiceoption-text span:last-child {
  flex: 1;
  line-height: 1.3;
}

.choiceoption:hover {
  transform: translateX(5px);
  box-shadow: none;              /* убираем тень */
}

.choiceoption:hover::before {
  content: '';
  position: absolute;
  inset: -2px;
  border: 2px solid var(--gold); /* обводка при ховере */
  border-radius: 12px;
  pointer-events: none;
}

/* =======================
   STORY CARD IMAGES (UNIFIED)
   ======================= */

/* Базовый контейнер картинки */
.story-card__image {
  /* Размеры контейнера должны быть фиксированы (они у тебя уже есть выше) */
  /* width: 332px; height: 560px; ... */
  display: flex;
  align-items: flex-end; /* Прижимаем к низу */
  justify-content: center; /* Центрируем */
}

/* Сама картинка - ОБЩИЙ СТИЛЬ для обоих состояний */
.story-card__image img {
  width: 100%;
  height: 100%;
  
  /* contain = вписать картинку целиком, не обрезая */
  object-fit: contain; 
  
  /* 50% 100% = Центр по горизонтали, Низ по вертикали */
  object-position: 50% 100%; 
  
  /* Сбрасываем любые трансформации */
  transform: none !important; 
  transition: transform 0.25s ease; /* Только если хочешь эффект при наведении */
}

/* Эффект при наведении на КАРТОЧКУ (опционально) */
.story-card:hover .story-card__image img {
  /* Легкое увеличение одинаково для обоих */
  transform: scale(1.02) !important; 
}

/* styles.css */

/* Магия: превращаем обычную картинку в силуэт, если есть класс --locked */
.story-card--locked .story-card__image img {
  /* Делает картинку полностью черной */
  filter: brightness(0) opacity(0.7); 
  
  /* opacity(0.7) - чтобы силуэт был чуть полупрозрачным (серым), как на вашем макете.
     Если нужен угольно-черный, уберите opacity или поставьте 1. */
}
/* =======================
   SILHOUETTE COLOR FIX
   ======================= */

.story-card--locked .story-card__image img {
  /* 1. Сдвигаем оригинальную картинку далеко влево (за экран) */
  transform: translateX(-5000px);
  
  /* 2. Отбрасываем тень обратно на место картинки.
     Тень повторяет форму альфа-канала и принимает нужный цвет. */
  filter: drop-shadow(5000px 0 0 #170D0E);
  
  /* Опционально: Если силуэт кажется слишком резким по краям */
  /* opacity: 1; */
}

/* =======================
   SILHOUETTE COLOR FIX (ONLY COLOR, NO SIZE CHANGE)
   ======================= */

.story-card--locked .story-card__image img {
  /* Сбрасываем любые трансформации, чтобы размер был как у оригинала */
  transform: none !important;
  
  /* Красим в нужный цвет */
  /* Сдвигаем оригинал далеко влево (-5000px) и отбрасываем цветную тень обратно */
  filter: drop-shadow(5000px 0 0 #170D0E);
  transform: translateX(-5000px); 
}

.story-card__image {
  position: absolute;
  left: 48px;
  top: -160px;
  width: 332px;
  height: 560px;
  z-index: 2;
  pointer-events: none;
  user-select: none;
  clip-path: inset(0 0 160px 0);

  /* === ВОТ ЭТУ СТРОКУ НАДО ДОБАВИТЬ === */

}

/* ==== ENDINGS final fix ==== */

.endings {
  position: relative;
  width: 1920px;
  height: 1080px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.endingscontainer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0;
  gap: 45px;
  width: 1065px;
  height: 990px;
}

/* Кнопка "назад" */
.endingsback {
  position: absolute;
  width: 48px;
  height: 48px;
  left: 40px;
  top: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform .2s ease;
  z-index: 10;
}

.endingsback:hover {
  transform: scale(1.1);
}

.endingsback::after {
  content: '';
  position: absolute;
  width: 32px;
  height: 4px;
  background: var(--gold);
  left: 8px;
  top: 22px;
}

.endingsback::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-left: 4px solid var(--gold);
  border-bottom: 4px solid var(--gold);
  transform: rotate(45deg);
  left: 4px;
  top: 16px;
}

/* Сетка концовок 3x3 */
.endingsgrid {
  display: grid !important;
  grid-template-columns: repeat(3, 315px);
  grid-auto-rows: 300px;
  gap: 60px;
  justify-content: center;
  align-content: start;
  width: 100%;
}

.endingsrow {
  display: contents !important;
}

/* Карточка концовки */
.ending-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px 15px;
  gap: 18.75px;
  width: 315px;
  height: 300px;
  background: rgba(22, 14, 14, 0.95);
  border-radius: 37.5px;
  border: 2px solid transparent;
  position: relative;
  transition: transform .2s ease, border-color .2s ease;
}

.ending-card--unlocked:hover {
  transform: scale(1.02);
  cursor: pointer;
  border-color: var(--gold);
}

/* Превью / замочек */
.ending-cardpreview {
  width: 285px;
  height: 213.75px;
  background: #0a0a0a;
  border-radius: 24px;
  overflow: hidden;
  flex: none;
  align-self: stretch;
}

.ending-cardpreview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ending-cardlock-icon {
  width: 80px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.ending-cardlock-icon img {
  width: 80px;
  height: 100px;
  object-fit: contain;
}

/* Заголовок концовки */
.ending-cardtitle-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 193px;
  height: 37px;
  flex: none;
}

.ending-cardtitle {
  width: 193px;
  height: 37px;
  font-family: Montserrat, sans-serif;
  font-style: normal;
  font-weight: 700;
  font-size: 30px;
  line-height: 37px;
  letter-spacing: 0.01em;
  color: #C0A65D;
  text-align: center;
  text-shadow:
    -3px -3px 0 #160e0e,
     3px -3px 0 #160e0e,
    -3px  3px 0 #160e0e,
     3px  3px 0 #160e0e;
}

/* Текст-заглушка, когда нет концовок */
.endingsplaceholder {
  font-weight: 500;
  font-size: 32px;
  color: var(--gold);
  opacity: 0.6;
  text-align: center;
  margin-top: 100px;
}

/* ==== ENDINGS layout: 9 cards (3x3) ==== */
.endingsgrid {
  display: flex !important;
  flex-direction: column !important;
  gap: 45px !important;
  width: 100% !important;
}

.endingsrow {
  display: flex !important;
  flex-direction: row !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 60px !important;
  width: 100% !important;
  height: 300px !important;
}

/* ==== Ending titles: чёрная обводка ==== */
.ending-cardtitle {
  font-weight: 700;
  font-size: 30px;
  line-height: 37px;
  letter-spacing: 0.01em;
  color: var(--gold);
  text-align: center;
  text-shadow:
    -3px -3px 0 #160e0e,
     3px -3px 0 #160e0e,
    -3px  3px 0 #160e0e,
     3px  3px 0 #160e0e,
    -2px  0px 0 #160e0e,
     2px  0px 0 #160e0e,
     0px -2px 0 #160e0e,
     0px  2px 0 #160e0e,
     0 0 10px rgba(0,0,0,0.5);
}

/* --- BEM compatibility (keep HTML as-is) --- */

/* BG */
.game__bg { 
  position: absolute;
  top: 0; left: 0;
  width: 1955px; height: 1955px;
  transform: translate(-12px, -699px);
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  z-index: 1;
}

/* Dialog structure */
.dialog__layout { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.dialog__text { width: 1139px; display: flex; flex-direction: column; gap: 15px; }

.dialog__name { 
  font-weight: 700;
  font-size: 40px;
  letter-spacing: .4px;
  text-shadow: -2px -2px 0 #160e0e, 2px -2px 0 #160e0e, -2px 2px 0 #160e0e, 2px 2px 0 #160e0e,
               0px -2px 0 #160e0e, 0px 2px 0 #160e0e, -2px 0px 0 #160e0e, 2px 0px 0 #160e0e,
               0 0 10px rgba(0,0,0,.5);
}
.dialog__verse { font-weight: 400; font-size: 40px; color: var(--white); letter-spacing: .4px; }
.dialog__aside { font-weight: 300; font-style: italic; font-size: 40px; color: var(--white); letter-spacing: .4px; }

/* Color modifiers should apply to BOTH */
.dialogname--mio { color: var(--color-mio); }
.dialogname--aya { color: var(--color-aya); }
.dialogname--kira { color: var(--color-kira); }
.dialogname--host { color: var(--color-host); }
.dialogname--player { color: var(--color-player); }

/* Controls BEM */
.controls__btn { 
  background: var(--bg-panel);
  border-radius: var(--radius-sm);
  height: 50px;
  width: 192px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
  transition: transform .2s ease;
  position: relative;
}
.controls__btn:hover { transform: scale(1.05); }

.controls__icon { width: 24px; height: 24px; flex-shrink: 0; object-fit: contain; }
.controls__btn-text { font-weight: 700; font-size: 20px; color: var(--gold); letter-spacing: .2px; white-space: nowrap; }

/* Smooth show/hide for character slot container */
.scene-char {
  display: block;              /* важно: не через display:none */
  opacity: 0;
  transform: translateY(20px) scale(0.98);
  transition: opacity 0.45s ease, transform 0.45s ease;
  pointer-events: none;
}

.scene-char.is-on {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Ending screen: ensure title is above background image */
.view[data-view="ending"] .ending__bg { z-index: 0; }
.view[data-view="ending"] .ending__title { 
  z-index: 2;
  text-shadow:
    -2px -2px 0 #160e0e,
     2px -2px 0 #160e0e,
    -2px  2px 0 #160e0e,
     2px  2px 0 #160e0e,
    -2px  0px 0 #160e0e,
     2px  0px 0 #160e0e,
     0px -2px 0 #160e0e,
     0px  2px 0 #160e0e,
     0 0 10px rgba(0,0,0,0.5);
}

/* Ending screen: ensure title is above background image */
.view[data-view="ending"] .ending__bg { z-index: 0; }
.view[data-view="ending"] .ending__title {
  z-index: 2;
  text-shadow:
    -1px -1px 0 #160e0e,
     1px -1px 0 #160e0e,
    -1px  1px 0 #160e0e,
     1px  1px 0 #160e0e,
    -1px  0px 0 #160e0e,
     1px  0px 0 #160e0e,
     0px -1px 0 #160e0e,
     0px  1px 0 #160e0e,
     0 0 6px rgba(0,0,0,0.45);
}

.scene-char.is-dim {
  filter: brightness(0.55) saturate(0.75);
  transition: filter 180ms ease;
}

.scene-char.is-focus {
  filter: brightness(1) saturate(1);
  transition: filter 180ms ease;
}

/* Плавность для всех состояний */
.scene-char {
  transition: filter 220ms ease, transform 220ms ease, opacity 220ms ease;
  will-change: filter, transform, opacity;
}

/* Неактивные: мягко затемнить и чуть убрать “живость” */
.scene-char.is-dim {
  filter: brightness(0.45) saturate(0.55) contrast(0.95) blur(0.2px);
  opacity: 0.85;
  transform: scale(0.995);
}

/* Активный: выделение + лёгкий “поп” */
.scene-char.is-focus {
  filter: brightness(1.06) saturate(1.18) contrast(1.06)
          drop-shadow(0 0 18px rgba(255, 220, 120, 0.35))
          drop-shadow(0 0 6px rgba(255, 255, 255, 0.18));
  opacity: 1;
  transform: scale(1.01);
}

/* Если вдруг ни у кого нет фокуса — сброс (опционально) */
.scene-char:not(.is-focus):not(.is-dim) {
  filter: none;
  opacity: 1;
  transform: none;
}

/* === PATCH: active speaker highlight + name colors fix (paste at end) === */

/* 1) Ensure dialog name color modifiers always win */
.view[data-view="game"] .dialog .dialogname.dialogname--mio,
.view[data-view="choice"] .dialog .dialogname.dialogname--mio { color: var(--color-mio) !important; }

.view[data-view="game"] .dialog .dialogname.dialogname--aya,
.view[data-view="choice"] .dialog .dialogname.dialogname--aya { color: var(--color-aya) !important; }

.view[data-view="game"] .dialog .dialogname.dialogname--kira,
.view[data-view="choice"] .dialog .dialogname.dialogname--kira { color: var(--color-kira) !important; }

.view[data-view="game"] .dialog .dialogname.dialogname--host,
.view[data-view="choice"] .dialog .dialogname.dialogname--host { color: var(--color-host) !important; }

.view[data-view="game"] .dialog .dialogname.dialogname--player,
.view[data-view="choice"] .dialog .dialogname.dialogname--player { color: var(--color-player) !important; }

/* Optional: slightly stronger readability for colored names */
.view[data-view="game"] .dialog .dialogname,
.view[data-view="choice"] .dialog .dialogname {
  text-shadow:
    -2px -2px 0 #160e0e,
    2px -2px 0 #160e0e,
    -2px 2px 0 #160e0e,
    2px 2px 0 #160e0e,
    0 0 14px rgba(0,0,0,0.55);
}

/* 2) Active speaker highlight on stage (uses classes your JS already toggles) */
:root{
  --focus-glow: rgba(192, 166, 93, 0.35);
  --focus-glow-2: rgba(255, 255, 255, 0.16);
  --dim-amount: 0.45;
}

/* Smooth transitions */
.scene-char,
.scene-charimg{
  will-change: filter, transform, opacity;
}

/* Dim non-speaking characters */
.scene-char.is-dim{
  filter: brightness(var(--dim-amount)) saturate(0.65) contrast(0.95) blur(0.2px);
  opacity: 0.82;
  transform: translateY(0) scale(0.995);
  transition: filter 200ms ease, transform 200ms ease, opacity 200ms ease;
}

/* Highlight speaking character */
.scene-char.is-focus{
  filter:
    brightness(1.08) saturate(1.22) contrast(1.06)
    drop-shadow(0 0 22px var(--focus-glow))
    drop-shadow(0 0 8px var(--focus-glow-2));
  opacity: 1;
  transform: translateY(-2px) scale(1.01);
  transition: filter 200ms ease, transform 200ms ease, opacity 200ms ease;
}

/* 3) Small “speaking” accent line in dialog (no JS changes, based on name class) */
.view[data-view="game"] .dialog .dialogname::after,
.view[data-view="choice"] .dialog .dialogname::after{
  content: "";
  display: block;
  width: 180px;
  height: 4px;
  margin-top: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  box-shadow: 0 0 18px rgba(0,0,0,0.25);
}

.view[data-view="game"] .dialog .dialogname--mio::after,
.view[data-view="choice"] .dialog .dialogname--mio::after{ background: color-mix(in srgb, var(--color-mio) 65%, transparent); }

.view[data-view="game"] .dialog .dialogname--aya::after,
.view[data-view="choice"] .dialog .dialogname--aya::after{ background: color-mix(in srgb, var(--color-aya) 65%, transparent); }

.view[data-view="game"] .dialog .dialogname--kira::after,
.view[data-view="choice"] .dialog .dialogname--kira::after{ background: color-mix(in srgb, var(--color-kira) 65%, transparent); }

.view[data-view="game"] .dialog .dialogname--host::after,
.view[data-view="choice"] .dialog .dialogname--host::after{ background: rgba(223,223,223,0.35); }

.view[data-view="game"] .dialog .dialogname--player::after,
.view[data-view="choice"] .dialog .dialogname--player::after{ background: rgba(255,255,255,0.25); }

/* Fallback if color-mix unsupported */
@supports not (background: color-mix(in srgb, #fff 50%, transparent)) {
  .view[data-view="game"] .dialog .dialogname--mio::after,
  .view[data-view="choice"] .dialog .dialogname--mio::after { background: rgba(225,155,156,0.35); }

  .view[data-view="game"] .dialog .dialogname--aya::after,
  .view[data-view="choice"] .dialog .dialogname--aya::after { background: rgba(105,61,105,0.35); }

  .view[data-view="game"] .dialog .dialogname--kira::after,
  .view[data-view="choice"] .dialog .dialogname--kira::after { background: rgba(192,83,11,0.35); }
}

/* FIX: ending background is black */
.view[data-view="ending"] {
  background: transparent !important;
}

.view[data-view="ending"] .endingbg,
.viewdata-viewending .endingbg {
  display: block !important;         /* если JS по ошибке оставил none */
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: 50% 50% !important;
  z-index: 0 !important;
}

/* UI поверх картинки */
.view[data-view="ending"] .endingtitle,
.view[data-view="ending"] .endingpanel,
.viewdata-viewending .endingtitle,
.viewdata-viewending .endingpanel {
  position: relative;
  z-index: 2;
}

/* на всякий случай: если фейд перекрывает */
#fadeOverlay {
  z-index: 9998; /* как у тебя, но если вдруг перекрывает — снизь до 50 */
}

.view[data-view="ending"] { position: absolute; inset: 0; }
.view[data-view="ending"] .endingbg { z-index: 1 !important; }
.view[data-view="ending"] .endingpanel,
.view[data-view="ending"] .endingtitle { z-index: 2 !important; position: relative; }
#fadeOverlay { opacity: 0 !important; pointer-events: none !important; }

/* Закреплённая диалоговая панель (имя + реплика + aside) */
.view[data-view="game"] .dialog,
.view[data-view="choice"] .dialog {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 1920px;
  height: 439px;
  background: linear-gradient(
    -0.147896deg,
    rgba(22, 14, 14, 0.9) 41.476%,
    rgba(22, 14, 14, 0.804) 61.918%,
    rgba(22, 14, 14, 0.494) 79.214%,
    rgba(22, 14, 14, 0) 97.035%
  );
  padding: 24px 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  z-index: 100;
}

/* На остальных экранах диалоговая панель скрыта */
.view:not([data-view="game"]):not([data-view="choice"]) .dialog {
  display: none !important;
}

/* Music muted state (опционально) */
.controls__btn[data-action="toggle-music"].controls__btn--active {
  background: rgba(192, 93, 93, 0.18);
}

/* =======================
   GLOBAL MUSIC TOGGLE
   ======================= */

.music-toggle{
  position: absolute;
  top: 26px;
  right: 26px;

  width: 64px;
  height: 64px;

  display: grid;
  place-items: center;

  border-radius: 999px;
  background: var(--bg-panel);

  z-index: 9999; /* поверх всех view и модалок */
  transition: transform .18s ease, background-color .18s ease;
}

.music-toggle:hover{
  transform: scale(1.06);
}

.music-toggle:active{
  transform: scale(0.98);
}

.music-toggle:focus-visible{
  outline: none;
}

/* золотая обводка как у твоих кнопок */
.music-toggle::before{
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-radius: 999px;
  pointer-events: none;
  transition: border-color .18s ease;
}

.music-toggle:hover::before,
.music-toggle:focus-visible::before{
  border-color: var(--gold);
}

/* иконки внутри */
.music-toggle__icon{
  width: 32px;
  height: 32px;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

/* Переключение: показываем нужную картинку */
.music-toggle--muted .music-toggle__icon--on{ display: none; }
.music-toggle:not(.music-toggle--muted) .music-toggle__icon--off{ display: none; }

/* (опционально) слегка меняем фон в muted */
.music-toggle--muted{
  background: rgba(22, 14, 14, 0.95);
}

.music-toggle{
  position: absolute;
  top: 26px;
  right: 18px;

  width: 64px;
  height: 64px;

  display: grid;
  place-items: center;

  border-radius: 18px;
  background: var(--bg-panel);

  z-index: 9999;
  transition: transform .18s ease, background-color .18s ease;
}

.music-toggle:hover{ transform: scale(1.06); }
.music-toggle:active{ transform: scale(0.98); }
.music-toggle:focus-visible{ outline: none; }

.music-toggle::before{
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-radius: 18px;
  pointer-events: none;
  transition: border-color .18s ease;
}

.music-toggle:hover::before,
.music-toggle:focus-visible::before{
  border-color: var(--gold);
}

.music-toggle__svg{
  width: 32px;
  height: 32px;
  color: var(--gold); /* currentColor */
  pointer-events: none;
  user-select: none;
}

/* зачёркивание только в muted */
.music-toggle::after{
  content: "";
  position: absolute;
  width: 46px;
  height: 4px;
  background: var(--gold);
  border-radius: 999px;
  transform: rotate(-35deg);
  opacity: 0;
  transition: opacity .18s ease;
  pointer-events: none;
}

.music-toggle--muted::after{ opacity: 1; }

.music-toggle{
  right: 44px; /* как padding справа у нижней панели */
}

.music-toggle{
  opacity: 0.75;
}
.music-toggle:hover{
  opacity: 0.92;
}

/* контейнер выбора на весь экран */
.view[data-view="choice"] .choice{
  position: absolute;
  inset: 0;
}

/* затемнение */
.view[data-view="choice"] .choice__overlay{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
}

/* ПАНЕЛЬ: центр по горизонтали и вертикали */
.view[data-view="choice"] .choice__panel{
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;

  /* необязательно, но удобно */
  max-width: min(1100px, 92vw);
  width: 92vw;
}

/* =========================
   HISTORY MODAL — styles
   ========================= */

:root{
  --hist-bg: rgba(10, 10, 14, 0.86);
  --hist-panel: rgba(18, 18, 26, 0.92);
  --hist-border: rgba(255, 255, 255, 0.08);
  --hist-text: rgba(255, 255, 255, 0.92);
  --hist-muted: rgba(255, 255, 255, 0.68);

  --hist-accent: #C0A65D; /* твой золотой */
  --hist-shadow: 0 18px 60px rgba(0,0,0,0.55);

  --name-player: #D6D6D6;
  --name-host: #C0A65D;
  --name-mio: #FF86B3;
  --name-aya: #7ED3FF;
  --name-kira: #BCA7FF;

  --hist-radius: 18px;
  --hist-pad: 18px;
}

/* весь экран для history view */
.view[data-view="history"]{
  position: absolute;
  inset: 0;
}

/* затемнение */
.view[data-view="history"] .history__overlay{
  position: absolute;
  inset: 0;
  background: var(--hist-bg);
  backdrop-filter: blur(6px);
}

/* само окно */
.view[data-view="history"] .history__modal{
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);

  width: min(1100px, 92vw);
  height: min(720px, 86vh);

  background: linear-gradient(180deg, rgba(30,30,44,0.92), rgba(16,16,24,0.92));
  border: 1px solid var(--hist-border);
  border-radius: var(--hist-radius);
  box-shadow: var(--hist-shadow);

  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

/* header */
.view[data-view="history"] .history__header{
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 14px var(--hist-pad);
  border-bottom: 1px solid var(--hist-border);
}

.view[data-view="history"] .history__title{
  color: var(--hist-text);
  font-weight: 700;
  letter-spacing: 0.4px;
}

.view[data-view="history"] .history__close{
  appearance: none;
  border: 1px solid var(--hist-border);
  background: rgba(0,0,0,0.25);
  color: var(--hist-text);

  width: 38px;
  height: 38px;
  border-radius: 12px;

  cursor: pointer;
  transition: transform 120ms ease, background 140ms ease, border-color 140ms ease;
}

.view[data-view="history"] .history__close:hover{
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.16);
  transform: translateY(-1px);
}

/* body with custom scrollbar block */
.view[data-view="history"] .history__body{
  position: relative;
  display: grid;
  grid-template-columns: 1fr 10px;
  gap: 10px;
  padding: var(--hist-pad);
}

/* list scrolling area */
.view[data-view="history"] .history__list{
  position: relative;
  overflow: auto;
  padding-right: 6px;

  color: var(--hist-text);
  font-size: 16px;
  line-height: 1.35;
}

/* WebKit scrollbar (Chrome/Edge) */
.view[data-view="history"] .history__list::-webkit-scrollbar{
  width: 10px;
}
.view[data-view="history"] .history__list::-webkit-scrollbar-track{
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
}
.view[data-view="history"] .history__list::-webkit-scrollbar-thumb{
  background: rgba(192,166,93,0.55);
  border-radius: 999px;
  border: 2px solid rgba(0,0,0,0.0);
  background-clip: padding-box;
}
.view[data-view="history"] .history__list::-webkit-scrollbar-thumb:hover{
  background: rgba(192,166,93,0.75);
  background-clip: padding-box;
}

/* Firefox */
.view[data-view="history"] .history__list{
  scrollbar-width: thin;
  scrollbar-color: rgba(192,166,93,0.65) rgba(255,255,255,0.06);
}

/* optional right-side “fake” scrollbar (если хочешь оставить декоративно) */
.view[data-view="history"] .history__scrollbar{
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}
.view[data-view="history"] .history__thumb{
  position: absolute;
  left: 1px;
  top: 1px;
  width: 8px;
  height: 80px;
  border-radius: 999px;
  background: rgba(192,166,93,0.55);
}

/* entries */
.view[data-view="history"] .history__item{
  padding: 12px 12px;
  margin: 10px 0;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.18);
  border-radius: 14px;
}

/* speaker name */
.view[data-view="history"] .history__name{
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: 0.2px;
  color: var(--hist-accent);
}

/* if you want per-character colors by adding class to history__name */
.view[data-view="history"] .history__name.is-player{ color: var(--name-player); }
.view[data-view="history"] .history__name.is-host{ color: var(--name-host); }
.view[data-view="history"] .history__name.is-mio{ color: var(--name-mio); }
.view[data-view="history"] .history__name.is-aya{ color: var(--name-aya); }
.view[data-view="history"] .history__name.is-kira{ color: var(--name-kira); }

.view[data-view="history"] .history__line{
  color: var(--hist-text);
  white-space: normal;
  word-break: break-word;
}

/* aside */
.view[data-view="history"] .history__aside{
  margin-top: 8px;
  color: var(--hist-muted);
  font-size: 14px;
  line-height: 1.3;
  padding-left: 10px;
  border-left: 2px solid rgba(192,166,93,0.35);
}

/* “choices” styling: если строка начинается с > или если ты добавишь класс */
.view[data-view="history"] .history__line.choice{
  color: rgba(255,255,255,0.90);
  border: 1px dashed rgba(192,166,93,0.35);
  background: rgba(192,166,93,0.10);
  border-radius: 12px;
  padding: 10px 10px;
}

/* placeholder text */
.view[data-view="history"] .history__text{
  color: var(--hist-muted);
  padding: 14px 10px;
}

.view[data-view="history"] .history__scrollbar{
  position: relative;
  user-select: none;
  touch-action: none; /* важно для pointer-drag */
}

.view[data-view="history"] .history__thumb{
  position: absolute;
  left: 1px;
  top: 1px;
  width: 8px;
  border-radius: 999px;
  cursor: grab;
}

.view[data-view="history"] .history__thumb:active{
  cursor: grabbing;
}

/* =========================
   HISTORY as modal (Figma)
   ========================= */

/* Вьюшка-оверлей на весь экран */
.view[data-view="history"]{
  position: absolute;
  inset: 0;
  z-index: 9996; /* выше игры, ниже fadeOverlay=9998 [file:3] */
}

/* Затемнение фона */
.view[data-view="history"] .history__overlay{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
}

/* Само окно (Container из Figma) */
.view[data-view="history"] .history__modal{
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);

  /* Figma: 1512x797, но адаптивно */
  width: min(1512px, 92vw);
  height: min(797px, 86vh);

  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 40px;
  gap: 40px;

  background: rgba(22, 14, 14, 0.95);
  border: 2px solid #C0A65D;
  border-radius: 30px;

  box-shadow: 0 18px 70px rgba(0,0,0,0.6);
  overflow: hidden; /* чтобы скроллбар/контент не вылезали */
}

/* Header (70px) */
.view[data-view="history"] .history__header{
  width: 100%;
  height: 70px;

  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;

  padding: 0;
  gap: 16px;
}

/* Title (48.5px) */
.view[data-view="history"] .history__title{
  margin: 0;
  font-family: "Montserrat", sans-serif;
  font-style: normal;
  font-weight: 700;
  font-size: 48.5455px;
  line-height: 59px;
  letter-spacing: 0.01em;
  color: #C0A65D;
}

/* Close button look */
.view[data-view="history"] .history__close{
  width: 70px;
  height: 70px;
  border: none;
  background: transparent;
  color: #C0A65D;
  cursor: pointer;

  display: grid;
  place-items: center;
  border-radius: 16px;
  transition: background 140ms ease, transform 140ms ease;
}

.view[data-view="history"] .history__close:hover{
  background: rgba(192,166,93,0.10);
  transform: translateY(-1px);
}

/* Body area: dialog container + scroll bar */
.view[data-view="history"] .history__body{
  width: 100%;
  flex: 1;

  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  min-height: 0; /* важно для правильного overflow */
}

/* Dialog content scroll area */
.view[data-view="history"] .history__list{
  flex: 1;
  height: 100%;
  overflow: auto;

  display: flex;
  flex-direction: column;
  gap: 15px;

  padding-right: 18px; /* чтобы текст не прятался под кастом-скроллом */

  font-family: "Montserrat", sans-serif;
  color: #FFFFFF;
}

/* прячем системный скроллбар (оставляем кастомный) */
.view[data-view="history"] .history__list{
  scrollbar-width: none;         /* Firefox */
}
.view[data-view="history"] .history__list::-webkit-scrollbar{
  width: 0;
  height: 0;
}

/* Dialog section */
.view[data-view="history"] .history__item{
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0;
  gap: 8px;
}

/* Speaker */
.view[data-view="history"] .history__name{
  width: 100%;
  font-family: "Montserrat", sans-serif;
  font-style: normal;
  font-weight: 700;
  font-size: 36px;
  line-height: 44px;
  letter-spacing: 0.01em;
  color: #FFFFFF;
}

/* Speaker color modifiers (под твои is-mio/is-aya/is-kira/is-host/is-player) */
.view[data-view="history"] .history__name.is-player{ color: #FFFFFF; }
.view[data-view="history"] .history__name.is-host{ color: #C0A65D; }
.view[data-view="history"] .history__name.is-mio{ color: #E19B9C; }
.view[data-view="history"] .history__name.is-aya{ color: #7ED3FF; }
.view[data-view="history"] .history__name.is-kira{ color: #C0530B; }

/* Dialog text */
.view[data-view="history"] .history__line{
  width: 100%;
  font-family: "Montserrat", sans-serif;
  font-style: normal;
  font-weight: 500;
  font-size: 36px;
  line-height: 44px;
  letter-spacing: 0.01em;
  color: #FFFFFF;

  word-break: break-word;
}

/* Aside (выделим мягко, не ломая стиль) */
.view[data-view="history"] .history__aside{
  width: 100%;
  margin-top: 4px;

  font-family: "Montserrat", sans-serif;
  font-style: italic;
  font-weight: 400;
  font-size: 30px;
  line-height: 38px;
  letter-spacing: 0.01em;

  color: rgba(255,255,255,0.85);
  padding-left: 18px;
  border-left: 4px solid rgba(192,166,93,0.45);
}

/* ===== кастомный скроллбар (как в Figma) ===== */
.view[data-view="history"] .history__scrollbar{
  width: 20px;
  height: 100%;

  background: #160E0E;
  border-radius: 62px;

  position: relative;
  overflow: hidden;

  user-select: none;
  touch-action: none;
}

/* thumb */
.view[data-view="history"] .history__thumb{
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;         /* Figma: 20 */
  height: 120px;       /* будет перезаписываться JS-ом */
  background: #C0A65D;
  border-radius: 62px;
  cursor: grab;
}

.view[data-view="history"] .history__thumb:active{
  cursor: grabbing;
}

/* placeholder */
.view[data-view="history"] .history__text{
  font-family: "Montserrat", sans-serif;
  font-weight: 500;
  font-size: 28px;
  line-height: 36px;
  color: rgba(255,255,255,0.75);
}

/* =========================
   HISTORY tweaks (as you asked)
   ========================= */

/* 5) фон = игра: оверлей НЕ затемняет */
.view[data-view="history"] .history__overlay{
  background: transparent;
  backdrop-filter: none;
}

/* 1) панель выше */
.view[data-view="history"] .history__modal{
  height: min(920px, 92vh);   /* было ~797px */
  width: min(1512px, 92vw);
}

/* 2) убрать тёмное выделение/карточки реплик */
.view[data-view="history"] .history__item{
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* чуть расстояния между секциями как в фигме */
.view[data-view="history"] .history__list{
  gap: 18px;
  padding-right: 28px; /* чтобы текст не залезал под скролл */
}

/* 3) Button Container (70x70) + нормальный крестик */
.view[data-view="history"] .history__close{
  width: 70px;
  height: 70px;
  padding: 0;
  gap: 10px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 16px;
  background: transparent;
  border: none;

  position: relative;
}

.view[data-view="history"] .history__close:hover{
  background: rgba(192,166,93,0.10);
}

/* рисуем X псевдоэлементами */
.view[data-view="history"] .history__close::before,
.view[data-view="history"] .history__close::after{
  content: "";
  position: absolute;
  width: 36px;     /* визуально как в фигме */
  height: 4px;     /* толщина */
  background: #C0A65D;
  border-radius: 999px;
}

.view[data-view="history"] .history__close::before{ transform: rotate(45deg); }
.view[data-view="history"] .history__close::after{ transform: rotate(-45deg); }

/* если внутри кнопки был SVG/иконка — скрываем, чтобы не мешал */
.view[data-view="history"] .history__close svg,
.view[data-view="history"] .history__close img{
  display: none !important;
}

/* 4) длинный скроллбар — трек на всю высоту блока диалогов */
.view[data-view="history"] .history__scrollbar{
  height: 100%;
  width: 20px;
  border-radius: 62px;
  background: #160E0E;
}

/* thumb тоже “длинный”, а реальную высоту всё равно задаст JS */
.view[data-view="history"] .history__thumb{
  width: 20px;
  left: 0;
  border-radius: 62px;
  background: #C0A65D;
}

/* приятнее выглядит при ховере */
.view[data-view="history"] .history__thumb:hover{
  filter: brightness(1.05);
}

.view[data-view="game"]{ z-index: 1; }
.view[data-view="history"]{ z-index: 9996; }

/* ===== History name colors ===== */
:root{
  --color-mio: #E19B9C;
  --color-aya: #693D69;
  --color-kira: #C0530B;
  --color-host: #DFDFDF;
  --color-player: #FFFFFF;
}

.view[data-view="history"] .history__name{ color: var(--color-player); }
.view[data-view="history"] .history__name.is-mio{ color: var(--color-mio); }
.view[data-view="history"] .history__name.is-aya{ color: var(--color-aya); }
.view[data-view="history"] .history__name.is-kira{ color: var(--color-kira); }
.view[data-view="history"] .history__name.is-host{ color: var(--color-host); }
.view[data-view="history"] .history__name.is-player{ color: var(--color-player); }

/* ===== History: softer dim + narration ===== */

/* фон за панелью: чуть затемняем, но игру видно */
.view[data-view="history"] .history__overlay{
  background: rgba(0,0,0,0.28);
  backdrop-filter: blur(2px);
}

/* НАРРАЦИЯ: если блока имени нет (renderHistory делает nameHtml пустым) */
.view[data-view="history"] .history__item:not(:has(.history__name)) .history__line{
  font-style: italic;
  color: rgba(255,255,255,0.88);
  padding-left: 18px;
  border-left: 4px solid rgba(192,166,93,0.55);
}

/* чуть плотнее, чтобы “описания” визуально отличались */
.view[data-view="history"] .history__item:not(:has(.history__name)) .history__line br{
  line-height: 1.25;
}

/* FIX: no red highlight behind story heroes */
.story-cardimage {
  background-color: transparent !important;
}

/* Stage: smoother cross-fade, less ghosting */
.scene-charimg {
  transform: translateY(10px) scale(0.985) !important;
  transition: opacity 0.42s ease, transform 0.42s ease !important;
  will-change: opacity, transform;
}

.scene-charimg.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1) !important;
}

/* Container: don't fight with display none; rely on opacity */
.scene-char {
  display: block !important;
  pointer-events: none;
}
.scene-char:not(.scene-char--visible) {
  opacity: 0 !important;
}
.scene-char.scene-char--visible {
  opacity: 1 !important;
}

.dialogaside {
  font-weight: 300;
  font-style: italic;
  font-size: 32px; /* меньше чем verse (40px) */
  color: var(--white);
  opacity: 0.6;    /* бледнее */
  letter-spacing: .4px;
}

.dialog__aside {
  font-weight: 300;
  font-style: italic;
  font-size: 38px; /* было 32px */
  color: var(--white);
  opacity: 0.6;
  letter-spacing: .4px;
}

.scene-char.is-focus {
  filter: brightness(1.06) saturate(1.18) contrast(1.06); /* без drop-shadow */
  opacity: 1;
  transform: scale(1.01);
}

.dialog {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 1920px;
  height: 439px;

  /* остальное оставь как было */
  background: linear-gradient(-0.147896deg, rgba(22, 14, 14, 0.9) 41.476%, rgba(22, 14, 14, 0.804) 61.918%, rgba(22, 14, 14, 0.494) 79.214%, rgba(22, 14, 14, 0) 97.035%);
  padding: 24px 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  z-index: 100;
}

.viewdata-viewgame .dialog {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 1920px;
  height: 439px;
  /* ... */
}

.view[data-view="game"] .dialog {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 1920px;
  height: 439px;
}

.view[data-view="game"] .dialog,
.view[data-view="choice"] .dialog {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 1920px;
  height: 439px;
  z-index: 100;
}

.view:not([data-view="game"]):not([data-view="choice"]) .dialog {
  display: none !important;
}

/* === DIALOG (BEM) === */

/* базовая панель как в макете */
.dialog {
  position: absolute;
  left: 0;
  top: 644px;
  width: 1920px;
  height: 439px;
  background: linear-gradient(
    -0.147896deg,
    rgba(22, 14, 14, 0.9) 41.476%,
    rgba(22, 14, 14, 0.804) 61.918%,
    rgba(22, 14, 14, 0.494) 79.214%,
    rgba(22, 14, 14, 0) 97.035%
  );
  padding: 24px 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  z-index: 100;
}

/* фиксируем только в GAME / CHOICE */
.view[data-view="game"] .dialog,
.view[data-view="choice"] .dialog {
  position: fixed;
  left: 50%;
  bottom: 0;
  top: auto;
  transform: translateX(-50%);
}

/* лэйаут */
.dialog__layout {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* колонка текста */
.dialog__text {
  width: 1139px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* строка имени — фиксированная высота, чтобы имя не прыгало */
.dialog__name-row {
  display: flex;
  align-items: center;
  min-height: 48px; /* подгони под шрифт имени */
}

/* имя героя */
.dialog__name {
  font-weight: 700;
  font-size: 40px;
  letter-spacing: 0.4px;
  text-shadow:
    -2px -2px 0 #160e0e,
     2px -2px 0 #160e0e,
    -2px  2px 0 #160e0e,
     2px  2px 0 #160e0e,
     0   -2px 0 #160e0e,
     0    2px 0 #160e0e,
    -2px  0   0 #160e0e,
     2px  0   0 #160e0e,
     0    0   10px rgba(0, 0, 0, 0.5);
}

/* цветные модификаторы имени (если нужно) */
.dialog__name--mio   { color: #E19B9C; }
.dialog__name--aya   { color: #693D69; }
.dialog__name--kira  { color: #C0530B; }
.dialog__name--host  { color: #DFDFDF; }
.dialog__name--player{ color: #FFFFFF; }

/* основной текст */
.dialog__verse {
  font-weight: 400;
  font-size: 40px;
  color: #ffffff;
  letter-spacing: 0.4px;
}

/* aside */
.dialog__aside {
  font-weight: 300;
  font-style: italic;
  font-size: 40px;
  color: #ffffff;
  letter-spacing: 0.4px;
}

.view[data-view="history"] .history__modal {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  /* делаем модалку крупнее */
  width: min(1600px, 94vw);
  height: min(900px, 94vh);
  background: rgba(22, 14, 14, 0.95);
  border-radius: 18px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

/* ==== HISTORY: увеличенный журнал + подписи ==== */

/* Увеличенный модал журнала (для старого и нового класса) */
.view[data-view="history"] .historymodal,
.view[data-view="history"] .history__modal {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(1600px, 94vw);
  height: min(900px, 94vh);
  background: rgba(22, 14, 14, 0.95);
  border-radius: 30px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

/* Контейнер шапки и списка — растягиваем по высоте */
.view[data-view="history"] .historybody,
.view[data-view="history"] .history__body {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  height: calc(100% - 90px);
}

/* Список — повыше */
.view[data-view="history"] .historylist,
.view[data-view="history"] .history__list {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Оформление нарраций (без имени) */
.view[data-view="history"] .historyitem:not(:has(.historyname)) .historytext,
.view[data-view="history"] .historyitem:not(:has(.historyname)) .history__text {
  font-style: italic;
  color: rgba(255, 255, 255, 0.9);
  padding-left: 18px;
  border-left: 4px solid rgba(192, 166, 93, 0.55);
}

/* Базовый стиль имени в истории (цвета подтягиваются модификаторами) */
.view[data-view="history"] .historyname,
.view[data-view="history"] .history__name {
  font-weight: 700;
  font-size: 36px;
  letter-spacing: 0.36px;
  white-space: nowrap;
  text-shadow:
    -1px -1px 0 #160e0e,
     1px -1px 0 #160e0e,
    -1px  1px 0 #160e0e,
     1px  1px 0 #160e0e;
}

/* Цвет для «Рассказчик» (host) и «Вы» (player) уже есть в стилях:
   .historyname--host { color: var(--color-host); }
   .historyname--player { color: var(--color-player); }
*/

/* =========================
   HISTORY (журнал)
   ========================= */

/* Увеличенный модал (старый и новый класс) */
.view[data-view="history"] .historymodal,
.view[data-view="history"] .history__modal {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(1600px, 94vw);
  height: min(900px, 94vh);
  background: rgba(22, 14, 14, 0.95);
  border-radius: 30px;
  padding: 40px;
  display: flex;
  flex-direction: column;
}

/* Шапка и тело */
.view[data-view="history"] .historyheader,
.view[data-view="history"] .history__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.view[data-view="history"] .historytitle,
.view[data-view="history"] .history__title {
  font-weight: 700;
  font-size: 48px;
  color: var(--gold);
  letter-spacing: 0.48px;
}

/* Контейнер списка + скроллбар */
.view[data-view="history"] .historybody,
.view[data-view="history"] .history__body {
  margin-top: 30px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  height: calc(100% - 100px);
}

/* Список истории — выше и скроллится */
.view[data-view="history"] .historylist,
.view[data-view="history"] .history__list {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scrollbar-width: none;
}

.view[data-view="history"] .historylist::-webkit-scrollbar,
.view[data-view="history"] .history__list::-webkit-scrollbar {
  display: none;
}

/* Один элемент истории */
.view[data-view="history"] .history__item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Имя спикера */
.view[data-view="history"] .history__name {
  font-weight: 700;
  font-size: 36px;
  letter-spacing: 0.36px;
  white-space: nowrap;
  text-shadow:
    -1px -1px 0 #160e0e,
     1px -1px 0 #160e0e,
    -1px  1px 0 #160e0e,
     1px  1px 0 #160e0e;
}

/* Цвета имён (совместим с существующими переменными) */
.historyname--mio    { color: var(--color-mio); }
.historyname--aya    { color: var(--color-aya); }
.historyname--kira   { color: var(--color-kira); }
.historyname--host   { color: var(--color-host); }   /* Рассказчик */
.historyname--player { color: var(--color-player); } /* Вы */

/* Текст реплики */
.view[data-view="history"] .history__line {
  font-weight: 500;
  font-size: 36px;
  color: #ffffff;
  letter-spacing: 0.36px;
}

/* Aside в истории */
.view[data-view="history"] .history__aside {
  font-weight: 400;
  font-size: 32px;
  color: #ffffff;
  opacity: 0.85;
}

/* Наррации (когда нет явного имени, но мы рисуем "Рассказчик") уже
   имеют .history__name + .historyname--host, поэтому отдельного
   спец-правила не нужно, достаточно цвета host. */

/* Кастомный скроллбар справа (у тебя он уже есть — слегка подправим размеры) */
.view[data-view="history"] .historyscrollbar,
.view[data-view="history"] .history__scrollbar {
  width: 20px;
  height: 100%;
  background: #160e0e;
  border-radius: 62px;
  position: relative;
  flex-shrink: 0;
}

.view[data-view="history"] .historythumb,
.view[data-view="history"] .history__thumb {
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 60px;
  background: var(--gold);
  border-radius: 62px;
}

.historyname--mio      { color: var(--color-mio); }
.historyname--aya      { color: var(--color-aya); }
.historyname--kira     { color: var(--color-kira); }
.historyname--host     { color: var(--color-host); }     /* Ведущий */
.historyname--player   { color: var(--color-player); }   /* Вы */

/* Отдельный цвет для Рассказчика */
.historyname--narrator {
  color: #f0c96a;              /* немного теплее/светлее золота */
  text-shadow:
    -1px -1px 0 #160e0e,
     1px -1px 0 #160e0e,
    -1px  1px 0 #160e0e,
     1px  1px 0 #160e0e;
}

/* Имя спикера */
.view[data-view="history"] .history__name {
  font-weight: 700;
  font-size: 36px;
  letter-spacing: 0.36px;
  white-space: nowrap;
  text-shadow:
    -1px -1px 0 #160e0e,
     1px -1px 0 #160e0e,
    -1px  1px 0 #160e0e,
     1px  1px 0 #160e0e;
}

/* Цвета имён */
.history__name--mio      { color: var(--color-mio); }
.history__name--aya      { color: var(--color-aya); }
.history__name--kira     { color: var(--color-kira); }
.history__name--host     { color: var(--color-host); }     /* Ведущий */
.history__name--player   { color: var(--color-player); }   /* Вы */

/* Отдельный цвет для Рассказчика (не host) */
.history__name--narrator {
  color: #f0c96a; /* чуть светлее/теплее золота, можешь заменить на свой */
  text-shadow:
    -1px -1px 0 #160e0e,
     1px -1px 0 #160e0e,
    -1px  1px 0 #160e0e,
     1px  1px 0 #160e0e;
}

/* Текст и aside на месте */
.view[data-view="history"] .history__line {
  font-weight: 500;
  font-size: 36px;
  color: #ffffff;
  letter-spacing: 0.36px;
}

.view[data-view="history"] .history__aside {
  font-weight: 400;
  font-size: 32px;
  color: #ffffff;
  opacity: 0.85;
}

/* =========================
   HISTORY (журнал)
   ========================= */

/* Увеличенный модал (старый и новый класс на всякий случай) */
.view[data-view="history"] .historymodal,
.view[data-view="history"] .history__modal {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(1600px, 94vw);
  height: min(900px, 94vh);
  background: rgba(22, 14, 14, 0.95);
  border-radius: 30px;
  padding: 40px;
  display: flex;
  flex-direction: column;
}

/* Шапка */
.view[data-view="history"] .historyheader,
.view[data-view="history"] .history__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.view[data-view="history"] .historytitle,
.view[data-view="history"] .history__title {
  font-weight: 700;
  font-size: 48px;
  color: var(--gold);
  letter-spacing: 0.48px;
}

/* Контент: список + скроллбар */
.view[data-view="history"] .historybody,
.view[data-view="history"] .history__body {
  margin-top: 30px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  height: calc(100% - 100px);
}

/* Список истории */
.view[data-view="history"] .historylist,
.view[data-view="history"] .history__list {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scrollbar-width: none;
}

.view[data-view="history"] .historylist::-webkit-scrollbar,
.view[data-view="history"] .history__list::-webkit-scrollbar {
  display: none;
}

/* Один элемент истории */
.view[data-view="history"] .history__item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Имя спикера */
.view[data-view="history"] .history__name {
  font-weight: 700;
  font-size: 36px;
  letter-spacing: 0.36px;
  white-space: nowrap;
  text-shadow:
    -1px -1px 0 #160e0e,
     1px -1px 0 #160e0e,
    -1px  1px 0 #160e0e,
     1px  1px 0 #160e0e;
}

/* Цвета имён */
.history__name--mio      { color: var(--color-mio); }
.history__name--aya      { color: var(--color-aya); }
.history__name--kira     { color: var(--color-kira); }
.history__name--host     { color: var(--color-host); }     /* Ведущий */
.history__name--player   { color: var(--color-player); }   /* Вы */

/* Отдельный цвет для Рассказчика */
.history__name--narrator {
  color: #f0c96a; /* можешь заменить на свой оттенок */
  text-shadow:
    -1px -1px 0 #160e0e,
     1px -1px 0 #160e0e,
    -1px  1px 0 #160e0e,
     1px  1px 0 #160e0e;
}

/* Текст реплики */
.view[data-view="history"] .history__line {
  font-weight: 500;
  font-size: 36px;
  color: #ffffff;
  letter-spacing: 0.36px;
}

/* Aside */
.view[data-view="history"] .history__aside {
  font-weight: 400;
  font-size: 32px;
  color: #ffffff;
  opacity: 0.85;
}

/* Кастомный скроллбар */
.view[data-view="history"] .historyscrollbar,
.view[data-view="history"] .history__scrollbar {
  width: 20px;
  height: 100%;
  background: #160e0e;
  border-radius: 62px;
  position: relative;
  flex-shrink: 0;
}

.view[data-view="history"] .historythumb,
.view[data-view="history"] .history__thumb {
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 60px;
  background: var(--gold);
  border-radius: 62px;
}

.dialog {
  position: absolute;
  left: 0;
  top: 644px;
  width: 1920px;
  height: 439px;
  background: linear-gradient(
    -0.147896deg,
    rgba(22, 14, 14, 0.9) 41.476%,
    rgba(22, 14, 14, 0.804) 61.918%,
    rgba(22, 14, 14, 0.494) 79.214%,
    rgba(22, 14, 14, 0) 97.035%
  );
  padding: 24px 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  z-index: 100;
}

.dialog__layout {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dialog__text {
  width: 1139px;
  display: flex;
  flex-direction: column;
}

/* Фиксированный блок под имя — оно всегда на одном уровне */
.dialog__name-row {
  display: flex;
  align-items: flex-start; /* прижимаем имя вверх блока */
  height: 90px;            /* ЗАДАННАЯ ВЫСОТА БЛОКА ПОД ИМЯ, подгони по макету */
  margin-bottom: 10px;
}

/* Имя */
.dialog__name {
  font-weight: 700;
  font-size: 40px;
  letter-spacing: .4px;
  text-shadow:
    -2px -2px 0 #160e0e,
     2px -2px 0 #160e0e,
    -2px  2px 0 #160e0e,
     2px  2px 0 #160e0e,
     0px -2px 0 #160e0e,
     0px  2px 0 #160e0e,
    -2px  0px 0 #160e0e,
     2px  0px 0 #160e0e,
     0 0 10px rgba(0, 0, 0, 0.5);
}

.dialog__name--mio    { color: var(--color-mio); }
.dialog__name--aya    { color: var(--color-aya); }
.dialog__name--kira   { color: var(--color-kira); }
.dialog__name--host   { color: var(--color-host); }
.dialog__name--player { color: var(--color-player); }

/* Текст идёт строго ниже фиксированного блока имени */
.dialog__verse {
  font-weight: 400;
  font-size: 40px;
  color: var(--white);
  letter-spacing: .4px;
}

.dialog__aside {
  font-weight: 300;
  font-style: italic;
  font-size: 40px;
  color: var(--white);
  letter-spacing: .4px;
}

.dialog {
  position: absolute;
  left: 0;
  top: 644px;
  width: 1920px;
  height: 439px;
  background: linear-gradient(
    -0.147896deg,
    rgba(22, 14, 14, 0.9) 41.476%,
    rgba(22, 14, 14, 0.804) 61.918%,
    rgba(22, 14, 14, 0.494) 79.214%,
    rgba(22, 14, 14, 0) 97.035%
  );
  padding: 24px 44px;
  display: flex;
  align-items: flex-start; /* ВЫРАВНИВАНИЕ ПО ВЕРХУ */
  cursor: pointer;
  z-index: 100;
}

.dialog {
  position: absolute;
  left: 0;
  top: 644px;
  width: 1920px;
  height: 439px;
  background: linear-gradient(
    -0.147896deg,
    rgba(22, 14, 14, 0.9) 41.476%,
    rgba(22, 14, 14, 0.804) 61.918%,
    rgba(22, 14, 14, 0.494) 79.214%,
    rgba(22, 14, 14, 0) 97.035%
  );
  padding: 24px 44px;
  display: flex;
  align-items: flex-start; /* выравнивание по ВЕРХУ */
  cursor: pointer;
  z-index: 100;
}

.dialog__layout {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.dialog__text {
  width: 1139px;
  display: flex;
  flex-direction: column;
}

/* Блок под имя — фикс высота, имя всегда на одной линии */
.dialog__name-row {
  display: flex;
  align-items: flex-end; /* нижняя линия имени ровная */
  height: 80px;          /* подгони под макет: 72–90px */
  margin-bottom: 6px;    /* небольшой, стабильный зазор до текста */
}

/* Имя */
.dialog__name {
  font-weight: 700;
  font-size: 40px;
  letter-spacing: .4px;
  text-shadow:
    -2px -2px 0 #160e0e,
     2px -2px 0 #160e0e,
    -2px  2px 0 #160e0e,
     2px  2px 0 #160e0e,
     0px -2px 0 #160e0e,
     0px  2px 0 #160e0e,
    -2px  0px 0 #160e0e,
     2px  0px 0 #160e0e,
     0 0 10px rgba(0, 0, 0, 0.5);
}

.dialog__name--mio    { color: var(--color-mio); }
.dialog__name--aya    { color: var(--color-aya); }
.dialog__name--kira   { color: var(--color-kira); }
.dialog__name--host   { color: var(--color-host); }
.dialog__name--player { color: var(--color-player); }

/* Реплика: растёт вниз, без влияния на имя */
.dialog__verse {
  font-weight: 400;
  font-size: 40px;
  color: var(--white);
  letter-spacing: .4px;
  line-height: 1.2;
}

/* Aside сразу под текстом, без лишних дыр */
.dialog__aside {
  margin-top: 4px; /* маленький отступ от текста */
  font-weight: 300;
  font-style: italic;
  font-size: 40px;
  color: var(--white);
  letter-spacing: .4px;
}

/* BRIDGE: новые BEM-классы → старые is-* для цвета */
.viewdata-viewhistory .history__name--mio    { color: var(--color-mio); }
.viewdata-viewhistory .history__name--aya    { color: var(--color-aya); }
.viewdata-viewhistory .history__name--kira   { color: var(--color-kira); }
.viewdata-viewhistory .history__name--host   { color: var(--color-host); }
.viewdata-viewhistory .history__name--player { color: var(--color-player); }

/* если хочешь, можно ещё тонко подсветить рассказчика */
.viewdata-viewhistory .history__name--narrator {
  color: rgba(255,255,255,0.85);
}

/* HISTORY name colors – новые классы */
.viewdata-viewhistory .history__name--mio {
  color: var(--color-mio);
}

.viewdata-viewhistory .history__name--aya {
  color: var(--color-aya);
}

.viewdata-viewhistory .history__name--kira {
  color: var(--color-kira);
}

.viewdata-viewhistory .history__name--host {
  color: var(--color-host);
}

.viewdata-viewhistory .history__name--player {
  color: var(--color-player);
}

/* Рассказчик – отдельный мягкий цвет */
.viewdata-viewhistory .history__name--narrator {
  color: #d0c8ff; /* выбери любой, например пастельный фиолетовый */
}

.viewdata-viewgame .dialog,
.viewdata-viewchoice .dialog {
  position: fixed;
  left: 50%;
  bottom: 20px;      /* было bottom: 0; */
  transform: translateX(-50%);
  width: 1920px;
  height: 439px;
  background: linear-gradient(-0.147896deg,
    rgba(22,14,14,0.9) 41.476%,
    rgba(22,14,14,0.804) 61.918%,
    rgba(22,14,14,0.494) 79.214%,
    rgba(22,14,14,0) 97.035%);
  padding: 24px 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  z-index: 100;
}

.viewdata-viewgame .dialog,
.viewdata-viewchoice .dialog {
  position: fixed;
  left: 50%;
  bottom: 8px;        /* было 20px */
  transform: translateX(-50%);
  width: 1920px;
  height: 439px;
  /* остальное без изменений */
}

.viewdata-viewgame .dialog,
.viewdata-viewchoice .dialog {
  position: fixed;
  left: 50%;
  bottom: 0px;  /* было 8px */
  transform: translateX(-50%);
  width: 1920px;
  height: 439px;
}

/* имя спикера чуть ниже строки текста */
.dialoglayout {
  align-items: flex-end; /* имя и текст будут «стоять» на одной линии снизу */
}

.dialogname {
  margin-top: 18px;  /* опускаем имя чуть ниже */
}

/* если хочешь, можно ещё сильнее прижать его к низу панели */
.dialogtext {
  padding-bottom: 10px;
}

.dialogname {
  margin-top: 40px;   /* или больше, если нужно ещё ниже */
}

.dialoglayout {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dialogname {
  font-weight: 700;
  font-size: 40px;
  letter-spacing: .4px;
  text-shadow: -2px -2px 0 #160e0e,
               2px -2px 0 #160e0e,
               -2px 2px 0 #160e0e,
               2px 2px 0 #160e0e,
               0px -2px 0 #160e0e,
               0px 2px 0 #160e0e,
               -2px 0px 0 #160e0e,
               2px 0px 0 #160e0e,
               0 0 10px rgba(0,0,0,0.5);
}

/* если добавлял эти штуки – удали их */
.dialogname--host { margin-top: 0; }
.dialogname { margin-top: 0; }
.dialogtext { padding-bottom: 0; }
.dialoglayout { align-items: center; }

.viewdata-viewgame .dialog,
.viewdata-viewchoice .dialog {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 1920px;
  height: 439px;
}

.viewdata-viewhistory .historymodal {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 50%;
  height: 50%;
}

/* HISTORY modal size 50% (BEM __) */
.viewdata-viewhistory .history__modal,
.viewdata-viewhistory .historymodal {
  width: 50% !important;
  height: 50% !important;
}

.view[data-view="history"] .history__modal {
  width: 70%;
  height: 70%;
}

/* HISTORY (BEM) — убрать странную верхнюю панель/пустоту */
.view[data-view="history"] .history__header {
  height: auto;
  padding: 0;
  margin: 0;
  border-bottom: none;
}

.view[data-view="history"] .history__body {
  margin-top: 0;
}

/* HISTORY BEM: включить цветные имена (если JS рендерит .historyname) */
.view[data-view="history"] .history__modal .historyname { color: var(--color-player); }
.view[data-view="history"] .history__modal .historyname.is-mio { color: var(--color-mio) !important; }
.view[data-view="history"] .history__modal .historyname.is-aya { color: var(--color-aya) !important; }
.view[data-view="history"] .history__modal .historyname.is-kira { color: var(--color-kira) !important; }
.view[data-view="history"] .history__modal .historyname.is-host { color: var(--color-host) !important; }
.view[data-view="history"] .history__modal .historyname.is-player { color: var(--color-player) !important; }

/* HISTORY (BEM) — цветные имена спикеров */
.view[data-view="history"] .history__name {
  font-weight: 700;
  color: var(--color-player);
  text-shadow: -1px -1px 0 #160e0e, 1px -1px 0 #160e0e, -1px 1px 0 #160e0e, 1px 1px 0 #160e0e;
}

/* поддержка обоих стилей модификаторов (is-* и --*) */
.view[data-view="history"] .history__name.is-mio,
.view[data-view="history"] .history__name--mio { color: var(--color-mio) !important; }

.view[data-view="history"] .history__name.is-aya,
.view[data-view="history"] .history__name--aya { color: var(--color-aya) !important; }

.view[data-view="history"] .history__name.is-kira,
.view[data-view="history"] .history__name--kira { color: var(--color-kira) !important; }

.view[data-view="history"] .history__name.is-host,
.view[data-view="history"] .history__name--host { color: var(--color-host) !important; }

.view[data-view="history"] .history__name.is-player,
.view[data-view="history"] .history__name--player { color: var(--color-player) !important; }

/* для нарратора, раз ты используешь history__name--narrator */
.view[data-view="history"] .history__name--narrator { color: var(--color-host) !important; opacity: 0.9; }

/* =======================
   GALLERY (BONUS ART)
   ======================= */

.view[data-view="gallery"] {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery {
  position: relative;
  width: 1920px;
  height: 1080px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery__container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0;
  gap: 24px;
  width: 1200px;
  height: 860px;
}

/* Заголовок + табы */

.gallery__header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gallery__title {
  font-weight: 700;
  font-size: 40px;
  color: var(--gold);
  letter-spacing: 0.4px;
}

.gallery__tabs {
  display: flex;
  gap: 10px;
}

.gallery__tab {
  min-width: 120px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(192, 166, 93, 0.5);
  background: rgba(22, 14, 14, 0.9);
  color: var(--gold);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.2px;
  text-align: center;
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.gallery__tab:hover,
.gallery__tab:focus-visible {
  transform: translateY(-1px);
  box-shadow: var(--shadow-gold);
  border-color: var(--gold);
}

.gallery__tab--active {
  background: var(--bg-panel-strong);
  box-shadow: var(--shadow-gold);
  border-color: var(--gold);
}

/* Основное тело: список артов + боковая панель */

.gallery__body {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  width: 100%;
  height: 100%;
}

/* Список из 3 карточек */

.gallery__list {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  gap: 20px;
}

/* Карточка арта */

.gallery-card {
  position: relative;
  width: 260px;
  height: 360px;
  border-radius: 30px;
  background: rgba(22, 14, 14, 0.9);
  border: 2px solid transparent;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.gallery-card__preview {
  position: relative;
  flex: 1;
  background: #0a0a0a;
  overflow: hidden;
}

.gallery-card__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.2s ease, transform 0.2s ease;
}

/* Лейаут подписи */

.gallery-card__footer {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gallery-card__title {
  font-weight: 600;
  font-size: 18px;
  color: var(--gold);
}

.gallery-card__status {
  font-weight: 400;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
}

/* Закрытое состояние */

.gallery-card--locked .gallery-card__preview img {
  filter: blur(6px) grayscale(0.3);
  transform: scale(1.05);
}

.gallery-card__lock {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.gallery-card__lock-icon {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-card__lock-icon img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

/* Ховер только если арт уже открыт */

.gallery-card--unlocked:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
  box-shadow: var(--shadow-gold);
}

.gallery-card--unlocked:hover .gallery-card__preview img {
  transform: scale(1.03);
}

/* Боковая панель справа */

.gallery__sidebar {
  padding: 18px 20px;
  border-radius: 24px;
  background: rgba(22, 14, 14, 0.95);
  border: 1px solid rgba(192, 166, 93, 0.45);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gallery__subtitle {
  font-weight: 700;
  font-size: 20px;
  color: var(--gold);
  letter-spacing: 0.3px;
}

.gallery__description {
  font-weight: 400;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.4;
}

/* Кнопка "смотреть рекламу / просмотреть арт" */

.gallery__action-btn {
  margin-top: auto;
  position: relative;
  background: var(--bg-panel);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.gallery__action-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid transparent;
  pointer-events: none;
  transition: border-color 0.2s ease;
}

.gallery__action-text {
  font-weight: 700;
  font-size: 18px;
  color: var(--gold);
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.gallery__action-btn:hover:not(:disabled),
.gallery__action-btn:focus-visible:not(:disabled) {
  transform: scale(1.03);
  box-shadow: var(--shadow-gold);
  background: var(--bg-panel-strong);
}

.gallery__action-btn:hover:not(:disabled)::before,
.gallery__action-btn:focus-visible:not(:disabled)::before {
  border-color: var(--gold);
}

.gallery__action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Прогресс (опционально, если сделаешь индикатор) */
.gallery__progress {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
}

/* FINAL: ending panel must be bottom */
.viewdata-viewending {
  position: absolute;
  inset: 0;
}

/* Прижимаем панель вниз и перебиваем любые position:relative из патчей */
.viewdata-viewending .endingpanel {
  position: absolute !important;
  left: 0;
  right: 0;
  bottom: 0 !important;
  top: auto !important;
  z-index: 2;
}

/* === ENDING: one true layout (BEM + legacy supported) === */
.view[data-view="ending"],
.viewdata-viewending {
  position: absolute;
  inset: 0;
}

/* Фон концовки (картинка) всегда снизу */
.view[data-view="ending"] .endingbg,
.viewdata-viewending .endingbg,
.view[data-view="ending"] .ending__bg,
.viewdata-viewending .ending__bg {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: 50% 50% !important;
  z-index: 0 !important;
}

/* Панель-затемнение всегда внизу */
.view[data-view="ending"] .ending__panel,
.view[data-view="ending"] .endingpanel,
.viewdata-viewending .ending__panel,
.viewdata-viewending .endingpanel {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  top: auto !important;
  z-index: 2 !important;
}

/* Текст/кнопка/заголовок всегда над панелью */
.view[data-view="ending"] #endingText,
.view[data-view="ending"] .ending__text,
.view[data-view="ending"] .endingtext,
.view[data-view="ending"] .ending__btn,
.view[data-view="ending"] .endingbtn,
.view[data-view="ending"] #endingTitle,
.view[data-view="ending"] .ending__title,
.view[data-view="ending"] .endingtitle,
.viewdata-viewending #endingText,
.viewdata-viewending #endingTitle,
.viewdata-viewending .ending__text,
.viewdata-viewending .endingtext,
.viewdata-viewending .ending__btn,
.viewdata-viewending .endingbtn,
.viewdata-viewending .ending__title,
.viewdata-viewending .endingtitle {
  position: relative;
  z-index: 3 !important;
}

/* MENU smaller (BEM + legacy) */
.menu__actions, .menuactions { gap: 24px; }
.menu__btn-wrap, .menubtn-wrap { margin-bottom: 12px; }

.menu__btn, .menubtn { height: 110px; }
.menu__btn-text, .menubtn-text { font-size: 44px; }

/* decor scaled */
.menu__decor, .menudecor {
  width: 168px;
  height: 168px;
  top: -4px;
}

.menu__decor--left, .menudecor--left { left: -88px; }
.menu__decor--right, .menudecor--right { right: -88px; }

/* softer hover pop */
.menu__btn:hover .menu__decor img,
.menu__btn:focus-visible .menu__decor img,
.menubtn:hover .menudecor img,
.menubtn:focus-visible .menudecor img {
  transform: scale(1.05);
}

/* FINAL: no underline/accent under speaker name */
.dialogname::after {
  content: none !important;
  display: none !important;
}

/* ENDINGS: title fit inside card */
.ending-cardtitle-wrap{
  width: 100% !important;
  height: auto !important;
}

.ending-cardtitle{
  width: 100% !important;
  font-size: 24px !important;
  line-height: 1.15 !important;
  white-space: normal !important;

  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
  overflow: hidden !important;
}

/* ENDINGS: full title fits (wrap, no cut) */
.ending-cardtitle-wrap{
  width: 100% !important;
  height: auto !important;
  padding: 0 10px !important;
}

.ending-cardtitle{
  width: 100% !important;
  height: auto !important;

  font-size: 22px !important;
  line-height: 1.15 !important;

  white-space: normal !important;
  overflow: visible !important;
  word-break: break-word !important;
  hyphens: auto !important;
}

/* BONUS ART: always show preview image */
.viewdata-viewbonus .gallery-cardpreview{
  height: 260px !important; /* чтобы не было 0 высоты */
}

.viewdata-viewbonus .gallery-cardpreview img{
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  opacity: 1 !important;
  filter: none !important;
  transform: none !important;
}

/* ===== TUTORIAL VIEW ===== */
.viewdata-viewtutorial {
  position: absolute;
  inset: 0;
  z-index: 9997; /* выше обычных views (у них 100), ниже fadeOverlay(9998) */
}

/* фон/контейнер (если у тебя на view стоит класс tutorial-bg) */
.viewdata-viewtutorial .tutorial-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* сама картинка */
#tutorialImg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;   /* как ты и хочешь: вписать без обрезки */
  object-position: 50% 50%;
  display: block;
  pointer-events: none;  /* чтобы клики шли по кнопкам tutorial, если они поверх */
  user-select: none;
}

/* точки */
#tutorialDots {
  position: absolute;
  left: 50%;
  bottom: 70px;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 2;
}

.tutorial-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.25);
  border: 2px solid rgba(192,166,93,0.55);
}

.tutorial-dot--active {
  background: rgba(192,166,93,0.9);
  border-color: rgba(192,166,93,1);
}

/* ---- Dialog global override (paste at END) ---- */

/* Всегда фиксируем диалог к низу экрана (и в game, и в choice) */
.viewdata-viewgame .dialog,
.viewdata-viewchoice .dialog {
  position: fixed !important;
  left: 50% !important;
  top: auto !important;
  bottom: -18px !important; /* ниже, чем было (0/8/20) */
  transform: translateX(-50%) !important;
  width: 1920px !important;
}

/* Меньше воздуха между name -> verse -> aside */
.viewdata-viewgame .dialog .dialogtext,
.viewdata-viewchoice .dialog .dialogtext {
  gap: 8px !important; /* было 15px */
}

/* Чуть ближе aside к основному тексту (если есть margin-top) */
.viewdata-viewgame .dialog .dialogaside,
.viewdata-viewchoice .dialog .dialogaside {
  margin-top: 0 !important; /* было 4px в одном из блоков */
}

/* ---- Dialog BEM/global override (paste at END) ---- */

/* Опускаем панель еще ниже (на 18px ниже низа) */
.viewdata-viewgame .dialog,
.viewdata-viewchoice .dialog {
  position: fixed !important;
  left: 50% !important;
  top: auto !important;
  bottom: -18px !important;
  transform: translateX(-50%) !important;
  width: 1920px !important;
}

/* Уменьшаем расстояние между: имя -> текст -> aside */
.viewdata-viewgame .dialog .dialogtext,
.viewdata-viewchoice .dialog .dialogtext,
.viewdata-viewgame .dialog .dialog__text,
.viewdata-viewchoice .dialog .dialog__text {
  gap: 8px !important; /* было 15px */
}

/* Прижимаем aside (убираем возможный margin-top) */
.viewdata-viewgame .dialog .dialogaside,
.viewdata-viewchoice .dialog .dialogaside,
.viewdata-viewgame .dialog .dialog__aside,
.viewdata-viewchoice .dialog .dialog__aside {
  margin-top: 0 !important; /* было 4px в одном из дублей */
}

.dialog__text {
  gap: 10px; /* было 15px */
}

.dialog__aside {
  margin-top: 0px; /* было 4px (если есть) */
}

/* Aya name readability (BEM: dialog__*) */
.viewdata-viewgame .dialog .dialog__name--aya,
.viewdata-viewchoice .dialog .dialog__name--aya {
  /* можешь убрать color, если хочешь оставить исходный --color-aya */
  color: #B985C7 !important;

  text-shadow:
    -2px -2px 0 #160e0e,
     2px -2px 0 #160e0e,
    -2px  2px 0 #160e0e,
     2px  2px 0 #160e0e,
    -3px  0   0 #160e0e,
     3px  0   0 #160e0e,
     0   -3px 0 #160e0e,
     0    3px 0 #160e0e,
     0    0   16px rgba(0,0,0,0.75) !important;
}

:root{
  --color-aya: #B985C7;
}

:root{
  --color-aya: #9B5A98;
}

/* Dialog panel lower (BEM-first) */
.viewdata-viewgame .dialog,
.viewdata-viewchoice .dialog,
.viewdata-viewgame .dialog__panel,
.viewdata-viewchoice .dialog__panel {
  position: fixed !important;
  left: 50% !important;
  top: auto !important;
  bottom: -80px !important; /* сильно ниже; поменяй на -60 / -100 */
  transform: translateX(-50%) !important;
  width: 1920px !important;
}

/* Disable active speaker highlight completely */
.scene-char.is-focus {
  filter: none !important;
  transform: none !important;
  opacity: 1 !important;
}

/* Put whole dialog panel lower (GAME + CHOICE) */
.viewdata-viewgame .dialog,
.viewdata-viewchoice .dialog {
  position: fixed !important;
  left: 50% !important;
  top: auto !important;
  bottom: -80px !important; /* ниже: -60..-120 подбери */
  transform: translateX(-50%) !important;
  width: 1920px !important;
  height: 439px !important;
}

/* BEM-compat aliases (if old CSS targets .dialoglayout/.dialogtext etc.) */
.viewdata-viewgame .dialog__layout,
.viewdata-viewchoice .dialog__layout {
  width: 100% !important;
}

.viewdata-viewgame .dialog__text,
.viewdata-viewchoice .dialog__text {
  width: 1139px !important;
}

/* Chapter end fade overlay */
#fadeOverlay{
  background: #000 !important;
  opacity: 0;
  transition: opacity 650ms ease !important;
  z-index: 9998 !important;
}

.music-toggle--muted,
.music-toggle--muted * {
  text-decoration: none !important;
}

.music-toggle--muted::after,
.music-toggle--muted::before {
  content: none !important;
}

#tutorialDots { display: none !important; }

.app {
  position: relative;
  overflow: hidden; /* можно убрать, если не нужно */
}

#chapterFade {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 500ms ease;
  z-index: 9998;
}

html, body {
  width: 100%;
  height: 100%;
  background: #000; /* или var(--bg-page) */
  overflow: hidden;
}

/* BONUS ART title: обводка + небольшая тень */
.view[data-view="bonus-art-view"] #bonusArtTitle{
  text-shadow:
    -1px -1px 0 #000,
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000,
     0 0 8px rgba(0,0,0,.45);
}

/* Locked bonus arts: такой же hover, но без "cursor:pointer" */
.view[data-view="bonus"] .ending-card:not(.ending-card--unlocked):hover{
  transform: scale(1.02);
  border-color: var(--gold);
}

/* чтобы выглядело как интерактив, но не как клик */
.view[data-view="bonus"] .ending-card:not(.ending-card--unlocked){
  cursor: default;
  transition: transform .2s ease, border-color .2s ease, filter .2s ease;
}

.ending-cardlock-icon{
  width: 120px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.ending-cardlock-icon img{
  width: 120px;
  height: 150px;
  object-fit: contain;
}

.ending-cardlock-icon{
  width: 96px;
  height: 120px;
}

.ending-cardlock-icon img{
  width: 96px;
  height: 120px;
}

/* --- FIX: мини-уведомления (toast notification) --- */
.notification{
  width: fit-content;
  max-width: min(1100px, 92vw);
  height: auto;
  min-height: 120px;         /* сохраняем “пухлость” как было */
  box-sizing: border-box;
  overflow: hidden;          /* ничего не торчит за рамку */
}

.notificationtext{
  white-space: normal;       /* вместо nowrap */
  overflow-wrap: anywhere;   /* рвём длинные слова/URL */
  word-break: break-word;
  hyphens: auto;
  line-height: 1.15;
  text-align: center;
}

/* Экран выбора истории: опустить лого */
.menu_logo{
  margin-top: 40px; /* подбери 20–80px */
}

html, body {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
  touch-action: none;
}

:root {
  --design-w: 1920;
  --design-h: 1080;
  --scale: 1;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;          /* убираем браузерный скролл */
  touch-action: none;        /* отключаем swipe-to-refresh */
}

.app {
  width: calc(var(--design-w) * 1px);
  height: calc(var(--design-h) * 1px);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(var(--scale));
  transform-origin: center center;
}

/* Убираем выделение текста и синий/серый тап-хайлайт на мобилке */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior-y: none; /* ключевая строка */
}

/* можно дополнительно на корневой игровой контейнер */
.app {
  overscroll-behavior-y: none;
}

/* ===== FINAL PATCH: music + lang ===== */

/* 1) Убиваем ЛЮБУЮ системную обводку/appearance в Chrome */
#langToggleBtn,
.music-toggle{
  -webkit-appearance: none !important;
  appearance: none !important;
  outline: none !important;
  box-shadow: none !important;
  border: 0 !important;          /* на случай если где-то появился border */
  background-clip: padding-box;  /* чтобы не было странных подсветок по краям */
}

/* Даже при фокусе/клике */
#langToggleBtn:focus,
#langToggleBtn:focus-visible,
.music-toggle:focus,
.music-toggle:focus-visible{
  outline: none !important;
  box-shadow: none !important;
}

/* 2) Позиционирование: язык СПРАВА от звука */
.music-toggle{
  position: absolute;
  top: 26px;
  right: 44px;     /* твой финальный right */
}

#langToggleBtn{
  position: absolute;
  top: 26px;
  right: calc(44px - 64px - 14px); /* справа от звука? Нет: это СЛЕВА. */

  /* ВАЖНО: если хочешь СПРАВА от звука — ставим больше right, а не меньше */
}

/* СПРАВА от звука (правильная формула): */
#langToggleBtn{
  right: calc(44px + 64px + 14px);
}

/* 3) Показывать lang только в меню */
#langToggleBtn{ display: none !important; }
.view.view--active[data-view="menu"] ~ #langToggleBtn{ display: grid !important; }

/* музыка левее */
.music-toggle{ right: calc(44px + 64px + 14px) !important; }
/* язык у самого правого края */
#langToggleBtn{ right: 44px !important; }

/* Видимость языка: только НЕ в геймплейных экранах */
#langToggleBtn{ display: grid; }

/* Скрыть в самой игре и модалках игры */
.view.view--active[data-view="game"] ~ #langToggleBtn,
.view.view--active[data-view="choice"] ~ #langToggleBtn,
.view.view--active[data-view="history"] ~ #langToggleBtn,
.view.view--active[data-view="ending"] ~ #langToggleBtn{
  display: none !important;
}

#langToggleBtn{
  outline: none !important;
  box-shadow: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}
#langToggleBtn:focus,
#langToggleBtn:focus-visible{
  outline: none !important;
  box-shadow: none !important;
}

/* В конец styles.css */
#langToggleBtn {
  display: grid; /* JS управляет видимостью через style.display */
  position: absolute;
  top: 26px;
  right: calc(44px + 64px + 14px);
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 18px;
  background: var(--bg-panel);
  z-index: 9999;
  color: var(--gold);
  font-family: var(--font);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .06em;
  opacity: 0.75;
  outline: none !important;
  box-shadow: none !important;
}
#langToggleBtn:hover { transform: scale(1.06); opacity: 0.92; }
#langToggleBtn:active { transform: scale(0.98); }
#langToggleBtn::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-radius: 18px;
  pointer-events: none;
  transition: border-color .18s ease;
}
#langToggleBtn:hover::before { border-color: var(--gold); }

/* Язык — у правого края */
#langToggleBtn {
  right: 44px;
}

/* Музыка — левее языка */
.music-toggle {
  right: calc(44px + 64px + 14px); /* = 122px */
}

/* === SWAP: язык справа, музыка левее === */
.music-toggle {
  right: calc(44px + 64px + 14px) !important; /* 122px */
}
#langToggleBtn {
  right: 44px !important;
}

/* === язык левее, музыка справа === */
.music-toggle {
  right: 44px !important;
}
#langToggleBtn {
  right: calc(44px + 64px + 14px) !important; /* 122px */
}
