/* Шрифты (SIL Open Font License, лежат локально — работают офлайн и в WebView):
 * Alegreya SC — заголовки, кнопки, HUD; Kurale — описательный текст. */
@font-face {
  font-family: 'Alegreya SC';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../assets/fonts/AlegreyaSC-700-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Alegreya SC';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../assets/fonts/AlegreyaSC-700-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;
}
@font-face {
  font-family: 'Alegreya SC';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url(../assets/fonts/AlegreyaSC-900-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Alegreya SC';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url(../assets/fonts/AlegreyaSC-900-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;
}
@font-face {
  font-family: 'Kurale';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../assets/fonts/Kurale-400-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Kurale';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../assets/fonts/Kurale-400-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;
}

/* Подстава — интерфейс. Все размеры кнопок/HUD задаются из JS через CSS-переменные. */
:root {
  --bg: #0e1019;
  --panel: #1d2233;
  --panel-hi: #2b3149;
  --edge: #07080d;
  --text: #f3e7c8;
  --muted: #a9a38f;
  --gold: #e0b04a;
  --red: #b3323e;
  --green: #7fc26b;
  --font: "Alegreya SC", Georgia, "Times New Roman", serif;
  --font-text: "Kurale", Georgia, "Times New Roman", serif;
  --hud-size: 18px;
  --btn: 72px;
  --pad-left: 16px;
  --pad-right: 16px;
  --pad-bottom: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-variant-numeric: lining-nums;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

#app { position: fixed; inset: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; }

[hidden] { display: none !important; }

button {
  font-family: var(--font);
  font-variant-numeric: lining-nums;
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
}

/* ---------------- HUD ---------------- */
#hud {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
  font-size: var(--hud-size);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  z-index: 5;
}
.hud-left, .hud-right { display: flex; align-items: center; gap: 0.8em; }
.hud-right { pointer-events: auto; gap: 0.45em; }
#hud-deaths { display: inline-flex; align-items: center; gap: 0.3em; color: #e8d9b5; }
#hud-deaths svg { width: 1em; height: 1em; }

.icon-btn {
  width: calc(var(--hud-size) * 2.3);
  height: calc(var(--hud-size) * 2.3);
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  background: rgba(14, 16, 25, 0.55);
  border: 2px solid rgba(230, 226, 214, 0.85);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--hud-size);
  font-weight: 700;
}
.icon-btn svg { width: 55%; height: 55%; fill: #f4f1e8; }
.icon-btn:active { background: rgba(255, 255, 255, 0.2); }
#btn-hint { color: var(--gold); border-color: var(--gold); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }

/* ---------------- Экранные кнопки ---------------- */
#pad { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.pad-group {
  position: absolute;
  bottom: calc(var(--pad-bottom) + env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: calc(var(--btn) * 0.18);
  pointer-events: auto;
}
.pad-group.left { left: calc(var(--pad-left) + env(safe-area-inset-left, 0px)); }
.pad-group.right { right: calc(var(--pad-right) + env(safe-area-inset-right, 0px)); }
.pad-btn {
  width: var(--btn);
  height: calc(var(--btn) * 0.74);
  background: rgba(20, 24, 36, 0.45);
  border: 3px solid rgba(225, 228, 236, 0.85);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  touch-action: none;
}
.pad-btn svg { width: 46%; height: 46%; fill: #f2f2f2; }
.pad-btn.pressed { background: rgba(255, 255, 255, 0.28); transform: translateY(2px); }

/* ---------------- Всплывающее сообщение ---------------- */
#toast {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(90vw, 640px);
  padding: 10px 16px;
  background: rgba(14, 16, 25, 0.88);
  border: 2px solid var(--gold);
  border-radius: 6px;
  text-align: center;
  font-weight: 700;
  font-size: clamp(13px, 2.4vmin, 18px);
  line-height: 1.35;
  z-index: 60;            /* над экранами «пройдено»/меню — там появляются достижения */
  pointer-events: none;
}
#toast .t-num { color: var(--gold); display: block; font-size: 0.8em; letter-spacing: 0.12em; }

/* ---------------- Экраны меню ---------------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(8, 9, 15, 0.62);
  z-index: 10;
  overflow-y: auto;
  touch-action: pan-y;
}
.panel {
  background: var(--panel);
  border: 4px solid var(--edge);
  box-shadow: inset 0 0 0 3px var(--panel-hi), 0 8px 0 rgba(0, 0, 0, 0.35);
  border-radius: 4px;
  padding: 22px 26px;
  text-align: center;
  width: min(440px, 100%);
}
.panel h2 { margin: 0 0 6px; font-size: 26px; letter-spacing: 0.08em; color: var(--gold); text-shadow: 3px 3px 0 #000; }
.panel p { margin: 6px 0; color: var(--muted); }

.logo {
  margin: 0;
  font-size: clamp(40px, 11vmin, 92px);
  letter-spacing: 0.1em;
  color: var(--text);
  text-shadow: 0 5px 0 var(--red), 5px 9px 0 #000;
  text-align: center;
}
.subtitle { margin: 16px 0 26px; color: #d8cfb8; font-weight: 700; text-align: center; text-shadow: 2px 2px 0 #000; }

.menu-buttons { display: flex; flex-direction: column; gap: 12px; width: min(300px, 80vw); }
.btn {
  display: block;
  width: 100%;
  padding: 13px 18px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: var(--panel-hi);
  border: 3px solid var(--edge);
  border-radius: 4px;
  box-shadow: inset 3px 3px 0 #414a6a, inset -3px -3px 0 #1a1e2d, 0 4px 0 rgba(0, 0, 0, 0.45);
  text-shadow: 2px 2px 0 #000;
}
.btn:hover, .btn:focus-visible { background: #384060; outline: none; }
.btn:active { transform: translateY(3px); box-shadow: inset 3px 3px 0 #414a6a, inset -3px -3px 0 #1a1e2d; }
.btn.primary { background: #8e1f2a; box-shadow: inset 3px 3px 0 #c0444f, inset -3px -3px 0 #5a111a, 0 4px 0 rgba(0, 0, 0, 0.45); }
.btn.primary:hover, .btn.primary:focus-visible { background: #a52734; }
.btn.small { font-size: 14px; padding: 9px 12px; }
.btn-row { display: flex; gap: 10px; margin-top: 16px; }
.btn-row .btn { flex: 1; }
.stats { margin-top: 20px; color: var(--muted); font-size: 14px; text-align: center; text-shadow: 1px 1px 0 #000; }

/* ---------------- Выбор уровня ---------------- */
#screen-levels { justify-content: flex-start; }
.levels-head {
  display: flex; align-items: center; gap: 12px;
  width: min(960px, 100%);
  margin-bottom: 14px;
}
.levels-head h2 { flex: 1; margin: 0; font-size: 24px; letter-spacing: 0.08em; color: var(--gold); text-shadow: 3px 3px 0 #000; }
.levels-head .btn { width: auto; }
#level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  width: min(960px, 100%);
}
.lvl {
  position: relative;
  text-align: left;
  padding: 10px 12px 12px;
  min-height: 104px;
  background: var(--panel-hi);
  border: 3px solid var(--edge);
  border-radius: 4px;
  box-shadow: inset 3px 3px 0 #414a6a, inset -3px -3px 0 #1a1e2d;
  display: flex; flex-direction: column; gap: 4px;
}
.lvl:hover:not(:disabled), .lvl:focus-visible { background: #384060; outline: none; }
.lvl .n { font-size: 28px; font-weight: 700; text-shadow: 2px 2px 0 #000; }
.lvl .name { font-size: 13px; font-weight: 700; line-height: 1.2; color: #e9dfc6; }
.lvl .meta { margin-top: auto; font-size: 12px; color: var(--muted); }
.lvl .diff { position: absolute; top: 12px; right: 10px; display: flex; gap: 3px; }
.lvl .diff i { width: 7px; height: 7px; background: #555c75; display: block; }
.lvl .diff i.on { background: var(--gold); }
.lvl.done { background: #2a3a36; box-shadow: inset 3px 3px 0 #3f5a52, inset -3px -3px 0 #18231f; }
.lvl.done .meta { color: var(--green); }
.lvl:disabled { opacity: 0.5; cursor: default; }
.lvl.soon { justify-content: center; align-items: center; text-align: center; color: var(--muted); font-weight: 700; }

/* ---------------- Переключатели ---------------- */
.toggles { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; text-align: left; }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 700; }
.toggle button {
  min-width: 78px; padding: 7px 10px; font-weight: 700;
  background: #3a3f55; border: 3px solid var(--edge); border-radius: 4px;
}
.toggle button.on { background: #2f6a3a; }
.toggle.range input { width: 52%; max-width: 220px; accent-color: var(--gold); cursor: pointer; }
#pause-toggles .toggle.range { grid-column: 1 / -1; }

.result { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; margin: 14px 0 4px; text-align: left; font-weight: 700; }
.result span:nth-child(odd) { color: var(--muted); }
.result .best { color: var(--gold); }

#screen-loading { background: var(--bg); font-weight: 700; letter-spacing: 0.1em; }


/* =================================================================
 * Оформление в стиле замка и анимации появления
 * ================================================================= */
.panel p, .subtitle, .stats, #toast, .about-text { font-family: var(--font-text); font-weight: 400; }
.panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.12)),
    var(--panel);
  border-image: none;
  position: relative;
}
.panel::before, .panel::after {         /* золотые уголки */
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  border: 3px solid var(--gold);
  pointer-events: none;
}
.panel::before { top: 6px; left: 6px; border-right: 0; border-bottom: 0; }
.panel::after { bottom: 6px; right: 6px; border-left: 0; border-top: 0; }
.panel h2 { font-weight: 900; font-size: 30px; }

.logo {
  font-weight: 900;
  font-size: clamp(46px, 13vmin, 118px);
  letter-spacing: 0.06em;
  line-height: 1;
  color: #f7d77a;
  background: linear-gradient(180deg, #fff3c4 0%, #f2c75a 45%, #b9791f 55%, #f0c060 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 3px 0 #5e121b) drop-shadow(0 4px 0 #2a0a0e) drop-shadow(3px 7px 0 rgba(0, 0, 0, 0.6));
}
.logo-wrap { display: flex; flex-direction: column; align-items: center; }
.logo-orn {
  display: flex; align-items: center; gap: 12px;
  width: min(520px, 80vw);
  color: var(--gold);
  margin-top: 10px;
}
.logo-orn::before, .logo-orn::after {
  content: ""; flex: 1; height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold));
  box-shadow: 0 2px 0 #000;
}
.logo-orn::after { background: linear-gradient(270deg, transparent, var(--gold)); }
.logo-orn svg { width: 26px; height: 26px; filter: drop-shadow(2px 2px 0 #000); }
.subtitle { font-size: clamp(16px, 2.6vmin, 22px); margin: 12px 0 24px; }
.btn { font-size: 20px; letter-spacing: 0.1em; }
#hud { font-weight: 900; letter-spacing: 0.08em; }
.lvl .n { font-weight: 900; }
.lvl .name { font-family: var(--font-text); font-weight: 400; font-size: 14px; }
.lvl .meta { font-family: var(--font-text); }
.toggle span { font-size: 18px; }

/* ---- появление экранов ---- */
.screen { animation: screen-in 0.35s ease-out both; }
.screen.leaving { animation: screen-out 0.22s ease-in both; pointer-events: none; }
@keyframes screen-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes screen-out { from { opacity: 1; } to { opacity: 0; } }

.panel { animation: panel-in 0.5s cubic-bezier(0.2, 1.3, 0.4, 1) both; }
@keyframes panel-in {
  from { opacity: 0; transform: translateY(-40px) scale(0.9); }
  to { opacity: 1; transform: none; }
}

#screen-menu .logo-wrap { animation: logo-drop 0.9s cubic-bezier(0.25, 1.5, 0.45, 1) both; }
@keyframes logo-drop {
  0% { opacity: 0; transform: translateY(-120px) scale(1.15); }
  60% { opacity: 1; }
  100% { transform: none; }
}
#screen-menu .subtitle { animation: fade-up 0.6s 0.45s ease-out both; }
#screen-menu .menu-buttons > * { animation: fade-up 0.5s ease-out both; }
#screen-menu .menu-buttons > :nth-child(1) { animation-delay: 0.55s; }
#screen-menu .menu-buttons > :nth-child(2) { animation-delay: 0.63s; }
#screen-menu .menu-buttons > :nth-child(3) { animation-delay: 0.71s; }
#screen-menu .menu-buttons > :nth-child(4) { animation-delay: 0.79s; }
#screen-menu .stats { animation: fade-up 0.6s 0.9s ease-out both; }
@keyframes fade-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.lvl { animation: tile-in 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) both; animation-delay: calc(var(--i, 0) * 35ms); }
@keyframes tile-in { from { opacity: 0; transform: translateY(16px) scale(0.85); } to { opacity: 1; transform: none; } }
.levels-head { animation: fade-up 0.4s ease-out both; }


#screen-complete .result > * { animation: fade-up 0.4s ease-out both; }
#screen-complete .result > :nth-child(n+3) { animation-delay: 0.12s; }
#screen-complete .result > :nth-child(n+5) { animation-delay: 0.24s; }
.stars { display: flex; justify-content: center; gap: 10px; margin: 10px 0 2px; }
.stars svg { width: 34px; height: 34px; animation: star-pop 0.5s cubic-bezier(0.2, 1.8, 0.4, 1) both; }
.stars svg:nth-child(2) { animation-delay: 0.15s; }
.stars svg:nth-child(3) { animation-delay: 0.3s; }
.stars .off { opacity: 0.25; filter: grayscale(1); }
@keyframes star-pop { from { opacity: 0; transform: scale(0.2) rotate(-40deg); } to { opacity: 1; transform: none; } }

#toast { animation: toast-in 0.35s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -14px); } to { opacity: 1; transform: translateX(-50%); } }

/* ---- заставка уровня между переходами ---- */
#title-card {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 8;
  pointer-events: none;
  text-align: center;
  padding: 16px;
}
#title-card .tc-num {
  font-weight: 900;
  font-size: clamp(16px, 3vmin, 24px);
  letter-spacing: 0.35em;
  color: var(--gold);
  text-shadow: 2px 2px 0 #000;
  animation: fade-up 0.45s ease-out both;
}
#title-card .tc-name {
  font-weight: 900;
  font-size: clamp(28px, 6.5vmin, 58px);
  color: var(--text);
  text-shadow: 0 3px 0 #5e121b, 3px 6px 0 #000;
  margin: 8px 0 12px;
  animation: card-name 0.6s 0.1s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
#title-card .tc-room { font-family: var(--font-text); color: var(--muted); font-size: clamp(14px, 2.4vmin, 19px); animation: fade-up 0.5s 0.25s ease-out both; }
#title-card .logo-orn { animation: orn-grow 0.6s 0.05s ease-out both; margin: 0; }
@keyframes card-name { from { opacity: 0; transform: scale(0.8); letter-spacing: 0.3em; } to { opacity: 1; transform: none; } }
@keyframes orn-grow { from { opacity: 0; transform: scaleX(0.2); } to { opacity: 1; transform: none; } }
#title-card.leaving { animation: screen-out 0.3s ease-in both; }

/* ---- Об игре ---- */
#screen-about .panel { width: min(560px, 100%); text-align: left; }
#screen-about h2 { text-align: center; }
.about-text { color: #e4dac2; font-size: 17px; line-height: 1.5; margin: 10px 0; }
.about-dev {
  display: flex; align-items: center; gap: 14px;
  margin: 16px 0 6px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.22);
  border: 2px solid #3d4560;
  border-radius: 4px;
}
.about-dev img { width: 56px; height: 56px; image-rendering: pixelated; border: 2px solid var(--gold); border-radius: 4px; }
.about-dev .who { font-weight: 900; font-size: 20px; color: var(--text); }
.about-dev .role { font-family: var(--font-text); color: var(--muted); font-size: 14px; }
.about-dev a, .about-link { color: var(--gold); font-weight: 700; text-decoration: none; border-bottom: 2px solid rgba(224, 176, 74, 0.4); }
.about-dev a:hover, .about-link:hover { border-bottom-color: var(--gold); }
.about-small { font-family: var(--font-text); color: var(--muted); font-size: 13px; margin-top: 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; }
}

/* Пауза компактнее, чтобы помещалась на невысоких экранах телефонов */
.screen { justify-content: safe center; }
#screen-pause .panel { width: min(520px, 100%); padding: 18px 20px; }
#screen-pause .menu-buttons { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 10px; }
#screen-pause #btn-resume { grid-column: span 2; }
#screen-pause .btn { font-size: 17px; padding: 10px 12px; }
#pause-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin-bottom: 0; }
#pause-toggles .toggle span { font-size: 15px; }
#pause-toggles .toggle button { min-width: 60px; padding: 5px 8px; }
#screen-pause [data-go=menu] { grid-column: span 2; }

/* ---------------- Заставка Lunev Games ---------------- */
#splash {
  position: absolute; inset: 0;
  z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #1c2031 0%, #07080d 70%);
  cursor: pointer;
}
#splash.hide { animation: splash-out 0.6s ease-in both; pointer-events: none; }
@keyframes splash-out { to { opacity: 0; transform: scale(1.06); } }
.splash-inner { display: flex; flex-direction: column; align-items: center; position: relative; }
.splash-emblem {
  width: clamp(70px, 16vmin, 120px);
  filter: drop-shadow(0 0 18px rgba(224, 176, 74, 0.35)) drop-shadow(3px 5px 0 #000);
  animation: emblem-in 0.8s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
@keyframes emblem-in {
  from { opacity: 0; transform: scale(0.3) rotate(-12deg); }
  to { opacity: 1; transform: none; }
}
.splash-title {
  display: flex;
  margin-top: 10px;
  font-weight: 900;
  font-size: clamp(44px, 12vmin, 96px);
  line-height: 1;
  letter-spacing: 0.04em;
  position: relative;
  overflow: hidden;
  padding: 0 6px 8px;
}
.splash-title span {
  display: inline-block;
  color: #f7d77a;
  background: linear-gradient(180deg, #fff3c4 0%, #f2c75a 45%, #b9791f 55%, #f0c060 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 0 #5e121b) drop-shadow(3px 6px 0 rgba(0, 0, 0, 0.7));
  animation: letter-in 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.splash-title span:nth-child(1) { animation-delay: 0.35s; }
.splash-title span:nth-child(2) { animation-delay: 0.43s; }
.splash-title span:nth-child(3) { animation-delay: 0.51s; }
.splash-title span:nth-child(4) { animation-delay: 0.59s; }
.splash-title span:nth-child(5) { animation-delay: 0.67s; }
@keyframes letter-in { from { opacity: 0; transform: translateY(40px) scale(0.6); } to { opacity: 1; transform: none; } }
.splash-title::after {       /* блик, пробегающий по золоту */
  content: "";
  position: absolute; top: 0; bottom: 0; left: -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 250, 225, 0.55), transparent);
  mix-blend-mode: overlay;
  animation: shine 0.9s 1.15s ease-in-out both;
}
@keyframes shine { from { left: -60%; } to { left: 120%; } }
.splash-games {
  display: flex; align-items: center; gap: 12px;
  font-weight: 700;
  font-size: clamp(16px, 3.6vmin, 28px);
  letter-spacing: 0.55em;
  color: #e8dcc0;
  text-shadow: 2px 2px 0 #000;
  margin-right: -0.55em;
  animation: games-in 0.7s 0.85s ease-out both;
}
.splash-games i { display: block; width: clamp(24px, 8vmin, 60px); height: 2px; background: #e0b04a; box-shadow: 0 2px 0 #000; }
@keyframes games-in { from { opacity: 0; letter-spacing: 1.1em; } to { opacity: 1; } }

/* ---------------- Просьба повернуть телефон ---------------- */
#rotate {
  position: absolute; inset: 0;
  z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
  background: radial-gradient(ellipse at center, #1c2031 0%, #07080d 75%);
  animation: screen-in 0.3s ease-out both;
}
#rotate h2 { margin: 18px 0 4px; font-weight: 900; font-size: 28px; color: var(--gold); text-shadow: 3px 3px 0 #000; }
#rotate p { margin: 0; font-family: var(--font-text); color: #d8cfb8; font-size: 17px; max-width: 280px; }
#rotate svg { width: 110px; height: 110px; }
.rotate-phone { animation: phone-turn 2.2s ease-in-out infinite; }
.rotate-icon { position: relative; width: 110px; height: 110px; }
.rotate-arrow { position: absolute; top: -18px; right: -44px; width: 64px !important; height: 64px !important; }
@keyframes phone-turn {
  0%, 20% { transform: rotate(0); }
  50%, 80% { transform: rotate(-90deg); }
  100% { transform: rotate(0); }
}

/* ---------------- Телефон в альбомной ориентации: всё компактнее ---------------- */
#hud { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
#btn-fullscreen.on svg, #btn-menu-fs.on svg { transform: rotate(180deg); }
@media (max-height: 520px) and (orientation: landscape) {
  .logo { font-size: min(15vh, 64px); }
  .logo-orn { margin-top: 4px; }
  .subtitle { margin: 6px 0 12px; font-size: 15px; }
  .menu-buttons { display: grid; grid-template-columns: 1fr 1fr; width: min(460px, 80vw); gap: 8px; }
  #screen-menu .btn.primary { grid-column: span 2; }
  .btn { padding: 9px 12px; font-size: 17px; }
  .stats { margin-top: 10px; }
  .panel { padding: 14px 18px; }
  .panel h2 { font-size: 24px; }
  .about-text { font-size: 15px; line-height: 1.35; }
  #level-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; }
  .lvl { min-height: 84px; padding: 8px 10px; }
  .lvl .n { font-size: 22px; }
  #title-card .tc-name { font-size: 9vh; }
}

/* ---------------- Финальная сценка ---------------- */
#dialog {
  position: absolute; left: 50%; bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(760px, calc(100% - 32px));
  background: rgba(20, 23, 36, 0.94);
  border: 4px solid var(--edge);
  box-shadow: inset 0 0 0 3px #3a4262, 0 6px 0 rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  padding: 12px 18px 14px;
  z-index: 12;
  cursor: pointer;
  user-select: none;
}
#dialog.pop { animation: dlg-pop 0.28s cubic-bezier(0.2, 1.3, 0.4, 1) both; }
@keyframes dlg-pop { from { opacity: 0; transform: translate(-50%, 12px) scale(0.96); } to { opacity: 1; transform: translateX(-50%); } }
.dlg-name { font-weight: 900; letter-spacing: 0.12em; font-size: 15px; margin-bottom: 4px; text-shadow: 2px 2px 0 #000; }
.dlg-name.knight { color: #9fc4ff; }
.dlg-name.princess { color: #ff9cc4; }
.dlg-name.dragon { color: #8fd060; }
.dlg-text { font-family: var(--font-text); font-size: clamp(16px, 2.6vmin, 21px); line-height: 1.35; min-height: 2.7em; color: var(--text); }
.dlg-next { position: absolute; right: 12px; bottom: 8px; color: var(--gold); font-size: 14px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
#btn-skip { position: absolute; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); width: auto; z-index: 12; }

#screen-sequel { background: radial-gradient(ellipse at center, rgba(40, 18, 24, 0.9), rgba(6, 6, 10, 0.97)); }
.sequel { text-align: center; max-width: 720px; }
.sequel-pre { font-family: var(--font-text); color: var(--muted); letter-spacing: 0.2em; animation: fade-up 0.8s 0.2s ease-out both; }
.sequel-logo { margin: 8px 0 0; animation: sequel-in 1.1s 0.5s cubic-bezier(0.2, 1.2, 0.4, 1) both; }
.sequel-logo span { color: var(--gold); text-shadow: 0 5px 0 #5e121b, 5px 9px 0 #000; }
.sequel-sub { font-weight: 900; font-size: clamp(20px, 4.5vmin, 36px); color: var(--gold); letter-spacing: 0.18em; text-shadow: 3px 3px 0 #000; margin: 10px 0 6px; animation: fade-up 0.8s 1.3s ease-out both; }
.sequel-text { font-family: var(--font-text); color: #d8cfb8; font-size: clamp(14px, 2.4vmin, 18px); animation: fade-up 0.8s 1.8s ease-out both; }
.sequel-credit { font-size: 13px; color: var(--muted); animation: fade-up 0.8s 2.2s ease-out both; }
.sequel .btn-row { justify-content: center; animation: fade-up 0.8s 2.5s ease-out both; }
@keyframes sequel-in { from { opacity: 0; transform: scale(2.2); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }

/* полоска загрузки под логотипом: появляется сама через 1,2 с (ещё до загрузки скриптов);
   пока нет данных о прогрессе (.wait) — по дорожке бегает огонёк */
.splash-load { margin-top: 26px; display: flex; flex-direction: column; align-items: center; gap: 8px; opacity: 0; animation: splash-load-in .5s 1.2s ease-out forwards; }
@keyframes splash-load-in { to { opacity: 1; } }
.splash-track { position: relative; }
.splash-load.wait .splash-bar { opacity: 0; }
.splash-load.wait .splash-track::after { content: ''; position: absolute; top: 0; bottom: 0; width: 35%; border-radius: 3px;
  background: linear-gradient(90deg, transparent, #f7d77a, transparent); animation: splash-run 1.3s ease-in-out infinite; }
@keyframes splash-run { from { left: -35%; } to { left: 100%; } }
.splash-track { width: clamp(140px, 30vmin, 240px); height: 6px; border-radius: 3px; background: rgba(224, 176, 74, .18); overflow: hidden; }
.splash-bar { height: 100%; background: linear-gradient(90deg, #b8862e, #f7d77a); transform-origin: left; transform: scaleX(.04); transition: transform .25s ease-out; }
.splash-load span { color: #c9b98a; font-size: 13px; letter-spacing: .06em; }
