* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: #03040c;
  overflow: hidden;
  font-family: 'Rajdhani', 'Segoe UI', system-ui, -apple-system, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-wrapper {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #0a0e28 0%, #03040c 80%, #010105 100%);
}

#gameCanvas {
  width: min(100vw, calc(100vh * 4 / 3));
  height: min(100vh, calc(100vw * 3 / 4));
  max-width: 100vw;
  max-height: 100vh;
  aspect-ratio: 4 / 3;
  box-shadow: 0 0 50px rgba(0, 240, 255, 0.2), 0 0 100px rgba(255, 43, 214, 0.15), 0 20px 60px rgba(0, 0, 0, 0.9);
  border-radius: 14px;
  border: 1px solid rgba(0, 240, 255, 0.3);
  cursor: pointer;
  display: block;
}

/* ============================================================================
   TRANSLUCENT FUTURISTIC MOBILE CONTROLS (Glassmorphic + Animated Rings)
   ============================================================================ */
#touch-controls {
  position: absolute;
  bottom: 22px;
  left: 26px;
  right: 26px;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 20;
}

#touch-controls.force-visible {
  display: flex;
}

@media (hover: none) and (pointer: coarse), (max-width: 960px) {
  #touch-controls {
    display: flex;
  }
}

.touch-dpad,
.touch-actions,
.touch-center-pills {
  display: flex;
  gap: 18px;
  pointer-events: auto;
  align-items: center;
}

.touch-btn {
  position: relative;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: 2px solid rgba(0, 240, 255, 0.55);
  background: radial-gradient(
    circle at 32% 30%,
    rgba(0, 240, 255, 0.22) 0%,
    rgba(16, 26, 62, 0.36) 60%,
    rgba(6, 10, 28, 0.48) 100%
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.92);
  font-size: 28px;
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.45),
    0 0 22px rgba(0, 240, 255, 0.25),
    inset 0 1px 2px rgba(255, 255, 255, 0.35);
  touch-action: manipulation;
  cursor: pointer;
  transition:
    transform 0.12s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.btn-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px dashed rgba(0, 240, 255, 0.42);
  pointer-events: none;
  animation: slowOrbit 9s linear infinite;
}

.jump-ring {
  border-color: rgba(255, 43, 214, 0.52);
  animation-duration: 7s;
  animation-direction: reverse;
}

@keyframes slowOrbit {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.btn-icon {
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.65));
}

.btn-sub {
  font-size: 9px;
  letter-spacing: 1px;
  color: #ffd166;
  margin-top: 3px;
  font-weight: 800;
}

.touch-btn:active {
  transform: scale(0.88);
  border-color: #2bff88;
  background: radial-gradient(
    circle at 35% 35%,
    rgba(43, 255, 136, 0.38) 0%,
    rgba(0, 240, 255, 0.28) 65%,
    rgba(10, 18, 42, 0.55) 100%
  );
  box-shadow:
    0 0 32px rgba(43, 255, 136, 0.55),
    inset 0 0 18px rgba(0, 240, 255, 0.45);
}

.jump-btn {
  width: 96px;
  height: 96px;
  border-color: rgba(255, 43, 214, 0.65);
  background: radial-gradient(
    circle at 32% 30%,
    rgba(255, 43, 214, 0.26) 0%,
    rgba(48, 16, 78, 0.38) 65%,
    rgba(10, 8, 28, 0.52) 100%
  );
  box-shadow:
    0 8px 30px rgba(0, 0, 0, 0.5),
    0 0 26px rgba(255, 43, 214, 0.32),
    inset 0 1px 2px rgba(255, 255, 255, 0.35);
}

.touch-pill {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1.5px solid rgba(0, 240, 255, 0.48);
  background: rgba(10, 18, 42, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #eef6ff;
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4), 0 0 14px rgba(0, 240, 255, 0.2);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s ease, border-color 0.15s ease;
}

.touch-pill:active {
  transform: scale(0.92);
  border-color: #2bff88;
}

/* the touch buttons are for playing only: hidden on the title, the episode map, pause, results and every overlay
   (game.js toggles body.playing when the state changes) */
body:not(.playing) #touch-controls { display: none !important; }

/* DOM dialogs (messages, privacy, report) and the small status line - real text, real buttons, always closable */
.rb-dialog { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(3, 4, 14, 0.72); }
.rb-card { width: min(520px, 100%); max-height: 90vh; overflow: auto; background: #0c1030; color: #eef3ff; border: 1.5px solid rgba(0, 240, 255, 0.5);
  border-radius: 18px; padding: 20px 22px; font: 600 16px/1.45 Rajdhani, 'Segoe UI', system-ui, sans-serif; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6); }
.rb-card h2 { margin: 0 0 10px; font: 800 20px Orbitron, 'Arial Black', sans-serif; color: #7ff6ff; }
.rb-card p { margin: 0 0 10px; }
.rb-card a { color: #ffd166; }
.rb-card .mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; opacity: 0.8; word-break: break-all; }
.rb-card textarea { width: 100%; box-sizing: border-box; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.06);
  color: inherit; font: inherit; padding: 10px; }
.rb-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.rb-row button { min-height: 44px; padding: 0 18px; border-radius: 12px; border: 0; background: linear-gradient(135deg, #ff3b5c, #ff2bd6); color: #fff;
  font: 800 14px Orbitron, 'Arial Black', sans-serif; cursor: pointer; }
.rb-row button.ghost { background: rgba(255, 255, 255, 0.1); }
.rb-row button:disabled { opacity: 0.5; }
.rb-toast { position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 30px); opacity: 0; transition: 0.25s; z-index: 101; pointer-events: none;
  background: rgba(10, 16, 40, 0.92); color: #fff; border: 1px solid rgba(0, 240, 255, 0.5); border-radius: 999px; padding: 10px 18px;
  font: 700 15px Rajdhani, 'Segoe UI', sans-serif; }
.rb-toast.on { opacity: 1; transform: translate(-50%, 0); }
