/* Layout of the page around the game: fill the window, centre the canvas. */

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #16141f;
  /* Stop the page bouncing, scrolling, zooming or selecting text while playing */
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: grid;
  place-items: center;
}

canvas {
  display: block;
  touch-action: none;
}

/* ---------- Back to the website ---------- */

.home-link {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  left: calc(12px + env(safe-area-inset-left));
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  color: #1f2350;
  font: 600 15px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 6px 18px rgba(40, 30, 110, 0.25);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  backdrop-filter: blur(10px) saturate(1.4);
}

.home-link[hidden] {
  display: none;
}

.home-link svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- On-screen touch buttons ---------- */

.touch {
  position: fixed;
  inset: 0;
  pointer-events: none; /* fingers are tracked by js/input.js, not by these shapes */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.touch[hidden] {
  display: none;
}

/* Frosted glass, to match the game */
.pad,
.mini {
  position: absolute;
  display: grid;
  place-items: center;
  color: #1f2350;
  background: rgba(255, 255, 255, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 6px 18px rgba(40, 30, 110, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  backdrop-filter: blur(10px) saturate(1.4);
  transition: transform 0.06s, background 0.06s;
}

.pad {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  bottom: calc(18px + env(safe-area-inset-bottom));
}

.pad svg,
.mini svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pad[data-action="left"] {
  left: calc(16px + env(safe-area-inset-left));
}

.pad[data-action="right"] {
  left: calc(92px + env(safe-area-inset-left));
}

.pad.round {
  border-radius: 50%;
  flex-direction: column;
  gap: 0;
}

.pad.round span {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.pad.round small {
  font-size: 9px;
  font-weight: 700;
  opacity: 0.75;
}

.pad[data-action="run"] {
  right: calc(104px + env(safe-area-inset-right));
  bottom: calc(14px + env(safe-area-inset-bottom));
}

.pad[data-action="jump"] {
  width: 76px;
  height: 76px;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(40px + env(safe-area-inset-bottom));
}

.pad.active {
  transform: scale(0.92);
  background: rgba(150, 220, 255, 0.55);
}

.mini {
  top: calc(10px + env(safe-area-inset-top));
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  pointer-events: auto;
  cursor: pointer;
}

.mini svg {
  width: 20px;
  height: 20px;
}

.mini[data-press="pause"] {
  left: calc(50% - 120px);
}

.mini[data-press="mute"] {
  left: calc(50% + 80px);
}

/* ---------- "Turn your phone sideways" card ---------- */

.rotate {
  display: none;
  position: fixed;
  inset: 0;
  place-items: center;
  background: linear-gradient(135deg, #dfe5ff, #f6e3f6 50%, #ffeedd);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1f2350;
  text-align: center;
}

.rotate-card {
  padding: 28px 32px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 30px rgba(40, 30, 110, 0.18);
}

.rotate-card svg {
  width: 72px;
  height: 72px;
  fill: none;
  stroke: #6a5cff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: tilt 2.4s ease-in-out infinite;
}

.rotate-card p {
  margin: 12px 0 0;
  font-size: 18px;
  font-weight: 700;
}

@keyframes tilt {
  0%, 30% { transform: rotate(0deg); }
  60%, 100% { transform: rotate(-90deg); }
}

@media (prefers-reduced-motion: reduce) {
  .rotate-card svg { animation: none; }
}

@media (orientation: portrait) and (pointer: coarse) {
  .rotate { display: grid; }
}
