body {
  font-family: sans-serif;
  text-align: center;
  background: url("../img1/bowlinghal.png") no-repeat center center fixed;
  background-size: cover;
  color: white;
  margin: 0;
  padding: 0;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6); /* 0.6 = mørk nok til kontrast */
  z-index: -1;
}

h1 {
  font-size: 2.2rem;
  font-weight: bold;
  margin-top: 10px;
  letter-spacing: 1px;
  color: white;
  background: linear-gradient(to right, #00ccff, #0077aa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.emoji {
  font-size: 1.2em;
  margin-right: 6px;
  vertical-align: middle;
  filter: none; /* ingen glow */
}

@keyframes glowTitle {
  from {
    text-shadow: 0 0 5px #00ccff, 0 0 10px #004466;
  }
  to {
    text-shadow: 0 0 10px #00ccff, 0 0 20px #0077aa;
  }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}


/* Mobiltilpasning */
@media (max-width: 600px) {
  h1 {
    font-size: 1.6rem;
  }

  .emoji {
    font-size: 1.1em;
  }
}

  @keyframes bounceMobile {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
  }


  canvas {
    background: #333;
    display: block;
    margin: 20px auto;
    border-radius: 10px;
  }

#scoreboard {
  background: linear-gradient(to bottom, #001144, #000822); /* Mørk blå */
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0, 204, 255, 0.2);
  color: white;
  max-width: 500px;
  margin: 0 auto;
  margin-top: 20px;
}

.frame {
  background: linear-gradient(to bottom, #0044cc, #002266); /* Blå baggrund */
  color: white; /* Hvid tekst */
  padding: 10px;
  border-radius: 8px;
  width: 60px;
  text-align: center;
  font-family: 'Courier New', monospace; /* Lidt retro-look */
  font-size: 16px;
  box-shadow: inset 0 0 5px rgba(255,255,255,0.1), 0 0 8px rgba(0, 0, 0, 0.3);
  border: 1px solid #0066ff;
  text-shadow: 0 0 5px #fff;
}

#scoreboard h2 {
  color: #00ccff;
  margin-bottom: 10px;
}

#scoreboard button {
  margin: 10px 5px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: #00ccff;
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
}

#scoreboard button:hover {
  background: #00aacc;
  box-shadow: 0 0 10px #00ccff;
}

#frames {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

#previousScores ul {
  list-style: none;
  padding: 0;
  font-size: 14px;
  color: #ddd;
}

#ballSelector button.selected {
  background-color: #00ccff;
  color: white;
  font-weight: bold;
}

#gameContainer {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 30px;
  flex-wrap: wrap;
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
  position: relative; /* Gør det muligt at absolut-positionere introImage inde i */
}

#gameCanvas {
  max-width: 400px;
  aspect-ratio: 1 / 2;
  width: 100%;
  height: auto;
  border: 2px solid white;
  border-radius: 10px;
  display: block;
}

#sidePanel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 260px;
  max-width: 320px;
  flex: 1;
  align-items: center;
  width: 100%;
  max-width: 500px;
  flex-shrink: 0;
}

#ballSelector, #scoreboard {
  flex: 1;
}

#panelWrapper {
  display: flex;
  flex-direction: column;
  gap: 30px;
  width: 100%;
}

#panelWrapper > div {
  align-self: flex-start;
}

@media (max-width: 700px) {
  #gameContainer {
    flex-direction: column;
    align-items: center;
  }

  #sidePanel {
    width: 90%;
    align-items: center;
  }

  #scoreboard, #ballSelector {
    width: 100%;
  }

  #scoreboard .frame:last-child {
    flex-basis: 100%;
    text-align: center;
  }

  #gameCanvas {
    width: 90%;
    aspect-ratio: 1 / 2;
    min-width: 280px;
    margin-left: auto;
    margin-right: auto;
  }
}

#ballSelector {
  background: linear-gradient(to bottom, #003366, #001f33); /* Mørk blå */
  padding: 15px;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0, 153, 255, 0.3);
  color: white;
  text-align: center;
  font-family: 'Segoe UI', sans-serif;
  border: 1px solid #0055cc;
}

#ballSelector label {
  font-weight: bold;
  font-size: 18px;
  color: #ffffff;
  text-shadow: 0 0 5px #00ccff;
  display: block;
  margin-bottom: 10px;
}

#ballSelector button {
  margin: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  background: #0044cc;
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 5px #003399;
}

#ballSelector button:hover {
  background: #0066ff;
  box-shadow: 0 0 12px #00ccff;
}

#ballSelector .tip {
  font-size: 13px;
  color: #cce6ff;
  margin-top: 10px;
  font-style: italic;
  text-shadow: 0 0 4px #003366;
}

#ballSelector button:hover {
  background: #888;
}

@keyframes pump {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1.05); }
}

#ballSelector button.selected {
  animation: pump 0.2s ease;
  background-color: #00ccff;
  color: white;
  font-weight: bold;
  box-shadow: 0 0 12px #00ccff, 0 0 20px #00ccff;
  border: 2px solid white;
  transform: scale(1.05);
}

.tip {
  font-size: 13px;
  color: #ccc;
  margin-top: 8px;
  font-style: italic;
}

#message {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 60px;
  font-weight: bold;
  display: none;
  z-index: 10;
  animation: pop 0.5s ease-out;
  text-shadow: 0 0 15px #fff, 0 0 30px #fff;
}

#message.strike {
  color: #ff3b3b;
  text-shadow: 0 0 20px #ff3b3b, 0 0 40px #ff3b3b;
  animation: pop 0.5s ease-out, glowPulse 1s infinite alternate;
}

#message.spare {
  color: #4fff4f;
  text-shadow: 0 0 20px #4fff4f, 0 0 40px #4fff4f;
  animation: pop 0.5s ease-out, glowPulse 1s infinite alternate;
}

@keyframes glowPulse {
  0% { text-shadow: 0 0 10px currentColor; }
  100% { text-shadow: 0 0 30px currentColor, 0 0 50px currentColor; }
}

@keyframes pop {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

#fxContainer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 9;
}

.fx-flamestrike {
  background: radial-gradient(circle, rgba(255,100,0,0.4) 0%, rgba(0,0,0,0) 70%);
  animation: pulse 0.4s ease-out;
  width: 100%;
  height: 100%;
  position: absolute;
}

@keyframes pulse {
  0% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

.fx-star, .fx-confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  opacity: 0;
  animation: rise 1s forwards;
}

.fx-star {
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 8px white;
}

.fx-confetti {
  background: hsl(var(--hue), 80%, 60%);
  transform: rotate(calc(var(--rot) * 1deg));
}

@keyframes rise {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-100px) rotate(360deg); opacity: 0; }
}

#message.flamestrike {
  background: radial-gradient(circle, #ff6600 0%, transparent 70%);
  padding: 20px 40px;
  border-radius: 20px;
  box-shadow: 0 0 30px #ff6600aa, 0 0 60px #ff2200aa;
  animation: explode 0.8s ease-out;
}

@keyframes explode {
  0% {
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 0;
  }
  60% {
    transform: translate(-50%, -50%) scale(1.3);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

#particleCanvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 0;
  background: transparent;
}

@media (min-width: 800px) {
  #panelWrapper {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }

  #ballSelector, #scoreboard {
    flex: 1;
    max-width: 48%;
  }
}

#introImage {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: 999;
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 0.8s ease;
  border-radius: 0;
  box-shadow: none;
  pointer-events: none;
}

#introImage.fade-out {
  opacity: 0;
  pointer-events: none;
}

#startText {
  position: fixed;
  bottom: 6%;
  width: 100%;
  text-align: center;
  color: white;
  font-size: 24px;
  text-shadow: 0 0 10px #000;
  animation: blink 1.5s infinite;
  z-index: 1000;
  transition: opacity 0.8s ease;
}

#startText.fade-out {
  opacity: 0;
  pointer-events: auto;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

#gameOverModal {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

#gameOverModal.hidden {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 600px) {
  #gameOverModal button + button {
    margin-top: 16px;
  }
}

.modal-content {
  background: #111;
  padding: 30px 40px;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 0 20px #00ccff;
  animation: pop 0.5s ease-out;
}

#gameOverModal h2 {
  color: #00ccff;
  font-size: 28px;
  margin-bottom: 10px;
}

#gameOverModal p {
  font-size: 18px;
  color: white;
  margin-bottom: 20px;
}

#gameOverModal button {
  padding: 10px 20px;
  font-size: 16px;
  background: #00ccff;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
}

#gameOverModal button:hover {
  background: #00aacc;
}

@keyframes pop {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.contact-button {
  margin-top: 20px;
  padding: 12px 20px;
  font-size: 1rem;
  background: #00ccff;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  box-shadow: 0 0 10px rgba(0, 204, 255, 0.5);
  transition: 0.3s ease;
}

.contact-button:hover {
  background: #009ec2;
  box-shadow: 0 0 15px rgba(0, 204, 255, 0.7);
  transform: scale(1.05);
}

.hidden {
  display: none;
}

#nameModal {
  position: fixed;
  z-index: 999;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.85);
  display: flex;
  justify-content: center;
  align-items: center;
}

#nameModal .modal-content {
  background: #111;
  padding: 30px 40px;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 0 20px #00ccff;
}

#nameModal input {
  padding: 10px;
  font-size: 16px;
  border-radius: 8px;
  border: none;
  margin: 10px 0;
  width: 80%;
}

#nameModal button {
  padding: 10px 20px;
  font-size: 16px;
  background: #00ccff;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
}

#nameModal button:hover {
  background: #00aacc;
}

#namePrompt {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

#introOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999;
  cursor: pointer;
  transition: opacity 0.8s ease;
}

#introOverlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

@keyframes blinkEffect {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}

.blink {
  animation: blinkEffect 1s infinite ease-in-out;
}

#effectGif {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  max-width: 80%;
  max-height: 80%;
  pointer-events: none;
  animation: pumpEffect 1s infinite ease-in-out;
  filter: drop-shadow(0 0 20px #ffcc00) drop-shadow(0 0 40px #ff6600);
}

@keyframes pumpEffect {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  25% { transform: translate(-50%, -50%) scale(1.15); opacity: 0.85; }
  50% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  75% { transform: translate(-50%, -50%) scale(1.15); opacity: 0.85; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}