:root {
  --bg: #f7f3fd;
  --card: #ffffff;
  --ink: #4a4550;
  --muted: #756b71;
  --line: #ece3f7;
  --v: #7b5ea7;
  --v-ink: #6b4c9a;
  --v-soft: #f0e9fb;
  --v-pill: #ded0f5;
  --y: #c9962f;
  --y-soft: #fdf6e3;
  --y-pill: #f7e6c8;
  --pink: #d1568a;
  --pink-soft: #fce4ee;
  --heart: #f48fb1;
  --star: #e8763a;
  --sky: #dff0fb;
  --btn-hover: rgba(123, 94, 167, 0.16);
}

html[data-theme="dark"] {
  --bg: #121212;
  --card: #1e1e1e;
  --ink: #e0e0e0;
  --muted: #a0a0a0;
  --line: #333333;
  --v: #a58ac9;
  --v-ink: #c6b2e0;
  --v-soft: #2d243a;
  --v-pill: #45355c;
  --y: #e3b652;
  --y-soft: #382c16;
  --y-pill: #5c4a25;
  --pink: #e27da9;
  --pink-soft: #421c2d;
  --heart: #f48fb1;
  --star: #ff9b66;
  --sky: #1e3a4f;
  --btn-hover: rgba(200, 180, 255, 0.16);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #121212;
    --card: #1e1e1e;
    --ink: #e0e0e0;
    --muted: #a0a0a0;
    --line: #333333;
    --v: #a58ac9;
    --v-ink: #c6b2e0;
    --v-soft: #2d243a;
    --v-pill: #45355c;
    --y: #e3b652;
    --y-soft: #382c16;
    --y-pill: #5c4a25;
    --pink: #e27da9;
    --pink-soft: #421c2d;
    --heart: #f48fb1;
    --star: #ff9b66;
    --sky: #1e3a4f;
    --btn-hover: rgba(200, 180, 255, 0.16);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", "Nanum Gothic", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 14px 110px; }
a { color: var(--v-ink); text-decoration: underline; text-underline-offset: 3px; }

/* ---- 표지 ---- */
.hero { position: relative; margin-top: 16px; border-radius: 22px; overflow: hidden; background: var(--card); border: 1px solid var(--line); }
.hero .art { display: block; width: 100%; height: auto; }
.hero .title { position: absolute; left: 26px; top: 22px; }
.hero h1 { margin: 0; font-size: 33px; font-weight: 800; letter-spacing: -.035em; color: var(--v-ink); text-wrap: balance; }
.hero h1 .hh { color: var(--heart); font-size: 22px; vertical-align: 5px; }
.hero h2 { margin: 2px 0 0; font-size: 17px; font-weight: 700; color: var(--v); }
.hero p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.script { position: absolute; right: 26px; top: 26px; font-size: 27px; color: var(--v-ink); font-family: "Segoe Script", "Brush Script MT", cursive; transform: rotate(-6deg); }

/* ---- 컨트롤 패널 ---- */
.controls { display: flex; justify-content: flex-end; padding: 8px 0; gap: 10px; }
.toggle-btn { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.toggle-btn:hover { background: var(--v-soft); }

/* ---- 글로벌 네비게이션 ---- */
.global-nav { margin: 8px 0 16px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 12px; display: flex; gap: 6px; overflow-x: auto; box-shadow: 0 2px 10px rgba(0,0,0,0.04); align-items: center; }
.global-nav .chip { flex: none; font-size: 14px; padding: 6px 16px; border-radius: 12px; border: none; background: var(--v-soft); color: var(--v-ink); font-weight: 700; transition: all .2s; cursor: pointer; }
.global-nav .chip.on { background: var(--v-ink); color: #fff; }
.global-nav .chip:hover:not(.on) { background: var(--v-pill); }
.global-nav .divider { width: 1px; height: 24px; background: var(--line); margin: 0 4px; flex: none; }
.global-nav .chip.extra { background: var(--y-soft); color: var(--y); }
.global-nav .chip.extra.on { background: var(--star); color: #fff; }
.global-nav .chip.extra:hover:not(.on) { background: var(--y-pill); }
.day-hidden { display: none !important; }
.section-hidden { display: none !important; }

/* ---- 검색 ---- */
.searchbar { position: sticky; top: 0; z-index: 6; background: var(--bg); padding: 10px 0 8px; margin-bottom: 2px; }
.searchbar .box { display: flex; gap: 8px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 9px 13px; }
.searchbar input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 15px; font-family: inherit; color: var(--ink); min-width: 0; }
.searchbar input::placeholder { color: var(--muted); }
.searchbar .ico { font-size: 15px; flex: none; }
.searchbar button { border: 0; background: transparent; font-size: 15px; cursor: pointer; color: var(--muted); font-family: inherit; padding: 0 2px; }
.searchbar .cnt { font-size: 12px; color: var(--muted); white-space: nowrap; }
#results { margin-top: 8px; display: none; flex-direction: column; gap: 7px; }
#results.on { display: flex; }
.hit { background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: 10px 12px; text-align: left; font-family: inherit; font-size: 14px; color: var(--ink); width: 100%; cursor: default; }
.hit.can { cursor: pointer; }
.hit.can:hover { box-shadow: 0 4px 12px var(--btn-hover); }
.hit .top { display: flex; gap: 7px; align-items: baseline; flex-wrap: wrap; }
.hit b { font-weight: 700; }
.hit .kind { font-size: 10.5px; border-radius: 999px; padding: 1px 8px; background: var(--v-soft); color: var(--v-ink); flex: none; }
.hit .snip { display: block; margin-top: 4px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.hit mark { background: var(--pink-soft); color: var(--pink); border-radius: 3px; padding: 0 2px; }
.nohit { color: var(--muted); font-size: 13px; padding: 12px 2px; }

/* ---- 일차 카드 ---- */
.day { margin: 16px 0; border-radius: 20px; border: 1px solid var(--line); background: var(--card); display: grid; grid-template-columns: 132px 1fr; overflow: hidden; }
.side { padding: 16px 12px; background: var(--v-soft); position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; }
.day.y .side { background: var(--y-soft); }
.side .n { font-size: 25px; font-weight: 800; color: var(--v-ink); letter-spacing: -.02em; }
.day.y .side .n { color: var(--y); }
.side .n .hh { color: var(--heart); font-size: 15px; vertical-align: 4px; }
.side .d { font-size: 16px; font-weight: 700; color: var(--v); margin-top: 1px; }
.day.y .side .d { color: var(--y); }
.holi { margin-top: 7px; font-size: 11.5px; background: var(--card); border-radius: 999px; padding: 2px 10px; border: 1px solid var(--line); white-space: nowrap; }
.holi i { color: var(--pink); font-style: normal; }
.mascot { width: 74px; height: 74px; margin-top: 14px; }
.side .mood { margin-top: 8px; font-size: 11.5px; color: var(--muted); white-space: pre-line; line-height: 1.45; }

.panel { padding: 10px 12px 12px; min-width: 0; }
.hdrow { display: grid; grid-template-columns: 1fr 112px 1.6fr; gap: 7px; font-size: 12px; font-weight: 700; text-align: center; color: var(--v-ink); }
.hdrow span { background: var(--v-pill); border-radius: 8px; padding: 4px 6px; }
.day.y .hdrow span { background: var(--y-pill); color: var(--y); }
.row { display: grid; grid-template-columns: 1fr 112px 1.6fr; gap: 7px; padding: 11px 0; border-bottom: 1px dashed var(--line); align-items: center; }
.row:last-child { border-bottom: 0; }

.main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.slot { flex: none; width: 34px; font-size: 12.5px; font-weight: 700; color: var(--v); text-align: center; }
.day.y .slot { color: var(--y); }
.pic { flex: none; width: 50px; height: 50px; border: 1px solid var(--line); background: var(--v-soft); border-radius: 14px; font-size: 24px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform .15s, box-shadow .15s; }
.day.y .pic { background: var(--y-soft); }
.pic:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 5px 14px var(--btn-hover); }
.pic:focus-visible { outline: 2px solid var(--v); outline-offset: 2px; }
.t { min-width: 0; }
.t b { display: block; font-size: 14.5px; font-weight: 700; line-height: 1.35; }
.t span { display: block; font-size: 12px; color: var(--muted); }

.hours { font-size: 12px; text-align: center; color: var(--star); white-space: pre-line; }
.hours .star { font-size: 13px; }
.row.none .hours { color: var(--muted); }

.move { font-size: 12px; color: var(--muted); min-width: 0; }
.leg { display: inline-block; background: var(--pink-soft); color: var(--pink); border-radius: 999px; padding: 2px 11px; font-weight: 700; font-size: 12px; margin-bottom: 5px; }
.day.y .leg { background: var(--y-pill); color: var(--y); }
.chain { display: flex; align-items: flex-start; gap: 2px; overflow-x: auto; padding-bottom: 3px; }
.step { flex: 0 0 auto; max-width: 88px; text-align: center; }
.step .e { display: block; width: 30px; height: 30px; margin: 0 auto 3px; background: var(--sky); border-radius: 10px; font-size: 15px; line-height: 30px; }
.step b { display: block; font-size: 10.5px; font-weight: 700; color: var(--v-ink); line-height: 1.25; }
.step span { display: block; font-size: 9.5px; color: var(--muted); line-height: 1.3; }
.arrow { flex: 0 0 auto; color: var(--heart); font-size: 12px; padding-top: 7px; }
.mnote { margin-top: 4px; }

.mapwrap { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 14px; margin: 16px 0; }
.maphead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.maphead .sec { margin: 0; }
#routemap { width: 100%; height: 460px; background: var(--bg); border-radius: 14px; overflow: hidden; }
.mapnote { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.mapcap { margin: 6px 0 0; font-size: 11.5px; color: var(--muted); }

/* ---- 팁 ---- */
.tipbar { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.tipbadge { font-size: 11.5px; border: 1px solid var(--v-pill); background: var(--v-soft); color: var(--v-ink); border-radius: 999px; padding: 2px 10px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tipbadge.trip { background: var(--card); border-color: var(--line); color: var(--muted); }
.tipgroup { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 11px 14px; margin-bottom: 9px; }
.tipgroup h4 { margin: 0 0 5px; font-size: 14px; font-weight: 800; color: var(--v-ink); }
.tip { border-top: 1px dashed var(--line); padding: 8px 0; font-size: 13px; }
.tipgroup .tip:first-of-type { border-top: 0; }
.tipmeta { font-size: 11.5px; font-weight: 700; color: var(--v); }
.tipev { margin-top: 3px; font-size: 11.5px; word-break: break-all; }

/* ---- 장소 목록 ---- */
h3.sec { margin: 32px 0 3px; font-size: 19px; font-weight: 800; color: var(--v-ink); }
.sec-sub { margin: 0 0 11px; color: var(--muted); font-size: 12.5px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 11px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 13px; font-size: 12.5px; cursor: pointer; font-family: inherit; color: var(--ink); }
.chip.on { background: var(--v-ink); color: #fff; border-color: var(--v-ink); }
#grid, #itemgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(224px, 1fr)); gap: 9px; }
.tile { display: flex; gap: 9px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 9px; text-align: left; font-family: inherit; font-size: 13.5px; color: var(--ink); width: 100%; }
button.tile { cursor: pointer; }
button.tile:hover { box-shadow: 0 5px 14px var(--btn-hover); }
.tile .e { font-size: 22px; flex: none; }
.tile > span { min-width: 0; }
/* min-height: 제목이 1줄이든 2줄이든 아래 본문 시작 높이를 맞춘다 */
.tile b { display: block; font-weight: 700; line-height: 1.3; min-height: 2.6em; max-width: 100%; overflow-wrap: anywhere; }
.tile small { color: var(--muted); }
.tile.done { background: var(--v-soft); }
.tile .tg { display: inline-block; font-size: 10.5px; background: var(--pink-soft); color: var(--pink); border-radius: 999px; padding: 1px 7px; margin-right: 5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.d-ambiguous { background: #e0a02a; } .d-not_found { background: #d1594c; }
.d-pending { background: #a8a0ad; } .d-matched { background: #79b58a; }

/* 서브 태그 필터 */
.subtabs { display: flex; flex-wrap: wrap; gap: 5px; margin: -4px 0 14px; }
.sub-chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 3px 10px; font-size: 11.5px; cursor: pointer; font-family: inherit; color: var(--muted); transition: all 0.2s; }
.sub-chip:hover { border-color: var(--v); color: var(--v-ink); }
.sub-chip.on { background: var(--v); color: #fff; border-color: var(--v); font-weight: 700; }

/* 카테고리별 그룹 묶음 */
.category-group { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; margin-bottom: 16px; width: 100%; box-sizing: border-box; }
.group-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.group-icon { font-size: 20px; line-height: 1; }
.group-name { font-size: 16px; font-weight: 800; color: var(--v-ink); }
.group-badge { font-size: 11px; font-weight: 700; background: var(--v-soft); color: var(--v-ink); border-radius: 999px; padding: 2px 8px; }
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }

/* 내 위치 기준 정렬 */
.nearbar { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin: -6px 0 12px; }
.nearbar .btn.on { background: var(--v); color: #fff; border-color: var(--v); font-weight: 700; }
.nearnote { font-size: 12px; color: var(--muted); }
.dist { display: inline-block; font-size: 10.5px; font-weight: 700; background: var(--v-soft); color: var(--v-ink); border-radius: 999px; padding: 1px 7px; margin-right: 5px; }
.dist.far { background: var(--bg); color: var(--muted); }

/* 아이템 카드 내 노트 스타일 */
.item-note { margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 1.45; background: var(--bg); border-radius: 8px; padding: 6px 9px; border: 1px solid var(--line); width: 100%; box-sizing: border-box; }
.item-actions { margin-top: 6px; display: flex; gap: 6px; min-height: 23px; max-width: 100%; }
.item-place-link { display: block; min-width: 0; font-size: 12px; font-weight: 700; line-height: 1.4; color: var(--v-ink); background: var(--v-soft); border-radius: 6px; padding: 3px 8px; text-decoration: none; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-place-link:hover { text-decoration: underline; background: var(--v-pill); }

/* 팝업 리뷰 박스 */
.review-box { margin-top: 14px; background: var(--bg); border: 1px solid var(--line); border-left: 4px solid var(--v); border-radius: 10px; padding: 11px 14px; font-size: 13px; line-height: 1.6; }
.review-header { font-weight: 800; font-size: 13px; color: var(--v-ink); margin-bottom: 5px; }
.review-content { color: var(--ink); white-space: pre-line; word-break: break-word; }

/* ---- 팝업 ---- */
dialog { border: 0; border-radius: 20px; padding: 0; max-width: 520px; width: calc(100% - 28px); background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,0.45); }
.pop { padding: 20px 22px 18px; }
.pop .top { display: flex; gap: 12px; align-items: flex-start; }
.pop .e { font-size: 36px; line-height: 1; }
.pop h4 { margin: 0; font-size: 19px; font-weight: 800; color: var(--v-ink); text-wrap: balance; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.badge { font-size: 11.5px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; color: var(--muted); }
.pop dl { margin: 13px 0 0; display: grid; grid-template-columns: 74px 1fr; gap: 6px 12px; font-size: 13px; }
.pop dt { color: var(--muted); } .pop dd { margin: 0; word-break: break-word; }
.tt { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.tt h5 { margin: 0 0 3px; font-size: 13.5px; font-weight: 800; color: var(--v-ink); }
.tt .leg { font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.tt table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.tt td { padding: 3px 0; }
.tt td.t { font-weight: 700; color: var(--v-ink); white-space: nowrap; }
.tt td.d { color: var(--muted); font-size: 12px; padding-left: 8px; }
.tt .soon { color: var(--pink); }
.tt .warn { margin-top: 7px; font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.tt .links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.tt .links a { font-size: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; text-decoration: none; color: var(--v-ink); background: var(--bg); }
.pop .acts { display: flex; gap: 8px; align-items: center; margin-top: 15px; flex-wrap: wrap; }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 14px; font-size: 13px; cursor: pointer; font-family: inherit; color: var(--ink); text-decoration: none; }
.btn.go { background: var(--v-ink); border-color: var(--v-ink); color: #fff; }
.btn.off { color: var(--muted); cursor: not-allowed; }
.savebox { display: flex; gap: 7px; align-items: center; font-size: 13px; margin-left: auto; }

/* ---- 하단 명령 바 ---- */
.bar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding: 8px 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12.5px; z-index: 5; }
.bar code { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; flex: 1; min-width: 180px; overflow: auto; white-space: nowrap; }
footer { color: var(--muted); font-size: 11.5px; padding: 24px 0 6px; text-align: center; margin-bottom: 60px; }

@keyframes fall { to { transform: translateY(78px) rotate(150deg); opacity: 0; } }
.petal { animation: fall 9s linear infinite; }
.petal:nth-of-type(2) { animation-delay: 2.4s; }
.petal:nth-of-type(3) { animation-delay: 4.9s; }

/* 인터랙티브 애니메이션 */
@keyframes shake { 0%,100%{transform:translateY(0)} 25%{transform:translateY(-2px) rotate(-3deg)} 75%{transform:translateY(1px) rotate(3deg)} }
.anim-shake { animation: shake 0.6s infinite ease-in-out; }
@keyframes walk { 0%,100%{transform:rotate(0deg)} 25%{transform:rotate(-8deg)} 75%{transform:rotate(8deg)} }
.anim-walk { animation: walk 0.8s infinite ease-in-out; transform-origin: bottom center; }
@keyframes flow { 0%{transform:translateX(0);opacity:.5} 50%{transform:translateX(3px);opacity:1} 100%{transform:translateX(0);opacity:.5} }
.anim-flow { animation: flow 1.5s infinite ease-in-out; display: inline-block; }
@keyframes cherryFall { 0%{transform:translateY(-10px) rotate(0deg) translateX(0);opacity:0} 10%{opacity:1} 90%{opacity:1} 100%{transform:translateY(100vh) rotate(360deg) translateX(50px);opacity:0} }
.cherry-blossom { position: fixed; top: -20px; color: var(--heart); user-select: none; pointer-events: none; z-index: 9999; animation: cherryFall linear forwards; }

.reduce-motion .petal, .reduce-motion .anim-shake, .reduce-motion .anim-walk, .reduce-motion .anim-flow, .reduce-motion .cherry-blossom { animation: none !important; }
@media(prefers-reduced-motion: reduce) { .petal, .anim-shake, .anim-walk, .anim-flow, .cherry-blossom { animation: none !important; } }

@media(max-width:780px) {
  .day { grid-template-columns: 1fr; }
  .side { flex-direction: row; gap: 10px; justify-content: flex-start; text-align: left; padding: 11px 14px; }
  .side .mood { display: none; } .mascot { width: 42px; height: 42px; margin: 0; }
  .hdrow { display: none; }
  .row { grid-template-columns: 1fr; gap: 7px; }
  .hours, .move { text-align: left; }
  .hours::before { content: "영업시간 · "; }
  .hero h1 { font-size: 25px; } .script { display: none; }
}
