:root {
  --ink: #fff;
  --panel: rgba(20, 24, 32, 0.92);
  --line: rgba(255, 255, 255, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background: #000;
  overscroll-behavior: none;
  color: var(--ink);
  font-family: Arial, "Helvetica Neue", sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

body {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
}

canvas {
  display: block;
  width: 100vw;
  height: 56.25vw;
  max-width: 177.7778vh;
  max-height: 100vh;
  width: min(100vw, calc(100dvh * 16 / 9));
  height: min(100dvh, calc(100vw * 9 / 16));
  background: #000;
  border: 0;
  box-shadow: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.app,
.game-root,
.game-shell,
.canvas-wrapper {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000;
}

#gameCanvas {
  cursor: pointer;
}

.meme-endcard-overlay {
  position: fixed;
  z-index: 5;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.9);
  cursor: pointer;
  touch-action: none;
}

.meme-endcard-overlay[hidden] {
  display: none;
}

.meme-endcard-image {
  display: block;
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.rotate-overlay {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: 28px;
  padding-top: calc(28px + env(safe-area-inset-top));
  padding-right: calc(28px + env(safe-area-inset-right));
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
  padding-left: calc(28px + env(safe-area-inset-left));
  box-sizing: border-box;
  background: #101820;
  color: #fff;
  text-align: center;
  pointer-events: none;
}

.rotate-visual {
  position: relative;
  width: 220px;
  height: 166px;
  flex: 0 0 166px;
}

.rotate-phone {
  position: absolute;
  top: 18px;
  left: 73px;
  display: block;
  width: 74px;
  height: 128px;
  border: 7px solid #fff;
  border-radius: 17px;
  background: #168cff;
  box-shadow: 0 0 0 3px #101820, 0 0 0 5px rgba(255, 255, 255, 0.24);
  transform-origin: 50% 50%;
  -webkit-transform-origin: 50% 50%;
  animation: rotate-device 2.2s ease-in-out infinite;
  -webkit-animation: rotate-device 2.2s ease-in-out infinite;
}

.rotate-phone::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  width: 22px;
  height: 4px;
  margin-left: -11px;
  border-radius: 2px;
  background: #fff;
}

.rotate-phone::after {
  content: "";
  position: absolute;
  top: 20px;
  right: 8px;
  bottom: 11px;
  left: 8px;
  border-radius: 7px;
  background: #dff4ff;
}

.rotate-arrow {
  position: absolute;
  right: 7px;
  bottom: 0;
  color: #a8ff22;
  font-size: 72px;
  font-weight: 700;
  line-height: 1;
}

.rotate-title {
  display: block;
  width: 100%;
  max-width: 380px;
  margin-top: 10px;
  color: #fff;
  font-size: 34px;
  font-weight: 900;
  line-height: 1.08;
}

.rotate-copy {
  display: block;
  width: 100%;
  max-width: 360px;
  margin-top: 14px;
  color: #c7d4df;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.35;
}

@keyframes rotate-device {
  0%,
  25% {
    transform: rotate(0deg);
  }

  70%,
  100% {
    transform: rotate(90deg);
  }
}

@-webkit-keyframes rotate-device {
  0%,
  25% {
    -webkit-transform: rotate(0deg);
  }

  70%,
  100% {
    -webkit-transform: rotate(90deg);
  }
}

@media (orientation: portrait) {
  .rotate-overlay {
    display: flex;
  }

  #gameCanvas {
    display: none;
  }
}

@media (orientation: portrait) and (max-height: 520px) {
  .rotate-visual {
    width: 180px;
    height: 126px;
    flex-basis: 126px;
    transform: scale(0.78);
    -webkit-transform: scale(0.78);
  }

  .rotate-title {
    margin-top: 0;
    font-size: 28px;
  }

  .rotate-copy {
    margin-top: 10px;
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rotate-phone {
    animation: none;
    -webkit-animation: none;
    transform: rotate(90deg);
    -webkit-transform: rotate(90deg);
  }
}
