/* ---------- Aanraakbediening (telefoon en tablet) ---------- */

html,
body {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.touch-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  display: none;
}

.is-touch .touch-layer {
  display: block;
}

.touch-layer button {
  pointer-events: auto;
  touch-action: none;
  font-family: inherit;
}

/* Joystick linksonder. */
.touch-joy {
  position: absolute;
  left: 12px;
  bottom: 48px;
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  border: 2px solid rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
  pointer-events: auto;
  touch-action: none;
}

.touch-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: #c0182b;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Actieknoppen rechtsonder: E, I en Spatie. */
.touch-actions {
  position: absolute;
  right: 12px;
  bottom: 48px;
  display: grid;
  grid-template-columns: 70px 70px;
  gap: 10px;
}

.touch-actions .touch-space {
  grid-column: 1 / span 2;
}

.touch-btn {
  min-width: 64px;
  min-height: 64px;
  border-radius: 50%;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  background: #c0c0c0;
  box-shadow: inset -2px -2px #808080, inset 2px 2px #dfdfdf;
  font-size: 18px;
  font-weight: bold;
  color: #000;
}

.touch-btn.touch-space {
  border-radius: 12px;
  min-height: 52px;
}

.touch-btn.down {
  box-shadow: inset 2px 2px #808080, inset -2px -2px #dfdfdf;
  background: #b0b0b0;
}

/* Taken-knop rechtsboven (compacte schermen). */
.touch-menu-btn {
  position: absolute;
  top: 124px;
  right: 6px;
  display: none;
  padding: 6px 10px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  font-size: 13px;
}

.touch-layer[data-mode="play"] .touch-menu-btn {
  display: block;
}

.touch-layer[data-mode="play"] .touch-joy,
.touch-layer[data-mode="play"] .touch-actions {
  display: block;
}

.touch-layer[data-mode="play"] .touch-actions {
  display: grid;
}

.touch-joy,
.touch-actions {
  display: none;
}

/* Cijfer- en pijltjesblok, onderaan tijdens printer en facturen. */
.touch-pad {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 42px;
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: rgba(192, 192, 192, 0.96);
  border-top: 2px solid #fff;
  pointer-events: auto;
}

.touch-layer[data-mode="minigame"] .touch-pad:not(.pad-off) {
  display: flex;
}

.touch-pad-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.touch-key {
  min-width: 36px;
  min-height: 40px;
  padding: 0 8px;
  background: #d4d0c8;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  font-size: 17px;
  font-weight: bold;
}

.touch-key.wide {
  min-width: 56px;
}

.touch-key:active {
  background: #b0b0b0;
}

.render-error {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 40%;
  padding: 12px;
  background: #fff;
  border: 2px solid #c0182b;
  color: #000;
  font-size: 14px;
  text-align: center;
  z-index: 80;
}

/* ---------- Compact scherm (telefoon) ---------- */

.compact .hud-panels {
  top: 6px;
  left: 6px;
  right: 6px;
  width: auto;
  flex-direction: row;
  gap: 4px;
}

.compact .hud-panels .hud-win {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
}

.compact .hud-win .win-body {
  padding: 4px;
}

.compact .meter-row {
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.compact .cup {
  width: 36px;
  height: 46px;
  border-width: 2px;
}

.compact .cup::after {
  display: none;
}

.compact .chart {
  height: 46px;
}

.compact .meter-value {
  font-size: 12px;
}

.compact .win-tasks,
.compact .win-goals {
  display: none;
}

.compact .prompt {
  top: 124px;
  bottom: auto;
  font-size: 13px;
  max-width: 92vw;
  white-space: normal;
  text-align: center;
}

.compact .toasts {
  top: 172px;
  left: 6px;
  right: 6px;
  width: auto;
}

/* Taken en doelen als paneel over het scherm, na het indrukken van de Taken-knop. */
.compact.show-tasks .win-tasks,
.compact.show-tasks .win-goals {
  display: block;
  position: fixed;
  left: 6px;
  right: 6px;
  width: auto;
  z-index: 70;
  max-height: 46vh;
  overflow-y: auto;
}

.compact.show-tasks .win-tasks {
  top: 52px;
}

.compact.show-tasks .win-goals {
  top: auto;
  bottom: 48px;
}

.compact .start-menu {
  width: 180px;
}

.compact .taskbar {
  font-size: 12px;
}

.compact .win-goals .win-body {
  font-size: 12px;
}

.compact .minigame {
  width: 96vw;
  max-height: 70vh;
  overflow-y: auto;
}

.compact .overlay {
  padding: 8px;
}

/* Hulptekst per taak op kleine schermen wat kleiner. */
.compact .task-help {
  font-size: 10px;
}
