* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #8fd3ff;
  font-family: 'Fredoka', 'Arial Rounded MT Bold', 'Trebuchet MS', sans-serif;
  color: #2b2240;
  user-select: none;
}

#game, #game canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

[hidden] { display: none !important; }

.overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(40, 30, 70, 0.45);
  z-index: 20;
  padding: 16px;
}

.panel {
  background: #fffaf2;
  border: 4px solid #2b2240;
  border-radius: 22px;
  box-shadow: 0 8px 0 #2b2240;
  padding: 22px 28px;
  text-align: center;
  max-width: 760px;
  max-height: 100%;
  overflow-y: auto;
}

h1 { font-size: 56px; margin: 0; color: #ff5fa2; text-shadow: 3px 3px 0 #2b2240; letter-spacing: 1px; }
h2 { margin: 0 0 14px; font-size: 32px; }
.subtitle { margin: 4px 0 14px; font-size: 20px; }

.start-grid { display: flex; gap: 22px; align-items: center; justify-content: center; flex-wrap: wrap; }
.intro { font-size: 20px; line-height: 1.45; max-width: 520px; margin: 0 auto 18px; }
#start-step1 .name-label { max-width: 360px; margin: 0 auto; text-align: left; font-size: 22px; }
.name-label input::placeholder { color: #b9aec9; }
.name-label input.shake { animation: shake 0.3s 2; border-color: #e0344a; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}
#figure-title { color: #ff5fa2; text-shadow: 2px 2px 0 #2b2240; font-size: 36px; }
.start-buttons { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.big-btn.back-btn { background: #fff; color: #2b2240; text-shadow: none; }
.big-btn.back-btn:hover { background: #efe6ff; }

.preview-box {
  width: 240px; height: 300px; border-radius: 18px;
  background: linear-gradient(#bfe8ff, #9bdc7a);
  border: 3px solid #2b2240;
}
.options { text-align: left; min-width: 260px; }
.name-label { font-weight: 600; font-size: 18px; display: block; margin-bottom: 8px; }
.name-label input {
  display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 22px;
  padding: 6px 10px; border: 3px solid #2b2240; border-radius: 12px;
}
.opt-title { font-weight: 600; margin: 8px 0 4px; }
.swatches, .choices { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches button {
  width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff;
  box-shadow: 0 0 0 2px #2b2240; cursor: pointer;
  font-size: 18px; line-height: 1; padding: 0;
}
.swatches button.selected { box-shadow: 0 0 0 4px #ff5fa2; transform: scale(1.12); }
.choices button {
  font: inherit; font-size: 16px; padding: 4px 12px; border-radius: 12px;
  border: 3px solid #2b2240; background: #fff; cursor: pointer;
}
.choices button.selected { background: #ffd23f; }

.big-btn {
  font: inherit; font-size: 28px; font-weight: 700;
  margin-top: 16px; padding: 10px 40px;
  background: #57d163; color: #fff; text-shadow: 2px 2px 0 #2b2240;
  border: 4px solid #2b2240; border-radius: 18px; box-shadow: 0 6px 0 #2b2240;
  cursor: pointer;
}
.big-btn:hover { background: #45c252; }
.big-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #2b2240; }

.keys { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; font-size: 15px; }
.keys span { background: #efe6ff; padding: 3px 10px; border-radius: 10px; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

#quests {
  position: absolute; top: 12px; left: 12px;
  padding: 10px 14px; text-align: left; max-width: 300px;
  background: rgba(255, 250, 242, 0.92); border-width: 3px; box-shadow: 0 4px 0 #2b2240;
}
#quests { max-height: calc(100vh - 150px); overflow-y: auto; }
#quests h3 { margin: 0 0 4px; font-size: 20px; }

/* Skoleopgaver */
.quiz-panel { min-width: min(560px, 90vw); }
#quiz-progress { font-size: 26px; letter-spacing: 4px; }
#quiz-q { font-size: 30px; font-weight: 600; margin: 12px 0 4px; }
#quiz-big { font-size: 52px; line-height: 1.2; max-width: 520px; margin: 0 auto; word-break: break-all; }
#quiz-options { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
#quiz-options button {
  font: inherit; font-size: 32px; font-weight: 700; min-width: 110px; padding: 10px 20px;
  background: #fff; color: #2b2240; border: 4px solid #2b2240; border-radius: 18px;
  box-shadow: 0 5px 0 #2b2240; cursor: pointer;
}
#quiz-options button:hover:not(:disabled) { background: #ffd23f; }
#quiz-options button:disabled { color: #2b2240; cursor: default; }
#quiz-options button.right { background: #57d163; color: #fff; }
#quiz-options button.wrong { background: #ff8f8f; opacity: 0.6; }
#quiz-feedback { font-size: 24px; min-height: 32px; margin: 12px 0 0; }
.small-btn { font-size: 20px; padding: 6px 26px; }

/* Sove */
#sleep {
  position: fixed; inset: 0; z-index: 30; background: #0b1030; color: #fff; font-size: 40px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 1.2s;
}
#sleep.show { opacity: 1; pointer-events: auto; }
#quest-list { list-style: none; padding: 0; margin: 0; font-size: 15px; line-height: 1.45; }
#quest-list li.done { color: #3a9d44; text-decoration: line-through; }

#top-right {
  position: absolute; top: 12px; right: 12px;
  background: rgba(255, 250, 242, 0.9); border: 3px solid #2b2240; border-radius: 14px;
  padding: 6px 12px; font-size: 16px;
}

#crosshair {
  position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border: 3px solid rgba(255, 255, 255, 0.9); border-radius: 50%;
}

#toast {
  position: absolute; top: 70px; left: 50%; transform: translateX(-50%) scale(0.6);
  background: #ffd23f; border: 4px solid #2b2240; border-radius: 18px; box-shadow: 0 5px 0 #2b2240;
  padding: 8px 24px; font-size: 26px; font-weight: 700; opacity: 0;
  transition: opacity 0.3s, transform 0.3s; white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) scale(1); }

#hint {
  position: absolute; bottom: 120px; left: 50%; transform: translateX(-50%);
  background: rgba(43, 34, 64, 0.8); color: #fff; padding: 6px 16px; border-radius: 14px;
  font-size: 20px; white-space: nowrap;
}
#hint:empty { display: none; }

#message {
  position: absolute; bottom: 170px; left: 50%; transform: translateX(-50%);
  background: #fffaf2; border: 3px solid #2b2240; border-radius: 16px;
  padding: 8px 18px; font-size: 22px; max-width: min(90vw, 700px); text-align: center;
  opacity: 0; transition: opacity 0.25s;
}
#message.show { opacity: 1; }

#hotbar { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.slot {
  width: 78px; height: 84px; background: rgba(255, 250, 242, 0.9);
  border: 4px solid #2b2240; border-radius: 16px; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.slot .icon { font-size: 34px; line-height: 1; }
.slot .name { font-size: 12px; margin-top: 2px; }
.slot .num { position: absolute; top: 1px; left: 6px; font-size: 13px; font-weight: 700; }
.slot.selected { background: #ffd23f; transform: translateY(-8px); box-shadow: 0 6px 0 #2b2240; }

#bag-items {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px;
  min-width: min(560px, 80vw); margin: 10px 0;
}
.bag-item { background: #efe6ff; border: 3px solid #2b2240; border-radius: 14px; padding: 8px; }
.bag-item .icon { font-size: 36px; }
.bag-item .count { font-size: 22px; font-weight: 700; }
.bag-empty { grid-column: 1 / -1; font-size: 20px; }
