:root {
  --blauw: #1d5aa8;
  --blauw-donker: #123c73;
  --creme: #fdf6e4;
  --creme-rand: #ead9b0;
  --hout: #3a2110;
  --goud: #f0b429;
  --tekst: #2b1a0c;
  --zacht: #7a6248;
  /* breedte van de "telefoon-kolom" waarin de achtergrond precies past */
  --kolom: min(100vw, max(56.3vh, 420px));
}

* { box-sizing: border-box; }

html { background: #1c0f06; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--tekst);
  -webkit-text-size-adjust: 100%;
}

/* Achtergrond: scherp in de kolom, wazig erachter op brede schermen */
.bg-wazig, .bg {
  position: fixed;
  top: 0;
  height: 100vh;
  background: url('achtergrond.jpg') center top / cover no-repeat;
  z-index: -1;
}
.bg-wazig { left: -40px; right: -40px; top: -40px; height: calc(100vh + 80px); filter: blur(28px) brightness(0.45); z-index: -2; }
.bg { left: 50%; width: var(--kolom); transform: translateX(-50%); }

main {
  width: var(--kolom);
  margin: 0 auto;
  /* ruimte vrijhouden voor het logo in de achtergrond */
  padding: max(calc(var(--kolom) * 0.36), 20vh) 16px 40px;
}

h1, h2, .kop { font-family: 'Rye', Georgia, serif; font-weight: 400; letter-spacing: 0.5px; }

h1 {
  margin: 0 0 4px;
  font-size: clamp(26px, calc(var(--kolom) * 0.082), 40px);
  text-align: center;
  color: #fff;
  text-shadow: 0 2px 0 var(--hout), 0 4px 14px rgba(0, 0, 0, 0.7);
}

.ondertitel {
  margin: 0 0 16px;
  text-align: center;
  color: #ffe9bd;
  font-weight: 700;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

.kaart {
  background: var(--creme);
  border: 2px solid var(--creme-rand);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.kaart h2 { margin: 0 0 10px; font-size: 19px; color: var(--blauw-donker); }

/* Wit-blauwe ruitjesrand boven een kaart */
.ruit { position: relative; overflow: hidden; padding-top: 26px; }
.ruit::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 12px;
  background: repeating-linear-gradient(135deg, var(--blauw) 0 10px, #fff 10px 20px);
}

/* Twee tegels: high score en eigen record */
.tegels { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.tegel {
  border-radius: 16px;
  padding: 12px 10px;
  text-align: center;
  color: #fff;
  background: linear-gradient(160deg, var(--blauw), var(--blauw-donker));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.35);
}
.tegel.goud { background: linear-gradient(160deg, #f6c445, #d98a0b); color: var(--hout); }
.tegel .label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; opacity: 0.9; }
.tegel .getal { font-family: 'Rye', Georgia, serif; font-size: 26px; white-space: nowrap; line-height: 1.15; }
.tegel .wie { font-size: 13px; font-weight: 700; min-height: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

label { display: block; font-weight: 800; font-size: 14px; margin: 0 0 6px; }

input[type='text'], input[type='number'] {
  width: 100%;
  font: inherit;
  font-size: 18px; /* ≥16px: voorkomt inzoomen op iPhone */
  font-weight: 700;
  padding: 13px 14px;
  border: 2px solid var(--creme-rand);
  border-radius: 12px;
  background: #fff;
  color: var(--tekst);
  outline: none;
}
input:focus { border-color: var(--blauw); box-shadow: 0 0 0 3px rgba(29, 90, 168, 0.2); }

.tijd-invoer { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--zacht); }
.tijd-invoer input { flex: 1; min-width: 0; text-align: center; }

.namen { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; max-height: 148px; overflow-y: auto; }
.naam-chip {
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid var(--creme-rand);
  background: #fff;
  color: var(--tekst);
  cursor: pointer;
}
.naam-chip.nieuw { border-style: dashed; border-color: var(--blauw); color: var(--blauw); }

.gekozen {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #e6effb;
  border: 2px solid #bcd3f2;
  font-weight: 800;
  font-size: 18px;
}
.link-knop { font: inherit; font-size: 14px; font-weight: 700; color: var(--blauw); background: none; border: 0; padding: 4px; text-decoration: underline; cursor: pointer; }

.knop {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 15px;
  font: inherit;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(180deg, #2a6fc7, var(--blauw-donker));
  border: 0;
  border-radius: 14px;
  box-shadow: 0 4px 0 #0b2748;
  cursor: pointer;
}
.knop:active { transform: translateY(2px); box-shadow: 0 2px 0 #0b2748; }
.knop:disabled { opacity: 0.45; box-shadow: none; cursor: default; }
.knop.licht { background: var(--creme); color: var(--blauw-donker); box-shadow: 0 4px 0 #b9a06a; }

.melding { margin-top: 12px; padding: 12px; border-radius: 12px; font-weight: 800; text-align: center; }
.melding.goed { background: #e3f4d7; color: #25601a; }
.melding.record { background: #fff0c2; color: #7a4b00; }
.melding.fout { background: #fbdcdc; color: #8a1c1c; }
[hidden] { display: none !important; }

/* Ranglijst */
.lijst { list-style: none; margin: 0; padding: 0; }
.lijst li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px dashed var(--creme-rand);
  font-weight: 700;
}
.lijst li:last-child { border-bottom: 0; }
.lijst .plek { width: 30px; flex: none; text-align: center; font-family: 'Rye', Georgia, serif; color: var(--zacht); }
.lijst li:nth-child(-n + 3) .plek { font-size: 20px; }
.lijst .wie { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lijst .score { font-family: 'Rye', Georgia, serif; color: var(--blauw-donker); white-space: nowrap; }
.lijst .score small { font-family: 'Nunito', system-ui, sans-serif; font-weight: 700; color: var(--zacht); }
.lijst li.ik { background: #e6effb; border-radius: 10px; }
.lijst .weg { border: 0; background: #fbdcdc; color: #8a1c1c; border-radius: 8px; font-weight: 800; padding: 4px 9px; cursor: pointer; }
.leeg { color: var(--zacht); font-weight: 700; text-align: center; padding: 8px 0; margin: 0; }

/* Tabs op het scoreboard */
.tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.tab {
  flex: none;
  font: inherit;
  font-weight: 800;
  font-size: 15px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  background: rgba(30, 15, 5, 0.65);
  color: #fff;
  cursor: pointer;
}
.tab.actief { background: var(--goud); border-color: var(--goud); color: var(--hout); }

/* Spellenoverzicht */
.spel-link { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.spel-link .icoon { font-size: 34px; }
.spel-link .titel { font-family: 'Rye', Georgia, serif; font-size: 19px; color: var(--blauw-donker); }
.spel-link .sub { font-size: 13px; font-weight: 700; color: var(--zacht); }
.spel-link .pijl { margin-left: auto; font-size: 22px; color: var(--blauw); }
.kaart.dicht { opacity: 0.7; }

.voet { text-align: center; margin-top: 6px; }
.voet a { color: #ffe9bd; font-weight: 800; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8); }

/* Scoreboard op een groot scherm (tv/beamer): alle spellen naast elkaar */
@media (min-width: 900px) {
  body.breed .bg { display: none; }
  body.breed .bg-wazig { filter: blur(10px) brightness(0.5); }
  body.breed main { width: min(1500px, 100vw); padding: 28px 28px 40px; }
  body.breed .logo { display: block; }
  body.breed h1 { font-size: 48px; }
  body.breed .tabs { display: none; }
  body.breed .borden { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 560px)); justify-content: center; gap: 18px; align-items: start; }
  body.breed .borden .kaart { display: block !important; }
  body.breed .lijst li { font-size: 19px; }
}
.logo { display: none; width: 120px; height: 120px; border-radius: 50%; margin: 0 auto 10px; box-shadow: 0 0 0 4px #fff, 0 8px 24px rgba(0, 0, 0, 0.6); }

/* Scoreboard op tv/beamer: alles op één scherm, maten schalen mee met het scherm */
body.tv-modus { overflow: hidden; }
body.tv-modus .bg { display: none; }
body.tv-modus .bg-wazig { filter: blur(7px) brightness(0.42); }
.tv { height: 100vh; padding: 2vh 1.6vw 1.6vh; display: flex; flex-direction: column; gap: 1.6vh; color: #fff; }
.tv-kop { display: flex; align-items: center; gap: 1.4vw; flex: none; }
.tv-kop img { width: 11vh; height: 11vh; border-radius: 50%; box-shadow: 0 0 0 0.4vh #fff, 0 0.6vh 2vh rgba(0, 0, 0, 0.6); }
.tv-titel { font-family: 'Rye', Georgia, serif; font-size: 6.4vh; line-height: 1; text-shadow: 0 0.3vh 0 var(--hout), 0 0.5vh 2vh rgba(0, 0, 0, 0.7); }
.tv-sub { font-size: 2.3vh; font-weight: 800; color: #ffe9bd; margin-top: 0.6vh; }
.tv-klok { margin-left: auto; font-family: 'Rye', Georgia, serif; font-size: 6vh; color: var(--goud); text-shadow: 0 0.3vh 0 var(--hout); }

.tv-borden { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(var(--aantal, 5), minmax(0, 1fr)); gap: 1vw; }
.bord {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: rgba(24, 12, 4, 0.8);
  border: 0.25vh solid rgba(240, 180, 41, 0.55);
  border-radius: 1.8vh;
  overflow: hidden;
  box-shadow: 0 1vh 3vh rgba(0, 0, 0, 0.5);
}
.bord-kop {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.7vw;
  padding: 2.6vh 0.9vw 1.2vh;
  min-height: 12.5vh;
  background: linear-gradient(180deg, var(--blauw), var(--blauw-donker));
  position: relative;
}
.bord-kop::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 1.3vh; background: repeating-linear-gradient(135deg, var(--blauw) 0 1.2vh, #fff 1.2vh 2.4vh); }
.bord-icoon { font-size: 4.4vh; line-height: 1; }
.bord-naam { font-family: 'Rye', Georgia, serif; font-size: min(2.7vh, 1.45vw); line-height: 1.1; }
.bord-regel { font-size: min(1.7vh, 0.95vw); font-weight: 700; color: #cfe1fa; margin-top: 0.3vh; }

.kampioen {
  flex: none;
  margin: 1.2vh 0.7vw 0.6vh;
  padding: 1vh 0.6vw 1.4vh;
  border-radius: 1.4vh;
  text-align: center;
  color: var(--hout);
  background: linear-gradient(160deg, #ffd766, #d98a0b);
  box-shadow: inset 0 0 0 0.25vh rgba(255, 255, 255, 0.45), 0 0.6vh 1.6vh rgba(0, 0, 0, 0.4);
}
.kampioen.leeg-bord { background: rgba(255, 255, 255, 0.08); color: #d9c7a3; box-shadow: inset 0 0 0 0.25vh rgba(255, 255, 255, 0.15); }
.kroon { font-size: 3.4vh; line-height: 1.1; }
.kampioen-naam { font-family: 'Rye', Georgia, serif; font-size: min(3.4vh, 1.8vw); line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kampioen-score { font-family: 'Rye', Georgia, serif; font-size: min(4.6vh, 2.4vw); line-height: 1.1; }
.kampioen-score small, .rijen small { font-family: 'Nunito', system-ui, sans-serif; font-weight: 800; font-size: 0.6em; opacity: 0.8; }

.rijen { flex: 1; min-height: 0; overflow: hidden; list-style: none; margin: 0; padding: 0 0.7vw; }
.rijen li { display: flex; align-items: center; gap: 0.5vw; height: 5.4vh; border-bottom: 0.15vh dashed rgba(255, 233, 189, 0.22); font-weight: 800; font-size: min(2.4vh, 1.25vw); }
.rijen .plek { flex: none; width: 1.9vw; text-align: center; font-family: 'Rye', Georgia, serif; color: #cbb68c; }
.rijen .wie { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rijen .score { font-family: 'Rye', Georgia, serif; color: var(--goud); white-space: nowrap; }

/* Nieuwe score: even laten oplichten */
@keyframes oplichten { 0%, 60% { box-shadow: 0 0 0 0.5vh #fff, 0 0 5vh 1vh rgba(255, 215, 102, 0.9); transform: scale(1.03); } 100% { transform: none; } }
@keyframes rij-oplichten { 0%, 60% { background: rgba(240, 180, 41, 0.45); } 100% { background: transparent; } }
.kampioen.nieuw { animation: oplichten 4s ease-out; }
.rijen li.nieuw { animation: rij-oplichten 4s ease-out; }

.tv-laatste { flex: none; display: flex; align-items: center; gap: 1.6vw; height: 5vh; padding: 0 1.2vw; border-radius: 1.4vh; background: rgba(24, 12, 4, 0.8); font-weight: 700; font-size: 2vh; white-space: nowrap; overflow: hidden; }
.tv-laatste b { color: var(--goud); font-family: 'Rye', Georgia, serif; font-weight: 400; }
.tv-laatste small { font-size: 0.8em; opacity: 0.75; }

/* QR-pagina */
.qr-raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.qr-kaart { text-align: center; break-inside: avoid; }
.qr-kaart svg, .qr-kaart img { width: 100%; max-width: 260px; height: auto; }
.qr-kaart .url { font-size: 12px; color: var(--zacht); word-break: break-all; }

@media print {
  .bg, .bg-wazig, .niet-printen { display: none !important; }
  html, body { background: #fff; }
  main { width: 100% !important; padding: 0 !important; }
  .kaart { box-shadow: none; }
  .qr-raster { grid-template-columns: 1fr 1fr; }
  .qr-kaart { page-break-inside: avoid; }
}
