/* Shared player shell for GameMaker HTML5 exports.
   Fits the game canvas to any screen and adds touch controls on phones/tablets. */

:root {
  --bg: #0b0b0d;
  --fg: #e8e6e3;
  --btn: rgba(255, 255, 255, 0.14);
  --btn-border: rgba(255, 255, 255, 0.35);
  --btn-active: rgba(255, 255, 255, 0.38);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* GameMaker's own wrapper div + canvas */
#gm4html5_div_id {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
#canvas {
  position: absolute;
  margin: 0;
  padding: 0;
  border: 0;
  display: block;
  touch-action: none;
  image-rendering: auto;
}
body.pixelated #canvas {
  image-rendering: pixelated;
}

/* ---------- top bar ---------- */
.mk-bar {
  position: fixed;
  top: calc(8px + var(--safe-t));
  left: calc(8px + var(--safe-l));
  right: calc(8px + var(--safe-r));
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
  z-index: 20;
}
.mk-bar a,
.mk-bar button {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.35);
  color: var(--fg);
  opacity: 0.55;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.2s;
}
.mk-bar a:hover,
.mk-bar button:hover { opacity: 1; }
.mk-bar svg { width: 18px; height: 18px; }
.mk-bar [hidden] { display: none; }

/* ---------- touch controls ---------- */
.mk-controls {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  display: none;
}
body.touch .mk-controls { display: block; }

.mk-stick,
.mk-buttons {
  position: absolute;
  bottom: calc(var(--pad-bottom, 20px) + var(--safe-b));
  pointer-events: auto;
  touch-action: none;
}
.mk-stick {
  left: calc(var(--pad-left, 20px) + var(--safe-l));
  width: var(--dpad-size, 150px);
  height: var(--dpad-size, 150px);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-sizing: border-box;
}
.mk-stick.on { background: rgba(255, 255, 255, 0.11); }
.mk-knob {
  position: absolute;
  left: 30%;
  top: 30%;
  width: 40%;
  height: 40%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-sizing: border-box;
  pointer-events: none;
  transition: transform 0.08s ease-out;
}
.mk-stick.on .mk-knob { background: rgba(255, 255, 255, 0.4); transition: none; }

.mk-buttons {
  right: calc(var(--pad-right, 20px) + var(--safe-r));
  display: flex;
  gap: 14px;
  align-items: flex-end;
}
.mk-btn {
  width: var(--btn-size, 84px);
  height: var(--btn-size, 84px);
  border-radius: 50%;
  background: var(--btn);
  border: 1px solid var(--btn-border);
  color: rgba(255, 255, 255, 0.85);
  font: 600 13px/1 system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mk-btn.on { background: var(--btn-active); }

/* ---------- rotate prompt ---------- */
.mk-rotate {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(8, 8, 10, 0.94);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  padding: 24px;
}
body.show-rotate .mk-rotate { display: flex; }
.mk-rotate svg { width: 64px; height: 64px; opacity: 0.9; animation: mk-tilt 2.4s ease-in-out infinite; }
.mk-rotate p { margin: 0; font-size: 17px; line-height: 1.4; max-width: 280px; }
.mk-rotate button {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--fg);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
}
@keyframes mk-tilt {
  0%, 30% { transform: rotate(0deg); }
  60%, 100% { transform: rotate(-90deg); }
}
