:root {
  color-scheme: dark;
  --brand: #f5f8ff;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: 'Plus Jakarta Sans', 'Noto Sans KR', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: radial-gradient(120% 140% at 20% 20%, rgba(37, 53, 82, 0.6), rgba(10, 12, 18, 1) 70%),
              linear-gradient(160deg, #0d111a 0%, #182132 60%, #0b0f16 100%);
  color: #e9eef5;
  background-attachment: fixed;
}

/* 브랜드 로고 */
.brand-logo {
  display: inline-block;
  text-decoration: none;
  color: var(--brand);
  font-family: "Anton","Noto Sans KR",system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  text-transform: uppercase;
  line-height: 1.1;
  font-size: clamp(16px, 3vw, 30px);
  letter-spacing: 1px;
  text-shadow: 0 1px 0 rgba(0,0,0,.2);
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.glass-panel {
  background: rgba(16, 20, 28, 0.7);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
}

/* 버거 버튼 */
.burger-btn {
  display: none;
  margin-right: 10px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.12);
  color: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  width: 42px;
  height: 36px;
}

.burger {
  position: relative;
  display: block;
  width: 18px;
  height: 2px;
  background: #f5f8ff;
  border-radius: 2px;
}
.burger::before, .burger::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: #f5f8ff;
  border-radius: 2px;
  transition: transform .2s ease;
}
.burger::before { top: -6px; }
.burger::after { top: 6px; }
.burger-btn.is-open .burger { background: transparent; }
.burger-btn.is-open .burger::before { top: 0; transform: rotate(45deg); }
.burger-btn.is-open .burger::after { top: 0; transform: rotate(-45deg); }

/* 오버레이 */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 14, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 15;
}
.overlay.is-visible { opacity: 1; pointer-events: auto; }

/* 툴바 */
.toolbar {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  left: calc(16px + env(safe-area-inset-left));
  right: calc(16px + env(safe-area-inset-right));
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-radius: 22px;
  color: #f5f8ff;
  z-index: 30;
}
.toolbar .title {
  font-weight: 600;
  letter-spacing: 0.4px;
  font-size: 1.05rem;
}
.toolbar .hint {
  opacity: 0.82;
  font-size: 0.86rem;
}
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.toolbar-btn {
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.18);
  color: #f5f8ff;
  font-size: 0.82rem;
  font-weight: 500;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.toolbar-btn:hover,
.toolbar-btn:focus {
  background: rgba(255, 255, 255, 0.32);
  border-color: rgba(255, 255, 255, 0.4);
  color: #0b0e14;
}
.toolbar-btn:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

/* ====== 사이드 패널 (PC 기본) ====== */
.mesh-list {
  position: absolute;
  left: calc(24px + env(safe-area-inset-left));
  top: calc(100px + env(safe-area-inset-top));
  width: 260px;
  max-height: calc(100% - 160px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 18px;
  border-radius: 26px;
  color: #f1f4fb;
  overflow: hidden;
  z-index: 20;
}
.mesh-list h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mesh-items {
  margin-top: 10px;
  overflow-y: auto;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mesh-items::-webkit-scrollbar {
  width: 6px;
}
.mesh-items::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 12px;
}
.mesh-item {
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
  transition: all 0.2s ease;
}
.mesh-item:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
  color: #101420;
}
.mesh-item:focus-visible {
  outline: 2px solid rgba(76, 201, 255, 0.55);
  outline-offset: 2px;
}
.mesh-item.is-active {
  background: rgba(76, 201, 255, 0.86);
  border-color: rgba(255, 255, 255, 0.4);
  color: #041224;
  box-shadow: 0 10px 24px rgba(76, 201, 255, 0.35);
}
.mesh-item:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* 정보 패널 */
.panel {
  position: absolute;
  right: 24px;
  top: 100px;
  width: 340px;
  max-width: calc(100% - 48px);
  border-radius: 26px;
  padding: 22px;
  color: #e6ecf7;
  display: none;
  z-index: 25;
}
.panel h3 {
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.panel .row {
  display: flex;
  gap: 12px;
  padding: 6px 0;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.panel .row:last-of-type {
  border-bottom: 0;
}
.panel .row > div:first-child {
  opacity: 0.68;
  min-width: 90px;
}
.panel p {
  margin: 0.4rem 0;
  font-size: 0.9rem;
  color: #cbd6e6;
}
.panel .close {
  margin-top: 14px;
}

/* 상태 표시 */
.status {
  position: absolute;
  left: calc(24px + env(safe-area-inset-left));
  bottom: calc(24px + env(safe-area-inset-bottom));
  padding: 10px 16px;
  border-radius: 18px;
  background: rgba(12, 17, 26, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  letter-spacing: 0.25px;
  color: #c8d2e2;
  z-index: 20;
}

/* ==================================
   📱 반응형 (모바일 전용)
================================== */




@media (max-width: 992px) {
  .toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .burger-btn { display: inline-block; }

  /* mesh-list를 바텀시트로 전환 */
  .mesh-list {
    position: fixed;
    left: calc(12px + env(safe-area-inset-left));
    right: calc(12px + env(safe-area-inset-right));
    bottom: calc(12px + env(safe-area-inset-bottom));
    top: auto;
    width: auto;
    max-height: min(60vh, calc(100vh - 140px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
    transform: translateY(110%);
    transition: transform .25s ease;
    overflow: hidden;
    border-radius: 18px 18px 22px 22px;
    z-index: 30;
  }
  .mesh-list.is-open { transform: translateY(0); }
  .mesh-list .sheet-handle {
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255,255,255,.35);
    margin: 4px auto 8px;
  }


  /* 패널도 고정형으로 */
  .panel {
    position: fixed;
    right: 16px;
    left: 16px;
    top: auto;
    bottom: 16px;
    width: auto;
    max-height: calc(100vh - 120px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow: auto;
  }

  .status {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .mobile-notice {
  position: fixed;
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  padding: 12px 16px;
  border-radius: 18px;
  display: none;
  z-index: 9999;  /* ✅ 맨 위로 올리기 */
}

.mobile-notice.is-visible {
  display: flex;
  align-items: center;
  gap: 12px;
}

}

/* 작은 기기 */
@media (max-width: 576px) {
  .toolbar {
    padding: 10px 14px;
    border-radius: 16px;
  }
  .toolbar .hint { display: none; }
  .toolbar-btn {
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
  }
  .mesh-list {
    padding: 10px 12px 14px;
    border-radius: 16px;
    max-height: min(65vh, calc(100vh - 120px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
  }
  .mesh-items { padding-right: 4px; }
  .panel { padding: 16px; border-radius: 16px; }
  .status { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
}
