/* Тропа Хаоса — оформление: тёмный фиолет, окно новеллы поверх изображения,
   кнопки-действия колонками по бокам, модальные окна. */
:root {
  --bg: #0b0713;
  --bg-deep: #06040c;
  --panel: rgba(24, 15, 40, 0.62);
  --panel-strong: rgba(18, 11, 32, 0.95);
  --panel-line: rgba(168, 130, 255, 0.22);
  --panel-line-strong: rgba(178, 140, 255, 0.45);

  --text: #f2eefb;
  --muted: #a99cc4;
  --dim: #7d719c;
  --hint: #8d84a3;

  --accent: #c9a7ff;
  --accent-soft: #7b58c9;
  --accent-deep: #4a2f80;
  --glow: rgba(160, 110, 255, 0.35);
  --found: #f0cf7a;
  --found-glow: rgba(240, 207, 122, 0.28);
  --danger: #e08a9a;
  --ok: #8fd3a5;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-deep);
  color: var(--text);
  font: 17px/1.55 "Georgia", "Times New Roman", serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body {
  display: flex;
  justify-content: center;
  background: radial-gradient(120% 60% at 50% 0%, #1a1030 0%, var(--bg-deep) 60%);
}

.sprite { display: none; }

.ic {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- каркас ---------- */

#game {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
}

@media (min-width: 520px) {
  #game {
    box-shadow: 0 0 0 1px var(--panel-line), 0 24px 70px rgba(0, 0, 0, 0.75);
  }
}

/* Ширину игры на больших экранах не расширяем: баннер меню вертикальный, и в
   широком контейнере его обрезало по высоте. Колонка остаётся телефонной. */

/* ---------- шапка ---------- */

#topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: max(8px, env(safe-area-inset-top, 0px)) 9px 7px;
  background: linear-gradient(180deg, rgba(12, 8, 22, 0.96), rgba(12, 8, 22, 0.5) 75%, transparent);
  position: relative;
  z-index: 6;
}

#place {
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent);
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 14px var(--glow);
}

#location-time {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

button.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 20, 50, 0.6);
  border: 1px solid var(--panel-line);
  color: var(--muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 5px 7px;
  font: inherit;
  font-size: 12.5px;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

button.icon:hover,
button.icon:active {
  color: var(--accent);
  border-color: var(--panel-line-strong);
  background: rgba(48, 30, 78, 0.8);
}

button.icon .ic { width: 17px; height: 17px; }

/* ---------- сцена ---------- */

#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#scene {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  user-select: none;
  /* Раньше картинка была видна только с классом ready, который ставился по
     событию load. При быстрой смене фона (сон меняет кадр на каждой строке)
     load не успевал сработать, и фон «залипал» на предыдущей картинке. */
  opacity: 1;
  z-index: 1;
}

#art-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 80% at 50% 0%, #241640 0%, #120b22 55%, #08050f 100%);
}

#art-fallback span {
  color: rgba(201, 167, 255, 0.28);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 13px;
}

#scene::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(
    180deg,
    rgba(8, 5, 16, 0.55) 0%,
    rgba(8, 5, 16, 0.08) 30%,
    rgba(8, 5, 16, 0.35) 62%,
    rgba(8, 5, 16, 0.8) 100%
  );
  pointer-events: none;
}

/* ---------- колонки кнопок ---------- */

.side-actions {
  position: absolute;
  top: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  z-index: 4;
}

#actions-left { left: 8px; align-items: flex-start; }
#actions-right { right: 8px; align-items: flex-end; }
.side-actions[hidden] { display: none; }

button.act {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--text);
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
  transition: color 0.2s, transform 0.1s;
}

button.act:hover,
button.act:active { color: var(--accent); }
button.act:active { transform: translateY(1px); }

/* Боковые кнопки: иконка в скруглённой форме, подпись под ней.
   Тень у текста — чтобы читалось на светлых фонах. */
button.act.side {
  flex-direction: column;
  gap: 3px;
  width: 70px;
}

button.act.side .ic-holder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: rgba(28, 18, 48, 0.42);
  border: 1px solid var(--panel-line);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: border-color 0.2s, background 0.2s;
}

button.act.side:hover .ic-holder,
button.act.side:active .ic-holder {
  border-color: var(--panel-line-strong);
  background: rgba(58, 36, 96, 0.66);
}

button.act.side .ic { width: 22px; height: 22px; }

button.act.side .label {
  font-size: 10.5px;
  line-height: 1.2;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 8px rgba(0, 0, 0, 0.8);
}

/* Кнопка-вариант в подменю и выборах: форма, номер и текст */
button.act.choice {
  flex: 1 1 auto;
  width: 100%;
  justify-content: flex-start;
  gap: 10px;
  font-size: 14.5px;
  padding: 10px 12px;
  background: rgba(34, 22, 58, 0.62);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-md);
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

button.act.choice:hover,
button.act.choice:active {
  background: rgba(58, 36, 96, 0.8);
  border-color: var(--panel-line-strong);
  color: var(--accent);
}

button.act .num {
  flex: 0 0 auto;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: rgba(123, 88, 201, 0.32);
  border: 1px solid var(--panel-line-strong);
  color: var(--accent);
  font-size: 11.5px;
  line-height: 19px;
  text-align: center;
}

button.act .label { flex: 1 1 auto; }

/* ---------- окно новеллы: одна фраза, высота по содержимому ---------- */

/* Высота окна — по содержимому: сколько строк занимает фраза, столько места оно
   и занимает. Раньше окно было фиксированным (место под пять строк тратилось
   всегда) либо росло построчно во время печати — это и выглядело как прыганье.
   Сейчас высоту текста заранее занимает клиент: `min-height` у `#line` ставится
   по целой фразе (`fitFrameHeight`), поэтому во время печати окно стоит. */
#panel {
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 9px;
  z-index: 5;
  height: auto;
  max-height: 58%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 13px 14px 12px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

/* имя говорящего: заметно выделяется над репликой.
   Строка сворачивается плавно (высота 25px → 0): место под капсулу нужно только
   тогда, когда она есть, но исчезать рывком оно не должно — иначе текст в окне
   подскакивал бы на её высоту. */
#speaker {
  flex: 0 0 auto;
  align-self: flex-start;
  height: 25px;
  margin-bottom: 2px;
  overflow: hidden;
  transition: height 0.18s ease-out, margin-bottom 0.18s ease-out, opacity 0.18s ease-out;
  padding: 2px 10px 2px 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(123, 88, 201, 0.5), rgba(123, 88, 201, 0.08));
  border-left: 2px solid var(--accent);
  color: var(--accent);
  font-family: "Georgia", serif;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-shadow: 0 0 12px var(--glow);
}

#speaker[hidden] {
  display: block;
  height: 0;
  margin-bottom: 0;
  opacity: 0;
}

/* Фраза внутри окна.
   Высоту задаёт окно, а окну — `min-height`, который клиент ставит по целой
   фразе. Прокрутка здесь только страховка для длинной служебной строки. */
#line {
  flex: 0 1 auto;
  min-height: 1.6em;
  overflow-y: auto;
  overscroll-behavior: contain;
  transition: min-height 0.18s ease-out, opacity 0.13s ease-out;
  scrollbar-width: none;
}

/* Кадр переворачивается: прошлая фраза гаснет, новая появляется. */
#line.fading { opacity: 0; }

#line::-webkit-scrollbar { display: none; }

/* Новая фраза проявляется. Сдвига здесь нет намеренно: на время анимации
   сдвинутая строка добавляла окну лишнюю прокрутку в несколько пикселей. */
#line .line { animation-name: appear-fade; }

.line {
  margin: 0;
  color: var(--text);
  animation: appear 0.24s ease-out;
}

/* служебный текст (инвентарь, журнал) — моноширинный, второстепенный */
.line.block {
  color: var(--muted);
  white-space: pre-wrap;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.45;
}

.line.profile { color: var(--accent); }

/* подсказки и служебные сообщения — курсив, мельче, серым */
.line.note,
.line.hint {
  color: var(--hint);
  font-style: italic;
  font-size: 14px;
}

.line.error {
  color: var(--danger);
  font-style: italic;
  font-size: 14.5px;
}

.line.title {
  color: var(--accent);
  text-align: center;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 13px;
  text-shadow: 0 0 16px var(--glow);
}

@keyframes appear {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

@keyframes appear-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* находка при осмотре — жёлтым, с иконкой глаза */
#note.found {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: rgba(240, 207, 122, 0.1);
  border: 1px solid rgba(240, 207, 122, 0.3);
  color: var(--found);
  font-size: 14.5px;
  text-shadow: 0 0 12px var(--found-glow);
}

#note.found .ic { width: 18px; height: 18px; color: var(--found); }
#note.found b { color: #ffe6a8; font-weight: 600; }

#note.hint {
  margin-top: 2px;
  color: var(--hint);
  font-style: italic;
  font-size: 14px;
}

#note[hidden] { display: none; }

/* подсказка «Выберите действие выше» — второстепенная, курсивом.
   Как и имя говорящего, сворачивается плавно (19px → 0): появляется она в конце
   хода, и рывок на её высоту выглядел бы как прыжок текста. */
#panel-hint {
  flex: 0 0 auto;
  height: 19px;
  margin-top: 4px;
  overflow: hidden;
  transition: height 0.18s ease-out, margin-top 0.18s ease-out, opacity 0.18s ease-out;
  color: var(--hint);
  font-style: italic;
  font-size: 13px;
  text-align: right;
}

#panel-hint[hidden] {
  display: block;
  height: 0;
  margin-top: 0;
  opacity: 0;
}

/* нижняя строка окна: далее / пропустить.
   Строка сворачивается плавно (43px → 0), а кнопки внутри сохраняют своё место:
   иначе в конце хода окно перекраивалось бы рывком. */
#panel-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 43px;
  margin-top: 9px;
  padding-top: 8px;
  overflow: hidden;
  border-top: 1px solid rgba(168, 130, 255, 0.12);
  transition: height 0.18s ease-out, margin-top 0.18s ease-out, padding-top 0.18s ease-out;
}

#panel-bar[hidden] {
  display: flex;
  height: 0;
  margin-top: 0;
  padding-top: 0;
  border-top-color: transparent;
}

#panel-bar button[hidden] {
  display: inline-flex;
  visibility: hidden;
}

/* Подменю выбора и строка ввода: своя высота, фраза их не выдавливает. */
#submenu,
#command-form { flex: 0 0 auto; }

#submenu-items { max-height: 32vh; overflow-y: auto; }

/* ----------------------------------------------------------- главное меню */

#main-menu {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: #0b0814;
}

#main-menu[hidden] { display: none; }

/* Панели должны быть выше главного меню: иначе «Настройки» из меню
   открываются под непрозрачным фоном и выглядят неработающими. */
#settings-panel, #help-panel, #history-panel, #quests-panel, #inventory-panel {
  z-index: 60;
}

/* Фон меню: положите свой вертикальный gif в static/menu.gif.
   Пока его нет — берётся статичная картинка menu-bg.png, а если и её нет,
   остаётся тёмная заливка. Никаких фильтров поверх: картинку не затемняем. */
#menu-art {
  position: absolute;
  inset: 0;
  background-image: url("/static/menu.gif");
  background-repeat: no-repeat;
  background-color: var(--bg);
  /* Баннер вертикальный, а контейнер на мониторе шире по пропорциям, поэтому
     вписываем картинку целиком — иначе `cover` обрезал её сверху и снизу. */
  background-size: contain;
  background-position: center;
}

/* На телефоне пропорции близки к баннеру — заполняем кадр целиком. */
@media (max-aspect-ratio: 3/5) {
  #menu-art {
    background-size: cover;
    background-position: center top;
  }
}

/* Заголовок и подзаголовок уже есть на самой картинке, поэтому текст в разметке
   скрыт визуально, но остаётся для доступности и поиска. */
#menu-title,
#menu-subtitle {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Кнопки — в правой части кадра, по центру по высоте: там на картинке
   свободное место между домами.
   Отступ задан в пикселях, а не в процентах: контейнер игры ограничен по
   ширине, поэтому проценты на большом экране считались от 480 px и сдвиг
   был почти незаметен. Больше число — кнопки левее. */
#menu-buttons {
  position: absolute;
  z-index: 1;
  top: 75%;
  right: 40px;
  transform: translateY(-58%);
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 40%;
  max-width: 200px;
  min-width: 132px;
}

/* Строка версии — внизу кадра, по центру */
#menu-version {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 16px;
  margin: 0;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: #cfc2ea;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.98), 0 1px 3px rgba(0, 0, 0, 1);
}

#menu-version[hidden] { display: none; }

button.menu-btn {
  padding: 9px 10px;
  font: inherit;
  font-size: 13px;
  color: #ece5ff;
  background: rgba(20, 12, 36, 0.5);
  border: 1px solid rgba(168, 130, 255, 0.3);
  border-radius: 11px;
  cursor: pointer;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.95);
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}

button.menu-btn:hover,
button.menu-btn:focus-visible {
  background: rgba(48, 28, 86, 0.8);
  border-color: rgba(190, 155, 255, 0.6);
  outline: none;
}

button.menu-btn:active { transform: translateY(1px); }

button.menu-btn.primary {
  background: rgba(88, 52, 158, 0.8);
  border-color: rgba(200, 170, 255, 0.65);
}

/* Отдельного правила для широких экранов больше нет: отступ в пикселях
   одинаково работает на любом размере, а картинка масштабируется по ширине
   контейнера. Так значение `right` в основном правиле — единственное. */

/* ------------------------------------------------------- окно ввода имени */

#name-screen {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 4, 12, 0.88);
}

#name-screen[hidden] { display: none; }

#name-inner {
  width: min(84%, 320px);
  text-align: center;
}

#name-title {
  margin: 0 0 16px;
  font-size: 19px;
  font-weight: normal;
  letter-spacing: 0.6px;
  color: #efe8ff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}

#name-form {
  display: flex;
  gap: 8px;
}

#name-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 11px 12px;
  font: inherit;
  font-size: 15px;
  color: #f2ecff;
  background: rgba(20, 13, 36, 0.9);
  border: 1px solid var(--panel-line-strong);
  border-radius: 12px;
  outline: none;
}

#name-input:focus { border-color: var(--accent); }

#name-submit {
  flex: 0 0 auto;
  padding: 11px 16px;
  font: inherit;
  font-size: 14px;
  color: #f4efff;
  background: rgba(96, 58, 168, 0.9);
  border: 1px solid rgba(200, 170, 255, 0.7);
  border-radius: 12px;
  cursor: pointer;
}

#name-submit:active { transform: translateY(1px); }

button.panel-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(34, 22, 58, 0.55);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  padding: 6px 11px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

button.panel-btn:hover,
button.panel-btn:active {
  background: rgba(58, 36, 96, 0.75);
  border-color: var(--panel-line-strong);
}

button.panel-btn[hidden] { display: none; }

button.panel-btn.primary { animation: pulse 1.7s ease-in-out infinite; }

button.panel-btn.quiet {
  color: var(--hint);
  font-size: 12px;
  padding: 5px 9px;
}

button.panel-btn .ic { width: 15px; height: 15px; }

/* ---------- подменю ---------- */

#submenu { margin-top: 6px; overflow-y: auto; }
#submenu[hidden] { display: none; }

#submenu-title {
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

#submenu-items { display: flex; flex-direction: column; gap: 6px; }

/* Варианты в две колонки: чётное число делится ровно, а нечётный последний
   вариант занимает всю строку целиком. */
#submenu-items.two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
}

#submenu-items.odd-last-wide > :last-child {
  grid-column: 1 / -1;
}

.submenu-note {
  color: var(--hint);
  font-style: italic;
  font-size: 13.5px;
}

/* ---------- ручной ввод ---------- */

#command-form { display: flex; gap: 7px; margin-top: 8px; }
#command-form[hidden] { display: none; }

#command {
  flex: 1 1 auto;
  min-width: 0;
  background: rgba(10, 6, 18, 0.72);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 11px;
  font: inherit;
  font-size: 14.5px;
}

#command:focus { outline: none; border-color: var(--accent-soft); }

#command-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--accent-soft), var(--accent-deep));
  border: none;
  border-radius: var(--radius-sm);
  color: #f3ecff;
  min-width: 44px;
  cursor: pointer;
}

#command-form button .ic { width: 19px; height: 19px; }

/* ---------- нижняя строка ---------- */

#hintbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 14px calc(8px + var(--safe-bottom));
  min-height: 8px;
}

#hintbar[hidden] { display: none; }

@keyframes pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* ---------- модальные окна ---------- */

#history-panel,
#help-panel,
#settings-panel,
#quests-panel,
#inventory-panel {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: 12px 12px calc(12px + var(--safe-bottom));
  background: rgba(8, 5, 16, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

#history-panel[hidden],
#help-panel[hidden],
#settings-panel[hidden],
#quests-panel[hidden],
#inventory-panel[hidden] { display: none; }

#history-panel header,
#help-panel header,
#settings-panel header,
#quests-panel header,
#inventory-panel header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--panel-strong);
  color: var(--accent);
  letter-spacing: 0.1em;
  font-size: 14.5px;
}

#history-panel .spacer,
#help-panel .spacer,
#settings-panel .spacer,
#quests-panel .spacer,
#inventory-panel .spacer { flex: 1 1 auto; }

#history-body,
#help-body,
.settings-body,
#quests-body,
#inventory-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px;
  background: var(--panel-strong);
  border: 1px solid var(--panel-line);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

#history-body .line { animation: none; }

/* история: повторяем вид реплик */
#history-body .speaker {
  margin: 10px 0 2px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#help-body p { margin: 0 0 7px; font-size: 14px; }

#help-body p.section,
.settings-body p.section,
#quests-detail p.section {
  margin: 14px 0 7px;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 11.5px;
}

#help-body p.section:first-child,
.settings-body p.section:first-child { margin-top: 0; }

#help-body b { color: var(--accent); font-weight: 600; }

#help-body code {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 13px;
  color: #d9c8ff;
  background: rgba(123, 88, 201, 0.18);
  border-radius: 5px;
  padding: 1px 5px;
}

/* ---------- настройки ---------- */

.settings-body .hint-line {
  color: var(--hint);
  font-style: italic;
  font-size: 13.5px;
  margin: 0 0 7px;
}

.speed-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
  margin-bottom: 8px;
}

.speed-row button.speed {
  background: rgba(34, 22, 58, 0.7);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-md);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 10px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.speed-row button.speed:hover { border-color: var(--panel-line-strong); }

.speed-row button.speed.active {
  background: linear-gradient(180deg, rgba(123, 88, 201, 0.6), rgba(74, 47, 128, 0.6));
  border-color: var(--accent);
  color: #f6f0ff;
  box-shadow: 0 0 18px var(--glow);
}

/* ---------- журнал заданий ---------- */

#quests-panel .tabs {
  display: flex;
  gap: 6px;
  padding: 10px 10px 0;
  background: var(--panel-strong);
  border-left: 1px solid var(--panel-line);
  border-right: 1px solid var(--panel-line);
}

#quests-panel .tab {
  flex: 1 1 0;
  background: rgba(34, 22, 58, 0.7);
  border: 1px solid var(--panel-line);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  padding: 8px 6px;
  cursor: pointer;
}

#quests-panel .tab.active {
  background: rgba(123, 88, 201, 0.35);
  border-color: var(--panel-line-strong);
  color: #f6f0ff;
}

#quests-body { display: flex; flex-direction: column; gap: 10px; }

#quests-list { display: flex; flex-direction: column; gap: 6px; }

button.quest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(34, 22, 58, 0.6);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-md);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  padding: 10px 11px;
  cursor: pointer;
  text-align: left;
}

button.quest-item:hover { border-color: var(--panel-line-strong); }

button.quest-item.active {
  background: rgba(123, 88, 201, 0.28);
  border-color: var(--panel-line-strong);
}

button.quest-item .quest-title { flex: 1 1 auto; }

.quest-status {
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
}

.quest-status.active { color: var(--accent); }
.quest-status.completed { color: var(--ok); }
.quest-status.failed { color: var(--danger); }
.quest-status.not_started { color: var(--dim); }

#quests-detail {
  border-top: 1px solid var(--panel-line);
  padding-top: 10px;
}

#quests-detail[hidden] { display: none; }

#quests-detail h3 {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 17px;
  letter-spacing: 0.02em;
}

#quests-detail .quest-status { display: inline-block; margin-bottom: 8px; }

#quests-detail .quest-description {
  margin: 0 0 8px;
  font-size: 14.5px;
  color: var(--text);
}

.quest-objectives {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
}

.quest-objectives li { margin-bottom: 4px; }

/* ---------- инвентарь ---------- */

.inventory-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inventory-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(34, 22, 58, 0.6);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-md);
  font-size: 14.5px;
}

.inventory-list .item-name { flex: 1 1 auto; }

.inventory-list .item-amount {
  color: var(--accent);
  font-size: 13.5px;
  letter-spacing: 0.04em;
}
