/* 2048: skiferbordet (puslespil, se docs/DESIGNMANUAL-SPIL.md). Skrift, filt og bjælke kommer fra Solitaire.css og kabale-kort.css.
   Brikkernes farver er manualens spillerfarver og bordfarverne, så hver værdi har sin egen farve; tallet står altid på brikken */
:root {
  --bord: #434D5D;
  --bjaelke: #252930;
  --knap: #464F5D;
  --kul: #1E2421;
  --roed: #C63F28;
  --ramme: #2B313B;
  --felt: rgba(252,247,238,.08);
  --fart: 120ms;
}
html.kabale-mork {
  --bord: #272D37;
  --bjaelke: #111315;
  --knap: #343B47;
  --ramme: #191D23;
  --felt: rgba(252,247,238,.06);
}
@media (prefers-reduced-motion: reduce) { :root { --fart: 0ms; } }
body { background: var(--filt), var(--bord); color: var(--creme); font-variant-numeric: tabular-nums; }
svg { background: none; width: auto; height: auto; }
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; 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, #panel button:focus-visible, #kk-besked button:focus-visible { outline: 3px solid var(--creme); outline-offset: 2px; }
@media (max-width: 420px) {
  #kk-bar { gap: 6px; padding: 6px; flex-wrap: nowrap; }
  #kk-bar button, #kk-bar select { flex: 1 1 auto; min-width: 0; font-size: 14px; padding-left: 8px; padding-right: 8px; }
  #kk-bar select { padding-right: 24px; background-position: right 8px center; }
}

#spil { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 6px 6px 8px; box-sizing: border-box; }
#info, #panel { width: 100%; max-width: var(--bredde, 100%); margin: 0 auto; box-sizing: border-box; flex: none; }
#info { display: flex; align-items: center; gap: 10px; min-height: 44px; font: 600 15px/1.3 Poppins, system-ui, sans-serif; }
#info .boks { background: rgba(0,0,0,.2); border-radius: 8px; padding: 3px 10px; display: flex; flex-direction: column; line-height: 1.15; }
#info .boks small { font-weight: 400; font-size: 14px; opacity: .85; }
#mal { flex: 1 1 auto; text-align: right; font-weight: 400; opacity: .85; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#ramme { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#ramme:focus { outline: none; }
#braet { position: relative; background: var(--ramme); border-radius: 10px; box-shadow: inset 0 2px 8px rgba(0,0,0,.45), 0 1px 0 rgba(252,247,238,.08); }
#ramme:focus-visible #braet { outline: 3px solid var(--creme); outline-offset: 3px; }
.felt { position: absolute; background: var(--felt); border-radius: 7px; }
.brik {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; justify-content: center; border-radius: 7px; box-sizing: border-box;
  font: 600 var(--str, 28px)/1 Poppins, system-ui, sans-serif; letter-spacing: -.02em; transition: transform var(--fart) ease-out; will-change: transform;
  box-shadow: 0 2px 0 rgba(0,0,0,.25);
}
.brik.ny { animation: ny 160ms ease-out; }
.brik.sammen { animation: sammen 180ms ease-out; z-index: 2; }
@keyframes ny { from { opacity: 0; scale: .4; } to { opacity: 1; scale: 1; } }
@keyframes sammen { 0% { scale: 1; } 45% { scale: 1.14; } 100% { scale: 1; } }
@media (prefers-reduced-motion: reduce) { .brik.ny, .brik.sammen { animation: none; } }
.v2 { background: #FCF7EE; color: #1E2421; }
.v4 { background: #E3D5BC; color: #1E2421; }
.v8 { background: #3E6FA3; color: #FCF7EE; }
.v16 { background: #3F8A5A; color: #FCF7EE; }
.v32 { background: #D69A2D; color: #1E2421; }
.v64 { background: #C63F28; color: #FCF7EE; }
.v128 { background: #005963; color: #FCF7EE; box-shadow: 0 0 0 2px #FCF7EE inset, 0 2px 0 rgba(0,0,0,.25); }
.v256 { background: #5E3D6D; color: #FCF7EE; box-shadow: 0 0 0 2px #FCF7EE inset, 0 2px 0 rgba(0,0,0,.25); }
.v512 { background: #6D4020; color: #FCF7EE; box-shadow: 0 0 0 2px #FCF7EE inset, 0 2px 0 rgba(0,0,0,.25); }
.v1024 { background: #74373D; color: #FCF7EE; box-shadow: 0 0 0 3px #D69A2D inset, 0 2px 0 rgba(0,0,0,.25); }
.v2048 { background: #1E2421; color: #D69A2D; box-shadow: 0 0 0 3px #D69A2D inset, 0 0 12px rgba(214,154,45,.55); }
.vstor { background: #FCF7EE; color: #C63F28; box-shadow: 0 0 0 3px #C63F28 inset, 0 0 12px rgba(198,63,40,.5); }
html.kabale-mork .v2 { background: #EFE8DB; }
#pil { position: absolute; left: 50%; top: 50%; width: 30%; height: 30%; transform: translate(-50%, -50%); pointer-events: none; color: #FCF7EE; filter: drop-shadow(0 2px 4px rgba(0,0,0,.6)); z-index: 3; }
#pil[hidden] { display: none; }
#pil svg { width: 100%; height: 100%; }

#panel { display: flex; gap: 8px; }
#panel button {
  flex: 1 1 0; min-width: 0; min-height: 44px; font: 600 15px/1.2 Poppins, system-ui, sans-serif; padding: 0 8px; border-radius: 8px; cursor: pointer;
  color: var(--creme); background: var(--knap); border: 1px solid rgba(252,247,238,.22);
}
#panel button:disabled { opacity: .45; cursor: default; }

#kk-besked { width: max-content; max-width: min(calc(100vw - 32px), 440px); box-sizing: border-box; z-index: 4; }
#kk-besked p { margin: 0 0 6px; font-size: 15px; }
#kk-besked.regler p { text-align: left; }
#kk-besked .knapper { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 10px; }
#kk-besked .knapper button { margin: 0; }
#kk-besked button.primaer { background: var(--roed); color: var(--creme); }
/* 2048 nået: guldbrikken gløder */
.brik.guld { animation: guld 900ms ease-in-out 2; z-index: 3; }
@keyframes guld { 50% { scale: 1.16; box-shadow: 0 0 0 3px #D69A2D inset, 0 0 28px rgba(214,154,45,.95); } }
@media (prefers-reduced-motion: reduce) { .brik.guld { animation: none; } }
/* Ugedagene i arkivet får dialogens baggrund, så kontrasten måles mod den og ikke mod brikkerne bag dialogen */
.sk-ugedag { background: var(--bjaelke); }
