:root {
  --bg: #0d0f1a; --bg2: #161a2e; --panel: #1c2140; --edge: #070812; --hi: #3a4378;
  --fg: #f4f2ff; --dim: #8a88b0; --orange: #f07a22; --teal: #18e8c8; --yellow: #ffe066;
  --red: #ff6060; --green: #70e060;
  --px: "Press Start 2P", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  background-image:
    linear-gradient(45deg, var(--bg2) 25%, transparent 25%, transparent 75%, var(--bg2) 75%),
    linear-gradient(45deg, var(--bg2) 25%, transparent 25%, transparent 75%, var(--bg2) 75%);
  background-size: 32px 32px; background-position: 0 0, 16px 16px;
  color: var(--fg); font-family: var(--px); font-size: 10px; line-height: 1.7;
  min-height: 100vh;
}
a { color: var(--teal); text-decoration: none; }

/* ---- pixel-rand ---- */
.panel {
  background: var(--panel);
  box-shadow: 0 -4px 0 0 var(--edge), 0 4px 0 0 var(--edge), -4px 0 0 0 var(--edge), 4px 0 0 0 var(--edge),
    inset 4px 4px 0 0 var(--hi), inset -4px -4px 0 0 #12152a;
}

/* ---- kop ---- */
.top {
  display: flex; align-items: center; gap: 16px; padding: 12px 20px;
  background: #080a14; border-bottom: 4px solid var(--edge); box-shadow: 0 4px 0 0 #232848;
  position: sticky; top: 0; z-index: 5;
}
.logo { display: flex; gap: 10px; align-items: baseline; font-size: 18px; letter-spacing: 1px; }
.logo .l1 { color: var(--orange); text-shadow: 3px 3px 0 #000; }
.logo .l2 { color: var(--teal); text-shadow: 3px 3px 0 #000; font-size: 22px; }
.nav { margin-left: 16px; }
.nav a { color: var(--dim); }
.nav a:hover { color: var(--yellow); }
.account { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.account .nick { color: var(--yellow); }

.pbtn {
  font-family: var(--px); font-size: 10px; color: #1a0e00; background: var(--yellow); border: 0; cursor: pointer;
  padding: 10px 14px; box-shadow: inset -4px -4px 0 0 #c89a10, inset 4px 4px 0 0 #fff4b0, 0 0 0 4px var(--edge);
  margin: 4px;
}
.pbtn:hover { filter: brightness(1.08); }
.pbtn:active { box-shadow: inset 4px 4px 0 0 #c89a10, 0 0 0 4px var(--edge); }
.pbtn.ghost { background: #3a4060; color: var(--fg); box-shadow: inset -4px -4px 0 0 #262a44, inset 4px 4px 0 0 #565e88, 0 0 0 4px var(--edge); }
.pbtn.small { padding: 7px 10px; font-size: 8px; }
.pbtn:focus-visible, .tab:focus-visible, .lvl:focus-visible { outline: 3px solid var(--teal); outline-offset: 4px; }

/* ---- indeling ---- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; max-width: 1240px; margin: 28px auto; padding: 0 20px; }
.stage { display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; }
.frame { width: 100%; max-width: 768px; padding: 8px; background: #000; box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #2a2f58, 0 12px 40px #0009; }
#screen { display: block; width: 100% !important; height: auto !important; image-rendering: pixelated; image-rendering: crisp-edges; background: #000; }
.runbar { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 14px; width: 100%; max-width: 768px; padding: 10px 14px; background: #080a14; box-shadow: 0 0 0 4px var(--edge); }
.runbar .lbl { color: var(--dim); }
.runbar .val { color: var(--fg); min-width: 3ch; }
.runbar .big { color: var(--yellow); font-size: 14px; font-variant-numeric: tabular-nums; }
.runbar .note { margin-left: auto; color: var(--red); font-size: 8px; }
.help { max-width: 768px; text-align: center; color: var(--fg); font-size: 8px; margin: 0; }
.help b { color: var(--teal); font-weight: normal; }
.help.dim { color: var(--dim); }

/* ---- ranglijst ---- */
.board { padding: 18px 16px 16px; align-self: start; position: sticky; top: 84px; }
.board h2 { margin: 0 0 14px; font-size: 14px; color: var(--orange); text-shadow: 2px 2px 0 #000; text-align: center; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.lvl {
  font-family: var(--px); font-size: 8px; color: var(--fg); background: #2a3060; border: 0; cursor: pointer;
  padding: 6px 2px 5px; box-shadow: inset -3px -3px 0 0 #1a1e40, inset 3px 3px 0 0 #4a5290; line-height: 1.6;
}
.lvl small { display: block; color: var(--dim); font-size: 7px; }
.lvl.castle { background: #4a2a40; box-shadow: inset -3px -3px 0 0 #2a1424, inset 3px 3px 0 0 #6e4062; }
.lvl.active { background: var(--teal); color: #032; box-shadow: inset -3px -3px 0 0 #0c9a84, inset 3px 3px 0 0 #a8fff0; }
.lvl.active small { color: #064; }
.boardhead { margin: 18px 0 8px; text-align: center; }
.boardhead h3 { margin: 0; font-size: 12px; color: var(--yellow); }
.boardhead .sub { color: var(--dim); font-size: 8px; margin-top: 4px; }
.list { list-style: none; margin: 0; padding: 0; min-height: 120px; }
.list li { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; padding: 7px 8px; font-size: 9px; align-items: baseline; }
.list li:nth-child(odd) { background: #171b36; }
.list li .r { color: var(--dim); }
.list li.p1 .r { color: #ffd040; } .list li.p2 .r { color: #d0d0e0; } .list li.p3 .r { color: #e09050; }
.list li .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li .t { color: var(--teal); font-variant-numeric: tabular-nums; }
.list li.me { background: #3a3060; box-shadow: inset 3px 0 0 var(--yellow); }
.list .empty { display: block; text-align: center; color: var(--dim); padding: 28px 8px; line-height: 2; }
.mybest { margin-top: 12px; text-align: center; color: var(--dim); font-size: 8px; }
.mybest b { color: var(--yellow); font-weight: normal; }

/* ---- inlogvenster ---- */
.dlg { border: 0; padding: 22px; width: min(92vw, 380px); color: var(--fg); }
.dlg::backdrop { background: rgba(4, 5, 12, 0.75); }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.tab { flex: 1; font-family: var(--px); font-size: 8px; padding: 10px 4px; border: 0; cursor: pointer; color: var(--dim); background: #12152a; }
.tab.active { color: #1a0e00; background: var(--orange); }
.dlg label { display: block; margin-bottom: 14px; color: var(--yellow); font-size: 8px; }
.dlg input {
  display: block; width: 100%; margin-top: 8px; padding: 10px; font-family: var(--px); font-size: 11px;
  color: var(--fg); background: #080a14; border: 0; box-shadow: 0 0 0 3px var(--edge), inset 3px 3px 0 #000;
}
.dlg input:focus { outline: 3px solid var(--teal); }
.hint { color: var(--dim); font-size: 8px; margin: 4px 0; }
.err { color: var(--red); font-size: 8px; min-height: 14px; margin: 6px 0; }
.row { display: flex; justify-content: space-between; margin-top: 8px; }

/* ---- melding ---- */
.toast {
  position: fixed; left: 50%; top: 86px; transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  background: #080a14; color: var(--yellow); padding: 12px 18px; font-size: 10px; text-align: center; max-width: 92vw;
  box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px var(--orange); transition: opacity .2s, transform .2s; z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.foot { text-align: center; color: var(--dim); font-size: 8px; padding: 24px 0 40px; }

@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .board { position: static; }
}
@media (max-width: 560px) {
  .top { padding: 10px 16px; gap: 10px; }
  .logo { font-size: 13px; } .logo .l2 { font-size: 16px; }
  .nav { display: none; }
  .layout { padding: 0 16px; margin-top: 18px; }
}

/* ---- spelersnamen klikbaar ---- */
.plink { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.plink:hover, .plink:focus-visible { color: var(--yellow); text-decoration: underline; text-underline-offset: 3px; outline: none; }
.account .plink { color: var(--yellow); }

/* ---- spelerskaart ---- */
.dlg.wide { width: min(94vw, 620px); max-height: 90vh; overflow-y: auto; }
.pc-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.pc-head canvas { width: 64px; height: 64px; image-rendering: pixelated; background: #080a14; box-shadow: 0 0 0 4px var(--edge); }
.pc-head h3 { margin: 0; font-size: 16px; color: var(--yellow); text-shadow: 2px 2px 0 #000; word-break: break-all; }
.pc-head .since { color: var(--dim); font-size: 8px; margin-top: 8px; }
.pc-head .crowns { color: #ffd040; font-size: 9px; margin-top: 6px; }
.pc-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.pc-tile { background: #12152a; padding: 12px 10px; box-shadow: 0 0 0 3px var(--edge); }
.pc-tile .n { font-size: 13px; color: var(--teal); }
.pc-tile .l { font-size: 7px; color: var(--dim); margin-top: 6px; }
.pc-sec { margin: 16px 0 8px; font-size: 10px; color: var(--orange); }
.pc-king li { display: flex; justify-content: space-between; padding: 7px 8px; font-size: 9px; }
.pc-king li:nth-child(odd) { background: #171b36; }
.pc-king { list-style: none; margin: 0; padding: 0; }
.pc-king .now { color: #ffd040; }
.pc-bests { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.pc-bests div { background: #12152a; padding: 5px 2px; text-align: center; font-size: 7px; line-height: 1.7; color: var(--dim); }
.pc-bests div b { display: block; color: var(--fg); font-weight: normal; }
.pc-bests div.has b { color: var(--teal); }
.pc-bests div.gold { background: #4a3a08; box-shadow: inset 0 0 0 2px #ffd040; }
.pc-bests div.gold b { color: #ffd040; }
.pc-empty { color: var(--dim); font-size: 8px; padding: 8px; }
@media (max-width: 560px) { .pc-tiles { grid-template-columns: repeat(2, 1fr); } .pc-bests { grid-template-columns: repeat(4, 1fr); } }

/* ---- wereldrecord-feest ---- */
.party { position: fixed; inset: 0; z-index: 50; background: radial-gradient(ellipse at center, #2a1a5aee, #070812f5 70%);
  display: grid; place-items: center; cursor: pointer; animation: partyIn .35s steps(6) both; }
.party[hidden] { display: none; }
.party canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.party-text { position: relative; text-align: center; padding: 0 16px; pointer-events: none; }
.p-crown { font-size: 54px; color: #ffd040; text-shadow: 4px 4px 0 #a06010, 0 0 30px #ffd04088; animation: bob 0.6s steps(2) infinite; }
.p-title { font-size: clamp(22px, 6vw, 56px); line-height: 1.25; color: var(--yellow);
  text-shadow: 4px 4px 0 var(--orange), 8px 8px 0 #000; animation: rainbow 0.9s steps(6) infinite, zoom .7s steps(7) both; }
.p-level { margin-top: 22px; font-size: clamp(11px, 2vw, 16px); color: var(--teal); }
.p-time { margin-top: 14px; font-size: clamp(26px, 6vw, 52px); color: #fff; text-shadow: 4px 4px 0 #000; animation: pulse 0.5s steps(2) infinite; }
.p-prev { margin-top: 14px; font-size: clamp(8px, 1.4vw, 11px); color: var(--dim); }
.p-hint { margin-top: 30px; font-size: 8px; color: var(--dim); animation: blink 1s steps(2) infinite; }
@keyframes partyIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes bob { 50% { transform: translateY(-8px); } }
@keyframes rainbow { 0% { color: #ffe066; } 33% { color: #ff70e0; } 66% { color: #40e8ff; } }
@keyframes zoom { from { transform: scale(0.2); } to { transform: scale(1); } }
@keyframes pulse { 50% { transform: scale(1.08); } }
@keyframes blink { 50% { opacity: 0; } }
/* het spel zelf doet mee */
.frame.partying { animation: frameParty 0.25s steps(2) infinite; }
@keyframes frameParty { 0% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 10px #ffd040, 0 0 60px #ffd040; transform: rotate(-0.6deg); }
  100% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 10px #ff70e0, 0 0 60px #40e8ff; transform: rotate(0.6deg) scale(1.01); } }
@media (prefers-reduced-motion: reduce) { .party, .p-title, .p-time, .p-crown, .frame.partying { animation: none; } }

[hidden] { display: none !important; }

/* ---- bladeren in de ranglijst ---- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.pager .pginfo { font-size: 8px; color: var(--dim); text-align: center; }
.pbtn:disabled { opacity: 0.35; cursor: default; filter: none; }
.pgme { display: block; width: calc(100% - 8px); margin-top: 12px; }

/* ---- je eigen naam valt op ---- */
.list li.me { background: linear-gradient(90deg, #5a4a10, #3a3060); box-shadow: inset 4px 0 0 var(--yellow), 0 0 0 2px var(--yellow);
  animation: meGlow 1.2s steps(2) infinite; position: relative; z-index: 1; }
.list li.me .n .plink, .list li.me .r { color: var(--yellow); }
.list li.me .t { color: #fff; }
.list li .you { margin-left: 6px; font-size: 7px; color: #1a0e00; background: var(--yellow); padding: 2px 4px; vertical-align: 1px; }
.list li .n { display: flex; align-items: baseline; min-width: 0; }
@keyframes meGlow { 50% { box-shadow: inset 4px 0 0 var(--yellow), 0 0 0 2px var(--orange); } }
@media (prefers-reduced-motion: reduce) { .list li.me { animation: none; } }

.list li.filler { background: none !important; }
.board { overflow-anchor: none; }
.list li .you { line-height: 1; padding: 2px 4px 1px; }

/* ---- spelerskaart: foto ---- */
.pc-ava { flex: none; width: 64px; height: 64px; }
.pc-ava canvas, .pc-ava img { display: block; width: 64px; height: 64px; background: #080a14; box-shadow: 0 0 0 4px var(--edge); object-fit: cover; }
.pc-ava canvas { image-rendering: pixelated; }

/* ---- kaart-editor ---- */
.pc-edit { margin-top: 18px; }
.pbtn.wide2 { width: calc(100% - 8px); }
.pc-opts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.pc-sw, .pc-bd { font-family: var(--px); font-size: 7px; color: #fff; border: 0; cursor: pointer; padding: 8px 2px; min-height: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; box-shadow: 0 0 0 3px var(--edge); }
.pc-sw span { text-shadow: 1px 1px 0 #000; }
.pc-bd { background: #12152a; }
.pc-sw.on, .pc-bd.on { outline: 3px solid var(--yellow); outline-offset: 3px; }
.pc-demo { display: block; width: 22px; height: 14px; background: #1c2140; box-shadow: 0 0 0 2px var(--edge); }
.pc-demo.pc-bd-0 { box-shadow: 0 0 0 2px var(--edge), 0 0 0 4px #3a4378; }
.pc-photo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pc-photo label.pbtn { margin: 4px; }
@media (max-width: 560px) { .pc-opts { grid-template-columns: repeat(3, 1fr); } }
.dlg .pc-photo label.pbtn { display: inline-block; color: #1a0e00; font-size: 8px; margin: 4px; }

/* ===== spelerskaart: 20 achtergronden (0-4 gratis, 5-19 via achievements). Allemaal donker genoeg voor lichte tekst. ===== */
.dlg.pc-bg-0, .pc-sw.sw-0 { background: #1c2140; }
.dlg.pc-bg-1, .pc-sw.sw-1 { background: #1e5a2e; }
.dlg.pc-bg-2, .pc-sw.sw-2 { background: #7a1e34; }
.dlg.pc-bg-3, .pc-sw.sw-3 { background: #14507a; }
.dlg.pc-bg-4, .pc-sw.sw-4 { background: #3e1e6a; }
/* polderblokjes */
.dlg.pc-bg-5, .pc-sw.sw-5 { background: repeating-conic-gradient(#1e4a2a 0 25%, #275c36 0 50%) 0 0 / 32px 32px; }
/* tulpenveld: rijen rood, geel en groen */
.dlg.pc-bg-6, .pc-sw.sw-6 { background: repeating-linear-gradient(90deg, #5a1424 0 14px, #4a3a0a 14px 28px, #1a4220 28px 42px); }
/* kanaalwater */
.dlg.pc-bg-7, .pc-sw.sw-7 { background: #0e4a4a; }
/* zeegroen */
.dlg.pc-bg-8, .pc-sw.sw-8 { background: linear-gradient(160deg, #0a2a5a, #134a40); }
/* avondrood */
.dlg.pc-bg-9, .pc-sw.sw-9 { background: linear-gradient(180deg, #1a1040, #4a1a48 60%, #6a2a28); }
/* kasteelstenen */
.dlg.pc-bg-10, .pc-sw.sw-10 { background: repeating-linear-gradient(0deg, #1e1e26 0 2px, transparent 2px 16px), repeating-linear-gradient(90deg, #1e1e26 0 2px, transparent 2px 32px), #3a3a46; }
/* koningspaars met gouden gloed */
.dlg.pc-bg-11, .pc-sw.sw-11 { background: linear-gradient(135deg, #2a0e4a, #4a1a6a 55%, #5a3a0a); }
/* grafiet */
.dlg.pc-bg-12, .pc-sw.sw-12 { background: #2a2a30; }
/* amber */
.dlg.pc-bg-13, .pc-sw.sw-13 { background: #5a3a0a; }
/* schatkist: gouden muntjes */
.dlg.pc-bg-14, .pc-sw.sw-14 { background: radial-gradient(#ffd04070 2px, transparent 2.6px) 0 0 / 16px 16px, linear-gradient(160deg, #3a2a06, #5a4008); }
/* stroopwafel */
.dlg.pc-bg-15, .pc-sw.sw-15 { background: repeating-linear-gradient(45deg, #3a200a 0 3px, transparent 3px 14px), repeating-linear-gradient(-45deg, #3a200a 0 3px, transparent 3px 14px), #6a3e16; }
/* lava */
.dlg.pc-bg-16, .pc-sw.sw-16 { background: linear-gradient(160deg, #4a0a0a, #8a3a0a); }
/* magenta */
.dlg.pc-bg-17, .pc-sw.sw-17 { background: #5a1650; }
/* sterrenhemel */
.dlg.pc-bg-18, .pc-sw.sw-18 { background: radial-gradient(#ffffff40 1px, transparent 1.6px) 0 0 / 18px 18px, #0a0a28; }
/* dageraad */
.dlg.pc-bg-19, .pc-sw.sw-19 { background: linear-gradient(135deg, #4a2a78, #7a3820); }
/* leesbaarheid op gekleurde achtergronden: donkere vakjes en lichtere bijtekst */
.dlg[class*="pc-bg-"]:not(.pc-bg-0) .pc-tile,
.dlg[class*="pc-bg-"]:not(.pc-bg-0) .pc-bests div:not(.gold),
.dlg[class*="pc-bg-"]:not(.pc-bg-0) .pc-edit .pc-bd { background: #000a; }
.dlg[class*="pc-bg-"]:not(.pc-bg-0) .pc-king li:nth-child(odd) { background: #0006; }
.dlg[class*="pc-bg-"]:not(.pc-bg-0) .since,
.dlg[class*="pc-bg-"]:not(.pc-bg-0) .hint,
.dlg[class*="pc-bg-"]:not(.pc-bg-0) .pc-tile .l,
.dlg[class*="pc-bg-"]:not(.pc-bg-0) .pc-empty { color: #d8d4f0; }
.dlg[class*="pc-bg-"]:not(.pc-bg-0) .pc-sec { color: var(--yellow); text-shadow: 2px 2px 0 #000; }

/* ===== spelerskaart: 17 randen (0-1 gratis, 2-16 via achievements) ===== */
.pc-bd-0 { }
.pc-bd-1 { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #b8f0ff, 0 0 18px 6px #80d8ff88 !important; }                 /* ijs */
.pc-bd-2 { animation: bdRainbow 1.2s steps(6) infinite; }                                                             /* regenboog */
.pc-bd-3 { animation: bdFire 0.3s steps(2) infinite; }                                                                /* vuur */
.pc-bd-4 { animation: bdRoyal 1s steps(2) infinite; }                                                                 /* koninklijk */
.pc-bd-5 { box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #ffd040, 0 0 0 10px #a06010 !important; }                   /* goud */
.pc-bd-6 { animation: bdStar 0.8s steps(3) infinite; }                                                                /* sterrenglans */
.pc-bd-7 { animation: bdJewels 1.6s steps(4) infinite; }                                                              /* kroonjuwelen */
.pc-bd-8 { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #e8e8f8, 0 0 0 9px #707088, 0 0 0 11px #c0c0d8 !important; } /* zilver */
.pc-bd-9 { animation: bdBolt 1.4s steps(1) infinite; }                                                                /* bliksem */
.pc-bd-10 { animation: bdGoldRush 1.2s ease-in-out infinite; }                                                        /* goudkoorts */
.pc-bd-11 { animation: bdSlime 1.6s ease-in-out infinite; }                                                           /* slijm */
.pc-bd-12 { animation: bdGhost 2.4s ease-in-out infinite; }                                                           /* geest */
.pc-bd-13 { box-shadow: 0 0 0 3px #ffe066, 0 0 0 6px var(--edge), 0 0 0 9px #ff6060, 0 0 0 12px var(--edge) !important; } /* retro */
.pc-bd-14 { animation: bdPink 1.1s ease-in-out infinite; }                                                            /* roze neon */
.pc-bd-15 { animation: bdNeon 1.4s ease-in-out infinite; }                                                            /* neon */
.pc-bd-16 { animation: bdArcade 0.5s steps(2) infinite; }                                                             /* arcade */
@keyframes bdRainbow {
  0%   { box-shadow: 0 0 0 4px var(--edge), 0 0 0 9px #ff6060; }
  17%  { box-shadow: 0 0 0 4px var(--edge), 0 0 0 9px #ffa040; }
  33%  { box-shadow: 0 0 0 4px var(--edge), 0 0 0 9px #ffe066; }
  50%  { box-shadow: 0 0 0 4px var(--edge), 0 0 0 9px #70e060; }
  67%  { box-shadow: 0 0 0 4px var(--edge), 0 0 0 9px #40c8ff; }
  83%  { box-shadow: 0 0 0 4px var(--edge), 0 0 0 9px #c070ff; }
  100% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 9px #ff6060; }
}
@keyframes bdFire {
  0%   { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #f07a22, 0 -6px 0 7px #ff3020, 0 0 24px 8px #ff602088; }
  100% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #ffb020, 0 -9px 0 7px #f05010, 0 0 30px 10px #ffa02088; }
}
@keyframes bdRoyal {
  0%   { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #9a50e0, 0 0 0 10px #ffd040, 0 0 24px 8px #9a50e066; }
  100% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #ffd040, 0 0 0 10px #9a50e0, 0 0 30px 10px #ffd04066; }
}
@keyframes bdStar {
  0%   { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #ffd040, 0 0 0 9px #fff4b0, 0 0 20px 6px #ffd04066; }
  50%  { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #fff4b0, 0 0 0 9px #ffd040, 0 0 26px 10px #ffffff66; }
  100% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #ffd040, 0 0 0 9px #c08010, 0 0 20px 6px #ffd04066; }
}
@keyframes bdJewels {
  0%   { box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #ffd040, 0 0 0 10px #a06010, 0 0 22px 8px #ff304088; }
  25%  { box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #ffd040, 0 0 0 10px #a06010, 0 0 22px 8px #3080ff88; }
  50%  { box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #ffd040, 0 0 0 10px #a06010, 0 0 22px 8px #30e07088; }
  75%  { box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #ffd040, 0 0 0 10px #a06010, 0 0 22px 8px #c050ff88; }
  100% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #ffd040, 0 0 0 10px #a06010, 0 0 22px 8px #ff304088; }
}
@keyframes bdBolt {
  0%   { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #c8a020; }
  70%  { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #ffffff, 0 0 40px 14px #fff4b0cc; }
  74%  { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #c8a020; }
  80%  { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #ffffff, 0 0 40px 14px #fff4b0cc; }
  84%  { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #c8a020; }
}
@keyframes bdGoldRush {
  0%, 100% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 9px #c08010, 0 0 10px 4px #ffd04044; }
  50%      { box-shadow: 0 0 0 4px var(--edge), 0 0 0 9px #fff0a0, 0 0 36px 14px #ffd040aa; }
}
@keyframes bdSlime {
  0%, 100% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #70e060, 0 5px 0 7px #3a9a30; }
  50%      { box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #a0ff80, 0 10px 0 8px #3a9a30; }
}
@keyframes bdGhost {
  0%, 100% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #ffffff22, 0 0 8px 4px #ffffff11; }
  50%      { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #e8e8ffcc, 0 0 34px 12px #d0d0ff55; }
}
@keyframes bdPink {
  0%, 100% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #ff70e0, 0 0 12px 4px #ff70e055; }
  50%      { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #ffc0f4, 0 0 28px 10px #ff70e099; }
}
@keyframes bdNeon {
  0%, 100% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #18e8c8, 0 0 14px 6px #18e8c855; }
  50%      { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #a8fff0, 0 0 30px 12px #18e8c899; }
}
@keyframes bdArcade {
  0%   { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #ffe066, 0 0 0 10px #101018, 0 0 0 13px #ffe066; }
  100% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #101018, 0 0 0 10px #ffe066, 0 0 0 13px #101018; }
}
@media (prefers-reduced-motion: reduce) { [class*="pc-bd-"] { animation: none !important; } }

/* slotjes op nog niet vrijgespeelde looks */
.pc-sw, .pc-bd { position: relative; }
.pc-sw.locked, .pc-bd.locked { cursor: help; filter: grayscale(0.85) brightness(0.55); }
.pc-sw.locked::after, .pc-bd.locked::after { content: "🔒︎"; position: absolute; inset: 0; display: grid; place-items: center;
  font-family: system-ui, sans-serif; font-size: 12px; color: #fff; text-shadow: 0 0 3px #000; filter: none; }
.pc-lockinfo { min-height: 28px; margin: 10px 0 0; line-height: 1.8; }
.pc-lockinfo b { color: var(--yellow); font-weight: normal; }
.ach-info .rw { color: var(--teal); }

/* keuzerasters in de editor (zonder namen) */
.pc-opts { grid-template-columns: repeat(8, 1fr); gap: 10px; }
.pc-sw, .pc-bd { min-height: 34px; padding: 0; }
.pc-demo { width: 24px; height: 16px; margin: auto; transform: scale(0.6); }
@media (max-width: 560px) { .pc-opts { grid-template-columns: repeat(4, 1fr); } }

/* ===== achievements op de kaart ===== */
.pc-ach { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.ach { font-family: system-ui, sans-serif; font-size: 16px; line-height: 1; aspect-ratio: 1; border: 0; cursor: pointer; padding: 0;
  color: #5a5a78; background: #0d0f1e; box-shadow: inset 0 0 0 2px #2a2f50; font-variant-emoji: text; }
.ach.on.t1 { color: #ffd8b0; background: #7a4520; box-shadow: inset 0 0 0 2px #c07a40, inset -3px -3px 0 #4a2a10; }
.ach.on.t2 { color: #ffffff; background: #5a6078; box-shadow: inset 0 0 0 2px #c8d0e8, inset -3px -3px 0 #3a4058; }
.ach.on.t3 { color: #fff4b0; background: #8a6a10; box-shadow: inset 0 0 0 2px #ffd040, inset -3px -3px 0 #5a4008; }
.ach.sel { outline: 3px solid var(--teal); outline-offset: 2px; }
.ach-info { min-height: 32px; margin-top: 10px; line-height: 1.8; }
.ach-info b { color: var(--yellow); font-weight: normal; }
.ach-info .got { color: var(--green); }
.ach-info .lock { color: var(--dim); }
@media (max-width: 560px) { .pc-ach { grid-template-columns: repeat(6, 1fr); } }

/* ===== achievement-melding ===== */
.achpop { position: fixed; right: 20px; bottom: 24px; z-index: 40; display: flex; gap: 14px; align-items: center; max-width: min(92vw, 380px);
  padding: 14px 16px; background: #080a14; box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #c07a40, 0 10px 30px #000a;
  transform: translateY(140%); transition: transform .3s steps(5); }
.achpop.t2 { box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #c8d0e8, 0 10px 30px #000a; }
.achpop.t3 { box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #ffd040, 0 0 30px #ffd04066; }
.achpop.show { transform: translateY(0); }
.achpop .ach { width: 44px; height: 44px; font-size: 24px; flex: none; cursor: default; }
.achpop small { display: block; font-size: 7px; color: var(--teal); margin-bottom: 6px; }
.achpop b { display: block; font-size: 10px; color: var(--yellow); font-weight: normal; margin-bottom: 6px; }
.achpop i { display: block; font-size: 7px; color: var(--fg); font-style: normal; line-height: 1.6; }

/* ===== mededeling van de beheerder ===== */
.announce { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 16px; text-align: center;
  background: var(--orange); color: #1a0e00; font-size: 9px; line-height: 1.7; box-shadow: 0 4px 0 #a04a10; }
.announce .megafoon { background: #1a0e00; color: var(--yellow); padding: 2px 7px; }
.achpop i.rw { color: var(--teal); margin-top: 6px; }

/* ===== feestdagenthema's (website, niet de game) ===== */
.holifx { position: fixed; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; z-index: 0; }
.top, .layout, .foot, .announce { position: relative; z-index: 1; }
.top { z-index: 5; }
.holi { font-size: 9px; color: #1a0e00; background: var(--yellow); padding: 6px 9px; box-shadow: 0 0 0 3px var(--edge); white-space: nowrap;
  animation: holiBob 1.6s steps(2) infinite; }
@keyframes holiBob { 50% { transform: translateY(-2px); } }
@media (max-width: 760px) { .holi { display: none; } }

body.theme-halloween   { --bg: #120a1a; --bg2: #1c0f26; --orange: #ff7a1a; --teal: #b070ff; --yellow: #ffb030; --hi: #4a2a68; --panel: #221535; }
body.theme-kerst       { --bg: #0a1a12; --bg2: #102418; --orange: #e83038; --teal: #6ad07a; --yellow: #ffe066; --hi: #2a5a3a; --panel: #142a1e; }
body.theme-sinterklaas { --bg: #1a0a0e; --bg2: #260f14; --orange: #d8283c; --teal: #ffd040; --yellow: #ffe7a0; --hi: #5a2a30; --panel: #2a1218; }
body.theme-oudnieuw    { --bg: #0a0a18; --bg2: #14142a; --orange: #ffd040; --teal: #c0a0ff; --yellow: #fff0b0; --hi: #3a3a68; }
body.theme-valentijn   { --bg: #1a0a16; --bg2: #260f20; --orange: #ff5a9a; --teal: #ff9ad0; --yellow: #ffd0e8; --hi: #5a2a4a; --panel: #2a1424; }
body.theme-carnaval    { --bg: #120e0a; --bg2: #1c160f; --orange: #e83030; --teal: #40c860; --yellow: #ffd820; --hi: #4a3a20; }
body.theme-pasen       { --bg: #10161a; --bg2: #182228; --orange: #ffb0d0; --teal: #a0e0b0; --yellow: #fff0a0; --hi: #3a4a58; --panel: #1c2a34; }
body.theme-koningsdag  { --bg: #1a0e04; --bg2: #26160a; --orange: #ff7a00; --teal: #ffa040; --yellow: #ffd090; --hi: #5a3a1a; --panel: #2a1a0c; }
body.theme-bevrijding  { --bg: #0a0e1a; --bg2: #121a2a; --orange: #e0303e; --teal: #7aa8f0; --yellow: #f4f2ff; --hi: #2a3a68; }
/* donkerrode accenten: witte tekst erop voor genoeg contrast */
body.theme-kerst .announce, body.theme-sinterklaas .announce, body.theme-bevrijding .announce,
body.theme-kerst .tab.active, body.theme-sinterklaas .tab.active, body.theme-bevrijding .tab.active,
body.theme-carnaval .announce, body.theme-carnaval .tab.active { color: #fff; }
body.theme-halloween .logo .l2 { text-shadow: 3px 3px 0 #000, 0 0 14px #b070ff88; }
body.theme-kerst .logo .l1 { text-shadow: 3px 3px 0 #000, 0 -3px 0 #ffffff; }

/* ===== uitgebreide feestdagen: decor, versieringen en verzameljacht ===== */
.frame { position: relative; }

/* kerstlampjes boven het spelscherm (kleuren wisselen via hue-rotate) */
body.theme-kerst.festive .frame::before {
  content: ""; position: absolute; left: -8px; right: -8px; top: -14px; height: 18px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='18' shape-rendering='crispEdges'%3E%3Cpath d='M0 3 Q16 11 32 3' stroke='%23203a20' stroke-width='2' fill='none'/%3E%3Crect x='7' y='7' width='4' height='6' fill='%23ff3a3a'/%3E%3Crect x='8' y='5' width='2' height='2' fill='%23404040'/%3E%3Crect x='21' y='7' width='4' height='6' fill='%23ffd040'/%3E%3Crect x='22' y='5' width='2' height='2' fill='%23404040'/%3E%3C/svg%3E") repeat-x;
  animation: lights 1.2s steps(3) infinite; }
@keyframes lights { 0% { filter: hue-rotate(0deg) drop-shadow(0 0 4px #ffd04088); } 100% { filter: hue-rotate(360deg) drop-shadow(0 0 4px #ffd04088); } }

/* halloween: spinnenweb in de hoek en een bungelende spin */
body.theme-halloween.festive .frame::before {
  content: ""; position: absolute; left: 8px; top: 8px; width: 64px; height: 64px; pointer-events: none; z-index: 2;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' stroke='%23e8e0f0' stroke-width='1' fill='none' opacity='.7'%3E%3Cpath d='M0 0L64 8M0 0L56 40M0 0L32 60M0 0L8 64'/%3E%3Cpath d='M14 2Q12 10 10 14Q6 14 2 14M28 4Q24 20 20 28Q10 28 4 28M44 6Q38 30 30 44Q16 44 6 44'/%3E%3C/svg%3E"); }
body.theme-halloween.festive .frame::after {
  content: ""; position: absolute; right: 40px; top: -40px; width: 16px; height: 74px; pointer-events: none; z-index: 2;
  background: linear-gradient(#e8e0f0, #e8e0f0) 7px 0 / 1px 60px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='14' shape-rendering='crispEdges'%3E%3Cg fill='%23101018'%3E%3Crect x='6' y='4' width='4' height='6'/%3E%3Crect x='5' y='3' width='6' height='3'/%3E%3Crect x='1' y='4' width='4' height='1'/%3E%3Crect x='11' y='4' width='4' height='1'/%3E%3Crect x='0' y='7' width='5' height='1'/%3E%3Crect x='11' y='7' width='5' height='1'/%3E%3Crect x='1' y='10' width='4' height='1'/%3E%3Crect x='11' y='10' width='4' height='1'/%3E%3C/g%3E%3Crect x='6' y='5' width='1' height='1' fill='%23ff3030'/%3E%3Crect x='9' y='5' width='1' height='1' fill='%23ff3030'/%3E%3C/svg%3E") 0 60px / 16px 14px no-repeat;
  animation: spider 3s ease-in-out infinite; }
@keyframes spider { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(26px); } }
body.theme-halloween.festive .frame { box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #3a1a4a, 0 0 40px #ff7a1a55; }

/* sinterklaas: pakjes onder het spelscherm */
body.theme-sinterklaas.festive .frame::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -22px; height: 18px; pointer-events: none; z-index: 2;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='18' shape-rendering='crispEdges'%3E%3Crect x='2' y='4' width='18' height='14' fill='%23c02030'/%3E%3Crect x='10' y='4' width='2' height='14' fill='%23ffd040'/%3E%3Crect x='2' y='9' width='18' height='2' fill='%23ffd040'/%3E%3Crect x='26' y='8' width='14' height='10' fill='%232a5ac0'/%3E%3Crect x='32' y='8' width='2' height='10' fill='%23ffffff'/%3E%3Crect x='46' y='2' width='20' height='16' fill='%2330a050'/%3E%3Crect x='55' y='2' width='2' height='16' fill='%23ff4060'/%3E%3Crect x='46' y='8' width='20' height='2' fill='%23ff4060'/%3E%3C/svg%3E") repeat-x left bottom; }

/* pasen: gras met eitjes onder het spelscherm */
body.theme-pasen.festive .frame::after {
  content: ""; position: absolute; left: -8px; right: -8px; bottom: -14px; height: 18px; pointer-events: none; z-index: 2;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='18' shape-rendering='crispEdges'%3E%3Crect y='10' width='48' height='8' fill='%2358b838'/%3E%3Cpath d='M0 10l3-6 3 6 3-8 3 8 3-5 3 5 3-7 3 7 3-6 3 6 3-8 3 8 3-5 3 5 3-6 3 6z' fill='%238ce060'/%3E%3Crect x='8' y='6' width='6' height='9' fill='%23ffb0d0'/%3E%3Crect x='8' y='9' width='6' height='1' fill='%23ffffff'/%3E%3Crect x='30' y='7' width='6' height='8' fill='%23a8d0ff'/%3E%3Crect x='30' y='10' width='6' height='1' fill='%23fff0a0'/%3E%3C/svg%3E") repeat-x; }

/* vlaggetjeslijnen onder de kop */
body.festive.theme-koningsdag .top::after, body.festive.theme-carnaval .top::after, body.festive.theme-bevrijding .top::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -18px; height: 16px; pointer-events: none;
  background-repeat: repeat-x; animation: bunting 2s ease-in-out infinite; transform-origin: top; }
body.festive.theme-koningsdag .top::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='16'%3E%3Cpath d='M0 1H48' stroke='%23ffffff' stroke-width='1.5'/%3E%3Cpath d='M2 1h12l-6 12z' fill='%23ff7a00'/%3E%3Cpath d='M18 1h12l-6 12z' fill='%23ffffff'/%3E%3Cpath d='M34 1h12l-6 12z' fill='%23ff7a00'/%3E%3C/svg%3E"); }
body.festive.theme-carnaval .top::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='16'%3E%3Cpath d='M0 1H48' stroke='%23ffffff' stroke-width='1.5'/%3E%3Cpath d='M2 1h12l-6 12z' fill='%23e83030'/%3E%3Cpath d='M18 1h12l-6 12z' fill='%23ffd820'/%3E%3Cpath d='M34 1h12l-6 12z' fill='%2330b040'/%3E%3C/svg%3E"); }
body.festive.theme-bevrijding .top::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='16'%3E%3Cpath d='M0 1H48' stroke='%23ffffff' stroke-width='1.5'/%3E%3Cpath d='M2 1h12l-6 12z' fill='%23c8102e'/%3E%3Cpath d='M18 1h12l-6 12z' fill='%23ffffff'/%3E%3Cpath d='M34 1h12l-6 12z' fill='%2321468b'/%3E%3C/svg%3E"); }
@keyframes bunting { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.15); } }

/* valentijn: kloppend logo; oud & nieuw: gouden gloed om het spel */
body.festive.theme-valentijn .logo { animation: heartbeat 1.1s ease-in-out infinite; }
@keyframes heartbeat { 0%, 40%, 100% { transform: scale(1); } 15% { transform: scale(1.08); } 25% { transform: scale(0.98); } }
body.festive.theme-oudnieuw .frame { animation: goldglow 1.6s ease-in-out infinite; }
@keyframes goldglow { 0%, 100% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #2a2f58, 0 0 20px #ffd04033; } 50% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #ffd040, 0 0 50px #ffd04088; } }
body.festive.theme-oudnieuw .holi { font-variant-numeric: tabular-nums; }

/* ===== verzameljacht: het gouden voorwerp ===== */
.holifind { position: fixed; z-index: 30; width: 56px; height: 56px; padding: 4px; border: 0; cursor: pointer; background: #0d0f1acc;
  box-shadow: 0 0 0 3px var(--edge), 0 0 0 6px #ffd040, 0 0 24px 8px #ffd04099; animation: findbob 0.8s ease-in-out infinite; }
.holifind canvas { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.holifind.pop { animation: findpop .3s steps(4), findbob 0.8s ease-in-out .3s infinite; }
.holifind:focus-visible { outline: 3px solid var(--teal); outline-offset: 6px; }
@keyframes findbob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-6px) rotate(4deg); } }
@keyframes findpop { from { transform: scale(0); } to { transform: scale(1); } }
.spark { position: fixed; z-index: 31; width: 5px; height: 5px; background: #ffd040; pointer-events: none; box-shadow: 0 0 6px #ffd040;
  animation: spark .8s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .holifind, .holifind.pop, body.festive .frame, body.festive .logo, body.festive .top::after, body.festive .frame::before, body.festive .frame::after { animation: none !important; }
}

/* ===== 9 seizoensranden (pc-bd-17 t/m 25), alleen te verdienen tijdens het feest ===== */
.pc-bd-17 { animation: bdWeb 1.2s steps(2) infinite; }        /* spinnenweb */
.pc-bd-18 { animation: bdMitre 1.4s steps(2) infinite; }      /* mijtergoud */
.pc-bd-19 { animation: bdXmas 0.9s steps(3) infinite; }       /* kerstlampjes */
.pc-bd-20 { animation: bdFirework 1.2s steps(4) infinite; }   /* vuurwerk */
.pc-bd-21 { animation: bdHeart 1.1s ease-in-out infinite; }   /* hartenklop */
.pc-bd-22 { animation: bdTricolor 0.9s steps(3) infinite; }   /* drieklek carnaval */
.pc-bd-23 { animation: bdPastel 2.4s linear infinite; }       /* pastel */
.pc-bd-24 { animation: bdOranje 0.8s ease-in-out infinite; }  /* oranjekoorts */
.pc-bd-25 { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #c8102e, 0 0 0 10px #ffffff, 0 0 0 13px #21468b, 0 0 20px 6px #ffffff44 !important; } /* vrijheid */
@keyframes bdWeb {
  0%   { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #ff7a1a, 0 0 0 9px #2a0a3a, 0 0 26px 8px #ff7a1a66; }
  100% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #9a50e0, 0 0 0 9px #2a0a3a, 0 0 26px 8px #9a50e066; }
}
@keyframes bdMitre {
  0%   { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #d8283c, 0 0 0 10px #ffd040, 0 0 18px 4px #ffd04055; }
  100% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #ffd040, 0 0 0 10px #d8283c, 0 0 26px 8px #ffd04088; }
}
@keyframes bdXmas {
  0%   { box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #e83038, 0 0 20px 6px #e8303866; }
  33%  { box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #30b040, 0 0 20px 6px #30b04066; }
  66%  { box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #ffd040, 0 0 20px 6px #ffd04066; }
  100% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #e83038, 0 0 20px 6px #e8303866; }
}
@keyframes bdFirework {
  0%   { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #ffd040, 0 0 30px 10px #ffd04066; }
  25%  { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #ff70b0, 0 0 40px 14px #ff70b066; }
  50%  { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #40e8ff, 0 0 30px 10px #40e8ff66; }
  75%  { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #c0a0ff, 0 0 46px 16px #c0a0ff66; }
  100% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #ffd040, 0 0 30px 10px #ffd04066; }
}
@keyframes bdHeart {
  0%, 45%, 100% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #ff4a8a, 0 0 12px 4px #ff4a8a55; }
  15%           { box-shadow: 0 0 0 4px var(--edge), 0 0 0 10px #ff8ab8, 0 0 34px 12px #ff4a8aaa; }
  28%           { box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #ff4a8a, 0 0 20px 6px #ff4a8a77; }
}
@keyframes bdTricolor {
  0%   { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #e83030, 0 0 0 10px #ffd820, 0 0 0 13px #30b040; }
  33%  { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #ffd820, 0 0 0 10px #30b040, 0 0 0 13px #e83030; }
  66%  { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #30b040, 0 0 0 10px #e83030, 0 0 0 13px #ffd820; }
  100% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #e83030, 0 0 0 10px #ffd820, 0 0 0 13px #30b040; }
}
@keyframes bdPastel {
  0%, 100% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #ffb0d0, 0 0 18px 6px #ffb0d055; }
  25%      { box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #a0e0b0, 0 0 18px 6px #a0e0b055; }
  50%      { box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #a8d0ff, 0 0 18px 6px #a8d0ff55; }
  75%      { box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px #fff0a0, 0 0 18px 6px #fff0a055; }
}
@keyframes bdOranje {
  0%, 100% { box-shadow: 0 0 0 4px var(--edge), 0 0 0 9px #ff7a00, 0 0 14px 4px #ff7a0055; }
  50%      { box-shadow: 0 0 0 4px var(--edge), 0 0 0 11px #ffa040, 0 0 36px 14px #ff7a00aa; }
}
.ach.seasonal { position: relative; }
.ach.seasonal::after { content: ""; position: absolute; right: 2px; top: 2px; width: 4px; height: 4px; background: var(--teal); }
body.festive .frame::before, body.festive .frame::after { z-index: 3; }

/* ===== duidelijke profielknop rechtsboven ===== */
.account .nickname { color: var(--dim); font-size: 8px; max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbtn.profile { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; position: relative; }
.pf-ava { flex: none; width: 24px; height: 24px; background: #080a14; box-shadow: 0 0 0 2px var(--edge); overflow: hidden; display: block; }
.pf-ava img, .pf-ava canvas { display: block; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.pf-new { position: absolute; top: -10px; right: -8px; background: var(--red); color: #200; font-size: 6px; padding: 3px 5px; line-height: 1;
  box-shadow: 0 0 0 2px var(--edge); animation: pfBlink 1s steps(2) infinite; }
@keyframes pfBlink { 50% { transform: translateY(-2px); } }
@media (max-width: 760px) { .account .nickname { display: none; } }
@media (max-width: 560px) { .pf-long { display: none; } }
@media (prefers-reduced-motion: reduce) { .pf-new { animation: none; } }

/* ===== eigen kaart: label en aanpas-knop bovenaan ===== */
.pc-you { display: inline-block; font-size: 7px; color: #1a0e00; background: var(--yellow); padding: 3px 6px; margin-bottom: 8px; box-shadow: 0 0 0 2px var(--edge); }
.pc-head + .pc-edit { margin: 0 0 18px; }
#pcEditToggle { font-size: 9px; padding: 12px 10px; }

/* ===== kop van de site: INLOGGEN, PROFIEL en UITLOGGEN zijn precies even groot ===== */
#account { gap: 8px; }
#account .pbtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-sizing: border-box;
  height: 34px; margin: 0 4px; padding: 0 14px; font-size: 9px; line-height: 1; white-space: nowrap; }
#account .pbtn.profile { padding: 0 14px 0 5px; }

/* ===== wachtwoord wijzigen op je eigen profiel ===== */
.pc-edit + .pc-pw { margin: -6px 0 18px; }
.pc-pwform { margin-top: 12px; padding: 14px; background: #0006; box-shadow: 0 0 0 3px var(--edge); }
.pc-pwform label { margin-bottom: 12px; }
.pc-pwform .err { min-height: 12px; }
#pwToggle { font-size: 9px; padding: 12px 10px; }
.pbtn:disabled { opacity: .5; cursor: default; }

/* ======================================================================
   TELEFOON EN TABLET: alleen voor aanraakschermen, op een computer verandert er niets.
   body.touch   = grof aanwijsapparaat (vinger), gezet in js/core.js
   body.compact = aanraakscherm met telefoonweergave (smal, of liggend), gezet in site.js
   ====================================================================== */
html { touch-action: manipulation; }                 /* geen inzoomen door dubbel tikken */
body { -webkit-tap-highlight-color: transparent; }

/* ---- tabs SPEL / RANGLIJST ---- */
.viewtabs { display: none; }
.vtab { font-family: var(--px); font-size: 9px; height: 34px; padding: 0 12px; border: 0; cursor: pointer; white-space: nowrap;
  color: var(--dim); background: #12152a; box-shadow: 0 0 0 3px var(--edge); }
.vtab.on { color: #1a0e00; background: var(--yellow); box-shadow: inset -3px -3px 0 #c89a10, inset 3px 3px 0 #fff4b0, 0 0 0 3px var(--edge); }
.vtab:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
body.compact .viewtabs { display: flex; gap: 10px; order: 3; flex: 1 1 100%; }
body.compact .vtab { flex: 1; height: 38px; font-size: 10px; }
body.compact .top { position: static; flex-wrap: wrap; row-gap: 10px; }
body.compact .layout { margin-top: 14px; grid-template-columns: minmax(0, 1fr); }
body.compact:not(.view-board) .board { display: none; }
body.compact.view-board .stage { display: none; }
body.compact.view-board #touch { display: none !important; }
body.compact:not(.view-board) .foot { padding: 12px 0 20px; }
body.compact.view-board .foot { padding-bottom: 84px; }   /* ruimte voor de zwevende knop */
.togame { position: fixed; right: 14px; bottom: 14px; z-index: 30; height: 40px; padding: 0 14px; font-size: 9px; margin: 0; }

/* ---- staand op een telefoon: het spel past met de besturing op één scherm ---- */
@media (max-width: 760px) and (orientation: portrait) {
  body.compact .frame { width: min(100%, max(240px, calc((100vh - 392px) * 1.0667 + 16px)));
    width: min(100%, max(240px, calc((100dvh - 392px) * 1.0667 + 16px))); }
  body.compact .runbar { padding: 8px 12px; }
  body.compact .top { padding: 10px 12px; column-gap: 8px; row-gap: 8px; }
  body.compact .logo { gap: 6px; }
  body.compact #account { gap: 4px; }
  body.compact #account .pbtn { margin: 0 2px; padding: 0 10px; }
  body.compact #account .pbtn.profile { padding: 0 10px 0 5px; }
}
/* heel smalle telefoons (320-360 px) */
@media (max-width: 360px) and (orientation: portrait) {
  body.compact .logo { font-size: 11px; } body.compact .logo .l2 { font-size: 13px; }
  body.compact #account .pbtn { padding: 0 8px; font-size: 8px; }
  body.compact #account .pbtn.profile { padding: 0 8px 0 4px; gap: 6px; }
  body.compact .pf-ava { width: 22px; height: 22px; }
  body.compact .top { padding: 8px 10px; }
  body.compact .viewtabs { gap: 8px; }
}

/* ---- liggend (telefoon en tablet): het spel schaalt mee met de hoogte ---- */
@media (orientation: landscape) and (max-height: 900px) {
  body.compact .top { flex-wrap: nowrap; padding: 6px 14px; gap: 10px; }
  body.compact .viewtabs { order: 0; flex: 0 0 auto; margin-left: 6px; }
  body.compact .vtab { flex: 0 0 auto; height: 28px; font-size: 8px; padding: 0 10px; }
  body.compact .logo { font-size: 12px; } body.compact .logo .l2 { font-size: 14px; }
  body.compact #account .pbtn { height: 28px; }
  body.compact .account .nickname, body.compact .holi { display: none; }
  body.compact .layout { margin: 8px auto; }
  body.compact .frame { width: min(calc(100% - 420px), calc((100vh - 78px) * 1.0667 + 16px)); width: min(calc(100% - 420px), calc((100dvh - 78px) * 1.0667 + 16px)); }
}

/* ---- aanraakbediening ---- */
#touch { display: none; --tb: clamp(46px, 15.5vw, 66px); -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; touch-action: none; }
#touch button { width: var(--tb); height: var(--tb); border-radius: 50%; border: 2px solid #fff6; background: #ffffff22; color: #fff;
  font-size: calc(var(--tb) * .32); font-weight: 700; padding: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
#touch button.on { background: #ffffff66; border-color: #fffd; transform: scale(.93); }
#touch .tbar button { width: auto; height: 34px; padding: 0 16px; border-radius: 10px; font-family: var(--px); font-size: 9px; }
body.touch .help { display: none; }
/* standaard: onder het spel, in de pagina, dus nooit over de ranglijst heen */
body.touch #touch { display: grid; grid-template-columns: auto auto; grid-template-areas: "bar bar" "left right"; justify-content: space-between;
  row-gap: 14px; width: 100%; max-width: 768px; padding: 4px 4px 8px; position: static; }
#touch .tbar { grid-area: bar; display: flex; justify-content: center; gap: 12px; }
#touch .pad { display: flex; gap: 8px; }
#touch .left { grid-area: left; } #touch .right { grid-area: right; }
/* liggend: zwevend aan de zijkanten, buiten het spel */
@media (orientation: landscape) and (max-height: 900px) {
  #touch { --tb: clamp(44px, 14vh, 60px); }
  body.touch #touch { display: block; position: fixed; inset: 0; width: auto; max-width: none; padding: 0; pointer-events: none; z-index: 10; }
  body.touch #touch > * { pointer-events: auto; }
  body.touch #touch .pad { position: absolute; bottom: 14px; }
  body.touch #touch .left { left: max(14px, env(safe-area-inset-left)); } body.touch #touch .right { right: max(14px, env(safe-area-inset-right)); }
  body.touch #touch .tbar { position: absolute; left: max(14px, env(safe-area-inset-left)); top: 62px; flex-direction: column; gap: 8px; }
  body.touch.game-away #touch { display: none; }
}

/* ---- sluitknop op de spelerskaart (alleen op aanraakschermen) ---- */
.dlg-x { display: none; position: sticky; top: 0; float: right; z-index: 4; width: 36px; height: 36px; margin: 0 0 6px 8px; padding: 0; border: 0; cursor: pointer;
  font-family: system-ui, sans-serif; font-size: 15px; line-height: 1; color: #fff; background: #000b; box-shadow: 0 0 0 3px var(--edge); }
body.touch .dlg-x { display: block; }
.dlg-x:hover, .dlg-x:focus-visible { background: var(--red); color: #200; outline: none; }

/* ---- grotere tikdoelen en leesbare invoervelden (grof aanwijsapparaat) ---- */
@media (pointer: coarse) {
  input, textarea, select { font-size: 16px !important; }   /* anders zoomt iOS in bij het invullen */
  .pager .pbtn, .pgme { min-height: 42px; }
  .pager .pbtn { min-width: 56px; }
  .list li { padding: 11px 8px; }
  .plink { padding: 4px 0; }
  .pc-sw, .pc-bd { min-height: 40px; }
  .dlg-x { width: 42px; height: 42px; }
}

/* ---- tablet: de kop mag nooit breder worden dan het scherm ---- */
.top { flex-wrap: wrap; row-gap: 8px; }
@media (max-width: 1000px) { body.touch .account .nickname { display: none; } }
@media (max-width: 900px) { body.touch .holi { display: none; } }

/* ---- level direct spelen vanuit de ranglijst ---- */
.playlvl { margin-top: 12px; }

/* ---- scrollbalken in dezelfde pixelstijl als de gele knoppen (kaarten en dialogen) ---- */
dialog, dialog *, .grid { scrollbar-width: thin; scrollbar-color: var(--yellow) #080a14; }
dialog::-webkit-scrollbar, dialog *::-webkit-scrollbar, .grid::-webkit-scrollbar { width: 12px; height: 12px; background: #080a14; }
dialog::-webkit-scrollbar-track, dialog *::-webkit-scrollbar-track, .grid::-webkit-scrollbar-track { background: #080a14; box-shadow: inset 0 0 0 2px var(--edge); }
dialog::-webkit-scrollbar-thumb, dialog *::-webkit-scrollbar-thumb, .grid::-webkit-scrollbar-thumb {
  background: var(--yellow); box-shadow: inset -3px -3px 0 #c89a10, inset 3px 3px 0 #fff4b0, 0 0 0 2px var(--edge); }
dialog::-webkit-scrollbar-thumb:hover, dialog *::-webkit-scrollbar-thumb:hover, .grid::-webkit-scrollbar-thumb:hover { filter: brightness(1.1); }
dialog::-webkit-scrollbar-corner { background: #080a14; }

/* melding voor geblokkeerde spelers */
body .banbanner { background: #c8283c; color: #fff; box-shadow: 0 4px 0 #7a1020; }
body .banbanner .megafoon { background: #fff; color: #c8283c; }

/* ---- thumbstick links, springknop rechts (alleen aanraakschermen) ---- */
#touch { --sb: clamp(88px, min(33vw, 17dvh), 140px); }
#touch .stick { position: relative; width: var(--sb); height: var(--sb); border-radius: 50%; background: #ffffff1a; border: 2px solid #fff5; touch-action: none; }
#touch .stick::before { content: ''; position: absolute; inset: 22%; border-radius: 50%; border: 2px dashed #fff3; }
#touch .stick .knob { position: absolute; left: 50%; top: 50%; width: 46%; height: 46%; margin: -23% 0 0 -23%; border-radius: 50%;
  background: #ffffff66; border: 2px solid #fffb; box-shadow: 0 3px 0 #0006; }
#touch .stick.on { background: #ffffff2a; }
#touch .pad.right { align-items: flex-end; gap: 14px; }
#touch .pad.left { align-items: center; }
#touch .jump { width: calc(var(--tb) * 1.55); height: calc(var(--tb) * 1.55); font-family: var(--px); font-size: 9px; background: #ffe06644; border-color: #ffe066aa; }
#touch .jump.on { background: #ffe066aa; }
#touch .fire { font-family: var(--px); font-size: 7px; background: #f07a2244; border-color: #f07a22aa; }
#touch .fire.on { background: #f07a22aa; }
@media (orientation: landscape) and (max-height: 900px) { #touch { --sb: clamp(96px, 34vh, 132px); } }

/* ---- spelweergave op de telefoon staat vast: de pagina scrolt niet (alleen de ranglijst scrolt) ---- */
html.lock, html.lock body { overflow: hidden; overscroll-behavior: none; }
html.lock body { position: fixed; inset: 0; width: 100%; }
html.lock .foot { display: none; }
/* korte schermen (kleine telefoons staand): besturing wat compacter zodat alles op één scherm past */
@media (orientation: portrait) and (max-height: 620px) { body.touch #touch { row-gap: 8px; padding-bottom: 2px; } }

/* ===== lobbychat ===== */
.chatbtn { position: relative; min-width: 128px; padding-left: 16px; padding-right: 16px; }
.chatcount { display: inline-block; min-width: 18px; padding: 2px 5px; margin-left: 4px; background: #1a0e00; color: var(--yellow); text-align: center; font-size: 8px; }
@keyframes chatping { 50% { transform: scale(1.25); } }

body.compact .chatbtn, body.compact #account .chatbtn { display: none; }
#chatTab { display: none; position: relative; }
body.compact #chatTab { display: block; }
body.compact .vtab .chatcount { margin-left: 6px; }
.chatdlg { width: min(94vw, 760px); max-height: 88vh; flex-direction: column; padding: 16px; }
.chatdlg[open] { display: flex; }
.chat-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.chat-head h3 { margin: 0; flex: 1; font-size: 12px; color: var(--yellow); }
.chat-n { font-size: 8px; color: var(--teal); }
.chat-body { display: grid; grid-template-columns: minmax(0, 1fr) 170px; gap: 12px; min-height: 0; flex: 1; }
.chat-log { height: min(52vh, 420px); overflow-y: auto; padding: 10px; background: #0d0f1f; box-shadow: 0 0 0 3px var(--edge); font-size: 9px; line-height: 1.9; }
.cmsg { padding: 3px 0; border-bottom: 1px dashed #ffffff10; word-break: break-word; overflow-wrap: anywhere; }
.cmsg .ctime { color: var(--dim); font-size: 7px; margin-right: 6px; }
.cmsg .cnick { color: var(--orange); font-size: 9px; }
.cmsg.mine .cnick { color: var(--teal); }
.cmsg .ctext { color: var(--fg); text-transform: none; }
.cava { image-rendering: pixelated; vertical-align: middle; margin-right: 4px; box-shadow: 0 0 0 1px var(--edge); }
.chat-side { background: #12152a; padding: 10px; box-shadow: 0 0 0 3px var(--edge); overflow-y: auto; max-height: min(52vh, 420px); }
.chat-side h4 { margin: 0 0 8px; font-size: 8px; color: var(--yellow); }
.chat-online { display: grid; gap: 4px; }
.conline { display: block; text-align: left; width: 100%; padding: 5px 4px; font-size: 8px; color: var(--fg); }
.conline:hover { background: #ffffff12; color: var(--yellow); }
.cdot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; background: #3ddc84; box-shadow: 0 0 0 2px var(--edge); }
.chat-form { display: flex; gap: 10px; margin-top: 12px; }
.chat-form input { flex: 1; min-width: 0; margin: 0; }
.chat-login { margin: 12px 0 0; font-size: 8px; color: var(--dim); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
@media (max-width: 640px) {
  .chat-body { grid-template-columns: 1fr; }
  .chat-side { order: -1; max-height: 112px; }
  .chat-online { display: flex; flex-wrap: wrap; gap: 4px 10px; }
  .conline { width: auto; }
  .chat-log { height: 38vh; }
  .chatdlg { padding: 12px; }
}
body.compact .top .account { margin-left: auto; }

/* automatische berichten: record gehaald */
.cmsg.sys { margin: 4px 0; padding: 6px 8px; background: #1b1f3a; border-left: 4px solid var(--teal); border-bottom: 0; }
.cmsg.sys.pb .cicon { color: var(--teal); }
.cmsg.sys.wr { background: #3a2a10; border-left-color: var(--yellow); }
.cmsg.sys.wr .cicon { color: var(--yellow); }
.cmsg.sys .ctext { color: var(--fg); }
.cmsg.sys.wr .ctext { color: var(--yellow); }

/* ===== persoonlijk record: banner + confetti ===== */
.pbpop { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); z-index: 60; width: min(92vw, 380px); padding: 16px 18px; text-align: center; pointer-events: none;
  background: linear-gradient(#1c2140, #12152a); color: var(--fg); box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px var(--teal), 0 10px 0 8px #000a; animation: pbin .55s cubic-bezier(.2, 1.4, .4, 1) both; }
.pbpop.out { animation: pbout .5s ease-in both; }
.pb-star { font-size: 28px; color: var(--yellow); animation: pbspin 1.2s ease-in-out infinite; text-shadow: 0 0 12px #ffe06699; }
.pb-title { margin: 6px 0; font-size: 13px; color: var(--teal); }
.pb-time { font-size: 18px; color: var(--yellow); margin: 6px 0; }
.pb-gain { font-size: 9px; color: var(--orange); margin: 6px 0; line-height: 1.6; }
.pb-rank { font-size: 8px; color: var(--dim); }
.pb-conf { position: fixed; top: -14px; z-index: 59; width: 9px; height: 9px; pointer-events: none; animation: pbfall linear forwards; }
@keyframes pbin { from { transform: translate(-50%, -140%) scale(.8); opacity: 0; } to { transform: translate(-50%, 0) scale(1); opacity: 1; } }
@keyframes pbout { to { transform: translate(-50%, -30%) scale(.9); opacity: 0; } }
@keyframes pbspin { 0%, 100% { transform: rotate(-12deg) scale(1); } 50% { transform: rotate(12deg) scale(1.2); } }
@keyframes pbfall { to { transform: translate(var(--dx), 105vh) rotate(var(--rot)); opacity: .9; } }
@media (prefers-reduced-motion: reduce) { .pbpop, .pb-star { animation: none; } }

/* ---- chat komt naar voren: groeit uit de CHAT-knop ---- */
.chatdlg[open] { animation: chatin .46s cubic-bezier(.2, 1.15, .35, 1) both; }
.chatdlg.closing { animation: chatout .26s cubic-bezier(.5, 0, .9, .4) both; }
.chatdlg[open]::backdrop { animation: chatbd .35s ease both; backdrop-filter: blur(3px); }
.chatdlg.closing::backdrop { animation: chatbdout .26s ease both; }
@keyframes chatin {
  from { opacity: 0; transform: translate(var(--cdx, 0px), var(--cdy, -40px)) scale(.12); }
  55% { opacity: 1; transform: translate(0, 0) scale(1.04); }
  to { opacity: 1; transform: translate(0, 0) scale(1); }
}
@keyframes chatout { to { opacity: 0; transform: translate(var(--cdx, 0px), var(--cdy, -40px)) scale(.12); } }
@keyframes chatbd { from { background: rgba(4, 5, 12, 0); backdrop-filter: blur(0); } }
@keyframes chatbdout { to { background: rgba(4, 5, 12, 0); backdrop-filter: blur(0); } }
.chatdlg[open] .cmsg:last-child { animation: cmsgpop .4s ease .35s both; }
@keyframes cmsgpop { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  .chatdlg[open], .chatdlg.closing, .chatdlg[open]::backdrop, .chatdlg.closing::backdrop, .chatdlg[open] .cmsg:last-child { animation: none; }
}

/* ===== BAM: nieuwe tijd wordt gepakt en in het scorebord geramd ===== */
.slamgrp { position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none; will-change: transform; }
.slamnum { font-family: var(--px); font-size: 14px; font-variant-numeric: tabular-nums; color: var(--yellow); white-space: nowrap; transform: translate(-50%, -50%);
  text-shadow: 2px 2px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 0 0 14px #ffe066aa; }
.slamhand { position: absolute; left: -28px; top: -52px; width: 56px; height: 40px; image-rendering: pixelated; filter: drop-shadow(0 4px 0 #0006); }
.slamflash { position: fixed; inset: 0; z-index: 88; pointer-events: none; background: #fff; animation: slamflash .26s ease-out both; }
.slamring { position: fixed; z-index: 89; width: 24px; height: 24px; margin: -12px 0 0 -12px; border: 4px solid var(--yellow); border-radius: 50%; pointer-events: none; animation: slamring .65s ease-out both; }
.slambam { position: fixed; z-index: 91; transform: translate(-50%, -50%); font-family: var(--px); font-size: 30px; color: var(--yellow); pointer-events: none; white-space: nowrap;
  text-shadow: 3px 3px 0 #000, -3px -3px 0 #000, 3px -3px 0 #000, -3px 3px 0 #000, 0 0 18px var(--orange); animation: slambam 1.05s ease-out both; }
.slamshake { animation: slamshake .5s linear both; }
.slamrow { animation: slamrow 1.3s ease-out both; }
.slamstamp { display: inline-block; animation: slamstamp .6s cubic-bezier(.2, 1.6, .4, 1) both; }
.slamtab { animation: slamrow 1s ease-out both; }
@keyframes slamflash { from { opacity: .45; } to { opacity: 0; } }
@keyframes slamring { from { transform: scale(.4); opacity: 1; } to { transform: scale(9); opacity: 0; } }
@keyframes slambam { 0% { transform: translate(-50%, -50%) scale(.2) rotate(-12deg); opacity: 0; } 18% { transform: translate(-50%, -50%) scale(1.5) rotate(6deg); opacity: 1; } 35% { transform: translate(-50%, -50%) scale(1) rotate(-3deg); }
  80% { opacity: 1; transform: translate(-50%, -78%) scale(1); } 100% { transform: translate(-50%, -110%) scale(1); opacity: 0; } }
@keyframes slamshake { 0%, 100% { transform: translate(0, 0); } 12% { transform: translate(-7px, 5px) rotate(-.4deg); } 26% { transform: translate(6px, -5px) rotate(.4deg); } 40% { transform: translate(-5px, 3px); }
  55% { transform: translate(4px, -3px); } 70% { transform: translate(-2px, 2px); } 85% { transform: translate(1px, -1px); } }
@keyframes slamrow { 0% { background: #ffe066; box-shadow: 0 0 0 4px #ffe066; } 100% { background: transparent; box-shadow: 0 0 0 0 #ffe06600; } }
@keyframes slamstamp { from { transform: scale(2.2); color: #fff; } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .slamflash, .slamring, .slambam, .slamshake, .slamrow, .slamstamp, .slamtab { animation: none; } }

/* ---- belletje met gemiste berichten (zonder geluid) ---- */
.chatbell { position: relative; display: inline-block; width: 15px; height: 15px; margin-left: 8px; vertical-align: -3px; color: #1a0e00; opacity: .45; transform-origin: 50% 0; }
.vtab .chatbell { color: currentColor; }
.chatbell .bellsvg { display: block; width: 15px; height: 15px; }
.chatbell.has { opacity: 1; animation: bellring 2.4s ease-in-out infinite; }
.chatmiss { position: absolute; top: -9px; right: -11px; min-width: 15px; padding: 2px 3px; background: #e83a4a; color: #fff; font-size: 7px; line-height: 1.1; text-align: center; box-shadow: 0 0 0 2px var(--edge); font-weight: normal; }
@keyframes bellring { 0%, 55%, 100% { transform: rotate(0); } 60% { transform: rotate(16deg); } 66% { transform: rotate(-14deg); } 72% { transform: rotate(10deg); } 78% { transform: rotate(-6deg); } 84% { transform: rotate(0); } }
@media (prefers-reduced-motion: reduce) { .chatbell.has { animation: none; } }

/* ghost-knop onder het spel */
.ghostbtn { margin-left: auto; height: 28px; padding: 0 12px; font-size: 8px; }
.ghostbtn:disabled { opacity: .45; cursor: default; }
.ghostbtn[aria-pressed="true"] { background: #6ebeff; color: #04223a; box-shadow: inset -4px -4px 0 0 #3f8fcf, inset 4px 4px 0 0 #c8e6ff, 0 0 0 4px var(--edge); }

/* ghost-knop tussen de spelknoppen (aanraakscherm) */
#touch .tbar .ghostbtn { margin: 0; height: 34px; font-size: 9px; padding: 0 16px; }
#touch .tbar .ghostbtn[aria-pressed="true"] { background: #6ebeff77; border-color: #c8e6ffcc; color: #fff; box-shadow: none; }
#touch .tbar .ghostbtn:disabled { opacity: .5; }

/* ===== welkomstscherm voor een nieuwe speler: gigantische Pim ===== */
.welcome { position: fixed; inset: 0; z-index: 95; display: flex; align-items: center; justify-content: center; gap: clamp(16px, 5vw, 80px); padding: 24px;
  background: rgba(5, 7, 20, .42); animation: wlbg .35s ease-out both; overflow: hidden; cursor: pointer; outline: none; }   /* de startpagina blijft zichtbaar, alleen gedimd */
.welcome.out { animation: wlout .45s ease-in both; }
.wl-pim { flex: none; image-rendering: pixelated; filter: drop-shadow(0 14px 0 #0009) drop-shadow(0 0 28px #0008); animation: wlpim .9s cubic-bezier(.2, 1.35, .35, 1) both, wlbob 1.7s ease-in-out .9s infinite; align-self: flex-end; margin-bottom: 3vh; }
.wl-bubble { position: relative; max-width: min(50vw, 600px); padding: clamp(14px, 3vw, 34px); background: #fff; color: #11162e; text-align: center; box-shadow: 0 0 0 6px #11162e, 0 12px 0 6px #0008; animation: wlbubble .6s cubic-bezier(.2, 1.4, .4, 1) .5s both; }
.wl-bubble::before { content: ''; position: absolute; left: -26px; bottom: 28%; border: 14px solid transparent; border-right: 18px solid #11162e; }
.wl-bubble::after { content: ''; position: absolute; left: -17px; bottom: calc(28% + 4px); border: 10px solid transparent; border-right: 14px solid #fff; }
.wl-hi { font-size: clamp(14px, 2.6vw, 30px); color: #f07a22; }
.wl-name { margin: clamp(8px, 1.6vw, 18px) 0; line-height: 1.25; color: #11162e; white-space: nowrap; }
.wl-sub { font-size: clamp(9px, 1.5vw, 18px); line-height: 1.7; color: #18a890; }
.wl-hint { margin-top: clamp(12px, 2vw, 24px); font-size: clamp(7px, 1.1vw, 11px); color: #6a6f94; animation: wlblink 1.4s steps(2) infinite; }
.wl-conf { position: absolute; top: -16px; width: 11px; height: 11px; pointer-events: none; animation: pbfall linear infinite; }
@keyframes wlbg { from { opacity: 0; } }
@keyframes wlout { to { opacity: 0; transform: scale(1.04); } }
@keyframes wlpim { from { transform: translateY(110vh) rotate(-10deg) scale(.8); } to { transform: none; } }
@keyframes wlbob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.4vh); } }
@keyframes wlbubble { from { opacity: 0; transform: scale(.3) translateX(-60px); } }
@keyframes wlblink { 50% { opacity: .25; } }
@media (max-width: 760px) {
  .welcome { flex-direction: column-reverse; justify-content: flex-end; gap: 22px; padding-top: 5vh; }
  .wl-pim { align-self: center; margin-bottom: 0; }
  .wl-bubble { max-width: 90vw; }
  .wl-bubble::before, .wl-bubble::after { left: 50%; bottom: -30px; margin-left: -14px; border-right-color: transparent; border-top-color: #11162e; border-width: 18px 14px 14px; }
  .wl-bubble::after { bottom: -22px; margin-left: -10px; border-width: 14px 10px 10px; border-top-color: #fff; border-right-color: transparent; }
}
@media (prefers-reduced-motion: reduce) { .welcome, .welcome.out, .wl-pim, .wl-bubble, .wl-hint { animation: none; } }

/* waarschuwing: kaart-keuzes nog niet opgeslagen */
.pc-warn { margin: 0 0 14px; padding: 12px 14px; background: #3a1018; color: #ffd6dc; border-left: 6px solid var(--red); box-shadow: 0 0 0 3px var(--edge); font-size: 8px; line-height: 1.7; }
.pc-warn b { display: block; margin-bottom: 4px; color: #fff; font-size: 10px; }
.pc-warn .row { margin-top: 10px; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.pc-nudge { animation: pcnudge .6s ease-in-out 2; }
@keyframes pcnudge { 0%, 100% { transform: none; } 20% { transform: translateX(-5px) scale(1.06); } 40% { transform: translateX(5px) scale(1.06); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
@media (prefers-reduced-motion: reduce) { .pc-nudge { animation: none; outline: 3px solid var(--yellow); outline-offset: 3px; } }

/* ===== easter egg: blackhole (typ het woord) ===== */
.bh { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .18); cursor: none; transition: opacity 1.4s ease-in; }
.bh.bh-out { opacity: 0; pointer-events: none; }
.bh-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.bh-count { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2.5vh; text-align: center; pointer-events: none; }
.bh-title { font-size: clamp(12px, 2.8vw, 36px); color: #ff9a3c; letter-spacing: .08em; text-shadow: 0 0 18px #ff6a00, 3px 3px 0 #000; }
.bh-num { font-size: clamp(90px, 28vw, 340px); line-height: 1; color: #fff; font-variant-numeric: tabular-nums; text-shadow: 0 0 40px #ff7a1a, 0 0 90px #ff4a00, 6px 6px 0 #000; }
.bh-num.pulse { animation: bhpulse .95s ease-out both; }
.bh-num.hot { color: #ff5a4a; text-shadow: 0 0 40px #ff1a00, 0 0 100px #ff0000, 6px 6px 0 #000; }
.bh-esc { font-size: clamp(7px, 1vw, 10px); color: #ffffff66; }
.bh-hint { position: absolute; left: 0; right: 0; bottom: 12vh; padding: 0 20px; text-align: center; color: #ffffff66; font-size: clamp(8px, 1.4vw, 14px); opacity: 0; transition: opacity 2.5s ease; pointer-events: none; }
.bh-hint.on { opacity: 1; animation: bhblink 3s ease-in-out infinite; }
.bh-shake { animation: bhshake .11s linear infinite; }
@keyframes bhpulse { 0% { transform: scale(1.35); opacity: .2; } 25% { transform: scale(1); opacity: 1; } 100% { transform: scale(.94); opacity: .92; } }
@keyframes bhshake { 0% { transform: translate(var(--bhs, 0), 0); } 25% { transform: translate(0, var(--bhs, 0)); } 50% { transform: translate(calc(var(--bhs, 0) * -1), 0); } 75% { transform: translate(0, calc(var(--bhs, 0) * -1)); } 100% { transform: translate(var(--bhs, 0), 0); } }
@keyframes bhblink { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .bh-num.pulse, .bh-shake, .bh-hint.on { animation: none; } }

/* ===== galaxy (easteregg): achtergrond 20 en rand 26, bij elkaar ontworpen: dezelfde paarse nevel ===== */
@property --tw1 { syntax: '<number>'; inherits: false; initial-value: 1; }
@property --tw2 { syntax: '<number>'; inherits: false; initial-value: 0.35; }
.dlg.pc-bg-20, .pc-sw.sw-20 {
  --hs: 110px; --hx: 20px; --hy: 6px;   /* grootte en plek van het zwarte gat (TON 618): klein, rechtsboven naast de naam */
  background:
    radial-gradient(ellipse 50% 6.5% at 50% 50%, #fff4dcdd 0, #ffbe70aa 45%, transparent 85%) right var(--hx) top var(--hy) / var(--hs) var(--hs) no-repeat,
    radial-gradient(circle at 50% 50%, #000 0 23%, #fff0cc 25%, #ffa84a 29%, #c4461a 36%, #5a1a2a 45%, transparent 56%) right var(--hx) top var(--hy) / var(--hs) var(--hs) no-repeat,
    radial-gradient(circle at 50% 50%, #ff8a3a40 0, #ff8a3a14 45%, transparent 70%) right var(--hx) top var(--hy) / calc(var(--hs) * 2) calc(var(--hs) * 2) no-repeat,
    radial-gradient(2px 2px at 30px 40px, rgb(255 255 255 / var(--tw1)), transparent 65%) 0 0 / 160px 160px,
    radial-gradient(2px 2px at 110px 120px, rgb(190 220 255 / var(--tw2)), transparent 65%) 0 0 / 160px 160px,
    radial-gradient(1px 1px at 40px 25px, #ffffffaa, transparent 70%) 0 0 / 70px 70px,
    radial-gradient(1px 1px at 20px 60px, #ffe6c8aa, transparent 70%) 0 0 / 110px 110px,
    radial-gradient(ellipse 55% 45% at 20% 25%, #8a35ff70, transparent 70%) 0 0 / 170% 170%,
    radial-gradient(ellipse 50% 45% at 85% 75%, #ff3ea560, transparent 70%) 0 0 / 170% 170%,
    radial-gradient(ellipse 65% 50% at 70% 15%, #19b4ff48, transparent 70%) 0 0 / 170% 170%,
    #060320;
}
.pc-sw.sw-20 { --hs: 40px; --hx: 4px; --hy: 2px; }
/* de animatie van de achtergrond krijgt specificiteit 0: een geanimeerde rand (eigen animation) wint dan niet per ongeluk van de achtergrond */
:where(.dlg.pc-bg-20, .pc-sw.sw-20) { animation: galaxyDrift 90s linear infinite, galaxyTw1 2.6s ease-in-out infinite alternate, galaxyTw2 3.7s ease-in-out infinite alternate; }
@keyframes galaxyDrift {
  0% { background-position: right var(--hx) top var(--hy), right var(--hx) top var(--hy), right var(--hx) top var(--hy), 0px 0px, 0px 0px, 0px 0px, 0px 0px, 0% 0%, 100% 100%, 50% 0%, 0 0; }
  25% { background-position: right var(--hx) top var(--hy), right var(--hx) top var(--hy), right var(--hx) top var(--hy), -40px 40px, 40px 40px, -35px 35px, 0px -27px, 60% 30%, 40% 80%, 100% 40%, 0 0; }
  50% { background-position: right var(--hx) top var(--hy), right var(--hx) top var(--hy), right var(--hx) top var(--hy), -80px 80px, 80px 80px, -70px 70px, 0px -55px, 100% 100%, 0% 0%, 50% 100%, 0 0; }
  75% { background-position: right var(--hx) top var(--hy), right var(--hx) top var(--hy), right var(--hx) top var(--hy), -120px 120px, 120px 120px, -105px 105px, 0px -82px, 40% 70%, 70% 30%, 0% 60%, 0 0; }
  100% { background-position: right var(--hx) top var(--hy), right var(--hx) top var(--hy), right var(--hx) top var(--hy), -160px 160px, 160px 160px, -140px 140px, 0px -110px, 0% 0%, 100% 100%, 50% 0%, 0 0; }
}
@keyframes galaxyTw1 { from { --tw1: 1; } to { --tw1: 0.25; } }
@keyframes galaxyTw2 { from { --tw2: 0.2; } to { --tw2: 1; } }

/* galaxy-rand: een lichtstraal met staart die rond het kader rent (conic-gradient als randafbeelding), in dezelfde paarse tint als de nevel, met een zachte pulserende gloed */
@property --ga { syntax: '<angle>'; inherits: true; initial-value: 0deg; }
@property --gp { syntax: '<number>'; inherits: true; initial-value: 4; }
.pc-bd-26 {
  --gb: 8px;
  animation: gxSpin 2.6s linear infinite, gxPulse 1.8s ease-in-out infinite alternate;
  border: var(--gb) solid transparent !important;
  border-image: conic-gradient(from var(--ga), #f6e8ff 0deg, #c58bff 22deg, #8a45ff 80deg, #5a2cc0 170deg, #2e1670 290deg, #5a2cc0 340deg, #f6e8ff 360deg) 1 !important;
  padding: calc(22px - var(--gb)) !important;
  box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #8a45ff, 0 0 calc(var(--gp) * 5px) calc(var(--gp) * 1.5px) #8a45ff80 !important;
}
/* galaxy-achtergrond en galaxy-rand samen: beide animaties tegelijk */
.dlg.pc-bg-20.pc-bd-26 { animation: gxSpin 2.6s linear infinite, gxPulse 1.8s ease-in-out infinite alternate, galaxyDrift 90s linear infinite, galaxyTw1 2.6s ease-in-out infinite alternate, galaxyTw2 3.7s ease-in-out infinite alternate; }
.pc-demo.pc-bd-26 { --gb: 3px; padding: 0 !important; }
@keyframes gxSpin { to { --ga: 360deg; } }
@keyframes gxPulse { from { --gp: 2; } to { --gp: 6; } }
@media (prefers-reduced-motion: reduce) { .dlg.pc-bg-20, .pc-sw.sw-20, .dlg.pc-bg-20.pc-bd-26 { animation: none !important; } }

/* ===== easter egg: sickomode (typ het woord) ===== */
.sm { position: fixed; inset: 0; z-index: 200; cursor: none; background: transparent; transition: opacity .6s ease; }
.sm.sm-out { opacity: 0; pointer-events: none; }
.sm-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sm-hint { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; color: #ffffff55; font-size: 9px; pointer-events: none; }

/* ===== festival (easteregg sickomode): achtergrond 21 is het festival uit de easteregg (animatie zit in het plaatje zelf), rand 27 twee lasers die langs het kader gaan ===== */
.dlg.pc-bg-21, .pc-sw.sw-21 { background: linear-gradient(#0000004d, #00000026) 0 0 / 100% 100% no-repeat, url(festival-bg.svg?v=2) center bottom / cover no-repeat, #0a0010; }
.pc-sw.sw-21 { background-position: 0 0, 12% 100%; background-size: 100% 100%, 330% auto; }
.pc-bd-27 {
  --gb: 7px;
  animation: gxSpin 3.4s linear infinite;
  border: var(--gb) solid transparent !important;
  border-image: conic-gradient(from var(--ga), #1a0a22 0deg 100deg, #3dff7a30 135deg, #3dff7a 176deg, #eafff0 180deg, #1a0a22 181deg 280deg, #ff2a6a30 315deg, #ff2a6a 356deg, #ffe6ee 360deg) 1 !important;
  padding: calc(22px - var(--gb)) !important;
  box-shadow: 0 0 0 4px var(--edge), 0 0 0 7px #1a0a22,
    calc(sin(var(--ga) + 180deg) * 16px) calc(cos(var(--ga) + 180deg) * -16px) 16px 2px #3dff7a99,
    calc(sin(var(--ga)) * 16px) calc(cos(var(--ga)) * -16px) 16px 2px #ff2a6a99 !important;
}
.pc-demo.pc-bd-27 { --gb: 3px; padding: 0 !important; }
/* galaxy-achtergrond met laser-rand: beide animaties */
.dlg.pc-bg-20.pc-bd-27 { animation: gxSpin 3.4s linear infinite, galaxyDrift 90s linear infinite, galaxyTw1 2.6s ease-in-out infinite alternate, galaxyTw2 3.7s ease-in-out infinite alternate; }
@media (prefers-reduced-motion: reduce) { .dlg.pc-bg-20.pc-bd-27 { animation: none !important; } }

/* ===== techno (easteregg): achtergrond 22 is de loods van buiten (animatie zit in het plaatje zelf), rand 28 is een rode industriële waarschuwingsrand die op de kick pulseert ===== */
.dlg.pc-bg-22, .pc-sw.sw-22 { background: linear-gradient(#00000040, #00000020) 0 0 / 100% 100% no-repeat, url(club-bg.svg?v=2) center bottom / cover no-repeat, #05060a; }
.pc-sw.sw-22 { background-position: 0 0, 50% 88%; background-size: 100% 100%, 250% auto; }
@property --so { syntax: '<length>'; inherits: true; initial-value: 0px; }
@property --gk { syntax: '<number>'; inherits: true; initial-value: 0.2; }
.pc-bd-28 {
  --gb: 8px;
  animation: tkMarch 1.1s linear infinite, tkKick 0.448s ease-out infinite;   /* 0,448 s = één kick bij 134 bpm */
  border: var(--gb) solid transparent !important;
  border-image: repeating-linear-gradient(45deg, #0a0206 var(--so), #0a0206 calc(var(--so) + 7px), #d0102c calc(var(--so) + 7px), #d0102c calc(var(--so) + 14px)) 1 !important;
  padding: calc(22px - var(--gb)) !important;
  box-shadow: 0 0 0 4px var(--edge), 0 0 calc(10px + var(--gk) * 40px) calc(var(--gk) * 10px) rgba(255, 24, 56, calc(0.22 + var(--gk) * 0.55)) !important;
}
.pc-demo.pc-bd-28 { --gb: 3px; padding: 0 !important; }
@keyframes tkMarch { to { --so: 14px; } }
@keyframes tkKick { from { --gk: 1; } to { --gk: 0.1; } }
/* galaxy-achtergrond met kick-rand: beide animaties */
.dlg.pc-bg-20.pc-bd-28 { animation: tkMarch 1.1s linear infinite, tkKick 0.448s ease-out infinite, galaxyDrift 90s linear infinite, galaxyTw1 2.6s ease-in-out infinite alternate, galaxyTw2 3.7s ease-in-out infinite alternate; }
@media (prefers-reduced-motion: reduce) { .dlg.pc-bg-20.pc-bd-28 { animation: none !important; } }
