/* ========================
  🧱 BASLAYOUT & BAKGRUND
======================== */
body {
  margin: 0;
  padding-top: 5rem;
  font-family: 'Press Start 2P', 'Retro Gaming', monospace;
  background: url('../img/background.png') no-repeat center center/cover;
  height: 100vh;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}

/* ========================
  🧢 TITEL & GLITCH-EFFEKT
======================== */
h1 {
  font-size: 2.2rem;
  color: #ff0044;
  margin: 1.5rem 0 1rem;
  text-align: center;
  text-shadow:
    -1px -1px 0 #000,
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000,
     0 0 10px #ff0044;
  animation: glitch 1.5s infinite;
  position: relative;
}

@keyframes glitch {
  0%, 100% { transform: translate(0, 0); }
  20%  { transform: translate(-1px, 1px); }
  40%  { transform: translate(1px, -1px); }
  60%  { transform: translate(-1px, -1px); }
  80%  { transform: translate(1px, 1px); }
}

/* ========================
  🎞️ TICKER / LÖPANDE TEXT
======================== */
.ticker {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  overflow: hidden;
  white-space: nowrap;
  border-top: 2px solid #ff0044;
  border-bottom: 2px solid #ff0044;
  padding: 0.5rem 0;
  background: rgba(0, 0, 0, 0.6);
}

.ticker p {
  display: inline-block;
  padding-left: 100%;
  animation: ticker 15s linear infinite;
  font-size: 0.9rem;
  color: #fff;
}

@keyframes ticker {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* ========================
  📦 INNEHÅLLSBOX (JOIN / COUNTDOWN)
======================== */
.content {
  text-align: center;
  max-width: 500px;
  width: 100%;
  margin-top: 1rem;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(255, 0, 68, 0.5);
}

/* ========================
  🕒 INFO-RADER & COUNTDOWN
======================== */
.info p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

#countdown {
  color: #00ff66;
  font-size: 1.4rem;
  text-shadow: 0 0 10px #00ff66;
}

#countdown.warning {
  color: #ff0033;
  text-shadow: 0 0 10px #ff0033;
}

/* ========================
  🕹️ KNAPPAR
======================== */
.buttons {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

button {
  background-color: #ff0044;
  border: none;
  color: white;
  padding: 0.8rem 1.5rem;
  font-size: 0.9rem;
  font-family: 'Press Start 2P', monospace;
  cursor: pointer;
  border-radius: 5px;
  box-shadow: 0 0 10px #ff0044;
  transition: background 0.2s ease;
}

button:hover {
  background-color: #cc0036;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

/* ========================
  📁 READ.ME-LÄNK
======================== */
.readme-link {
  text-align: center;
  margin-top: 1.5rem;
}

.readme-link a {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.8rem;
  color: #00ff99;
  text-decoration: underline;
  cursor: pointer;
}

.readme-link a:hover {
  color: #ff0044;
}

/* ========================
  📄 MODALRUTOR (README.TXT
======================== */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  box-sizing: border-box;
}

.modal.show {
  display: flex;
}

.modal:not(.show) {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background: rgba(20, 20, 20, 0.95);
  border: 2px solid #ff0044;
  color: #fff;
  padding: 2rem;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.55rem;
  line-height: 1.6;
  width: 90vw;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 0 20px #ff0044;
  text-align: left;
  position: relative;
  box-sizing: border-box;
  margin: 0 auto;
}

.modal-content h2 {
  margin-top: 0;
  color: #ff0044;
}

.modal-content ul {
  padding-left: 1.5rem;
  text-align: left;
}

.close-btn {
  position: absolute;
  top: 0.5rem;
  right: 1rem;
  font-size: 1.2rem;
  color: #ff0044;
  cursor: pointer;
  background: none;
  border: none;
}

/* ========================
  📊 LOBBY / RACE: STATS-BOX
======================== */
.stats-box {
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid #ff0044;
  padding: 1rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
  color: #fff;
}

.stats-box table {
  border-collapse: collapse;
}

.stats-box td {
  padding: 0.2rem 0.5rem;
}

/* ========================
  🗺️ KARTA (LEAFLET)
======================== */
#map {
  width: 100%;
  height: 300px;
  margin-top: 1rem;
}

/* ========================
  🎇 GO! - BLINKEFFEKT
======================== */
.flash-text {
  animation: flash 0.5s ease-in-out 4;
  color: #00ff66;
  text-shadow: 0 0 10px #00ff66;
}

@keyframes flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ========================
  📊 RESULTAT
======================== */
#results-table th, #results-table td {
      padding: 0.5rem 0.7rem;
      text-align: center;
    }

    #results-table td[colspan="3"] {
      color: #888;
      font-style: italic;
      padding-top: 2rem;
    }

/* ========================
  📱 MOBILANPASSNING
======================== */
@media (max-width: 600px) {
  body {
    padding: 0.5rem;
  }

  h1 {
    font-size: 1.8rem;
  }

  button {
    font-size: 0.8rem;
    padding: 0.6rem 1.2rem;
  }

  .modal-content {
    font-size: 0.7rem;
    padding: 1.2rem;
  }
}
