:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
.player,
.game-frame {
  width: 100%;
  /* Safari before 15.4 does not understand dynamic viewport units. Keep
     earlier declarations so an unsupported 100dvh does not collapse the
     iframe to its HTML default height of 150px. */
  height: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0;
}

html,
body {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  overflow: hidden;
  background: #030611;
  overscroll-behavior: none;
}

.player {
  position: relative;
  overflow: hidden;
  touch-action: none;
}

.game-frame {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  border: 0;
  background: #030611;
  pointer-events: auto;
  touch-action: none;
}

.game-overlay {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  z-index: 10;
  width: min(920px, calc(100% - 28px));
  min-height: 62px;
  padding: 9px 10px 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: #eef4ff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: rgba(5, 10, 25, 0.86);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
  transform: translateX(-50%);
  transition: opacity 160ms ease, transform 160ms ease;
}

@supports (backdrop-filter: blur(1px)) {
  .game-overlay {
    backdrop-filter: blur(18px);
  }
}

.game-overlay.is-hidden {
  display: none;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -16px);
}

.overlay-brand,
.overlay-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.overlay-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 12px;
  font-weight: 950;
  background: linear-gradient(135deg, #5ce7ff, #6077ff, #b45cff);
}

.overlay-brand strong,
.overlay-brand small {
  display: block;
  white-space: nowrap;
}

.overlay-brand small {
  margin-top: 2px;
  color: #9fb2d9;
  font-size: 0.72rem;
}

.overlay-button {
  min-height: 44px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #eef4ff;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.06);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}

.overlay-button:hover {
  border-color: rgba(92, 231, 255, 0.5);
  background: rgba(255, 255, 255, 0.12);
}

.overlay-back {
  color: #061024;
  border: 0;
  background: linear-gradient(135deg, #5ce7ff, #6077ff);
}

.overlay-icon {
  width: 44px;
  padding: 0;
  font-size: 1.2rem;
}

.show-overlay {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  z-index: 11;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  color: white;
  background: linear-gradient(135deg, #6077ff, #b45cff);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  font-weight: 950;
  cursor: grab;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
  transition: opacity 160ms ease, transform 160ms ease;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.show-overlay:active {
  cursor: grabbing;
}

.show-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.player-notice {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 12;
  max-width: calc(100% - 32px);
  padding: 11px 15px;
  color: #eef4ff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  background: rgba(5, 10, 25, 0.9);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  font-size: 0.82rem;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: 160ms ease;
}

.player-notice.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.player-error:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 30px;
  color: #ffb5c8;
  text-align: center;
}

@media (max-width: 760px) {
  .game-overlay {
    align-items: stretch;
    flex-direction: column;
  }

  .overlay-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .overlay-icon {
    position: absolute;
    top: 9px;
    right: 9px;
  }

  .overlay-brand {
    padding-right: 48px;
  }
}
