/* Boerenerf 2.0, het draaivenster: schermvullend boven de spelkaart, in de laag van spel.css */
@layer spel {
  .spel.sd {
    --sd-smin: 72px; --sd-smax: clamp(96px, 22dvh, 176px); --sd-rand: 16px; --sd-onder: clamp(20px, 5dvh, 56px);
    position: fixed; inset: 0; z-index: 3000; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(calc(var(--sd-smin) + var(--sd-onder)), 1fr) minmax(0, auto);
    overflow: hidden; background: var(--sp-lucht); overscroll-behavior: none; -webkit-tap-highlight-color: transparent;
  }
  .spel.sd:focus, .spel.sd:focus-visible { outline: none; }
  .sd p, .sd h2, .sd h3, .sd ul { margin: 0; }
  .sd svg.sd-ic { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
  .sd img { display: block; max-width: none; }

  .sd .sd-kop {
    position: relative; z-index: 2; grid-row: 1; grid-column: 1; display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; align-items: start; gap: 8px;
    padding: calc(env(safe-area-inset-top, 0px) + 12px) calc(env(safe-area-inset-right, 0px) + var(--sd-rand)) 0 calc(env(safe-area-inset-left, 0px) + var(--sd-rand));
  }
  .sd .sd-sluit {
    display: grid; place-items: center; width: 48px; height: 48px; min-height: 48px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
    background: var(--sp-kaart); color: var(--sp-inkt); box-shadow: 0 5px 0 var(--sp-rand); transition: transform 120ms var(--ease, ease-out);
  }
  .sd .sd-sluit:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--sp-rand); }
  .sd .sd-naam { grid-column: 2; text-align: center; padding-top: 2px; min-width: 0; }
  .sd .sd-naam h2 { font-size: 28px; line-height: 1.1; overflow-wrap: anywhere; text-wrap: balance; }
  @media (max-width: 359px) { .sd .sd-naam h2 { font-size: 23px; } }
  .sd .sd-soort { display: inline-block; margin-top: 6px; padding: 2px 12px; border-radius: 999px; background: var(--sp-kaart); font-size: 14px; font-weight: 700; line-height: 1.5; box-shadow: 0 3px 0 var(--sp-rand); }

  .sd .sd-toneel { position: relative; z-index: 1; grid-row: 2; grid-column: 1; display: grid; place-items: end center; min-height: 0; container-type: size; padding-bottom: var(--sd-onder); }
  .sd .sd-zon, .sd .sd-wolk { position: absolute; z-index: 0; pointer-events: none; }
  .sd .sd-zon { top: 18px; right: calc(8% + 10px); width: 52px; height: 52px; border-radius: 50%; background: var(--sp-geel); box-shadow: 0 0 0 10px color-mix(in srgb, var(--sp-geel) 32%, var(--sp-kaart)); }
  .sd .sd-wolk { top: 30px; left: 8%; width: 84px; height: 26px; border-radius: 999px; background: var(--sp-kaart); opacity: .9; box-shadow: 30px -12px 0 -2px var(--sp-kaart); }
  @container (max-height: 170px) { .sd .sd-wolk { display: none; } }
  @container (max-height: 100px) { .sd .sd-zon { display: none; } }
  .sd .sd-podium { --sd-s: max(var(--sd-smin), min(var(--sd-smax), 100cqh)); position: relative; width: calc(var(--sd-s) * 1.5); height: var(--sd-s); }
  .sd .sd-land { position: absolute; left: 50%; top: calc(100% - var(--sd-s) * .26); width: 400vw; height: 100dvh; margin-left: -200vw; }
  .sd .sd-land > i { position: absolute; border-radius: 50%; }
  .sd .sd-heuvel--ver { left: calc(50% - var(--sd-s) * 3.3); top: calc(var(--sd-s) * -.7); width: calc(var(--sd-s) * 3.6); height: calc(var(--sd-s) * 1.5); background: var(--sp-veld); }
  .sd .sd-heuvel--bij { left: calc(50% - var(--sd-s) * .2); top: calc(var(--sd-s) * -.36); width: calc(var(--sd-s) * 4.2); height: calc(var(--sd-s) * 1.2); background: var(--sp-gras); }
  .sd .sd-veld { left: 0; right: 0; top: 0; bottom: 0; border-radius: 0; background: var(--sp-gras); }
  .sd .sd-plateau { position: absolute; left: 50%; bottom: 0; width: calc(var(--sd-s) * 1.4); height: calc(var(--sd-s) * .36); margin-left: calc(var(--sd-s) * -.7); border-radius: 50%; background: var(--sp-groen-licht); box-shadow: 0 8px 0 var(--sp-veld); }
  .sd .sd-schaduw { position: absolute; left: 50%; bottom: calc(var(--sd-s) * .1); width: calc(var(--sd-s) * .9); height: calc(var(--sd-s) * .12); margin-left: calc(var(--sd-s) * -.45); border-radius: 50%; background: color-mix(in srgb, var(--sp-inkt) 14%, transparent); }
  .sd .sd-schuur { position: absolute; left: 50%; bottom: calc(var(--sd-s) * .14); width: calc(var(--sd-s) * .84); height: calc(var(--sd-s) * .756); margin-left: calc(var(--sd-s) * -.42); z-index: 2; transform-origin: 50% 100%; }
  .sd .sd-schuur .sk-schuur { display: block; width: 100%; height: 100%; filter: drop-shadow(0 3px 0 color-mix(in srgb, var(--sp-inkt) 18%, transparent)); }
  .sd .sk-schuur-muur { fill: var(--sp-schuur); }
  .sd .sk-schuur-dak, .sd .sk-schuur-wit { fill: var(--sp-kaart); }

  .sd .sd-paneel {
    position: relative; z-index: 2; grid-row: 3; grid-column: 1; width: auto; max-width: 520px; min-height: 0; box-sizing: border-box; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 14px; overflow: hidden;
    margin: 0 calc(env(safe-area-inset-right, 0px) + var(--sd-rand)) calc(env(safe-area-inset-bottom, 0px) + 20px) calc(env(safe-area-inset-left, 0px) + var(--sd-rand));
    padding: 18px 18px 20px;
  }
  @media (min-width: 552px) { .sd .sd-paneel { margin-left: auto; margin-right: auto; width: 520px; } }
  @media (max-width: 359px) { .sd .sd-paneel { padding: 16px 14px 18px; } }
  .sd .sd-tekst { display: grid; align-content: start; gap: 10px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: -4px -6px; padding: 4px 6px; }
  .sd .sd-tekst:focus { outline: none; }
  .sd .sd-tekst.is-meer { mask-image: linear-gradient(to bottom, var(--sp-inkt) calc(100% - 28px), transparent); }
  .sd .sd-knoppen[hidden] { display: none; }
  .sd .sd-tekst > p { font-size: 18px; line-height: 1.35; font-weight: 600; }
  .sd .sd-knoppen { display: grid; gap: 10px; padding-bottom: 5px; }
  .sd .sd-breed { justify-self: stretch; min-height: 56px; font-size: 19px; }
  .sd .sd-breed:disabled { cursor: default; opacity: .6; }

  .sd .sd-uitslag { display: grid; gap: 10px; }
  .sd .sd-uitslag-kop { font-size: 22px; line-height: 1.15; }
  .sd .sd-uitslag-kop:focus { outline: none; }
  .sd .sd-uitslag-kop:focus-visible { outline: 3px solid var(--sp-inkt); outline-offset: 3px; border-radius: 6px; }
  .sd .sd-items { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 0 2px; list-style: none; }
  .sd .sd-items li { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 44px; box-sizing: border-box; padding: 4px 14px 4px 4px; border-radius: 999px; background: var(--sp-zand); box-shadow: 0 3px 0 var(--sp-rand); }
  .sd .sd-item-ic { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--sp-kaart); }
  .sd .sd-item-ic > * { width: 30px; height: 30px; }
  .sd .sd-item-naam { min-width: 0; font-size: 15px; line-height: 1.15; font-weight: 700; }
  .sd .sd-item-n { flex: none; font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
  .sd .sd-bonus { justify-self: start; padding: 2px 12px; border-radius: 999px; background: var(--sp-geel); box-shadow: 0 3px 0 var(--sp-geel-rand); font-size: 14px; font-weight: 800; }
  .sd .sd-plek { padding: 10px 14px; border-radius: 16px; background: color-mix(in srgb, var(--sp-geel) 30%, var(--sp-kaart)); font-size: 16px; line-height: 1.35; font-weight: 700; }
  .sd .sd-rij { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .sd .sd-stempel, .sd .sd-punten { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; box-sizing: border-box; padding: 2px 14px 2px 8px; border-radius: 999px; font-size: 15px; font-weight: 800; line-height: 1.2; }
  .sd .sd-stempel { background: var(--sp-zand); box-shadow: 0 3px 0 var(--sp-rand); color: var(--sp-schuur); }
  .sd .sd-stempel span { color: var(--sp-inkt); }
  .sd .sd-punten { background: var(--sp-groen-licht); box-shadow: 0 3px 0 var(--sp-gras); color: var(--sp-groen); }
  .sd .sd-extra { padding: 10px 14px; border-radius: 18px; background: var(--sp-groen-licht); }
  .sd .sd-extra-kop { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 800; }
  .sd .sd-extra ul { margin-top: 4px; padding-left: 22px; font-size: 15px; line-height: 1.35; font-weight: 600; }

  .sd.is-uitslag { --sd-smin: 56px; --sd-smax: clamp(64px, 14dvh, 120px); --sd-onder: 16px; }

  @media (max-height: 480px) and (orientation: landscape) {
    .spel.sd, .sd.is-uitslag { --sd-onder: 20px; --sd-smin: 72px; --sd-smax: clamp(88px, 40dvh, 150px); --sd-kol: min(420px, max(300px, 50%)); grid-template-columns: minmax(0, 1fr) var(--sd-kol); grid-template-rows: auto minmax(calc(var(--sd-smin) + var(--sd-onder)), 1fr); }
    .sd .sd-kop { grid-column: 1; }
    .sd .sd-toneel { grid-column: 1; grid-row: 2; }
    .sd .sd-paneel { grid-column: 2; grid-row: 1 / 3; align-self: center; width: auto; max-height: calc(100dvh - 32px); margin: 16px calc(env(safe-area-inset-right, 0px) + var(--sd-rand)) 16px 0; }
    .sd .sd-naam h2 { font-size: 24px; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .sd .sd-sluit:active { transform: none; }
  .spel.sd, .sd *, .sd *::before, .sd *::after { transition-property: none !important; animation-name: none !important; }
}
