@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(assets/inter-latin-400-normal-C38fXH4l.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 500; font-display: swap; src: url(assets/inter-latin-500-normal-Cerq10X2.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url(assets/inter-latin-600-normal-LgqL8muc.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 700; font-display: swap; src: url(assets/inter-latin-700-normal-Yt3aPRUw.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 800; font-display: swap; src: url(assets/inter-latin-800-normal-BYj_oED-.woff2) format('woff2'); }

:root {
  --afas: #005FAA;
  --afas-2: #0074D0;
  --afas-light: #D7EAFF;
  --orange: #F59F39;
  --green: #22C55E;
  --red: #D2003A;
  --gold: #EAB308;
  --ink: #0B1B33;
  --muted: #5B7394;
  --brand-shadow: 0 5px 8px rgba(0, 96, 172, .2);
  /* Solid translucent fills instead of backdrop blur: keeps the animated snow cheap to render */
  --glass: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .07)), rgba(95, 0, 28, .44);
  --glass-border: rgba(255, 255, 255, .2);
  --pad: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: Inter, system-ui, sans-serif;
  color: #fff;
  background: #A8002E;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }

/* Background: AFAS pattern + snow */
.bg {
  position: fixed; inset: 0; z-index: -1;
  background: #BE0832 url(assets/afas-patroon-rood.svg) center / cover no-repeat;
}
.bg::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(80, 0, 20, 0) 30%, rgba(60, 0, 15, .5) 100%);
}
.drifts { position: fixed; left: 0; right: 0; bottom: 0; width: 100%; height: 150px; pointer-events: none; }
.snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.topbar, .layout { position: relative; }

/* Snow caps on cards and board */
.card::before, .board-frame::before {
  content: ''; position: absolute; pointer-events: none;
  background: url(assets/snowcap.svg) center / 100% 100% no-repeat;
  filter: drop-shadow(0 2px 2px rgba(90, 0, 25, .28));
}
.card::before { top: -10px; left: 14px; right: 14px; height: 22px; }
.board-frame::before { z-index: 1; top: -13px; left: 20px; right: 20px; height: 30px; background-image: url(assets/snowcap-wide.svg); }

/* Top bar */
.topbar {
  height: 92px; padding: 0 40px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 18px; }
.logo { height: 40px; display: block; }
.divider { width: 1px; height: 30px; background: rgba(255, 255, 255, .35); }
.title { font-size: 26px; letter-spacing: -.01em; }
.title strong { font-weight: 800; }
.title .light { font-weight: 400; opacity: .75; }
.xmas-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px 6px 9px; border-radius: 999px;
  background: #fff; color: var(--red);
  font-size: 13px; font-weight: 700;
  box-shadow: 0 5px 12px rgba(90, 0, 25, .3);
}
.xmas-pill svg { width: 16px; height: 16px; fill: none; stroke: var(--red); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.actions { display: flex; gap: 10px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; cursor: pointer;
  display: grid; place-items: center;
  background: var(--glass); border: 1px solid var(--glass-border);
  transition: background .2s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .22); }
.icon-btn svg { width: 22px; height: 22px; fill: currentColor; }
.icon-btn .ic-off { display: none; }
.icon-btn.muted .ic-on { display: none; }
.icon-btn.muted .ic-off { display: block; }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 280px auto 280px;
  grid-template-rows: minmax(0, 1fr);
  justify-content: center;
  gap: 40px;
  height: calc(100vh - 92px);
  padding: 0 40px 40px;
}
.panel { display: flex; flex-direction: column; justify-content: center; gap: 22px; min-height: 0; }
.stage { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; min-height: 0; }

/* Cards */
.card {
  position: relative;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 20px 22px;
  box-shadow: 0 12px 32px rgba(60, 0, 15, .3);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.label { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .75); }
.value { display: block; margin-top: 6px; font-size: 64px; font-weight: 800; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.value.sm { font-size: 34px; }
.score-card { background: #fff; border-color: #fff; color: var(--ink); box-shadow: var(--brand-shadow), 0 18px 40px rgba(60, 0, 15, .32); }
.score-card .label { color: var(--muted); }
.score-card .value { color: var(--afas-2); }
.score-card .value.bump { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.08); color: var(--orange); } }
.score-card .value.drop { animation: drop .5s ease; }
@keyframes drop {
  20%, 60% { transform: translateX(-6px); color: var(--red); }
  40%, 80% { transform: translateX(6px); color: var(--red); }
}
/* Score change next to the score: the card flashes red (competitor) or blue (AFAS gift) with a chip */
.score-card { position: relative; }
.score-card.hit { animation: hit-card .9s ease; }
.score-card.hit.good { animation-name: good-card; }
@keyframes hit-card { 15%, 50% { background: #FFE4EA; box-shadow: 0 0 0 4px var(--red), 0 18px 40px rgba(60, 0, 15, .32); } }
@keyframes good-card { 15%, 50% { background: #E3F0FF; box-shadow: 0 0 0 4px var(--afas-2), 0 18px 40px rgba(60, 0, 15, .32); } }
.score-delta {
  position: absolute; right: 18px; top: 50%; padding: 6px 12px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 26px; font-weight: 800; line-height: 1;
  opacity: 0; pointer-events: none;
}
.score-delta.good { background: var(--afas-2); }
.score-delta.hit { animation: delta 1.9s ease forwards; }
@keyframes delta {
  0% { opacity: 0; transform: translateY(-50%) scale(.5); }
  12% { opacity: 1; transform: translateY(-50%) scale(1.15); }
  22%, 70% { opacity: 1; transform: translateY(-50%) scale(1); }
  100% { opacity: 0; transform: translateY(10%) scale(1); }
}
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--orange); color: #fff; }

.modules { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.mod {
  position: relative; aspect-ratio: 1; border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .07); border: 1px dashed rgba(255, 255, 255, .24);
  transition: background .3s, transform .3s;
}
.mod img { width: 68%; height: 68%; object-fit: contain; filter: grayscale(1) brightness(1.6); opacity: .28; transition: all .3s; }
.mod.on { background: #fff; border: 1px solid #fff; box-shadow: var(--brand-shadow); }
.mod.on img { filter: none; opacity: 1; }
.mod.pop { animation: pop .4s ease; }
@keyframes pop { 50% { transform: scale(1.18); } }
.mod .cnt {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--orange); color: #fff;
  font-size: 10px; font-weight: 800; display: none; place-items: center;
}
.mod.on .cnt { display: grid; }

/* Board */
.board-frame {
  position: relative;
  width: min(calc(100vh - 140px), calc(100vw - 720px));
  aspect-ratio: 1;
  padding: var(--pad);
  border-radius: 30px;
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, .28);
  box-shadow: 0 30px 70px rgba(55, 0, 15, .45);
  touch-action: none;
  container-type: inline-size;
}
@container (max-width: 600px) {
  .badge { display: none; }
  .dialog { padding: 24px 24px 22px; }
  .dialog h1 { font-size: 32px; }
  .dialog p { margin: 8px 0 16px; font-size: 14px; }
  .prize { margin: 0 0 12px; font-size: 13px; }
  .legend { margin-bottom: 14px; }
  .final { margin-top: 10px; }
  .final-score { font-size: 56px; }
  .record-badge { margin-bottom: 8px; }
  .dialog p.season { display: none; }
}
.board-frame.shake { animation: shake .45s ease; }
@keyframes shake {
  15%, 55% { transform: translateX(-8px); }
  35%, 75% { transform: translateX(8px); }
}
canvas#board { display: block; width: 100%; height: 100%; border-radius: 18px; background: #F7FAFF; }

/* Christmas lights around the board */
.lights { position: absolute; inset: calc(var(--pad) / 2); z-index: 2; pointer-events: none; }
.lights i {
  position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: var(--c); box-shadow: 0 0 7px 2px var(--c);
  animation: twinkle 1.8s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .35; } to { opacity: 1; } }

/* Overlays */
.overlay {
  position: absolute; inset: var(--pad); z-index: 3; border-radius: 18px;
  display: flex; overflow-y: auto; padding: 12px;
  background: rgba(90, 0, 25, .38);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  transition: opacity .2s, visibility 0s;
}
.overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s, visibility 0s .2s; }
.dialog {
  width: min(420px, 92%);
  margin: auto;
  padding: 34px 36px 30px;
  border-radius: 24px;
  background: #fff; color: var(--ink);
  text-align: center;
  box-shadow: var(--brand-shadow), 0 30px 60px rgba(60, 0, 15, .35);
}
.overlay:not(.hidden) .dialog { animation: rise .3s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes rise { from { transform: translateY(16px) scale(.96); opacity: 0; } }
.badge { width: 76px; height: 76px; margin-bottom: 14px; }
.dialog h1 { font-size: 40px; font-weight: 800; color: var(--afas-2); letter-spacing: -.02em; line-height: 1.1; }
.dialog h1 span { font-weight: 400; color: var(--muted); }
.dialog p { margin: 12px 0 24px; font-size: 16px; line-height: 1.5; color: var(--muted); }
.dialog p.season { margin: 18px 0 0; font-size: 13px; font-weight: 700; color: var(--red); letter-spacing: .02em; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  border: 0; border-radius: 999px; padding: 14px 28px;
  font-size: 16px; font-weight: 700; cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-2px); }
.btn svg { width: 16px; height: 16px; fill: currentColor; }
.btn-primary { background: var(--orange); color: #fff; box-shadow: 0 8px 18px rgba(245, 159, 57, .45); }
.btn-ghost { background: var(--afas-light); color: var(--afas); }
.btn-row { display: flex; gap: 10px; justify-content: center; }
.hint { margin-top: 14px; font-size: 13px; color: var(--muted); }
.dialog kbd { background: var(--afas-light); color: var(--afas); border: 0; box-shadow: inset 0 -2px 0 rgba(0, 95, 170, .2); }
.final { margin-top: 18px; display: flex; flex-direction: column; align-items: center; }
.final-score { font-size: 76px; font-weight: 800; line-height: 1; color: var(--afas); letter-spacing: -.03em; }
.final-label { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-top: 4px; }
.dialog .final + p { margin-top: 14px; }
.record-badge {
  display: inline-block; margin-bottom: 14px; padding: 6px 14px; border-radius: 999px;
  background: rgba(34, 197, 94, .14); color: #15803d; font-size: 13px; font-weight: 700;
}
.record-badge.hidden { display: none; }

/* Leaderboard */
.leaderboard { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.leaderboard li {
  display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 12px; font-size: 15px;
}
.leaderboard .rank {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; background: rgba(255, 255, 255, .14);
}
.leaderboard li:first-child .rank { background: var(--orange); }
.leaderboard .pts { font-weight: 800; font-variant-numeric: tabular-nums; }
.leaderboard li.me { background: #fff; color: var(--ink); box-shadow: var(--brand-shadow); }
.leaderboard li.me .rank { background: var(--afas-2); color: #fff; }
.leaderboard li.me .pts { color: var(--afas-2); }
.leaderboard .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard li.empty { display: block; padding: 12px 10px; font-size: 14px; line-height: 1.4; color: rgba(255, 255, 255, .85); }
.leaderboard li.gap { display: block; padding: 0; height: 12px; line-height: 6px; text-align: center; color: rgba(255, 255, 255, .6); }
.leaderboard .tk { width: 16px; height: 16px; margin-left: 7px; vertical-align: -3px; color: var(--gold); }
.countdown {
  padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .16);
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.prize-line {
  display: flex; align-items: center; gap: 8px; margin: -2px 0 12px; padding: 9px 11px;
  border-radius: 12px; background: var(--gold); color: #5A3A00;
  font-size: 13px; font-weight: 700; line-height: 1.25;
}
.ticket { width: 20px; height: 20px; flex: none; }
.prize-line .ticket { color: #fff; }
.lb-foot { margin-top: 10px; font-size: 12px; color: rgba(255, 255, 255, .7); }

/* Module rarity */
.mod.rare { border-color: rgba(111, 179, 242, .75); }
.mod.legendary { border-color: rgba(234, 179, 8, .9); }
.mod.on.rare { box-shadow: 0 0 0 2px #0074D0, var(--brand-shadow); }
.mod.on.legendary {
  box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(234, 179, 8, .7);
  background: linear-gradient(120deg, #FFF7D1 30%, #FFFFFF 45%, #FDE68A 52%, #FFF7D1 65%) 0 0 / 300% 100%;
  animation: shimmer 2.4s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }
.mod.legendary::after {
  content: '★'; position: absolute; left: -6px; bottom: -6px; width: 17px; height: 17px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--gold); color: #fff; font-size: 10px; line-height: 1;
}
.rarity-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 14px; font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, .82); }
.rarity-legend span { display: inline-flex; align-items: center; gap: 5px; }
.rarity-legend span::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--dot); }
.r-common { --dot: #fff; }
.r-rare { --dot: #6FB3F2; }
.r-legendary { --dot: var(--gold); }

/* Start dialog: prize + legend */
.prize {
  display: flex; align-items: center; gap: 12px; margin: -6px 0 16px; padding: 11px 14px;
  border-radius: 14px; background: #FEF6DA; color: #6B4A00;
  font-size: 14px; line-height: 1.4; text-align: left;
}
.prize .ticket { width: 28px; height: 28px; color: var(--gold); }

/* Game over: name and winner code for the leaderboard */
.submit { display: flex; flex-direction: column; gap: 8px; margin: -6px 0 16px; text-align: left; }
.submit.hidden, .submit.done { display: none; }
.dialog .submit p { margin: 0; }
.dialog .submit .submit-intro { font-size: 14px; font-weight: 700; color: var(--afas); text-align: center; }
.submit-row { display: flex; gap: 8px; }
.submit input {
  flex: 1; width: 100%; min-width: 0; height: 46px; padding: 0 16px; border-radius: 999px;
  border: 2px solid var(--afas-light); outline: none;
  font: 500 15px Inter, sans-serif; color: var(--ink); background: #fff;
}
.submit input:focus { border-color: var(--afas-2); }
.submit input.fout { border-color: var(--red); }
.submit input.initiaal { flex: 0 0 92px; text-align: center; text-transform: uppercase; padding: 0 10px; }
.submit input.initiaal::placeholder { text-transform: none; }
.dialog .submit .name-preview { font-size: 13px; font-weight: 600; color: var(--muted); text-align: center; }
.dialog .submit .name-preview:empty { display: none; }

/* Winner code: the only way to claim a prize. Until the end date only a blurred placeholder is shown. */
.code-box {
  margin: -4px 0 16px; padding: 14px 16px; border-radius: 16px;
  background: #FEF6DA; border: 2px dashed var(--gold); text-align: center;
}
.code-box[hidden] { display: none; }
.code-title { display: block; font-size: 20px; font-weight: 800; line-height: 1.2; color: #6B4A00; }
.dialog .code-box p.code-come { margin: 4px 0 10px; font-size: 14px; color: #4A2F00; }
.code-label { font-size: 13px; font-weight: 600; color: #6B4A00; }
.code-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 12px; margin: 6px 0 8px; }
.code-box .code {
  font: 800 22px/1.2 Inter, sans-serif; letter-spacing: .03em; color: var(--ink); white-space: nowrap;
  font-variant-numeric: tabular-nums; user-select: all; -webkit-user-select: all;
}
.code.blurred { filter: blur(7px); opacity: .75; user-select: none; -webkit-user-select: none; transition: filter .35s, opacity .35s; }
/* While the code is blurred, its button sits on top of it: "there is a code, tap to see it" */
.code-row:has(.blurred), .code-line:has(.blurred) { position: relative; }
.code-row:has(.blurred) .copy, .code-line .reveal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  box-shadow: 0 4px 12px rgba(74, 47, 0, .3);
}
.copy {
  height: 32px; padding: 0 12px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--gold); color: #fff; font-size: 13px; font-weight: 800;
}
.dialog .code-box p { margin: 0; font-size: 13px; line-height: 1.45; color: #6B4A00; }
.dialog p.code-reminder {
  margin: -6px 0 16px; padding: 8px 12px; border-radius: 12px;
  background: #FEF6DA; color: #6B4A00; font-size: 14px; font-weight: 700;
}
.dialog p.code-reminder:empty { display: none; }
.my-code {
  margin-top: 12px; padding: 10px 12px; border-radius: 12px;
  background: rgba(255, 255, 255, .12); border: 1px dashed rgba(255, 255, 255, .45);
}
.my-code[hidden] { display: none; }
.my-code .lbl { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .8; }
.my-code .sub { display: block; margin-top: 6px; font-size: 11px; opacity: .85; }
.my-code .code-line { display: flex; align-items: center; margin: 5px 0 7px; }
.my-code .code { font-size: 18px; font-weight: 800; letter-spacing: .03em; white-space: nowrap; user-select: all; -webkit-user-select: all; }
.my-code .code.blurred { filter: blur(6px); }
.reveal {
  height: 26px; padding: 0 14px; border: 0; border-radius: 999px; cursor: pointer;
  background: #fff; color: var(--red); font-size: 12px; font-weight: 800; white-space: nowrap;
}
.my-code.winner .reveal { background: #4A2F00; color: #fff; }
.my-code p { font-size: 12px; line-height: 1.4; opacity: .9; }
.my-code.winner { background: var(--gold); border: 0; color: #4A2F00; box-shadow: 0 0 0 3px rgba(255, 255, 255, .5); }
.my-code.winner .lbl { font-size: 14px; letter-spacing: 0; text-transform: none; opacity: 1; }
.submit .btn { height: 46px; padding: 0 18px; justify-content: center; white-space: nowrap; }
.submit .btn:disabled { opacity: .6; cursor: wait; transform: none; }
.dialog .submit .submit-error { font-size: 13px; font-weight: 600; color: var(--red); text-align: center; }
.dialog .submit .submit-error:empty { display: none; }
.dialog .submit .privacy { font-size: 11.5px; line-height: 1.4; color: var(--muted); text-align: center; }
.dialog .submit .privacy strong { color: var(--ink); font-weight: 800; }
.dialog p.submit-done { margin: -6px 0 16px; font-size: 14px; font-weight: 700; color: #15803d; }
.dialog p.submit-done:empty { display: none; }

/* Competitor effect banner */
.fx-banner {
  position: absolute; z-index: 3; top: calc(var(--pad) + 14px); left: 50%;
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  border-radius: 14px; background: #fff; color: var(--ink);
  font-size: 15px; font-weight: 800; white-space: nowrap;
  box-shadow: var(--brand-shadow), 0 12px 28px rgba(60, 0, 15, .3);
  opacity: 0; transform: translate(-50%, -10px); pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.fx-banner.on { opacity: 1; transform: translate(-50%, 0); }
.fx-icon svg { display: block; width: 22px; height: 22px; }
.fx-bar, .fx-pct { display: none; }
.fx-banner.slow .fx-icon { color: var(--afas-2); }
.fx-banner.slow .fx-icon svg { animation: spin 4s linear infinite; }
.fx-banner.slow .fx-bar { display: block; width: 120px; height: 8px; border-radius: 99px; background: var(--afas-light); overflow: hidden; }
.fx-banner.slow .fx-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--afas-2); }
.fx-banner.slow .fx-pct { display: block; min-width: 34px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fx-banner.glitch { background: #0B1B33; color: #fff; text-shadow: 2px 0 rgba(255, 0, 90, .8), -2px 0 rgba(0, 210, 255, .8); }
.fx-banner.glitch .fx-icon { color: #FF4D7A; }
.fx-banner.blackout { background: #0B1B33; color: #FDE68A; }
.fx-banner.licenses { background: #3B2A8F; color: #fff; }
.fx-banner.licenses .fx-icon { color: #FDE047; }
.fx-minus { display: none; }
.fx-minus:not(:empty) {
  display: block; padding: 3px 9px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 14px; text-shadow: none;
}

/* Score change on the board: above the pop-ups and the power cut, so it is always visible.
   Red for a competitor, AFAS blue for the gift. */
.score-msg {
  position: absolute; left: 50%; top: 32%; z-index: 6;
  display: flex; flex-direction: column; align-items: center; gap: .5cqw;
  padding: 2.4cqw 5cqw 2.6cqw; border-radius: 4.5cqw;
  background: var(--red); color: #fff; border: max(3px, .7cqw) solid #fff;
  box-shadow: 0 0 0 max(5px, 1.2cqw) rgba(210, 0, 58, .3), 0 18px 40px rgba(60, 0, 15, .45);
  text-align: center; pointer-events: none;
  opacity: 0; transform: translate(-50%, -50%);
}
.score-msg.good { background: var(--afas-2); box-shadow: 0 0 0 max(5px, 1.2cqw) rgba(0, 116, 208, .3), 0 18px 40px rgba(0, 40, 90, .4); }
.score-msg strong { font-size: 14cqw; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.score-msg span { font-size: 3.4cqw; font-weight: 700; white-space: nowrap; }
.score-msg.hit { animation: score-msg 1.9s cubic-bezier(.2, .8, .3, 1) forwards; }
.score-msg.hold { animation: none; opacity: 1; }
@keyframes score-msg {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(-8deg); }
  13% { opacity: 1; transform: translate(-50%, -50%) scale(1.12) rotate(3deg); }
  22%, 62% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translate(-50%, -110%) scale(.9); }
}
@keyframes spin { to { transform: rotate(360deg); } }

.fx-slow .lights i { animation-duration: 9s; }
.fx-slow canvas#board { filter: saturate(.5); }
.fx-glitch canvas#board { animation: jitter .3s steps(2) infinite; }
@keyframes jitter {
  25% { transform: translate(-3px, 1px); }
  50% { transform: translate(2px, -2px); }
  75% { transform: translate(-1px, 2px); }
}
.bg { transition: filter .6s; }
.fx-blackout .bg { filter: brightness(.45); }
.fx-blackout .lights i { animation: none; opacity: .12; box-shadow: none; }

/* Odoo pop-up storm */
.popups { position: absolute; inset: var(--pad); z-index: 4; display: none; border-radius: 18px; background: rgba(40, 10, 40, .3); }
.popups.on { display: block; }
.popup {
  position: absolute; left: 50%; top: 50%; width: min(320px, 86%);
  transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy)));
  border-radius: 14px; overflow: hidden; background: #fff; color: var(--ink);
  box-shadow: 0 18px 40px rgba(30, 0, 30, .4);
  pointer-events: none;
  animation: popin .28s cubic-bezier(.2, .9, .3, 1.3) backwards;
}
.popup:last-child { pointer-events: auto; }
@keyframes popin { from { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.7); } }
.popup-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 8px 14px; background: #7B4F72; color: #fff; font-size: 13px; font-weight: 800; }
.popup-x { width: 18px; height: 18px; border: 0; background: none; color: rgba(255, 255, 255, .5); font-size: 10px; cursor: pointer; }
.popup-body { padding: 16px 16px 4px; }
.popup-body strong { display: block; font-size: 17px; font-weight: 800; line-height: 1.25; }
.popup-body p { margin-top: 6px; font-size: 14px; line-height: 1.4; color: var(--muted); }
.popup-actions { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 16px 12px; }
.popup .yes { width: 100%; padding: 12px; border: 0; border-radius: 10px; background: #7B4F72; color: #fff; font-size: 15px; font-weight: 800; cursor: pointer; }
.popup .no { border: 0; background: none; color: #94A3B8; font-size: 11px; text-decoration: underline; cursor: pointer; }

/* "Nog even geduld": the winner code only appears on the end date */
.code-wait {
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(70, 0, 20, .6);
}
.code-wait[hidden] { display: none; }
.code-wait-card {
  width: min(380px, 100%); padding: 28px 26px 24px; border-radius: 24px; text-align: center;
  background: #fff; color: var(--ink); box-shadow: var(--brand-shadow), 0 24px 60px rgba(40, 0, 12, .45);
  animation: popin-card .28s cubic-bezier(.2, .9, .3, 1.3);
}
@keyframes popin-card { from { opacity: 0; transform: scale(.85); } }
.code-wait-icon { width: 52px; height: 52px; padding: 10px; border-radius: 50%; background: #FEF6DA; color: #B07A00; }
.code-wait-card h2 { margin: 10px 0 8px; font-size: 26px; font-weight: 800; color: var(--afas-2); }
.code-wait-card p { margin-bottom: 20px; font-size: 15px; line-height: 1.5; color: var(--muted); }
.code-wait-card p strong { color: var(--ink); }
.code-wait-card .btn { justify-content: center; }

/* Santa in the corner */
.santa { position: fixed; left: 24px; bottom: -6px; z-index: 5; width: 124px; pointer-events: none; }
.santa-figure {
  display: block; width: 100%;
  transform-origin: 50% 100%; animation: santa-bob 3.2s ease-in-out infinite;
  filter: drop-shadow(0 6px 10px rgba(60, 0, 15, .35));
}
@keyframes santa-bob { 50% { transform: translateY(-4px) rotate(-2deg); } }
.santa .mouth { transform-box: fill-box; transform-origin: 50% 0; transform: scaleY(.35); }
.santa.talking .mouth { animation: talk .18s ease-in-out infinite alternate; }
@keyframes talk { from { transform: scaleY(.3); } to { transform: scaleY(1); } }
.bubble {
  position: absolute; left: 116px; bottom: 40px; width: max-content; max-width: 210px;
  padding: 12px 14px; border-radius: 16px 16px 16px 4px;
  background: #fff; color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.35;
  box-shadow: var(--brand-shadow), 0 12px 24px rgba(60, 0, 15, .3);
  opacity: 0; transform: translateY(8px) scale(.9); transform-origin: 0 100%;
  transition: opacity .2s, transform .2s;
}
.santa.talking .bubble { opacity: 1; transform: none; }

/* Medium screens (small laptops, VS Code panel): big board on the right, one compact info column on the left */
@media (min-width: 1001px) and (max-width: 1279px) {
  .topbar { height: 72px; padding: 0 24px; }
  .logo { height: 32px; }
  .title { font-size: 22px; }
  .layout {
    grid-template-columns: 300px auto;
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: 28px; row-gap: 16px;
    height: calc(100vh - 72px);
    padding: 6px 24px 16px;
  }
  .panel.left { grid-column: 1; grid-row: 1; display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 16px 10px; }
  .stat-row { display: contents; }
  .modules-card { grid-column: 1 / -1; }
  .panel.right { grid-column: 1; grid-row: 2; justify-content: flex-start; padding-bottom: 84px; }
  .panel.right > .card:last-child { display: none; }
  .stage { grid-column: 2; grid-row: 1 / span 2; }
  .board-frame { width: min(calc(100vh - 112px), calc(100vw - 404px)); }
  .card { padding: 12px 14px; border-radius: 16px; }
  .card::before { top: -8px; left: 10px; right: 10px; height: 17px; }
  .card-head { margin-bottom: 10px; }
  .label { font-size: 10px; }
  .value { font-size: 34px; margin-top: 4px; }
  .value.sm { font-size: 26px; }
  .score-delta { top: 22px; right: 10px; padding: 4px 8px; font-size: 16px; }
  .modules { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 5px; }
  .mod { border-radius: 7px; }
  .mod .cnt { top: -5px; right: -5px; min-width: 13px; height: 13px; padding: 0 3px; font-size: 7px; }
  .mod.legendary::after { width: 12px; height: 12px; left: -4px; bottom: -4px; font-size: 7px; }
  .rarity-legend { margin-top: 10px; font-size: 10px; }
  .prize-line { margin: 0 0 8px; padding: 7px 10px; font-size: 12px; }
  .leaderboard { gap: 3px; }
  .leaderboard li { padding: 5px 8px; font-size: 14px; }
  .leaderboard .rank { width: 22px; height: 22px; font-size: 11px; }
  .lb-foot { margin-top: 8px; font-size: 11px; }
  .santa { left: 12px; width: 84px; }
  .bubble { left: 78px; bottom: 30px; max-width: 220px; font-size: 13px; padding: 10px 12px; }
}

@media (max-width: 1000px), (pointer: coarse) and (max-width: 1200px) {
  .prize { margin: 0 0 14px; padding: 9px 11px; font-size: 12.5px; }
  .prize .ticket { width: 22px; height: 22px; }
  .submit { margin: -4px 0 12px; }
  .submit input, .submit .btn { height: 44px; }
  .submit input { font-size: 16px; }
  .final { margin-top: 10px; }
  .fx-banner { font-size: 12px; padding: 8px 12px; top: calc(var(--pad) + 10px); }
  .fx-banner.slow .fx-bar { width: 60px; }
  .popup-body { padding: 12px 12px 2px; }
  .popup-body strong { font-size: 15px; }
  .popup-body p { font-size: 12.5px; }
  .popup .yes { padding: 9px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .fx-glitch canvas#board { animation: none; }
  .santa-figure { animation: none; }
}

/* Controls */
kbd {
  display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px;
  border-radius: 9px; font: 700 13px Inter, sans-serif;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .2);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18);
}
.dialog .hint kbd, .control-text kbd { height: 26px; min-width: 0; font-size: 12px; }
.controls { display: flex; align-items: center; gap: 18px; }
.arrows { display: grid; grid-template-columns: repeat(3, 34px); gap: 4px; }
.arrows .k-up { grid-column: 2; }
.arrows .k-left { grid-column: 1; }
.control-text { display: flex; flex-direction: column; gap: 10px; font-size: 14px; color: rgba(255, 255, 255, .85); }

/* Touch d-pad */
.dpad { display: none; }
.rotate-hint { display: none; }

/* Touch comfort: no double-tap zoom, no text selection or callouts while steering */
body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
.dpad, .board-frame, .santa { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button { touch-action: manipulation; }

/* Phones (portrait) and small tablets */
@media (max-width: 1000px), (pointer: coarse) and (max-width: 1200px) {
  :root { --pad: 9px; }
  body { overflow: auto; }
  .topbar { height: 72px; padding: 0 16px; padding-top: env(safe-area-inset-top); }
  .brand { gap: 10px; }
  .logo { height: 30px; }
  .title { font-size: 20px; }
  .title .light { display: none; }
  .xmas-pill { font-size: 11px; padding: 4px 9px 4px 7px; }
  .xmas-pill svg { width: 13px; height: 13px; }
  .icon-btn { width: 40px; height: 40px; }
  .actions { gap: 8px; }

  .layout {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    grid-template-rows: none;
    grid-template-areas: "score record level" "stage stage stage" "lb lb lb" "mods mods mods";
    height: auto; gap: 18px 10px;
    padding: 6px 14px calc(28px + env(safe-area-inset-bottom));
  }
  .panel, .stat-row { display: contents; }
  .score-card { grid-area: score; }
  .stat-row > .card:first-child { grid-area: record; }
  .stat-row > .card:last-child { grid-area: level; }
  .stage { grid-area: stage; gap: 12px; }
  .lb-card { grid-area: lb; }
  .modules-card { grid-area: mods; }
  .panel.right > .card:last-child { display: none; }

  .card { padding: 12px 14px; border-radius: 16px; }
  .card::before { top: -8px; left: 10px; right: 10px; height: 17px; }
  .card-head { margin-bottom: 10px; }
  .value { font-size: 34px; margin-top: 4px; }
  .value.sm { font-size: 26px; }
  .label { font-size: 10px; }
  .value { font-size: 34px; margin-top: 4px; }
  .value.sm { font-size: 26px; }
  .score-delta { top: 22px; right: 10px; padding: 4px 8px; font-size: 16px; }
  .modules { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 5px; }
  .mod { border-radius: 7px; }
  .mod .cnt { top: -5px; right: -5px; min-width: 13px; height: 13px; padding: 0 3px; font-size: 7px; }
  .mod.legendary::after { width: 12px; height: 12px; left: -4px; bottom: -4px; font-size: 7px; }
  .rarity-legend { margin-top: 10px; font-size: 10px; }
  .prize-line { margin: 0 0 8px; padding: 8px 10px; font-size: 13px; }
  .leaderboard { gap: 3px; }
  .leaderboard li { padding: 6px 8px; font-size: 14px; }
  .lb-foot { font-size: 11px; }

  /* Board as big as possible while score, board, Santa and arrows fit on the first screen */
  .board-frame {
    width: min(calc(100vw - 28px), calc(100vh - 410px));
    width: min(calc(100vw - 28px), calc(100svh - 410px));
    min-width: 250px; margin-top: 8px; border-radius: 22px;
    container-type: normal;
  }
  .board-frame::before { top: -10px; left: 14px; right: 14px; height: 22px; }
  .lights i { width: 6px; height: 6px; margin: -3px 0 0 -3px; box-shadow: 0 0 5px 1px var(--c); }
  canvas#board { border-radius: 15px; }

  /* Menus (start, pause, game over) take the whole screen instead of squeezing into the board */
  .overlay {
    position: fixed; inset: 0; z-index: 30; border-radius: 0;
    padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
    background: rgba(70, 0, 20, .72);
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .dialog { width: min(400px, 100%); padding: 26px 22px 24px; }
  .dialog h1 { font-size: 32px; }
  .dialog p { font-size: 15px; margin: 8px 0 18px; }
  .badge { width: 64px; height: 64px; margin-bottom: 10px; }
  .final-score { font-size: 60px; }
  .hint { display: none; }

  /* Santa becomes a message bar between the board and the arrows */
  .santa {
    order: 1; position: relative; left: auto; bottom: auto; z-index: auto;
    display: flex; align-items: center; gap: 8px;
    width: 100%; max-width: 440px;
  }
  .santa-figure { order: -1; width: 50px; flex: none; animation: none; filter: none; }
  .drifts { height: 56px; opacity: .55; }
  .bubble {
    position: static; flex: 1; width: auto; max-width: none; min-height: 46px;
    display: flex; align-items: center;
    padding: 8px 12px; border-radius: 14px 14px 14px 4px;
    font-size: 13px; line-height: 1.3;
    opacity: 1; transform: none;
  }
  .santa:not(.talking) .bubble { opacity: .82; }

  .dpad { order: 2; display: grid; grid-template-columns: repeat(3, 60px); grid-template-rows: repeat(2, 60px); gap: 8px; }
  .dpad button {
    border-radius: 18px; cursor: pointer;
    display: grid; place-items: center;
    background: var(--glass); border: 1px solid var(--glass-border);
  }
  .dpad button:active { background: rgba(255, 255, 255, .3); }
  .dpad svg { width: 28px; height: 28px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
  .dpad .up { grid-column: 2; grid-row: 1; }
  .dpad .left { grid-column: 1; grid-row: 2; }
  .dpad .down { grid-column: 2; grid-row: 2; }
  .dpad .right { grid-column: 3; grid-row: 2; }
}

@media (max-width: 380px) {
  .divider { display: none; }
  .title { font-size: 18px; }
  .brand { gap: 8px; }
}

@media (max-width: 1000px) and (max-height: 700px) {
  .dpad { grid-template-columns: repeat(3, 54px); grid-template-rows: repeat(2, 54px); }
}

/* Phone held sideways: ask to rotate (the game pauses itself) */
@media (max-width: 1000px) and (max-height: 500px) and (orientation: landscape) {
  .rotate-hint {
    position: fixed; inset: 0; z-index: 60;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    padding: 24px; text-align: center; color: #fff;
    background: #A8002E url(assets/afas-patroon-rood.svg) center / cover no-repeat;
  }
  .rotate-hint svg { width: 64px; height: 64px; margin-bottom: 6px; animation: tilt 2.4s ease-in-out infinite; }
  .rotate-hint strong { font-size: 22px; font-weight: 800; }
  .rotate-hint span { font-size: 15px; opacity: .85; }
}
@keyframes tilt { 0%, 25% { transform: rotate(-90deg); } 55%, 100% { transform: rotate(0); } }

@media (prefers-reduced-motion: reduce) {
  .lights i { animation: none; opacity: .9; }
}
