:root {
  color-scheme: light;
  --yellow: #ffde00;
  --orange: #ffba00;
  --ink: #231f20;
  --cream: #fff9e8;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgb(255 222 0 / 14%), transparent 34rem),
    radial-gradient(circle at 16% 88%, rgb(255 186 0 / 8%), transparent 24rem),
    linear-gradient(145deg, #2b2627 0%, #171314 100%);
  font-family: Metropolis, "Avenir Next", Avenir, Montserrat, system-ui, sans-serif;
  overscroll-behavior: none;
  touch-action: none;
}

.game-nav {
  position: fixed;
  z-index: 10;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  left: max(10px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.game-nav a {
  min-height: 44px;
  padding: 0 17px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgb(255 255 255 / 32%);
  border-radius: 999px;
  color: var(--cream);
  background: rgb(35 31 32 / 64%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 22%), 0 10px 28px rgb(0 0 0 / 24%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  backdrop-filter: blur(18px) saturate(130%);
  text-decoration: none;
  font-size: 0.76rem;
  font-weight: 850;
  pointer-events: auto;
  transition: transform 180ms ease, background-color 180ms ease;
}

.game-nav a:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}

.game-nav a:active { transform: scale(0.98); }

@media (hover: hover) {
  .game-nav a:hover { background: rgb(35 31 32 / 82%); transform: translateY(-1px); }
}

.game-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(64px, calc(env(safe-area-inset-top) + 56px)) max(8px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}

#moodi-game {
  display: block;
  width: min(calc(100vw - 16px), calc((100dvh - 72px) * 0.8372), 720px);
  height: auto;
  max-height: calc(100dvh - 72px);
  border: 3px solid var(--orange);
  border-radius: clamp(18px, 3vw, 32px);
  background: var(--cream);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 22%), 0 26px 82px rgb(0 0 0 / 42%);
  outline: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#moodi-game:focus-visible {
  box-shadow: 0 0 0 5px rgb(255 222 0 / 78%), 0 26px 82px rgb(0 0 0 / 42%);
}

#moodi-game:fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border: 0;
  border-radius: 0;
  object-fit: contain;
  background: var(--ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  #moodi-game {
    scroll-behavior: auto;
  }
}

@media (max-width: 520px) {
  .game-nav a { min-height: 42px; padding-inline: 14px; font-size: 0.72rem; }
  .game-shell { padding-top: max(60px, calc(env(safe-area-inset-top) + 52px)); }
  #moodi-game {
    width: min(calc(100vw - 12px), calc((100dvh - 66px) * 0.8372), 720px);
    max-height: calc(100dvh - 66px);
  }
}
