/* 甲乙丙 studio — 火山口新手期 H5
   dimetric ~2:1 斜俯视（约 35–40°），疯狂水世界轻松卡通 */

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

:root {
  --phone-w: 390px;
  --phone-h: 780px;
  --bg-desk: #1a1210;
  --hud-bg: rgba(40, 22, 16, 0.82);
  --accent: #ff8c42;
  --accent-soft: #ffb347;
}

html, body {
  height: 100%;
  background: var(--bg-desk);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    system-ui, -apple-system, sans-serif;
  color: #fff8f0;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  min-height: 100dvh;
}

.phone {
  width: min(100vw, var(--phone-w));
  height: min(100dvh, var(--phone-h));
  max-width: var(--phone-w);
  background: linear-gradient(180deg, #3d2418 0%, #2a1810 100%);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 0 0 3px #1a0e0a,
    0 20px 60px rgba(0, 0, 0, 0.55),
    inset 0 0 40px rgba(255, 100, 40, 0.08);
  border-radius: 0;
}

/* Desktop: centered phone frame */
@media (min-width: 601px) and (pointer: fine) {
  .phone {
    border-radius: 28px;
    height: min(92dvh, var(--phone-h));
  }
}

/* Mobile / touch / narrow: edge-to-edge fullscreen */
@media (max-width: 600px), (pointer: coarse) {
  html, body { background: #2a1810; }
  body { display: block; }
  .phone {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: -webkit-fill-available;
    height: 100dvh;
    max-width: none;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .title-strip { padding-top: max(10px, env(safe-area-inset-top)); padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .hud { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .actions { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
}

.title-strip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 8px;
  background: linear-gradient(180deg, #4a2c1e 0%, #3a2218 100%);
  border-bottom: 2px solid rgba(255, 140, 66, 0.35);
  z-index: 20;
}

.title-strip .studio {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff8c42, #ff5e3a);
  color: #fff;
  box-shadow: 0 2px 6px rgba(255, 80, 30, 0.4);
}

.title-strip h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.hud {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  background: var(--hud-bg);
  backdrop-filter: blur(8px);
  z-index: 20;
  border-bottom: 1px solid rgba(255, 180, 100, 0.15);
}

.stat {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 200, 140, 0.12);
  font-size: 12px;
}

.stat .icon { font-size: 14px; line-height: 1; }
.stat .label { opacity: 0.7; font-size: 11px; }
.stat strong {
  margin-left: auto;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--accent-soft);
}

.viewport {
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
  cursor: grab;
  background: #2a1c14;
  touch-action: none;
  min-height: 0;
}

.viewport:active { cursor: grabbing; }

.map {
  position: absolute;
  width: 900px;
  height: 1500px;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform;
  background: #2a1c14;
}

.crater-back,
.crater-front {
  position: absolute;
  left: 0;
  top: 0;
  width: 900px;
  height: 1500px;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.crater-back { z-index: 1; }
.crater-front { z-index: 8; }

.edge-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  background:
    linear-gradient(180deg, rgba(20, 10, 8, 0.22) 0%, transparent 10%, transparent 90%, rgba(20, 10, 8, 0.28) 100%);
}

.corner-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 12;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(20, 12, 8, 0.65);
  border: 1px solid rgba(255, 200, 140, 0.2);
  color: rgba(255, 240, 220, 0.85);
  pointer-events: none;
  letter-spacing: 0.04em;
}

/* Magma — foreshortened ellipse + near-side wall height */
.magma-pit {
  position: absolute;
  left: 385px;
  top: 520px;
  width: 140px;
  height: 78px;
  z-index: 2;
}

.magma-glow {
  position: absolute;
  left: -24px;
  right: -24px;
  top: -18px;
  bottom: -10px;
  border-radius: 50%;
  background: radial-gradient(ellipse 60% 50% at 50% 55%, rgba(255, 120, 40, 0.55) 0%, rgba(255, 80, 20, 0.18) 55%, transparent 75%);
  animation: glowPulse 2.4s ease-in-out infinite;
}

/* visible “drop” on near side */
.magma-wall {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 42px;
  height: 22px;
  border-radius: 0 0 50% 50%;
  background: linear-gradient(180deg, #c43e00 0%, #6b1800 100%);
  opacity: 0.85;
  z-index: 1;
}

.magma-core {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 8px;
  height: 48px;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 40% 35%, #ffe066 0%, #ff8c00 35%, #e63900 70%, #8b1a00 100%);
  box-shadow:
    0 0 20px 6px rgba(255, 100, 30, 0.65),
    inset 0 -6px 12px rgba(139, 20, 0, 0.5);
  border: 3px solid #6b3a22;
  z-index: 2;
}

.bubble {
  position: absolute;
  width: 12px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffe066, #ff6600);
  opacity: 0.85;
  animation: bubbleUp 2s ease-in infinite;
  z-index: 3;
}
.bubble.b1 { left: 36px; top: 28px; animation-delay: 0s; }
.bubble.b2 { left: 78px; top: 32px; width: 9px; height: 6px; animation-delay: 0.7s; }
.bubble.b3 { left: 58px; top: 22px; width: 10px; height: 7px; animation-delay: 1.3s; }

@keyframes glowPulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.06); opacity: 1; }
}
@keyframes bubbleUp {
  0% { transform: translateY(0) scale(1); opacity: 0.9; }
  70% { opacity: 0.55; }
  100% { transform: translateY(-28px) scale(0.45); opacity: 0; }
}

.snow {
  position: absolute;
  border-radius: 50%;
  background: linear-gradient(160deg, #f0f7fa 0%, #c8e0ec 70%);
  box-shadow: inset 0 -3px 6px rgba(100, 140, 160, 0.35);
  opacity: 0.85;
  z-index: 2;
}
.snow.s-in1 { left: 320px; top: 520px; width: 52px; height: 22px; transform: rotate(-12deg); }
.snow.s-in2 { left: 540px; top: 640px; width: 58px; height: 24px; transform: rotate(8deg); }

.paths {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.building {
  position: absolute;
  z-index: 4;
  filter: drop-shadow(3px 5px 3px rgba(0, 0, 0, 0.35));
  line-height: 0;
}

.building svg { display: block; }

.building .tag {
  position: absolute;
  left: 50%;
  bottom: -14px;
  transform: translateX(-50%);
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(30, 16, 10, 0.7);
  color: #ffe8c8;
  pointer-events: none;
}

.vent {
  position: absolute;
  width: 40px;
  height: 16px;
  border-radius: 50%;
  background: #4a2c1e;
  border: 3px solid #6b4030;
  z-index: 3;
  box-shadow: inset 0 0 10px #ff6600, 0 0 10px rgba(255, 100, 30, 0.35);
}
.vent.small { width: 26px; height: 11px; }
.vent .steam {
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 18px;
  height: 36px;
  margin-left: -9px;
  background: linear-gradient(180deg, transparent, rgba(255, 200, 150, 0.35), transparent);
  border-radius: 50%;
  animation: steamRise 2.5s ease-in-out infinite;
}
@keyframes steamRise {
  0%, 100% { transform: translateY(0) scaleX(1); opacity: 0.3; }
  50% { transform: translateY(-16px) scaleX(1.25); opacity: 0.7; }
}

.worker {
  position: absolute;
  z-index: 5;
  animation: bob 2.2s ease-in-out infinite;
  pointer-events: none;
  line-height: 0;
  /* slight foreshortening */
  transform: scaleY(0.92);
}
.worker:nth-child(odd) { animation-delay: 0.4s; }
@keyframes bob {
  0%, 100% { transform: scaleY(0.92) translateY(0); }
  50% { transform: scaleY(0.92) translateY(-3px); }
}

.actions {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  padding: 10px 14px 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #3a2218 0%, #2a1810 100%);
  border-top: 2px solid rgba(255, 140, 66, 0.3);
  z-index: 20;
}

.action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(180deg, #5a3828 0%, #3d2618 100%);
  color: #fff8f0;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow:
    0 3px 0 #241410,
    inset 0 1px 0 rgba(255, 200, 140, 0.15);
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.action-btn .emoji { font-size: 22px; line-height: 1; }

.action-btn:active,
.action-btn.pressed {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #241410, inset 0 1px 0 rgba(255, 200, 140, 0.1);
  background: linear-gradient(180deg, #ff8c42 0%, #e06a28 100%);
}

.action-btn.highlight {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
  background: linear-gradient(180deg, #ff9a55 0%, #e07030 100%);
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 100px;
  transform: translateX(-50%) translateY(12px);
  z-index: 50;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(20, 12, 8, 0.88);
  border: 1px solid rgba(255, 180, 100, 0.35);
  color: #fff8f0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* v2: camp group sits on the flat floor below the mountain wall */
.camp {
  position: absolute;
  left: 0; top: 0;
  width: 900px; height: 1500px;
  transform: translate(0, 420px);
  z-index: 2;
  pointer-events: none;
}
.camp .paths { height: 1200px; bottom: auto; }
