/* Сайт игры — общие стили: шрифты, цвета игры, кнопки, плашки, пузырь реплики. */

@font-face {
  font-family: "Unbounded";
  src: url("../assets/fonts/unbounded-800.woff") format("woff");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020-007E, U+00A0-00FF, U+0400-045F, U+0490-0491, U+2010-2015, U+2018-201E, U+2022, U+2026, U+2030, U+2039-203A, U+20BD, U+2116, U+2190-2193, U+2212;
}
@font-face {
  font-family: "Manrope";
  src: url("../assets/fonts/manrope-400.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020-007E, U+00A0-00FF, U+0400-045F, U+0490-0491, U+2010-2015, U+2018-201E, U+2022, U+2026, U+2030, U+2039-203A, U+20BD, U+2116, U+2190-2193, U+2212;
}
@font-face {
  font-family: "Manrope";
  src: url("../assets/fonts/manrope-700.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020-007E, U+00A0-00FF, U+0400-045F, U+0490-0491, U+2010-2015, U+2018-201E, U+2022, U+2026, U+2030, U+2039-203A, U+20BD, U+2116, U+2190-2193, U+2212;
}

:root {
  /* Цвета игры (lib/theme.dart, wiki.css). */
  --paper: #f6ebd9;
  --white: #fffbf4;
  --ink: #1e1511;
  --note: #5a4a3e;
  --line: #e4d6c0;
  --mustard: #f5b62e;
  --mustard-deep: #d9951a;
  --tomato: #e5442b;
  --tomato-deep: #c2371f;
  --herb: #2f7d4f;
  --night: #1b1233;
  --indigo: #2a1d52;
  --indigo-soft: #3d2f73;
  --gold: #ffd27a;
  --wood: #6b3a22;

  --display: "Unbounded", "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --text: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --pop: cubic-bezier(0.3, 1.5, 0.5, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font: 400 17px/1.55 var(--text);
  -webkit-font-smoothing: antialiased;
}

img,
canvas,
video {
  max-width: 100%;
}

a {
  color: inherit;
}

/* Только для чтения с экрана и поисковиков. */
.vh {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 100;
  padding: 10px 16px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--mustard);
  color: var(--ink);
  font: 700 15px/1.2 var(--text);
  text-decoration: none;
}
.skip:focus {
  top: 12px;
}

:focus-visible {
  outline: 3px solid var(--mustard);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ── Кнопки — как в игре: горчица или томат, чернильная обводка, «ступенька» снизу. ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 20px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--mustard);
  box-shadow: 0 4px 0 var(--ink);
  color: var(--ink);
  font: 800 14px/1.15 var(--display);
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease), background-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover {
  background: #ffc74a;
}
.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}
.btn-red {
  background: var(--tomato-deep);
  color: #fff;
}
.btn-red:hover {
  background: var(--tomato);
}
.btn-ghost {
  background: var(--white);
}
.btn-ghost:hover {
  background: #fff;
}
.btn-small {
  min-height: 44px;
  padding: 6px 16px;
  font-size: 12.5px;
}

/* ── Деревянная плашка из игры. Три слоя фона: левый и правый концы с кристаллами (не тянутся,
   лежат на прозрачных боковых рамках) и середина (тянется под текстом). Все размеры — в em:
   плашка целиком растёт и сжимается вместе с размером шрифта (на площади он привязан к ширине
   картины). Так рисуют все браузеры одинаково; border-image в Safari вёл себя иначе. ── */
.plaque {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  min-height: 1.62em;
  padding: 0 0.25em 0.06em 0;
  border: solid transparent;
  border-width: 0 0.92em;
  background:
    url("../assets/ui/plaque-l.webp") left center / auto 100% no-repeat border-box,
    url("../assets/ui/plaque-r.webp") right center / auto 100% no-repeat border-box,
    url("../assets/ui/plaque-m.webp") center / 100% 100% no-repeat padding-box,
    /* если картинки не загрузились — простая дощечка */
    linear-gradient(#6b3a22, #5a3018) center / 100% 78% no-repeat padding-box;
  color: #fff7e6;
  font: 700 13px/1 var(--text);
  letter-spacing: 0.01em;
  text-shadow: 0 1px 0 #2b1408, 0 0 6px rgba(43, 20, 8, 0.8);
  white-space: nowrap;
  filter: drop-shadow(0 3px 4px rgba(20, 8, 30, 0.55));
}
.plaque .token {
  flex: none;
  width: 2em;
  height: 2em;
  margin: -0.3em 0 -0.24em -0.86em;
  filter: drop-shadow(0 1px 1px rgba(40, 16, 0, 0.6));
}
.plaque .soon {
  position: absolute;
  right: -0.9em;
  top: -0.95em;
  padding: 0.16em 0.4em 0.08em;
  border: 1.5px solid var(--ink);
  border-radius: 0.46em;
  background: var(--mustard);
  color: var(--ink);
  font: 800 0.62em/1.15 var(--display);
  letter-spacing: 0.04em;
  text-shadow: none;
  text-transform: uppercase;
  transform: rotate(7deg);
}

/* ── Пузырь реплики персонажа. ── */
.say {
  position: relative;
  padding: 12px 14px 13px;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: var(--white);
  box-shadow: 0 4px 0 rgba(30, 21, 17, 0.9);
  color: var(--ink);
  font: 400 15px/1.45 var(--text);
}
.say p {
  margin: 0;
}
.say-name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin-bottom: 5px !important;
  font: 800 12.5px/1.2 var(--display);
}
.say-name .role {
  color: var(--note);
  font: 700 12.5px/1.2 var(--text);
}
.tag {
  display: inline-block;
  padding: 2px 7px 2px;
  border-radius: 6px;
  background: var(--indigo);
  color: #efe7ff;
  font: 700 10px/1.3 var(--text);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ── Плашка «Скоро в App Store» (своя, не значок Apple). ── */
.store {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 7px 18px 7px 12px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: linear-gradient(#34265f, #1f1540);
  box-shadow: 0 4px 0 var(--ink), inset 0 0 0 1px rgba(255, 210, 122, 0.55);
  color: #fff;
  text-decoration: none;
  text-align: left;
}
.store img {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  box-shadow: 0 0 0 1px rgba(255, 210, 122, 0.7);
}
.store-lines {
  display: grid;
  gap: 2px;
}
.store small {
  color: #d9cdf5;
  font: 700 10.5px/1.1 var(--text);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.store b {
  font: 800 13.5px/1.1 var(--display);
  white-space: nowrap;
}
a.store {
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease);
}
a.store:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink), inset 0 0 0 1px rgba(255, 210, 122, 0.55);
}
.store-badge img {
  display: block;
  height: 54px;
  width: auto;
}

/* ── Герой или страж: неподвижный кадр, поверх него — холст с кадрами покоя. ── */
.sprite {
  position: relative;
  display: block;
  justify-self: center;
  line-height: 0;
}
.sprite img {
  display: block;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}
.sprite canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  /* Рамке тесно (узкий экран) — кадр вписывается, а не растягивается: как и картинка под ним. */
  object-fit: contain;
  opacity: 0;
}
.sprite canvas.ready {
  opacity: 1;
}
.sprite canvas.ready + img {
  visibility: hidden;
}

/* Вкладка скрыта — всё замирает. */
.paused *,
.paused *::before,
.paused *::after {
  animation-play-state: paused !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Выбор языка: плашка «RU · EN» справа наверху на каждой странице ── */
.langs {
  display: inline-flex;
  flex: none;
  padding: 3px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: rgba(255, 251, 244, 0.96);
  box-shadow: 0 3px 0 rgba(30, 21, 17, 0.85);
  font: 800 12px/1 var(--display);
  letter-spacing: 0.04em;
}
.langs > * {
  display: grid;
  place-items: center;
  min-width: 36px;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
}
.langs .lang-on {
  background: var(--mustard);
}
/* Нажимается вся плашка другого языка; зона нажатия — не меньше 44 точек. */
.langs a {
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s;
}
.langs a::after {
  content: "";
  position: absolute;
  inset: -11px -6px;
}
.langs a:hover,
.langs a:focus-visible {
  background: rgba(30, 21, 17, 0.12);
}
