* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0c0e16; font-family: Manrope, -apple-system, sans-serif; }

#scene { position: fixed; inset: 0; display: block; outline: none; cursor: crosshair; }

#hud-hint {
  position: fixed; top: 16px; left: 16px; z-index: 5;
  background: rgba(20, 22, 32, 0.68); color: #e3e6ee; padding: 10px 14px;
  border-radius: 12px; font-size: 13px; line-height: 1.5; max-width: 260px;
  pointer-events: none;
  animation: hint-out 1s 20s forwards;
}
@keyframes hint-out { to { opacity: 0; } }
#hud-hint b { color: #ffe28a; }

#hud-prompt {
  position: fixed; left: 50%; bottom: 64px; transform: translateX(-50%);
  background: rgba(20, 22, 32, 0.82); color: #fff; padding: 8px 18px;
  border-radius: 999px; font-size: 14px; font-weight: 700; letter-spacing: 0.2px;
  display: none; z-index: 5; pointer-events: none;
}

#hud-panel {
  position: fixed; right: 0; top: 0; height: 100%; width: 360px; max-width: 92vw;
  background: #141624; color: #e3e6ee; z-index: 10;
  transform: translateX(105%); transition: transform .4s cubic-bezier(.2,.8,.2,1);
  padding: 28px 24px; overflow-y: auto;
}
#hud-panel.open { transform: translateX(0); box-shadow: -20px 0 40px rgba(0,0,0,0.35); }
#hud-panel-close {
  position: absolute; top: 18px; right: 18px; background: none; border: none;
  color: #9aa3b5; font-size: 20px; cursor: pointer; line-height: 1;
}
.hud-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.hud-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
#hud-panel-project { font-size: 13px; color: #9aa3b5; text-transform: uppercase; letter-spacing: 0.5px; }
#hud-panel-role { font-size: 24px; font-weight: 800; margin: 2px 0 14px; }
#hud-panel-desc { font-size: 14px; line-height: 1.55; color: #c9cee8; margin-bottom: 16px; }
#hud-panel h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: #7a86e8; margin: 18px 0 8px; }
#hud-panel-skills { list-style: none; padding: 0; margin: 0; font-size: 14px; }
#hud-panel-skills li { padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
#hud-panel-stack { display: flex; flex-wrap: wrap; gap: 6px; }
#hud-panel-stack span { background: rgba(255,255,255,0.08); border-radius: 8px; padding: 4px 10px; font-size: 12px; }

#hud-click-start {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 11, 18, 0.72); color: #fff; font-size: 18px; font-weight: 700;
  text-align: center; cursor: pointer;
}
#hud-click-start.hidden { display: none; }

/* touch gamepad, shown only on touch screens */
html, body, #scene, #touch-controls { touch-action: none; }
#hud-panel { touch-action: pan-y; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#touch-controls { display: none; }
body.touch #touch-controls { display: block; }
body.touch #hud-hint { display: none; }
body.touch #hud-prompt { top: calc(12px + env(safe-area-inset-top)); bottom: auto; }
body.touch #hud-panel-close { width: 44px; height: 44px; top: 8px; right: 8px; }

.stick {
  position: fixed; bottom: calc(20px + env(safe-area-inset-bottom)); width: 124px; height: 124px;
  display: flex; align-items: center; justify-content: center; z-index: 6;
  border-radius: 50%; background: rgba(20, 22, 32, 0.28); border: 2px solid rgba(255, 255, 255, 0.55);
  touch-action: none;
}
#stick-move { left: calc(20px + env(safe-area-inset-left)); }
#stick-look { right: calc(20px + env(safe-area-inset-right)); }
.stick-knob {
  width: 56px; height: 56px; border-radius: 50%; pointer-events: none;
  background: rgba(255, 255, 255, 0.85); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.touch-buttons {
  position: fixed; right: calc(14px + env(safe-area-inset-right)); bottom: calc(156px + env(safe-area-inset-bottom));
  display: flex; gap: 8px; z-index: 6;
}
.touch-btn {
  width: 62px; height: 62px; padding: 0; border-radius: 50%; touch-action: none;
  background: rgba(20, 22, 32, 0.78); color: #ffffff; border: 2px solid rgba(255, 255, 255, 0.55);
  font: 700 12px Manrope, sans-serif;
}
.touch-btn:disabled { opacity: 0.35; }
.touch-btn.held { background: #ffe28a; color: #1b1f2a; }
#btn-info:not(:disabled) { background: #3b48b0; }
#btn-car:not(:disabled) { background: #d4544a; }
@media (max-height: 340px) {
  .stick { width: 104px; height: 104px; bottom: 12px; }
  .stick-knob { width: 48px; height: 48px; }
  .touch-btn { width: 54px; height: 54px; }
  .touch-buttons { bottom: 124px; }
}
