html, body {
  margin: 0;
  padding: 0;
  background: #0e0f12;
  color: #e7e7e7;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  height: 100%;
  overscroll-behavior: none;
  touch-action: none;
}
.wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 24px;
  height: 100%;
  justify-content: center;
}
canvas {
  background: #17181c;
  box-shadow: 0 10px 30px rgba(0,0,0,0.55), 0 2px 6px rgba(0,0,0,0.35) inset;
  border-radius: 10px;
  image-rendering: pixelated;
  width: 100%;
  max-width: 96vw;
  height: auto;
  aspect-ratio: 20/12;
}
.hud {
  width: 100%;
  max-width: 96vw;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: #cfcfcf;
  gap: 10px;
  flex-wrap: wrap;
}
.hud strong { color: #fff; }
.hud-left { display: flex; flex-direction: column; line-height: 1.25; }
.hud-sub { font-size: 11px; color: #8f9aa8; font-weight: 500; }
.hud-center { display: flex; align-items: center; gap: 8px; }
.belt-chip, .kihap-chip, .room-chip {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.belt-chip .belt-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: -1px;
  border: 1px solid rgba(0,0,0,0.35);
}
.kihap-chip { color: #ffd76a; }
.objective {
  width: 100%;
  max-width: 96vw;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #ffe9a8;
  background: linear-gradient(180deg, rgba(255,190,60,0.12), rgba(255,190,60,0.05));
  border: 1px solid rgba(255,190,60,0.28);
  border-radius: 10px;
  padding: 5px 12px;
  box-sizing: border-box;
  min-height: 26px;
}
.objective.done { color: #9be39b; border-color: rgba(120,220,120,0.3); background: linear-gradient(180deg, rgba(120,220,120,0.1), rgba(120,220,120,0.04)); }

/* Dialogue bubble */
.bubble {
  position: absolute;
  background: #ffffff;
  color: #111;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  max-width: 240px;
  text-align: center;
  z-index: 10;
  pointer-events: none;
  transform: translate(-50%, -100%);
  margin-top: -18px;
}
.bubble::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -6px;
  border-width: 6px;
  border-style: solid;
  border-color: #ffffff transparent transparent transparent;
}
@keyframes bubblePanic {
  0%   { transform: translate(-50%, -100%) translateX(-1.5px) rotate(-1deg); }
  25%  { transform: translate(-50%, -100%) translateX( 1.5px) rotate( 1deg); }
  50%  { transform: translate(-50%, -100%) translateX(-1.2px) rotate(-0.8deg); }
  75%  { transform: translate(-50%, -100%) translateX( 1.2px) rotate( 0.8deg); }
  100% { transform: translate(-50%, -100%) translateX( 0px)   rotate( 0deg); }
}
.bubble-panic { color: #d0021b; animation: bubblePanic 90ms linear infinite; }

/* Mobile Controls */
.mobile-controls {
  display: none;
  position: fixed;
  bottom: 30px;
  left: 30px;
  width: 150px;
  height: 150px;
  z-index: 100;
  pointer-events: none;
}
@media (hover: none) and (pointer: coarse) {
  .mobile-controls { display: block; }
}
.dpad-btn {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  pointer-events: auto;
  touch-action: none;
  display: flex;
  justify-content: center;
  align-items: center;
  color: rgba(255,255,255,0.7);
  font-size: 20px;
  user-select: none;
  -webkit-user-select: none;
  backdrop-filter: blur(4px);
}
.dpad-btn:active { background: rgba(255, 255, 255, 0.3); color: #fff; }
.dpad-up { top: 0; left: 50%; transform: translateX(-50%); }
.dpad-down { bottom: 0; left: 50%; transform: translateX(-50%); }
.dpad-left { left: 0; top: 50%; transform: translateY(-50%); }
.dpad-right { right: 0; top: 50%; transform: translateY(-50%); }

.action-btn {
  position: fixed;
  bottom: 60px;
  right: 40px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(255, 59, 59, 0.25);
  border: 2px solid rgba(255, 59, 59, 0.4);
  pointer-events: auto;
  display: none;
  justify-content: center;
  align-items: center;
  color: white;
  font-weight: bold;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  font-size: 14px;
  backdrop-filter: blur(4px);
}
.action-btn:active { background: rgba(255, 59, 59, 0.5); transform: scale(0.95); }
@media (hover: none) and (pointer: coarse) {
  .action-btn { display: flex; }
}
