/* Domino: træ-bordet (brætspil, se docs/DESIGNMANUAL-SPIL.md). Skrift, filt og bjælke kommer fra Solitaire.css og kabale-kort.css */
:root {
  --bord: #6D4020;
  --bjaelke: #372417;
  --knap: #6A452B;
  --brik: #FCF7EE;
  --kul: #1E2421;
  --roed: #C63F28;
  --kant-brik: rgba(30,36,33,.5);
}
html.kabale-mork {
  --bord: #402613;
  --bjaelke: #18110D;
  --knap: #4B2F1C;
  --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; }
/* Solitaire.css giver alle svg filt og fuld størrelse; her er svg kun brikker og kæde */
#spil svg, #kk-besked svg { background: none; width: auto; height: auto; }

/* Bjælken: samme knapper som kabalerne, vælgerne ligner knapper */
#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, .brik:focus-visible { outline: 3px solid var(--creme); outline-offset: 2px; }
@media (max-width: 480px) {
  #kk-bar { gap: 5px; padding: 6px; flex-wrap: nowrap; }
  #kk-bar button, #kk-bar select { flex: 1 1 auto; font-size: 14px; padding-left: 8px; padding-right: 8px; }
  #kk-bar select { padding-right: 22px; background-position: right 7px center; }
  #kk-bar button, #kk-bar select { white-space: nowrap; }
}
@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; }
}
@media (max-width: 340px) { #kk-bar select { background-image: none; padding-right: 6px; text-align: center; } }

/* Spilleområdet: modstandere, bordet med kæden, status, din hånd og knapperne nederst ved tommelfingeren */
#spil { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: 6px 6px 8px; box-sizing: border-box; max-width: 980px; 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; flex-direction: column; justify-content: center; padding: 4px 10px; min-height: 40px; box-sizing: border-box;
  border-radius: 8px; background: rgba(0,0,0,.18); border: 2px solid transparent; font: 400 14px/1.3 Poppins, system-ui, sans-serif;
}
.modspiller div { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.modspiller b { font-weight: 600; font-size: 15px; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.modspiller i { font-style: normal; font-weight: 600; flex: none; }
.modspiller span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Tur: lys kant, lysere felt og en rød pil foran navnet (ikke kun farve) */
.modspiller.tur { border-color: var(--creme); background: rgba(252,247,238,.1); }
.modspiller.tur div::before { content: ''; flex: none; width: 0; height: 0; border-style: solid; border-width: 5px 0 5px 8px; border-color: transparent transparent transparent var(--roed); filter: drop-shadow(0 0 1px var(--creme)); }
.modspiller.leder i::before, #mig.leder::before { content: ''; display: inline-block; margin-right: 5px; vertical-align: 1px; width: 8px; height: 8px; border-radius: 50%; background: #D69A2D; box-shadow: 0 0 0 1.5px var(--creme); flex: none; }

#braet { flex: 1 1 auto; min-height: 90px; position: relative; border-radius: 10px; background: rgba(0,0,0,.12); box-shadow: inset 0 0 0 1px rgba(252,247,238,.1); }
#kaede { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.ksten rect.krop { fill: var(--brik); stroke: var(--kant-brik); stroke-width: .035; }
.ksten line { stroke: var(--kul); stroke-width: .06; stroke-linecap: round; }
.ksten circle { fill: var(--kul); }
.ny > .ksten rect.krop { stroke: var(--roed); stroke-width: .09; }
.ind > .ksten { animation: ind 220ms ease-out both; transform-box: fill-box; transform-origin: center; }
@keyframes ind { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
.spoegelse { cursor: pointer; outline: none; }
.spoegelse .ksten { opacity: .5; }
.spoegelse rect.ramme { fill: rgba(252,247,238,.16); stroke: var(--roed); stroke-width: .09; stroke-dasharray: .22 .14; }
.spoegelse:hover rect.ramme, .spoegelse:focus-visible rect.ramme { fill: rgba(252,247,238,.32); stroke: var(--creme); stroke-dasharray: none; }
.spoegelse.tip rect.ramme { animation: puls 900ms ease-in-out infinite alternate; }
@keyframes puls { from { stroke-width: .07; } to { stroke-width: .16; } }
.spoegelse .hit { fill: transparent; }
#tom { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; text-align: center; padding: 12px; pointer-events: none;
  font: 400 14px/1.4 Poppins, system-ui, sans-serif; color: var(--creme); opacity: .85; }

#info { flex: none; display: flex; align-items: center; gap: 10px; min-height: 26px; 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; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
#mig small { font-weight: 400; font-size: 14px; opacity: .85; }

/* Din hånd: brikkerne står på højkant og kan læses på mobil */
#haand { flex: none; display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-end; gap: 6px; min-height: calc(var(--bw, 44px) * 2); padding-top: 4px; }
.brik { width: var(--bw, 44px); height: calc(var(--bw, 44px) * 2); padding: 0; border: 0; background: none; cursor: pointer; border-radius: calc(var(--bw, 44px) * .14);
  transition: transform 160ms ease-out, opacity 160ms ease-out; touch-action: none; }
.brik svg { display: block; width: 100% !important; height: 100% !important; overflow: visible; pointer-events: none; }
.brik.ude { opacity: .6; }
.brik.ny rect.krop { stroke: #D69A2D; stroke-width: .08; }
.brik.valgt { transform: translateY(-6px); }
.brik.valgt rect.krop { stroke: var(--roed); stroke-width: .1; }
.brik.valgt svg { filter: drop-shadow(0 5px 6px rgba(0,0,0,.35)); }
.flyver { position: fixed; z-index: 4; pointer-events: none; filter: drop-shadow(0 8px 10px rgba(0,0,0,.4)); }
.flyver svg { display: block; width: 100%; height: 100%; }

#knapper { flex: none; display: grid; grid-template-columns: repeat(var(--kol, 3), 1fr); gap: 6px; }
#knapper button {
  min-height: 48px; padding: 0 8px; 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.maa { background: var(--brik); color: var(--bjaelke); border-color: var(--roed); box-shadow: inset 0 -4px 0 var(--roed); }
#knapper button.blink { animation: blink 300ms ease-out 2; }
@keyframes blink { 50% { transform: scale(1.06); } }

/* Beskeden: flere linjer til reglerne og rundens resultat, rød primærknap */
#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 .raekke { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 14px; text-align: left; }
#kk-besked .raekke .navn { flex: none; width: 4.2em; font-weight: 600; }
#kk-besked .raekke .smaa { display: flex; flex-wrap: wrap; gap: 3px; flex: 1 1 auto; min-width: 0; }
#kk-besked .raekke .smaa svg { width: 36px !important; height: 18px !important; }
#kk-besked .raekke .sum { flex: none; margin-left: auto; white-space: nowrap; }
#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); }

@media (hover: hover) { .brik:not(.ude):hover { transform: translateY(-3px); } .brik.valgt:hover { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) {
  .ind > .ksten, .spoegelse.tip rect.ramme, #knapper button.blink { animation: none; }
  .brik { transition: none; }
}

/* Spilskallet: er der ikke plads, deler de tre vælgere en linje under knapperne */
#kk-bar.sk-bar.sk-taet > select { flex: 1 1 calc(33% - 6px); }
