:root {
  color-scheme: dark;
  --ink: #fffaff;
  --deep: #17112f;
  --night: #0d0824;
  --line: rgba(255, 255, 255, 0.28);
  --glass: rgba(255, 255, 255, 0.18);
  --glass-strong: rgba(255, 255, 255, 0.28);
  --grass: #65f4b8;
  --soil: #62402e;
  --gold: #ffe45e;
  --pink: #ff4fd8;
  --violet: #8b5cff;
  --blue: #35d7ff;
  --lime: #b6ff5c;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--night);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent 78%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    radial-gradient(circle at 20% 30%, #fff 0 1px, transparent 1.5px),
    radial-gradient(circle at 70% 60%, #fff 0 1px, transparent 1.5px);
  background-size: 19px 19px, 31px 31px;
  mix-blend-mode: overlay;
}

button {
  font: inherit;
}

#gradient-field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: saturate(1.34) contrast(1.08) hue-rotate(0deg);
  transform: scale(1.04);
  animation: color-cycle 14s ease-in-out infinite alternate;
  background:
    radial-gradient(circle at 10% 18%, rgba(255, 79, 216, 0.7), transparent 30rem),
    radial-gradient(circle at 86% 22%, rgba(53, 215, 255, 0.72), transparent 28rem),
    radial-gradient(circle at 54% 88%, rgba(182, 255, 92, 0.58), transparent 32rem),
    linear-gradient(135deg, #3910a8, #ff4fd8 38%, #1ddcff 72%, #b6ff5c);
}

@keyframes color-cycle {
  0% {
    filter: saturate(1.34) contrast(1.08) hue-rotate(0deg);
  }
  45% {
    filter: saturate(1.55) contrast(1.14) hue-rotate(52deg);
  }
  100% {
    filter: saturate(1.42) contrast(1.1) hue-rotate(104deg);
  }
}

.game-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  padding: 24px clamp(14px, 4vw, 56px) 38px;
}

.stage {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 12px;
  min-height: calc(100vh - 62px);
  max-width: 1120px;
  margin: 0 auto;
}

.falling-title {
  display: flex;
  justify-content: center;
  gap: clamp(3px, 0.9vw, 12px);
  min-height: clamp(80px, 11vw, 126px);
  padding-top: 8px;
  perspective: 900px;
  pointer-events: none;
}

.falling-title span {
  display: inline-block;
  font-size: clamp(46px, 8.6vw, 108px);
  font-weight: 1000;
  line-height: 0.82;
  letter-spacing: 0;
  color: #fffaff;
  text-shadow:
    1px 1px 0 #ffe45e,
    2px 2px 0 #35d7ff,
    3px 3px 0 #ff4fd8,
    4px 4px 0 #8b5cff,
    0 0 26px rgba(255, 255, 255, 0.72),
    14px 22px 34px rgba(23, 17, 47, 0.35);
  transform: translate3d(calc((var(--i) - 3.5) * 10px), -135vh, 120px)
    rotateX(75deg) rotateY(calc((var(--i) - 4) * 16deg))
    rotateZ(calc((var(--i) - 4) * -10deg));
  animation: title-drop 1.55s cubic-bezier(0.15, 1.2, 0.28, 1) forwards;
  animation-delay: calc(var(--i) * 0.09s);
}

@keyframes title-drop {
  0% {
    filter: blur(4px);
  }
  58% {
    transform: translate3d(calc((var(--i) - 3.5) * -7px), 18px, 20px)
      rotateX(-18deg) rotateY(calc((var(--i) - 4) * -7deg))
      rotateZ(calc((var(--i) - 4) * 6deg));
  }
  76% {
    transform: translate3d(calc((var(--i) - 3.5) * 3px), -8px, 42px)
      rotateX(10deg) rotateY(calc((var(--i) - 4) * 4deg))
      rotateZ(calc((var(--i) - 4) * -3deg));
  }
  100% {
    filter: blur(0);
    transform: translate3d(0, 0, 0) rotateX(0) rotateY(0) rotateZ(0);
  }
}

.hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(120px, 160px);
  gap: 12px;
}

.hud-item,
.start-button,
.prompt {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.1));
  box-shadow:
    0 24px 70px rgba(31, 18, 82, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.36);
  backdrop-filter: blur(22px) saturate(1.35);
}

.hud-item {
  min-height: 70px;
  padding: 14px 16px;
}

.hud-item span {
  display: block;
  color: rgba(255, 250, 255, 0.78);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.hud-item strong {
  display: block;
  margin-top: 5px;
  color: var(--gold);
  font-size: 32px;
  line-height: 1;
}

.start-button {
  min-height: 70px;
  border-radius: 22px;
  color: var(--deep);
  background: linear-gradient(135deg, #ffe45e, #ff8bd1 48%, #35d7ff);
  cursor: pointer;
  font-weight: 1000;
  text-transform: uppercase;
  transition:
    transform 160ms ease,
    filter 160ms ease;
}

.start-button:hover {
  filter: brightness(1.08) saturate(1.12);
  transform: translateY(-3px) scale(1.01);
}

.start-button:active {
  transform: translateY(1px);
}

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(86px, 1fr));
  gap: clamp(8px, 1.5vw, 16px);
  align-content: center;
  min-height: 304px;
  padding: clamp(8px, 1.5vw, 18px);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 28px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08));
  background-size: 48px 48px;
  box-shadow:
    inset 0 0 90px rgba(255, 255, 255, 0.13),
    0 30px 80px rgba(23, 17, 47, 0.3);
  backdrop-filter: blur(20px) saturate(1.25);
}

.hole {
  position: relative;
  display: grid;
  min-height: clamp(82px, 10vw, 104px);
  place-items: end center;
  overflow: hidden;
  border: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 24px;
  background:
    radial-gradient(ellipse at center 76%, rgba(42, 20, 18, 0.52) 0 35%, transparent 36%),
    linear-gradient(145deg, rgba(101, 244, 184, 0.82), rgba(53, 215, 255, 0.5) 55%, rgba(255, 79, 216, 0.36));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -28px 54px rgba(30, 113, 75, 0.18);
  cursor: crosshair;
}

.hole::before {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 12%;
  height: 25%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at center, #1b0b16 0 46%, #7a4330 47% 70%, transparent 72%);
  box-shadow:
    inset 0 8px 18px rgba(0, 0, 0, 0.68),
    0 0 26px rgba(255, 228, 94, 0.14);
}

.hole.hit {
  animation: bump 180ms ease;
}

@keyframes bump {
  50% {
    transform: scale(0.98);
  }
}

.samoyed {
  position: absolute;
  bottom: 9%;
  width: min(80%, 130px);
  aspect-ratio: 1 / 0.94;
  transform: translateY(112%) rotate(var(--tilt, 0deg));
  transition: transform 150ms cubic-bezier(0.2, 0.9, 0.2, 1.2);
  pointer-events: none;
}

.hole.up .samoyed {
  transform: translateY(4%) rotate(var(--tilt, 0deg));
}

.head,
.ear,
.fur,
.eye,
.muzzle,
.nose,
.smile,
.paws {
  position: absolute;
  display: block;
}

.head {
  inset: 13% 8% 10%;
  border-radius: 48% 48% 45% 45%;
  background:
    radial-gradient(circle at 26% 24%, #ffffff 0 10%, transparent 11%),
    radial-gradient(circle at 74% 24%, #ffffff 0 10%, transparent 11%),
    linear-gradient(180deg, #fffefa, #f3ead9);
  box-shadow:
    inset 0 -10px 18px rgba(199, 167, 123, 0.22),
    0 10px 20px rgba(28, 18, 12, 0.24);
}

.ear {
  top: 8%;
  width: 33%;
  height: 38%;
  border-radius: 70% 70% 24% 24%;
  background: linear-gradient(180deg, #fffefa, #f0e2c7);
}

.ear-left {
  left: 5%;
  transform: rotate(-32deg);
}

.ear-right {
  right: 5%;
  transform: rotate(32deg);
}

.fur {
  top: 45%;
  width: 28%;
  height: 36%;
  background: #f7efdf;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.fur-left {
  left: -3%;
  transform: rotate(19deg);
}

.fur-right {
  right: -3%;
  transform: rotate(-19deg);
}

.eye {
  top: 38%;
  width: 8%;
  height: 9%;
  border-radius: 50%;
  background: #202020;
  box-shadow: 0 0 0 3px rgba(32, 32, 32, 0.05);
}

.eye-left {
  left: 34%;
}

.eye-right {
  right: 34%;
}

.muzzle {
  left: 30%;
  right: 30%;
  bottom: 19%;
  height: 30%;
  border-radius: 48%;
  background: #fffaf1;
}

.nose {
  left: 37%;
  top: 22%;
  width: 26%;
  height: 20%;
  border-radius: 45% 45% 55% 55%;
  background: #222;
}

.smile {
  left: 25%;
  top: 45%;
  width: 50%;
  height: 30%;
  border-bottom: 3px solid #2b2b2b;
  border-radius: 0 0 48% 48%;
}

.paws {
  left: 18%;
  right: 18%;
  bottom: 0;
  height: 18%;
  border-radius: 999px 999px 20px 20px;
  background: linear-gradient(90deg, #fff9e9 0 46%, transparent 47% 53%, #fff9e9 54%);
}

.prompt {
  margin: 0;
  padding: 14px 16px;
  color: rgba(255, 250, 255, 0.88);
  text-align: center;
  line-height: 1.5;
}

.score-pop {
  position: fixed;
  z-index: 5;
  color: var(--gold);
  font-weight: 1000;
  pointer-events: none;
  text-shadow:
    0 0 14px rgba(255, 255, 255, 0.7),
    0 3px 10px rgba(0, 0, 0, 0.35);
  animation: float-score 620ms ease forwards;
}

@keyframes float-score {
  to {
    opacity: 0;
    transform: translateY(-42px) scale(1.28);
  }
}

@media (max-width: 760px) {
  .game-shell {
    padding: 14px 12px 28px;
  }

  .stage {
    gap: 12px;
    min-height: calc(100vh - 42px);
  }

  .falling-title {
    min-height: 86px;
  }

  .falling-title span {
    font-size: clamp(34px, 11.5vw, 58px);
    text-shadow:
      1px 1px 0 #ffe45e,
      2px 2px 0 #35d7ff,
      3px 3px 0 #ff4fd8,
      0 0 18px rgba(255, 255, 255, 0.75),
      7px 11px 20px rgba(23, 17, 47, 0.35);
  }

  .hud {
    grid-template-columns: repeat(3, 1fr);
  }

  .start-button {
    grid-column: 1 / -1;
    min-height: 50px;
  }

  .hud-item {
    min-height: 58px;
    padding: 10px;
  }

  .hud-item strong {
    font-size: 24px;
  }

  .board {
    min-height: 430px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hole {
    min-height: 118px;
  }
}
