:root {
  --red: #b51226; --red-dark: #8d0b1c; --pine: #14483a; --snow: #f4f8f8; --ice: #dce9ec; --line: #c5d6d8;
  --ink: #1d2b2a; --outline: #12163a; --muted: #566765; --gold: #f5c454; --win: #16794a; --cream: #fffaf0; --top: var(--red);
  --display: Caprasimo, Georgia, serif; --body: Figtree, system-ui, sans-serif; --r: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; background: var(--snow); color: var(--ink); font: 17px/1.4 var(--body); }
.is-over { --top: #25282c; }
.is-complete { --top: var(--pine); }
h1, h2, p, dl, dd, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
h1, h2 { font-family: var(--display); font-weight: 400; line-height: 1.08; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; box-shadow: 0 0 0 2px var(--ink); }
.btn { border: 0; border-radius: 999px; padding: 10px 18px; background: var(--red); color: #fff; font-weight: 700; white-space: nowrap; }
.btn:hover { background: var(--red-dark); }
.btn:disabled { opacity: .6; cursor: wait; }
.top .btn { background: var(--gold); color: var(--ink); }
.top .btn:hover { background: #ffd978; }
.demo-bar { background: var(--gold); padding: 5px 16px; text-align: center; font-size: .9rem; }

/* Header med lyskæde og snekant */
.top { display: flex; align-items: center; gap: 24px; padding: 18px 32px 12px; background: var(--top); color: #fff; }
.brand { margin-right: auto; text-decoration: none; }
h1 { display: grid; line-height: .98; letter-spacing: -.005em; }
h1 span { white-space: nowrap; font-size: 1.8rem; }
h1 span:last-child { font-size: 2.07rem; }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 9px 17px; border-radius: 999px; font-weight: 700; text-decoration: none; }
.tabs a:hover { background: #ffffff24; }
.tabs a[aria-current] { background: #fff; color: var(--red-dark); }
.lights { flex: none; height: 62px; overflow: hidden; margin-top: -1px; background: linear-gradient(var(--top) 56px, var(--snow) 56px); }
.lights svg { display: block; width: 100%; height: 62px; }
.blink { animation: blink 1.6s steps(1) infinite; }
@keyframes blink { 50% { opacity: .4; } }

main { flex: 1; display: flex; flex-direction: column; width: min(1500px, 100%); margin-inline: auto; padding: 2px 32px 24px; }
.notice { margin-bottom: 12px; padding: 8px 14px; border-radius: 8px; background: #fff1cc; }
.view { flex: 1; min-height: 0; }

/* Kalenderen: stansede låger i tegningen og enkelte farvede låger */
.calendar { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; }
.today-strip { display: none; }
.doors { display: grid; grid-template: repeat(4, minmax(0, 1fr)) / repeat(7, minmax(0, 1fr)); gap: 12px; min-height: 520px; padding: 16px; border-radius: var(--r); background: url(/scene-wide.svg) center / cover; }
.doors .d24 { grid-area: 2 / 4 / span 2 / span 2; }
.doors .d13 { grid-area: 4 / 1 / span 1 / span 2; }
.is-over .doors { filter: saturate(.3); }
.door { position: relative; display: block; width: 100%; height: 100%; padding: 0; border: 2px dashed #ffffffd9; border-radius: 8px; background: #12163a52; perspective: 1400px; }
.door:hover { background: #12163a80; }
.door-num { position: absolute; left: 12px; top: 8px; font: 400 2rem/1 var(--display); color: #fff; }
/* Mørk kant, så tallene kan læses oven på sne og huse */
.door-num { -webkit-text-stroke: 5px var(--outline); paint-order: stroke fill; }
.d24 .door-num { font-size: 4.2rem; }
li:is(.d7, .d5, .d9, .d17, .d23) .door:is(.closed, .open) { border: 0; background: var(--red); }
li:is(.d18, .d14, .d6, .d15) .door:is(.closed, .open) { border: 0; background: #c9dfe5; }
li:is(.d11, .d22, .d10) .door:is(.closed, .open) { border: 0; background: #fff; }
li:is(.d3, .d12, .d19) .door:is(.closed, .open) { border: 0; background: repeating-linear-gradient(135deg, var(--red) 0 12px, #c92a3d 12px 24px); }
li:is(.d7, .d5, .d9, .d17, .d23, .d18, .d14, .d6, .d15, .d11, .d22, .d10, .d3, .d12, .d19) .door:is(.closed, .open) .door-num { -webkit-text-stroke: 0; }
li:is(.d11, .d22, .d10) .door:is(.closed, .open) .door-num { color: var(--red); }
li:is(.d18, .d14, .d6, .d15) .door:is(.closed, .open) .door-num { color: var(--pine); }
li:is(.d7, .d5, .d9, .d17, .d23, .d18, .d14, .d6, .d15, .d11, .d22, .d10, .d3, .d12, .d19) .door:is(.closed, .open):hover { filter: brightness(1.1); }
.door .crest { position: absolute; right: 8px; bottom: 8px; }
.doors li .door.today { outline: 4px solid #fff; outline-offset: 1px; }
.doors li .door.today:focus-visible { outline-color: var(--ink); }
.door.won, .door.void, .door.lost { border: 0; background: #d9efe3; color: var(--pine); box-shadow: inset 8px 6px 12px #0d332940; }
.door.void { background: var(--ice); }
.door.lost { background: #17191d; color: #fff; }
.door:is(.won, .void, .lost) .door-num { left: 24px; -webkit-text-stroke: 0; color: inherit; font-size: 1.6rem; }
/* Gul = afventer, grøn = gået hjem. Farverne bruges ikke til andre låger. */
.tag { position: absolute; inset: auto 0 0; padding: 5px 4px; border-radius: 0 0 8px 8px; text-align: center; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.door:is(.won, .void, .lost) .tag { left: 12px; border-radius: 0 0 8px; }
.won .tag { background: var(--win); color: #fff; }
.lost .tag { background: #000; color: #fff; }
.void .tag { background: #b9ccd2; }
.door.pending { border: 0; background: #ffe39a; color: var(--ink); }
.door.pending:hover { background: #ffedbd; }
.door.pending .door-num { color: var(--ink); -webkit-text-stroke: 0; }
.door.pending .tag { background: var(--gold); border-top: 2px dashed #9a7418; }
.door:is(.pending, .won, .void, .lost) .crest { top: 8px; bottom: auto; }
.verdict { padding: 11px 14px; border-radius: 8px; font-size: 1.15rem; font-weight: 700; text-align: center; background: var(--ice); }
.verdict.pending { background: var(--gold); color: var(--ink); }
.verdict.won { background: var(--win); color: #fff; }
.verdict.lost { background: #17191d; color: #fff; }
.door:is(.won, .void, .lost)::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 75%; border-radius: 8px 3px 3px 8px; background: var(--red); transform-origin: left; transform: rotateY(-79deg); }
.door.cancelled { opacity: .5; }
.crest { flex: none; display: block; width: 32px; height: 32px; border-radius: 50%; overflow: hidden; background: #fff; }
.crest img, .crest svg { display: block; width: 100%; height: 100%; object-fit: cover; }
.crest img { transform: scale(2.5); transform-origin: 50% 25%; }
.crest .photo-feedbistrovenner { transform: scale(3.5); transform-origin: 34.5% 40%; }

/* Kuponen */
.side { display: flex; flex-direction: column; gap: 20px; }
.headline { font-size: 2.1rem; color: var(--red); }
.is-over .headline { color: var(--ink); }
.is-complete .headline { color: var(--pine); }
.slip { padding: 22px 22px 40px; background: #fff;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 14px), 93.75% 100%, 87.5% calc(100% - 14px), 81.25% 100%, 75% calc(100% - 14px), 68.75% 100%, 62.5% calc(100% - 14px), 56.25% 100%, 50% calc(100% - 14px), 43.75% 100%, 37.5% calc(100% - 14px), 31.25% 100%, 25% calc(100% - 14px), 18.75% 100%, 12.5% calc(100% - 14px), 6.25% 100%, 0 calc(100% - 14px)); }
/* Svag skygge uden om den takkede kant */
.side { filter: drop-shadow(0 1px 2px #14483a33); }
.slip .verdict { margin: -22px -22px 20px; padding: 14px; border-radius: 0; font-size: 1.25rem; }
.slip-date { color: var(--muted); }
.slip h2 { margin: 4px 0 14px; font-size: 1.7rem; overflow-wrap: anywhere; }
.match-note { margin: -4px 0 14px; color: var(--muted); }
.match-note p { font-weight: 600; color: var(--ink); }
.match-note small { font-size: .9rem; }
dialog .match-note { margin: 12px 0 0; }
.slip-team { display: flex; align-items: center; gap: 10px; font-weight: 700; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-variant-numeric: tabular-nums; }
dd { text-align: right; font-weight: 700; }
.slip dl { margin-top: 18px; padding-top: 14px; border-top: 2px dashed var(--line); }
.totals { align-items: baseline; padding-inline: 4px; }
.totals dd { white-space: nowrap; }
.totals dd:first-of-type { font: 400 1.75rem/1 var(--display); color: var(--red); }
.is-over .totals dd:first-of-type { color: var(--ink); }

/* Hold */
.teams { display: grid; grid-template-columns: minmax(330px, 1fr) minmax(0, min(62vh, 55vw)); gap: 36px; align-items: start; max-width: 1200px; width: 100%; margin-inline: auto; padding-top: 10px; }
.team { display: grid; grid-template-columns: 1fr auto; gap: 4px 18px; width: 100%; padding: 20px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; }
.team:hover { background: var(--ice); }
.team[aria-pressed=true] { background: var(--pine); color: #fff; border-color: transparent; border-radius: var(--r); }
.team strong { font: 400 1.65rem/1.1 var(--display); }
.score { grid-row: span 2; text-align: right; font: 400 1.65rem/1.1 var(--display); }
.score small { display: block; font: 500 .9rem var(--body); }
.members { font-weight: 700; }
.joke { grid-column: 1; }
.next-odds { text-align: right; white-space: nowrap; }
.poster { position: relative; aspect-ratio: 1; border-radius: var(--r); overflow: hidden; }
.poster img, .poster svg { display: block; width: 100%; height: 100%; object-fit: cover; }
.poster-sign { position: absolute; left: 0; right: 0; top: 0; padding: 14px; background: var(--red); color: #fff; text-align: center; font: 400 clamp(1.3rem, 2.6vw, 2.1rem)/1.1 var(--display); }

/* Penge */
.paper { background: #fff; padding: 18px 26px; border-radius: var(--r); }
.fine { margin-top: 12px; color: var(--muted); font-size: .95rem; }
.money { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; max-width: 1300px; width: 100%; margin-inline: auto; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 0 8px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--ice); }
th:first-child { padding-left: 0; text-align: left; }
thead th { color: var(--muted); font-weight: 600; }
tbody th, tfoot { font-weight: 700; }
tfoot th, tfoot td { border: 0; border-top: 2px solid var(--red); }
.hill { position: relative; min-height: 300px; border-radius: var(--r); background: var(--top); color: #fff; overflow: hidden; }
.hill svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hill p { position: absolute; right: 24px; top: 20px; text-align: right; font: 400 2.3rem/1.15 var(--display); }
.hill small { display: block; font: 600 1.05rem var(--body); }

/* Regler */
.rules-paper { max-width: 800px; margin: 8px auto 0; }
.rules li { position: relative; padding: 10px 0 10px 40px; border-bottom: 1px solid var(--ice); overflow-wrap: anywhere; }
.rules li::before { content: ""; position: absolute; left: 0; top: 10px; width: 23px; height: 23px; border: 2px solid var(--pine); border-radius: 4px; }
.rules li::after { content: ""; position: absolute; left: 8px; top: 8px; width: 8px; height: 16px; border: solid var(--red); border-width: 0 4px 4px 0; transform: rotate(42deg); }
.warnings { margin-top: 16px; padding: 10px 14px; border-radius: 8px; background: #fff1cc; }

/* Dialoger */
dialog { width: min(520px, 100% - 28px); max-height: calc(100dvh - 28px); overflow: auto; border: 0; border-top: 8px solid var(--red); border-radius: var(--r); padding: 26px; color: var(--ink); background: #fff; }
dialog::backdrop { background: #0d3329b8; }
dialog h2 { margin: 0 46px 8px 0; font-size: 1.8rem; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.close { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; font-size: 1.8rem; line-height: 1; }
.close:hover { background: var(--ice); }
.facts { margin: 18px 0; }
.facts dd { overflow-wrap: anywhere; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.fields label { display: grid; gap: 4px; min-width: 0; font-weight: 600; }
.fields .wide { grid-column: 1 / -1; }
.fields input, .fields select { width: 100%; min-height: 44px; padding: 8px 10px; border: 1.5px solid #8fa5a6; border-radius: 8px; background: #fff; }
.form-error { min-height: 1.4em; margin: 8px 0; color: var(--red-dark); font-weight: 700; }

@media (max-width: 1050px) {
  .top { gap: 12px; padding-inline: 18px; }
  main { padding-inline: 18px; }
  .tabs a { padding: 8px 11px; }
  h1 span { font-size: 1.305rem; } h1 span:last-child { font-size: 1.5rem; }
  .calendar { grid-template-columns: minmax(0, 1fr) 250px; gap: 18px; }
  .doors { gap: 8px; padding: 10px; }
  .door:is(.won, .void, .lost) .door-num { left: 17px; }
  .tag { font-size: .88rem; }
  .teams { grid-template-columns: minmax(280px, 1fr) minmax(0, 1fr); gap: 20px; }
}
@media (max-width: 800px) {
  .top { padding: 12px 14px 8px; }
  .lights { height: 54px; background: linear-gradient(var(--top) 49px, var(--snow) 49px); }
  .lights svg { margin-top: -6px; }
  main { padding: 0 12px calc(72px + env(safe-area-inset-bottom)); }
  .tabs { position: fixed; z-index: 5; inset: auto 0 0; gap: 0; padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); background: var(--top); }
  .tabs a { flex: 1; padding: 10px 2px; text-align: center; }
  .calendar { display: flex; flex-direction: column; gap: 8px; }
  .side { display: none; }
  .today-strip { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 8px 14px; border: 0; border-radius: 10px; background: #fff; text-align: left; }
  .today-strip span:last-child { text-align: right; }
  .today-strip small, .today-strip b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .today-strip small { font-size: .85rem; color: var(--muted); }
  .doors { flex: 1; min-height: 480px; grid-template: repeat(7, minmax(0, 1fr)) / repeat(4, minmax(0, 1fr)); gap: 7px; padding: 8px; background-image: url(/scene-tall.svg); }
  .doors .d24 { grid-area: 3 / 2 / span 2 / span 2; }
  .doors .d13 { grid-area: 7 / 3 / span 1 / span 2; }
  .door-num { font-size: 1.5rem; left: 8px; top: 6px; }
  .d24 .door-num { font-size: 3rem; }
  .door:is(.won, .void, .lost) .door-num { left: 15px; font-size: 1.2rem; }
  .tag { padding: 3px 1px; font-size: .78rem; }
  .door:is(.won, .void, .lost) .tag { left: 8px; }
  .today-strip .verdict { grid-column: 1 / -1; margin: -8px -14px 0; padding: 6px; border-radius: 10px 10px 0 0; font-size: 1rem; }
  .door .crest { width: 24px; height: 24px; right: 5px; bottom: 5px; }
  .door:is(.pending, .won, .void, .lost) .crest { width: 22px; height: 22px; top: 6px; }
  .teams, .money { display: flex; flex-direction: column; gap: 10px; padding-top: 0; }
  .teams { align-items: stretch; }
  .poster { order: -1; width: min(100%, 32dvh); margin-inline: auto; }
  .team { padding: 9px 14px; gap: 1px 12px; font-size: .95rem; }
  .team strong, .score { font-size: 1.25rem; }
  .paper { padding: 8px 14px; }
  .money .paper { flex: none; }
  th, td { padding: 4px 0 4px 8px; font-size: .9rem; }
  .fine { margin-top: 6px; font-size: .88rem; }
  .hill { flex: 1; min-height: 150px; }
  .hill p { font-size: 1.6rem; right: 16px; top: 10px; }
  .hill small { font-size: .95rem; }
  .rules-paper { margin-top: 0; }
  dialog { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) { .blink { animation: none; } }
