/* ============================================================
   BIG BENIS GAME — базовые токены, шрифты, каркас приложения
   ============================================================ */

@font-face {
  font-family: "Russo One";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/russo-one-cyrillic-400.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Russo One";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/russo-one-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, 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: 400;
  font-display: swap;
  src: url("../fonts/roboto-condensed-cyrillic-400.woff2") format("woff2");
}
@font-face {
  font-family: "Roboto Condensed";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/roboto-condensed-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, 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: 700;
  font-display: swap;
  src: url("../fonts/roboto-condensed-cyrillic-700.woff2") format("woff2");
}
@font-face {
  font-family: "Roboto Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/roboto-condensed-latin-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;

  /* палитра игры */
  --gold-1: #ffe27a;
  --gold-2: #ffc137;
  --gold-3: #b96200;
  --purple: #a445ff;
  --green: #7fe04d;
  --red: #ff5f51;
  --ink: #040a14;
  --slate-1: #263246;
  --slate-2: #111a2a;
  --text-main: #f7f2e8;
  --text-muted: #a7afbd;

  /* шрифты */
  --font-display: "Russo One", Impact, "Arial Narrow Bold", system-ui, sans-serif;
  --font-body: "Roboto Condensed", system-ui, sans-serif;

  /* безопасные зоны: iOS/Android + Telegram Mini App */
  --safe-top: max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
  color: var(--text-main);
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

body { font-family: var(--font-body); }

button { font: inherit; color: inherit; border: 0; background: none; }
img { -webkit-user-drag: none; }

/* Каркас "телефона": на мобильном — весь экран, на десктопе — колонка по центру */
.app {
  position: relative;
  width: min(100vw, 520px);
  height: var(--tg-viewport-stable-height, 100svh);
  min-height: 568px;
  margin: auto;
  overflow: hidden;
  background: var(--ink);
}

/* Экраны: один активный, остальные скрыты */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
  isolation: isolate;
}
.screen.is-active { display: grid; }

/* Плавное появление экрана при переключении */
.screen.is-active { animation: screen-in 320ms ease both; }
@keyframes screen-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* На ПК (широкий экран или Telegram Desktop) — не растягиваем на весь
   экран, а показываем телефон-фрейм по центру с закруглением. */
@media (min-width: 700px) {
  body {
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 50% 40%, #14233c, #030710);
  }
  .app {
    width: min(92vw, 430px);
    height: min(92svh, 900px);
    border-radius: 22px;
    box-shadow: 0 0 70px #000, 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  }
}
/* Telegram Desktop: тот же телефон-фрейм, даже если окно уже 700px.
   Класс tg-desktop ставит telegram.js на <html>. */
:root.tg-desktop body {
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 40%, #14233c, #030710);
}
:root.tg-desktop .app {
  width: min(92vw, 430px);
  height: min(92svh, 900px);
  border-radius: 22px;
  box-shadow: 0 0 70px #000, 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
