:root {
  --cyan: #39e6f2;
  --blue: #1689c8;
  --pink: #ff5da8;
  --dark: #0b1018;
  --panel: rgba(13, 28, 42, 0.9);
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  color: #e8fbff;
  font-family: Arial, sans-serif;
  background:
    radial-gradient(circle at center, #14354b 0%, #0b1018 58%),
    var(--dark);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(57, 230, 242, 0.25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57, 230, 242, 0.25) 1px, transparent 1px);
  background-size: 42px 42px;
  transform: perspective(500px) rotateX(58deg) scale(1.5);
  transform-origin: center bottom;
}

.screen {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(57, 230, 242, 0.35);
  color: var(--cyan);
  font-size: 12px;
  letter-spacing: 0.16em;
  background: rgba(5, 12, 19, 0.65);
}

.stage {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.miku {
  position: relative;
  z-index: 3;
  width: min(48vw, 380px);
  max-height: 70vh;
  transform: translateX(-25vw);
  transition: transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
}

.miku img {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  user-select: none;
  filter:
    drop-shadow(0 0 12px rgba(57, 230, 242, 0.75))
    drop-shadow(0 0 36px rgba(57, 230, 242, 0.35));
  pointer-events: none;
}

.miku.entered {
  transform: translateX(0);
}

.miku.beaming {
  animation: hover 900ms ease-in-out infinite alternate;
}

.effect-text {
  position: absolute;
  z-index: 4;
  top: 16%;
  left: 50%;
  color: white;
  font-size: clamp(26px, 7vw, 76px);
  font-weight: 900;
  letter-spacing: 0.08em;
  opacity: 0;
  pointer-events: none;
  text-shadow:
    0 0 8px white,
    0 0 20px var(--cyan),
    0 0 42px var(--pink);
  transform: translate(-50%, -50%) scale(0.5);
}

.effect-text.show {
  animation: text-pop 1.25s ease-out forwards;
}

.beam-layer {
  position: fixed;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 150vw;
  height: 13vh;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(57, 230, 242, 0.2) 15%,
    white 48%,
    rgba(255, 93, 168, 0.8) 63%,
    transparent
  );
  box-shadow:
    0 0 20px var(--cyan),
    0 0 60px var(--cyan),
    0 0 120px var(--pink);
  transform: translate(-50%, -50%) rotate(-8deg) scaleX(0);
  transform-origin: left center;
}

.beam-layer.fire {
  animation: beam-fire 850ms cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

.flash-layer {
  position: fixed;
  z-index: 5;
  inset: 0;
  background: white;
  opacity: 0;
  pointer-events: none;
}

.flash-layer.flash {
  animation: flash 650ms ease-out forwards;
}

.control-panel {
  display: flex;
  align-items: center;
  flex-direction: column;
  padding: 16px 20px 24px;
  background: var(--panel);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
}

.beam-button,
.sound-button {
  border: 0;
  color: white;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.beam-button {
  width: min(90vw, 420px);
  padding: 17px 24px;
  border: 2px solid var(--cyan);
  border-radius: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
  background: linear-gradient(135deg, #117a9b, #d32983);
  box-shadow:
    0 0 14px rgba(57, 230, 242, 0.7),
    inset 0 0 18px rgba(255, 255, 255, 0.2);
}

.beam-button:active {
  transform: scale(0.96);
}

.sound-button {
  margin-top: 12px;
  padding: 8px 14px;
  border: 1px solid rgba(57, 230, 242, 0.5);
  border-radius: 999px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.disclaimer {
  margin: 14px 0 0;
  color: rgba(232, 251, 255, 0.6);
  font-size: 11px;
}

@keyframes beam-fire {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-8deg) scaleX(0);
  }

  18% {
    opacity: 1;
  }

  70% {
    opacity: 0.95;
    transform: translate(-50%, -50%) rotate(-8deg) scaleX(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-8deg) scaleX(1.15);
  }
}

@keyframes flash {
  0% {
    opacity: 0;
  }

  14% {
    opacity: 0.85;
  }

  100% {
    opacity: 0;
  }
}

@keyframes text-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }

  25% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.25);
  }
}

@keyframes hover {
  from {
    transform: translateY(-5px) rotate(-1deg);
  }

  to {
    transform: translateY(5px) rotate(1deg);
  }
}

@media (max-width: 600px) {
  .miku {
    width: min(70vw, 330px);
  }

  .top-bar {
    padding: 12px 14px;
    font-size: 10px;
  }

  .control-panel {
    padding-bottom: 18px;
  }
}