:root {
  /* ===== COLORS ===== */
  --bg-deep: #07020F;
  --bg-purple: #120622;

  --accent-purple: #A855F7;
  --accent-violet: #6D28D9;
  --accent-gold-start: #FFCC33;
  --accent-gold-end: #FF9900;

  --text-primary: rgba(255,255,255,0.92);
  --text-secondary: rgba(255,255,255,0.68);

  --glass-bg: rgba(255,255,255,0.06);
  --glass-border: rgba(255,255,255,0.10);

  --shadow-purple: rgba(168, 85, 247, 0.35);
  --shadow-gold: rgba(255, 176, 0, 0.35);

  /* ===== RADIUS ===== */
  --radius-card: 24px;
  --radius-pill: 999px;
  --radius-small: 14px;

  /* ===== SPACING ===== */
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-20: 20px;
  --space-24: 24px;
  --space-32: 32px;

  /* ===== ANIMATION ===== */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.4s ease;

  /* ===== Z-INDEX ===== */
  --z-nav: 20;
  --z-toast: 30;
}
/* ===============================
   SV ARENA DESIGN SYSTEM (layout.css)
   Global layout + sensible resets for Telegram WebApp
================================= */

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

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(circle at 50% 20%, #2a0f4a 0%, #120622 40%, #07020F 100%);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Telegram WebApp often needs this to avoid white flash on overscroll */
#root {
  min-height: 100vh;
}

/* Tap friendliness */
button, [role="button"] {
  -webkit-tap-highlight-color: transparent;
}

/* Basic links */
a {
  color: inherit;
  text-decoration: none;
}

/* Generic containers (legacy) */
.app-container {
  padding: var(--space-20);
}

.section {
  margin-bottom: var(--space-24);
}

/* Generic topbar (legacy) */
.topbar {
  position: sticky;
  top: 0;
  padding: var(--space-16) var(--space-20);
  backdrop-filter: blur(20px);
  background: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}
/* ===============================
   SV ARENA DESIGN SYSTEM
================================= */

/* ===== BALANCE ===== */
.balance-pill {
  background: linear-gradient(
    135deg,
    var(--accent-gold-start),
    var(--accent-gold-end)
  );
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  letter-spacing: 0.4px;
  box-shadow: 0 0 22px rgba(255, 176, 0, 0.45);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.balance-pill:active {
  transform: scale(0.97);
  box-shadow: 0 0 30px rgba(255, 176, 0, 0.65);
}


/* ===== GAME CARD ===== */
.game-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-card);
  padding: var(--space-16);
  margin-bottom: var(--space-16);
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.game-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-card);
  background: radial-gradient(circle at top right, rgba(168,85,247,0.18), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.game-card:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 0 30px rgba(168, 85, 247, 0.35);
  border-color: rgba(168,85,247,0.4);
}

.game-card:hover::before {
  opacity: 1;
}

.game-card:active {
  transform: scale(0.97);
}

.game-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.game-card .muted {
  font-size: 13px;
  color: var(--text-secondary);
}


/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 75px;
  backdrop-filter: blur(30px);
  background: rgba(255,255,255,0.05);
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 20;
}

.nav-item {
  color: var(--text-secondary);
  font-weight: 600;
  transition: all 0.2s ease;
}

.nav-item.active {
  color: var(--accent-purple);
  text-shadow: 0 0 12px rgba(168, 85, 247, 0.6);
  transform: translateY(-1px);
}
/* ===============================
   APP STORE / SUPERCELL TILES
================================= */

.gameTiles{
  display: grid;
  gap: 12px;
}

/* tile base */
.gameTile{
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(18px);
  overflow: hidden;
  cursor: pointer;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
  will-change: transform;
}

/* “cover light” overlay */
.gameTile::before{
  content:"";
  position:absolute;
  inset:-2px;
  background:
    radial-gradient(circle at 75% 20%, rgba(168,85,247,0.22), transparent 55%),
    radial-gradient(circle at 20% 90%, rgba(255,176,0,0.16), transparent 55%);
  opacity: .95;
  pointer-events:none;
}

/* glossy streak */
.gameTile::after{
  content:"";
  position:absolute;
  top:-40%;
  left:-30%;
  width: 60%;
  height: 180%;
  transform: rotate(18deg);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.10), transparent);
  opacity: .35;
  pointer-events:none;
}

/* hover / press */
.gameTile:hover{
  transform: translateY(-2px) scale(1.01);
  border-color: rgba(168,85,247,0.35);
  box-shadow: 0 0 34px rgba(168,85,247,0.25);
}
.gameTile:active{
  transform: scale(0.98);
}

/* badge */
.gameTileBadge{
  position:absolute;
  top: 12px;
  left: 12px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  color: rgba(255,255,255,0.92);
  background: rgba(168,85,247,0.18);
  border: 1px solid rgba(255,255,255,0.10);
}

/* text */
.gameTileText{ display:flex; flex-direction:column; gap: 3px; }
.gameTileTitle{
  font-size: 18px;
  font-weight: 950;
  letter-spacing: .2px;
}
.gameTileSub{
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,0.68);
}

/* icon */
.gameTileIcon{
  font-size: 28px;
  filter: drop-shadow(0 0 10px rgba(168,85,247,0.18));
  opacity: .95;
}

/* disabled */
.isDisabled{
  opacity: .55;
  cursor: not-allowed;
}
.isDisabled:hover{
  transform:none;
  box-shadow:none;
  border-color: rgba(255,255,255,0.10);
}

/* subtle pulse for main featured game */
@keyframes saPulse {
  0% { box-shadow: 0 0 22px rgba(168,85,247,0.18); }
  50% { box-shadow: 0 0 34px rgba(168,85,247,0.32); }
  100% { box-shadow: 0 0 22px rgba(168,85,247,0.18); }
}
.gameTile--monopoly{
  animation: saPulse 7s ease-in-out infinite;
}

/* ===============================
   2x2 HUB TILES (reference style)
   Requires files in: /img/hub-bg.webp, /img/monopoly-cover.webp, /img/seabattle-cover.webp
================================= */

.saPage{
  background:
    radial-gradient(circle at 50% 18%, rgba(42,15,74,0.45) 0%, rgba(18,6,34,0.55) 45%, rgba(7,2,15,0.90) 100%),
    url("/static/img/hub-bg.webp");
  background-size: cover;
  background-position: center;
}

.saGrid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.saTile{
  position:relative;
  border-radius: 22px;
  overflow:hidden;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(14px);
  aspect-ratio: 1 / 1;
  cursor:pointer;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.saTile:hover{
  transform: translateY(-2px) scale(1.01);
  border-color: rgba(168,85,247,0.40);
  box-shadow: 0 0 36px rgba(168,85,247,0.30);
}

.saTile:active{ transform: scale(0.98); }

.saTileTop{
  position:absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display:flex;
  justify-content:flex-start;
}

.saBadge{
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  background: rgba(168,85,247,0.18);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.92);
}

.saTileBottom{
  position:absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  padding: 10px 10px;
  border-radius: 16px;
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(10px);
}

.saTileTitle{
  font-weight: 950;
  letter-spacing: 0.8px;
  font-size: 14px;
}

.saTileSub{
  margin-top: 3px;
  font-weight: 800;
  font-size: 12px;
  opacity: 0.78;
}

.saTileSoon{
  font-weight: 900;
  letter-spacing: 1px;
  font-size: 12px;
  opacity: 0.8;
  text-align:center;
}

.saTileCenter{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 44px;
  font-weight: 900;
  opacity: 0.35;
}

.saTile.saDisabled{ opacity: 0.55; cursor:not-allowed; }
.saTile.saDisabled:hover{ transform:none; box-shadow:none; border-color: rgba(255,255,255,0.10); }

.saTile--monopoly{
  background-image:
    linear-gradient(135deg, rgba(0,0,0,0.22), rgba(0,0,0,0.55)),
    url("/static/img/monopoly-cover.webp");
  background-size: cover;
  background-position: center;
}

.saTile--sea{
  background-image:
    linear-gradient(135deg, rgba(0,0,0,0.22), rgba(0,0,0,0.55)),
    url("/static/img/seabattle-cover.webp");
  background-size: cover;
  background-position: center;
}

.saTile--uno{
  background-image:
    linear-gradient(135deg, rgba(0,0,0,0.22), rgba(0,0,0,0.55)),
    url("/static/img/uno-cover.webp");
  background-size: cover;
  background-position: center;
}
/* ===============================
   PREMIUM TOPBAR
================================= */

.saTopbar{
  padding: 18px 16px 12px;
  position: sticky;
  top: 0;
  z-index: 10;
  border-radius: 18px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(20px);
}

.saTopbarInner{
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.saTitleBlock{
  display:flex;
  flex-direction:column;
}

.saTitle{
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 1px;
  background: linear-gradient(90deg,#ffffff,#a855f7,#ffcc33);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.saSubtitle{
  font-size: 12px;
  opacity: 0.6;
  letter-spacing: 1px;
  margin-top: 2px;
}

/* ===== Balance pill ===== */

.saBalance{
  display:flex;
  align-items:center;
  gap:8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 800;
  cursor:pointer;
  background: linear-gradient(135deg,#ffcc33,#ff9900);
  color:#000;
  box-shadow:
    0 0 20px rgba(255,176,0,0.4),
    inset 0 0 10px rgba(255,255,255,0.3);
  transition: transform .2s ease, box-shadow .2s ease;
  user-select: none;
}

.saBalance:hover{
  transform: scale(1.05);
  box-shadow:
    0 0 30px rgba(255,176,0,0.6),
    inset 0 0 12px rgba(255,255,255,0.35);
}

.saBalance:active{
  transform: scale(0.98);
}

.saBalanceIcon{
  font-size:14px;
}

.saBalanceValue{
  font-size:14px;
}

.saBalanceUnit{
  font-size:12px;
  opacity:0.8;
}

/* ===============================
   LOBBY UI KIT (SV ARENA)
================================= */

.saCard{
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  padding: 14px;
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 40px rgba(0,0,0,0.55);
}

.saH1{
  font-size: 22px;
  font-weight: 950;
  letter-spacing: .4px;
  margin: 10px 0 4px;
}

.saH2{
  font-size: 14px;
  font-weight: 900;
  opacity: .85;
  letter-spacing: .8px;
  text-transform: uppercase;
  margin: 16px 0 10px;
}

.saRow{
  display:flex;
  gap:10px;
  flex-wrap: wrap;
}

.saBtn{
  appearance: none;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.92);
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 900;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.saBtn:hover{
  transform: translateY(-1px);
  border-color: rgba(168,85,247,0.45);
  box-shadow: 0 0 24px rgba(168,85,247,0.22);
}

.saBtn:active{ transform: scale(.98); }

.saBtnGold{
  background: linear-gradient(135deg,#ffcc33,#ff9900);
  color:#000;
  border-color: rgba(255,255,255,0.10);
  box-shadow: 0 0 24px rgba(255,176,0,0.35);
}

.saBtnGhost{
  background: rgba(0,0,0,0.25);
}

.saBtn:disabled{
  opacity:.45;
  cursor:not-allowed;
  box-shadow:none;
  transform:none;
}

.saInput{
  width: 100%;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.92);
  border-radius: 14px;
  padding: 10px 12px;
  outline: none;
}

.saInput:focus{
  border-color: rgba(168,85,247,0.55);
  box-shadow: 0 0 0 3px rgba(168,85,247,0.18);
}

.saMuted{
  opacity: .7;
  font-weight: 700;
}

.saDivider{
  height: 1px;
  background: rgba(255,255,255,0.10);
  margin: 12px 0;
}

.saPill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  font-weight: 900;
  opacity:.9;
}

/* optional: collapsible “full map” */
.saDetails{
  margin-top: 10px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.35);
}
.saSummary{
  list-style:none;
  padding: 12px 12px;
  cursor:pointer;
  font-weight: 900;
  opacity:.9;
}
.saDetailsContent{
  padding: 12px;
}/* ===== ОБЩИЙ ФОН ===== */
.hub {
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, #1a1a2e, #0a0a12 70%);
  overflow: hidden;
  position: relative;
  font-family: sans-serif;
  color: white;
}

/* ===== ДИНАМИЧЕСКИЙ ФОН С ЧАСТИЦАМИ ===== */
.bg-animation {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 40%, #1e1a3a, #0a0a12);
  background-image: repeating-radial-gradient(circle at 20% 30%, rgba(168, 85, 247, 0.15) 0px, transparent 80px);
  animation: breathe 8s ease-in-out infinite, shiftBg 20s linear infinite;
  z-index: 0;
}

@keyframes breathe {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

@keyframes shiftBg {
  0% { background-position: 0% 0%; }
  50% { background-position: 100% 100%; }
  100% { background-position: 0% 0%; }
}

/* Плавающие частицы */
.particle {
  position: absolute;
  background: rgba(168, 85, 247, 0.3);
  border-radius: 50%;
  pointer-events: none;
  animation: floatParticle linear infinite;
  z-index: 0;
}

@keyframes floatParticle {
  0% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  10% { opacity: 0.6; }
  90% { opacity: 0.6; }
  100% {
    transform: translateY(-20vh) rotate(360deg);
    opacity: 0;
  }
}

/* ===== HEADER ===== */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  z-index: 2;
  position: relative;
}

.logo {
  font-size: 26px;
  font-weight: bold;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #fff, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.balance {
  font-size: 22px;
  font-weight: bold;
  background: linear-gradient(90deg, #ffd700, #ffae00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: transform 0.2s ease;
  cursor: pointer;
}

.balance:hover {
  transform: scale(1.05);
}

.sound-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  font-size: 24px;
  cursor: pointer;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  backdrop-filter: blur(4px);
}

.sound-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

/* ===== СЕТКА ИГР ===== */
.games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 30px;
  padding: 30px;
  margin-top: 20px;
  position: relative;
  z-index: 2;
  backdrop-filter: blur(2px);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 48px;
  margin-left: 20px;
  margin-right: 20px;
}

/* ===== КАРТОЧКА (улучшенная) ===== */
.card {
  width: 100%;
  height: 200px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  cursor: pointer;
  overflow: hidden;
  transition: box-shadow 0.3s ease, transform 0.1s linear;
  transform-style: preserve-3d;
  opacity: 0;
  transform: translateY(30px);
  animation: cardAppear 0.5s cubic-bezier(0.2, 0.9, 0.4, 1.1) forwards;
}

@keyframes cardAppear {
  to {
    opacity: 1;
    transform: translateY(0) rotateX(0deg);
  }
}

.card:hover {
  box-shadow: 0 25px 40px rgba(168, 85, 247, 0.4);
}

.card:active {
  transform: scale(0.97) !important;
  transition: transform 0.05s;
}

/* Внутренний блик для tilt */
.card .glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--glow-x, 50%) var(--glow-y, 50%), rgba(168, 85, 247, 0.5), transparent 70%);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  border-radius: inherit;
}

.card:hover .glow {
  opacity: 1;
}

/* Градиентная обводка при ховере */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: linear-gradient(120deg, transparent, rgba(168, 85, 247, 0.8), transparent);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s;
}

.card:hover::after {
  opacity: 1;
}

/* Контент карточки */
.card-content {
  position: relative;
  z-index: 2;
  padding: 20px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.card p {
  margin-top: 8px;
  font-size: 14px;
  color: #ddd;
}

/* Плавающая иконка */
.card-icon {
  font-size: 56px;
  position: absolute;
  bottom: 12px;
  right: 16px;
  opacity: 0.2;
  transition: all 0.3s ease;
  animation: floatIcon 4s infinite alternate;
  pointer-events: none;
  z-index: 1;
}

.card:hover .card-icon {
  opacity: 0.6;
  transform: scale(1.1) rotate(5deg);
}

@keyframes floatIcon {
  from { transform: translateY(0px); }
  to { transform: translateY(-8px); }
}

/* ===== RIPPLE ЭФФЕКТ ===== */
.ripple {
  position: fixed;
  border-radius: 50%;
  background: rgba(168, 85, 247, 0.5);
  transform: scale(0);
  animation: rippleAnim 0.6s linear forwards;
  pointer-events: none;
  z-index: 9999;
}

@keyframes rippleAnim {
  to {
    transform: scale(10);
    opacity: 0;
  }
}

/* ===== АНИМАЦИЯ ДЛЯ БАЛАНСА ===== */
.balance-update {
  animation: balancePop 0.3s ease-out;
}

@keyframes balancePop {
  0% { transform: scale(1); text-shadow: 0 0 0 rgba(255, 215, 0, 0); }
  50% { transform: scale(1.2); text-shadow: 0 0 8px gold; }
  100% { transform: scale(1); text-shadow: 0 0 0 transparent; }
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 640px) {
  .games {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
  }
  .card {
    height: 170px;
  }
  .logo {
    font-size: 20px;
  }
  .balance {
    font-size: 18px;
  }
}