/* Top Dawg Casino — демо. Общие токены, сброс, кнопки, монеты, тосты.
   Правила адаптации:
   — mobile-first, контрольные точки 480 / 768 / 960 / 1200;
   — размеры шрифтов и отступов через rem + clamp(), без фиксированных px для текста;
   — высота экрана через dvh (с фолбэком vh), отступы под вырезы через env(safe-area-inset-*);
   — зоны нажатия не меньше 44px, шрифт полей не меньше 16px (iOS не зумит);
   — hover-эффекты только при (hover: hover), анимации гасятся при prefers-reduced-motion;
   — у картинок заданы размеры и aspect-ratio — без скачков вёрстки;
   — горизонтального скролла нет: overflow-x: clip и min-width: 0 у элементов сетки. */

:root {
  color-scheme: dark;

  --bg: #060a1d;
  --bg-2: #0b0818;
  --panel: rgba(9, 17, 50, 0.82);
  --panel-solid: #0a1234;
  --line: rgba(86, 122, 255, 0.28);
  --line-strong: rgba(98, 140, 255, 0.6);

  --text: #eef1ff;
  --muted: #9aa6d6;
  --muted-2: #6f7bb0;

  --blue: #2f6bff;
  --blue-2: #1846d8;
  --blue-glow: rgba(47, 107, 255, 0.55);
  --violet: #8a2cf6;
  --violet-2: #5b17c9;
  --violet-glow: rgba(160, 60, 255, 0.55);
  --pink: #e04dff;
  --gold: #ffcc48;
  --gold-2: #e09a12;
  --danger: #ff5c7a;
  --ok: #3ee0a0;

  --radius-s: 0.625rem;
  --radius: 0.875rem;
  --radius-l: 1.375rem;

  --gutter: clamp(1rem, 3.2vw, 2rem);
  --tap: 2.75rem; /* 44px */

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Bangers", "Impact", "Arial Black", sans-serif;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.45;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

img, svg { display: block; max-width: 100%; }
img { height: auto; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

:focus-visible {
  outline: 2px solid #8fb0ff;
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  min-height: var(--tap);
  padding: 0.75em 1.5em;
  border: 0;
  border-radius: var(--radius);
  font-weight: 700;
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.18s var(--ease-out), box-shadow 0.25s, filter 0.25s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }

/* блик, пробегающий по кнопке */
.btn--shine::after {
  content: "";
  position: absolute;
  inset: -50% auto -50% -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: skewX(-20deg);
  animation: shine 3.6s 1.2s var(--ease-out) infinite;
  z-index: -1;
  pointer-events: none;
}
@keyframes shine {
  0% { left: -60%; }
  35%, 100% { left: 130%; }
}

.btn-close {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(6, 10, 30, 0.7);
  color: #fff;
  transition: transform 0.3s var(--ease-back), background 0.2s;
}
.btn-close .icon { width: 1.25rem; height: 1.25rem; stroke-width: 2.4; }
@media (hover: hover) {
  .btn-close:hover { transform: rotate(90deg); background: rgba(40, 50, 110, 0.85); }
}

/* ---------- Монеты на фоне ---------- */

.coins {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.coin {
  position: absolute;
  width: var(--s, 3rem);
  aspect-ratio: 1;
  background: url("../art/coin-2.webp") center / contain no-repeat;
  filter: drop-shadow(0 0 0.9rem rgba(255, 180, 50, 0.45)) blur(var(--blur, 0));
  opacity: var(--o, 0.95);
  animation: coin-float var(--d, 9s) ease-in-out var(--delay, 0s) infinite alternate;
}
.coin:nth-child(4n + 2) { background-image: url("../art/coin-3.webp"); }
.coin:nth-child(4n + 3) { background-image: url("../art/coin-4.webp"); }
.coin:nth-child(4n) { background-image: url("../art/coin-1.webp"); }
@keyframes coin-float {
  0% { transform: translate3d(0, 0, 0) rotateY(0deg) rotate(-12deg); }
  50% { transform: translate3d(0.6rem, -1.4rem, 0) rotateY(60deg) rotate(6deg); }
  100% { transform: translate3d(-0.4rem, 0.8rem, 0) rotateY(0deg) rotate(18deg); }
}

/* ---------- Тост ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.25rem + env(safe-area-inset-bottom));
  z-index: 200;
  max-width: min(92vw, 26rem);
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius);
  background: rgba(14, 20, 56, 0.96);
  border: 1px solid var(--line-strong);
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.5);
  font-size: 0.9375rem;
  text-align: center;
  transform: translate(-50%, 140%);
  opacity: 0;
  transition: transform 0.45s var(--ease-back), opacity 0.3s;
  pointer-events: none;
}
.toast.is-on { transform: translate(-50%, 0); opacity: 1; }

/* ---------- Появление при загрузке ---------- */

.reveal {
  opacity: 0;
  animation: reveal-up 0.7s var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 70ms + var(--base, 0ms));
}
@keyframes reveal-up {
  from { opacity: 0; transform: translateY(1rem); }
  to { opacity: 1; transform: none; }
}

/* ---------- Без анимаций по настройке системы ---------- */

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

/* ---------- Переход между страницами: шторка ---------- */

.curtain {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  pointer-events: none;
  visibility: hidden;
}
.curtain__panel {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 50% at 50% 45%, rgba(138, 44, 246, 0.55), transparent 70%),
    radial-gradient(80% 60% at 50% 110%, rgba(47, 107, 255, 0.45), transparent 70%),
    #07051a;
  clip-path: circle(0% at var(--cx, 50%) var(--cy, 50%));
}
.curtain__logo {
  position: relative;
  width: clamp(10rem, 40vw, 16rem);
  opacity: 0;
  transform: scale(0.7);
}
.curtain__bar {
  position: absolute;
  top: calc(50% + clamp(3.5rem, 10vw, 5rem));
  left: 50%;
  width: clamp(6rem, 24vw, 9rem);
  height: 0.25rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  transform: translateX(-50%);
  opacity: 0;
}
.curtain__bar::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 40%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--pink));
  animation: bar-run 0.9s ease-in-out infinite;
}
@keyframes bar-run {
  from { transform: translateX(-100%); }
  to { transform: translateX(260%); }
}

/* уход со страницы: шторка раскрывается кругом из точки клика */
.curtain.is-closing { visibility: visible; pointer-events: auto; }
.curtain.is-closing .curtain__panel { animation: curtain-in 0.6s var(--ease-out) forwards; }
.curtain.is-closing .curtain__logo { animation: logo-in 0.5s 0.25s var(--ease-back) forwards; }
.curtain.is-closing .curtain__bar { animation: fade-in 0.3s 0.45s forwards; }

/* приход на страницу: шторка уже закрыта и уезжает вверх */
.curtain.is-opening { visibility: visible; }
.curtain.is-opening .curtain__panel { clip-path: none; animation: curtain-out 0.75s 0.35s cubic-bezier(0.7, 0, 0.2, 1) forwards; }
.curtain.is-opening .curtain__logo { opacity: 1; transform: none; animation: logo-out 0.45s 0.2s ease-in forwards; }

@keyframes curtain-in {
  from { clip-path: circle(0% at var(--cx, 50%) var(--cy, 50%)); }
  to { clip-path: circle(150% at var(--cx, 50%) var(--cy, 50%)); }
}
@keyframes curtain-out {
  from { transform: none; }
  to { transform: translateY(-100%); }
}
@keyframes logo-in { to { opacity: 1; transform: none; } }
@keyframes logo-out { to { opacity: 0; transform: translateY(-2rem) scale(0.9); } }
@keyframes fade-in { to { opacity: 1; } }

/* страница под шторкой чуть отъезжает назад */
body.is-leaving main { transition: transform 0.6s var(--ease-out), filter 0.6s; transform: scale(0.96); filter: blur(4px); }
