/* =====================================================================
   Hestespil – farver og udseende
   ===================================================================== */
:root {
  --træ: #5a3b22;
  --creme: #fbf6ea;
  --grøn: #3f5f2a;
  --grøn-lys: #6b9442;
  --tekst: #2b2118;
  --panel: rgba(251, 246, 234, 0.9);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #9fc6e8;
  font-family: Nunito, system-ui, sans-serif;
  color: var(--tekst);
  touch-action: none;            /* ingen zoom ved dobbelt-tryk på iPad */
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#game, #game canvas { position: fixed; inset: 0; display: block; }
.hidden { display: none !important; }

button {
  font: inherit; cursor: pointer; border: none;
  color: var(--tekst);
}

.panel {
  background: var(--panel);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  padding: 10px 14px;
}

/* ---------- HUD ---------- */
#hud-gaard {
  position: fixed; top: max(12px, env(safe-area-inset-top)); left: 12px;
}
#gaard-navn { font-weight: 900; font-size: 18px; color: var(--træ); }
#moenter { font-weight: 800; font-size: 16px; margin-top: 2px; }

#hud-knapper { position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px; display: flex; gap: 8px; }
.rund {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--panel); font-size: 20px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.rund:active { transform: scale(0.94); }

#hud-hest {
  position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  text-align: center; padding: 8px 12px;
}
#heste-navn { font-weight: 900; font-size: 15px; color: var(--træ); margin-bottom: 6px; }
#gangart { display: flex; gap: 6px; }
#gangart div {
  padding: 5px 10px; border-radius: 10px; font-weight: 800; font-size: 14px;
  background: rgba(90, 59, 34, 0.1); color: rgba(43, 33, 24, 0.55);
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
#gangart div.aktiv { background: var(--grøn-lys); color: white; transform: scale(1.08); }

#besked {
  position: fixed; left: 50%; top: max(14px, env(safe-area-inset-top)); transform: translateX(-50%);
  max-width: min(560px, 70vw); text-align: center; font-weight: 800; font-size: 16px;
}

#hjaelp {
  position: fixed; left: 12px; bottom: 14px; max-width: 30vw;
  font-size: 12px; color: white; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* Touch-styring (iPad) */
.touch-only { display: none !important; }
body.touch .touch-only { display: revert !important; }
body.touch .keys-only { display: none !important; }

#stick {
  position: fixed; width: 128px; height: 128px; margin: -64px 0 0 -64px;
  border-radius: 50%; background: rgba(255, 255, 255, 0.18); border: 2px solid rgba(255, 255, 255, 0.5);
  pointer-events: none; display: none;
}
#stick.on { display: block; }
#stick div {
  position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.75); transform: translate(-50%, -50%);
}
#btn-jump {
  position: fixed; right: 24px; bottom: 28px; width: 88px; height: 88px; border-radius: 50%;
  background: var(--panel); font-size: 30px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
body.touch #btn-jump { display: flex !important; }
#btn-jump span { font-size: 13px; font-weight: 900; margin-top: 4px; }
#btn-jump:active { transform: scale(0.94); }

/* ---------- Menuen ---------- */
.overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(40, 60, 30, 0.25), rgba(40, 30, 20, 0.55));
  padding: 16px; overflow-y: auto;
}
.kort {
  background: var(--creme); border-radius: 22px; padding: 26px 30px; width: min(420px, 100%);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.35); border: 3px solid #e6d7b8;
}
h1 { margin: 0; font-size: 40px; font-weight: 900; color: var(--træ); text-align: center; }
.under { margin: 2px 0 18px; text-align: center; font-weight: 700; color: #7a6450; }
label, .label { display: block; font-weight: 800; font-size: 14px; margin: 12px 0 4px; color: #6a5440; }
input {
  width: 100%; margin-top: 4px; padding: 10px 12px; border-radius: 10px; border: 2px solid #ddcca9;
  font: inherit; font-size: 17px; font-weight: 700; background: white; color: var(--tekst);
  -webkit-user-select: text; user-select: text;
}
input:focus { outline: none; border-color: var(--grøn-lys); }
#pelse { display: flex; flex-wrap: wrap; gap: 8px; }
#pelse button {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px 6px 6px; border-radius: 20px;
  background: white; border: 2px solid #ddcca9; font-weight: 800; font-size: 14px;
}
#pelse button i { width: 22px; height: 22px; border-radius: 50%; display: inline-block; border: 2px solid rgba(0, 0, 0, 0.15); }
#pelse button.valgt { border-color: var(--grøn-lys); background: #eef5e4; }
.stor {
  display: block; width: 100%; margin-top: 22px; padding: 14px; border-radius: 14px;
  background: var(--grøn-lys); color: white; font-size: 22px; font-weight: 900;
  box-shadow: 0 5px 0 var(--grøn);
}
.stor:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--grøn); }
.styring { margin-top: 16px; font-size: 13px; text-align: center; color: #7a6450; line-height: 1.6; }
.styring b { background: #eadcbf; border-radius: 5px; padding: 0 5px; color: var(--tekst); }

/* Smal skærm: hjælpeteksten ville ligge oven i gangarterne */
@media (max-width: 900px) { #hjaelp { display: none; } }

/* ---------- Spil sammen ---------- */
#net-info { margin-top: 6px; font-weight: 800; font-size: 14px; color: var(--grøn); }
#sammen { margin-top: 18px; padding-top: 6px; border-top: 2px dashed #e6d7b8; }
.lille {
  display: block; width: 100%; padding: 10px; border-radius: 12px; margin-top: 6px;
  background: #eadcbf; font-weight: 900; font-size: 16px;
}
.lille:active { transform: scale(0.98); }
.række { display: flex; gap: 8px; margin-top: 4px; }
.række input { flex: 1; text-transform: uppercase; letter-spacing: 6px; text-align: center; font-weight: 900; }
.række .lille { width: auto; padding: 10px 18px; margin-top: 4px; }
#sammen-tekst { font-weight: 800; text-align: center; margin: 4px 0; }
#sammen-tekst .kode { display: block; font-size: 38px; letter-spacing: 8px; color: var(--træ); }
#sammen-status { min-height: 1em; margin-top: 6px; text-align: center; font-weight: 700; font-size: 14px; color: #a0522d; }
#version { margin-top: 10px; text-align: center; font-size: 11px; color: #b3a28c; }

/* Smal skærm: beskeden lægger sig under gårdens navn i stedet for ved siden af */
@media (max-width: 700px) { #besked { top: 130px; max-width: 90vw; } }
