:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #1e2a24;
  --muted: #67736c;
  --accent: #1f3a2e;
  --accent-2: #c8503c;
  --line: #e3dfd5;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141a17;
    --card: #1d2621;
    --ink: #eef1ee;
    --muted: #9aa8a0;
    --accent: #7fc4a0;
    --accent-2: #e8806b;
    --line: #2d3932;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
.wrap { max-width: 680px; margin: 0 auto; padding: 16px; }
.wrap.wide { max-width: 980px; }
h1 { font-size: 1.5rem; margin: 8px 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
h3 { font-size: 1rem; margin: 16px 0 6px; }
.muted { color: var(--muted); font-size: .92rem; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 14px 0;
}
.card.locked { opacity: .65; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
input[type=text], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
}
textarea { min-height: 220px; resize: vertical; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1 1 auto; }
.row > .shrink { flex: 0 0 auto; }
button, .btn {
  font: inherit;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
@media (prefers-color-scheme: dark) { button, .btn { color: #0d1511; } }
button.secondary, .btn.secondary { background: transparent; color: var(--accent); border: 1px solid var(--line); }
button.danger { background: var(--accent-2); color: #fff; }
button.small { padding: 5px 10px; font-size: .85rem; }
button:disabled { opacity: .5; cursor: default; }
.error { color: var(--accent-2); font-weight: 600; margin-top: 8px; }
.ok { color: var(--accent); font-weight: 600; margin-top: 8px; }
.badge {
  display: inline-block;
  font-size: .78rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
}
@media (prefers-color-scheme: dark) { .badge { color: #0d1511; } }
.task { font-size: 1.2rem; font-weight: 600; margin: 6px 0 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-top: 10px; }
.grid figure { margin: 0; position: relative; }
.grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  background: var(--line);
  cursor: zoom-in;
}
.grid figcaption { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.grid figcaption.mine { color: var(--accent); font-weight: 700; }
.grid .x {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,.65); color: #fff;
  border-radius: 99px; width: 26px; height: 26px; padding: 0; line-height: 26px; text-align: center;
}
.countdown { font-variant-numeric: tabular-nums; font-weight: 700; }
.lightbox {
  position: fixed; inset: 0; background: #000; z-index: 50;
  overflow-y: auto; scroll-snap-type: y proximity;
}
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.invite { word-break: break-all; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; padding: 8px 10px; background: var(--bg); border-radius: 8px; border: 1px solid var(--line); }
.hidden { display: none !important; }

.facts { margin: .5rem 0 1rem; padding-left: 1.2rem; }
.facts li { margin: .25rem 0; }
.desc { white-space: pre-line; }
.wrap { position: relative; }
#title { padding-right: 6rem; }
.helpBtn {
  position: absolute; top: 12px; right: 16px; width: 2.5rem; height: 2.5rem; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: var(--accent); border: 1px solid var(--line); border-radius: 50%;
}
.helpBtn.hidden { display: none; }
.settingsBtn { right: calc(16px + 2.5rem + 8px); }

.modal {
  position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modalBox { background: var(--card); border-radius: 12px; padding: 16px; max-width: 480px; width: 100%; max-height: 100%; overflow: auto; }
.modalBox img { display: block; width: 100%; max-height: 50vh; object-fit: contain; border-radius: 8px; background: #eee; }
.pvQuestion { font-weight: 600; }
.modalBtns { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Billede i fuld skærm; scroll ned for at se kommentarerne */
.lbHero {
  position: relative; height: 100vh; height: 100dvh; scroll-snap-align: start;
  display: flex; align-items: center; justify-content: center;
}
.lbHero img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lbClose {
  position: fixed; top: 12px; right: 12px; z-index: 2; width: 2.5rem; height: 2.5rem; padding: 0;
  border-radius: 50%; font-size: 1.5rem; line-height: 1; background: rgba(0,0,0,.6); color: #fff; border: 1px solid rgba(255,255,255,.4);
}
.lbMore {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 1;
  background: rgba(0,0,0,.6); color: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: 999px; padding: .5rem 1rem;
}
.lbInfo {
  scroll-snap-align: start; background: var(--card); min-height: 70vh;
  padding: 16px; box-sizing: border-box; max-width: 680px; margin: 0 auto;
}
.comments { list-style: none; padding: 0; margin: .5rem 0; display: grid; gap: .5rem; }
.comments .muted { display: block; font-size: .8rem; }
.lbForm { display: flex; gap: .5rem; }
.lbForm input { flex: 1; min-width: 0; }
.grid .cap { font-size: .8rem; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lbCaption { margin: .25rem 0 .5rem; font-weight: 600; white-space: pre-line; overflow-wrap: anywhere; }

/* ---- Temaer: vælges pr. udfordring (data-theme på <html>, eller på en beholder i admin) ---- */
[data-theme="jul"] { --bg: #fdf1ee; --card: #ffffff; --ink: #2a1a18; --muted: #7a5f5b; --accent: #b3261e; --accent-2: #7f1710; --line: #f0cfc9; }
@media (prefers-color-scheme: dark) { [data-theme="jul"] { --bg: #1c0f0e; --card: #2a1613; --ink: #f7e9e6; --muted: #bf9f9a; --accent: #ff6b61; --accent-2: #ff9a92; --line: #4a2824; } }
[data-theme="jul"] #title::before { content: "🎄 "; }
[data-theme="jul"] h1 { color: var(--accent); }
/* lidt grønt som kontrast til det røde */
[data-theme="jul"] .card { border-top: 3px solid #2e7d4f; }
[data-theme="vinter"] { --bg: #eef4f9; --card: #ffffff; --ink: #14232f; --muted: #5b7080; --accent: #1d5f8a; --accent-2: #c8503c; --line: #d3e0ea; }
@media (prefers-color-scheme: dark) { [data-theme="vinter"] { --bg: #0e1822; --card: #15222e; --ink: #e9f1f7; --muted: #93a9ba; --accent: #8cc4ec; --accent-2: #e8806b; --line: #25384a; } }
[data-theme="vinter"] #title::before { content: "❄️ "; }
[data-theme="foraar"] { --bg: #f1f9e8; --card: #ffffff; --ink: #1f2a1c; --muted: #66795e; --accent: #2f8a34; --accent-2: #d9486b; --line: #d5e8c0; }
@media (prefers-color-scheme: dark) { [data-theme="foraar"] { --bg: #121b10; --card: #1b2718; --ink: #eef6e8; --muted: #9cb392; --accent: #8fd36b; --accent-2: #ff8aa6; --line: #2c3f26; } }
[data-theme="foraar"] #title::before { content: "🌷 "; }
[data-theme="paaske"] { --bg: #fff4bf; --card: #fffdf2; --ink: #2e2606; --muted: #7a6a2a; --accent: #c99700; --accent-2: #d1583c; --line: #f0d86a; }
@media (prefers-color-scheme: dark) { [data-theme="paaske"] { --bg: #231d05; --card: #31280a; --ink: #fff6d6; --muted: #cbb86a; --accent: #ffd54a; --accent-2: #ee8268; --line: #5a4a10; } }
[data-theme="paaske"] #title::before { content: "🐣 "; }
[data-theme="paaske"] h1 { color: #8a6100; }
@media (prefers-color-scheme: dark) { [data-theme="paaske"] h1 { color: var(--accent); } }
/* gul baggrund kræver mørk tekst på knapperne */
[data-theme="paaske"] button, [data-theme="paaske"] .btn { color: #2b2000; }
[data-theme="paaske"] button.secondary, [data-theme="paaske"] .btn.secondary { color: #8a6100; }
@media (prefers-color-scheme: dark) { [data-theme="paaske"] button.secondary, [data-theme="paaske"] .btn.secondary { color: var(--accent); } }
[data-theme="paaske"] button.danger { color: #fff; }
[data-theme="sommer"] { --bg: #fff9e8; --card: #ffffff; --ink: #1d2a29; --muted: #667371; --accent: #0b7a75; --accent-2: #d9534a; --line: #f0e3b8; }
@media (prefers-color-scheme: dark) { [data-theme="sommer"] { --bg: #0e1a19; --card: #142423; --ink: #e9f4f3; --muted: #92aaa8; --accent: #5fd1c9; --accent-2: #f08278; --line: #223a38; } }
[data-theme="sommer"] #title::before { content: "☀️ "; }
[data-theme="efteraar"] { --bg: #faf3e8; --card: #ffffff; --ink: #2b2118; --muted: #7a6a5a; --accent: #8a4b12; --accent-2: #b8321f; --line: #e8d8c0; }
@media (prefers-color-scheme: dark) { [data-theme="efteraar"] { --bg: #1b1510; --card: #261d16; --ink: #f3ebe1; --muted: #b3a190; --accent: #e5a15a; --accent-2: #ee7d68; --line: #3a2d22; } }
[data-theme="efteraar"] #title::before { content: "🍂 "; }
[data-theme="fest"] { --bg: #fff5f9; --card: #ffffff; --ink: #2b1a23; --muted: #7d6672; --accent: #c2185b; --accent-2: #7b1fa2; --line: #f3d3e1; }
@media (prefers-color-scheme: dark) { [data-theme="fest"] { --bg: #1c1218; --card: #281a22; --ink: #f8eef3; --muted: #b9a0ad; --accent: #ff8ab8; --accent-2: #d58cf0; --line: #412a37; } }
[data-theme="fest"] #title::before { content: "🎉 "; }
[data-theme="halloween"] { --bg: #1f0e02; --card: #2f1706; --ink: #ffeedd; --muted: #dba878; --accent: #ff7a00; --accent-2: #ff4d3d; --line: #6e3510; }
[data-theme="halloween"] #title::before { content: "🎃 "; }
[data-theme="halloween"] h1 { color: var(--accent); }
[data-theme="halloween"] .card { border-top: 3px solid var(--accent); }
[data-theme="halloween"] button, [data-theme="halloween"] .btn { color: #1a0a00; }
[data-theme="halloween"] button.secondary, [data-theme="halloween"] .btn.secondary { color: var(--accent); }
[data-theme="halloween"] button.danger { color: #fff; }

/* Bannerbillede øverst på deltagersiden (og som forhåndsvisning i admin) */
.banner { display: block; width: 100%; height: 140px; object-fit: cover; border-radius: var(--radius); }
.helpBtn { background: var(--card); }

.check { display: flex; align-items: center; gap: .6rem; font-weight: 400; margin: .5rem 0; }
.check input { width: 1.2rem; height: 1.2rem; flex: none; }

.toast {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 60;
  max-width: calc(100% - 32px); padding: .6rem 1rem; border-radius: 999px;
  background: var(--accent); color: #fff; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.3);
}
@media (prefers-color-scheme: dark) { .toast { color: #0d1511; } }

/* Fremhævet boks, fx "Installer appen og få push-beskeder" */
.promo { border: 2px solid var(--accent); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; background: var(--bg); }
.promo h2 { margin-top: 0; }
.promo p { margin-bottom: 0; }
