/* =========================================================
   Witcher 3 UI — за зразком меню інвентаря/персонажа гри:
   без рамок-панелей, контент на темряві, DIN-капс заголовки,
   сітка слотів з кольором рідкості, золото для дій.
   Анімації — лише transform/opacity, щоб не навантажувати GPU.
   ========================================================= */

/* Roboto Condensed (Apache 2.0 / OFL) — змінний шрифт, лише кирилиця й латиниця, розміщено на власному сайті */
@font-face {
  font-family: 'Roboto Condensed';
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url('../fonts/roboto-condensed-cyrillic-italic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Roboto Condensed';
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url('../fonts/roboto-condensed-latin-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Roboto Condensed';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../fonts/roboto-condensed-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Roboto Condensed';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../fonts/roboto-condensed-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --accent: #c9a05a;           /* колір героя (дим, смуги характеру) */
  --head: #ececec;             /* заголовки розділів */
  --text: #d9d9d9;             /* основні значення */
  --muted: #a3a3a3;            /* підписи */
  --faint: #8a847a;            /* дрібні мітки */
  --action: #e1a64e;           /* інтерактивний текст, як «Sort Items» */
  --item: #d6b77c;             /* назви предметів і квестів */
  --line: rgba(255, 255, 255, 0.12);
  --line-gold: rgba(201, 160, 90, 0.45);
  --cell: rgba(10, 10, 10, 0.72);
  --cell-edge: rgba(255, 255, 255, 0.1);
  --select: #d9b25c;           /* жовта рамка виділення */
  --surface: rgba(14, 14, 14, 0.97);
  --bg: #0a0a0a;
  --font: 'Roboto Condensed', 'Arial Narrow', 'Segoe UI', sans-serif;
  --gap: clamp(14px, 1.6vw, 26px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
/* Курсор у стилі гри: сталева стрілка, золота — над активними елементами */
html { cursor: url('../img/ui/cursor.svg') 3 2, auto; }
a, button, [role="tab"], .slot, .medal, label {
  cursor: url('../img/ui/cursor-hover.svg') 3 2, pointer;
}
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-x: clip;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, p, ul, dl, dd, blockquote { margin: 0; padding: 0; }
ul { list-style: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 1px solid var(--select); outline-offset: 2px; }

/* ---------------- Завантаження ---------------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: #0a0a0a;
  transition: opacity 0.6s ease, visibility 0.6s;
}
.loader img { width: 76px; animation: medallion 1.6s ease-in-out infinite; }
.loader.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader.is-done img { animation: none; }
@keyframes medallion {
  0%, 100% { transform: rotate(-6deg) scale(0.96); opacity: 0.7; }
  50% { transform: rotate(6deg) scale(1.04); opacity: 1; }
}

/* ---------------- Фон: відеопетля героя ---------------- */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg); }
.backdrop__scene, .backdrop__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: center / cover no-repeat;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.backdrop__scene.is-on { opacity: 1; }
.backdrop__video.is-on { opacity: 1; }
/* Затемнення під контентом: ліворуч щільніше, за героєм прозоріше — сцену видно */
.backdrop__vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)),
    linear-gradient(90deg, rgba(8, 8, 8, 0.86) 0%, rgba(8, 8, 8, 0.7) 40%, rgba(8, 8, 8, 0.38) 72%, rgba(8, 8, 8, 0.55) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, transparent 22%, transparent 70%, rgba(0, 0, 0, 0.8) 100%);
}
.backdrop__grain { display: none; }
@media (max-width: 1199px) {
  .backdrop__vignette { background: linear-gradient(180deg, rgba(8, 8, 8, 0.55), rgba(8, 8, 8, 0.82) 45%, rgba(8, 8, 8, 0.9)); }
}

/* ---------------- Каркас ---------------- */
.app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
  max-width: 1760px;
  margin: 0 auto;
  padding: 0 max(clamp(16px, 2.4vw, 44px), env(safe-area-inset-right)) 0 max(clamp(16px, 2.4vw, 44px), env(safe-area-inset-left));
}

/* ---------------- Верхня панель ---------------- */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 12px 0 8px;
}
.topbar__logo { justify-self: start; }
.topbar__logo img { width: clamp(110px, 8.5vw, 150px); height: auto; }
.topbar__tools { justify-self: end; display: flex; align-items: center; gap: 10px; }

/* Персонажі — великі портрети як вкладки меню */
.heroes { display: flex; align-items: center; gap: clamp(8px, 1.2vw, 18px); min-width: 0; }
.heroes__list { display: flex; gap: clamp(18px, 2.3vw, 36px); min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 6px 6px 12px; }
.heroes__list::-webkit-scrollbar { display: none; }
.heroes__arrow {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: 26px;
  border: 0;
  background: none;
  opacity: 0.55;
  transition: opacity 0.2s, transform 0.2s;
}
.heroes__arrow::before { content: ''; border: 7px solid transparent; }
.heroes__arrow--prev::before { border-right: 11px solid var(--muted); border-left: 0; }
.heroes__arrow--next::before { border-left: 11px solid var(--muted); border-right: 0; }
.heroes__arrow:hover { opacity: 1; }
.heroes__arrow--prev:hover { transform: translateX(-3px); }
.heroes__arrow--next:hover { transform: translateX(3px); }

.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  flex: none;
  color: var(--muted);
  text-decoration: none;
}
.tab__avatar, .medal__avatar {
  display: block;
  border-radius: 50%;
  /* темне коло з легким світлом — щоб світле волосся Цірі не зливалось */
  background-color: #1c1b19;
  background-repeat: no-repeat;
  /* медальйон: портрет, темний зазор і тонке кільце */
  box-shadow: 0 0 0 3px #0a0a0a, 0 0 0 4px rgba(255, 255, 255, 0.24);
  transition: box-shadow 0.25s, filter 0.25s, transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.tab__avatar {
  width: clamp(54px, 4.3vw, 74px);
  height: clamp(54px, 4.3vw, 74px);
  filter: grayscale(0.3) brightness(0.85);
}
.tab__name {
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.2s;
}
.tab:hover .tab__avatar { filter: none; transform: translateY(-2px); box-shadow: 0 0 0 3px #0a0a0a, 0 0 0 4px rgba(255, 255, 255, 0.55); }
.tab:hover .tab__name { color: var(--text); }
.tab.is-active .tab__avatar {
  filter: none;
  box-shadow: 0 0 0 3px #0a0a0a, 0 0 0 5px var(--select), 0 8px 20px rgba(0, 0, 0, 0.6);
  transform: scale(1.05);
}
.tab.is-active .tab__name { color: var(--head); }
.tab.is-active::after {
  /* ромбик-індикатор, як крапка пейджера в грі */
  content: '';
  position: absolute;
  bottom: -12px;
  width: 5px;
  height: 5px;
  background: var(--select);
  transform: rotate(45deg);
}

/* Кнопки-плашки праворуч */
.tool {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.5);
  color: var(--muted);
  font: 400 0.9rem/1 var(--font);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  transition: border-color 0.25s, color 0.25s, background 0.25s;
}
.tool::before {
  /* відблиск, що пробігає при наведенні */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(225, 166, 78, 0.22) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.6s ease;
}
.tool:hover::before { transform: translateX(120%); }
.tool:hover { border-color: var(--line-gold); color: var(--action); background: rgba(20, 16, 10, 0.6); }
.tool svg { width: 15px; height: 15px; transition: transform 0.25s; }
.tool--link:hover svg { transform: translate(2px, -2px); }
/* Перемикач мови: круглий прапор у тонкому кільці, як медальйони героїв */
.tool--lang { gap: 9px; padding: 0 14px; }
.tool--lang .flag {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #0a0a0a, 0 0 0 3px rgba(255, 255, 255, 0.22);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s;
}
.tool--lang:hover .flag { transform: rotate(-12deg) scale(1.12); box-shadow: 0 0 0 2px #0a0a0a, 0 0 0 3px var(--select); }

/* Іконка звуку: динамік; вимкнено — хрестик, увімкнено — хвилі, що «дихають» */
.tool .snd { width: 22px; height: 22px; overflow: visible; }
.snd path { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.snd__body { fill: currentColor !important; fill-opacity: 0.18; transform-origin: 8px 12px; transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.snd__wave { opacity: 0; transform-origin: 11px 12px; transform: scale(0.6); transition: opacity 0.3s, transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }
.snd__off { stroke-dasharray: 8; stroke-dashoffset: 0; transition: stroke-dashoffset 0.35s ease, opacity 0.35s; }
.tool--sound:hover .snd__body { transform: scale(1.08); }
.tool--sound:hover .snd__off { transform: rotate(90deg); transform-origin: 18.5px 12px; transition: transform 0.4s, stroke-dashoffset 0.35s; }
.tool--sound[aria-pressed="true"] { color: var(--action); border-color: var(--line-gold); }
.tool--sound[aria-pressed="true"] .snd__off { stroke-dashoffset: 8; opacity: 0; }
.tool--sound[aria-pressed="true"] .snd__wave { opacity: 1; transform: scale(1); }
.tool--sound[aria-pressed="true"] .snd__wave--1 { animation: wave 1.6s ease-in-out infinite; }
.tool--sound[aria-pressed="true"] .snd__wave--2 { animation: wave 1.6s ease-in-out 0.25s infinite; }
@keyframes wave { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.88); } }
/* імпульс при перемиканні */
.tool--sound::after {
  content: '';
  position: absolute;
  left: 27px;
  top: 50%;
  width: 60px;
  height: 60px;
  margin: -30px 0 0 -30px;
  border-radius: 50%;
  border: 1px solid var(--action);
  opacity: 0;
  pointer-events: none;
}
.tool--sound.is-entering::after { animation: ripple 0.7s ease-out; }
@keyframes ripple { from { opacity: 0.9; transform: scale(0.2); } to { opacity: 0; transform: scale(2.6); } }

/* ---------------- Кнопки дії (як «[F] Sort Items» у грі) ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 38px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.55);
  color: var(--action);
  font: 400 1rem/1 var(--font);
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.btn:hover { border-color: var(--line-gold); background: rgba(201, 160, 90, 0.1); color: #f0bd68; }
.btn--action { min-height: 44px; padding: 8px 18px; font-size: 1.08rem; }
.btn--action img { width: auto; height: 26px; }

/* ---------------- Розділи ---------------- */
.block { display: flex; flex-direction: column; min-height: 0; }
.block__title {
  position: relative;
  margin-bottom: 14px;
  padding-bottom: 12px;
  color: var(--head);
  font: 400 clamp(1.05rem, 1.15vw, 1.25rem)/1 var(--font);
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
}
.block__title::after {
  /* тонка лінія з шевроном посередині, як роздільники в грі */
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 9px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='9'%3E%3Cpath d='M1 1h14L8 8z' fill='%230a0a0a' stroke='%23a3895a' stroke-width='1'/%3E%3C/svg%3E") center top / 16px 9px no-repeat,
    linear-gradient(90deg, transparent, var(--line) 20%, var(--line) 80%, transparent) center 1px / 100% 1px no-repeat;
}

/* ---------------- Перемикач підрозділів: видно, що це кнопки ---------------- */
.lore__tabs {
  position: relative;
  display: flex;
  align-self: center;
  margin: 0 auto 16px;
  padding: 3px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.5);
}
.lore__tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  overflow: hidden;
  border: 0;
  background: none;
  color: var(--muted);
  font: 400 clamp(0.92rem, 1vw, 1.05rem)/1 var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.2s, background 0.2s;
}
.lore__tab:hover { color: var(--head); background: rgba(255, 255, 255, 0.06); }
.lore__tab.is-active {
  color: var(--head);
  background: linear-gradient(180deg, rgba(201, 160, 90, 0.24), rgba(201, 160, 90, 0.08));
  box-shadow: inset 0 -2px 0 var(--select);
}
.lore__count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid currentColor;
  font-size: 0.72rem;
  letter-spacing: 0;
  opacity: 0.7;
}
.lore__tab.is-active .lore__count { color: var(--select); opacity: 1; }
/* неактивна вкладка двічі ледь помітно зблискує — підказка, що її можна відкрити */
.lore__tab:not(.is-active)::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(225, 166, 78, 0.28) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: invite 2.4s ease-in-out 1.5s 2;
}
@keyframes invite { 0% { transform: translateX(-120%); } 45%, 100% { transform: translateX(120%); } }
.lore__sep { display: none; }
.lore__pane.is-entering { animation: rise 0.35s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; }

/* ---------------- Сітка екрана ---------------- */
.screen {
  display: grid;
  gap: var(--gap);
  padding: 8px 0 var(--gap);
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
}
.col { display: flex; flex-direction: column; gap: var(--gap); min-height: 0; min-width: 0; }
/* Телефон: герой → галерея й знаки → журнал і спорядження */
.col--hero { order: -1; }
.col--mid { order: 0; }
.col--left { order: 1; }

/* Планшет: герой поруч із журналом, нижче — галерея і знаки в два стовпці */
@media (min-width: 760px) {
  .screen { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .col--hero { grid-column: 2; grid-row: 1; }
  .col--left { grid-column: 1; grid-row: 1; }
  .col--mid {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    align-items: start;
  }
}

/* Десктоп: три колонки, персонаж праворуч як модель в інвентарі */
@media (min-width: 1200px) {
  .screen { grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr) minmax(0, 0.92fr); }
  .col--left { grid-column: 1; grid-row: 1; }
  .col--mid { grid-column: 2; grid-row: 1; display: flex; align-items: stretch; }
  .col--hero { grid-column: 3; grid-row: 1; }
  /* модель займає верх колонки, картка — під нею, без перекриття */
  .hero { position: relative; min-height: 680px; justify-content: flex-start; gap: 10px; }
  .hero .hero__figure { position: relative; flex: 1 1 0; min-height: 0; align-items: flex-end; margin-top: -4%; }
  .hero .hero__figure img {
    height: 100%;
    max-height: none;
    -webkit-mask: linear-gradient(180deg, transparent 0, #000 7%, #000 86%, transparent);
            mask: linear-gradient(180deg, transparent 0, #000 7%, #000 86%, transparent);
  }
  .hero .hero__info { position: relative; flex: none; max-width: 520px; gap: 10px; }
  /* компактна картка: характеристики у дві колонки */
  .hero .hero__card { padding: 12px 16px 12px; }
  .hero .stats { grid-template-columns: 1fr 1fr; column-gap: 18px; }
  .hero .stats div { padding: 6px 0; flex-direction: column; align-items: flex-start; gap: 1px; }
  .hero .stats dt { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
  .hero .stats dd { text-align: left; font-size: 0.95rem; }
  .hero .hero__bio { margin-top: 8px; font-size: 0.9rem; }
}

/* Достатньо висоти — увесь екран без скролу; на нижчих екранах сторінка просто прокручується */
@media (min-width: 1200px) and (min-height: 620px) {
  html, body { overflow: hidden; overflow: clip; }
  .app { height: 100vh; height: 100dvh; min-height: 0; }
  .screen { min-height: 0; align-content: stretch; grid-template-rows: minmax(0, 1fr); }
  .journal, .gallery { flex: 1 1 0; }
  .hero { min-height: 0; }
}

/* Поява при зміні героя */
.screen.is-entering .block,
.screen.is-entering .hero__info { animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; }
.screen.is-entering .col--mid .block { animation-delay: 0.06s; }
.screen.is-entering .hero__figure img { animation: emerge 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; }
.screen.is-entering .hero__info { animation-delay: 0.1s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes emerge { from { opacity: 0; transform: translateY(14px) scale(0.98); } }

/* ---------------- Персонаж ---------------- */
.hero { justify-content: flex-end; gap: 12px; }
.hero__figure {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 320px;
}
.hero__figure img {
  position: relative;
  max-height: 100%;
  width: auto;
  object-fit: contain;
  -webkit-mask: linear-gradient(180deg, #000 78%, transparent);
          mask: linear-gradient(180deg, #000 78%, transparent);
}
@media (max-width: 1199px) { .hero__figure img { max-height: min(60vh, 520px); } }

/* Аура: світіння, дим і жар за героєм */
.aura { position: absolute; inset: 0; pointer-events: none; overflow: hidden; overflow: clip; }
.aura__glow {
  position: absolute;
  left: 50%;
  top: 26%;
  width: 92%;
  aspect-ratio: 1;
  margin-left: -46%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 50%, transparent), transparent);
  opacity: 0.7;
  will-change: transform, opacity;
  animation: glow 7s ease-in-out infinite alternate;
}
@keyframes glow { to { opacity: 0.85; transform: scale(1.1); } }
/* Дим: готові текстури з прозорими краями (assets/img/fx) — браузер не рахує шум і маски щокадру */
.aura__smoke {
  position: absolute;
  inset: -4% -16%;
  background: center / 100% 100% no-repeat;
  opacity: 0.6;
  will-change: transform;
}
.aura__smoke--a { background-image: url('../img/fx/smoke-a.webp'); animation: smoke-a 34s linear infinite alternate; }
.aura__smoke--b { background-image: url('../img/fx/smoke-b.webp'); opacity: 0.45; animation: smoke-b 46s linear infinite alternate; }
.aura__smoke--c { display: none; }
@keyframes smoke-a { from { transform: translate3d(-3%, 2%, 0) rotate(-2deg) scale(1); } to { transform: translate3d(4%, -5%, 0) rotate(3deg) scale(1.08); } }
@keyframes smoke-b { from { transform: scaleX(-1) translate3d(-3%, -2%, 0); } to { transform: scaleX(-1) translate3d(5%, -8%, 0) scale(1.1); } }
.aura__embers { position: absolute; inset: 0; }
.aura__embers i {
  position: absolute;
  bottom: 18%;
  left: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 70%, #fff);
  opacity: 0;
  animation: ember 9s linear infinite;
}
.aura__embers i:nth-child(1)  { left: 30%; animation-duration: 8s;  animation-delay: -1s; }
.aura__embers i:nth-child(2)  { left: 42%; animation-duration: 11s; animation-delay: -4s; }
.aura__embers i:nth-child(3)  { left: 55%; animation-duration: 9s;  animation-delay: -6s; }
.aura__embers i:nth-child(4)  { left: 63%; animation-duration: 12s; animation-delay: -2s; }
.aura__embers i:nth-child(5)  { left: 36%; animation-duration: 10s; animation-delay: -8s; width: 2px; height: 2px; }
.aura__embers i:nth-child(6)  { left: 70%; animation-duration: 7s;  animation-delay: -3s; width: 2px; height: 2px; }
.aura__embers i:nth-child(7)  { left: 48%; animation-duration: 13s; animation-delay: -9s; }
.aura__embers i:nth-child(8)  { left: 25%; animation-duration: 9s;  animation-delay: -5s; width: 2px; height: 2px; }
.aura__embers i:nth-child(9)  { left: 58%; animation-duration: 8s;  animation-delay: -7s; width: 2px; height: 2px; }
.aura__embers i:nth-child(10) { left: 75%; animation-duration: 11s; animation-delay: -10s; }
@keyframes ember {
  0% { opacity: 0; transform: translate3d(0, 0, 0); }
  15% { opacity: 0.9; }
  70% { opacity: 0.5; }
  100% { opacity: 0; transform: translate3d(28px, -320px, 0); }
}

/* Картка персонажа — як підказка предмета в інвентарі гри:
   назва ліворуч, тип праворуч, золота лінія, рядки характеристик */
.hero__info { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 12px; width: 100%; max-width: 460px; margin: 0 auto; }
.hero__card {
  padding: 14px 18px 16px;
  background: rgba(14, 14, 14, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.65);
}
.hero__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(201, 160, 90, 0.5);
}
.hero__name {
  color: var(--head);
  font: 400 clamp(1.7rem, 2vw, 2.15rem)/1 var(--font);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.hero__epithet {
  max-width: 52%;
  color: #8f8f8f;
  font-size: 0.74rem;
  line-height: 1.35;
  letter-spacing: 0.08em;
  text-align: right;
  text-transform: uppercase;
}
.stats { display: grid; }
.stats div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.stats dt { color: var(--muted); font-size: 0.94rem; }
.stats dd { color: var(--text); font-size: 0.96rem; text-align: right; }
.hero__bio { margin-top: 10px; color: var(--muted); font-size: 0.94rem; line-height: 1.45; }
.hero__bio b { color: var(--text); font-weight: 400; }
.hero__info .btn--action { align-self: center; }

/* ---------------- Журнал (список квестів) ---------------- */
.journal__viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.journal__viewport::before, .journal__viewport::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 14%;
  z-index: 1;
  pointer-events: none;
}
.journal__viewport::before { top: 0; background: linear-gradient(rgba(10, 10, 10, 0.92), rgba(10, 10, 10, 0)); }
.journal__viewport::after { bottom: 0; background: linear-gradient(rgba(10, 10, 10, 0), rgba(10, 10, 10, 0.92)); }
@media (max-width: 1199px), (max-height: 619px) { .journal__viewport { height: 320px; flex: none; } }
.journal__list { will-change: transform; animation: ticker var(--dur, 30s) linear infinite; }
.journal__viewport:hover .journal__list,
.journal__viewport:focus-within .journal__list { animation-play-state: paused; }
@keyframes ticker { to { transform: translateY(-50%); } }
.entry {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 14px;
  align-items: center;
  padding: 9px 10px;
  transition: background 0.2s;
}
.entry:hover { background: linear-gradient(90deg, rgba(201, 160, 90, 0.12), transparent 80%); }
.entry__icon { width: 46px; height: 46px; object-fit: cover; border: 1px solid var(--cell-edge); background: #000; }
.entry__place { color: var(--faint); font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; }
.entry__title { color: var(--text); font: 400 1.06rem/1.2 var(--font); }
.entry:hover .entry__title { color: var(--item); }
.entry__sub { color: var(--muted); font-size: 0.9rem; line-height: 1.3; }

/* ---------------- Слоти інвентаря ---------------- */
.slots { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px 6px; }
@media (max-width: 520px) { .slots { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.slot {
  --r: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
}
.slot img {
  width: 100%;
  max-width: 82px;
  aspect-ratio: 1;
  object-fit: contain;
  padding: 10%;
  border: 1px solid var(--cell-edge);
  background: linear-gradient(0deg, var(--r) 0%, transparent 80%), var(--cell);
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: outline-color 0.15s, transform 0.2s;
}
.slot span { font-size: 0.88rem; }
.slot:hover img, .slot:focus-visible img { outline-color: var(--select); transform: translateY(-2px); }
.slot:hover span, .slot:focus-visible span { color: var(--text); }
.slot:focus-visible { outline: none; }
/* Кольори рідкості — фон клітинки, як у грі */
.rarity-master { --r: rgba(36, 74, 170, 0.75); }
.rarity-magic { --r: rgba(170, 128, 24, 0.7); }
.rarity-witcher { --r: rgba(28, 118, 44, 0.78); }

/* ---------------- Риси характеру (як шкала досвіду) ---------------- */
.traits { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 28px; padding: 2px 4px; }
.traits__row { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--muted); }
.traits__row span:last-child { color: var(--text); }
.bar { height: 4px; background: rgba(255, 255, 255, 0.08); }
.bar i {
  display: block;
  height: 100%;
  width: var(--v);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.35), var(--accent));
  transform-origin: left;
  animation: fill 1s cubic-bezier(0.2, 0.7, 0.2, 1) backwards 0.2s;
}
@keyframes fill { from { transform: scaleX(0); } }

/* ---------------- Медальйони: знаки, школи, стосунки ---------------- */
.medals { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
@media (max-width: 520px) { .medals { grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); row-gap: 14px; } }
.medal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
}
.medal img { width: clamp(40px, 3.3vw, 54px); height: clamp(40px, 3.3vw, 54px); object-fit: contain; }
.medal:hover, .medal:focus-visible { color: var(--text); outline: none; }

/* Знаки: «дихають» своїм кольором, при наведенні — імпульс кола */
.medal__icon { position: relative; display: grid; place-items: center; }
.medal__icon::before {
  content: '';
  position: absolute;
  inset: -30%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--sign) 55%, transparent), transparent);
  opacity: 0.32;
  transition: opacity 0.3s;
}
.medal__icon::after {
  content: '';
  position: absolute;
  inset: -6%;
  border-radius: 50%;
  border: 1px solid var(--sign);
  opacity: 0;
}
.medal__icon img { position: relative; transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes breathe { 50% { opacity: 0.55; transform: scale(1.12); } }
.medal--sign:hover .medal__icon img,
.medal--sign:focus-visible .medal__icon img { transform: translateY(-3px) scale(1.12); }
.medal--sign:hover .medal__icon::before,
.medal--sign:focus-visible .medal__icon::before { opacity: 0.85; animation-play-state: paused; }
.medal--sign:hover .medal__icon::after,
.medal--sign:focus-visible .medal__icon::after { animation: cast 1.3s ease-out infinite; }
@keyframes cast { from { opacity: 0.9; transform: scale(0.7); } to { opacity: 0; transform: scale(1.8); } }

/* Школи: срібний відблиск пробігає по медальйону; при наведенні — тремтить, як поруч із магією */
.medal__metal { position: relative; display: block; }
.medal__metal img { filter: grayscale(1) brightness(1.05); transition: filter 0.3s; }
.medal__metal::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.9) 50%, transparent 62%) 160% 0 / 260% 100% no-repeat;
  -webkit-mask: var(--mask) center / contain no-repeat;
          mask: var(--mask) center / contain no-repeat;
  opacity: 0;
}
.medal--school:hover .medal__metal::after,
.medal--school:focus-visible .medal__metal::after { opacity: 1; animation: glint 1.1s ease-out 1; }
@keyframes glint { from { background-position: 160% 0; } to { background-position: -60% 0; } }
.medal--school:hover .medal__metal img,
.medal--school:focus-visible .medal__metal img { filter: grayscale(0.3) brightness(1.3); }
.medal--school:hover .medal__metal,
.medal--school:focus-visible .medal__metal { animation: tremble 0.45s linear infinite; }
@keyframes tremble {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  20% { transform: translate(-1px, 0) rotate(-2.5deg); }
  40% { transform: translate(1px, -1px) rotate(2deg); }
  60% { transform: translate(-1px, 1px) rotate(-1.5deg); }
  80% { transform: translate(1px, 0) rotate(1.5deg); }
}

.medal__avatar { width: clamp(48px, 3.7vw, 60px); height: clamp(48px, 3.7vw, 60px); transition: border-color 0.2s, transform 0.3s; }
.medal--link:hover .medal__avatar { box-shadow: 0 0 0 3px #0a0a0a, 0 0 0 5px var(--select); transform: translateY(-3px); }

/* ---------------- Картка знака ---------------- */
.signcard {
  --sign: #e0472c;
  position: fixed;
  z-index: 60;
  width: 320px;
  padding: 16px 16px 14px;
  background: rgba(14, 14, 14, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-top: 2px solid var(--sign);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.7);
  color: #b4b4b4;
  font-size: 0.92rem;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
}
.signcard.is-on { opacity: 1; transform: none; transition: opacity 0.25s, transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.signcard__head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.signcard__rune {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--sign) 30%, transparent), transparent);
}
.signcard__rune img { position: relative; width: 42px; height: 42px; object-fit: contain; }
.signcard__fx { position: absolute; inset: 0; border-radius: 50%; }
.signcard__fx::before, .signcard__fx::after { content: ''; position: absolute; inset: 0; border-radius: 50%; }
/* Ігні — полум'я тремтить */
.signcard[data-fx="fire"] .signcard__fx::before { background: radial-gradient(closest-side, color-mix(in srgb, var(--sign) 60%, transparent), transparent); animation: flicker 0.18s steps(2) infinite alternate; }
@keyframes flicker { from { opacity: 0.55; transform: scale(0.95); } to { opacity: 0.9; transform: scale(1.06); } }
/* Аард — хвилі розходяться */
.signcard[data-fx="wave"] .signcard__fx::before,
.signcard[data-fx="wave"] .signcard__fx::after { border: 2px solid var(--sign); animation: cast 1.4s ease-out infinite; }
.signcard[data-fx="wave"] .signcard__fx::after { animation-delay: 0.7s; }
/* Ірден — рунне коло обертається */
.signcard[data-fx="rune"] .signcard__fx::before { border: 2px dashed var(--sign); animation: spin 6s linear infinite; }
.signcard[data-fx="rune"] .signcard__fx::after { inset: 8px; border: 1px dotted var(--sign); animation: spin 4s linear infinite reverse; }
/* Квен — щит переливається */
.signcard[data-fx="shield"] .signcard__fx::before { background: conic-gradient(from 0deg, transparent, color-mix(in srgb, var(--sign) 70%, transparent), transparent 40%); animation: spin 2.2s linear infinite; -webkit-mask: radial-gradient(closest-side, transparent 78%, #000 80%); mask: radial-gradient(closest-side, transparent 78%, #000 80%); }
/* Аксій — гіпнотична спіраль */
.signcard[data-fx="spiral"] .signcard__fx::before { background: repeating-conic-gradient(color-mix(in srgb, var(--sign) 40%, transparent) 0 12deg, transparent 12deg 30deg); animation: spin 5s linear infinite; opacity: 0.6; }
/* Хеліотроп — гліф-ромби */
.signcard[data-fx="glyph"] .signcard__fx::before { inset: 10px; border: 1px solid var(--sign); border-radius: 0; transform: rotate(45deg); animation: spin-diamond 7s linear infinite; }
.signcard[data-fx="glyph"] .signcard__fx::after { inset: 14px; border: 1px solid var(--sign); border-radius: 0; animation: spin 9s linear infinite reverse; opacity: 0.6; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spin-diamond { from { transform: rotate(45deg); } to { transform: rotate(405deg); } }
.signcard__type { color: #8d8d8d; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; }
.signcard__name { color: #ececec; font-size: 1.3rem; letter-spacing: 0.06em; text-transform: uppercase; }
.signcard__desc { color: #c9c9c9; line-height: 1.45; }
.signcard__alt { margin-top: 10px; padding: 8px 10px; border-left: 2px solid var(--sign); background: rgba(255, 255, 255, 0.03); }
.signcard__alt span { display: block; margin-bottom: 2px; color: var(--sign); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; }
.signcard__power { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.signcard__power span { display: block; margin-bottom: 4px; color: #8d8d8d; font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; }
.signcard__power b { display: flex; gap: 4px; }
.signcard__power i { width: 7px; height: 7px; border: 1px solid #555; transform: rotate(45deg); }
.signcard__power i.on { background: var(--sign); border-color: var(--sign); }
.signcard__label { margin-bottom: 6px; color: #8d8d8d; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; }
.signcard__best { display: flex; flex-wrap: wrap; gap: 6px; }
.signcard__best li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 3px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.35);
  color: #d9d9d9;
  font-size: 0.85rem;
}
.signcard__best img { width: 24px; height: 24px; object-fit: cover; border-radius: 50%; }
.signcard__best li > i { width: 6px; height: 6px; margin: 0 4px 0 6px; background: var(--sign); transform: rotate(45deg); }

/* ---------------- Цитата ---------------- */
.quote { display: flex; flex-direction: column; gap: 8px; padding: 0 6%; text-align: center; }
.quote p { color: var(--text); font: italic 300 clamp(1.08rem, 1.2vw, 1.28rem)/1.4 var(--font); }
.quote cite { color: var(--item); font-style: normal; font-size: 0.85rem; letter-spacing: 0.1em; text-transform: uppercase; }

/* ---------------- Галерея-стрічка ---------------- */
.reel { flex: 1; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.reel__stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--cell-edge);
  background: #000;
  cursor: url('../img/ui/cursor-hover.svg') 3 2, zoom-in;
  transition: border-color 0.2s;
}
/* без фіксованої висоти екрана — кадр завжди 16:9, як сам скриншот, обличчя не обрізаються */
@media (max-width: 1199px), (max-height: 619px) { .reel__stage { flex: none; aspect-ratio: 16 / 9; } }
.reel__stage:hover, .reel__stage:focus-visible { border-color: var(--select); outline: none; }
.reel__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;   /* обличчя зазвичай у верхній третині кадру */
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 1.1s ease;
}
.reel__img.is-tall { object-fit: contain; object-position: 50% 50%; }
.reel__blur {
  position: absolute;
  inset: -30px;
  background: center / cover no-repeat;
  background-image: radial-gradient(closest-side, #1d1c1a, #050505) !important;
  opacity: 0;
  transition: opacity 0.9s ease;
}
.reel__blur.is-on { opacity: 1; }
/* повільний наїзд камери, як у кат-сценах */
.reel__img.is-on { opacity: 1; animation: kenburns 10s ease-out forwards; }
@keyframes kenburns { from { transform: scale(1.04) translate3d(0, 0, 0); } to { transform: scale(1.14) translate3d(-1.6%, -1.2%, 0); } }
.reel__caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 40px 16px 14px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.88));
  text-align: left;
}
.reel__tag { color: var(--action); font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase; }
.reel__title { color: #f0f0f0; font-size: 1.05rem; letter-spacing: 0.06em; text-transform: uppercase; }
.reel__count {
  position: absolute;
  top: 10px;
  right: 12px;
  padding: 3px 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #cfcfcf;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
}
.reel__progress {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: var(--select);
  transform-origin: left;
  transform: scaleX(0);
}
.reel__progress.is-entering { animation: progress 6.5s linear forwards; }
.reel.is-paused .reel__progress { animation-play-state: paused; }
@keyframes progress { to { transform: scaleX(1); } }
.reel__strip { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.reel__strip::-webkit-scrollbar { display: none; }
.reel__thumb {
  flex: none;
  width: 74px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--cell-edge);
  background: #000;
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: outline-color 0.2s, transform 0.2s;
}
.reel__thumb img { width: 100%; height: 100%; object-fit: cover; opacity: 0.6; transition: opacity 0.25s; }
.reel__thumb:hover img { opacity: 0.95; }
.reel__thumb:hover { transform: translateY(-2px); }
.reel__thumb.is-active { outline-color: var(--select); }
.reel__thumb.is-active img { opacity: 1; }

/* ---------------- Підвал ---------------- */
.footer {
  padding: 6px 0 12px;
  color: var(--faint);
  font-size: 0.85rem;
  text-align: center;
}
.footer a { color: var(--action); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ---------------- Діалог квесту ---------------- */
dialog { padding: 0; border: 0; background: none; color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, 0.75); }
.quest { width: min(480px, calc(100vw - 32px)); }
.quest[open] { animation: rise 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.quest__inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
}
.quest__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-gold);
}
.quest__title { display: flex; align-items: center; gap: 10px; color: var(--item); font: 400 1.25rem/1.15 var(--font); letter-spacing: 0.04em; text-transform: uppercase; }
.quest__title img { width: 30px; height: 30px; object-fit: contain; }
.quest__kicker { flex: none; color: var(--muted); font-size: 0.82rem; letter-spacing: 0.08em; text-align: right; text-transform: uppercase; }
.quest__image { width: 100%; max-height: 210px; object-fit: contain; }
.quest__text { color: var(--muted); font-size: 1.02rem; }
.quest__text b { color: var(--text); font-weight: 400; }
.quest__reward { display: flex; align-items: center; justify-content: flex-end; gap: 10px; color: var(--muted); }
.quest__reward b { color: var(--text); font-weight: 400; font-size: 1.1rem; }
.quest__giver { color: var(--faint); font-size: 0.9rem; font-style: italic; }
.quest__actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------------- Лайтбокс ---------------- */
.lightbox { max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
.lightbox[open] { display: grid; place-items: center; animation: fade 0.3s ease; }
.lightbox::backdrop { background: rgba(0, 0, 0, 0.94); }
.lightbox__img { max-width: min(92vw, 1920px); max-height: 84vh; object-fit: contain; border: 1px solid rgba(255, 255, 255, 0.1); }
.lightbox__caption { position: fixed; bottom: 22px; left: 0; right: 0; color: #ececec; font: 400 1.05rem/1 var(--font); letter-spacing: 0.08em; text-align: center; text-transform: uppercase; }
.lightbox__nav, .lightbox__close {
  position: fixed;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.6);
  color: #e1a64e;
  font-size: 1.8rem;
  line-height: 1;
}
.lightbox__nav::before { content: ''; border: 8px solid transparent; }
.lightbox__nav--prev::before { border-right: 12px solid currentColor; border-left: 0; }
.lightbox__nav--next::before { border-left: 12px solid currentColor; border-right: 0; }
.lightbox__nav:hover, .lightbox__close:hover { border-color: rgba(201, 160, 90, 0.6); }
.lightbox__nav--prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lightbox__nav--next { right: 18px; top: 50%; transform: translateY(-50%); }
.lightbox__close { top: 18px; right: 18px; }

/* ---------------- «Новий квест» — як сповіщення в грі ---------------- */
.toast {
  position: fixed;
  top: clamp(90px, 16vh, 170px);
  left: 50%;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(640px, calc(100vw - 24px));
  text-align: center;
  pointer-events: none;
  visibility: hidden;
  transform: translateX(-50%);
}
.toast.is-on { visibility: visible; }
/* темна пляма, що відділяє сповіщення від будь-якого фону */
.toast__veil {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 150%;
  height: 150%;
  transform: translate(-50%, -46%);
  background:
    linear-gradient(90deg, transparent, rgba(4, 4, 4, 0.92) 22%, rgba(4, 4, 4, 0.92) 78%, transparent) center 62% / 100% 58% no-repeat,
    radial-gradient(closest-side, rgba(0, 0, 0, 0.75), transparent);
  opacity: 0;
  z-index: -1;
}
.toast__emblem { position: relative; display: grid; place-items: center; width: 74px; height: 74px; margin-bottom: 8px; }
.toast__emblem::before {
  /* ромб-медальйон, як рамки іконок у меню гри */
  content: '';
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(225, 166, 78, 0.85);
  background: radial-gradient(closest-side, rgba(40, 28, 10, 0.95), rgba(10, 8, 6, 0.95));
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.8), inset 0 0 0 4px rgba(225, 166, 78, 0.35);
  transform: rotate(45deg);
}
.toast__halo {
  position: absolute;
  inset: -64px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 206, 110, 0.85), rgba(235, 150, 45, 0.35) 38%, rgba(200, 110, 30, 0.12) 60%, transparent 75%);
  opacity: 0;
}
.toast__emblem img { position: relative; height: 34px; width: auto; filter: drop-shadow(0 0 6px rgba(255, 196, 94, 0.8)); }
.toast__kicker {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  color: #e9b45a;
  font: 400 0.82rem/1 var(--font);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(255, 180, 70, 0.6);
}
.toast__kicker::before, .toast__kicker::after {
  /* орнаментні лінії з ромбом, що розходяться від центру */
  content: '';
  flex: 1;
  height: 7px;
  background:
    linear-gradient(45deg, transparent 40%, #e9b45a 40% 60%, transparent 60%) right center / 7px 7px no-repeat,
    linear-gradient(90deg, transparent, rgba(233, 180, 90, 0.8)) left center / calc(100% - 10px) 1px no-repeat;
  transform: scaleX(0);
}
.toast__kicker::before { transform-origin: right; }
.toast__kicker::after {
  transform-origin: left;
  background:
    linear-gradient(45deg, transparent 40%, #e9b45a 40% 60%, transparent 60%) left center / 7px 7px no-repeat,
    linear-gradient(270deg, transparent, rgba(233, 180, 90, 0.8)) right center / calc(100% - 10px) 1px no-repeat;
}
.toast__title {
  margin-top: 10px;
  color: #f4efe4;
  font: 300 clamp(1.5rem, 2.4vw, 2.1rem)/1.1 var(--font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.9);
}
.toast.is-on .toast__veil { animation: toast-veil 5.2s ease forwards; }
.toast.is-on .toast__halo { animation: toast-halo 5.2s ease forwards; }
.toast.is-on .toast__emblem { animation: toast-pop 5.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.toast.is-on .toast__kicker, .toast.is-on .toast__title { animation: toast-text 5.2s ease forwards; }
.toast.is-on .toast__title { animation-delay: 0.12s; }
.toast.is-on .toast__kicker::before { animation: toast-line 5.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.toast.is-on .toast__kicker::after { animation: toast-line 5.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
@keyframes toast-veil { 0% { opacity: 0; } 8%, 85% { opacity: 1; } 100% { opacity: 0; } }
@keyframes toast-halo { 0% { opacity: 0; transform: scale(0.4); } 10% { opacity: 1; transform: scale(1.15); } 30%, 80% { opacity: 0.75; transform: scale(1); } 100% { opacity: 0; } }
@keyframes toast-pop { 0% { opacity: 0; transform: scale(0.6); } 8% { opacity: 1; transform: scale(1.08); } 14%, 85% { opacity: 1; transform: scale(1); } 100% { opacity: 0; } }
@keyframes toast-text { 0% { opacity: 0; transform: translateY(6px); } 10%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes toast-line { 0%, 6% { transform: scaleX(0); } 22%, 85% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }

/* ---------------- Підказка предмета ---------------- */
.tooltip {
  --r: #d6b77c;
  position: fixed;
  top: 0; left: 0;
  z-index: 60;
  width: 280px;
  padding: 12px 14px 14px;
  background: rgba(16, 16, 16, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.65);
  color: #a9a9a9;
  font-size: 0.92rem;
  pointer-events: none;
}
.tooltip__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(201, 160, 90, 0.45);
}
.tooltip__title { color: var(--r); font-size: 1rem; letter-spacing: 0.04em; text-transform: uppercase; }
.tooltip__type { color: #8d8d8d; font-size: 0.74rem; letter-spacing: 0.06em; text-align: right; text-transform: uppercase; }
.tooltip.rarity-common { --r: #e6e6e6; }
.tooltip.rarity-master { --r: #6c9cff; }
.tooltip.rarity-magic { --r: #e8b84a; }
.tooltip.rarity-witcher { --r: #59c86f; }

.noscript { position: fixed; inset: 0; z-index: 200; overflow: auto; padding: 32px; background: #0a0a0a; color: var(--text); }
.noscript h1, .noscript h2 { color: var(--item); font-weight: 400; text-transform: uppercase; letter-spacing: 0.06em; }
.noscript section { margin-top: 20px; }

/* ---------------- Адаптив ---------------- */
@media (max-width: 1000px) {
  .topbar { grid-template-columns: 1fr auto; row-gap: 10px; }
  .heroes { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
  .heroes__arrow { display: none; }
}
/* Телефони й планшети: шапка з героями завжди під рукою */
@media (max-width: 1199px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    margin: 0 calc(-1 * clamp(16px, 2.4vw, 44px));
    padding: 10px clamp(16px, 2.4vw, 44px) 6px;
    background: rgba(8, 8, 8, 0.96);
    border-bottom: 1px solid var(--line);
  }
  .hero__info { margin-top: -70px; }   /* картка трохи заходить на ноги фігури, як у грі */
  .entry { padding: 10px 6px; }
}
@media (max-width: 1000px) {
  .is-scrolled .topbar__logo, .is-scrolled .topbar__tools { display: none; }
  .is-scrolled .topbar { padding-top: 8px; }
}
@media (max-width: 760px) {
  .tab__avatar { width: 50px; height: 50px; }
  .tab__name { font-size: 0.76rem; }
  .heroes__list { gap: 14px; padding-bottom: 10px; }
  .topbar__logo img { width: 104px; }
  .tool { height: 38px; }
  .hero__name { font-size: 2.2rem; }
  .hero__figure { min-height: 0; }
  .reel__thumb { width: 64px; height: 40px; }
  .reel__caption { padding: 28px 12px 10px; }
  .reel__title { font-size: 0.95rem; }
  .medal { padding: 8px 2px; }                 /* більша зона дотику */
  /* картка знака — нижня шторка на всю ширину */
  .signcard {
    left: 8px !important;
    right: 8px;
    top: auto !important;
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: auto;
    max-height: 70vh;
    overflow: auto;
    pointer-events: auto;
  }
  .toast { top: 130px; }
  .toast__kicker { letter-spacing: 0.2em; font-size: 0.74rem; }
  .lightbox__nav { width: 44px; height: 44px; top: auto; bottom: 64px; transform: none; }
  .lightbox__caption { bottom: 24px; padding: 0 70px; font-size: 0.9rem; }
}
@media (max-width: 520px) {
  /* герої по центру; якщо не влізуть — гортаються, нічого не обрізається */
  .heroes { justify-content: center; }
  .heroes__list { gap: 8px; padding: 6px 4px 12px; }
  .heroes__list > :first-child { margin-left: auto; }
  .heroes__list > :last-child { margin-right: auto; }
  .tab { gap: 9px; min-width: 60px; }
  .tab__avatar { width: 48px; height: 48px; }
  .tab__name { font-size: 0.7rem; letter-spacing: 0.04em; }
  .tool { padding: 0 12px; }
  .tool--sound .tool__label, .tool--link .tool__label { display: none; }
  .traits { grid-template-columns: 1fr; }
  .quest__actions { flex-direction: column-reverse; }
  .quest__actions .btn { width: 100%; }
  .signcard { width: calc(100vw - 16px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .journal__viewport { overflow-y: auto; }
  .aura__smoke, .aura__embers { display: none; }
  .toast.is-on .toast__veil, .toast.is-on .toast__emblem, .toast.is-on .toast__kicker, .toast.is-on .toast__title { opacity: 1; transform: none; }
  .toast.is-on .toast__kicker::before, .toast.is-on .toast__kicker::after { transform: none; }
  .toast.is-on .toast__veil { transform: translate(-50%, -46%); }
}

/* ---------------- Невисокі екрани ноутбуків (наприкінці, щоб перекривати базові стилі) ---------------- */
/* Ноутбуки з невисоким екраном: компактніша шапка й відступи, щоб галереї лишилось місце */
@media (min-width: 1200px) and (min-height: 620px) and (max-height: 820px) {
  :root { --gap: 14px; }
  .topbar { padding: 8px 0 4px; }
  .tab__avatar { width: 52px; height: 52px; }
  .tab { gap: 6px; }
  .block__title { margin-bottom: 10px; padding-bottom: 10px; }
  .lore__tabs { margin-bottom: 10px; }
  .lore__tab { padding: 7px 13px; }
  .medal img, .medal__avatar { width: 42px; height: 42px; }
  .reel__thumb { height: 38px; width: 62px; }
  .entry { padding: 7px 10px; }
}
@media (min-width: 1200px) and (min-height: 620px) and (max-height: 740px) {
  .reel__strip { display: none; }
  .topbar { padding: 6px 0 2px; }
  .tab__avatar { width: 46px; height: 46px; }
  .tab__name { font-size: 0.76rem; }
  .hero__name { font-size: 2rem; }
  .hero .hero__info { gap: 8px; }
  .hero .hero__card { padding: 9px 14px 10px; }
  .hero .stats div { padding: 4px 0; }
  .hero .hero__name { font-size: 1.6rem; }
  .hero .stats dd, .hero .hero__bio { font-size: 0.88rem; }
  .hero .hero__bio { display: none; }
  .slot img { max-width: 64px; }
  .footer { padding: 2px 0 8px; }
}
@media (min-width: 1200px) and (min-height: 620px) and (max-height: 680px) {
  .hero__bio { display: none; }
  .block__title { margin-bottom: 8px; padding-bottom: 8px; }
}

/* Звук обрано, але браузер чекає першої дії: кнопка м'яко пульсує золотом */
.tool--sound.is-pending { color: var(--action); border-color: var(--line-gold); animation: sound-wait 1.8s ease-in-out infinite; }
.tool--sound.is-pending .snd__off { stroke-dashoffset: 8; opacity: 0; }
.tool--sound.is-pending .snd__wave { opacity: 0.45; transform: scale(1); }
@keyframes sound-wait {
  0%, 100% { box-shadow: 0 0 0 0 rgba(225, 166, 78, 0); }
  50% { box-shadow: 0 0 0 4px rgba(225, 166, 78, 0.22); }
}

/* Телефон у горизонтальному положенні: низький екран — шапка не закріплена, щоб не з'їдати третину висоти */
@media (max-width: 1199px) and (max-height: 520px) {
  .topbar { position: static; margin: 0; padding: 8px 0 4px; background: none; border-bottom: 0; }
  .is-scrolled .topbar__logo, .is-scrolled .topbar__tools { display: flex; }
  .hero__figure img { max-height: min(62vh, 300px); }
  .reel__stage { height: auto; max-height: 62vh; }
}

/* ---------------- Полегшений режим ----------------
   Вмикається скриптом у <head> для телефонів, слабких пристроїв і режиму економії трафіку.
   Примусово: додайте ?lite=1 до адреси (вимкнути — ?lite=0). */
.lite .aura__smoke, .lite .aura__embers, .lite .aura__glow { animation: none; }
.lite .aura__smoke, .lite .aura__embers { display: none; }
.lite .backdrop__video { display: none; }
.lite .reel__img.is-on { animation: none; transform: none; }
.lite .toast__halo, .lite .tool--sound.is-pending { animation: none; }
.lite .tab__avatar, .lite .slot img, .lite .reel__thumb { transition: none; }

/* ---------------- Підвал: застереження, авторство, конфіденційність ---------------- */
.footer { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 4px 10px; }
.footer i { font-style: normal; opacity: 0.6; }
.footer__link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--action);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(225, 166, 78, 0.4);
}
.footer__link:hover { text-decoration-color: currentColor; }
.privacy .quest__text { margin: 0; }

/* ---------------- Згода на аналітику (лише якщо ввімкнено Google Analytics) ---------------- */
.consent {
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 70;
  width: min(380px, calc(100vw - 32px));
  padding: 14px 16px 16px;
  background: rgba(14, 14, 14, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 2px solid var(--select);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.7);
  animation: rise 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) backwards 0.8s;
}
.consent[hidden] { display: none; }
.consent p { margin: 0 0 12px; color: var(--text); font-size: 0.92rem; line-height: 1.4; }
.consent__actions { display: flex; gap: 8px; justify-content: flex-end; }
.consent .btn { min-height: 36px; padding: 6px 14px; font-size: 0.95rem; }
@media (max-width: 520px) { .consent { width: calc(100vw - 24px); left: 12px; } .consent__actions .btn { flex: 1; } }
