:root {
  --red: #c62828;
  --red-dark: #8e1b1b;
  --green: #1b7a3e;
  --green-dark: #0b3d24;
  --gold: #f4c542;
  --cream: #fff8e7;
  --blue: #1f6fb2;
  --card: rgba(255, 255, 255, 0.10);
  --card-border: rgba(255, 255, 255, 0.22);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--cream);
  background:
    radial-gradient(ellipse at top, rgba(244, 197, 66, 0.18), transparent 60%),
    radial-gradient(ellipse at bottom left, rgba(198, 40, 40, 0.35), transparent 55%),
    linear-gradient(160deg, #0f4d2d 0%, #0b3d24 45%, #072818 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}
a { color: var(--gold); }

/* ---------- Sne og lys ---------- */
#snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.flake {
  position: absolute; top: -30px; color: #fff;
  animation-name: fall, sway; animation-timing-function: linear, ease-in-out;
  animation-iteration-count: infinite, infinite; animation-direction: normal, alternate;
}
@keyframes fall { to { transform: translateY(110vh); } }
@keyframes sway { from { margin-left: -15px; } to { margin-left: 15px; } }

#lights {
  position: fixed; top: 0; left: 0; right: 0; height: 34px; z-index: 2; pointer-events: none;
  display: flex; justify-content: space-around;
  border-top: 3px solid #1a1a1a;
}
.bulb {
  width: 14px; height: 22px; margin-top: 4px; border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  animation: glow 1.6s infinite alternate;
}
.bulb.b0 { background: #ff3b3b; color: #ff3b3b; }
.bulb.b1 { background: #ffd23b; color: #ffd23b; }
.bulb.b2 { background: #3bff7a; color: #3bff7a; }
.bulb.b3 { background: #3bb4ff; color: #3bb4ff; }
@keyframes glow { from { opacity: .35; box-shadow: none; } to { opacity: 1; box-shadow: 0 0 14px 4px currentColor; } }

main { position: relative; z-index: 1; }

/* ---------- Generelt ---------- */
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: 24px;
  padding: 28px; backdrop-filter: blur(6px); box-shadow: 0 20px 50px rgba(0,0,0,.35);
}
.card.narrow { width: 100%; max-width: 420px; text-align: center; }
.title {
  font-family: 'Mountains of Christmas', cursive; font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 4rem); margin: 0 0 8px; color: var(--gold);
  text-shadow: 0 3px 0 var(--red-dark), 0 6px 18px rgba(0,0,0,.5);
  letter-spacing: 1px;
}
.title.huge { font-size: clamp(3rem, 9vw, 7rem); }
h2 { margin: 0 0 12px; }
.muted { opacity: .75; }
.lead { font-size: 1.3rem; margin: 4px 0 12px; }
.error { background: rgba(198,40,40,.85); padding: 10px 14px; border-radius: 12px; margin: 12px 0 0; }
.big-emoji { font-size: 4rem; line-height: 1; margin-bottom: 8px; }
.bounce { animation: bounce 1.2s infinite; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
.badge {
  display: inline-block; background: var(--gold); color: var(--green-dark); font-weight: 900;
  padding: 3px 12px; border-radius: 999px; font-size: .8rem; letter-spacing: 2px; margin-bottom: 12px;
}
.pill {
  display: inline-block; padding: 6px 14px; border-radius: 999px; background: rgba(0,0,0,.25);
  border: 1px solid var(--card-border); font-weight: 700;
}

.stack { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
input {
  font: inherit; font-size: 1.2rem; padding: 14px 16px; border-radius: 14px; border: 2px solid transparent;
  background: var(--cream); color: #222; text-align: center; outline: none;
}
input:focus { border-color: var(--gold); }
.code-input { text-transform: uppercase; letter-spacing: 8px; font-weight: 900; }

.btn {
  font: inherit; font-weight: 900; font-size: 1.1rem; border: 0; cursor: pointer; color: #fff;
  padding: 14px 26px; border-radius: 14px; text-decoration: none; display: inline-block;
  box-shadow: 0 5px 0 rgba(0,0,0,.3); transition: transform .08s, filter .15s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.3); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-red { background: linear-gradient(var(--red), var(--red-dark)); }
.btn-green { background: linear-gradient(#24a052, var(--green)); }
.btn-ghost { background: rgba(255,255,255,.15); border: 1px solid var(--card-border); box-shadow: none; }
.btn-big { font-size: 1.4rem; padding: 18px 32px; }
.btn-link { background: none; border: 0; color: var(--cream); opacity: .7; text-decoration: underline; cursor: pointer; font: inherit; }

/* ---------- Vært: lobby ---------- */
.host-app { min-height: 100vh; padding: 56px 32px 32px; }
.lobby { display: grid; grid-template-columns: minmax(340px, 1fr) 1.3fr; gap: 32px; max-width: 1400px; margin: 0 auto; align-items: stretch; }
.join-card { text-align: center; }
.qr { background: #fff; padding: 16px; border-radius: 20px; display: inline-block; border: 6px solid var(--red); box-shadow: 0 0 0 6px var(--gold); }
.qr img, .qr canvas { display: block; width: min(320px, 28vw); height: auto; }
.room-code {
  font-size: 4rem; font-weight: 900; letter-spacing: 14px; color: var(--gold);
  background: rgba(0,0,0,.3); border-radius: 18px; padding: 6px 10px 6px 24px; display: inline-block; margin-top: 6px;
}
.room-code.small { font-size: 2rem; letter-spacing: 8px; padding: 4px 6px 4px 14px; }
.players-card { display: flex; flex-direction: column; }
.players-card h2 { font-size: 2rem; }
.chips { flex: 1; display: flex; flex-wrap: wrap; gap: 12px; align-content: flex-start; min-height: 200px; }
.chip {
  font: inherit; font-weight: 900; font-size: 1.4rem; color: #fff; cursor: pointer;
  background: linear-gradient(var(--red), var(--red-dark)); border: 2px solid var(--gold);
  padding: 8px 18px; border-radius: 999px; animation: pop .35s ease-out;
}
.chip:nth-child(3n+2) { background: linear-gradient(#24a052, var(--green)); }
.chip:nth-child(3n) { background: linear-gradient(#2a83cf, var(--blue)); }
.chip:hover { text-decoration: line-through; }
@keyframes pop { from { transform: scale(0); } 70% { transform: scale(1.15); } to { transform: scale(1); } }
.cats { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; }

/* ---------- Vært: kategori ---------- */
.category-intro { text-align: center; animation: zoomIn .6s ease-out; }
.cat-num { font-size: 1.6rem; font-weight: 900; text-transform: uppercase; letter-spacing: 4px; opacity: .8; }
.cat-icon { font-size: 8rem; line-height: 1.1; animation: bounce 1.4s infinite; }
@keyframes zoomIn { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Vært: spørgsmål ---------- */
.question-screen { max-width: 1400px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; min-height: calc(100vh - 88px); }
.q-header { display: flex; justify-content: space-between; font-size: 1.3rem; }
.question-text {
  text-align: center; font-size: clamp(2rem, 4.2vw, 3.6rem); line-height: 1.2; margin: 10px 0;
  background: var(--cream); color: var(--green-dark); padding: 28px 36px; border-radius: 24px;
  box-shadow: 0 10px 0 var(--red-dark), 0 20px 40px rgba(0,0,0,.4);
}
.q-middle { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.q-status { text-align: right; font-size: 1.6rem; font-weight: 900; display: flex; flex-direction: column; gap: 12px; align-items: flex-end; }
.timer {
  --p: 1; width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--gold) calc(var(--p) * 360deg), rgba(255,255,255,.12) 0);
  position: relative;
}
.timer::before { content: ''; position: absolute; inset: 12px; border-radius: 50%; background: var(--green-dark); }
.timer span { position: relative; font-size: 3.6rem; font-weight: 900; }
.timer.urgent { background: conic-gradient(#ff4d4d calc(var(--p) * 360deg), rgba(255,255,255,.12) 0); animation: pulse .5s infinite alternate; }
@keyframes pulse { to { transform: scale(1.06); } }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.option {
  position: relative; display: flex; align-items: center; gap: 18px; padding: 26px 28px; border-radius: 20px;
  font-size: clamp(1.4rem, 2.6vw, 2.2rem); font-weight: 900; color: #fff; overflow: hidden;
  box-shadow: 0 6px 0 rgba(0,0,0,.3); transition: opacity .4s, transform .4s;
}
.opt-icon { font-size: 1.3em; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
.opt-text { flex: 1; position: relative; z-index: 1; }
.opt-0 { background: linear-gradient(135deg, #d93636, var(--red-dark)); }
.opt-1 { background: linear-gradient(135deg, #e0a91b, #a87700); }
.opt-2 { background: linear-gradient(135deg, #24a052, #0f5c2c); }
.opt-3 { background: linear-gradient(135deg, #2a83cf, #164e80); }
.option.wrong { opacity: .3; transform: scale(.96); }
.option.correct { transform: scale(1.03); box-shadow: 0 0 0 6px var(--gold), 0 0 40px var(--gold); }
.check { font-size: 1.5em; position: relative; z-index: 1; }
.dist { position: absolute; inset: auto 0 0 0; height: 8px; background: rgba(0,0,0,.25); }
.dist-bar { height: 100%; background: rgba(255,255,255,.85); transition: width .8s ease-out; }
.dist b { position: absolute; right: 16px; bottom: 12px; font-size: 1.4rem; background: rgba(0,0,0,.35); padding: 0 10px; border-radius: 10px; }
.actions { display: flex; justify-content: center; margin-top: 12px; }

/* ---------- Vært: stilling ---------- */
.scores-screen, .finished-screen { max-width: 900px; margin: 0 auto; text-align: center; }
.leaderboard { list-style: none; padding: 0; margin: 20px 0; text-align: left; }
.leaderboard li {
  display: flex; align-items: center; gap: 16px; padding: 14px 22px; margin-bottom: 10px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--card-border); font-size: 1.6rem; font-weight: 900;
  animation: slideIn .4s ease-out backwards;
}
.leaderboard li:nth-child(2) { animation-delay: .05s; } .leaderboard li:nth-child(3) { animation-delay: .1s; }
.leaderboard li:nth-child(4) { animation-delay: .15s; } .leaderboard li:nth-child(5) { animation-delay: .2s; }
.leaderboard li.top { background: linear-gradient(90deg, rgba(244,197,66,.35), rgba(244,197,66,.08)); border-color: var(--gold); }
.leaderboard .rank { width: 50px; text-align: center; }
.leaderboard .name { flex: 1; }
.leaderboard .gained { color: #7dff9e; font-size: 1.2rem; }
.leaderboard .score { color: var(--gold); min-width: 80px; text-align: right; }
@keyframes slideIn { from { transform: translateX(-40px); opacity: 0; } to { transform: none; opacity: 1; } }

.podium { display: flex; justify-content: center; align-items: flex-end; gap: 16px; margin: 30px 0; }
.podium-place { width: 220px; text-align: center; animation: zoomIn .8s ease-out backwards; }
.podium-place.first { animation-delay: 1.2s; } .podium-place.second { animation-delay: .6s; } .podium-place.third { animation-delay: .2s; }
.pod-name { font-size: 1.8rem; font-weight: 900; }
.pod-score { color: var(--gold); font-weight: 700; margin-bottom: 8px; }
.pod-block { font-size: 3.5rem; border-radius: 16px 16px 0 0; display: grid; place-items: center; box-shadow: inset 0 -8px 0 rgba(0,0,0,.2); }
.first .pod-block { height: 220px; background: linear-gradient(var(--gold), #b8891a); }
.second .pod-block { height: 160px; background: linear-gradient(#e0e0e0, #9a9a9a); }
.third .pod-block { height: 110px; background: linear-gradient(#d88a4a, #9a5a24); }

/* ---------- Spiller (telefon) ---------- */
.player-app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.p-top {
  display: flex; justify-content: space-between; padding: 12px 16px; font-weight: 900;
  background: rgba(0,0,0,.3); border-bottom: 2px solid var(--red);
}
.p-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px 20px; }
.p-center .cat-icon { font-size: 6rem; }
.p-question { flex: 1; display: flex; flex-direction: column; padding: 12px 12px 16px; gap: 10px; }
.ptimer { height: 10px; background: rgba(255,255,255,.15); border-radius: 999px; overflow: hidden; }
#pbar { height: 100%; width: 100%; background: var(--gold); border-radius: 999px; }
#pbar.urgent { background: #ff4d4d; }
.p-qmeta { margin: 4px 0 0; opacity: .8; font-weight: 700; text-align: center; }
.p-qtext { text-align: center; font-size: 1.25rem; margin: 0 0 6px; }
.answer-grid { flex: 1; display: grid; grid-template-rows: repeat(4, 1fr); gap: 10px; }
.answer-btn {
  font: inherit; font-weight: 900; font-size: 1.25rem; color: #fff; border: 0; border-radius: 18px;
  display: flex; align-items: center; gap: 14px; padding: 12px 18px; text-align: left; min-height: 64px;
  box-shadow: 0 6px 0 rgba(0,0,0,.35); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.answer-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.35); }
.answer-btn:disabled { opacity: .35; }
.answer-btn.picked { opacity: 1; box-shadow: 0 0 0 4px var(--gold); }
.result.good { background: radial-gradient(circle, rgba(36,160,82,.55), transparent 70%); }
.result.bad { background: radial-gradient(circle, rgba(198,40,40,.55), transparent 70%); }
.points { font-size: 3rem; font-weight: 900; color: var(--gold); margin: 6px 0; }
.rank-line { font-size: 1.15rem; margin-top: 18px; background: rgba(0,0,0,.25); padding: 10px 16px; border-radius: 14px; }

/* ---------- Responsivt ---------- */
@media (max-width: 900px) {
  .host-app { padding: 48px 16px 16px; }
  .lobby { grid-template-columns: 1fr; }
  .qr img, .qr canvas { width: min(260px, 70vw); }
  .options { grid-template-columns: 1fr; }
  .podium-place { width: 30%; }
  .pod-name { font-size: 1.1rem; }
}
