:root {
  --panel: rgba(43, 10, 27, 0.82);
  --text: #fff2f7;
  --soft: #f7dce8;
  --line: rgba(255, 224, 236, 0.3);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #260a18;
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
}

canvas {
  display: block;
}

#loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 20% 20%, #7c2a4e, #210814);
  z-index: 80;
  font-size: 1.15rem;
}

.hidden,
#loading.hidden {
  display: none !important;
}

#inventoryPanel,
#balloonHud,
#vehicleHud {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(8px);
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.35);
}

.controls-help {
  margin-top: 8px;
  display: grid;
  gap: 4px;
  font-size: 0.78rem;
  color: #ffe7f0;
}

#interactionPrompt {
  position: fixed;
  left: 50%;
  bottom: 24%;
  transform: translateX(-50%);
  background: rgba(26, 6, 16, 0.89);
  border: 1px solid rgba(255, 204, 223, 0.65);
  border-radius: 999px;
  padding: 10px 15px;
  z-index: 14;
  font-size: 0.92rem;
  text-align: center;
}

.message-box {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(12, 2, 8, 0.72);
  display: grid;
  place-items: center;
  padding: 18px;
}

.message-card {
  width: min(720px, 94vw);
  background: rgba(45, 9, 26, 0.98);
  border: 1px solid rgba(255, 210, 228, 0.45);
  border-radius: 16px;
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.35);
  padding: 18px 20px;
  text-align: center;
  position: relative;
}

.countdown {
  display: inline-block;
  margin-left: 6px;
  font-weight: 700;
  color: #ff6b9d;
  min-width: 20px;
}

#welcomeBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: rgba(255, 107, 157, 0.3);
}

#welcomeBtn:disabled:hover {
  transform: none;
}

.message-card p {
  margin: 0 0 14px;
  color: var(--soft);
  line-height: 1.45;
}

#inventoryPanel {
  position: fixed;
  right: 14px;
  top: 14px;
  z-index: 14;
  border-radius: 14px;
  padding: 12px;
  min-width: 220px;
}

#inventoryPanel .item {
  font-size: 0.87rem;
  margin-bottom: 6px;
}

#balloonHud {
  position: fixed;
  right: 14px;
  top: 180px;
  z-index: 14;
  border-radius: 14px;
  padding: 12px;
  min-width: 220px;
  font-size: 0.85rem;
}

#balloonHud h3 {
  margin: 0 0 6px;
  font-size: 0.9rem;
}

#flightHint {
  margin-top: 6px;
  color: #ffd8e7;
  display: block;
}

#vehicleHud {
  position: fixed;
  right: 14px;
  top: 180px;
  z-index: 14;
  border-radius: 14px;
  padding: 12px;
  min-width: 220px;
  font-size: 0.85rem;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(8px);
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.35);
}

#vehicleHud h3 {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.speed-display {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 107, 157, 0.5);
}

.speed-unit {
  font-size: 0.9rem;
  color: var(--soft);
  margin-left: 4px;
}

.gear-display {
  display: inline-block;
  width: 32px;
  height: 32px;
  line-height: 32px;
  text-align: center;
  border-radius: 6px;
  font-weight: 700;
  font-size: 1.1rem;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.gear-park {
  background: rgba(100, 100, 100, 0.3);
  color: #aaa;
}

.gear-reverse {
  background: rgba(255, 80, 80, 0.3);
  color: #ff6b6b;
  border-color: rgba(255, 80, 80, 0.5);
}

.gear-first {
  background: rgba(80, 255, 80, 0.2);
  color: #6bff6b;
  border-color: rgba(80, 255, 80, 0.4);
}

.gear-second {
  background: rgba(80, 180, 255, 0.2);
  color: #6bb4ff;
  border-color: rgba(80, 180, 255, 0.4);
}

.gear-third {
  background: rgba(255, 180, 80, 0.2);
  color: #ffb46b;
  border-color: rgba(255, 180, 80, 0.4);
}

#vehicleHint {
  margin-top: 8px;
  color: #ffd8e7;
  display: block;
  font-size: 0.75rem;
  line-height: 1.4;
}

button {
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #d15285, #7b1e46);
  color: white;
  padding: 9px 12px;
  font-weight: 700;
  cursor: pointer;
}

#throwBtn {
  width: 100%;
  margin-top: 8px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(8, 2, 6, 0.82);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-content {
  width: min(900px, 95vw);
  background: rgba(45, 9, 26, 0.98);
  border: 1px solid rgba(255, 210, 228, 0.4);
  border-radius: 18px;
  padding: 18px;
  position: relative;
}

.simple-dismiss .modal-content {
  width: min(760px, 94vw);
  text-align: center;
}

#churchSignModal .modal-content {
  text-align: center;
}

#churchOutcomeEmoji {
  font-size: 2.2rem;
  margin: 0 0 8px;
}

.modal-content.large {
  width: min(1000px, 96vw);
}

.modal .close {
  position: absolute;
  right: 14px;
  top: 12px;
  padding: 5px 10px;
  background: rgba(255, 232, 241, 0.15);
}

.message-card .close {
  position: absolute;
  right: 14px;
  top: 12px;
  padding: 5px 10px;
  background: rgba(255, 232, 241, 0.15);
}

#galleryGrid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

#galleryGrid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(255, 226, 238, 0.3);
}

#rsvpFrame {
  margin-top: 10px;
  width: 100%;
  min-height: min(72vh, 620px);
  border: none;
  border-radius: 12px;
  background: #fff;
}

#mobileControls {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 13;
}

#joystickBase {
  position: absolute;
  bottom: 26px;
  left: 20px;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  border: 2px solid rgba(255, 226, 238, 0.52);
  background: rgba(28, 7, 17, 0.34);
  display: none;
  pointer-events: auto;
  touch-action: none;
  z-index: 2;
}

#joystickKnob {
  position: absolute;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  left: 36px;
  top: 36px;
  background: radial-gradient(circle at 30% 30%, #ffdbe8, #c25380);
}

#lookZone {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  touch-action: none;
}

#jumpBtn {
  display: none;
  position: absolute;
  right: 18px;
  bottom: 102px;
  width: 86px;
  height: 46px;
  border-radius: 26px;
  pointer-events: auto;
  z-index: 2;
}

#interactBtn {
  display: none;
  position: absolute;
  right: 18px;
  bottom: 158px;
  min-width: 110px;
  height: 46px;
  border-radius: 26px;
  pointer-events: auto;
  z-index: 2;
}

@media (hover: none) and (pointer: coarse) {
  #joystickBase,
  #jumpBtn {
    display: block;
  }

  #interactBtn:not(.hidden) {
    display: block;
  }

  #hud,
  #inventoryPanel,
  #balloonHud,
  #vehicleHud {
    font-size: 0.8rem;
  }

  #hud p {
    font-size: 0.82rem;
  }
}
