* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Avenir Next", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #87c5f0;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior: none;
}

#app, #app canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

#zoom-lock-tip {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  z-index: 200;
  max-width: min(92vw, 360px);
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(20, 32, 48, 0.92);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
#zoom-lock-tip.hidden { display: none !important; }

/* ---------- Orientation guide ---------- */
#orient-tip {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 16, 32, 0.88);
  padding: 24px;
}
#orient-tip.hidden { display: none !important; }
#orient-tip-card {
  max-width: 320px;
  text-align: center;
  color: #fff;
}
#orient-tip-icon {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 14px;
  animation: orientSpin 1.6s ease-in-out infinite;
}
#orient-tip-text {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.5;
}
@keyframes orientSpin {
  0%, 100% { transform: rotate(-20deg); }
  50% { transform: rotate(20deg); }
}

/* Gameplay: discourage landscape layout on phones */
@media (max-width: 900px) and (orientation: landscape) {
  body:not(.parent-mode) #joystick,
  body:not(.parent-mode) #jump-btn {
    transform: scale(0.85);
    transform-origin: bottom left;
  }
  body:not(.parent-mode) #jump-btn {
    transform-origin: bottom right;
  }
}

.hidden { display: none !important; }
/* ---------- Hint ---------- */
#hint {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  background: rgba(20, 32, 48, 0.45);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 10;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
/* ---------- Start overlay ---------- */
#start-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 24, 40, 0.45);
  backdrop-filter: blur(5px);
}

#start-card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 24px;
  padding: 36px 44px;
  text-align: center;
  max-width: min(420px, 88vw);
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}

#start-card h1 {
  font-size: clamp(22px, 5.5vw, 32px);
  color: #1d3557;
  margin-bottom: 18px;
  line-height: 1.25;
}

#start-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#start-btn {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(180deg, #2ec4b6, #189a8f);
  border: none;
  border-radius: 999px;
  padding: 14px 52px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(24, 154, 143, 0.45);
  transition: transform 0.1s ease;
}
#start-btn:disabled {
  background: #a9bfc9;
  box-shadow: none;
  cursor: wait;
}
#start-btn:not(:disabled):hover { transform: scale(1.05); }
#start-btn:not(:disabled):active { transform: scale(0.97); }

#loading-wrap {
  margin-bottom: 20px;
  background: #f3f7fb;
  border: 2px solid #dde7f0;
  border-radius: 16px;
  padding: 16px 18px;
  text-align: left;
}

#loading-tagline {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
  color: #1d3557;
  margin-bottom: 12px;
  text-align: center;
}

#loading-howto {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.65;
  color: #6b7f95;
}

#loading-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #dde7f0;
  overflow: hidden;
  margin-bottom: 8px;
}

#loading-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffd24a, #ff9f1c);
  transition: width 0.2s ease;
}

#loading-text {
  font-size: 13px;
  color: #6b7f95;
  text-align: center;
}

@keyframes talkPulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.08); }
}
@keyframes okPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
