:root {
  --text: #f7fbff;
  --yellow: #ffe54f;
  --red: #ff4040;
  --green: #35df6d;
  --panel: rgba(10, 24, 14, 0.48);
  --panel-strong: rgba(12, 28, 16, 0.72);
  --border: rgba(255,255,255,0.12);
  --card-w: 92px;
  --card-h: 124px;
  --scene-perspective: 980px;

  /* Масштаб персонажа. Меняй только это значение: 1 = стандарт, 1.15 = крупнее, 0.9 = меньше. */
  --hero-scale: 1;
  --hero-offset-x: 0px;
  --hero-offset-y: 0px;
  --hero-base-height: calc(100vh - 2px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 229, 79, 0.10), transparent 28%),
    radial-gradient(circle at 90% 80%, rgba(255, 64, 64, 0.14), transparent 30%),
    linear-gradient(180deg, #06120a 0%, #07170d 52%, #051009 100%);
  overflow: hidden;
}

button, input { font-family: inherit; }

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at center, black 42%, transparent 88%);
  pointer-events: none;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(88px);
  pointer-events: none;
}

.orb-a { width: 360px; height: 360px; left: -120px; top: -140px; background: rgba(255, 225, 60, 0.18); }
.orb-b { width: 420px; height: 420px; right: -140px; bottom: -150px; background: rgba(255, 71, 71, 0.18); }
.orb-c { width: 300px; height: 300px; left: 44%; bottom: -100px; background: rgba(53, 223, 109, 0.15); }

.app {
  position: relative;
  z-index: 2;
  width: 100vw;
  height: 100vh;
}

.scene-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.scene-bg,
.scene-shade,
.light-core,
.floor-ring,
.scene,
.winner-layer,
.modes-panel,
.bottom-controls {
  position: absolute;
}

.scene-bg {
  inset: 0;
  background-image: url('assets/scene-bg.png');
  background-size: cover;
  background-position: center center;
  z-index: 0;
}

.scene-shade {
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 50% 54%, rgba(255, 229, 79, 0.14), transparent 18%),
    linear-gradient(180deg, rgba(4, 13, 6, 0.08), rgba(4, 13, 6, 0.24));
}

.scene-wrap::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 52%;
  width: 78%;
  height: 38%;
  transform: translate(-50%, -50%) rotateX(68deg);
  border-radius: 50%;
  border: 2px solid rgba(255, 229, 79, 0.12);
  box-shadow:
    0 0 0 18px rgba(255,255,255,0.012),
    0 0 80px rgba(255, 229, 79, 0.12),
    inset 0 0 70px rgba(255, 64, 64, 0.10);
  z-index: 2;
}

.light-core {
  left: 50%;
  top: 50%;
  width: 360px;
  height: 360px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255,229,79,0.22), rgba(255,229,79,0.04) 42%, transparent 70%);
  filter: blur(4px);
  animation: pulse 3s ease-in-out infinite;
  z-index: 3;
}

.floor-ring {
  left: 50%;
  top: 60%;
  width: 70%;
  height: 22%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255,229,79,0.14), rgba(255,229,79,0.03) 42%, transparent 72%);
  filter: blur(10px);
  z-index: 3;
}

@keyframes pulse {
  0%, 100% { opacity: 0.72; transform: translate(-50%, -50%) scale(0.95); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
}

.scene {
  inset: 0;
  perspective: var(--scene-perspective);
  perspective-origin: 50% 43%;
  transform-style: preserve-3d;
  z-index: 8;
}

.cards-layer {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.cards-back-layer { z-index: 6; }
.cards-front-layer { z-index: 10; }

.hero-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%) translateZ(0);
  z-index: 8;
  pointer-events: none;
}

.hero-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(48vw, 560px);
  height: 74vh;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: radial-gradient(circle at 50% 46%, rgba(255, 228, 92, 0.28), rgba(255, 228, 92, 0.08) 46%, transparent 72%);
  filter: blur(14px);
}

.hero-image {
  position: absolute;
  left: 50%;
  top: 50%;
  width: auto;
  height: var(--hero-base-height);
  max-width: none;
  max-height: none;
  object-fit: contain;
  object-position: center center;
  transform: translate(calc(-50% + var(--hero-offset-x)), calc(-50% + var(--hero-offset-y))) scale(var(--hero-scale));
  transform-origin: center center;
  filter: drop-shadow(0 18px 28px rgba(0,0,0,0.38));
}

.number-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--card-w);
  height: var(--card-h);
  margin-left: calc(var(--card-w) / -2);
  margin-top: calc(var(--card-h) / -2);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(145deg, #fff7bf 0%, #ffd94a 46%, #f7a900 100%);
  border: 2px solid #ffffff;
  color: var(--text);
  box-shadow:
    0 26px 46px rgba(0,0,0,0.35),
    inset 0 2px 0 rgba(255,255,255,0.65),
    inset 0 -16px 26px rgba(0,0,0,0.18);
  transform-style: preserve-3d;
  will-change: transform, opacity, filter;
  overflow: hidden;
}

.number-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 18%, rgba(255,255,255,0.70), transparent 24%),
    linear-gradient(120deg, transparent 8%, rgba(255,255,255,0.22) 45%, transparent 72%);
  pointer-events: none;
}

.number-card::after {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 18px;
  border: 2px solid rgba(255,255,255,0.35);
  transform: translateZ(3px);
}

.number-card span {
  position: relative;
  z-index: 2;
  transform: translateZ(22px);
  font-size: clamp(26px, 2.8vw, 40px);
  font-weight: 900;
  letter-spacing: -0.06em;
  text-shadow: 0 8px 22px rgba(0,0,0,0.55);
}

.number-card.green {
  background: linear-gradient(145deg, #d9ffe7 0%, #57ef8d 48%, #0a9c49 100%);
}

.number-card.red {
  background: linear-gradient(145deg, #ffd7d7 0%, #ff6a6a 48%, #c91515 100%);
}

.number-card.yellow {
  background: linear-gradient(145deg, #fff6be 0%, #ffd94f 46%, #f0a100 100%);
  color: #101010;
}

.number-card.back {
  filter: blur(1px) saturate(0.90);
}

.number-card.dim {
  opacity: 0.18 !important;
  filter: blur(1.8px) grayscale(0.28);
}

.number-card.hidden-card {
  opacity: 0 !important;
  visibility: hidden;
}

.winner-layer {
  inset: 0;
  z-index: 25;
  pointer-events: none;
}

.winner-card {
  position: absolute;
  left: 50%;
  top: 55%;
  width: 180px;
  height: 180px;
  transform: translate(-50%, -50%) scale(1);
  border-radius: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #fff7bf 0%, #ffd94a 46%, #f7a900 100%);
  border: 2px solid #ffffff;
  box-shadow:
    0 0 0 9px rgba(255,255,255,0.07),
    0 38px 80px rgba(0,0,0,0.46),
    0 0 80px rgba(255,229,79,0.32),
    inset 0 2px 0 rgba(255,255,255,0.72),
    inset 0 -18px 28px rgba(0,0,0,0.18);
  animation: winnerPop 1.5s ease-in-out infinite;
  opacity: 1 !important;
}

.winner-card.green {
  background: linear-gradient(145deg, #d9ffe7 0%, #57ef8d 48%, #0a9c49 100%);
}

.winner-card.red {
  background: linear-gradient(145deg, #ffd7d7 0%, #ff6a6a 48%, #c91515 100%);
}

.winner-card.yellow {
  background: linear-gradient(145deg, #fff6be 0%, #ffd94f 46%, #f0a100 100%);
}

.winner-card span {
  font-size: 72px;
  font-weight: 900;
  letter-spacing: -0.08em;
  text-shadow: 0 10px 26px rgba(0,0,0,0.5);
}

@keyframes winnerPop {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.055); }
}



.modes-panel {
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: rgba(6, 18, 10, 0.42);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.mode-btn,
.btn {
  border: 0;
  cursor: pointer;
  color: var(--text);
  transition: transform 0.18s ease, filter 0.18s ease, opacity 0.18s ease;
}

.mode-btn:hover:not(.active),
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.mode-btn {
  width: 58px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 17px;
  font-weight: 900;
}

.mode-btn.active {
  color: #0b1006;
  background: linear-gradient(135deg, var(--yellow), #fff288 44%, #ff9287 100%);
  box-shadow: 0 14px 28px rgba(255, 229, 79, 0.22);
}

.bottom-controls {
  right: 18px;
  bottom: 18px;
  z-index: 40;
}

.range-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 28px;
  border: 1px solid rgba(255,255,255,0.10);
  background: linear-gradient(180deg, rgba(28, 8, 8, 0.62), rgba(20, 7, 7, 0.72));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    0 18px 42px rgba(0,0,0,0.34),
    inset 0 1px 0 rgba(255,255,255,0.06);
}

.range-box input {
  width: 108px;
  height: 68px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(23, 82, 36, 0.86), rgba(18, 67, 30, 0.92));
  color: var(--text);
  font-size: 30px;
  font-weight: 900;
  text-align: center;
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 10px 20px rgba(0,0,0,0.18);
}

.range-box input:focus {
  border-color: rgba(255, 229, 79, 0.56);
  box-shadow:
    0 0 0 4px rgba(255, 229, 79, 0.12),
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 10px 20px rgba(0,0,0,0.18);
}

.btn {
  border-radius: 18px;
  font-weight: 900;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.btn-apply {
  width: 76px;
  height: 56px;
  background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.07));
  border: 1px solid rgba(255,255,255,0.08);
}

.btn-main {
  min-width: 224px;
  height: 68px;
  color: #0b1006;
  font-size: 18px;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #f7ea61 0%, #f4dc57 44%, #f3b38f 100%);
  box-shadow: 0 20px 34px rgba(255, 229, 79, 0.18);
}

@media (max-width: 900px) {
  .modes-panel {
    right: 10px;
    padding: 8px;
  }

  .mode-btn {
    width: 50px;
    height: 40px;
    font-size: 15px;
  }

  .range-box {
    gap: 8px;
    padding: 10px;
  }

  .range-box input {
    width: 90px;
    height: 50px;
    font-size: 20px;
  }

  .btn-apply,
  .btn-main {
    height: 50px;
  }

  .btn-main {
    min-width: 146px;
  }
}

@media (max-width: 680px) {
  .modes-panel {
    top: auto;
    right: 10px;
    bottom: 84px;
    transform: none;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .bottom-controls {
    width: calc(100% - 20px);
    left: 10px;
    right: 10px;
    transform: none;
    bottom: 10px;
  }

  .range-box {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
  }

  .winner-card {
    width: 150px;
    height: 150px;
  }

  .winner-card span {
    font-size: 58px;
  }
}
