* {
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  background: #111;
  color: #fff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin-top: 50px;
}

h1,
h2 {
  color: cyan;
}

.game-section {
  display: grid;
  place-items: center;
  padding: 10px;
  margin: 0 auto;
}

.game-ui {
  width: min(95vw, 95vh);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 10px;
}

.game-ui__left {
  max-width: 70%;
}

.game-wrap {
  width: min(95vw, 95vh);
  position: relative;
  border: 6px solid #b076ff;
  border-radius: 8px;
  box-shadow: 0 0 20px rgb(255, 0, 0);
  overflow: hidden;
  margin: 0 auto;
}

#gameCanvas {
  width: 100%;
  height: auto;
  display: block;
  background: #111;
}

.score-box {
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid #555;
  min-width: 110px;
  text-align: right;
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.overlay.hidden {
  display: none;
}

.overlay__title {
  font-size: 5rem;
  margin-bottom: 1.5rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.overlay__subtitle {
  margin-top: 16px;
  margin-bottom: 10px;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.9;
  text-align: center;
  color: cyan;
}

.overlay__text {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  text-align: center;
}

.overlay__label {
  font-size: 0.9rem;
  opacity: 0.85;
  margin-bottom: 6px;
  display: block;
}

.overlay__panel {
  width: min(520px, 92%);
  padding: 16px 18px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.overlay__button {
  padding: 0.75rem 1.5rem;
  font-size: 1.1rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: #7b3cff;
  color: #fff;
  box-shadow: 0 0 15px rgba(123, 60, 255, 0.6);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  margin: 6px 0;
}

.overlay__button:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(123, 60, 255, 0.9);
}

.overlay__button--ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: none;
}

.overlay__input {
  width: 95%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(10, 10, 10, 0.7);
  color: #fff;
  outline: none;
}

.overlay__input:focus {
  border-color: rgba(0, 255, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 255, 255, 0.12);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
    monospace;
  width: 90%;
}

#hostLobbyButton {
  width: 40%;
  align-self: center;
}

.lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.join-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.ready-row {
  display: flex;
  gap: 30px;
  justify-content: center;
  flex-wrap: wrap;
}

.countdown {
  opacity: 0.9;
  color: cyan;
}

.highscore {
  display: flex;
  margin-top: 18px;
  padding: 20px 0px;
  width: min(350px, 100%);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  flex-direction: column;
  align-items: center;
}

.highscore__title {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.9;
}

.highscore__list {
  margin: 0;
  padding-left: 18px;
  text-align: left;
  line-height: 1.6;
  font-size: 0.95rem;
}

.winner-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.powerupWrapper {
  width: min(95vw, 95vh);
  margin: 0 auto;
}

.powerupGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

/* Mobil */
@media (max-width: 700px) {
  .powerupGrid {
    grid-template-columns: 1fr;
  }
}



/* Title Animation */
.titleFliker {
  -webkit-animation: text-flicker-in-glow 3s linear 0.5s both;
  animation: text-flicker-in-glow 3s linear both;
}

@-webkit-keyframes text-flicker-in-glow {
  0% { opacity: 0; }
  10% { opacity: 0; text-shadow: none; }
  10.1% { opacity: 1; text-shadow: none; }
  10.2% { opacity: 0; text-shadow: none; }
  20% { opacity: 0; text-shadow: none; }
  20.1% { opacity: 1; text-shadow: 0 0 30px rgba(255,255,255,0.25); }
  20.6% { opacity: 0; text-shadow: none; }
  30% { opacity: 0; text-shadow: none; }
  30.1% { opacity: 1; text-shadow: 0 0 30px rgba(255,255,255,0.45), 0 0 60px rgba(255,255,255,0.25); }
  30.6% { opacity: 0; text-shadow: none; }
  45% { opacity: 0; text-shadow: none; }
  45.1% { opacity: 1; text-shadow: 0 0 30px rgba(255,255,255,0.45), 0 0 60px rgba(255,255,255,0.25); }
  55.1% { opacity: 0; text-shadow: none; }
  57.1% { opacity: 1; text-shadow: 0 0 30px rgba(255,255,255,0.55), 0 0 60px rgba(255,255,255,0.35); }
  60.1% { opacity: 0; text-shadow: none; }
  65.1% { opacity: 1; text-shadow: 0 0 30px rgba(255,255,255,0.55), 0 0 60px rgba(255,255,255,0.35), 0 0 100px rgba(255,255,255,0.1); }
  75.1% { opacity: 0; text-shadow: none; }
  77.1% { opacity: 1; text-shadow: 0 0 30px rgba(255,255,255,0.55), 0 0 60px rgba(255,255,255,0.4), 0 0 110px rgba(255,255,255,0.2), 0 0 100px rgba(255,255,255,0.1); }
  85.1% { opacity: 0; text-shadow: none; }
  86.1% { opacity: 1; text-shadow: 0 0 30px rgba(255,255,255,0.6), 0 0 60px rgba(255,255,255,0.45), 0 0 110px rgba(255,255,255,0.25), 0 0 100px rgba(255,255,255,0.1); }
  100% { opacity: 1; text-shadow: 0 0 30px rgba(255,255,255,0.6), 0 0 60px rgba(255,255,255,0.45), 0 0 110px rgba(255,255,255,0.25), 0 0 100px rgba(255,255,255,0.1); }
}

@keyframes text-flicker-in-glow {
  0% { opacity: 0; }
  10% { opacity: 0; text-shadow: none; }
  10.1% { opacity: 1; text-shadow: none; }
  10.2% { opacity: 0; text-shadow: none; }
  20% { opacity: 0; text-shadow: none; }
  20.1% { opacity: 1; text-shadow: 0 0 30px rgba(255,255,255,0.25); }
  20.6% { opacity: 0; text-shadow: none; }
  30% { opacity: 0; text-shadow: none; }
  30.1% { opacity: 1; text-shadow: 0 0 30px rgba(255,255,255,0.45), 0 0 60px rgba(255,255,255,0.25); }
  30.6% { opacity: 0; text-shadow: none; }
  45% { opacity: 0; text-shadow: none; }
  45.1% { opacity: 1; text-shadow: 0 0 30px rgba(255,255,255,0.45), 0 0 60px rgba(255,255,255,0.25); }
  55.1% { opacity: 0; text-shadow: none; }
  57.1% { opacity: 1; text-shadow: 0 0 30px rgba(255,255,255,0.55), 0 0 60px rgba(255,255,255,0.35); }
  60.1% { opacity: 0; text-shadow: none; }
  65.1% { opacity: 1; text-shadow: 0 0 30px rgba(255,255,255,0.55), 0 0 60px rgba(255,255,255,0.35), 0 0 100px rgba(255,255,255,0.1); }
  75.1% { opacity: 0; text-shadow: none; }
  77.1% { opacity: 1; text-shadow: 0 0 30px rgba(255,255,255,0.55), 0 0 60px rgba(255,255,255,0.4), 0 0 110px rgba(255,255,255,0.2), 0 0 100px rgba(255,255,255,0.1); }
  85.1% { opacity: 0; text-shadow: none; }
  86.1% { opacity: 1; text-shadow: 0 0 30px rgba(255,255,255,0.6), 0 0 60px rgba(255,255,255,0.45), 0 0 110px rgba(255,255,255,0.25), 0 0 100px rgba(255,255,255,0.1); }
  100% { opacity: 1; text-shadow: 0 0 30px rgba(255,255,255,0.6), 0 0 60px rgba(255,255,255,0.45), 0 0 110px rgba(255,255,255,0.25), 0 0 100px rgba(255,255,255,0.1); }
}


/* Button animations */

/* --- Intro + Vibrate (vibrate är pausad tills hover) --- */
#startButton,
#multiplayerButton {
  opacity: 0;
  filter: blur(8px);
  transition: none;

  /* 1) intro  2) vibrate */
  animation-name: btnFadeIn, vibrate-1;
  animation-duration: 5s, 0.5s;
  animation-timing-function: cubic-bezier(.2,.8,.2,1), linear;
  animation-fill-mode: forwards, none;
  animation-iteration-count: 1, infinite;

  /* Viktigt: vibrate startar pausad */
  animation-play-state: running, paused;
}

/* delays för intro (vibrate-delay = 0) */
#startButton {
  animation-delay: 4s, 0s;
}
#multiplayerButton {
  animation-delay: 5s, 0s;
}

/* När du hovrar: “starta” vibrate genom att unpausa den andra animationen */
#startButton:hover,
#multiplayerButton:hover {
  animation-play-state: running, running;
}

/* Intro keyframes */
@keyframes btnFadeIn {
  to {
    opacity: 1;
    filter: blur(0);
  }
}

/* Vibrate keyframes (använder translate3d för lite bättre rendering) */
@keyframes vibrate-1 {
  0%   { transform: translate3d(0, 0, 0); }
  20%  { transform: translate3d(-2px, 2px, 0); }
  40%  { transform: translate3d(-2px, -2px, 0); }
  60%  { transform: translate3d(2px, 2px, 0); }
  80%  { transform: translate3d(2px, -2px, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

.about {
  display: flex;
  flex-direction: column;
  width: 45%;
  margin: 0 auto;
  margin-top: 30px;
}

.history a {
  color: cyan;
  font-style: italic;
}