:root {
  color-scheme: dark;
  --play-bg: #070914;
  --play-cyan: #55e7ff;
  --play-violet: #9a74ff;
  --play-muted: #9ca4bf;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  position: fixed;
  inset: 0;
  touch-action: none;
  background:
    radial-gradient(circle at 50% 42%, rgba(59, 86, 180, .2), transparent 30rem),
    var(--play-bg);
  color: #fff;
  font-family: var(--bs-font-sans-serif);
}

#phone-view,
#desktop-view {
  display: none;
  width: 100%;
  height: 100dvh;
  min-height: 100dvh !important;
}

body.is-phone #phone-view,
body.is-desktop #desktop-view {
  display: flex;
}

.app-splash {
  display: none;
  z-index: 9999;
  background:
    radial-gradient(circle at 50% 45%, rgba(45, 84, 180, .2), transparent 23rem),
    #070914;
}

body.is-phone.splash-active .app-splash {
  display: flex;
}

body.splash-active #games-home {
  visibility: hidden;
}

.splash-brand {
  font-size: clamp(2.15rem, 10vw, 3.35rem);
  letter-spacing: -.07em;
  background: linear-gradient(105deg, #fff 20%, var(--play-cyan) 63%, #cbbcff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.splash-loader {
  width: 2.6rem;
  height: 2.6rem;
  border: .18rem solid rgba(85, 231, 255, .18);
  border-top-color: var(--play-cyan);
  border-right-color: var(--play-violet);
  border-radius: 50%;
  animation: splash-spin .8s linear infinite;
}

.splash-label {
  color: var(--play-muted);
  font-size: .66rem;
  letter-spacing: .28em;
}

.app-splash.splash-leaving {
  opacity: 0;
  transition: opacity 220ms ease;
}

.device-pending::after {
  position: fixed;
  inset: 50% auto auto 50%;
  width: 2rem;
  height: 2rem;
  content: "";
  border: .18rem solid rgba(85, 231, 255, .22);
  border-top-color: var(--play-cyan);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: spin .8s linear infinite;
}

main::before {
  position: absolute;
  inset: 0;
  content: "";
  opacity: .16;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, #000, transparent 68%);
}

.brand-title {
  font-size: clamp(2.55rem, 8vw, 6.6rem);
  letter-spacing: -.065em;
  line-height: .95;
  background: linear-gradient(105deg, #fff 25%, var(--play-cyan) 58%, #cbbcff 88%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 1.5rem rgba(85, 231, 255, .12));
}

.loader-wrap {
  position: relative;
  width: 4.5rem;
  height: 4.5rem;
}

.loader-wrap .spinner-border {
  width: 4.5rem;
  height: 4.5rem;
  border-width: .2rem;
  border-right-color: rgba(154, 116, 255, .25);
  animation-duration: 1.15s;
}

.loader-core {
  position: absolute;
  width: .72rem;
  height: .72rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 1.2rem .25rem rgba(85, 231, 255, .6);
  animation: pulse 1.15s ease-in-out infinite;
}

.loading {
  color: var(--play-muted);
  font-size: .78rem;
  letter-spacing: .26em;
}

.loading-dots::after {
  content: "";
  animation: dots 1.5s steps(4, end) infinite;
}

.coming-soon {
  font-size: clamp(1rem, 2vw, 1.35rem);
  letter-spacing: .48em;
  text-indent: .48em;
}

.ambient {
  position: absolute;
  width: 18rem;
  height: 18rem;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .16;
  pointer-events: none;
}

.ambient-one { top: -7rem; left: -7rem; background: var(--play-violet); }
.ambient-two { right: -8rem; bottom: -8rem; background: var(--play-cyan); }

.install-tip {
  width: min(100%, 31rem);
  padding-bottom: max(1rem, env(safe-area-inset-bottom)) !important;
}

.install-tip .alert {
  border-radius: 1.25rem;
  background: rgba(18, 22, 40, .96);
  backdrop-filter: blur(18px);
  color: #fff;
  touch-action: manipulation;
}

.install-tip .text-secondary-emphasis {
  color: #b8c1db !important;
}

.share-icon {
  width: 2.3rem;
  height: 2.3rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(85, 231, 255, .45);
  border-radius: .75rem;
  color: var(--play-cyan);
  font-size: 1.45rem;
  line-height: 1;
}

.desktop-message {
  max-width: 44rem;
}

.games-home {
  max-width: 27rem;
  padding-top: max(1rem, env(safe-area-inset-top));
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.games-home .brand-title {
  font-size: clamp(1.8rem, 8vw, 2.35rem);
  letter-spacing: -.055em;
}

.game-card {
  width: min(100%, 23rem);
  height: min(72dvh, 36rem);
  border-radius: 1.55rem;
  outline: 1px solid rgba(85, 231, 255, .38);
  touch-action: manipulation;
}

.game-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-card-shade {
  position: absolute;
  inset: 36% 0 0;
  background: linear-gradient(transparent, rgba(5, 7, 18, .96));
}

.game-title {
  background: linear-gradient(100deg, #fff, var(--play-cyan), #c9b6ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.play-button,
.menu-panel .btn-primary {
  border: 0;
  background: linear-gradient(105deg, #08cce9, #7d35f3);
}

.game-screen {
  background: #070914;
  grid-template-rows: 5rem minmax(0, 1fr) 10.5rem;
  width: 100%;
  height: 100dvh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.game-screen:not(.d-none) {
  display: grid !important;
}

.game-hud {
  border-bottom: 1px solid rgba(148, 162, 205, .18);
}

.hud-label {
  color: var(--play-muted);
  font-size: .63rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.game-icon-btn {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: .85rem;
  touch-action: manipulation;
}

.arena-wrap {
  min-height: 0;
  display: grid;
  place-items: center;
}

#snake-canvas {
  display: block;
  width: min(100%, 24rem);
  height: auto;
  aspect-ratio: 1;
  border: 1px solid rgba(85, 231, 255, .28);
  border-radius: 1.2rem;
  background: #0a1020;
  box-shadow: inset 0 0 2rem rgba(33, 74, 143, .15), 0 1rem 3rem rgba(0, 0, 0, .25);
}

.joystick {
  position: relative;
  width: 9rem;
  height: 9rem;
  border: 1px solid rgba(85, 231, 255, .3);
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(85, 231, 255, .09) 0 30%, transparent 31%), #0d1527;
  box-shadow: inset 0 0 2rem rgba(45, 99, 172, .22), 0 .8rem 2rem rgba(0, 0, 0, .3);
  touch-action: none;
  user-select: none;
}

.joystick-ring {
  position: absolute;
  inset: 1rem;
  border: 1px dashed rgba(154, 116, 255, .28);
  border-radius: 50%;
}

.joystick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4.35rem;
  height: 4.35rem;
  border: 1px solid rgba(255, 255, 255, .26);
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #6cf2ff, #198ac2 32%, #5931a5 78%);
  box-shadow: 0 .55rem 1.2rem rgba(0, 0, 0, .38), 0 0 1.2rem rgba(85, 231, 255, .22);
  transform: translate(-50%, -50%);
  transition: transform 100ms ease-out;
  pointer-events: none;
}

.joystick.is-active .joystick-knob {
  transition: none;
}

.game-menu {
  background: rgba(3, 5, 13, .72);
  backdrop-filter: blur(12px);
}

.game-menu.menu-hidden {
  display: none !important;
}

.menu-panel {
  max-width: 22rem;
  border: 1px solid rgba(85, 231, 255, .3);
  border-radius: 1.5rem;
  background: rgba(12, 17, 32, .96);
  box-shadow: 0 1.4rem 5rem rgba(0, 0, 0, .45);
}

.menu-panel .btn {
  touch-action: manipulation;
  border-radius: .9rem;
}

@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75%, 100% { content: "..."; }
}

@keyframes pulse {
  0%, 100% { transform: scale(.72); opacity: .65; }
  50% { transform: scale(1); opacity: 1; }
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes splash-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
