﻿:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --bg0: #020712;
  --bg1: #041225;
  --cyan: #36f7ff;
  --lime: #76ff72;
  --gold: #ffd55c;
  --pink: #ff4fd8;
  --danger: #ff4b6e;
  --panel: rgba(3, 11, 26, .76);
  --stroke: rgba(112, 248, 255, .26);
  --text: #ffffff;
  --muted: rgba(222, 242, 255, .72);
  --game-max: 540px;
  --skin-primary: #36f7ff;
  --skin-secondary: #76ff72;
  --skin-rgb: 54, 247, 255;
  --skin-secondary-rgb: 118, 255, 114;
  --skin-dark: #061124;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg0); color: var(--text); font-family: Trebuchet MS, Verdana, sans-serif; touch-action: none; overscroll-behavior: none; }
body.slitherpay-game {
  min-height: 100svh;
  background:
    radial-gradient(circle at 18% 5%, rgba(54, 247, 255, .18), transparent 34%),
    radial-gradient(circle at 82% 12%, rgba(255, 79, 216, .16), transparent 34%),
    linear-gradient(180deg, #020712, #04102a 48%, #020712);
}
body.slitherpay-game::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(54,247,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(54,247,255,.04) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(180deg, transparent, #000 15%, #000 82%, transparent);
}

#slitherpay-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100svh;
  display: block;
  background: transparent;
  image-rendering: auto;
  transform: translateZ(0);
}

.hidden { display: none !important; }

.boot-loader, .overlay, .bet-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: radial-gradient(circle at center, rgba(10, 28, 62, .55), rgba(0,0,0,.84));
  backdrop-filter: blur(10px);
}
.boot-card, .panel, .bet-card {
  width: min(92vw, 390px);
  border-radius: 28px;
  border: 1px solid rgba(var(--skin-rgb), .34);
  background: linear-gradient(180deg, rgba(5, 24, 46, .94), rgba(2, 8, 18, .94));
  box-shadow: 0 26px 80px rgba(0,0,0,.55), 0 0 36px rgba(var(--skin-rgb), .18), inset 0 1px 0 rgba(255,255,255,.08);
  padding: 24px;
  text-align: center;
}
.boot-mark {
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
  position: relative;
  border-radius: 50%;
  border: 3px solid rgba(54,247,255,.22);
  animation: spin 1.6s linear infinite;
}
.boot-mark::before, .boot-mark::after { content: ''; position: absolute; inset: 9px; border-radius: 50%; border: 3px solid transparent; border-top-color: var(--lime); }
.boot-mark::after { inset: 22px; border-top-color: var(--pink); animation: spin .8s linear reverse infinite; }
.boot-mark span { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--cyan); left: 6px; top: 10px; box-shadow: 0 0 18px var(--cyan); }
@keyframes spin { to { transform: rotate(360deg); } }
.boot-card h1, .panel h1, .bet-card h2 { margin: 0 0 8px; font-size: 2rem; line-height: 1; letter-spacing: -.06em; font-weight: 1000; color: #fff; text-shadow: 0 4px 0 rgba(0,0,0,.3), 0 0 24px rgba(54,247,255,.3); }
.boot-card p, .panel p, .bet-card p { margin: 0 0 16px; color: var(--muted); font-weight: 700; line-height: 1.42; }
.boot-progress { height: 8px; border-radius: 100px; background: rgba(255,255,255,.1); overflow: hidden; }
.boot-progress span { display: block; width: 54%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--skin-primary), var(--pink)); animation: loadbar 1.2s ease-in-out infinite alternate; }
@keyframes loadbar { from { transform: translateX(-45%); } to { transform: translateX(95%); } }
.boot-card small { display: block; margin-top: 10px; color: rgba(255,255,255,.62); font-weight: 800; }

.top-hud {
  position: fixed;
  z-index: 10;
  top: calc(10px + var(--safe-top));
  left: max(10px, calc((100vw - var(--game-max)) / 2 + 10px));
  right: max(10px, calc((100vw - var(--game-max)) / 2 + 10px));
  height: 74px;
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 8px;
  pointer-events: none;
}
.hud-item {
  border-radius: 18px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(7, 25, 52, .68), rgba(2, 8, 18, .42));
  border: 1px solid rgba(54,247,255,.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.hud-item span { display: block; color: rgba(220,240,255,.75); font-size: .66rem; font-weight: 1000; text-transform: uppercase; }
.hud-item strong { display: block; margin-top: 2px; color: #fff; font-size: .98rem; font-weight: 1000; text-shadow: 0 2px 0 rgba(0,0,0,.32); }
.hud-item small { display: block; margin-top: 1px; color: rgba(255,255,255,.58); font-size: .63rem; font-weight: 900; }
.hud-prize { text-align: center; border-color: rgba(54,247,255,.25); }
.hud-prize strong { color: var(--skin-primary); font-size: clamp(1.45rem, 5.2vw, 2.3rem); line-height: 1; text-shadow: 0 3px 0 #08445b, 0 0 20px rgba(var(--skin-rgb), .6); }
.hud-target { text-align: right; }
.hud-target strong { color: var(--gold); font-size: 1rem; }
.demo-hud .hud-bet strong { color: var(--gold); }

.exit-btn, .sound-btn, .cashout-btn, .boost-btn {
  position: fixed;
  z-index: 12;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(2, 12, 24, .62);
  color: #fff;
  box-shadow: 0 12px 28px rgba(0,0,0,.28);
  backdrop-filter: blur(8px);
  cursor: pointer;
}
.exit-btn { top: calc(92px + var(--safe-top)); right: max(12px, calc((100vw - var(--game-max)) / 2 + 12px)); height: 38px; border-radius: 13px; padding: 0 16px; font-weight: 1000; }
.sound-btn { right: max(14px, calc((100vw - var(--game-max)) / 2 + 14px)); bottom: calc(18px + var(--safe-bottom)); width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center; }
.sound-btn svg { width: 25px; fill: #fff; }
.cashout-btn { left: max(14px, calc((100vw - var(--game-max)) / 2 + 14px)); right: max(84px, calc((100vw - var(--game-max)) / 2 + 84px)); bottom: calc(18px + var(--safe-bottom)); height: 54px; border-radius: 18px; border: 0; background: linear-gradient(180deg, #ffb22e, #ff5a00); color: #1a0800; font-size: 1.02rem; font-weight: 1000; animation: cashPulse .9s ease-in-out infinite; }
.boost-btn {
  right: max(14px, calc((100vw - var(--game-max)) / 2 + 14px));
  bottom: calc(86px + var(--safe-bottom));
  width: 72px;
  height: 72px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  gap: 0;
  padding: 8px 6px;
  background: linear-gradient(180deg, var(--skin-primary), var(--skin-secondary));
  color: #061124;
  font-weight: 1000;
  text-shadow: 0 1px 0 rgba(255,255,255,.34);
  box-shadow: 0 0 30px rgba(var(--skin-rgb), .42), 0 16px 34px rgba(0,0,0,.34);
  touch-action: none;
  user-select: none;
}
.boost-btn span { display: block; font-size: .82rem; line-height: 1; letter-spacing: -.04em; }
.boost-btn small { display: block; margin-top: -7px; font-size: .62rem; line-height: 1; color: rgba(6,17,36,.75); font-weight: 1000; }
.boost-btn.active { transform: scale(.96); filter: brightness(1.18); box-shadow: 0 0 42px rgba(var(--skin-rgb), .58), 0 0 54px rgba(var(--skin-secondary-rgb), .44); }
.boost-btn.disabled { opacity: .48; filter: grayscale(.35); }
@keyframes cashPulse { 50% { transform: scale(1.025); box-shadow: 0 0 34px rgba(255,133,0,.72); } }

.round-panel {
  position: fixed;
  z-index: 10;
  top: calc(88px + var(--safe-top));
  left: 50%;
  width: min(250px, 54vw);
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}
.progress-track { height: 10px; border-radius: 100px; padding: 2px; background: rgba(0,0,0,.46); border: 1px solid rgba(255,255,255,.16); box-shadow: inset 0 1px 7px rgba(0,0,0,.45); }
.progress-track span { display: block; width: 0%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--skin-primary), var(--gold)); transition: width .22s ease; }
.round-panel small { display: block; margin-top: 5px; color: rgba(240,250,255,.72); font-size: .7rem; font-weight: 900; text-shadow: 0 2px 0 rgba(0,0,0,.45); }

.gesture-hint {
  position: fixed;
  z-index: 11;
  left: 50%;
  top: 54%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  text-shadow: 0 4px 0 rgba(0,0,0,.32), 0 0 24px rgba(54,247,255,.5);
}
.gesture-hint strong { display: block; font-size: clamp(2rem, 9vw, 4rem); font-weight: 1000; color: #fff; letter-spacing: -.06em; }
.gesture-hint small { display: block; margin-top: 4px; color: #bdefff; font-weight: 1000; }

.panel-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 12px;
  margin-bottom: 12px;
  border-radius: 100px;
  background: rgba(var(--skin-rgb), .13);
  color: var(--skin-primary);
  border: 1px solid rgba(var(--skin-rgb), .28);
  font-size: .74rem;
  font-weight: 1000;
  text-transform: uppercase;
}
#overlay-btn, .bet-btn {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(180deg, var(--skin-primary), var(--skin-secondary));
  color: #051124;
  font-size: 1rem;
  font-weight: 1000;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(var(--skin-rgb), .26);
}

.bet-stepper { display: grid; grid-template-columns: 58px 1fr 58px; gap: 10px; margin: 12px 0 10px; }
.bet-step-btn { height: 56px; border: 1px solid rgba(255,255,255,.16); border-radius: 18px; color: #fff; background: rgba(255,255,255,.08); font-size: 1.5rem; font-weight: 1000; cursor: pointer; }
#bet-input { width: 100%; border: 1px solid rgba(54,247,255,.2); border-radius: 18px; color: var(--gold); background: rgba(0,0,0,.22); text-align: center; font-size: 1.55rem; font-weight: 1000; outline: none; }
#bet-range, #bet-preview { display: block; color: rgba(255,255,255,.66); font-size: .76rem; font-weight: 900; }
.bet-suggest-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 14px 0; }
.bet-suggest-btn { height: 44px; border-radius: 14px; border: 1px solid rgba(255,255,255,.14); color: #fff; background: rgba(255,255,255,.08); font-weight: 1000; cursor: pointer; }
.skin-picker {
  margin: 13px 0 12px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(54,247,255,.16);
  background: rgba(255,255,255,.055);
}
.skin-picker span {
  display: block;
  margin-bottom: 9px;
  color: rgba(234,248,255,.82);
  font-size: .75rem;
  font-weight: 1000;
  text-transform: uppercase;
}
.skin-options { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.skin-option {
  height: 38px;
  border-radius: 14px;
  border: 2px solid rgba(255,255,255,.18);
  background:
    radial-gradient(circle at 35% 28%, rgba(255,255,255,.86), transparent 23%),
    var(--skin);
  box-shadow: 0 0 18px rgba(54,247,255,.18);
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, filter .16s ease;
}
.skin-option.active {
  transform: translateY(-2px) scale(1.04);
  border-color: #fff;
  filter: brightness(1.18);
}
.overlay-skin-picker { margin-bottom: 16px; }
.bet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.bet-btn.secondary { background: rgba(255,255,255,.08); color: #fff; box-shadow: none; border: 1px solid rgba(255,255,255,.14); }

.gain-feed { position: fixed; inset: 0; pointer-events: none; z-index: 13; overflow: hidden; }
.gain-pop { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%); font-weight: 1000; font-size: .9rem; color: var(--gold); text-shadow: 0 2px 0 rgba(0,0,0,.5), 0 0 14px rgba(255,213,92,.75); animation: gainFloat .75s ease-out forwards; }
@keyframes gainFloat { to { opacity: 0; transform: translate(-50%, -160%); } }

@media (min-width: 720px) {
  body.slitherpay-game::after {
    content: '';
    position: fixed;
    top: 0;
    bottom: 0;
    left: calc(50% - var(--game-max) / 2);
    width: var(--game-max);
    pointer-events: none;
    border-left: 1px solid rgba(54,247,255,.12);
    border-right: 1px solid rgba(54,247,255,.12);
    box-shadow: 0 0 80px rgba(54,247,255,.06);
  }
}
@media (max-width: 430px) {
  .top-hud { height: 66px; gap: 5px; left: 6px; right: 6px; top: calc(7px + var(--safe-top)); }
  .hud-item { border-radius: 15px; padding: 8px 8px; }
  .hud-item span { font-size: .58rem; }
  .hud-item strong { font-size: .82rem; }
  .hud-item small { font-size: .56rem; }
  .hud-prize strong { font-size: 1.62rem; }
  .round-panel { top: calc(76px + var(--safe-top)); width: 58vw; }
  .exit-btn { top: calc(80px + var(--safe-top)); height: 35px; right: 9px; padding: 0 13px; }
  .boost-btn { width: 66px; height: 66px; border-radius: 21px; bottom: calc(82px + var(--safe-bottom)); right: 9px; }
  .boot-card, .panel, .bet-card { padding: 20px; border-radius: 24px; }
  .bet-stepper { grid-template-columns: 54px 1fr 54px; }
}
