:root {
  color-scheme: dark;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: #0b152a;
  color: #f1f5ff;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 10%, #243961, #0b152a 75%);
}
#snow47 {
  max-width: 558px;
  margin: auto;
  padding: 8px 9px 18px;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
  touch-action: manipulation;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid #ffdf88;
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
.controls,
.board-heading,
.finish-row {
  display: flex;
  align-items: center;
}
.game-column {
  --controls-gap: 6px;
  min-width: 0;
}
.stage {
  container-type: inline-size;
  aspect-ratio: 3 / 4;
  isolation: isolate;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 0 1px #61799c;
  border-radius: 12px;
  background: #8cadd4;
}
.stage canvas {
  touch-action: none;
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.dashboard {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 50%;
  width: 100%;
  transform: translateX(-50%);
  container-type: inline-size;
  aspect-ratio: 3 / 1;
  background: url("assets/dashboard.webp") center / 100% 100% no-repeat;
  pointer-events: none;
  user-select: none;
  color: #f7f9ff;
  font-family: Arial, "Helvetica Neue", sans-serif;
}
.brand {
  position: absolute;
  inset: 8.5% 0 auto;
  height: 23%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.3cqw;
  font-weight: 1000;
  line-height: 1;
  transform: scaleX(.88);
}
.wordmark {
  font-family: "Arial Black", Arial, sans-serif;
  font-size: 6.15cqw;
  letter-spacing: -.022em;
  transform: rotate(-2deg);
  -webkit-text-stroke: .04cqw currentColor;
  text-shadow: 0 .35cqw #bcdfff, 0 .85cqw #274daf, .24cqw 1cqw #051a57;
}
.brand b {
  display: inline-block;
  color: white;
  padding: .04em .21em .08em;
  font-size: 5.9cqw;
  letter-spacing: -.06em;
  line-height: .98;
  border-radius: 1.1cqw;
  background: linear-gradient(150deg, #ff4633, #dd171c 80%);
  box-shadow: inset 0 .3cqw #ff7751, 0 .48cqw #862039, .22cqw .78cqw #031647;
  transform: rotate(6deg);
}
.flake {
  padding: 0 .55cqw;
  color: #e6f7ff;
  font: 4.6cqw/1 Arial, sans-serif;
  text-shadow: 0 .32cqw #5398e0;
}
.instruments {
  position: absolute;
  inset: 33.4% 7% auto;
  height: 20%;
  display: grid;
  grid-template-columns: 1fr 1.17fr .91fr;
  gap: 3.2%;
  margin: 0;
}
.instrument {
  position: relative;
  min-width: 0;
  display: grid;
  place-items: center;
  border: .36cqw solid var(--rim);
  border-radius: 10cqw;
  background: linear-gradient(180deg, #102561, #071644 90%);
  box-shadow: inset 0 .27cqw .38cqw #030d38, 0 .25cqw #020b30;
}
.instrument + .instrument::before {
  content: "";
  position: absolute;
  left: -5.6%;
  top: 10%;
  height: 80%;
  width: .23cqw;
  background: linear-gradient(transparent, #9eb7f4 20% 80%, transparent);
}
.instrument dd {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.1cqw;
  margin: 0;
  font-size: 4.75cqw;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.instrument svg {
  flex: none;
  width: 4.35cqw;
  height: 4.35cqw;
}
.score {
  --rim: #ffc84c;
  color: #ffcf48;
}
.city {
  --rim: #efb287;
  transform: translateY(-9%);
}
.city dd { font-size: 4.25cqw; gap: .65cqw; }
.city svg { color: #ffce49; }
.city .long { font-size: 3cqw; }
.score .long { font-size: 3.1cqw; }
.timer { --rim: #afc4fc; }
#sn-complaints-title {
  position: absolute;
  top: 55.5%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 3.15cqw;
  font-weight: 750;
  line-height: 1;
  text-shadow: 0 .25cqw #142463;
}
#sn-complaints::before {
  content: "";
  position: absolute;
  top: 55.7%;
  left: 19%;
  right: 19%;
  height: 16%;
  border-bottom: .35cqw solid #7497e4;
  border-radius: 0 0 50% 50% / 0 0 94% 94%;
}
#sn-bars {
  position: absolute;
  top: 77%;
  left: 17%;
  right: 17%;
  height: 12.4%;
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: .65cqw;
}
#sn-cleanup {
  position: absolute;
  top: 90%;
  left: 33%;
  width: 34%;
  height: auto;
  fill: none;
  stroke-linecap: round;
}
.cleanup-rim {
  stroke: #659abd;
  stroke-width: 7.5;
}
.cleanup-track {
  stroke: #071c38;
  stroke-width: 5.5;
}
.cleanup-fill {
  stroke: url(#sn-cleanup-color);
  stroke-width: 5.5;
  stroke-linecap: butt;
  stroke-dasharray: calc(var(--fill, 0) * 100) 100;
  transition: stroke-dasharray 160ms ease-out;
}
#sn-cleanup.complete {
  filter: drop-shadow(0 0 .65cqw #78fbd3);
}
#sn-cleanup.complete .cleanup-rim { stroke: #d2ffed; }
#sn-cleanup.complete .cleanup-fill {
  animation: cleanup-complete 1.35s ease-out both;
}
#sn-bars i {
  position: relative;
  background: linear-gradient(#5169b0, #3a498a);
  border-radius: .88cqw;
  box-shadow: inset 0 .32cqw #8190ca, 0 .35cqw #06103c;
  transform: translateY(var(--lift)) rotate(var(--angle));
}
#sn-bars i:nth-child(1)  { --segment: 0; --lift: -116%; --angle: 20deg; }
#sn-bars i:nth-child(2)  { --segment: 1; --lift: -63%;  --angle: 15deg; }
#sn-bars i:nth-child(3)  { --segment: 2; --lift: -27%;  --angle: 9deg; }
#sn-bars i:nth-child(4)  { --segment: 3; --lift: -7%;   --angle: 4deg; }
#sn-bars i:nth-child(5)  { --segment: 4; --lift: 0%;    --angle: 0deg; }
#sn-bars i:nth-child(6)  { --segment: 5; --lift: -7%;   --angle: -4deg; }
#sn-bars i:nth-child(7)  { --segment: 6; --lift: -27%;  --angle: -9deg; }
#sn-bars i:nth-child(8)  { --segment: 7; --lift: -63%;  --angle: -15deg; }
#sn-bars i:nth-child(9)  { --segment: 8; --lift: -116%; --angle: -20deg; }
#sn-bars i::before {
  --segment-fill: clamp(0, calc(var(--fill, calc(1 / 3)) * 9 - var(--segment)), 1);
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(#ff5338, #ef2826);
  box-shadow: inset 0 .35cqw #ff9964, 0 .35cqw #5c1628;
  clip-path: inset(0 calc((1 - var(--segment-fill)) * 100%) -.35cqw 0);
  transition: clip-path 130ms ease-out;
}
#sn-complaints.danger #sn-bars i::before {
  background: linear-gradient(#ff7945, #fb302b);
}
#sn-complaints.rising #sn-bars i::before {
  filter: brightness(1.5);
}
#sn-complaints.rising #sn-complaints-title {
  text-shadow: 0 .25cqw #142463, 0 0 1.25cqw #ff663e;
}
@keyframes cleanup-complete {
  0%, 18% { stroke-dasharray: 100 100; filter: brightness(1.4); }
  60%, 100% { stroke-dasharray: calc(var(--fill, 0) * 100) 100; }
}
#sn-radio, #sn-scoop, #sn-brake {
  position: absolute;
  z-index: 2;
  top: 65%;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  width: clamp(39px, 10cqw, 50px);
  aspect-ratio: 1;
  padding: 7px;
  border: 2px solid #c2ffe7;
  border-radius: 9px;
  color: #e2fff2;
  background: #10534e;
  box-shadow: 0 0 11px #6ffbd6, 0 3px 0 #082a32;
  touch-action: manipulation;
}
#sn-radio { top: 77%; }
#sn-scoop, #sn-brake {
  background: #233752;
  border-color: #ffd087;
  box-shadow: 0 0 10px #e7a6539c, 0 3px 0 #10253e;
}
#sn-brake { top: 77%; }
#sn-scoop.extended, #sn-brake.slowing { background: #694738; box-shadow: 0 0 13px #ffcb80, 0 3px 0 #10253e; }
#sn-brake-seconds, #sn-radio-status {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 5px;
  border-radius: 4px;
  background: #482d35;
  color: #fff0d8;
  font: 700 12px / 1.2 Arial, sans-serif;
  white-space: nowrap;
}
#sn-radio-status {
  left: auto;
  right: 0;
  transform: none;
  background: #154845;
  color: #effff6;
}
#sn-radio svg, #sn-scoop svg, #sn-brake svg { width: 100%; height: 100%; }
#sn-radio:focus-visible, #sn-scoop:focus-visible, #sn-brake:focus-visible { outline: 3px solid white; outline-offset: 3px; }
#sn-radio:disabled { opacity: .55; box-shadow: 0 3px 0 #082a32; }
@media (prefers-reduced-motion: reduce) {
  .cleanup-fill, #sn-bars i::before { transition: none; }
  #sn-cleanup.complete .cleanup-fill { animation: none; }
}
.stage:has(.shade[hidden]) {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.route-event {
  position: absolute;
  z-index: 1;
  top: 35cqw;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  width: max-content;
  max-width: 88%;
  padding: 1.3cqw 4cqw;
  border: 2px solid #e5efff;
  border-radius: 5px;
  box-shadow: 0 2px 0 #172c4a;
  background: #214779;
  color: #fff;
  line-height: 1.15;
  pointer-events: none;
}
.route-event span { font-size: clamp(10px, 2.6cqw, 14px); }
.route-event strong { font-size: clamp(15px, 4.6cqw, 24px); }
.stage:has(.shade:not([hidden])) .route-event { visibility: hidden; }
.shade {
  position: absolute;
  inset: 33.333cqw 0 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: linear-gradient(transparent, #08132866);
}
.shade:has(#sn-finish:not([hidden])) {
  /* The controls start one gutter below the stage. Center against their top edge. */
  padding-top: calc(12px + var(--controls-gap));
}
.panel {
  max-height: 100%;
  overflow: auto;
  width: 100%;
  padding: 13px 15px;
  background: #122440f5;
  border: 1px solid #91aacf;
  border-top: 3px solid #ffd078;
  border-radius: 5px;
  box-shadow: 0 3px 0 #060e20;
}
.panel h1,
.board-heading h2 {
  font-size: clamp(19px, 5vw, 24px);
  margin: 0;
  line-height: 1.1;
  font-weight: 850;
  letter-spacing: -0.7px;
}
.desc {
  font-size: 13px;
  line-height: 1.4;
  color: #d5e3f4;
  margin: 8px 0 12px;
}
.ability-symbols {
  position: absolute;
  pointer-events: none;
}
.start-tips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 12px 0;
}
.start-tips li {
  display: grid;
  grid-template-rows: auto 1fr;
  justify-items: center;
  gap: 6px;
  padding: 7px 3px;
  border: 1px solid #3e5b7d;
  border-radius: 5px;
  background: #172d49;
  text-align: center;
  color: #e5efff;
  font-size: clamp(10px, 3.1cqw, 13px);
  font-weight: 650;
  line-height: 1.2;
  hyphens: auto;
  overflow-wrap: anywhere;
}
.start-tips svg {
  width: clamp(34px, 11cqw, 52px);
  height: auto;
  padding: 4px;
  border: 1px solid #efbe79;
  border-radius: 7px;
  background: #243950;
}
.start-tips .ability-radio {
  color: #e2fff2;
  border-color: #81e3c4;
  background: #10534e;
}
.play {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-bottom: 3px solid #c38234;
  border-radius: 4px;
  background: #ffd077;
  color: #172239;
  font:
    900 14px ui-monospace,
    monospace;
  letter-spacing: 0.5px;
}
.play:disabled,
button:disabled {
  opacity: 0.6;
  cursor: default;
}
#sn-lap-finish {
  margin-top: 7px;
  background: #233d60;
  border-color: #7195c0;
  box-shadow: inset 0 -3px #142943;
  color: #edf6ff;
}
#sn-appeal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 5px 9px;
  text-align: center;
  margin-top: 9px;
  background: #006eea;
  border-bottom-color: #00499f;
  color: #fff;
  text-decoration: none;
  font: 750 14px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}
.vk-mark {
  display: grid;
  place-items: center;
  flex: 0 0 21px;
  height: 19px;
  border-radius: 5px;
  background: white;
  color: #006eea;
  font: 900 12px/1 Arial, sans-serif;
  letter-spacing: -1px;
}
#sn-finish label,
#sn-save-status {
  display: block;
  font-size: 12px;
  margin: 7px 0;
  color: #c3d4ec;
}
#sn-save-status:empty { display: none; }
.finish-row {
  gap: 5px;
}
.finish-row input {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  padding: 8px;
  background: #eff5ff;
  border: 0;
  color: #132440;
  border-radius: 3px;
}
.finish-row button {
  background: #2a5577;
  border: 1px solid #7298b8;
  border-radius: 3px;
  padding: 9px;
  font-size: 11px;
  font-weight: 800;
}
.nick-confirm {
  padding: 8px 9px;
  margin-top: 7px;
  border: 1px solid #5f7d9f;
  border-radius: 5px;
  background: #1c3452;
  color: #e5efff;
  font-size: 13px;
}
.nick-confirm p {
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}
.nick-confirm-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.nick-confirm-actions strong {
  flex: 1;
}
.nick-confirm-actions button {
  min-width: 44px;
  min-height: 44px;
  padding: 4px 9px;
  border: 1px solid #7195c0;
  border-radius: 4px;
  background: #2a5577;
  font-weight: 750;
}
#sn-nick-yes {
  border-color: #e2ab58;
  background: #ffd077;
  color: #172239;
}
.controls {
  gap: 7px;
  margin-top: var(--controls-gap);
}
.controls button {
  height: 44px;
  background: #1d3557;
  border: 1px solid #617da3;
  border-radius: 5px;
  font-weight: 850;
  font-size: 19px;
  box-shadow: inset 0 -3px #14253e;
}
.controls .ctrl {
  flex: 1;
}
.controls button:active,
.play:active {
  transform: translateY(1px);
}
#sn-pause {
  width: 54px;
}
#sn-pause.restart {
  width: auto;
  padding: 0 14px;
  font-size: 15px;
  background: #ffd077;
  border-color: #d5a351;
  color: #172239;
  box-shadow: inset 0 -3px #c38234;
}
#sn-route-progress,
#sn-board-status {
  font-size: 11px;
  line-height: 1.4;
  color: #aec2dd;
  text-align: center;
  margin: 7px 0;
}
.leaderboard {
  margin-top: 12px;
  padding: 15px;
  background: #142540;
  border: 1px solid #405777;
  border-radius: 7px;
}
.board-heading {
  justify-content: space-between;
  margin-bottom: 10px;
}
.board-heading h2 {
  font-size: 20px;
}
#sn-refresh {
  font-size: 21px;
  background: transparent;
  border: 1px solid #526c90;
  border-radius: 3px;
  width: 36px;
}
.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.tab {
  font-size: 12px;
  padding: 8px 3px;
  border: 1px solid #425b7e;
  background: #162d4b;
  border-radius: 3px;
}
.tab.active {
  background: #ffcf79;
  color: #1d2941;
  font-weight: bold;
}
#sn-leaders {
  list-style: none;
  padding: 0;
  margin: 9px 0;
}
#sn-leaders li {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #324a69;
  padding: 8px 3px;
  font-size: 13px;
}
.rank,
.points {
  color: #ffda91;
  font-weight: 750;
}
.rank,
.duration,
.points {
  flex: 0 0 auto;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.name {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.duration {
  color: #99b4d4;
  font-size: 11px;
}
.empty {
  color: #c2d4eb;
  justify-content: center;
  text-align: center;
  min-height: 60px;
}
@supports (height: 100svh) {
  .game-column {
    width: 100%;
    max-width: clamp(200px, calc(75svh - 82.5px), 100%);
    margin-inline: auto;
  }
}
@media (min-width: 760px) {
  #snow47 {
    max-width: 900px;
    display: grid;
    grid-template-columns: minmax(0, 550px) minmax(245px, 1fr);
    gap: 18px;
    padding-top: 15px;
  }
  .leaderboard {
    margin: 0;
    align-self: start;
  }
}
@media (max-width: 350px) {
  #snow47 { padding: 5px; }
  .panel { padding: 10px; }
  .start-tips li { padding-inline: 2px; }
  .nick-confirm { padding-block: 6px; margin-top: 6px; }
  .nick-confirm p { margin-bottom: 4px; }
}
