: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;
}

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

#hud {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 12;
  max-width: min(650px, calc(100vw - 28px));
  border-radius: 14px;
  padding: 14px 16px;
}

#hud h1 {
  margin: 0;
  font-size: clamp(1.1rem, 2vw, 1.6rem);
}

#hud p {
  margin: 8px 0 0;
  color: var(--soft);
  line-height: 1.35;
  font-size: 0.92rem;
}

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

#scoreHud {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 11;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.84rem;
  max-width: min(550px, calc(100vw - 28px));
}

#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;
}

#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;
}

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;
}

.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);
}

#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;
}

#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;
  right: 0;
  top: 0;
  width: 54vw;
  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;
}

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

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

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