:root {
  color-scheme: dark;
  font-family: Inter, ui-rounded, "SF Pro Rounded", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0b2d24;
}

* {
  box-sizing: border-box;
}

html,
body,
.game-shell,
#rack-game {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

.game-shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 50% 36%, rgba(77, 173, 123, 0.2), transparent 38%),
    linear-gradient(145deg, #174d3b, #09281f 72%);
}

#rack-game {
  position: absolute;
  inset: 0;
  display: block;
  border: 0;
  background: #123f31;
  opacity: 0;
  transition: opacity 260ms ease;
}

#rack-game.is-ready {
  opacity: 1;
}

.loading-screen {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 28px;
  color: #fff8df;
  text-align: center;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.loading-screen.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.loading-screen h1 {
  margin: 8px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 8vw, 4rem);
  letter-spacing: -0.04em;
  text-shadow: 0 5px 18px rgba(0, 0, 0, 0.32);
}

.loading-screen p {
  margin: 0;
  color: #c9ded4;
  font-size: 1rem;
}

.tile-mark {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 82px;
  filter: drop-shadow(0 12px 12px rgba(0, 0, 0, 0.26));
}

.tile {
  display: grid;
  width: 49px;
  height: 70px;
  margin-left: -8px;
  place-items: center;
  border: 1px solid #d7c79d;
  border-radius: 8px;
  background: linear-gradient(145deg, #fff9df, #e5d8b1);
  box-shadow: inset 0 1px #fff, inset -3px -3px 6px rgba(103, 77, 33, 0.16);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.75rem;
  font-weight: 800;
  transform-origin: bottom center;
  animation: deal 1.1s cubic-bezier(0.2, 0.75, 0.25, 1) infinite alternate;
}

.tile:first-child {
  margin-left: 0;
}

.tile:nth-child(1) {
  transform: rotate(-8deg) translateY(5px);
}

.tile:nth-child(2) {
  animation-delay: 100ms;
  transform: rotate(-2deg);
}

.tile:nth-child(3) {
  animation-delay: 200ms;
  transform: rotate(3deg);
}

.tile:nth-child(4) {
  animation-delay: 300ms;
  transform: rotate(9deg) translateY(5px);
}

.tile-red {
  color: #c9312d;
}

.tile-blue {
  color: #2165b5;
}

.tile-black {
  color: #25282a;
}

.tile-orange {
  color: #df761d;
}

.fallback-link {
  display: none;
  margin-top: 8px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  color: #fff8df;
  background: rgba(255, 255, 255, 0.09);
  font-weight: 700;
  text-decoration: none;
}

.fallback-link.is-visible {
  display: inline-flex;
}

.no-script {
  position: fixed;
  z-index: 5;
  inset: 0;
  margin: 0;
  padding: 40px 24px;
  color: white;
  background: #123f31;
  text-align: center;
}

.no-script a {
  color: #fff0ac;
}

@keyframes deal {
  from {
    translate: 0 2px;
  }

  to {
    translate: 0 -4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #rack-game,
  .loading-screen,
  .tile {
    transition: none;
    animation: none;
  }
}
