* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  background: radial-gradient(circle at top, #2b2140, #090612 70%);
  color: white;
  overflow: hidden;
}

#gameWrapper {
  width: 100vw;
  height: 100vh;
  position: relative;
}

/* SKÆRME */

.screen {
  display: none;
  width: 100%;
  height: 100%;
  padding: 24px;
  text-align: center;
}

.screen.active {
  display: block;
}

/* STARTSKÆRM */

#startScreen {
  overflow-y: auto;
}

h1 {
  font-size: 46px;
  margin: 10px 0;
  text-shadow: 0 0 18px gold;
}

h2 {
  margin-top: 22px;
}

.intro {
  max-width: 820px;
  margin: 0 auto 20px;
  font-size: 20px;
  line-height: 1.5;
}

/* KNAPPER */

button {
  border: none;
  padding: 14px 24px;
  border-radius: 16px;
  font-size: 18px;
  cursor: pointer;
  background: #f0c75e;
  color: #1a102b;
  font-weight: bold;
  box-shadow: 0 5px 0 #9c7a24;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
  margin: 6px;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #9c7a24;
  filter: brightness(1.08);
}

button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #9c7a24;
}

.secondaryBtn {
  background: linear-gradient(145deg, #47346b, #241637);
  color: white;
  box-shadow: 0 5px 0 #140c20;
  border: 2px solid rgba(240, 199, 94, 0.45);
}

/* HUSVALG */

.houseButtons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin: 18px 0 24px;
}

.houseBtn {
  color: white;
}

.gryffindor {
  background: #7f0909;
  box-shadow: 0 5px 0 #3c0505;
}

.ravenclaw {
  background: #0e1a40;
  box-shadow: 0 5px 0 #050a1b;
}

.hufflepuff {
  background: #ecb939;
  color: #1a1a1a;
  box-shadow: 0 5px 0 #9c761f;
}

.slytherin {
  background: #1a472a;
  box-shadow: 0 5px 0 #082113;
}

.houseBtn.selected,
.difficultyBtn.selected {
  outline: 4px solid white;
  transform: scale(1.05);
}

/* SVÆRHEDSGRAD */

.difficultyButtons {
  max-width: 980px;
  margin: 16px auto 26px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.difficultyBtn {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(145deg, #3c2a63, #1b1230);
  color: white;
  border: 2px solid rgba(240, 199, 94, 0.55);
  box-shadow: 0 5px 0 #130b22;
}

.difficultyBtn span {
  display: block;
  font-size: 14px;
  font-weight: normal;
  line-height: 1.35;
  color: #e7dcff;
}

/* FORKLARING AF SYMBOLER */

.instructionPanel {
  max-width: 1100px;
  margin: 20px auto 26px;
  padding: 22px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(240, 199, 94, 0.45);
  box-shadow: 0 0 24px rgba(240, 199, 94, 0.18);
}

.instructionPanel h2 {
  margin-top: 0;
  color: #ffe58a;
}

.instructionGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.instructionCard {
  min-height: 155px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.symbolBig {
  min-height: 42px;
  font-size: 28px;
  margin-bottom: 6px;
}

.instructionCard h3 {
  margin: 6px 0;
  color: #f0c75e;
  font-size: 18px;
}

.instructionCard p {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

/* FORTÆLLING FØR BANE */

#levelIntroScreen {
  background: radial-gradient(circle at center, #33245a, #090612 72%);
}

.storyBox {
  max-width: 720px;
  margin: 55px auto;
  padding: 34px;
  border-radius: 30px;
  background: rgba(0, 0, 0, 0.55);
  border: 3px solid rgba(240, 199, 94, 0.7);
  box-shadow: 0 0 34px rgba(240, 199, 94, 0.25);
}

.storyIcon {
  font-size: 76px;
  margin-bottom: 12px;
}

#levelIntroStory {
  font-size: 23px;
  line-height: 1.55;
  color: #f5ecff;
  margin: 20px auto 28px;
}

/* SPIL-LAYOUT */

#gameScreen {
  padding: 16px;
}

#gameLayout {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(650px, 1fr) 290px;
  gap: 16px;
  align-items: start;
}

#mainGameColumn {
  min-width: 0;
}

/* TOPMENU */

#topBar {
  min-height: 88px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.statBox {
  padding: 10px 8px;
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.35));
  border: 2px solid rgba(240, 199, 94, 0.65);
  box-shadow: 0 0 16px rgba(240, 199, 94, 0.18);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
}

.statLabel {
  font-size: 14px;
  color: #f0c75e;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.statValue {
  font-size: 23px;
  font-weight: bold;
  color: white;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.35);
}

.pauseBtn {
  min-height: 88px;
  padding: 10px 8px;
  border-radius: 22px;
  background: linear-gradient(145deg, #f0c75e, #b9902e);
  color: #1a102b;
  box-shadow: 0 5px 0 #755916;
  font-size: 19px;
  margin: 0;
}

/* BOSS-LIVBJÆLKE */

.bossHealthPanel {
  width: 100%;
  margin: 0 0 10px;
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.42);
  border: 2px solid rgba(255, 88, 88, 0.7);
  box-shadow: 0 0 18px rgba(255, 88, 88, 0.18);
}

.bossHealthTop {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #ffd1d1;
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 8px;
}

.bossHealthOuter {
  width: 100%;
  height: 22px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#bossHealthFill {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #32d46b, #ffd84a, #ff4b4b);
  box-shadow: 0 0 12px rgba(255, 87, 87, 0.45);
  transition: width 0.25s ease;
}

#messageBox {
  min-height: 44px;
  padding: 10px;
  margin-bottom: 10px;
  font-size: 20px;
  color: #ffe58a;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 18px;
}

/* SPILBANE */

#gameArea {
  position: relative;
  width: 100%;
  height: calc(100vh - 232px);
  min-height: 470px;
  max-height: 620px;
  overflow: hidden;
  border: 4px solid #f0c75e;
  border-radius: 24px;
  background:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px),
    radial-gradient(circle at center, #30305d, #151526 70%);
  background-size: 40px 40px, 40px 40px, cover;
  box-shadow: 0 0 30px rgba(240, 199, 94, 0.45);
}

#player {
  position: absolute;
  width: 42px;
  height: 42px;
  font-size: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: transform 0.1s;
}

/* PAUSE */

.pauseOverlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 3, 12, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.pauseBox {
  width: min(520px, 90vw);
  padding: 34px;
  border-radius: 30px;
  background: radial-gradient(circle at top, #3b2a67, #130b22 75%);
  border: 3px solid rgba(240, 199, 94, 0.75);
  box-shadow: 0 0 34px rgba(240, 199, 94, 0.28);
  text-align: center;
}

.pauseBox h1 {
  margin-top: 0;
}

.pauseBox p {
  font-size: 22px;
  color: #f5ecff;
}

/* LEVEL-OVERSIGT */

#levelProgressPanel {
  height: calc(100vh - 32px);
  padding: 18px;
  border-radius: 26px;
  background: rgba(0, 0, 0, 0.42);
  border: 3px solid rgba(240, 199, 94, 0.55);
  box-shadow: 0 0 24px rgba(240, 199, 94, 0.18);
  text-align: left;
}

#levelProgressPanel h2 {
  margin: 0 0 16px;
  text-align: center;
  color: #ffe58a;
}

.levelStep {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 10px;
  align-items: center;
  padding: 11px;
  margin-bottom: 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.07);
  border: 2px solid transparent;
  opacity: 0.55;
}

.levelStep.done {
  opacity: 0.9;
  border-color: rgba(106, 255, 138, 0.55);
  background: rgba(47, 147, 69, 0.18);
}

.levelStep.activeLevel {
  opacity: 1;
  border-color: #f0c75e;
  background: rgba(240, 199, 94, 0.18);
  box-shadow: 0 0 18px rgba(240, 199, 94, 0.25);
  transform: scale(1.02);
}

.levelIcon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 27px;
}

.levelStep h3 {
  margin: 0;
  font-size: 18px;
  color: white;
}

.levelStep p {
  margin: 3px 0 0;
  font-size: 14px;
  color: #ddd0ff;
}

#levelHint {
  margin-top: 16px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(240, 199, 94, 0.14);
  border: 1px solid rgba(240, 199, 94, 0.45);
  color: #ffe58a;
  font-size: 15px;
  line-height: 1.35;
  text-align: center;
}

/* SPIL-ELEMENTER */

.collectible,
.enemy,
.powerup,
.boss,
.spell,
.enemySpell,
.spark {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
}

.collectible {
  width: 34px;
  height: 34px;
  font-size: 28px;
  animation: float 1.2s infinite alternate;
}

.powerup {
  width: 36px;
  height: 36px;
  font-size: 30px;
  animation: pulse 0.8s infinite alternate;
}

.enemy {
  width: 44px;
  height: 44px;
  font-size: 34px;
  z-index: 4;
}

/* STØRRE FINALEMONSTER */

.boss {
  width: 130px;
  height: 130px;
  font-size: 108px;
  z-index: 4;
  animation: bossPulse 0.7s infinite alternate;
  filter: drop-shadow(0 0 18px rgba(255, 80, 80, 0.75));
}

.spell {
  width: 18px;
  height: 18px;
  background: #8af7ff;
  border-radius: 50%;
  box-shadow: 0 0 16px #8af7ff;
}

.enemySpell {
  width: 22px;
  height: 22px;
  background: #ff5757;
  border-radius: 50%;
  box-shadow: 0 0 18px #ff5757;
  z-index: 4;
}

.spark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: gold;
  box-shadow: 0 0 15px gold;
}

/* QUIZ */

.quizBox {
  max-width: 680px;
  margin: 80px auto;
  padding: 30px;
  border-radius: 26px;
  background: rgba(0, 0, 0, 0.68);
  border: 3px solid #f0c75e;
  box-shadow: 0 0 25px rgba(240, 199, 94, 0.4);
}

#quizLevelText {
  color: #ffe58a;
  font-size: 18px;
  margin-bottom: 18px;
}

#quizQuestion {
  font-size: 25px;
  line-height: 1.4;
}

#quizAnswers {
  display: grid;
  gap: 14px;
  margin-top: 25px;
}

#quizAnswers button {
  background: #47346b;
  color: white;
  box-shadow: 0 5px 0 #221633;
}

/* BANE KLARET */

#levelCompleteScreen {
  background: radial-gradient(circle at center, #3b2a67, #090612 70%);
}

.completeBox {
  max-width: 760px;
  margin: 42px auto;
  padding: 34px;
  border-radius: 32px;
  background: rgba(0, 0, 0, 0.56);
  border: 3px solid rgba(240, 199, 94, 0.75);
  box-shadow: 0 0 35px rgba(240, 199, 94, 0.25);
}

.completeImage {
  position: relative;
  height: 230px;
  margin-bottom: 18px;
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 55%, rgba(255, 226, 120, 0.35), transparent 30%),
    linear-gradient(145deg, rgba(79, 53, 134, 0.9), rgba(12, 8, 25, 0.95));
  border: 2px solid rgba(255, 255, 255, 0.16);
}

.magicCircle {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  width: 170px;
  height: 170px;
  border-radius: 50%;
  border: 5px dotted gold;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 58px;
  animation: spin 7s linear infinite;
  box-shadow: 0 0 35px rgba(255, 215, 0, 0.35);
}

.completeWizard {
  position: absolute;
  left: 50%;
  top: 54%;
  transform: translate(-50%, -50%);
  font-size: 86px;
  filter: drop-shadow(0 0 20px gold);
}

.completeSparkles {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 24px;
  font-size: 34px;
  animation: sparkleDance 1.2s infinite alternate;
}

#levelCompleteText {
  font-size: 22px;
  line-height: 1.45;
  color: #f5ecff;
}

/* SLUTSKÆRME */

#winScreen,
#gameOverScreen {
  background: radial-gradient(circle at center, #322252, #090612 70%);
}

#winScreen p,
#gameOverScreen p {
  font-size: 24px;
}

#fireworks {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.firework {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: gold;
  box-shadow: 0 0 18px gold;
  animation: explode 1s ease-out forwards;
}

.hidden {
  display: none;
}

/* ANIMATIONER */

@keyframes float {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-8px);
  }
}

@keyframes pulse {
  from {
    transform: scale(1);
    filter: brightness(1);
  }

  to {
    transform: scale(1.25);
    filter: brightness(1.5);
  }
}

@keyframes bossPulse {
  from {
    transform: scale(1);
  }

  to {
    transform: scale(1.07);
  }
}

@keyframes spin {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes sparkleDance {
  from {
    transform: scale(1);
    filter: brightness(1);
  }

  to {
    transform: scale(1.08);
    filter: brightness(1.5);
  }
}

@keyframes explode {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }

  100% {
    transform: translate(var(--x), var(--y)) scale(0);
    opacity: 0;
  }
}

/* MINDRE SKÆRME */

@media (max-width: 1250px) {
  #topBar {
    grid-template-columns: repeat(4, 1fr);
  }

  .pauseBtn {
    min-height: 76px;
  }

  #gameArea {
    height: calc(100vh - 300px);
  }
}

@media (max-width: 1150px) {
  #gameLayout {
    grid-template-columns: 1fr;
  }

  #levelProgressPanel {
    display: none;
  }

  .instructionGrid {
    grid-template-columns: repeat(2, 1fr);
  }

  .difficultyButtons {
    grid-template-columns: 1fr;
  }
}