/* Utseendet på spillet */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: "Segoe UI", system-ui, sans-serif;
  touch-action: none;
  user-select: none;
}

#lerret {
  display: block;
  position: absolute;
  left: 0;
  top: 48px;
}

/* Tallene øverst */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 12px;
  background: #0a0f2e;
  border-bottom: 2px solid #2f5bff;
  font-size: 20px;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
}
#hud .hoyre { margin-left: auto; display: flex; gap: 6px; }
#hud button {
  font-size: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
#hudEffekter { font-size: 18px; }

/* Beskjeder midt på skjermen */
#melding {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 14px;
  background: rgba(10, 15, 46, 0.9);
  border: 2px solid #ffd23f;
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  max-width: 90vw;
}
#melding.vis { opacity: 1; }
#melding.darlig { border-color: #ff4d4d; }

/* Lag som legger seg over spillet (start, quiz, pause, slutt) */
.lag {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  padding: 16px;
}
.skjult { display: none; }

.kort {
  background: #101a4d;
  border: 3px solid #2f5bff;
  border-radius: 20px;
  padding: 20px 28px;
  max-width: 720px;
  width: 100%;
  max-height: 100%;
  overflow-y: auto;
  text-align: center;
  font-size: 19px;
}
.kort h1 { font-size: 44px; margin: 6px 0 10px; color: #ffd23f; }
.kort h2 { margin: 4px 0 12px; font-size: 28px; }
.liten { font-size: 15px; opacity: 0.8; }

button.stor {
  font-size: 28px;
  padding: 12px 36px;
  border-radius: 14px;
  border: none;
  background: #ffd23f;
  color: #101a4d;
  font-weight: bold;
  cursor: pointer;
  margin-top: 8px;
}
button.stor:hover { background: #ffe27a; }

.lenkeknapp { background: none; border: none; color: #9fd6ff; font-size: 16px; cursor: pointer; text-decoration: underline; }

/* Vanskelighetsgrad */
#gradvalg { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
#gradvalg button {
  font-size: 18px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 2px solid #2f5bff;
  background: #1c2a78;
  color: #fff;
  cursor: pointer;
  font-weight: bold;
}
#gradvalg button.valgt { border-color: #ffd23f; background: #3a3a12; box-shadow: 0 0 10px #ffd23f88; }
#gradTekst { min-height: 20px; margin: 6px 0 0; }
.lister li .grad { float: none; margin-left: 4px; font-size: 12px; }

.tittel { display: flex; align-items: center; justify-content: center; gap: 14px; }

/* Rekordlistene */
.lister {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  text-align: left;
  margin: 14px 0 6px;
}
.lister h3 { margin: 0 0 4px; font-size: 18px; color: #ffd23f; }
.lister ol { margin: 0; padding-left: 28px; font-size: 16px; }
.lister li span { float: right; opacity: 0.85; }
.lister li.ny { color: #4dff6a; font-weight: bold; }
.lister .tom { opacity: 0.6; font-size: 15px; }

#navnFelt {
  font-size: 24px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid #ffd23f;
  width: 220px;
  text-align: center;
}
button.liten-knapp { font-size: 22px; padding: 8px 20px; margin-left: 6px; }

details { text-align: left; margin: 8px 0; font-size: 16px; }
summary { cursor: pointer; text-align: center; color: #9fd6ff; }

#quizGruppe { font-size: 18px; color: #ffd23f; margin: -4px 0 10px; }

#forklaring {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 4px 12px;
  text-align: left;
  font-size: 15px;
  margin: 10px 0;
}

/* Quizen */
#quizBilde {
  display: block;
  margin: 0 auto 12px;
  max-width: min(360px, 80vw);
  max-height: 32vh;
  border: 2px solid #fff;
  background: #fff;
}
#quizBilde.vaapen { border: none; background: none; }
#alternativer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
#alternativer button {
  position: relative;
  overflow: hidden;
  font-size: 20px;
  padding: 12px 8px;
  border-radius: 12px;
  border: 2px solid #2f5bff;
  background: #1c2a78;
  color: #fff;
  cursor: pointer;
  font-weight: bold;
}
#alternativer button:hover:not(:disabled) { background: #2c3fa3; }
#alternativer button .nr { opacity: 0.5; font-size: 14px; margin-right: 6px; }
#alternativer button.feil { background: #7a1a1a; border-color: #ff4d4d; opacity: 0.6; }
#alternativer button.riktig { background: #1a7a2c; border-color: #4dff6a; }
#alternativer button.borte { visibility: hidden; }
#alternativer button .publikum {
  position: absolute;
  left: 0; bottom: 0;
  height: 6px;
  background: #ffd23f;
}
#alternativer button .prosent { font-size: 14px; color: #ffd23f; margin-left: 6px; }

#quizJokere { margin-top: 12px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
#quizJokere button {
  font-size: 16px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid #ffd23f;
  background: #2a2a10;
  color: #fff;
  cursor: pointer;
}
#quizJokere button:disabled { opacity: 0.3; cursor: default; }

#quizVenn {
  min-height: 0;
  font-size: 20px;
  margin-bottom: 10px;
  color: #9fd6ff;
}
#quizMelding { min-height: 32px; font-size: 24px; font-weight: bold; margin-top: 10px; }

.rist { animation: rist 0.35s; }
@keyframes rist {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

@media (max-width: 600px) {
  #hud { font-size: 16px; gap: 10px; }
  #alternativer { grid-template-columns: 1fr; }
  .lister { grid-template-columns: 1fr; }
  #alternativer button { font-size: 17px; padding: 9px 6px; }
  .kort { padding: 14px; }
  .kort h1 { font-size: 32px; }
}
