:root {
  --gold: #B8922A;
  --gold-light: #f5e9cc;
  --black: #0a0a0a;
  --white: #fafaf8;
  --surface: #f7f5f0;
  --border: #e0ddd7;
  --text-muted: #888;
  --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body: 'Barlow', 'Arial', sans-serif;
}

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

body {
  font-family: var(--font-body);
  height: 100vh;
  overflow: hidden;
  color: var(--black);
  background: var(--white);
}

#app { display: flex; height: 100vh; }

/* ─────────────────────────────
   Sidebar
───────────────────────────── */
#sidebar {
  width: 440px;
  min-width: 440px;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-right: 1px solid var(--border);
  overflow: hidden;
  z-index: 10;
}

#sidebar header {
  padding: 36px 26px 22px;
  background: var(--black);
  border-bottom: 4px solid var(--gold);
}

/* Brand */
#brand { margin-bottom: 18px; }
#brand::after {
  content: '';
  display: block;
  width: 52px;
  height: 2px;
  background: var(--gold);
  margin-top: 18px;
}

#sidebar h1 {
  font-family: var(--font-display);
  font-size: 84px;
  font-weight: 900;
  color: var(--white);
  line-height: 0.85;
  text-transform: uppercase;
  letter-spacing: -2px;
}

.slogan {
  margin-top: 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--gold);
  line-height: 1.6;
  opacity: 0.85;
}

/* Search */
#search-wrap {
  position: relative;
  margin-bottom: 12px;
}

#search-wrap::before {
  content: '—';
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: rgba(255,255,255,0.3);
  pointer-events: none;
}

#search {
  width: 100%;
  padding: 11px 14px 11px 32px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 0;
  background: rgba(255,255,255,0.07);
  color: var(--white);
  font-size: 15px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.12s, background 0.12s;
}
#search::placeholder { color: rgba(255,255,255,0.3); }
#search:focus {
  border-color: var(--gold);
  background: rgba(255,255,255,0.1);
}

/* View tabs */
#view-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.view-tab {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,0.22);
  background: transparent;
  color: rgba(255,255,255,0.55);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.view-tab.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--black);
  font-weight: 900;
}

/* Controls */
#controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#filters { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }

.filter-btn {
  padding: 7px 15px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 0;
  background: transparent;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  color: rgba(255,255,255,0.55);
  transition: all 0.1s;
  white-space: nowrap;
}
.filter-btn:hover { border-color: rgba(255,255,255,0.6); color: var(--white); }
.filter-btn.active {
  background: var(--gold);
  color: var(--black);
  border-color: var(--gold);
  font-weight: 900;
}

#btn-sort {
  padding: 7px 15px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 0;
  background: transparent;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  color: rgba(255,255,255,0.55);
  white-space: nowrap;
  transition: all 0.1s;
}
#btn-sort:hover { border-color: rgba(255,255,255,0.6); color: var(--white); }
#btn-sort[data-active="true"] {
  background: var(--gold);
  color: var(--black);
  border-color: var(--gold);
  font-weight: 900;
}

/* Trick controls */
#trick-controls {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#trick-controls.hidden { display: none; }

#trick-filters {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.trick-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.trick-filter-label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  white-space: nowrap;
  min-width: 36px;
}

.trick-filter-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

#btn-trick-sort {
  padding: 7px 15px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 0;
  background: transparent;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  color: rgba(255,255,255,0.55);
  white-space: nowrap;
  transition: all 0.1s;
  align-self: flex-start;
}
#btn-trick-sort:hover { border-color: rgba(255,255,255,0.6); color: var(--white); }
#btn-trick-sort[data-active="true"] {
  background: var(--gold);
  color: var(--black);
  border-color: var(--gold);
  font-weight: 900;
}

/* Radius filter */
#radius-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
#radius-row.hidden { display: none; }

.radius-label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

#radius-btns { display: flex; gap: 4px; }

.radius-btn {
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 0;
  background: transparent;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  color: rgba(255,255,255,0.5);
  transition: all 0.1s;
}
.radius-btn:hover { border-color: rgba(255,255,255,0.6); color: var(--white); }
.radius-btn.active {
  background: var(--gold);
  color: var(--black);
  border-color: var(--gold);
  font-weight: 900;
}

/* List meta */
#list-meta {
  padding: 9px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
#list-count {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ─────────────────────────────
   Spot List
───────────────────────────── */
#spot-list,
#trick-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
}

#spot-list { counter-reset: spot-counter; }

.hidden { display: none !important; }
#spot-list::-webkit-scrollbar { width: 3px; }
#spot-list::-webkit-scrollbar-thumb { background: var(--border); }

.spot-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 22px;
  cursor: pointer;
  border-bottom: 1px solid #f0ede8;
  transition: background 0.1s;
  counter-increment: spot-counter;
}
.spot-item:hover { background: var(--surface); }
.spot-item:hover::before { opacity: 1; }
.spot-item.active {
  background: #fdf8ee;
  border-left: 3px solid var(--gold);
  padding-left: 19px;
}

/* 번호 */
.spot-item::before {
  content: counter(spot-counter, decimal-leading-zero);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 0.04em;
  min-width: 36px;
  flex-shrink: 0;
  opacity: 0.7;
}

.spot-thumb {
  width: 54px;
  height: 54px;
  border-radius: 0;
  object-fit: cover;
  flex-shrink: 0;
  background: #eee;
}
.spot-thumb-placeholder {
  width: 54px;
  height: 54px;
  background: var(--surface);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.spot-info { overflow: hidden; flex: 1; min-width: 0; }

.spot-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.2px;
  text-transform: uppercase;
  color: var(--black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.spot-category {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  margin-bottom: 4px;
  border: 1px solid currentColor;
}

.spot-address {
  font-size: 14px;
  color: #aaa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spot-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
}

.spot-distance {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.fav-btn {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: #ddd;
  line-height: 1;
  padding: 0;
  transition: color 0.1s;
}
.fav-btn:hover { color: var(--gold); }
.fav-btn.active { color: var(--gold); }

/* Category colors */
.cat-공공스케이트파크  { color: #0070c0; }
.cat-사설스케이트파크  { color: #c25a00; }
.cat-스팟              { color: #1a7a35; }
.cat-스케이트샵        { color: #8a1a1a; }

/* Tricks list */
.trick-item {
  padding: 14px 22px;
  border-bottom: 1px solid #f0ede8;
  cursor: pointer;
  transition: background 0.1s;
}

.trick-item:hover { background: var(--surface); }
.trick-item.active {
  background: #fdf8ee;
  border-left: 3px solid var(--gold);
  padding-left: 19px;
}

.trick-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.trick-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.trick-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.trick-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border: 1px solid var(--border);
  color: #666;
}

.trick-summary {
  font-size: 13px;
  color: #777;
  line-height: 1.5;
}

.trick-video-wrap {
  position: relative;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 16 / 9;
  margin-top: 10px;
  background: #000;
}
.trick-video-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.diff-입문 { color: #0284c7; border-color: #0284c7; }
.diff-초급 { color: #16a34a; border-color: #16a34a; }
.diff-중급 { color: #b45309; border-color: #b45309; }
.diff-고급 { color: #b91c1c; border-color: #b91c1c; }

/* ─────────────────────────────
   Tricks mode (map hidden, always split)
───────────────────────────── */
#app.view-tricks #map-wrap { display: none; }

/* Sidebar always fixed width in tricks mode */
#app.view-tricks #sidebar {
  flex: none;
  width: 440px;
  min-width: 440px;
  border-right: 1px solid var(--border);
}

/* Right panel always visible as right column */
#app.view-tricks #detail-panel {
  display: block !important;
  position: fixed;
  top: 0;
  left: 440px;
  bottom: 0;
  right: 0;
  width: auto;
  max-height: none;
  border-top: none;
  border-left: 3px solid var(--gold);
  overflow-y: auto;
}

/* Placeholder when no trick selected */
#trick-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--border);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* Mobile floating tabs */
#mobile-tabs { display: none; }

/* ─────────────────────────────
   Map
───────────────────────────── */
#map-wrap { flex: 1; position: relative; }
#map { width: 100%; height: 100%; }

#btn-locate {
  position: absolute;
  bottom: 28px;
  right: 16px;
  z-index: 500;
  padding: 9px 18px;
  background: var(--black);
  border: 2px solid var(--gold);
  border-radius: 0;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--gold);
  box-shadow: 3px 3px 0 rgba(0,0,0,0.18);
  transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
}
#btn-locate:hover {
  background: var(--gold);
  color: var(--black);
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 rgba(0,0,0,0.2);
}
#btn-locate:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 rgba(0,0,0,0.15);
}

/* ─────────────────────────────
   Detail Panel
───────────────────────────── */
#detail-panel {
  position: fixed;
  bottom: 0;
  left: 440px;
  width: 380px;
  max-height: 68vh;
  background: var(--white);
  border-top: 3px solid var(--gold);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  z-index: 600;
  box-shadow: -4px 0 20px rgba(0,0,0,0.08);
}
#detail-panel::-webkit-scrollbar { display: none; }
#detail-panel.hidden { display: none; }

#detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: 1px solid var(--border);
  width: 28px;
  height: 28px;
  font-size: 13px;
  cursor: pointer;
  color: #888;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: border-color 0.1s, color 0.1s;
  font-family: inherit;
}
#detail-close:hover { border-color: var(--gold); color: var(--gold); }

/* Image gallery */
.detail-gallery { display: flex; overflow-x: auto; scrollbar-width: none; }
.detail-gallery::-webkit-scrollbar { display: none; }
.detail-gallery img {
  height: 200px;
  min-width: 100%;
  flex-shrink: 0;
  object-fit: cover;
}
.detail-gallery:not(.single) img { min-width: 80%; }

#detail-content { padding: 18px 18px 28px; }

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.detail-fav {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #ccc;
  padding: 0;
  flex-shrink: 0;
  transition: color 0.1s;
  line-height: 1;
  margin-top: 2px;
}
.detail-fav:hover { color: var(--gold); }
.detail-fav.active { color: var(--gold); }

.detail-category {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border: 1px solid currentColor;
  margin-bottom: 8px;
}

.detail-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.5px;
  text-transform: uppercase;
  color: var(--black);
  margin-bottom: 8px;
  line-height: 1.15;
}
.detail-address {
  font-size: 12.5px;
  color: #888;
  line-height: 1.6;
}
.detail-distance {
  display: inline-block;
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-nav {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.nav-btn {
  flex: 1;
  padding: 16px 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  transition: opacity 0.1s;
}
.nav-btn:hover { opacity: 0.82; }
.nav-btn.naver { background: #03C75A; color: #fff; }
.nav-btn.kakao { background: #FEE500; color: #3C1E1E; }

/* ─────────────────────────────
   Marker Clusters
───────────────────────────── */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large { background-clip: padding-box; border-radius: 50%; }
.marker-cluster-small  { background-color: rgba(184,146,42,0.15); }
.marker-cluster-small div  { background-color: rgba(184,146,42,0.65); }
.marker-cluster-medium { background-color: rgba(184,146,42,0.2); }
.marker-cluster-medium div { background-color: rgba(184,146,42,0.72); }
.marker-cluster-large  { background-color: rgba(184,146,42,0.25); }
.marker-cluster-large div  { background-color: rgba(184,146,42,0.8); }
.marker-cluster div {
  width: 30px; height: 30px; margin: 5px;
  border-radius: 50%; text-align: center;
  line-height: 30px; font-size: 12px; font-weight: 800; color: #fff;
}


/* ─────────────────────────────
   Mobile
───────────────────────────── */
#btn-list-toggle { display: none; }

@media (max-width: 600px) {
  /* 지도 풀스크린 */
  #app { display: block; height: 100vh; }
  #map-wrap { position: fixed; inset: 0; z-index: 1; }

  /* 목록 버튼 */
  #btn-list-toggle {
    display: block;
    position: absolute;
    bottom: 72px;
    right: 16px;
    z-index: 500;
    padding: 9px 18px;
    background: var(--black);
    border: 2px solid var(--gold);
    border-radius: 0;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    color: var(--gold);
    box-shadow: 3px 3px 0 rgba(0,0,0,0.18);
  }

  /* 사이드바 — 바텀 드로어 */
  #sidebar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 80vh;
    min-width: 0;
    border-right: none;
    border-top: 3px solid var(--gold);
    z-index: 200;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  #sidebar.open { transform: translateY(0); }

  #sidebar header { padding: 14px 16px 12px; flex-shrink: 0; }
  #sidebar h1 { font-size: 30px; line-height: 0.9; }
  #brand { margin-bottom: 8px; }
  #brand::after { display: none; }
  .slogan { display: none; }
  #search-wrap { margin-bottom: 8px; }
  #search { padding: 9px 12px 9px 28px; font-size: 14px; }
  .filter-btn { padding: 5px 10px; font-size: 13px; }
  #btn-sort { padding: 5px 10px; font-size: 13px; }
  #list-meta { flex-shrink: 0; }
  #spot-list { flex: 1; overflow-y: auto; }
  .spot-item { padding: 10px 16px; gap: 10px; }
  .spot-name { font-size: 16px; }
  .spot-address { font-size: 12px; }
  .spot-thumb, .spot-thumb-placeholder { width: 44px; height: 44px; }

  /* 상세 패널 — 절반 바텀시트 */
  #detail-panel {
    left: 0 !important;
    width: 100% !important;
    max-height: 50vh;
    z-index: 300;
  }
  .detail-gallery img { height: 120px; }
  #detail-content { padding: 12px 16px 20px; }
  .detail-name { font-size: 18px; }
  .detail-address { font-size: 12px; }
  .detail-nav { margin-top: 12px; padding-top: 12px; }
  .nav-btn { padding: 12px 0; font-size: 15px; }

  /* Trick controls mobile */
  .trick-filter-row { gap: 4px; }
  .trick-filter-label { font-size: 11px; min-width: 30px; }
  .trick-filter-btns .filter-btn { padding: 4px 8px; font-size: 12px; }
  #btn-trick-sort { padding: 5px 10px; font-size: 13px; }

  #trick-list { flex: 1; overflow-y: auto; }
  .trick-item { padding: 10px 16px; }
  .trick-name { font-size: 17px; }
  .trick-summary { font-size: 12px; }

  #btn-locate { bottom: 12px; right: 16px; padding: 9px 18px; font-size: 12px; }

  /* 모바일 플로팅 탭 */
  #mobile-tabs {
    display: flex;
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 600;
    gap: 4px;
    padding: 4px;
    background: rgba(10,10,10,0.88);
    border: 1px solid var(--gold);
  }
  #sidebar #view-tabs { display: none; }

  /* 모바일 tricks 모드 */
  #app.view-tricks #map-wrap { display: none; }
  #app.view-tricks #sidebar {
    transform: none !important;
    position: fixed;
    inset: 0;
    height: 100vh;
    border-top: none;
    z-index: 200;
  }
  #app.view-tricks #btn-list-toggle { display: none !important; }

  /* 모바일 tricks: 오른쪽 패널 기본 숨김, 바텀시트로만 */
  #app.view-tricks #detail-panel {
    display: none !important;
  }
  #app.view-tricks #detail-panel:not(.hidden) {
    display: block !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    bottom: 0;
    top: auto;
    max-height: 80vh;
    border-left: none;
    border-top: 3px solid var(--gold);
    z-index: 400;
  }
}
