/* Talbrikker: grønt spillebord med lyse brikker. Skrift, filt og bjælke kommer fra Solitaire.css og kabale-kort.css */
:root {
  --bord: #1F5A43;
  --bjaelke: #163626;
  --knap: #2C6B51;
  --brik: #FCF7EE;
  --kul: #1E2421;
  --roed: #C63F28;
  --guld: #D69A2D;
  --f0: #1E2421; --f1: #C0291B; --f2: #1F5FA8; --f3: #9A4806;
}
html.kabale-mork {
  --bord: #123627;
  --bjaelke: #0B1E15;
  --knap: #1E4A38;
  --brik: #F1E9DA;
}
body { background: var(--filt), var(--bord); color: var(--creme); font-variant-numeric: tabular-nums; }
button, select { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

#kk-bar { align-items: center; }
#kk-bar select {
  font: 600 15px/1.2 Poppins, system-ui, sans-serif; min-height: 44px; min-width: 0; padding: 0 34px 0 14px; border: 1px solid rgba(252,247,238,.22); border-radius: 8px;
  background: var(--knap) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23FCF7EE' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--creme); cursor: pointer; -webkit-appearance: none; appearance: none;
}
#kk-bar select option { background: #FCF7EE; color: #1E2421; }
#kk-bar button:focus-visible, #kk-bar select:focus-visible, #knapper button:focus-visible, #kk-besked button:focus-visible, .tb:focus-visible, .plads:focus-visible { outline: 3px solid var(--guld); outline-offset: 2px; }
@media (max-width: 480px) {
  #kk-bar { gap: 5px; padding: 6px; }
  #kk-bar button, #kk-bar select { flex: 1 1 auto; font-size: 14px; padding-left: 8px; padding-right: 8px; white-space: nowrap; }
  #kk-bar select { padding-right: 22px; background-position: right 7px center; }
}
@media (max-width: 360px) {
  #kk-bar { gap: 4px; padding: 6px 4px; }
  #kk-bar button, #kk-bar select { font-size: 13px; padding-left: 6px; padding-right: 6px; }
  #kk-bar select { padding-right: 18px; background-position: right 5px center; background-size: 9px 6px; }
}
#kk-bar.sk-bar.sk-taet > select { flex: 1 1 calc(33% - 6px); }

#spil { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 5px; padding: 5px 6px 8px; box-sizing: border-box; max-width: 1100px; width: 100%; margin: 0 auto; }
#modst { flex: none; display: flex; gap: 6px; justify-content: center; }
.modspiller {
  flex: 0 1 200px; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 2px 10px; min-height: 32px; box-sizing: border-box;
  border-radius: 8px; background: rgba(0,0,0,.18); border: 2px solid transparent; font: 400 14px/1.25 Poppins, system-ui, sans-serif; white-space: nowrap;
}
.modspiller b { font-weight: 600; font-size: 15px; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.modspiller span { flex: none; }
.modspiller.tur { border-color: var(--creme); background: rgba(252,247,238,.1); }
.modspiller.tur b::before { content: ''; display: inline-block; margin-right: 6px; width: 0; height: 0; border-style: solid; border-width: 5px 0 5px 8px; border-color: transparent transparent transparent var(--guld); }

/* Bordet: rækkerne flyder og kan rulles lodret, når der er mange */
#bord { flex: 1 1 auto; min-height: 96px; overflow-y: auto; overscroll-behavior: contain; border-radius: 10px; background: rgba(0,0,0,.14); box-shadow: inset 0 0 0 1px rgba(252,247,238,.1);
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px 12px; padding: 8px; box-sizing: border-box; }
.saet { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 8px; border: 2px solid transparent; position: relative; max-width: 100%; box-sizing: border-box; }
.saet.ugyldig { border: 2px dashed #FF8A70; background: rgba(198,63,40,.22); }
.saet.ugyldig::after { content: '!'; position: absolute; top: -9px; right: -7px; width: 18px; height: 18px; border-radius: 50%; background: #FF8A70; color: #2A0D07; font: 700 13px/18px Poppins, system-ui, sans-serif; text-align: center; }
.saet.nyt-pc { border-color: var(--guld); }
#tom { width: 100%; text-align: center; align-self: center; font: 400 14px/1.4 Poppins, system-ui, sans-serif; opacity: .85; padding: 8px; }

/* Brikkerne */
.tb {
  flex: none; width: var(--bw, 40px); height: calc(var(--bw, 40px) * 1.32); padding: 0; margin: 0; box-sizing: border-box; border-radius: 6px; cursor: pointer;
  background: var(--brik); border: 1px solid rgba(30,36,33,.45); box-shadow: 0 2px 0 rgba(0,0,0,.28); display: flex; flex-direction: column; align-items: center; justify-content: center;
  font: 700 calc(var(--bw, 40px) * .5)/1 Poppins, system-ui, sans-serif; position: relative; transition: transform 140ms ease-out;
}
.tb small { font-size: max(10px, calc(var(--bw, 40px) * .26)); line-height: 1; margin-top: 2px; font-weight: 400; }
.tb.f0 { color: var(--f0); } .tb.f1 { color: var(--f1); } .tb.f2 { color: var(--f2); } .tb.f3 { color: var(--f3); }
.tb.joker { color: var(--roed); }
.tb.valgt { transform: translateY(-5px); box-shadow: 0 0 0 3px var(--guld), 0 6px 8px rgba(0,0,0,.35); }
.tb.ny { box-shadow: 0 0 0 2px var(--guld), 0 2px 0 rgba(0,0,0,.28); }
.tb.min { background: #FFF4D6; }
.tb.tip { animation: puls 900ms ease-in-out infinite alternate; box-shadow: 0 0 0 3px var(--guld); }
@keyframes puls { from { box-shadow: 0 0 0 2px var(--guld); } to { box-shadow: 0 0 0 5px var(--guld); } }

/* Pladser, hvor den valgte brik kan lægges: for enden af hver række og en ny række */
.plads { flex: none; width: var(--bw, 40px); height: calc(var(--bw, 40px) * 1.32); min-width: 44px; min-height: 44px; border-radius: 6px; border: 2px dashed var(--creme);
  background: rgba(252,247,238,.12); color: var(--creme); font: 700 20px/1 Poppins, system-ui, sans-serif; cursor: pointer; padding: 0; box-sizing: border-box; }
.plads.ny-raekke { width: auto; padding: 0 10px; font-size: 14px; font-weight: 600; }
.plads:hover { background: rgba(252,247,238,.28); }

#info { flex: none; display: flex; align-items: center; gap: 10px; min-height: 22px; font: 600 15px/1.3 Poppins, system-ui, sans-serif; }
#status { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mig { flex: none; white-space: nowrap; font-weight: 400; font-size: 14px; opacity: .9; }

/* Din hånd */
#haand { flex: none; display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start; gap: 4px; padding: 6px 4px; border-radius: 10px; background: rgba(0,0,0,.2);
  overflow-y: auto; max-height: var(--hmax, 140px); box-sizing: border-box; }
#haand .plads { --bw: var(--bh, 40px); }

#knapper { flex: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
#knapper button {
  min-height: 46px; padding: 0 6px; border-radius: 8px; cursor: pointer; font: 600 15px/1.1 Poppins, system-ui, sans-serif;
  border: 1px solid rgba(252,247,238,.22); background: var(--knap); color: var(--creme);
}
#knapper button:disabled { opacity: .45; cursor: default; }
#knapper button.primaer { background: var(--brik); color: var(--bjaelke); border-color: var(--roed); box-shadow: inset 0 -4px 0 var(--roed); }
@media (max-width: 380px) { #knapper button { font-size: 14px; } }

#kk-besked { width: max-content; max-width: min(calc(100vw - 24px), 460px); max-height: calc(100vh - 24px); overflow: auto; box-sizing: border-box; bottom: 8px; }
#kk-besked p { margin: 0 0 6px; font-size: 15px; }
#kk-besked p.titel { font-weight: 600; font-size: 17px; }
#kk-besked.regler p { text-align: left; }
#kk-besked .knapper { display: flex; justify-content: center; gap: 10px; margin-top: 10px; }
#kk-besked .knapper button { margin: 0; }
#kk-besked button.primaer { background: var(--roed); color: var(--creme); }

/* Pointkamp: stillingen i slutdialogen */
.tb-stilling { width: 100%; border-collapse: collapse; margin: 0 0 8px; font: 400 14px/1.2 Poppins, system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.tb-stilling caption { text-align: left; font-weight: 600; padding-bottom: 2px; }
.tb-stilling th, .tb-stilling td { padding: 2px 4px; text-align: right; border-bottom: 1px solid rgba(128,128,128,.35); white-space: nowrap; }
.tb-stilling th { font-weight: 600; }
.tb-stilling tr > :first-child { text-align: left; }
.tb-stilling th[scope=row] { font-weight: 400; }
.tb-stilling tfoot th, .tb-stilling tfoot td { border-bottom: 0; border-top: 2px solid rgba(128,128,128,.6); font-weight: 600; }
.tb-stilling .plus { font-weight: 700; }
@media (max-height: 480px) { .tb-stilling { font-size: 13px; } .tb-stilling th, .tb-stilling td { padding: 1px 4px; } }

@media (prefers-reduced-motion: reduce) { .tb { transition: none; } .tb.tip { animation: none; } }
