/* Spilkit (spilkit.js): fælles værktøjslinje, dialog, statistik, arkiv og læsehjælp for dagens-spillene.
   Farverne kommer fra spillets egne variabler (--bjaelke, --knap, --creme, --roed), så hvert spil beholder sit bord. */

/* Højre side af bjælken: ens ikonknapper, teksten vises når der er plads */
#kk-bar.sk-bar { align-items: center; }
.sk-hoejre { display: flex; gap: 6px; margin-left: auto; flex: none; }
#kk-bar button.sk-ikon { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; padding: 0 10px; }
.sk-ikon svg, .sk-luk svg, .sk-mdnav svg, .sk-del svg { width: 22px; height: 22px; flex: none; background: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sk-tekst { display: none; }
@media (min-width: 900px) { .sk-tekst { display: inline; } }
#kk-bar.sk-bar > button, #kk-bar.sk-bar > select { white-space: nowrap; }
@media (max-width: 420px) {
  #kk-bar.sk-bar { gap: 4px; }
  #kk-bar.sk-bar > button { padding-left: 6px; padding-right: 6px; min-width: 0; }
  #kk-bar.sk-bar .sk-hoejre { gap: 4px; }
  #kk-bar.sk-bar button.sk-ikon { flex: none; min-width: 44px; width: 44px; padding: 0; }
  /* Nyt spil og Dagens som ikoner fra første frame (ren CSS); teksten bliver i knappen som navn til skærmlæsere (24.10) */
  html body #kk-bar > button:is(#nyt, #dagens) { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; min-width: 44px; padding: 0; font-size: 0; overflow: hidden; }
  html body #kk-bar > button:is(#nyt, #dagens)::before { content: ""; width: 22px; height: 22px; flex: none; background: currentColor;
    -webkit-mask: var(--sk-m) center / 22px 22px no-repeat; mask: var(--sk-m) center / 22px 22px no-repeat; }
  #kk-bar > #nyt { --sk-m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 12a8 8 0 1 1-2.6-5.9'/%3E%3Cpath d='M20 4v5h-5'/%3E%3C/svg%3E"); }
  #kk-bar > #dagens { --sk-m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5' width='17' height='15.5' rx='2.5'/%3E%3Cpath d='M3.5 10h17M8 3v4M16 3v4'/%3E%3Ccircle cx='12' cy='15' r='1.6' fill='%23000'/%3E%3C/svg%3E"); }
}
#kk-bar.sk-taet { flex-wrap: wrap; }
#kk-bar > .sk-vaek { display: none !important; }
@media (max-width: 420px) { #kk-bar > select[data-smal="visning"] { display: none !important; } } /* står under Visning på smal skærm (spilkit.js) */ /* valgfri knap (lyd), når pladsen ikke rækker */
#kk-bar.sk-taet > select { order: 10; flex: 1 1 40%; min-width: 0; } /* flere vælgere deler den nye linje */
#kk-bar button:focus-visible, #sk-dialog button:focus-visible { outline: 3px solid var(--creme, #FCF7EE); outline-offset: 2px; }

/* Uret kan slås fra i Aa (intet tidspres); spillene giver tiden klassen sk-ur */
html.sk-uden-ur .sk-ur { display: none !important; }

/* Dialogen: native <dialog> (fokus, Esc og baggrund klarer browseren) */
#sk-dialog {
  width: min(calc(100vw - 24px), 460px); max-height: calc(100dvh - 24px); box-sizing: border-box; padding: 0; overflow: auto;
  border: 1px solid rgba(252,247,238,.25); border-radius: 16px; background: var(--bjaelke, #172F20); color: var(--creme, #FCF7EE);
  font: 400 16px/1.45 Poppins, system-ui, sans-serif; box-shadow: 0 18px 48px rgba(0,0,0,.45);
}
#sk-dialog::backdrop { background: rgba(0,0,0,.5); }
#sk-dialog[open] { animation: sk-ind 180ms ease-out; }
@keyframes sk-ind { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { #sk-dialog[open] { animation: none; } }
.sk-hoved { display: flex; align-items: center; gap: 8px; padding: 12px 10px 4px 20px; }
.sk-hoved h2 { flex: 1; margin: 0; font: 600 20px/1.25 Poppins, system-ui, sans-serif; }
#sk-dialog button { font: 600 16px/1.2 Poppins, system-ui, sans-serif; color: inherit; cursor: pointer; touch-action: manipulation; }
.sk-luk { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: transparent; }
.sk-luk:hover { background: rgba(252,247,238,.1); }
.sk-krop { padding: 4px 20px 20px; }
.sk-krop p { margin: 0 0 10px; }
.sk-lbl { font-weight: 600; font-size: 14px; letter-spacing: .02em; opacity: .85; margin: 14px 0 8px !important; }
.sk-note { font-size: 14px; opacity: .8; margin-top: 14px !important; }

/* Tekststørrelse og kontakter */
.sk-gruppe { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sk-ts { min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 10px; border: 1px solid rgba(252,247,238,.3); background: var(--knap, #2A5A3D); }
.sk-ts span { font-size: 18px; line-height: 1; }
.sk-ts1 span { font-size: 22px; } .sk-ts2 span { font-size: 27px; }
.sk-ts small { font: 400 14px/1 Poppins, system-ui, sans-serif; opacity: .9; }
#sk-dialog .sk-ts[aria-checked="true"] { background: var(--creme, #FCF7EE); color: var(--bjaelke, #172F20); border-color: var(--creme, #FCF7EE); box-shadow: inset 0 -4px 0 var(--roed, #C63F28); }
.sk-kontakt { width: 100%; min-height: 52px; margin-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 12px 0 14px; border-radius: 10px; border: 1px solid rgba(252,247,238,.22); background: rgba(252,247,238,.06); text-align: left; }
.sk-spor { position: relative; width: 48px; height: 28px; flex: none; border-radius: 14px; background: rgba(252,247,238,.25); transition: background .15s; }
.sk-spor span { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--creme, #FCF7EE); transition: transform .15s; }
.sk-kontakt[aria-checked="true"] .sk-spor { background: var(--roed, #C63F28); }
.sk-kontakt[aria-checked="true"] .sk-spor span { transform: translateX(20px); }
.sk-kontakt[aria-checked="true"] .sk-spor::after { content: ''; position: absolute; left: 9px; top: 9px; width: 8px; height: 5px; border: solid var(--creme, #FCF7EE); border-width: 0 0 2px 2px; transform: rotate(-45deg); }

/* Tal og tider */
.sk-tal { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 4px; text-align: center; }
.sk-tal div { padding: 10px 4px; border-radius: 10px; background: rgba(252,247,238,.08); }
.sk-tal b { display: block; font: 600 26px/1.1 Poppins, system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.sk-tal span { display: block; font-size: 14px; line-height: 1.25; opacity: .85; margin-top: 2px; }
.sk-tider { list-style: none; margin: 0; padding: 0; }
.sk-tider li { display: flex; justify-content: space-between; padding: 7px 2px; border-bottom: 1px solid rgba(252,247,238,.15); }
.sk-tider b { font-variant-numeric: tabular-nums; }
.sk-uge li { padding: 5px 2px; }
.sk-uge li.idag { font-weight: 600; }
/* Pause: brættet dækkes, så tiden ikke løber, mens man ser væk */
.sk-pause { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--bjaelke, #172F20); color: var(--creme, #FCF7EE); border-radius: 8px; font: 600 22px/1.3 Poppins, system-ui, sans-serif; }
.sk-pause button { min-height: 52px; padding: 0 28px; border-radius: 10px; border: 0; background: var(--roed, #C63F28); color: #fff; font: 600 17px/1.2 Poppins, system-ui, sans-serif; cursor: pointer; }
.sk-pause button:focus-visible { outline: 3px solid var(--creme, #FCF7EE); outline-offset: 3px; }

/* Arkivet: en månedskalender, dage før start og efter i dag kan ikke åbnes */
.sk-mdnav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sk-mdnav span { font-weight: 600; }
.sk-mdnav button { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid rgba(252,247,238,.25); background: transparent; }
.sk-mdnav button:disabled { opacity: .3; cursor: default; }
.sk-kal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.sk-ugedag { text-align: center; font-size: 14px; opacity: .75; padding-bottom: 2px; }
.sk-kal button { position: relative; aspect-ratio: 1; min-height: 40px; border-radius: 10px; border: 1px solid rgba(252,247,238,.2); background: var(--knap, #2A5A3D); font-variant-numeric: tabular-nums; padding: 0; }
.sk-kal button:disabled { background: transparent; border-color: transparent; opacity: .35; cursor: default; }
.sk-kal button.idag { border: 2px solid var(--creme, #FCF7EE); }
.sk-kal button.valgt { box-shadow: inset 0 -4px 0 var(--roed, #C63F28); }
#sk-dialog .sk-kal button.loest { background: var(--creme, #FCF7EE); color: var(--bjaelke, #172F20); }
.sk-kal button.loest::after { content: ''; position: absolute; right: 4px; top: 4px; width: 8px; height: 5px; border: solid var(--roed, #C63F28); border-width: 0 0 2px 2px; transform: rotate(-45deg); }

/* Sejr */
.sk-sejr .sk-krop > p:first-child { font-size: 18px; }
.sk-knapper { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.sk-knapper button { flex: 1 1 auto; min-height: 48px; padding: 0 16px; border-radius: 10px; border: 1px solid rgba(252,247,238,.3); background: var(--knap, #2A5A3D); display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
#sk-dialog .sk-knapper button.primaer { background: var(--roed, #C63F28); border-color: var(--roed, #C63F28); color: #fff; }
#sk-dialog .sk-knapper .sk-del { background: var(--creme, #FCF7EE); color: var(--bjaelke, #172F20); border-color: var(--creme, #FCF7EE); }
.sk-svar { min-height: 1.4em; margin: 8px 0 0 !important; font-size: 14px; }
.sk-sejr-boks { position: relative; }

/* Læsehjælp i spillet: tekststørrelse løfter bjælke, info, knapper og beskeder; brættet skalerer i forvejen efter pladsen */
html[data-ts="1"] :is(#kk-bar, #info, #kk-besked, #sk-dialog) { zoom: 1.12; }
html[data-ts="2"] :is(#kk-bar, #info, #kk-besked, #sk-dialog) { zoom: 1.25; }
html[data-ts] #kk-bar { flex-wrap: wrap !important; }
html[data-ts] #spil.side #info { zoom: 1; }
/* Høj kontrast: kraftige kanter, fuld tekstfarve, tydelige deaktiverede knapper og fokus */
html.kabale-hk { --kant: #fff; }
html.kabale-hk #kk-bar button, html.kabale-hk #kk-bar select, html.kabale-hk #pad button:not(.tal), html.kabale-hk #sk-dialog .sk-knapper button, html.kabale-hk .sk-ts, html.kabale-hk .sk-kontakt { border: 2px solid var(--creme, #FCF7EE) !important; }
html.kabale-hk #kk-bar button:disabled, html.kabale-hk #pad button:disabled { opacity: .6; border-style: dashed !important; }
html.kabale-hk #info, html.kabale-hk #rekord { opacity: 1 !important; }
html.kabale-hk :is(button, select, [tabindex]):focus-visible { outline: 4px solid #FFD54A !important; outline-offset: 2px; }
html.kabale-hk #sk-dialog { border: 2px solid var(--creme, #FCF7EE); }
html.kabale-hk .sk-lbl, html.kabale-hk .sk-note, html.kabale-hk .sk-tal span, html.kabale-hk .sk-ugedag { opacity: 1; }

/* Baneoversigt (casual-spillene): alle baner med nummer, navn og stjerner; låste baner kan ikke åbnes */
.sk-baner-gitter { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-top: 6px; }
#sk-dialog .sk-baner-gitter button { min-height: 76px; padding: 6px 4px; border-radius: 10px; border: 1px solid rgba(252,247,238,.3); background: var(--knap, #2A5A3D); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.sk-baner-gitter b { font-size: 20px; line-height: 1.1; }
.sk-baner-gitter small { font: 400 14px/1.2 Poppins, system-ui, sans-serif; opacity: .9; text-align: center; }
.sk-baner-gitter span { font-size: 15px; letter-spacing: 1px; color: #F0C463; }
#sk-dialog .sk-baner-gitter button.klaret { border-color: #D69A2D; }
#sk-dialog .sk-baner-gitter button.valgt { box-shadow: inset 0 -4px 0 var(--roed, #C63F28); }
#sk-dialog .sk-baner-gitter button:disabled { opacity: .5; cursor: default; }
.sk-baner-gitter button:disabled span { color: inherit; font-size: 14px; letter-spacing: 0; }
html.kabale-hk #sk-dialog .sk-baner-gitter button { border: 2px solid var(--creme, #FCF7EE) !important; }
html.kabale-hk .sk-baner-gitter small { opacity: 1; }
/* Valgliste i en dialog (fx Hjælp i ordspillene): store knapper med titel og en kort forklaring */
#sk-dialog .sk-valg { width: 100%; min-height: 56px; margin-top: 8px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding: 8px 14px; border-radius: 10px; border: 1px solid rgba(252,247,238,.25); background: var(--knap, #2A5A3D); text-align: left; }
#sk-dialog .sk-valg small { font: 400 14px/1.35 Poppins, system-ui, sans-serif; opacity: .88; }
#sk-dialog .sk-valg.primaer { background: var(--roed, #C63F28); border-color: var(--roed, #C63F28); color: #fff; }
#sk-dialog .sk-valg:disabled { opacity: .45; cursor: default; }
html.kabale-hk #sk-dialog .sk-valg { border: 2px solid var(--creme, #FCF7EE); }

/* Kom i gang (visTrin): billede, tekst og prikker for trinnene */
.sk-trin-billede { display: flex; justify-content: center; margin: 4px 0 14px; }
.sk-trin-billede svg { width: min(100%, 260px); height: auto; background: none; }
.sk-trin .sk-krop > p { font-size: 17px; }
.sk-prikker { display: flex; justify-content: center; gap: 8px; margin: 6px 0 2px; }
.sk-prikker span { width: 10px; height: 10px; border-radius: 50%; background: rgba(252,247,238,.3); }
.sk-prikker span.aktiv { background: var(--creme, #FCF7EE); box-shadow: 0 0 0 3px rgba(252,247,238,.25); }

/* Farveprøver i Visning (valg med muligheder, fx kortbagside og bord) */
.sk-farve .sk-proeve { display: block; width: 28px; height: 28px; border-radius: 50%; border: 2px solid currentColor; box-sizing: border-box; }
#sk-dialog .sk-farve[aria-checked="true"] .sk-proeve { box-shadow: 0 0 0 3px var(--roed, #C63F28); }
.sk-farve.sk-tekstvalg { min-height: 52px; }
.sk-farve.sk-tekstvalg small { font: 600 16px/1.2 Poppins, system-ui, sans-serif; }

/* Kom i gang på mobil (Esben 23.10): billedet krymper, så tekst og knapper altid er synlige; billedet ligger på et lille spillebord */
#sk-dialog.sk-trin[open] { display: flex; flex-direction: column; }
.sk-trin .sk-hoved h2 { font-size: 19px; }
.sk-trin .sk-krop { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding-bottom: 16px; }
.sk-trin .sk-trin-billede { flex: 1 1 150px; min-height: 76px; max-height: 172px; margin: 4px 0 16px; padding: 12px; box-sizing: border-box; border-radius: 12px;
  background: radial-gradient(ellipse at 50% 35%, rgba(255,255,255,.08), transparent 70%), var(--bord, #1F5A36); box-shadow: inset 0 0 0 1px rgba(252,247,238,.14), inset 0 -10px 24px rgba(0,0,0,.18); }
.sk-trin .sk-trin-billede svg { width: auto; height: 100%; max-width: 100%; }
.sk-trin .sk-krop > p { flex: none; font-size: 16px; text-align: center; margin: 0 4px 12px; }
.sk-trin .sk-prikker { flex: none; margin: 0; }
.sk-trin .sk-knapper { flex: none; flex-wrap: nowrap; margin-top: 14px; }
#sk-dialog.sk-trin .sk-knapper button:not(.primaer) { flex: 0 1 auto; background: transparent; border-color: transparent; opacity: .85; }
#sk-dialog.sk-trin .sk-knapper button:not(.primaer):hover { opacity: 1; text-decoration: underline; }
#sk-dialog.sk-trin .sk-knapper .primaer { flex: 1 1 auto; }
/* Lav ramme (små telefoner): billedet i lille størrelse (under 280 px uden), og knapperne bliver i bunden, hvis teksten alligevel skal rulle */
@media (max-height: 380px) {
  .sk-trin .sk-trin-billede { flex: 1 1 96px; min-height: 44px; max-height: 96px; margin: 0 0 8px; padding: 4px; }
  .sk-trin .sk-knapper { margin-top: 8px; }
  .sk-trin .sk-hoved { padding-top: 8px; }
  .sk-trin .sk-hoved h2 { font-size: 17px; }
  .sk-trin .sk-krop > p { font-size: 15px; margin-bottom: 8px; }
}
@media (max-height: 279px) { .sk-trin .sk-trin-billede { display: none; } }
.sk-trin .sk-knapper { position: sticky; bottom: -16px; padding-bottom: 2px; background: var(--bjaelke, #172F20); }
