* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #050608; color: #eee;
  font-family: "Segoe UI", system-ui, sans-serif; user-select: none; }
canvas { display: block; }

#hud { display: none; position: fixed; inset: 0; pointer-events: none; }
#tellers { position: absolute; top: 16px; right: 16px; background: rgba(0,0,0,.55); padding: 10px 16px;
  border-radius: 10px; font-size: 20px; line-height: 1.6; text-align: right; }
#tellers b { color: #ffd54f; font-size: 24px; }
#minimap { position: absolute; top: 16px; left: 16px; border-radius: 8px; width: 200px; height: 200px; }
#leven { position: absolute; left: 16px; bottom: 16px; display: flex; align-items: center; gap: 10px;
  background: rgba(0,0,0,.55); padding: 10px 14px; border-radius: 10px; font-weight: 600; }
#levenBalk { width: 220px; height: 18px; background: #222; border-radius: 9px; overflow: hidden; }
#levenVul { height: 100%; width: 100%; background: #4caf50; transition: width .2s; }
#revives { color: #80deea; }
#wapen { position: absolute; right: 16px; bottom: 16px; background: rgba(0,0,0,.55); padding: 10px 16px;
  border-radius: 10px; font-size: 18px; font-weight: 600; }
#vizier { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; transform: translate(-50%, -50%); }
#vizier::before, #vizier::after { content: ""; position: absolute; background: rgba(255,255,255,.85); }
#vizier::before { left: 8px; top: 0; width: 2px; height: 18px; }
#vizier::after { top: 8px; left: 0; height: 2px; width: 18px; }
#bericht { position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%); font-size: 22px; font-weight: 700;
  text-shadow: 0 2px 6px #000; opacity: 0; transition: opacity .4s; text-align: center; max-width: 90vw; }
#pijn { position: fixed; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(200,0,0,.8)); }

#overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.6); padding: 16px; }
.paneel { background: #15171c; border: 2px solid #3a3f4a; border-radius: 16px; padding: 28px 36px;
  max-width: 560px; width: 100%; text-align: center; box-shadow: 0 10px 40px #000; }
.paneel h1 { margin: 0 0 4px; font-size: 44px; letter-spacing: 2px; color: #8bc34a; text-shadow: 0 3px 0 #2e4a12; }
.sub { color: #999; margin-top: 0; }
.uitleg { text-align: left; }
.uitleg table { margin: 12px auto; border-collapse: collapse; }
.uitleg td { padding: 3px 12px; }
kbd { display: inline-block; background: #2a2e37; border: 1px solid #555; border-bottom-width: 3px; border-radius: 5px;
  padding: 1px 7px; margin-right: 3px; font-family: inherit; font-size: 14px; }
button { margin-top: 14px; font-size: 22px; font-weight: 700; padding: 12px 40px; border: 0; border-radius: 10px;
  background: #8bc34a; color: #111; cursor: pointer; }
button:hover { background: #a5d65f; }

/* ---------- instellingen ---------- */
.instellingen { margin-top: 16px; padding-top: 12px; border-top: 1px solid #333; display: flex; flex-wrap: wrap;
  align-items: center; justify-content: center; gap: 10px 24px; }
.instellingen h2 { width: 100%; margin: 0; font-size: 16px; color: #aaa; font-weight: 600; }
.instellingen label { display: flex; align-items: center; gap: 8px; }
button.schakel { margin: 0; font-size: 15px; padding: 5px 16px; min-width: 64px; }
button.schakel.uit { background: #555; color: #ddd; }
.instellingen input[type=range] { width: 120px; accent-color: #8bc34a; }

/* ---------- mobiel ---------- */
html, body { touch-action: none; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
#touch, #draai { display: none; }
body.touch #touch { display: block; }
body.touch #hud { --l: max(8px, env(safe-area-inset-left)); --r: max(8px, env(safe-area-inset-right)); }
body.touch #minimap { top: 8px; left: var(--l); width: 110px; height: 110px; }
body.touch #tellers { top: 8px; right: var(--r); font-size: 14px; padding: 6px 10px; line-height: 1.4; }
body.touch #tellers b { font-size: 16px; }
body.touch #leven { white-space: nowrap; top: 8px; bottom: auto; left: 50%; transform: translateX(-50%); padding: 6px 10px; gap: 6px; font-size: 13px; }
body.touch #levenBalk { width: 110px; height: 12px; }
body.touch #wapen { top: 72px; bottom: auto; right: var(--r); font-size: 13px; padding: 6px 10px; }
body.touch #bericht { bottom: auto; top: 22%; font-size: 16px; }
body.touch #touch { position: absolute; inset: 0; }
#stick { position: absolute; display: none; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); background: rgba(255,255,255,.08); }
#stickKnop { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255,255,255,.45); transform: translate(-50%, -50%); }
.tk { position: absolute; pointer-events: auto; margin: 0; padding: 0; border-radius: 50%; font-size: 26px;
  background: rgba(255,255,255,.18); border: 2px solid rgba(255,255,255,.4); color: #fff; touch-action: none; }
.tk:hover { background: rgba(255,255,255,.18); }
#tVuur { width: 92px; height: 92px; right: calc(var(--r) + 18px); bottom: max(22px, env(safe-area-inset-bottom)); font-size: 38px; }
#tVuur.in { background: rgba(255,80,60,.45); }
#tHerlaad { width: 58px; height: 58px; right: calc(var(--r) + 124px); bottom: max(26px, env(safe-area-inset-bottom)); }
#tDeur { width: 58px; height: 58px; right: calc(var(--r) + 34px); bottom: calc(max(22px, env(safe-area-inset-bottom)) + 108px); }
.tk.klein { width: 44px; height: 44px; font-size: 20px; top: 8px; }
#tKaart { left: calc(var(--l) + 120px); }
#tPauze { left: calc(var(--l) + 170px); }
#tMuziek { left: calc(var(--l) + 220px); }
@media (orientation: portrait) {
  body.touch #draai { display: block; position: absolute; left: 50%; top: 128px; transform: translateX(-50%);
    background: rgba(0,0,0,.6); padding: 6px 12px; border-radius: 8px; font-size: 13px; white-space: nowrap; }
  body.touch #leven { top: auto; bottom: max(8px, env(safe-area-inset-bottom)); left: var(--l); transform: none; }
  body.touch #levenBalk { width: 70px; }
}
@media (max-height: 500px), (max-width: 600px) {
  #overlay { align-items: flex-start; overflow-y: auto; }
  .paneel { padding: 16px 18px; margin: auto; }
  .paneel h1 { font-size: 30px; }
  .uitleg p { font-size: 14px; margin: 6px 0; }
  #overlay { touch-action: pan-y; }
  .instellingen { margin-top: 10px; padding-top: 8px; }
  .uitleg td { padding: 1px 10px; font-size: 14px; }
  button { font-size: 18px; padding: 10px 30px; margin-top: 8px; }
}
@media (max-height: 500px) {
  .uitleg p, .sub { display: none; }
  .uitleg table { margin: 4px auto; }
  .instellingen h2 { display: none; }
}
