* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, sans-serif;
  background: #1e293b;
  color: #f1f5f9;
  display: flex;
  justify-content: center;
  align-items: center;
}

main {
  display: flex;
  gap: 32px;
  padding: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------- Spillet ---------- */
#spilboks {
  position: relative;
  width: min(400px, 100vw - 32px);
  aspect-ratio: 2 / 3;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  cursor: pointer;
  touch-action: none; /* ingen zoom/scroll når man tapper på mobil */
}

#slut {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.75);
  border-radius: 12px;
  text-align: center;
}
#slut[hidden] { display: none; }
#slut h2 { margin: 0; font-size: 2rem; }
.stor-score { margin: 0; font-size: 1.3rem; }
.stor-score span { font-size: 2.5rem; font-weight: 800; color: #fbbf24; }

#gem-form { display: flex; gap: 6px; }
#gem-form[hidden] { display: none; }
#gem-besked { margin: 0; min-height: 1.2em; color: #a7f3d0; }

input, button {
  font: inherit;
  padding: 10px 14px;
  border-radius: 8px;
  border: none;
}
input { width: 150px; }
button { background: #fbbf24; color: #1e293b; font-weight: 700; cursor: pointer; }
button:hover { background: #f59e0b; }
button:disabled { opacity: 0.5; cursor: default; }
#igen { background: #38bdf8; }
#igen:hover { background: #0ea5e9; }

/* ---------- Highscore-listen ---------- */
aside { width: 240px; }
aside h1 { margin: 0 0 4px; color: #fbbf24; }
.hjælp { margin-top: 0; color: #94a3b8; font-size: 0.9rem; }
kbd {
  background: #334155;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.85em;
}

#highscores {
  padding-left: 1.6em;
  margin: 0;
}
#highscores li {
  padding: 6px 0;
  border-bottom: 1px solid #334155;
}
#highscores li span { float: right; font-weight: 700; color: #fbbf24; }
#highscores li.tom { list-style: none; margin-left: -1.6em; color: #94a3b8; }
#highscores li.ny { color: #a7f3d0; }

/* ---------- micro:bit ---------- */
.microbit {
  background: #334155;
  border-radius: 10px;
  padding: 12px;
  margin: 12px 0 20px;
  font-size: 0.9rem;
}
#microbit-knap { width: 100%; background: #34d399; }
#microbit-knap:hover { background: #10b981; }
#microbit-knap[hidden] { display: none; }
#microbit-status { margin: 8px 0 0; color: #cbd5e1; }
#microbit-status.forbundet { margin-top: 0; color: #a7f3d0; font-weight: 600; }
.microbit details { margin-top: 8px; color: #cbd5e1; }
.microbit summary { cursor: pointer; color: #f1f5f9; }
.microbit ol { padding-left: 1.2em; margin: 8px 0 0; }
.microbit li { margin-bottom: 4px; }
.microbit a { color: #7dd3fc; }
.microbit code { background: #1e293b; padding: 1px 4px; border-radius: 4px; }
#slut-årsag { margin: 0; color: #cbd5e1; }

/* ---------- Fuldskærm ---------- */
#fuldskærm {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 1.3rem;
  line-height: 1;
  background: rgba(15, 23, 42, 0.45);
  color: white;
}
#fuldskærm:hover { background: rgba(15, 23, 42, 0.7); }

#spilboks:fullscreen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  background: #0f172a;
}
#spilboks:fullscreen canvas,
#spilboks:fullscreen #slut { border-radius: 0; }
#spilboks:fullscreen #slut h2 { font-size: 3rem; }

#slut-top {
  margin: 6px 0 0;
  padding-left: 1.4em;
  text-align: left;
  color: #e2e8f0;
  font-size: 0.95rem;
}
#slut-top:empty { display: none; }
