.snakes-game {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding: 1rem clamp(0.75rem, 2vw, 1.5rem) 1.25rem;
  border: 1px solid rgba(227, 205, 143, 0.38);
  border-radius: 1.25rem;
  background: linear-gradient(150deg, #1d3d2f, #10251e 68%, #193328);
  box-shadow: 0 14px 32px rgba(10, 19, 14, 0.2);
  color: #f8f2df;
  text-align: center;
}

.snakes-game,
.snakes-game * {
  box-sizing: border-box;
}

.snakes-game-header {
  margin-bottom: 0.65rem;
}

.snakes-eyebrow {
  margin: 0 0 0.2rem;
  color: #e5d49f;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.snakes-title {
  margin: 0;
  color: #fff7df;
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 700;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.48);
}

.snakes-status {
  min-height: 1.5rem;
  margin: 0.45rem 0 0;
  color: #f0ead8;
  font-size: 0.94rem;
}

.snakes-stage {
  position: relative;
  isolation: isolate;
  display: grid;
  width: min(100%, 1180px);
  height: clamp(580px, 45vw, 660px);
  margin: 0 auto;
  place-items: center;
  perspective: 3600px;
  perspective-origin: 50% 50%;
  border: 1px solid rgba(227, 205, 143, 0.32);
  border-radius: 1.25rem;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(93, 125, 76, 0.55), transparent 43%),
    radial-gradient(ellipse at 9% 78%, rgba(25, 55, 42, 0.9), transparent 36%),
    radial-gradient(ellipse at 92% 24%, rgba(34, 73, 54, 0.9), transparent 36%),
    linear-gradient(155deg, #263f32, #10251f 64%, #172e25);
  box-shadow: inset 0 0 70px rgba(5, 15, 12, 0.68), 0 16px 34px rgba(10, 19, 14, 0.24);
}

.snakes-stage::before,
.snakes-stage::after {
  position: absolute;
  z-index: -1;
  content: "";
  pointer-events: none;
}

.snakes-stage::before {
  inset: 0;
  border-radius: inherit;
  background-image:
    radial-gradient(circle, rgba(239, 238, 159, 0.9) 0 1px, transparent 2px),
    radial-gradient(circle, rgba(184, 224, 128, 0.76) 0 1.5px, transparent 2.5px),
    radial-gradient(ellipse at 8% 90%, rgba(86, 130, 72, 0.55), transparent 21%),
    radial-gradient(ellipse at 93% 10%, rgba(69, 115, 69, 0.48), transparent 20%);
  background-position: 7% 19%, 88% 33%, center, center;
  background-size: 97px 89px, 137px 121px, auto, auto;
  opacity: 0.62;
}

.snakes-stage::after {
  right: 2%;
  bottom: 1%;
  left: 2%;
  height: 11%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(8, 18, 14, 0.72), transparent 69%);
  filter: blur(7px);
}

.snakes-board-plane {
  position: relative;
  z-index: 1;
  width: min(72%, 850px);
  aspect-ratio: 1 / 1;
  transform: rotateX(43deg) rotateZ(45deg);
  transform-style: preserve-3d;
  filter: drop-shadow(0 15px 0 rgba(51, 35, 23, 0.96)) drop-shadow(0 21px 12px rgba(4, 12, 9, 0.58));
}

.snakes-board-grid {
  position: absolute;
  inset: 0;
  border: 5px solid #6f5132;
  border-radius: 1.1%;
  background:
    radial-gradient(circle at 20% 24%, rgba(143, 188, 96, 0.34) 0 1.2%, transparent 2.2%),
    radial-gradient(circle at 73% 68%, rgba(202, 180, 96, 0.2) 0 1%, transparent 2.1%),
    linear-gradient(145deg, #35573b, #213d2d 48%, #3c5936);
  box-shadow: 0 0 0 5px rgba(38, 29, 20, 0.88), 0 0 32px rgba(185, 223, 111, 0.28);
  transform-style: preserve-3d;
}

.snakes-board-field {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: repeat(10, minmax(0, 1fr));
  gap: 1%;
  padding: 0.5%;
  transform-style: preserve-3d;
}

.snakes-board-grid::before {
  position: absolute;
  z-index: -1;
  inset: -1.1%;
  border: 6px solid #402d1e;
  border-radius: 1.8%;
  background: linear-gradient(145deg, #795b39, #4b3625 70%);
  box-shadow: 0 0 0 4px rgba(31, 23, 17, 0.78);
  content: "";
  transform: translateZ(-30px);
}

.snakes-board-row {
  display: grid;
  min-height: 0;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 1%;
}

.snakes-tile {
  position: relative;
  display: block;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1 / 1;
  overflow: visible;
  border: 1px solid rgba(76, 52, 31, 0.94);
  border-radius: 3px;
  background: linear-gradient(145deg, #ead9a8, #c3a76a 72%, #a78b51);
  box-shadow: inset 0 1px 0 rgba(255, 252, 220, 0.72), inset 0 -3px 0 rgba(91, 62, 35, 0.3), 0 2px 0 rgba(35, 25, 18, 0.72);
  transform-style: preserve-3d;
}

.snakes-board-row .snakes-tile:nth-child(even) {
  background: linear-gradient(145deg, #b9ca8b, #829b61 72%, #647b4d);
}

.snakes-tile--start {
  background: linear-gradient(145deg, #d8e3a5, #a5c16d 72%, #78924e) !important;
}

.snakes-tile--finish {
  background: linear-gradient(145deg, #f4e5aa, #d9bc6f 72%, #b58c3e) !important;
}

.snakes-tile-number,
.snakes-tile-caption,
.snakes-tile-marker,
.snakes-token {
  position: absolute;
  transform: rotateZ(-45deg) rotateX(-43deg);
  transform-origin: center;
}

.snakes-tile-number {
  top: 8%;
  left: 8%;
  z-index: 4;
  color: #392c1d;
  font-size: clamp(12px, 1.1vw, 16px);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 1px rgba(255, 246, 208, 0.78);
}

.snakes-tile-caption {
  right: 8%;
  bottom: 8%;
  z-index: 4;
  color: #473820;
  font-size: clamp(7px, 0.7vw, 9px);
  font-weight: 900;
  letter-spacing: 0.06em;
}

.snakes-tile-marker {
  right: 8%;
  bottom: 6%;
  z-index: 5;
  display: grid;
  width: clamp(14px, 24%, 19px);
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(255, 255, 229, 0.8);
  border-radius: 50%;
  color: #f8ffe2;
  font-size: clamp(8px, 0.8vw, 11px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.snakes-tile-marker--shortcut {
  background: #477444;
  box-shadow: 0 0 8px rgba(215, 255, 140, 0.9);
}

.snakes-tile-marker--setback {
  background: #8d4433;
  box-shadow: 0 0 7px rgba(250, 155, 91, 0.7);
}

.snakes-transition-layer {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.snakes-transition-path {
  fill: none;
  stroke-linecap: round;
  opacity: 0.98;
}

.snakes-transition-path--shortcut {
  stroke: #c8ef83;
  stroke-width: 6;
  stroke-dasharray: 5 18;
  filter: drop-shadow(0 0 5px rgba(202, 255, 135, 0.95));
}

.snakes-bridge-underlay {
  stroke: #3e2b20;
  stroke-width: 48;
  filter: drop-shadow(0 3px 3px rgba(8, 14, 10, 0.74));
}

.snakes-bridge-deck {
  stroke: #9a7447;
  stroke-width: 38;
}

.snakes-bridge-plank {
  fill: none;
  stroke: #e0c27c;
  stroke-linecap: round;
  stroke-width: 11;
}

.snakes-bridge-rail {
  fill: none;
  stroke: #553b26;
  stroke-linecap: round;
  stroke-width: 9;
}

.snakes-bridge-rail-highlight {
  fill: none;
  stroke: #c4a56a;
  stroke-linecap: round;
  stroke-width: 3;
}

.snakes-bridge-glimmer {
  fill: none;
  stroke: #dafa9f;
  stroke-linecap: round;
  stroke-width: 5;
}

.snakes-transition-path--setback {
  stroke: #453426;
  stroke-width: 15;
  filter: drop-shadow(0 0 3px rgba(18, 25, 13, 0.92));
}

.snakes-bramble-core {
  fill: none;
  stroke: #71894a;
  stroke-linecap: round;
  stroke-width: 7;
}

.snakes-bramble-thorn {
  fill: #70432f;
  stroke: #c17a4d;
  stroke-linejoin: round;
  stroke-width: 3;
}

.snakes-transition-point {
  fill: #f4e6b0;
  stroke-width: 8;
}

.snakes-transition-point--shortcut {
  stroke: #76a957;
}

.snakes-transition-point--setback {
  stroke: #a94c37;
}

.snakes-arrow-head--shortcut {
  fill: #dafa9f;
}

.snakes-arrow-head--setback {
  fill: #70432f;
}

.snakes-token {
  inset: 0;
  margin: auto;
  z-index: 7;
  display: block;
  width: 36%;
  height: 52%;
  transform-origin: 50% 90%;
  filter: drop-shadow(0 2px 2px rgba(19, 16, 13, 0.62));
  pointer-events: none;
}

.snakes-token__hood,
.snakes-token__face,
.snakes-token__scarf,
.snakes-token__coat,
.snakes-token__boots {
  position: absolute;
  display: block;
}

.snakes-token__hood {
  top: 0;
  left: 23%;
  width: 56%;
  height: 39%;
  border: 1px solid #352b24;
  border-radius: 48% 48% 42% 42%;
  background: linear-gradient(140deg, #526846, #283c2d 75%);
}

.snakes-token__face {
  top: 8%;
  left: 34%;
  width: 34%;
  height: 25%;
  border-radius: 46% 46% 44% 44%;
  background: linear-gradient(135deg, #f3d0a0, #bd8156);
}

.snakes-token__scarf {
  top: 29%;
  left: 17%;
  width: 67%;
  height: 13%;
  border-radius: 50%;
  background: #c76d42;
  box-shadow: 0 2px 0 #7c412d;
}

.snakes-token__coat {
  top: 37%;
  left: 25%;
  width: 51%;
  height: 47%;
  border: 1px solid #263529;
  border-radius: 30% 30% 19% 19%;
  background: linear-gradient(90deg, #536d4d, #293f30 55%, #657448);
}

.snakes-token__boots {
  bottom: 0;
  left: 24%;
  width: 55%;
  height: 17%;
  border-radius: 4px 4px 40% 40%;
  background: linear-gradient(#8b5837, #533723);
}

.snakes-token--hopping {
  animation: snakes-token-hop 170ms ease-out;
}

@keyframes snakes-token-hop {
  0% { translate: 0 0; }
  48% { translate: 0 -8px; }
  100% { translate: 0 0; }
}

.snakes-firefly {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e7ed9a;
  box-shadow: 0 0 8px 3px rgba(215, 239, 128, 0.56);
  animation: snakes-firefly-glow 3s ease-in-out infinite alternate;
  pointer-events: none;
}

.snakes-firefly--one {
  top: 21%;
  left: 15%;
}

.snakes-firefly--two {
  top: 67%;
  right: 13%;
  width: 5px;
  height: 5px;
  animation-delay: 0.8s;
}

.snakes-firefly--three {
  right: 24%;
  bottom: 17%;
  width: 4px;
  height: 4px;
  animation-delay: 1.4s;
}

@keyframes snakes-firefly-glow {
  from { opacity: 0.45; }
  to { opacity: 1; }
}

.snakes-game-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  max-width: 900px;
  margin: 1rem auto 0;
}

.snakes-transition-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem 1rem;
  margin: 0;
  padding: 0;
  color: #f4edd8;
  font-size: 0.82rem;
  list-style: none;
  text-align: left;
}

.snakes-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.snakes-legend-item strong {
  color: #fff2c4;
}

.snakes-legend-swatch {
  display: inline-block;
  width: 1.5rem;
  height: 0.45rem;
  flex: 0 0 auto;
  border-radius: 1rem;
}

.snakes-legend-item--shortcut .snakes-legend-swatch {
  height: 0.55rem;
  border-top: 2px solid #c4a56a;
  border-bottom: 2px solid #c4a56a;
  background: repeating-linear-gradient(90deg, #e0c27c 0 4px, #9a7447 4px 7px);
  box-shadow: 0 0 5px rgba(202, 255, 135, 0.62);
}

.snakes-legend-item--setback .snakes-legend-swatch {
  height: 0.55rem;
  background:
    repeating-linear-gradient(70deg, transparent 0 5px, #c17a4d 5px 7px, transparent 7px 10px),
    linear-gradient(90deg, #453426, #71894a, #453426);
}

.snakes-roll-button {
  display: inline-flex;
  min-width: 102px;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid #d8bd7c;
  border-radius: 0.85rem;
  background: linear-gradient(145deg, #fff9e8, #e6d8b5);
  box-shadow: 0 4px 0 #755633, 0 7px 13px rgba(0, 0, 0, 0.28);
  color: #3c3325;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: translate 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.snakes-roll-button:hover:not(:disabled) {
  translate: 0 -2px;
  box-shadow: 0 6px 0 #755633, 0 10px 16px rgba(0, 0, 0, 0.28);
}

.snakes-roll-button:active:not(:disabled) {
  translate: 0 2px;
  box-shadow: 0 2px 0 #755633, 0 4px 9px rgba(0, 0, 0, 0.24);
}

.snakes-roll-button:focus-visible {
  outline: 3px solid #f4e39b;
  outline-offset: 4px;
}

.snakes-roll-button:disabled {
  cursor: wait;
  opacity: 0.78;
}

.snakes-dice-image {
  display: block;
  width: 62px;
  height: 62px;
  object-fit: contain;
}

.snakes-board-note {
  margin: 0.65rem 0 0;
  color: #d8e3cf;
  font-size: 0.75rem;
}

@media (min-width: 576px) and (max-width: 991.98px) {
  .snakes-stage {
    height: clamp(500px, 68vw, 600px);
  }

  .snakes-board-plane {
    width: min(68%, 700px);
    transform: rotateX(46deg) rotateZ(45deg);
  }

  .snakes-tile-number,
  .snakes-tile-caption,
  .snakes-tile-marker,
  .snakes-token {
    transform: rotateZ(-45deg) rotateX(-46deg);
  }
}

@media (max-width: 575.98px) {
  .snakes-game {
    padding: 0.85rem 0.65rem 1rem;
    border-radius: 1rem;
  }

  .snakes-stage {
    height: clamp(300px, 82vw, 360px);
    border-radius: 0.75rem;
  }

  .snakes-board-plane {
    width: min(70%, 700px);
    transform: rotateX(50deg) rotateZ(45deg);
  }

  .snakes-tile-number {
    font-size: clamp(12px, 3.2vw, 14px);
  }

  .snakes-tile-number,
  .snakes-tile-caption,
  .snakes-tile-marker,
  .snakes-token {
    transform: rotateZ(-45deg) rotateX(-50deg);
  }

  .snakes-token {
    width: 64%;
    height: 84%;
  }

  .snakes-game-controls {
    flex-direction: column-reverse;
    gap: 0.8rem;
  }

  .snakes-transition-legend {
    align-items: flex-start;
    flex-direction: column;
    font-size: 0.82rem;
  }

  .snakes-roll-button {
    flex-direction: row;
    gap: 0.45rem;
    min-width: 150px;
    padding-inline: 0.8rem;
  }

  .snakes-dice-image {
    width: 46px;
    height: 46px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .snakes-firefly,
  .snakes-token--hopping {
    animation-duration: 0.01ms;
  }

  .snakes-roll-button {
    transition: none;
  }
}
