/* Harald sin 3D-verden — UI-laget oppå spillet. */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --gul: #ffd400;
  --rosa: #ff5d8f;
  --oransje: #ff6d00;
  --moerk: #1c1c1c;
  --kant: #2b2b2b;
  --lys: #fffdf5;
}

body.kjor-side {
  font-family: "Comic Sans MS", "Comic Sans", "Chalkboard SE", "Segoe UI", sans-serif;
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  background: #2e9ade;
  color: var(--kant);
}

#verden {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Knapper øverst */
#lyd-knapp,
.scene-knapp {
  position: fixed;
  top: 12px;
  z-index: 10;
  width: 54px;
  height: 54px;
  font-size: 1.6rem;
  background: var(--lys);
  border: 4px solid var(--kant);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
  -webkit-tap-highlight-color: transparent;
}

#lyd-knapp {
  right: 76px;
}

.kjor-knapp {
  right: 12px;
}

#lyd-knapp:active,
.scene-knapp:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}

/* HUD-chips */
#hud,
#jakt-hud,
#runde-hud {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  border: 4px solid var(--kant);
  border-radius: 999px;
  padding: 0.4rem 1.2rem;
  font-size: 1.15rem;
  font-weight: bold;
  white-space: nowrap;
}

#hud {
  top: 16px;
  background: var(--gul);
}

#runde-hud {
  top: 74px;
  background: var(--moerk);
  color: var(--oransje);
  border-color: var(--oransje);
  font-variant-numeric: tabular-nums;
}

#jakt-hud {
  top: 130px;
  background: var(--rosa);
  color: #fff;
}

#jakt-hud[hidden],
#runde-hud[hidden] {
  display: none;
}

/* Store meldinger midt på skjermen */
#melding {
  position: fixed;
  top: 38%;
  left: 50%;
  transform: translateX(-50%) scale(0);
  z-index: 10;
  background: var(--lys);
  border: 5px solid var(--kant);
  border-radius: 20px;
  padding: 0.8rem 1.4rem;
  font-size: clamp(1.2rem, 4.5vw, 1.8rem);
  font-weight: bold;
  white-space: nowrap;
  transition: transform 0.3s;
}

#melding.vis {
  transform: translateX(-50%) scale(1);
}

#hjelp {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
  font-size: 0.95rem;
  white-space: nowrap;
}

/* Styrespak på touch-skjermer — til høyre, der tommelen bor */
#styrespak {
  position: fixed;
  bottom: 56px;
  right: 26px;
  z-index: 10;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 253, 245, 0.25);
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

#styrespak[hidden] {
  display: none;
}

#spak {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--lys);
  border: 4px solid var(--kant);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

/* Hoppeknapp på touch-skjermer — venstre tommel */
#hopp-knapp {
  position: fixed;
  bottom: 76px;
  left: 30px;
  z-index: 10;
  width: 84px;
  height: 84px;
  font-size: 2.2rem;
  background: var(--oransje);
  border: 4px solid var(--kant);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.35);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

#hopp-knapp[hidden] {
  display: none;
}

#hopp-knapp:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

/* Konfetti og trollregn */
#confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}

.konfetti {
  position: absolute;
  top: -5vh;
  font-size: 1.6rem;
  animation: fall linear forwards;
}

@keyframes fall {
  to {
    transform: translateY(110vh) rotate(720deg);
  }
}

/* Reserveside hvis 3D ikke kan starte */
#fallback {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(160deg, #38b6ff 0%, #9b5de5 60%, #ff5d8f 100%);
}

#fallback[hidden] {
  display: none;
}

.kort {
  background: var(--lys);
  border-radius: 28px;
  border: 6px solid var(--kant);
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.3);
  padding: 1.8rem 1.2rem 2.2rem;
  max-width: 540px;
  text-align: center;
}

.kort h2 {
  font-size: 2rem;
  margin-bottom: 0.6rem;
}

.forklaring {
  font-size: 1.05rem;
  margin-bottom: 1.2rem;
  line-height: 1.5;
}

.stor-knapp {
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: bold;
  color: #fff;
  background: var(--oransje);
  border: 5px solid var(--kant);
  border-radius: 999px;
  padding: 0.8rem 1.6rem;
  cursor: pointer;
  box-shadow: 0 6px 0 #b34c00;
  transition: transform 0.1s, box-shadow 0.1s;
  touch-action: manipulation;
}

.stor-knapp:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 #b34c00;
}

#fallback-tekst {
  margin-top: 1.2rem;
  font-size: 1.2rem;
  font-weight: bold;
  line-height: 1.5;
  min-height: 2rem;
}

/* Mindre bevegelse for de som har bedt om det */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
