:root {
  --bg: #1d2128;
  --text: #ffffff;
  --outline: #2b2233;
  --gold: #ffd23a;
  --paper: #fbf6e9;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
}

/* Vast 16:9-vlak, zo groot als past. */
#stage {
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(100vw, 177.78vh);
  height: min(56.25vw, 100vh);
  font-family: "Pixelify Sans", ui-monospace, monospace;
  color: var(--text);
  user-select: none;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
}

/* Harde pixelrand rondom tekst, zoals in de HUD van de Godot-versie. */
#hud, #hint, #loading, #title {
  text-shadow:
    2px 0 var(--outline), -2px 0 var(--outline), 0 2px var(--outline), 0 -2px var(--outline),
    2px 2px var(--outline), -2px 2px var(--outline), 2px -2px var(--outline), -2px -2px var(--outline);
}

#hud, #hint, #loading { position: absolute; pointer-events: none; }

#hud {
  top: 2.5%;
  left: 2%;
  font-size: clamp(14px, 2.4vw, 30px);
}

#stamina {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

/* Eén veertje vliegkracht; --fill loopt van 0% tot 100%. */
.pip {
  --fill: 100%;
  width: clamp(8px, 1.1vw, 14px);
  height: clamp(14px, 1.9vw, 24px);
  border: 2px solid var(--outline);
  border-radius: 50% 50% 40% 40%;
  background: linear-gradient(to top, var(--gold) var(--fill), rgb(43 34 51 / 0.55) var(--fill));
  box-shadow: 2px 2px 0 var(--outline);
}

.pip.empty { animation: blink 0.5s steps(1) 3; }

#friet {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.8em;
}

#friet svg {
  width: clamp(14px, 1.8vw, 24px);
  filter: drop-shadow(2px 2px 0 var(--outline));
}

#friet.pop { animation: pop 0.4s steps(3); }

@keyframes pop { 50% { transform: scale(1.3); } }

#minimap {
  position: absolute;
  top: 2.5%;
  right: 2%;
  width: clamp(80px, 12vw, 170px);
  aspect-ratio: 1;
  image-rendering: pixelated;
  border: 3px solid var(--outline);
  border-radius: 6px;
  box-shadow: 4px 4px 0 var(--outline);
  pointer-events: none;
  transition: opacity 0.6s steps(4);
}

#hint {
  bottom: 2.5%;
  left: 2%;
  right: 2%;
  font-size: clamp(10px, 1.3vw, 17px);
}

#hud, #hint { transition: opacity 0.6s steps(4); }

#loading {
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(16px, 3vw, 36px);
  background: var(--bg);
}

.hidden { display: none !important; }

/* ---------------------------------------------------------------- titelscherm */

#title {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  background: radial-gradient(ellipse at center, rgb(29 33 40 / 0) 40%, rgb(29 33 40 / 0.55) 100%);
  animation: appear 0.8s steps(5) both;
}

#title.leaving { animation: vanish 0.6s steps(5) both; }

#title h1 {
  margin: 0.15em 0 0.35em;
  font-weight: 700;
  font-size: clamp(32px, 7.5vw, 100px);
  line-height: 1.05;
  letter-spacing: 0.04em;
  color: var(--gold);
  text-transform: uppercase;
  text-shadow:
    4px 0 var(--outline), -4px 0 var(--outline), 0 4px var(--outline), 0 -4px var(--outline),
    4px 4px var(--outline), -4px 4px var(--outline), 4px -4px var(--outline), -4px -4px var(--outline),
    8px 10px 0 var(--outline);
}

#title .tag {
  margin: 0.4em 0 0;
  font-size: clamp(14px, 2.2vw, 28px);
}

#title .press {
  margin: 2.2em 0 0;
  font-size: clamp(14px, 2.2vw, 28px);
  color: var(--gold);
  animation: blink 1s steps(1) infinite;
}

#title .foot {
  position: absolute;
  bottom: 3%;
  margin: 0;
  font-size: clamp(10px, 1.2vw, 15px);
  opacity: 0.85;
}

/* ---------------------------------------------------------------- tekstvak */

#dialog {
  position: absolute;
  left: 50%;
  bottom: 6%;
  width: min(80%, 900px);
  transform: translateX(-50%);
  min-height: 22%;
  padding: 1.1em 1.4em 1.4em;
  background: var(--paper);
  color: var(--outline);
  border: 4px solid var(--outline);
  border-radius: 8px;
  box-shadow: 0 6px 0 var(--outline), inset 0 -6px 0 #eee3c8;
  font-size: clamp(13px, 2.1vw, 28px);
  line-height: 1.35;
  cursor: pointer;
  animation: appear 0.4s steps(4) both;
}

#dialog p { margin: 0; }

#dialog .more {
  position: absolute;
  right: 0.9em;
  bottom: 0.4em;
  font-size: 0.8em;
  animation: bob 0.5s steps(2) infinite alternate;
}

/* ---------------------------------------------------------------- beweging, met harde stappen */

@keyframes appear { from { opacity: 0; } to { opacity: 1; } }
@keyframes vanish { from { opacity: 1; } to { opacity: 0; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-4px); } }

@media (prefers-reduced-motion: reduce) {
  #title, #title .press, #dialog, #dialog .more { animation: none; }
}
