:root {
  --bg: #0e0805;
  --bg-2: #1a100a;
  --card: #1f140c;
  --card-2: #2a1a0e;
  --line: rgba(255, 190, 130, 0.14);
  --line-2: rgba(255, 190, 130, 0.28);
  --text: #fcefe1;
  --muted: #c4a88d;
  --orange: #ff7a1a;
  --orange-2: #ffa23a;
  --gold: #ffd36a;
  --ok: #8be39a;
  --off: #ff8f7a;
  --danger: #ff5b4d;
  --ink: #2a1405;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--orange-2); }
img { max-width: 100%; }

.glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 520px at 50% -8%, rgba(255, 122, 26, 0.28), transparent 62%),
    radial-gradient(600px 400px at 100% 100%, rgba(255, 162, 58, 0.08), transparent 70%);
}
main, header { position: relative; z-index: 1; }
.wrap { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 16px 32px; }
.wrap.wide { max-width: 1100px; }
body.has-bar .wrap { padding-bottom: calc(130px + env(safe-area-inset-bottom)); }
h1, h2 { line-height: 1.1; margin: 0; }

.hero { text-align: center; padding: calc(28px + env(safe-area-inset-top)) 16px 8px; max-width: 640px; margin: 0 auto; }
.eyebrow { margin: 0 0 8px; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--orange-2); font-weight: 700; }
.hero h1, .waiting h1, .board h1, .qr-page h1 {
  font-size: clamp(30px, 8.5vw, 54px);
  font-weight: 850;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #fff3e3 0%, var(--gold) 55%, var(--orange) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lead { color: var(--muted); font-size: 17px; margin: 12px auto 0; max-width: 34em; }
.lead strong { color: var(--text); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.loading { text-align: center; color: var(--muted); padding: 40px 0; }

/* navn */
.field { display: block; margin: 18px 0 6px; }
.field-label { display: block; font-size: 14px; font-weight: 700; color: var(--muted); margin: 0 0 6px 4px; }
.field input {
  width: 100%;
  font: inherit;
  font-size: 18px;
  color: var(--text);
  background: var(--card);
  border: 1.5px solid var(--line-2);
  border-radius: 14px;
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input::placeholder { color: #8d7360; }
.field input:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(255, 122, 26, 0.18); }
.hint { color: var(--muted); font-size: 15px; margin: 14px 4px 10px; }

/* græskar-kort */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s, box-shadow 0.2s;
}
.card:active { transform: scale(0.98); }
.card:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.card.has { border-color: rgba(255, 122, 26, 0.75); box-shadow: 0 0 0 1px rgba(255, 122, 26, 0.4), 0 12px 30px rgba(255, 122, 26, 0.18); }
.card-img { display: block; aspect-ratio: 3 / 4; background: #000; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 46px;
  height: 46px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 24px;
  font-weight: 850;
  color: var(--ink);
  background: linear-gradient(180deg, var(--gold), var(--orange));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45), inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}
.badge.empty {
  color: var(--text);
  background: rgba(14, 8, 5, 0.6);
  border: 2px dashed rgba(255, 220, 190, 0.65);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  font-weight: 600;
  box-shadow: none;
}
.card-foot { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; padding: 10px 12px 12px; }
.card-no { font-weight: 800; font-size: 17px; }
.card-cta { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--orange-2); }
.card.has .card-cta { color: var(--gold); }
.card-label { flex: 1 1 100%; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* bundbjælke */
.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(20, 12, 7, 0.88);
  border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.bar-info { flex: 1; min-width: 0; }
.bar-title { display: block; font-size: 13px; color: var(--muted); font-weight: 700; margin-bottom: 5px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  min-width: 28px;
  height: 28px;
  padding: 0 4px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  font-weight: 800;
  font-size: 15px;
  background: var(--card-2);
  border: 1px solid var(--line-2);
}
.chips-done { color: var(--ok); font-weight: 800; font-size: 15px; }

/* knapper */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 800;
  font-size: 17px;
  border-radius: 14px;
  padding: 14px 20px;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.1s, opacity 0.15s, filter 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; filter: grayscale(0.4); }
.btn-primary { color: var(--ink); background: linear-gradient(180deg, var(--gold), var(--orange)); box-shadow: 0 6px 18px rgba(255, 122, 26, 0.35); }
.btn-ghost { color: var(--text); background: var(--card-2); border: 1px solid var(--line-2); }
.btn-danger { color: #fff; background: var(--danger); }
.btn-small { font-size: 15px; padding: 10px 14px; border-radius: 12px; }
.btn-tiny { font-size: 13px; padding: 6px 10px; border-radius: 9px; }
.icon-btn {
  flex: none;
  width: 40px;
  height: 40px;
  font: inherit;
  font-size: 18px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--card-2);
  color: var(--text);
  cursor: pointer;
}

/* point-vælger */
.sheet {
  padding: 0;
  border: 0;
  width: 100%;
  max-width: min(560px, 100vw);
  max-height: 94dvh;
  margin: auto auto 0;
  border-radius: 24px 24px 0 0;
  background: var(--bg-2);
  color: var(--text);
  overflow: auto;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6);
}
.sheet[open] { animation: sheet-up 0.22s ease-out; }
.sheet::backdrop { background: rgba(0, 0, 0, 0.62); }
@media (min-width: 720px) { .sheet { margin: auto; border-radius: 24px; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-photo { height: min(32dvh, 300px); background: #000; }
.sheet-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sheet-body { padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { font-size: 24px; font-weight: 850; }
.sheet-hint { color: var(--muted); font-size: 14px; margin: 6px 0 14px; }
.pts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 70px;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  border-radius: 16px;
  background: var(--card-2);
  border: 1.5px solid var(--line-2);
  transition: transform 0.1s, background 0.15s;
}
.pt:active { transform: scale(0.95); }
.pt-v { font-size: 28px; font-weight: 850; line-height: 1; }
.pt-sub { font-size: 12px; color: var(--muted); font-weight: 700; }
.pt.top .pt-v { color: var(--gold); }
.pt.taken { background: transparent; border-style: dashed; }
.pt.taken .pt-v { opacity: 0.55; }
.pt.sel { background: linear-gradient(180deg, var(--gold), var(--orange)); border-color: transparent; }
.pt.sel .pt-v, .pt.sel .pt-sub { color: var(--ink); opacity: 1; }
#sheetClear { margin-top: 14px; width: 100%; }

/* paneler og kvittering */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 18px 0; box-shadow: var(--shadow); }
.panel h2 { font-size: 20px; margin-bottom: 12px; }
.panel h2 small { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.done { text-align: center; }
.done-emoji { font-size: 54px; line-height: 1; margin-bottom: 8px; }
.done h2 { font-size: 28px; margin-bottom: 6px; }
.done .btn { margin-top: 6px; }
.mine { list-style: none; padding: 0; margin: 18px 0; text-align: left; display: grid; gap: 8px; }
.mine-row { display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px; background: var(--card-2); border-radius: 14px; border: 1px solid var(--line); }
.mine-row img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex: none; }
.mine-name { flex: 1; font-weight: 800; display: flex; flex-direction: column; min-width: 0; }
.mine-name small, .row-name small { font-weight: 600; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-pts { font-size: 22px; font-weight: 850; color: var(--gold); display: flex; align-items: baseline; gap: 4px; }
.mine-pts small, .row-pts small { font-size: 12px; color: var(--muted); font-weight: 700; }
.done-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.reveal-link {
  display: block;
  text-align: center;
  margin: 16px 0 0;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 211, 106, 0.12);
  border: 1px solid rgba(255, 211, 106, 0.4);
  color: var(--gold);
  font-weight: 800;
  text-decoration: none;
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  top: calc(14px + env(safe-area-inset-top));
  z-index: 50;
  transform: translate(-50%, -160%);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 14px;
  background: #2d1c10;
  border: 1px solid var(--line-2);
  color: var(--text);
  font-weight: 700;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); }
.toast.err { border-color: rgba(255, 91, 77, 0.6); background: #3a1511; }

/* resultat */
.waiting { text-align: center; padding: calc(40px + env(safe-area-inset-top)) 0 20px; }
.count-big { margin: 26px auto 4px; display: flex; flex-direction: column; align-items: center; }
.count-big span { font-size: clamp(64px, 16vw, 120px); font-weight: 900; line-height: 1; color: var(--gold); text-shadow: 0 0 40px rgba(255, 122, 26, 0.45); font-variant-numeric: tabular-nums; }
.count-big small { color: var(--muted); font-size: 18px; font-weight: 700; }
.qr-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 26px auto 0;
  padding: 18px 18px 14px;
  background: #fff;
  border-radius: 22px;
  color: #1d1008;
  box-shadow: 0 20px 60px rgba(255, 122, 26, 0.25);
}
.qr-card img { width: min(62vw, 260px); height: auto; display: block; }
.qr-card.big img { width: min(80vw, 420px); }
.qr-card figcaption { font-weight: 800; font-size: 16px; text-align: center; line-height: 1.3; }
.qr-card figcaption span { font-weight: 600; color: #6b4a33; font-size: 14px; }
.board { padding: calc(28px + env(safe-area-inset-top)) 0 20px; text-align: center; }
.board h1 { margin-bottom: 22px; }
.foot { margin-top: 18px; font-size: 14px; }
.rows { list-style: none; padding: 0; margin: 0 auto; display: grid; gap: 10px; max-width: 760px; text-align: left; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.row.pending { opacity: 0; transform: translateY(14px) scale(0.98); }
.row.in { opacity: 1; transform: none; transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1.2); }
.row.winner { border-color: rgba(255, 211, 106, 0.8); background: linear-gradient(90deg, rgba(255, 211, 106, 0.16), rgba(255, 122, 26, 0.08)), var(--card); }
.row.winner.in { animation: winner-pop 0.7s ease-out; }
@keyframes winner-pop { 0% { transform: scale(0.94); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }
.row-rank { width: 36px; flex: none; text-align: center; font-size: 22px; font-weight: 850; color: var(--muted); }
.row-img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; flex: none; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.row-name { font-weight: 800; font-size: 17px; display: flex; flex-direction: column; min-width: 0; }
.row-track { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.row-fill { display: block; height: 100%; width: var(--w, 0%); border-radius: inherit; background: linear-gradient(90deg, var(--orange), var(--gold)); transition: width 0.8s ease; }
.row-pts { flex: none; font-size: 26px; font-weight: 900; color: var(--gold); display: flex; flex-direction: column; align-items: flex-end; line-height: 1; font-variant-numeric: tabular-nums; }
.row-pts small { margin-top: 4px; }
@media (min-width: 900px) {
  .page-results .row { padding: 14px 22px 14px 14px; }
  .page-results .row-img { width: 76px; height: 76px; }
  .page-results .row-name { font-size: 22px; }
  .page-results .row-pts { font-size: 36px; }
}
.rows.compact .row { box-shadow: none; padding: 8px 12px 8px 8px; }
.rows.compact .row-img { width: 42px; height: 42px; }
.rows.compact .row-pts { font-size: 20px; }

/* konfetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.cf { position: absolute; top: -20px; left: var(--x); width: 9px; height: 14px; border-radius: 2px; background: var(--c); animation: fall var(--t) linear var(--d) forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(var(--r)); opacity: 0.9; } }

/* admin */
.admin-head { padding: calc(24px + env(safe-area-inset-top)) 0 0; }
.admin-head h1 { font-size: 32px; }
.status { display: grid; gap: 16px; }
.stat { display: flex; align-items: baseline; gap: 8px; }
.stat-num { font-size: 44px; font-weight: 900; color: var(--gold); line-height: 1; }
.stat-label { color: var(--muted); font-weight: 700; }
.toggles { display: grid; gap: 10px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--line); }
.ok { color: var(--ok); }
.off { color: var(--off); }
.links { display: flex; gap: 16px; flex-wrap: wrap; }
.links a { font-weight: 700; }
.labels { display: grid; gap: 8px; }
.label-row { display: flex; align-items: center; gap: 10px; }
.label-row img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; flex: none; }
.label-no { width: 50px; font-weight: 800; flex: none; }
.label-row input { flex: 1; min-width: 0; font: inherit; font-size: 16px; color: var(--text); background: var(--card-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; }
.labels .btn { justify-self: start; margin-top: 6px; }
.voters { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.voters li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--card-2); border-radius: 12px; }
.voter-name { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.danger { border-color: rgba(255, 91, 77, 0.35); }

/* QR-side */
.qr-page { text-align: center; padding: 40px 16px; }
@media print {
  body { background: #fff; color: #000; }
  .glow { display: none; }
  .qr-page h1 { background: none; color: #000; -webkit-text-fill-color: #000; }
  .qr-card { box-shadow: none; }
  .lead, .eyebrow { color: #333; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .row.pending { opacity: 1; transform: none; }
}

/* Egon 30/10: live-stilling + QR på forsiden */
.live { margin: 34px 0 120px; text-align: center; }
.live h2 { margin: 0 0 4px; }
.live .rows { margin: 16px auto 24px; }
.live .qr-card { margin: 0 auto; }
#locked input { width: 100%; margin: 10px 0; padding: 12px; font-size: 16px; border-radius: 12px; border: 1px solid var(--line); }
