:root {
  --primary: #c8ff2b;
  --accent: #7100ff;
  --ink: #0f172a;
  --muted: #6b7280;
  --line: #e5e7eb;
}

@font-face {
  font-family: "Apple SD Gothic Neo";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/gh/fonts-archive/AppleSDGothicNeo/AppleSDGothicNeo-Regular.woff2")
    format("woff2");
}
@font-face {
  font-family: "Apple SD Gothic Neo";
  font-weight: 800;
  font-style: normal;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/gh/fonts-archive/AppleSDGothicNeo/AppleSDGothicNeo-ExtraBold.woff2")
    format("woff2");
}

/* ========== Base ========== */
* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}
html {
  scroll-behavior: smooth;
}

body {
  font-family: "Apple SD Gothic Neo", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #fff;
}

/* 페이지 스크롤 잠금 + 1뷰포트 고정 */
.container {
  max-width: 430px;
  margin: 0 auto;
  padding: 18px 16px 0; /* ⬅️ 하단 패딩 제거(리스트 내부로 이동) */
  height: 100dvh;
  overflow: hidden;
}
@supports not (height: 100dvh) {
  .container {
    height: 100vh;
  }
}

/* 공통 스크린 */
.screen {
  display: none;
  min-height: 100%;
  align-items: center;
  justify-content: center;
}
.screen.active {
  display: flex;
}
.hidden {
  display: none;
}

/* ========== Screen A (scan) ========== */
.loader-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.ring {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: conic-gradient(
    var(--accent) 0 70deg,
    transparent 70deg 180deg,
    var(--primary) 180deg 250deg,
    transparent 250deg 360deg
  );
  -webkit-mask: radial-gradient(circle at center, transparent 58%, #000 60%);
  mask: radial-gradient(circle at center, transparent 58%, #000 60%);
  animation: spin 1.5s linear infinite;
  box-shadow: 0 0 0 6px rgba(113, 0, 255, 0.06);
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.scan-text {
  font-weight: 800;
  font-size: 1.1rem;
}
.hint {
  color: var(--muted);
  font-size: 0.9rem;
}
.cta {
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(113, 0, 255, 0.22);
}
.cta i {
  margin-right: 8px;
}

/* ========== Screen B (list) ========== */
/* 화면을 2단(Grid)으로: (1) 고정 헤더, (2) 내부 스크롤 리스트 */
#screen-list {
  display: grid;
  grid-template-rows: auto 1fr; /* 헤더 / 리스트 */
  height: 100%;
  min-height: 0; /* 내부 스크롤 허용을 위한 필수 값 */
}

/* 헤더: 상단 고정 */
#screen-list .list-head {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  padding:  6px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  width: 100%;
}

/* 제목 + 이모지 */
.list-head .title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.list-head h1 {
  margin: 0;
  font-size: clamp(16px, 2.1vh, 18px); /* ⬅️ 살짝 키움 */
  font-weight: 800;
}

/* 위치 pill */
.loc-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(
      0deg,
      rgba(200, 255, 43, 0.35),
      rgba(200, 255, 43, 0.35)
    )
    border-box;
  border: 1.5px solid transparent;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.08);
  font-size: clamp(12px, 1.8vh, 14px); /* ⬅️ 살짝 키움 */
}
.loc-pill i {
  color: var(--accent);
}
.pill-btn {
  margin-left: auto;
  border: none;
  background: #fff;
  color: var(--accent);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.pill-btn:hover {
  box-shadow: 0 6px 12px rgba(113, 0, 255, 0.18);
}

/* 리스트 자체(섹션 2) — 내부 스크롤 Only */
.space-list {
  list-style: none;
  padding: 10px 0 24px;
  margin:  6px 0 0; /* ⬅️ 위로 살짝 간격 */
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto; /* ⬅️ 내부만 스크롤 */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable; /* 스크롤바 폭 확보로 레이아웃 안정 */
  scroll-padding-bottom: 56px; /* 마지막 아이템이 하단에 붙지 않도록 */
  min-height: 0; /* 내부 스크롤 허용 */
}
@supports (padding: max(0px)) {
  .space-list {
    padding-bottom: max(24px, env(safe-area-inset-bottom) + 18px);
  }
}
/* 하단에 내용이 비치지 않도록 추가 여유 */
.space-list::after {
  content: "";
  display: block;
  height: max(14px, env(safe-area-inset-bottom));
}

/* 아이템 (실제 마크업 클래스에 맞춤) */
.space-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #eef2ff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: transform 0.12s ease, box-shadow 0.2s ease;
}
.space-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.space-line {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.space-title {
  font-weight: 800;
  font-size: clamp(15px, 2vh, 16px);
}
.space-desc {
  font-size: clamp(12px, 1.8vh, 13px);
  color: #6b7280;
}

#screen-list::after {
  content: "";
  position: sticky;
  bottom: 0;
  height: 18px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff);
  pointer-events: none;
  z-index: 15;
  display: block;
}

.space-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto; /* 내부 스크롤 */
  -webkit-overflow-scrolling: touch;
}

/* 아이템 박스 (두 DOM 모두 커버) */
.space-list li,
.space-item,
.item {
  list-style: none;
}
.space-item,
.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #eef2ff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: transform 0.12s ease, box-shadow 0.2s ease;
}
.space-item:hover,
.item:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

/* 왼쪽 배지(이모지/아이콘) */
.space-item .badge,
.item .badge {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 2px solid #7cde8a;
  color: #19b76f;
  font-size: 18px;
}

/* 가운데 텍스트 블록 */
.space-item .space-line,
.item .meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.space-title,
.item .name {
  font-weight: 800;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.space-desc,
.item .addr,
.item .sub {
  font-size: 13px;
  color: #6b7280;
}

/* 오른쪽 꺽쇠 (동일 줄 끝에 정렬) */
.space-item .chev,
.item .chev {
  margin-left: auto;
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
