:root { color-scheme: dark; }
html, body { height: 100%; margin: 0; background: #000000;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, 'Helvetica Neue', Arial, Noto Sans; }
#app { position: relative; height: 99dvh; overflow: hidden; }
canvas { display:block; }

.hud { position: absolute; inset: 0; pointer-events: none; }
.title {
  position: absolute; left: 48px; top: 48px; pointer-events: none;
  color: #d6e4ff; letter-spacing: .2px; line-height: 1.2;
  text-shadow: 0 8px 40px rgba(0,140,255,.35);
}
.title h1 { font-size: clamp(28px, 3.4vw, 52px); margin: 0 0 .2em; font-weight: 700; }
.title p { margin: 0; opacity: .8; font-weight: 500; }

.label {
  padding: 6px 10px; border-radius: 14px; font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,.08); color: #e6f0ff; backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.12); white-space: nowrap;
  box-shadow: 0 6px 22px rgba(0,180,255,.25);
  pointer-events: auto; cursor: pointer;
  transition: transform .18s, box-shadow .18s, opacity .18s;
}
.label:hover { transform: scale(1.06); box-shadow: 0 10px 28px rgba(0,200,255,.35); }
.label.active { border-color: rgba(120,200,255,.8); box-shadow: 0 0 0 2px rgba(120,200,255,.35); }
.label small { display:block; opacity:.75; font-weight:500; }

.credits { position:absolute; right: 12px; bottom: 8px; color:#7f9ccf; font-size:12px; opacity:.8; }
.legend-dot { display:inline-block; width:8px; height:8px; border-radius:50%; background:#7cc8ff; margin-right:6px; box-shadow:0 0 12px #58b7ff; }

/* === theme panel (minimal) === */
.panel {
  position: absolute; right: 12px; bottom: 12px; display: flex; gap: 8px; z-index: 3;
  pointer-events: auto; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  flex-wrap: wrap; width: min(420px, 46vw);
}
.btn {
  padding: 6px 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,.12); color: #cfe;
  background: rgba(255,255,255,.06); cursor: pointer; user-select: none;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: transform .12s ease, background .2s ease, border-color .2s ease;
  touch-action: manipulation;
}
.btn:hover { transform: translateY(-1px); background: rgba(255,255,255,.12); }
.btn.active { border-color: rgba(120,255,180,.45); box-shadow: 0 0 0 1px rgba(120,255,180,.25) inset; }

/* === Globe bottom spacing & fade === */
.globe-section {
  position: relative;              /* 페이드 절대배치 기준 */
  margin-bottom: 14vh;             /* ⬅️ 섹션 아래 여백 (원하는 만큼 조절: 10~20vh 권장) */
  /* 필요시 아래 grow가 잘리는 경우 약간의 패딩을 더해도 됨 */
  /* padding-bottom: 4vh; */
}

/* 지구와 다음 섹션 사이를 부드럽게 연결하는 블랙 페이드 */
.globe-fade {
  position: absolute;
  left: 0; right: 0; bottom: -1px; /* -1px로 경계 라인 감춤 */
  height: 18vh;                    /* ⬅️ 페이드 높이 (원하는 느낌에 맞춰 12~24vh 범위 추천) */
  pointer-events: none;
  z-index: 2;                      /* HUD(3), 버튼(3)보다 낮게, 캔버스(1)보단 높게 */
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0%,
    rgba(0,0,0,0.35) 55%,
    rgba(0,0,0,0.65) 78%,
    #000 100%
  );
}

/* 작은 화면에서 살짝 값 축소 (선택) */
@media (max-width: 768px) {
  .globe-section{ margin-bottom: 10vh; }
  .globe-fade{ height: 14vh; }
}
@media (max-width: 420px) {
  .label { font-size: 11px; }
}

/* ✅ 모바일에서 버튼(.panel) 위로 올리고 크기 키우기 */
  .btn {
    padding: 10px 14px !important;  /* 🔹 버튼 크기 키움 (기본 6x10 → 10x14) */
    font-size: 15px !important;     /* 🔹 텍스트 살짝 크게 */
    border-radius: 12px;            /* 🔹 둥글기 살짝 강화 */
  }

/* ✅ 모바일(≤820px)에서 지구 아래 여백/페이드/버튼 위치 동시 조정 */
@media (max-width: 820px) {
  /* 1) 섹션 하단 여백 크게 줄이기 */
  section#globe-section.globe-section {
    margin-bottom: 3vh !important; /* 기존 14vh → 3vh */
  }

  /* 2) 블랙 페이드도 짧게 (여백처럼 느껴지는 부분) */
  section#globe-section .globe-fade {
    height: 6vh !important;       /* 기존 18vh → 6vh */
  }

  /* 3) 버튼 패널을 위로 당기기 + 노치 대응 */
  section#globe-section .panel {
    bottom: calc(150px + env(safe-area-inset-bottom)) !important; /* 필요시 60~120px로 조절 */
  }

  /* (선택) 버튼 크기 살짝 키워 터치 편의 ↑ */
  section#globe-section .btn {
    padding: 10px 14px !important;
    font-size: 15px !important;
  }
}
