/* ══════════════════════════════════════════════════════════════════
   한밭기행 — 디자인 시스템
   단청(丹靑) 팔레트 + 한지 질감 + 유리 표면
   ══════════════════════════════════════════════════════════════════ */

:root {
  /* 색 */
  --ink:        #16181c;
  --ink-2:      #33383f;
  --ink-3:      #6b727c;
  --ink-4:      #9aa1aa;
  --hanji:      #f7f3ea;
  --hanji-2:    #efe8da;
  --paper:      #ffffff;
  --line:       rgba(22, 24, 28, .10);
  --line-2:     rgba(22, 24, 28, .06);

  --red:        #b8392c;   /* 단청 적 */
  --red-soft:   #d9695b;
  --blue:       #1f6e8c;   /* 단청 청 */
  --gold:       #c08a1e;   /* 단청 황 */
  --green:      #4e7a4a;
  --brown:      #8c5a3c;

  /* 분류별 색 */
  --c-고건축:   #8c5a3c;
  --c-성곽:     #5f7a50;
  --c-서원향교: #a9832f;
  --c-근대건축: #4a6d80;

  --surface:      rgba(255,255,255,.82);
  --surface-solid:#ffffff;
  --surface-2:    #faf7f0;
  --glass-brd:    rgba(255,255,255,.6);
  --shadow-sm: 0 2px 8px rgba(20,22,26,.08), 0 1px 2px rgba(20,22,26,.06);
  --shadow-md: 0 8px 28px rgba(20,22,26,.14), 0 2px 6px rgba(20,22,26,.08);
  --shadow-lg: 0 24px 70px rgba(20,22,26,.24), 0 6px 16px rgba(20,22,26,.10);

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 30px;

  --font-serif: 'Gowun Batang', 'Nanum Myeongjo', 'Apple SD Gothic Neo', serif;
  --font-sans: 'Noto Sans KR', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.22,.85,.3,1);
  --spring: cubic-bezier(.18,.9,.24,1.05);
}

[data-theme="dark"] {
  --ink:        #f2eee6;
  --ink-2:      #d3cec4;
  --ink-3:      #9a978f;
  --ink-4:      #6f6d68;
  --hanji:      #16171a;
  --hanji-2:    #1e2024;
  --paper:      #1b1d21;
  --line:       rgba(240,236,228,.12);
  --line-2:     rgba(240,236,228,.07);

  --red:        #e0705f;
  --red-soft:   #b8483a;
  --blue:       #6bb2ce;
  --gold:       #dfb352;
  --green:      #82ab7c;
  --brown:      #c08f6c;

  --c-고건축:   #c08f6c;
  --c-성곽:     #8db07f;
  --c-서원향교: #d8b356;
  --c-근대건축: #7ea9c0;

  --surface:      rgba(28,30,34,.84);
  --surface-solid:#1b1d21;
  --surface-2:    #212429;
  --glass-brd:    rgba(255,255,255,.10);
  --shadow-sm: 0 2px 10px rgba(0,0,0,.4);
  --shadow-md: 0 10px 32px rgba(0,0,0,.5);
  --shadow-lg: 0 28px 80px rgba(0,0,0,.62);
}

/* 사용자가 명시적으로 고르지 않았다면 OS 설정을 따른다 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink:        #f2eee6;
    --ink-2:      #d3cec4;
    --ink-3:      #9a978f;
    --ink-4:      #6f6d68;
    --hanji:      #16171a;
    --hanji-2:    #1e2024;
    --paper:      #1b1d21;
    --line:       rgba(240,236,228,.12);
    --line-2:     rgba(240,236,228,.07);

    --red:        #e0705f;
    --red-soft:   #b8483a;
    --blue:       #6bb2ce;
    --gold:       #dfb352;
    --green:      #82ab7c;
    --brown:      #c08f6c;

    --c-고건축:   #c08f6c;
    --c-성곽:     #8db07f;
    --c-서원향교: #d8b356;
    --c-근대건축: #7ea9c0;

    --surface:      rgba(28,30,34,.84);
    --surface-solid:#1b1d21;
    --surface-2:    #212429;
    --glass-brd:    rgba(255,255,255,.10);
    --shadow-sm: 0 2px 10px rgba(0,0,0,.4);
    --shadow-md: 0 10px 32px rgba(0,0,0,.5);
    --shadow-lg: 0 28px 80px rgba(0,0,0,.62);
  }
}


* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--hanji);
  overscroll-behavior: none;
}
body { overflow: hidden; }

button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
h1,h2,h3,h4 { margin: 0; font-weight: 700; letter-spacing: -.02em; }
p { margin: 0; }
a { color: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* 한지 질감 */
.paper-tex::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.09'/%3E%3C/svg%3E");
}

/* ══════════════════════ 스플래시 ══════════════════════ */
.splash {
  position: fixed; inset: 0; z-index: 9000;
  display: grid; place-content: center; justify-items: center; gap: 6px;
  background: radial-gradient(120% 90% at 50% 20%, #2a2d33 0%, #16181c 70%);
  transition: opacity .55s var(--ease), visibility .55s;
}
.splash.gone { opacity: 0; visibility: hidden; }
.splash-mark svg { width: 118px; height: 88px; }
.splash-mark .s-roof { fill: #b8392c; }
.splash-mark .s-base, .splash-mark .s-ground { fill: #f7f3ea; }
.splash-mark .s-col { fill: #c9c2b4; }
.splash-mark svg > * { opacity: 0; animation: rise .6s var(--spring) forwards; }
.splash-mark .s-ground { animation-delay: .05s; }
.splash-mark .s-col:nth-of-type(1) { animation-delay: .14s; }
.splash-mark .s-col:nth-of-type(2) { animation-delay: .2s; }
.splash-mark .s-col:nth-of-type(3) { animation-delay: .26s; }
.splash-mark .s-base { animation-delay: .18s; }
.splash-mark .s-roof { animation-delay: .34s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.splash-title {
  font-family: var(--font-serif); font-size: 34px; font-weight: 700; color: #f7f3ea;
  letter-spacing: .22em; text-indent: .22em; margin-top: 14px;
  opacity: 0; animation: rise .6s .45s var(--ease) forwards;
}
.splash-sub {
  font-size: 12.5px; color: #8f9299; letter-spacing: .16em;
  opacity: 0; animation: rise .6s .6s var(--ease) forwards;
}
.splash-bar { width: 130px; height: 2px; margin-top: 24px; background: rgba(255,255,255,.14); border-radius: 2px; overflow: hidden; }
.splash-bar i { display: block; height: 100%; width: 40%; background: #b8392c; border-radius: 2px; animation: slide 1.1s infinite var(--ease); }
@keyframes slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(360%); } }

/* ══════════════════════ 지도 ══════════════════════ */
#map { position: fixed; inset: 0; z-index: 0; background: var(--hanji-2); }
.map-vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(12,13,16,.42) 0%, rgba(12,13,16,0) 22%),
    linear-gradient(to top, rgba(12,13,16,.34) 0%, rgba(12,13,16,0) 26%);
  transition: opacity .4s;
}
.leaflet-container { font-family: var(--font-sans); background: var(--hanji-2); }
.leaflet-control-attribution {
  background: var(--surface) !important; color: var(--ink-3) !important;
  font-size: 10px !important; backdrop-filter: blur(8px); border-radius: 6px 0 0 0;
}
.leaflet-control-attribution a { color: var(--ink-3) !important; }
[data-theme="dark"] .leaflet-tile { filter: none; }

/* 마커 */
.pin { position: relative; width: 44px; height: 54px; }
.pin-body {
  position: absolute; inset: 0 0 8px 0;
  background: var(--pin, #8c5a3c);
  border-radius: 50% 50% 50% 50% / 46% 46% 58% 58%;
  box-shadow: 0 6px 16px rgba(20,22,26,.34), inset 0 -2px 0 rgba(0,0,0,.14);
  border: 2.5px solid #fff;
  display: grid; place-items: center;
  transition: transform .28s var(--spring), box-shadow .28s;
}
[data-theme="dark"] .pin-body { border-color: #22252a; }
.pin-body svg { width: 22px; height: 22px; fill: #fff; }
.pin-tip {
  position: absolute; bottom: 2px; left: 50%; width: 10px; height: 10px;
  background: var(--pin, #8c5a3c); transform: translateX(-50%) rotate(45deg);
  border-right: 2.5px solid #fff; border-bottom: 2.5px solid #fff;
}
[data-theme="dark"] .pin-tip { border-color: #22252a; }
.pin-num {
  position: absolute; top: -5px; right: -5px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; background: var(--ink); color: var(--hanji);
  font-size: 11px; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--paper);
}
.pin.done .pin-num { background: var(--green); color: #fff; }
.pin.active .pin-body { transform: scale(1.22) translateY(-4px); box-shadow: 0 14px 26px rgba(20,22,26,.42); }
.pin.active::after {
  content: ''; position: absolute; left: 50%; top: 46%; width: 54px; height: 54px;
  transform: translate(-50%,-50%); border-radius: 50%; border: 2px solid var(--pin);
  animation: ping 1.6s infinite var(--ease); opacity: .8;
}
@keyframes ping { to { transform: translate(-50%,-50%) scale(2.1); opacity: 0; } }
.pin-label {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 2px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap; color: var(--ink);
  background: var(--surface); padding: 2px 7px; border-radius: 8px;
  backdrop-filter: blur(6px); box-shadow: var(--shadow-sm); letter-spacing: -.02em;
}
.place-label { pointer-events: none; }
.place-label span {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  text-shadow: 0 1px 2px var(--paper), 0 0 3px var(--paper);
}
.place-label.big span { font-size: 13px; font-weight: 700; }
.far-out .place-label:not(.big) span { opacity: 0; }
/* 배율이 낮을 때는 일반 간선도로를 감춰 지도를 단순하게 유지한다 */
.far-out .road-primary { opacity: 0; }
.road-primary { transition: opacity .3s; }

.zoomed-out .pin-label { opacity: 0; transform: translateX(-50%) scale(.9); }
.pin-label { transition: opacity .25s, transform .25s; }
.zoomed-out .pin.active .pin-label { opacity: 1; transform: translateX(-50%); }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #2f7fe0; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(47,127,224,.22), var(--shadow-sm); }

/* ══════════════════════ 상단바 ══════════════════════ */
.topbar {
  position: fixed; z-index: 40; top: calc(10px + var(--safe-t)); left: 12px; right: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.icon-btn {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--surface); backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid var(--glass-brd); box-shadow: var(--shadow-md);
  display: grid; place-items: center; position: relative;
  transition: transform .2s var(--spring), background .2s;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.menu-btn { flex-direction: column; gap: 4px; }
.menu-btn span { display: block; width: 17px; height: 2px; border-radius: 2px; background: var(--ink); transition: transform .3s var(--ease), opacity .2s; }
.menu-btn span:nth-child(2) { width: 12px; align-self: flex-start; margin-left: 14.5px; }
body.drawer-open .menu-btn span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.drawer-open .menu-btn span:nth-child(2) { opacity: 0; }
body.drawer-open .menu-btn span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.wordmark {
  display: flex; align-items: center; gap: 8px; padding: 9px 16px 9px 13px;
  border-radius: 26px; background: var(--surface); backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid var(--glass-brd); box-shadow: var(--shadow-md); cursor: pointer;
  transition: transform .2s var(--spring);
}
.wordmark:active { transform: scale(.96); }
.wm-icon { width: 30px; height: 21px; fill: var(--red); }
.wm-text { font-family: var(--font-serif); font-weight: 700; font-size: 18px; letter-spacing: .06em; }

.avatar-btn .avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #fff;
  background: conic-gradient(from 0deg, var(--red), var(--gold), var(--blue), var(--red));
}
.avatar-btn .dot { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--red); border: 2px solid var(--paper); }

/* 공지 */
.notice {
  position: fixed; z-index: 39; top: calc(66px + var(--safe-t)); left: 12px; right: 12px;
  height: 42px; padding: 0 12px 0 16px; border-radius: 21px;
  background: var(--surface); backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid var(--glass-brd); box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 8px; overflow: hidden;
  text-align: left; transition: transform .2s var(--spring), opacity .3s;
}
.notice:active { transform: scale(.985); }
.notice-text { flex: 1; font-size: 13.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notice-text.swap { animation: noticeSwap .5s var(--ease); }
@keyframes noticeSwap { 0% { opacity: 0; transform: translateY(10px); } 100% { opacity: 1; transform: none; } }
.notice .chev { width: 16px; height: 16px; fill: none; stroke: var(--ink-4); stroke-width: 2.2; stroke-linecap: round; flex: none; }

/* ══════════════════════ 우측 레일 ══════════════════════ */
.rail {
  position: fixed; z-index: 38; right: 12px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 10px; align-items: stretch;
}
.rail-group {
  display: flex; flex-direction: column;
  background: var(--surface); backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid var(--glass-brd); border-radius: var(--r-md); box-shadow: var(--shadow-md);
  overflow: hidden;
}
.rail-btn {
  width: 62px; padding: 9px 4px 7px; display: grid; justify-items: center; gap: 2px;
  transition: background .18s, transform .18s var(--spring);
}
.rail-group .rail-btn + .rail-btn { border-top: 1px solid var(--line-2); }
.rail-btn svg { width: 21px; height: 21px; fill: none; stroke: var(--ink-2); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.rail-btn b { font-size: 10.5px; font-weight: 600; color: var(--ink-2); letter-spacing: -.02em; }
.rail-btn:active { transform: scale(.93); }
.rail-btn:hover { background: var(--line-2); }
.rail-btn.accent {
  background: var(--red); border: 1px solid rgba(0,0,0,.06); border-radius: var(--r-md);
  box-shadow: 0 8px 22px rgba(184,57,44,.36);
}
.rail-btn.accent svg { stroke: #fff; }
.rail-btn.accent b { color: #fff; }
.rail-btn.on svg { stroke: var(--red); }
.rail-btn.on b { color: var(--red); }

/* 지도 위 칩 */
.map-chips {
  position: fixed; z-index: 37; left: 12px; top: calc(120px + var(--safe-t));
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start; max-width: 62vw;
}
.map-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px;
  border-radius: 20px; background: var(--surface); backdrop-filter: blur(12px);
  border: 1px solid var(--glass-brd); box-shadow: var(--shadow-sm);
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  animation: rise .3s var(--ease);
}
.map-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex: none; }
.map-chip button { margin-left: 2px; color: var(--ink-4); font-size: 15px; line-height: 1; }

/* ══════════════════════ 하단 도크 ══════════════════════ */
.dock {
  position: fixed; z-index: 36; left: 12px; right: 12px; bottom: calc(14px + var(--safe-b));
  display: grid; gap: 8px; transition: transform .38s var(--spring), opacity .3s;
}
body.sheet-open .dock, body.view-open .dock { transform: translateY(160%); opacity: 0; pointer-events: none; }
.dock-head { display: none; }

/* 모바일: 가로로 넘기는 띠. 오른쪽 끝을 흐리게 해 "잘림"이 아니라
   "더 있음"으로 읽히게 한다. */
.dock-peek {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 2px 2px 2px 2px;
  scroll-snap-type: x proximity;
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 34px), transparent 100%);
          mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 34px), transparent 100%);
}
.dock-peek::-webkit-scrollbar { display: none; }
.peek-card { scroll-snap-align: start; }
.peek-card {
  flex: none; display: flex; align-items: center; gap: 8px; padding: 7px 12px 7px 8px;
  border-radius: 999px; background: var(--surface); backdrop-filter: blur(14px);
  border: 1px solid var(--glass-brd); box-shadow: var(--shadow-sm);
  transition: transform .2s var(--spring);
}
.peek-card:active { transform: scale(.95); }
.peek-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.peek-dot svg { width: 15px; height: 15px; fill: #fff; }
.peek-name { font-size: 12.5px; font-weight: 700; letter-spacing: -.02em; }
.peek-meta { font-size: 10.5px; color: var(--ink-3); }

.cta {
  height: 58px; border-radius: var(--r-md); background: var(--red); color: #fff;
  font-size: 16px; font-weight: 700; letter-spacing: -.01em;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 12px 30px rgba(184,57,44,.42), inset 0 1px 0 rgba(255,255,255,.18);
  transition: transform .2s var(--spring), box-shadow .2s;
  position: relative; overflow: hidden;
}
.cta::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.24) 50%, transparent 70%);
  transform: translateX(-100%); animation: sheen 3.4s 1.2s infinite;
}
@keyframes sheen { 0%,72% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.cta:active { transform: scale(.975); }
.cta svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ══════════════════════ 상세 시트 ══════════════════════ */
.sheet-backdrop, .drawer-backdrop {
  position: fixed; inset: 0; z-index: 44; background: rgba(12,13,16,.5);
  opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s;
  backdrop-filter: blur(2px);
}
body.sheet-open .sheet-backdrop, body.drawer-open .drawer-backdrop { opacity: 1; visibility: visible; }

.sheet {
  position: fixed; z-index: 45; left: 0; right: 0; bottom: 0;
  height: 90dvh; max-height: 90dvh;
  background: var(--paper); border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(101%); transition: transform .46s var(--spring);
  display: flex; flex-direction: column; overflow: hidden;
  border-top: 1px solid var(--line-2);
}
body.sheet-open .sheet { transform: translateY(0); }
body.sheet-open.sheet-peek .sheet { transform: translateY(calc(90dvh - 340px)); }
.sheet-grab { padding: 10px 0 4px; display: grid; place-items: center; cursor: grab; touch-action: none; flex: none; }
.sheet-grab i { width: 44px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

/* 시트 내부 */
.hero { position: relative; margin: 0 14px; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.hero svg { display: block; width: 100%; height: auto; }
.hero-badge {
  position: absolute; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 999px; background: rgba(16,18,22,.62); backdrop-filter: blur(8px);
  color: #fff; font-size: 11.5px; font-weight: 700; letter-spacing: -.01em;
}
.hero-fav {
  position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(16,18,22,.5); backdrop-filter: blur(8px); display: grid; place-items: center;
  transition: transform .22s var(--spring);
}
.hero-fav svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2; }
.hero-fav.on svg { fill: var(--red-soft); stroke: var(--red-soft); }
.hero-fav:active { transform: scale(.85); }

.sheet-title { padding: 16px 20px 0; }
.sheet-title .kicker { font-size: 12px; font-weight: 700; color: var(--cat, var(--brown)); letter-spacing: .02em; }
.sheet-title h2 { font-family: var(--font-serif); font-size: 29px; line-height: 1.15; margin-top: 4px; }
.sheet-title h2 small { font-family: var(--font-sans); font-size: 14px; font-weight: 500; color: var(--ink-4); margin-left: 8px; letter-spacing: 0; }
.sheet-title .summary { margin-top: 9px; font-size: 14.5px; line-height: 1.62; color: var(--ink-2); }

.meta-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 20px 0; }
.meta-pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--line-2);
  font-size: 11.5px; font-weight: 600; color: var(--ink-2);
}
.meta-pill svg { width: 13px; height: 13px; fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; }

.tabs {
  display: flex; gap: 3px; margin: 16px 14px 0; padding: 4px;
  background: var(--surface-2); border-radius: 13px; border: 1px solid var(--line-2);
  position: sticky; top: 0; z-index: 3; backdrop-filter: blur(10px);
}
.tab {
  flex: 1; padding: 9px 4px; border-radius: 10px; font-size: 12.5px; font-weight: 700;
  color: var(--ink-3); transition: color .2s, background .25s var(--ease), box-shadow .2s;
  white-space: nowrap;
}
.tab.on { color: var(--ink); background: var(--paper); box-shadow: var(--shadow-sm); }

.pane { padding: 18px 20px 40px; animation: fadeUp .34s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.story p { font-size: 15px; line-height: 1.85; color: var(--ink-2); margin-bottom: 15px; word-break: keep-all; }
.story p:first-child::first-letter {
  font-family: var(--font-serif); font-size: 2.9em; float: left; line-height: .92;
  padding: 4px 9px 0 0; color: var(--red); font-weight: 700;
}

.section-h { display: flex; align-items: baseline; gap: 8px; margin: 26px 0 12px; }
.section-h h3 { font-family: var(--font-serif); font-size: 18px; }
.section-h span { font-size: 11.5px; color: var(--ink-4); font-weight: 600; }

.hl-grid { display: grid; gap: 8px; }
.hl {
  display: flex; gap: 11px; padding: 13px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line-2);
}
.hl .em { font-size: 20px; line-height: 1.2; flex: none; }
.hl b { display: block; font-size: 13.5px; margin-bottom: 3px; }
.hl p { font-size: 12.8px; line-height: 1.6; color: var(--ink-3); word-break: keep-all; }

.audio-card {
  margin-top: 18px; padding: 15px; border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--cat, var(--brown)) 0%, color-mix(in srgb, var(--cat, var(--brown)) 65%, #000) 100%);
  color: #fff; box-shadow: var(--shadow-sm);
}
.audio-head { display: flex; align-items: center; gap: 10px; }
.audio-play {
  width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.2);
  display: grid; place-items: center; flex: none; transition: transform .2s var(--spring);
}
.audio-play:active { transform: scale(.88); }
.audio-play svg { width: 18px; height: 18px; fill: #fff; }
.audio-head b { font-size: 13.5px; }
.audio-head p { font-size: 11.5px; opacity: .78; margin-top: 1px; }
.audio-wave { display: flex; align-items: flex-end; gap: 2.5px; height: 22px; margin-left: auto; }
.audio-wave i { width: 2.5px; border-radius: 2px; background: rgba(255,255,255,.55); height: 20%; }
.audio-card.playing .audio-wave i { animation: wave .9s infinite var(--ease); }
.audio-wave i:nth-child(2){animation-delay:.1s} .audio-wave i:nth-child(3){animation-delay:.2s}
.audio-wave i:nth-child(4){animation-delay:.3s} .audio-wave i:nth-child(5){animation-delay:.15s}
.audio-wave i:nth-child(6){animation-delay:.25s} .audio-wave i:nth-child(7){animation-delay:.05s}
@keyframes wave { 0%,100% { height: 18%; } 50% { height: 100%; } }
.audio-script { margin-top: 12px; font-size: 12.8px; line-height: 1.75; opacity: .9; word-break: keep-all; }

/* 3D 뷰어 */
.viewer {
  position: relative; margin: 0 -20px; height: 380px; background: var(--surface-2);
  border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); overflow: hidden;
}
.viewer canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.viewer canvas:active { cursor: grabbing; }
.viewer-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  padding: 6px 13px; border-radius: 999px; background: rgba(16,18,22,.6); backdrop-filter: blur(8px);
  color: #fff; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  transition: opacity .4s; pointer-events: none;
}
.viewer-tools { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; }
.vt {
  width: 38px; height: 38px; border-radius: 11px; background: var(--surface); backdrop-filter: blur(10px);
  border: 1px solid var(--glass-brd); box-shadow: var(--shadow-sm); display: grid; place-items: center;
  transition: transform .18s var(--spring);
}
.vt:active { transform: scale(.9); }
.vt svg { width: 18px; height: 18px; fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vt.on { background: var(--red); border-color: transparent; }
.vt.on svg { stroke: #fff; }
.viewer-legend { position: absolute; left: 10px; bottom: 10px; display: grid; gap: 4px; }
.vl { display: flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 600; color: #fff;
  background: rgba(16,18,22,.55); backdrop-filter: blur(6px); padding: 3px 8px; border-radius: 7px; }
.vl i { width: 9px; height: 9px; border-radius: 2px; }
.viewer-fallback { display: grid; place-content: center; gap: 8px; height: 100%; text-align: center; color: var(--ink-3); font-size: 13px; padding: 20px; }

.model-facts { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; margin-top: 18px; }
.mf { padding: 12px 13px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line-2); }
.mf b { display: block; font-size: 10.5px; color: var(--ink-4); font-weight: 700; letter-spacing: .04em; }
.mf span { font-size: 14px; font-weight: 700; }

/* 연표 */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); border-radius: 2px; }
.tl-item { position: relative; padding-bottom: 22px; }
.tl-item::before {
  content: ''; position: absolute; left: -25px; top: 4px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--paper); border: 3px solid var(--cat, var(--brown));
}
.tl-year { font-family: var(--font-serif); font-size: 15px; font-weight: 700; color: var(--cat, var(--brown)); }
.tl-item b { display: block; font-size: 14px; margin: 2px 0 3px; }
.tl-item p { font-size: 12.8px; line-height: 1.65; color: var(--ink-3); word-break: keep-all; }

/* 퀴즈 */
.quiz { padding: 15px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line-2); margin-bottom: 12px; }
.quiz-q { font-size: 14.5px; font-weight: 700; line-height: 1.5; margin-bottom: 11px; word-break: keep-all; }
.quiz-opts { display: grid; gap: 6px; }
.qo {
  text-align: left; padding: 12px 13px; border-radius: var(--r-sm); background: var(--paper);
  border: 1.5px solid var(--line); font-size: 13.5px; font-weight: 500; color: var(--ink-2);
  transition: all .2s var(--ease); display: flex; align-items: center; gap: 9px;
}
.qo i { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line); flex: none;
  display: grid; place-items: center; font-size: 10.5px; font-weight: 700; color: var(--ink-4); font-style: normal; }
.qo:hover:not(:disabled) { border-color: var(--ink-4); }
.qo.ok { border-color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); color: var(--ink); }
.qo.ok i { background: var(--green); border-color: var(--green); color: #fff; }
.qo.no { border-color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); }
.qo.no i { background: var(--red); border-color: var(--red); color: #fff; }
.qo:disabled { cursor: default; }
.quiz-ex { margin-top: 10px; padding: 11px 12px; border-radius: var(--r-sm); background: var(--paper);
  border-left: 3px solid var(--cat, var(--brown)); font-size: 12.8px; line-height: 1.6; color: var(--ink-2); }

/* 방문/후기 */
.stamp-card {
  padding: 18px; border-radius: var(--r-md); border: 1.5px dashed var(--line);
  text-align: center; background: var(--surface-2);
}
.stamp-card.done { border-style: solid; border-color: var(--green); background: color-mix(in srgb, var(--green) 8%, transparent); }
.stamp-seal {
  /* 전통 낙관(落款)처럼 정사각 도장 모양 */
  width: 76px; height: 76px; margin: 0 auto 12px; border-radius: 12px;
  border: 3px solid var(--cat, var(--brown));
  display: grid; place-items: center; overflow: hidden;
  font-family: var(--font-serif); font-size: 20px; font-weight: 700; color: var(--cat, var(--brown));
  line-height: 1.0; transform: rotate(-7deg); letter-spacing: -.06em; padding: 6px;
  max-width: 76px; word-break: break-all; text-align: center;
}
.stamp-card.done .stamp-seal { border-color: var(--green); color: var(--green); animation: stampIn .5s var(--spring); }
@keyframes stampIn { 0% { transform: rotate(-8deg) scale(2.4); opacity: 0; } 60% { transform: rotate(-8deg) scale(.92); opacity: 1; } 100% { transform: rotate(-8deg) scale(1); } }
.stamp-card h4 { font-size: 15px; margin-bottom: 4px; }
.stamp-card p { font-size: 12.5px; color: var(--ink-3); line-height: 1.6; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 46px; padding: 0 18px; border-radius: 12px; font-size: 14px; font-weight: 700;
  background: var(--ink); color: var(--hanji); transition: transform .18s var(--spring), opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.wide { width: 100%; }
.btn.red { background: var(--red); color: #fff; }
.btn.soft { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.btn.line { background: transparent; border: 1.5px solid var(--line); color: var(--ink-2); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.btn-row { display: flex; gap: 8px; margin-top: 12px; }
.btn-row .btn { flex: 1; }

.stars { display: flex; gap: 3px; }
.stars button { font-size: 24px; line-height: 1; color: var(--line); transition: transform .15s var(--spring), color .2s; }
.stars button.on { color: var(--gold); }
.stars button:active { transform: scale(1.25); }

.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12px; font-weight: 700; color: var(--ink-3); }
.field input, .field textarea, .field select {
  width: 100%; padding: 13px 14px; border-radius: 12px; font-family: inherit; font-size: 14.5px;
  border: 1.5px solid var(--line); background: var(--surface-2); color: var(--ink);
  transition: border-color .2s, background .2s;
}
.field textarea { resize: vertical; min-height: 92px; line-height: 1.6; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--red); background: var(--paper); }

.review { padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.review:last-child { border-bottom: 0; }
.rv-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rv-av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; flex: none; }
.rv-name { font-size: 13px; font-weight: 700; }
.rv-date { font-size: 11px; color: var(--ink-4); margin-left: auto; }
.rv-stars { font-size: 11.5px; color: var(--gold); letter-spacing: 1px; }
.review p { font-size: 13.5px; line-height: 1.7; color: var(--ink-2); word-break: keep-all; }

.nearby { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 0 20px 4px; }
.nearby::-webkit-scrollbar { display: none; }
.nb-card { flex: none; width: 132px; border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); border: 1px solid var(--line-2); text-align: left; }
.nb-card svg { display: block; width: 100%; height: 74px; }
.nb-card .nb-t { padding: 9px 10px 11px; }
.nb-card b { display: block; font-size: 13px; }
.nb-card span { font-size: 11px; color: var(--ink-4); }

/* ══════════════════════ 드로어 ══════════════════════ */
.drawer {
  position: fixed; z-index: 46; top: 0; bottom: 0; left: 0; width: min(310px, 84vw);
  background: var(--paper); box-shadow: var(--shadow-lg);
  transform: translateX(-102%); transition: transform .42s var(--spring);
  display: flex; flex-direction: column; padding-top: var(--safe-t);
}
body.drawer-open .drawer { transform: none; }
.drawer-head { padding: 22px 20px 18px; border-bottom: 1px solid var(--line-2); }
.drawer-user { display: flex; align-items: center; gap: 12px; }
.du-av { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 18px; font-weight: 700; flex: none; }
.du-name { font-size: 16px; font-weight: 700; }
.du-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.du-points { display: inline-flex; align-items: center; gap: 4px; margin-top: 5px; padding: 3px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); font-size: 11.5px; font-weight: 700; }

.drawer-nav { flex: 1; overflow-y: auto; padding: 10px 12px; }
.dn-sec { font-size: 10.5px; font-weight: 700; color: var(--ink-4); letter-spacing: .1em; padding: 14px 10px 6px; }
.dn {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 12px; border-radius: 12px;
  font-size: 14.5px; font-weight: 600; color: var(--ink-2); text-align: left; transition: background .18s;
}
.dn:hover { background: var(--surface-2); }
.dn.on { background: color-mix(in srgb, var(--red) 10%, transparent); color: var(--red); }
.dn .em { font-size: 18px; width: 24px; text-align: center; flex: none; }
.dn .tail { margin-left: auto; font-size: 11.5px; color: var(--ink-4); font-weight: 700; }

.drawer-foot { padding: 12px 16px calc(18px + var(--safe-b)); border-top: 1px solid var(--line-2); }
.ghost-btn { display: flex; align-items: center; gap: 9px; width: 100%; padding: 11px 12px; border-radius: 11px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2); transition: background .18s; }
.ghost-btn:hover { background: var(--surface-2); }
.ghost-btn svg { width: 18px; height: 18px; fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.drawer-note { margin-top: 10px; font-size: 10.5px; line-height: 1.6; color: var(--ink-4); padding: 0 12px; }

/* ══════════════════════ 전체화면 뷰 ══════════════════════ */
.view {
  position: fixed; z-index: 42; inset: 0; background: var(--hanji);
  transform: translateY(100%); transition: transform .46s var(--spring);
  display: flex; flex-direction: column; visibility: hidden;
}
body.view-open .view { transform: none; visibility: visible; }
.view-head {
  position: relative; flex: none; padding: calc(12px + var(--safe-t)) 16px 12px;
  display: flex; align-items: center; gap: 12px; background: var(--paper);
  border-bottom: 1px solid var(--line-2); z-index: 2;
}
.view-head h1 { font-family: var(--font-serif); font-size: 20px; }
.view-kicker { margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--ink-4); }
.back-btn { width: 40px; height: 40px; box-shadow: none; background: var(--surface-2); border-color: var(--line-2); }
.view-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(40px + var(--safe-b)); }

/* 공통 카드 그리드 */
.wrap { padding: 20px 16px; max-width: 900px; margin: 0 auto; }
.lede { font-size: 15px; line-height: 1.8; color: var(--ink-2); word-break: keep-all; }
.grid { display: grid; gap: 10px; }
.grid.two { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

.card { background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-sm); text-align: left; transition: transform .22s var(--spring), box-shadow .22s; }
.card:active { transform: scale(.98); }
button.card:hover { box-shadow: var(--shadow-md); }
.card-body { padding: 13px 14px 15px; }
.card-body h4 { font-size: 14.5px; letter-spacing: -.02em; }
.card-body p { font-size: 12.3px; line-height: 1.6; color: var(--ink-3); margin-top: 5px; word-break: keep-all; }
.card-tag { display: inline-block; padding: 3px 8px; border-radius: 7px; font-size: 10.5px; font-weight: 700; margin-bottom: 7px; }

/* 통계 */
.stat-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin: 16px 0 22px; }
.stat { padding: 14px 8px; border-radius: var(--r-md); background: var(--paper); border: 1px solid var(--line-2); text-align: center; }
.stat b { display: block; font-family: var(--font-serif); font-size: 21px; color: var(--red); }
.stat b small { font-size: 11px; font-family: var(--font-sans); color: var(--ink-3); margin-left: 1px; }
.stat span { font-size: 10.5px; color: var(--ink-4); font-weight: 600; }

/* 시대 아코디언 */
.era { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line-2); background: var(--paper); margin-bottom: 8px; }
.era-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 15px 16px; text-align: left; }
.era-dot { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; flex: none; }
.era-head b { display: block; font-family: var(--font-serif); font-size: 16px; }
.era-head span { font-size: 11.5px; color: var(--ink-4); }
.era-head .chev { margin-left: auto; width: 18px; height: 18px; fill: none; stroke: var(--ink-4); stroke-width: 2.2; stroke-linecap: round; transition: transform .3s var(--ease); }
.era.open .chev { transform: rotate(90deg); }
.era-body { max-height: 0; overflow: hidden; transition: max-height .4s var(--ease); }
.era.open .era-body { max-height: 400px; }
.era-body p { padding: 0 16px 16px; font-size: 13.5px; line-height: 1.8; color: var(--ink-2); word-break: keep-all; }

/* 굿즈 */
.goods-card { display: grid; }
.goods-vis { height: 110px; display: grid; place-items: center; font-size: 42px; position: relative; }
.goods-vis::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 120%, rgba(255,255,255,.35), transparent 60%); }
.goods-price { display: flex; align-items: baseline; gap: 7px; margin-top: 9px; }
.goods-price b { font-size: 15px; }
.goods-price s { font-size: 11.5px; color: var(--ink-4); }
.goods-stock { font-size: 10.5px; color: var(--ink-4); margin-top: 3px; }
.shop-link { display: block; margin-top: 8px; text-align: center; font-size: 11.5px; font-weight: 600;
  color: var(--ink-3); text-decoration: none; padding: 4px; }
.shop-link:hover { color: var(--red); }

/* 스탬프 보드 */
.stamp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px,1fr)); gap: 9px; }
.sg {
  aspect-ratio: 1; border-radius: var(--r-md); border: 1.5px dashed var(--line);
  display: grid; place-items: center; gap: 3px; background: var(--paper);
  font-size: 11px; color: var(--ink-4); font-weight: 600; text-align: center; padding: 6px;
}
.sg.got { border-style: solid; border-color: var(--green); background: color-mix(in srgb, var(--green) 8%, transparent); color: var(--green); }
.sg .seal { width: 46px; height: 46px; border-radius: 8px; border: 2px solid currentColor; display: grid; place-items: center;
  font-family: var(--font-serif); font-size: 13px; font-weight: 700; line-height: 1; transform: rotate(-7deg);
  padding: 4px; overflow: hidden; word-break: break-all; text-align: center; letter-spacing: -.06em; }
.sg.got .seal { animation: stampIn .5s var(--spring); }

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(102px,1fr)); gap: 9px; }
.bg-item { padding: 14px 8px; border-radius: var(--r-md); background: var(--paper); border: 1px solid var(--line-2); text-align: center; }
.bg-item.off { opacity: .38; filter: grayscale(1); }
.bg-item .ic { font-size: 26px; }
.bg-item b { display: block; font-size: 12px; margin-top: 5px; }
.bg-item span { font-size: 10px; color: var(--ink-4); line-height: 1.4; display: block; margin-top: 3px; }

.progress { height: 8px; border-radius: 5px; background: var(--line-2); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 5px; background: var(--red); transition: width .6s var(--ease); }

/* 코스 카드 */
.course-card { padding: 16px; border-radius: var(--r-lg); background: var(--paper); border: 1px solid var(--line-2); box-shadow: var(--shadow-sm); margin-bottom: 10px; text-align: left; width: 100%; }
.cc-head { display: flex; align-items: center; gap: 10px; }
.cc-num { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-family: var(--font-serif); font-size: 15px; font-weight: 700; flex: none; }
.cc-head b { font-family: var(--font-serif); font-size: 17px; }
.cc-head span { display: block; font-size: 11.5px; color: var(--ink-4); }
.cc-desc { font-size: 13px; line-height: 1.7; color: var(--ink-3); margin-top: 10px; word-break: keep-all; }
.cc-stops { display: flex; align-items: center; gap: 4px; margin-top: 12px; flex-wrap: wrap; }
.cs { display: inline-flex; align-items: center; gap: 4px; padding: 5px 9px; border-radius: 8px; background: var(--surface-2); font-size: 11.5px; font-weight: 600; }
.cs.done { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.cc-meta { display: flex; gap: 12px; margin-top: 12px; font-size: 11.5px; color: var(--ink-4); font-weight: 600; }

/* 검색 */
.search-bar { display: flex; align-items: center; gap: 10px; padding: 0 4px 14px; }
.search-bar input { flex: 1; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--paper); font-family: inherit; font-size: 15px; color: var(--ink); }
.search-bar input:focus { outline: none; border-color: var(--red); }
.chip-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 0 4px 14px; }
.chip-row::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--paper); font-size: 12.5px; font-weight: 600; color: var(--ink-2); transition: all .2s; }
.chip.on { background: var(--ink); color: var(--hanji); border-color: var(--ink); }

.list-row { display: flex; gap: 12px; padding: 12px; border-radius: var(--r-md); background: var(--paper); border: 1px solid var(--line-2); width: 100%; text-align: left; margin-bottom: 8px; transition: transform .2s var(--spring); }
.list-row:active { transform: scale(.985); }
.list-row .lr-vis { width: 74px; height: 62px; border-radius: 11px; overflow: hidden; flex: none; }
.list-row .lr-vis svg { display: block; width: 100%; height: 100%; }
.lr-body { flex: 1; min-width: 0; }
.lr-body b { font-size: 14.5px; letter-spacing: -.02em; }
.lr-body .d { font-size: 11px; font-weight: 700; margin-top: 2px; }
.lr-body p { font-size: 12px; color: var(--ink-3); margin-top: 4px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: keep-all; }
.lr-tail { display: grid; place-items: center; align-content: center; gap: 2px; flex: none; padding-left: 4px; }
.lr-tail .km { font-size: 11px; color: var(--ink-4); font-weight: 700; }

/* ══════════════════════ 랭킹 ══════════════════════ */

.rank-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); background: var(--paper); border: 1px solid var(--line-2); margin-bottom: 7px; }
.rank-no { width: 26px; font-family: var(--font-serif); font-size: 16px; font-weight: 700; color: var(--ink-4); text-align: center; flex: none; font-variant-numeric: tabular-nums; }
.rank-row.top .rank-no { color: var(--gold); font-size: 19px; }
.rank-av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 700; flex: none; }
.rank-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-name em { font-style: normal; font-size: 10px; font-weight: 700; color: #fff; background: var(--red);
  padding: 1px 5px; border-radius: 5px; margin-left: 6px; vertical-align: middle; }
.rank-sub { font-size: 11px; color: var(--ink-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-pt { margin-left: auto; font-size: 15px; font-weight: 700; color: var(--red); flex: none;
  font-variant-numeric: tabular-nums; }
.rank-pt i, .pod-score i, .pop-cnt i { font-style: normal; font-size: 11px; font-weight: 600; color: var(--ink-4); margin-left: 2px; }
.rank-row.me { border-color: var(--red); background: color-mix(in srgb, var(--red) 7%, var(--paper)); }

/* 1~3위 시상대 */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 8px; margin-bottom: 22px; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.pod.empty { visibility: hidden; }
.pod-medal { font-size: 22px; line-height: 1; }
.pod-av { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-size: 17px; font-weight: 700; box-shadow: var(--shadow-sm); }
.pod.p1 .pod-av { width: 60px; height: 60px; font-size: 22px; box-shadow: 0 0 0 3px var(--gold), var(--shadow-md); }
.pod.p1 .pod-medal { font-size: 30px; }
.pod-name { font-size: 12.5px; font-weight: 700; max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.pod.p1 .pod-name { font-size: 14px; }
.pod-score { font-family: var(--font-serif); font-size: 16px; font-weight: 700; color: var(--red); font-variant-numeric: tabular-nums; }
.pod.p1 .pod-score { font-size: 20px; }
.pod-base { width: 100%; border-radius: 10px 10px 0 0; margin-top: 4px;
  background: linear-gradient(to bottom, var(--surface-2), transparent); border: 1px solid var(--line-2); border-bottom: 0; }
.pod.p1 .pod-base { height: 54px; background: linear-gradient(to bottom, color-mix(in srgb, var(--gold) 26%, transparent), transparent); }
.pod.p2 .pod-base { height: 38px; }
.pod.p3 .pod-base { height: 28px; }
.pod.me .pod-name::after { content: ' · 나'; color: var(--red); }

.rank-list { display: grid; }

/* 내 순위 카드 */
.my-rank { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r-md);
  background: var(--paper); border: 1.5px solid var(--red); box-shadow: var(--shadow-sm); }
.my-rank.guest { border-color: var(--line); border-style: dashed; }
.mr-place { display: flex; align-items: baseline; gap: 2px; flex: none; }
.mr-place b { font-family: var(--font-serif); font-size: 30px; color: var(--red); font-variant-numeric: tabular-nums; }
.mr-place span { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.mr-body { flex: 1; min-width: 0; }
.mr-gap { text-align: right; font-size: 10.5px; color: var(--ink-4); line-height: 1.5; flex: none; }
.mr-gap b { display: block; font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* 많이 찾은 곳 */
.pop-list { display: grid; gap: 7px; }
.pop-row { display: flex; align-items: center; gap: 11px; padding: 9px 12px; width: 100%; text-align: left;
  border-radius: var(--r-md); background: var(--paper); border: 1px solid var(--line-2);
  transition: transform .2s var(--spring); }
.pop-row:active { transform: scale(.985); }
.pop-no { width: 18px; font-family: var(--font-serif); font-size: 15px; font-weight: 700; color: var(--ink-4); flex: none; }
.pop-vis { width: 56px; height: 44px; border-radius: 9px; overflow: hidden; flex: none; }
.pop-vis svg { display: block; width: 100%; height: 100%; }
.pop-cnt { margin-left: auto; font-size: 14px; font-weight: 700; flex: none; font-variant-numeric: tabular-nums; }

/* ══════════════════════ 아바타 ══════════════════════ */

.avatar-art { display: block; width: 100%; height: 100%; }

.av-stage {
  padding: 22px 20px 20px; border-radius: var(--r-lg); text-align: center;
  background: radial-gradient(120% 90% at 50% 0%, var(--surface-2) 0%, var(--paper) 70%);
  border: 1px solid var(--line-2); box-shadow: var(--shadow-sm);
}
.av-figure { width: 172px; height: 230px; margin: 0 auto; }

/* 3D 아바타 */
.av-3d { position: relative; width: 100%; height: 300px; margin: -6px 0 2px; }
.av-3d canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; }
.av-3d canvas:active { cursor: grabbing; }
.av-level {
  display: inline-flex; align-items: baseline; gap: 7px; padding: 4px 12px; border-radius: 999px;
  background: var(--ink); color: var(--hanji); font-size: 14px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.av-level span { font-size: 11px; opacity: .7; font-weight: 600; }

/* 기수 — 차림새가 바뀌는 다섯 갈래 */
.av-tiers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.av-tier {
  display: grid; justify-items: center; gap: 2px; padding: 9px 3px 10px;
  border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line-2);
  opacity: .42; filter: grayscale(1);
}
.av-tier.on { opacity: 1; filter: none; }
.av-tier.now { border-color: var(--red); background: color-mix(in srgb, var(--red) 8%, transparent); }
.av-tier-fig { width: 100%; aspect-ratio: 200/268; display: grid; place-items: center; }
.av-tier-emoji { font-size: 30px; line-height: 1; }
.av-tier b { font-size: 11.5px; }
.av-tier-wear { font-size: 9.5px; color: var(--ink-4); text-align: center; }

/* 앞으로 올 단계 */
.av-next { display: grid; gap: 6px; }
.av-next-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: var(--r-md); background: var(--paper); border: 1px solid var(--line-2);
}
.av-next-lv {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: var(--surface-2); font-family: var(--font-serif); font-size: 14px; font-weight: 700;
  color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.av-next-need { font-size: 12.5px; font-weight: 700; color: var(--ink-4); flex: none;
  font-variant-numeric: tabular-nums; }
.av-figure .av-body { transform-origin: 100px 230px; animation: avBreathe 4.2s ease-in-out infinite; }
.av-figure .av-head { transform-origin: 100px 96px; animation: avNod 4.2s ease-in-out infinite; }
@keyframes avBreathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.012); } }
@keyframes avNod { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }

.av-title { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin-top: 6px; }
.av-title b { font-family: var(--font-serif); font-size: 28px; }
.av-title span { font-size: 14px; color: var(--ink-4); }
.av-desc { margin-top: 8px; font-size: 13.5px; line-height: 1.7; color: var(--ink-3); word-break: keep-all; }

.av-progress { margin-top: 20px; text-align: left; }
.av-progress-head, .av-progress-foot { display: flex; justify-content: space-between; }
.av-progress-head { font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 7px; }
.av-progress-head span:last-child { color: var(--ink-4); font-weight: 600; }
.av-progress-foot { font-size: 10.5px; color: var(--ink-4); margin-top: 5px; font-variant-numeric: tabular-nums; }

.av-greet {
  display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 14px 16px;
  border-radius: var(--r-md); background: var(--paper); border: 1.5px solid var(--red);
}
.av-greet.done { border-color: var(--line); border-style: dashed; }
.av-greet b { font-size: 14px; }
.av-greet p { font-size: 11.5px; color: var(--ink-4); margin-top: 2px; }
.av-greet .btn { height: 38px; padding: 0 14px; font-size: 13px; flex: none; }
.av-streak { font-size: 15px; font-weight: 700; color: var(--red); flex: none; }

.look-row { display: flex; flex-wrap: wrap; gap: 7px; }
.look-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--paper); font-size: 12.5px; font-weight: 600;
  color: var(--ink-2); transition: border-color .2s, background .2s;
}
.look-chip i { width: 13px; height: 13px; border-radius: 50%; border: 1px solid var(--line); flex: none; }
.look-chip.on { border-color: var(--red); background: color-mix(in srgb, var(--red) 9%, transparent); color: var(--ink); }
.look-chip.locked { opacity: .5; cursor: not-allowed; }
.look-chip em { font-style: normal; font-size: 10.5px; color: var(--ink-4); font-weight: 600; }
.look-chip:not(.locked):hover { border-color: var(--ink-4); }

.av-ladder { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.av-step {
  display: grid; justify-items: center; gap: 2px; padding: 8px 2px 9px;
  border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line-2);
  opacity: .45; filter: grayscale(1);
}
.av-step.on { opacity: 1; filter: none; }
.av-step.now { border-color: var(--red); background: color-mix(in srgb, var(--red) 8%, transparent); }
.av-step-fig { width: 100%; aspect-ratio: 200/268; }
.av-step b { font-size: 10.5px; }
.av-step-need { font-size: 9px; color: var(--ink-4); font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .av-figure .av-body, .av-figure .av-head { animation: none; }
}

/* ══════════════════════ 관리자 ══════════════════════ */

.adm-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(98px, 1fr)); gap: 8px; margin-bottom: 6px; }
.adm-tile { padding: 13px 12px; border-radius: var(--r-md); background: var(--paper); border: 1px solid var(--line-2); }
.adm-tile b { display: block; font-family: var(--font-serif); font-size: 22px; color: var(--ink);
  font-variant-numeric: tabular-nums; line-height: 1.1; }
.adm-tile b i { font-style: normal; font-size: 11px; font-weight: 600; color: var(--ink-4); margin-left: 3px;
  font-family: var(--font-sans); }
.adm-tile span { font-size: 11px; color: var(--ink-4); font-weight: 600; }

.adm-chart { display: flex; align-items: flex-end; gap: 3px; height: 110px; padding: 10px 12px 0;
  background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r-md); }
.adm-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  height: 100%; gap: 4px; min-width: 0; }
.adm-bar i { display: block; width: 100%; max-width: 18px; min-height: 2px; border-radius: 3px 3px 0 0;
  background: var(--red); opacity: .85; }
.adm-bar span { font-size: 8.5px; color: var(--ink-4); white-space: nowrap; font-variant-numeric: tabular-nums; }

.adm-feed { display: grid; gap: 2px; }
.adm-ev { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line-2); }
.adm-ev:last-child { border-bottom: 0; }
.adm-ev-ic { font-size: 16px; width: 22px; text-align: center; flex: none; }

.adm-user { padding: 13px 14px; border-radius: var(--r-md); background: var(--paper);
  border: 1px solid var(--line-2); margin-bottom: 8px; }
.adm-user-head { display: flex; align-items: center; gap: 11px; }
.adm-user-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px;
  font-size: 11.5px; color: var(--ink-4); }
.adm-user-stats b { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.adm-user-act { display: flex; align-items: center; gap: 7px; margin-top: 11px;
  padding-top: 11px; border-top: 1px solid var(--line-2); }
.adm-user-act label { font-size: 11.5px; font-weight: 700; color: var(--ink-3); flex: none; }
.adm-user-act .adm-pt { width: 86px; padding: 7px 9px; border-radius: 9px; border: 1.5px solid var(--line);
  background: var(--surface-2); color: var(--ink); font-family: inherit; font-size: 13px;
  font-variant-numeric: tabular-nums; }
.adm-user-act .adm-pt:focus { outline: none; border-color: var(--red); background: var(--paper); }
.adm-user-act .btn { height: 34px; padding: 0 12px; font-size: 12.5px; }
.adm-user-act .btn:last-child { margin-left: auto; }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.btn.danger:disabled { color: var(--ink-4); border-color: var(--line); }

.adm-review { padding: 14px; border: 1px solid var(--line-2); border-radius: var(--r-md);
  margin-bottom: 8px; background: var(--paper); }
.adm-review-act { display: flex; gap: 8px; margin-top: 10px; }
.adm-review-act .btn { height: 32px; padding: 0 12px; font-size: 12px; }

/* ══════════════════════ 모달 ══════════════════════ */
.modal {
  position: fixed; z-index: 60; inset: 0; display: grid; place-items: center; padding: 20px;
  background: rgba(12,13,16,.58); backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s;
}
body.modal-open .modal { opacity: 1; visibility: visible; }
.modal-card {
  width: min(400px, 100%); max-height: 88dvh; overflow-y: auto;
  background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  padding: 26px 24px; transform: translateY(16px) scale(.97); transition: transform .38s var(--spring);
}
body.modal-open .modal-card { transform: none; }
.modal-card h3 { font-family: var(--font-serif); font-size: 23px; margin-bottom: 4px; }
.modal-card .m-sub { font-size: 13px; color: var(--ink-3); margin-bottom: 20px; line-height: 1.6; }
.g-btn { display: flex; justify-content: center; min-height: 44px; margin-bottom: 4px; }
.or {
  display: flex; align-items: center; gap: 10px; margin: 14px 0 16px;
  font-size: 11.5px; font-weight: 600; color: var(--ink-4);
}
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.m-switch { text-align: center; margin-top: 16px; font-size: 13px; color: var(--ink-3); }
.m-switch button { font-weight: 700; color: var(--red); text-decoration: underline; text-underline-offset: 3px; }
.m-err { padding: 11px 13px; border-radius: 10px; background: color-mix(in srgb, var(--red) 12%, transparent);
  color: var(--red); font-size: 12.5px; font-weight: 600; margin-bottom: 12px; line-height: 1.5; }
.m-close { position: absolute; }

/* ══════════════════════ 토스트 / 배지 팝 ══════════════════════ */
.toasts { position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); bottom: calc(94px + var(--safe-b)); display: grid; gap: 8px; width: max-content; max-width: 92vw; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 9px; padding: 12px 16px; border-radius: 14px;
  background: rgba(22,24,28,.92); color: #f7f3ea; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-md); backdrop-filter: blur(10px);
  animation: toastIn .4s var(--spring); word-break: keep-all;
}
.toast.out { animation: toastOut .3s var(--ease) forwards; }
.toast .em { font-size: 17px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px) scale(.96); } }

.badge-pop { position: fixed; z-index: 80; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; background: rgba(12,13,16,.5); }
.badge-pop.show { opacity: 1; visibility: visible; }
.bp-card { background: var(--paper); border-radius: var(--r-lg); padding: 30px 34px; text-align: center; box-shadow: var(--shadow-lg); animation: stampIn .6s var(--spring); }
.bp-ic { font-size: 56px; }
.bp-card b { display: block; font-family: var(--font-serif); font-size: 22px; margin-top: 8px; }
.bp-card span { font-size: 12.5px; color: var(--ink-3); }
.bp-card em { display: block; font-style: normal; font-size: 11px; font-weight: 700; letter-spacing: .16em; color: var(--gold); margin-bottom: 4px; }

/* ══════════════════════ 데스크톱 ══════════════════════ */
@media (min-width: 860px) {
  .sheet {
    left: auto; right: 18px; top: 18px; bottom: 18px; width: 440px; height: auto; max-height: none;
    border-radius: var(--r-lg); transform: translateX(calc(100% + 24px));
  }
  body.sheet-open .sheet { transform: none; }
  body.sheet-open.sheet-peek .sheet { transform: none; }
  .sheet-grab { display: none; }
  .sheet-backdrop { display: none; }
  .rail { right: 476px; transition: right .46s var(--spring); }
  body.sheet-open .rail { right: 476px; }
  body:not(.sheet-open) .rail { right: 18px; }
  /* 데스크톱: 아래 띠 대신 왼쪽 세로 목록 패널 — 지도를 가리지 않고
     13곳 전체를 한눈에 훑을 수 있다. */
  .dock {
    left: 18px; right: auto; width: 296px;
    top: calc(118px + var(--safe-t)); bottom: 18px;
    display: flex; flex-direction: column; gap: 8px; padding: 12px;
    background: var(--surface); backdrop-filter: blur(16px) saturate(1.3);
    border: 1px solid var(--glass-brd); border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
  }
  body.sheet-open .dock { transform: none; opacity: 1; pointer-events: auto; }
  .dock-head {
    display: flex; align-items: baseline; gap: 7px; padding: 2px 4px 6px;
    border-bottom: 1px solid var(--line-2);
  }
  .dock-head b { font-family: var(--font-serif); font-size: 15px; }
  .dock-head span { font-size: 11.5px; color: var(--ink-4); font-weight: 600; margin-left: auto; }
  .dock-peek {
    flex: 1; min-height: 0;
    flex-direction: column; gap: 4px;
    overflow-x: hidden; overflow-y: auto;
    scroll-snap-type: none;
    -webkit-mask-image: none; mask-image: none;
  }
  .dock-peek .peek-card {
    width: 100%; border-radius: 12px; background: transparent;
    border-color: transparent; box-shadow: none; padding: 8px 10px 8px 8px;
  }
  .dock-peek .peek-card:hover { background: var(--line-2); }
  .dock-peek .peek-card.on { background: color-mix(in srgb, var(--red) 12%, transparent); }
  .cta { height: 52px; font-size: 15px; }
  .topbar { left: 18px; right: 18px; }
  .notice { left: 18px; right: auto; width: 420px; }
  .view { left: 0; right: 0; }
  .map-chips { top: calc(122px + var(--safe-t)); left: 332px; max-width: 40vw; }
  .viewer { height: 420px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
