* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; font-family: system-ui, -apple-system, sans-serif;
  background: radial-gradient(120% 80% at 50% 30%, #16335a 0%, #0a1c2e 45%, #05140d 100%); }

/* размытый стадион на весь экран — заполняет полосы по краям */
#bgfill {
  position: fixed; left: -5%; top: -5%; width: 110%; height: 110%;
  object-fit: cover; filter: blur(26px) brightness(.45) saturate(1.1);
  z-index: -1; pointer-events: none;
}

/* логическая сцена 1376x768, масштабируется в JS */
#stage {
  position: absolute; top: 50%; left: 50%;
  width: 1376px; height: 768px;
  transform-origin: center center;
  touch-action: none; user-select: none;
}
#bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

#keeper {
  position: absolute; bottom: 248px; left: 688px;
  height: 150px; transform: translateX(-50%);
  transition: left 0.28s cubic-bezier(.34,1.2,.64,1), bottom 0.28s ease, height 0.28s ease;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,.45));
  pointer-events: none;
}
#ball {
  position: absolute; left: 688px; top: 612px;
  width: 70px; height: 70px; transform: translate(-50%, -50%);
  filter: drop-shadow(0 8px 8px rgba(0,0,0,.5));
  cursor: grab; z-index: 6;
}

#fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 8; }

/* девушка-болельщица — всегда на виду, в правом углу */
#girl {
  position: absolute; right: 24px; bottom: 0; height: 340px;
  transform-origin: bottom center; z-index: 7; pointer-events: none;
  filter: drop-shadow(0 10px 22px rgba(0,0,0,.55));
  transition: transform .25s cubic-bezier(.34,1.5,.5,1), height .25s ease;
}
#girl.celebrate { height: 440px; animation: girlpop .6s ease; }
@keyframes girlpop {
  0% { transform: scale(1) translateY(0); }
  35% { transform: scale(1.12) translateY(-14px) rotate(-3deg); }
  100% { transform: scale(1) translateY(0); }
}

/* HUD */
#hud {
  position: absolute; top: 18px; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-between; padding: 0 28px;
  pointer-events: none;
}
.hud-item {
  background: rgba(0,0,0,.42); color: #fff; font-weight: 800; font-size: 30px;
  padding: 8px 20px; border-radius: 999px; backdrop-filter: blur(4px);
  text-shadow: 0 2px 4px rgba(0,0,0,.5);
}

#flash {
  position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none;
  z-index: 9; transition: opacity .12s ease;
}

#hint {
  position: absolute; bottom: 26px; left: 0; right: 0; text-align: center; z-index: 10;
  color: #fff; font-size: 26px; font-weight: 600; opacity: .85;
  text-shadow: 0 2px 6px rgba(0,0,0,.7); pointer-events: none;
}

#gameover {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: rgba(0,0,0,.72); color: #fff; text-align: center;
}
#gameover h1 { font-size: 64px; }
#gameover p { font-size: 34px; }
#gameover button {
  font-size: 34px; padding: 18px 52px; border: 0; border-radius: 999px;
  background: linear-gradient(180deg,#ffe26b,#ffc61a); font-weight: 800; cursor: pointer;
  box-shadow: 0 8px 0 #c9930a;
}
#gameover button:active { transform: translateY(4px); box-shadow: 0 4px 0 #c9930a; }

#goaltext {
  position: absolute; top: 38%; left: 50%; z-index: 12;
  transform: translate(-50%,-50%);
  font-size: 150px; font-weight: 900; font-style: italic;
  color: #fff; -webkit-text-stroke: 6px #0a2a14;
  text-shadow: 0 6px 0 #0a8a3a, 0 10px 24px rgba(0,0,0,.5);
  letter-spacing: 4px; pointer-events: none;
  animation: goalpop 1.1s cubic-bezier(.2,1.5,.4,1) forwards;
}
@keyframes goalpop {
  0%   { transform: translate(-50%,-50%) scale(.2) rotate(-12deg); opacity: 0; }
  18%  { transform: translate(-50%,-50%) scale(1.15) rotate(-6deg); opacity: 1; }
  30%  { transform: translate(-50%,-50%) scale(1) rotate(-6deg); }
  78%  { transform: translate(-50%,-50%) scale(1) rotate(-6deg); opacity: 1; }
  100% { transform: translate(-50%,-58%) scale(1.05) rotate(-6deg); opacity: 0; }
}

/* ===== оверлеи: правила + кейс ===== */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(3, 10, 20, .82); backdrop-filter: blur(6px);
  padding: 20px; box-sizing: border-box;
}
.panel {
  background: linear-gradient(180deg, #15355c, #0b1d33);
  border: 2px solid rgba(255,255,255,.12); border-radius: 26px;
  padding: 32px 26px; text-align: center; color: #fff; max-width: 440px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
}
.panel-emoji { font-size: 56px; }
.panel h1 { font-size: 56px; margin: 6px 0 14px; letter-spacing: 1px; }
.panel p { font-size: 22px; line-height: 1.4; margin: 8px 0; }
.panel .sub { font-size: 17px; opacity: .75; }
.panel button, #claim-btn {
  margin-top: 22px; font-size: 26px; font-weight: 800; color: #1a1100;
  padding: 16px 46px; border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(180deg, #ffe26b, #ffc61a); box-shadow: 0 7px 0 #c9930a;
}
.panel button:active, #claim-btn:active { transform: translateY(4px); box-shadow: 0 3px 0 #c9930a; }

/* кейс-рулетка */
.case-box { width: 100%; max-width: 680px; text-align: center; color: #fff; }
#case-title { font-size: 30px; margin-bottom: 16px; text-shadow: 0 2px 6px rgba(0,0,0,.6); }
#reel-viewport {
  position: relative; width: 100%; height: 200px; overflow: hidden;
  border-radius: 18px; background: rgba(0,0,0,.45);
  border: 2px solid rgba(255,255,255,.14);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
#reel { display: flex; gap: 12px; padding: 14px 0; height: 100%; will-change: transform; }
.reel-card {
  flex: 0 0 150px; width: 150px; height: 172px; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.25));
  border-bottom: 5px solid var(--rar, #4b69ff);
  box-shadow: inset 0 0 36px var(--rar, #4b69ff);
}
.reel-card .emoji { font-size: 58px; }
.reel-card .picon { height: 92px; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0,0,0,.45)); }
.reel-card .name { font-size: 16px; font-weight: 700; padding: 0 6px; }
.r-blue   { --rar: #4b69ff; } .r-purple { --rar: #8847ff; }
.r-pink   { --rar: #d32ce6; } .r-red    { --rar: #eb4b4b; }
.r-gold   { --rar: #ffae00; }
#reel-marker {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 4px; margin-left: -2px;
  background: #ffd84d; box-shadow: 0 0 16px 3px rgba(255,216,77,.9); z-index: 3;
}
#case-result { margin-top: 22px; }
#prize-card {
  display: inline-flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 22px 36px; border-radius: 18px; color: #fff;
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(0,0,0,.3));
  border: 2px solid var(--rar, #ffd84d); box-shadow: 0 0 40px var(--rar, #ffd84d);
  animation: prizepop .5s cubic-bezier(.2,1.6,.4,1);
}
#prize-card .emoji { font-size: 72px; }
#prize-card .picon-big { height: 132px; object-fit: contain; filter: drop-shadow(0 6px 14px rgba(0,0,0,.5)); }
#prize-card .name { font-size: 28px; font-weight: 800; }
@keyframes prizepop { 0% { transform: scale(.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.hidden { display: none !important; }
