/* ===== 토큰 ===== */
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --card-line: #edf0f6;
  --line: #e8ebf2;
  --line-strong: #d6dbe5;
  --hover: #f6f8fc;
  --text: #1f2937;
  --text-2: #4b5563;
  --text-3: #6b7280;
  --text-4: #8b93a3; /* 숫자·보조 표시 (14px 이상 굵게, 또는 장식용) */

  --mint: #13c296;  --mint-soft: #e6f8f2;  --mint-ink: #087f62;
  --purple: #6c5ce7; --purple-soft: #efedff; --purple-ink: #5848d6;
  --coral: #ff7a59; --coral-soft: #fff0eb; --coral-ink: #c4441f;
  --yellow: #ffc233; --yellow-soft: #fff6dc; --yellow-ink: #8a6100;
  --sky: #3d9bff;   --sky-soft: #e8f3ff;   --sky-ink: #1f6fd1;
  --pink: #ff5c8a;  --pink-soft: #ffeef3;  --pink-ink: #c52a58;
  --indigo: #5b7cfa; --indigo-soft: #edf1ff; --indigo-ink: #3552c9;
  --gray-soft: #f1f3f7; --gray-ink: #5f687b;
  /* 주색: 로고의 노랑 */
  --primary: #ffc233; --primary-ink: #8a6100; --primary-soft: #fff6dc; --primary-line: #ffe49b; --primary-hover: #f5b40f;
  --on-primary: #fff;            /* 노란 바탕 위 글자: 흰색 */
  --on-primary-shadow: 0 1px 2px rgba(138, 88, 0, .38);  /* 흰 글자가 밝은 노랑에 묻히지 않게 옅은 그림자 */
  --map-1: #fff1c4; --map-2: #ffdf85; --map-3: #ffc94a; --map-4: #f5a800;  /* 지도 단계 */
  --heat-a: 255, 194, 51; --heat-b: 230, 146, 0;                           /* 2주 달력 단계 (흰 글자가 보이게 한 단계 진하게) */
  --label-count: #ffd25e;        /* 어두운 말풍선 안 숫자 */
  --hl-color: var(--text);       /* 제목의 지역 이름 (노란 형광펜으로 강조) */
  --hl-bg: linear-gradient(transparent 58%, var(--primary) 58%, var(--primary) 92%, transparent 92%);
  --logo-accent: #c47f00;        /* 로고 "놀자" */
  --danger: #f03e5e;

  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-point: "MoaPoint", var(--font);

  --shadow: 0 1px 2px rgba(27, 36, 55, 0.04), 0 8px 24px rgba(27, 36, 55, 0.05);
  --radius: 18px;
  --radius-sm: 10px;
  --sidebar-w: 248px;
  --appbar-h: 0px;
  --gap: 16px;
}

/* 색 시안: 기본은 노랑, 보라·다홍은 index.html?theme=purple / coral 로 비교 */
:root[data-theme="purple"] {
  --primary: #6c5ce7; --primary-ink: #5848d6; --primary-soft: #efedff; --primary-line: #d9d4ff; --primary-hover: #5848d6;
  --on-primary: #fff; --on-primary-shadow: none;
  --map-1: #e2ddff; --map-2: #c2b9fb; --map-3: #9a8cf3; --map-4: #6c5ce7;
  --heat-a: 108, 92, 231; --heat-b: 58, 45, 176;
  --label-count: #c9c2ff;
  --hl-color: var(--primary); --hl-bg: none;
  --logo-accent: #5848d6;
}
:root[data-theme="coral"] {
  --primary: #ff7a59; --primary-ink: #c4441f; --primary-soft: #fff0eb; --primary-line: #ffd2c4; --primary-hover: #f2643f;
  --on-primary: #1f2937; --on-primary-shadow: none;
  --map-1: #ffe3da; --map-2: #ffc0ad; --map-3: #ff9a7d; --map-4: #ff7a59;
  --heat-a: 255, 170, 146; --heat-b: 255, 112, 76;
  --label-count: #ffab93;
  --hl-color: #e2532f; --hl-bg: none;
  --logo-accent: #e2532f;
}

/* ===== 기본 ===== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-wrap: break-word;
}
h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
p { margin: 0; }
p, li, dd { text-wrap: pretty; }
.desc { text-wrap: balance; }
button, .btn, .badge, .chip, .tag { white-space: nowrap; }
.nw { white-space: nowrap; }
.sent { display: block; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
a { color: inherit; }
svg.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--primary-ink); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 200; padding: 8px 14px; border-radius: var(--radius-sm); background: var(--text); color: #fff; text-decoration: none; }
.skip-link:focus { top: 12px; }

/* 기관 유형 색 */
.t-library    { --tc: var(--mint);   --tsoft: var(--mint-soft);   --tink: var(--mint-ink); }
.t-foundation { --tc: var(--purple); --tsoft: var(--purple-soft); --tink: var(--purple-ink); }
.t-public     { --tc: var(--sky);    --tsoft: var(--sky-soft);    --tink: var(--sky-ink); }
.t-childcare  { --tc: var(--coral);  --tsoft: var(--coral-soft);  --tink: var(--coral-ink); }
.t-family     { --tc: var(--yellow); --tsoft: var(--yellow-soft); --tink: var(--yellow-ink); }
.t-youth      { --tc: var(--indigo); --tsoft: var(--indigo-soft); --tink: var(--indigo-ink); }
.t-museum     { --tc: var(--pink);   --tsoft: var(--pink-soft);   --tink: var(--pink-ink); }

/* ===== 레이아웃 ===== */
.app {
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh;
  /* 페이지가 화면보다 길어도 사이드바 칸의 흰 배경·경계선이 끝까지 이어지게 */
  background: linear-gradient(to right, #fff calc(var(--sidebar-w) - 1px), var(--card-line) calc(var(--sidebar-w) - 1px) var(--sidebar-w), transparent var(--sidebar-w));
}
.main { min-width: 0; container: main / inline-size; }
.content { display: flex; flex-direction: column; gap: var(--gap); padding: 22px 24px 0; outline: none; min-height: calc(100vh - var(--appbar-h)); }

/* ===== 로고 ===== */
/* 카페24 숑숑 (상업적 사용 가능, 폰트 파일 판매만 금지) */
/* 로고·제목 글꼴: Cafe24 숑숑에서 쓰는 글자만 남긴 파일 (713KB → 25KB, scripts/subset-font.js · 라이선스 fonts/OFL.txt) */
@font-face { font-family: 'MoaPoint'; src: url('../fonts/moa-point.woff2') format('woff2'); font-display: swap; }
.brand-link { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; cursor: pointer; text-align: left; }
.logo-mark { width: 36px; height: 36px; flex: none; overflow: visible; }
.logo-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.logo-word { font-family: var(--font-point); font-size: 27px; line-height: 1.05; color: var(--logo-accent); letter-spacing: -0.01em; }
.logo-word b { font-weight: 400; color: var(--text); }
.logo-sub { font-size: 11.5px; color: var(--text-3); }
.brand-link.sm .logo-mark { width: 28px; height: 28px; }
.brand-link.sm .logo-word { font-size: 22px; }

/* 노란 블록이 왼쪽에서 통통통 튀며 굴러와 맨 위에 안착 → 아래 블록이 살짝 눌리고 → 웃는 얼굴이 나타난다 */
.lm-drop, .lm-face, .lm-base { transform-box: fill-box; transform-origin: center; }
.lm-base { transform-origin: center bottom; }
.logo-mark.is-playing .lm-drop { animation: lm-roll 1.7s both; }
.logo-mark.is-playing .lm-base { animation: lm-squash 1.7s both; }
.logo-mark.is-playing .lm-face { animation: lm-face 1.7s both; }
@keyframes lm-roll {
  0%   { transform: translate(-26px, -2px) rotate(-360deg); opacity: 0; animation-timing-function: ease-out; }
  8%   { opacity: 1; }
  20%  { transform: translate(-21px, -12px) rotate(-300deg); animation-timing-function: ease-in; }
  32%  { transform: translate(-16px, 0) rotate(-240deg); animation-timing-function: ease-out; }
  44%  { transform: translate(-11px, -9px) rotate(-170deg); animation-timing-function: ease-in; }
  56%  { transform: translate(-6px, 0) rotate(-100deg); animation-timing-function: ease-out; }
  66%  { transform: translate(-3px, -5px) rotate(-45deg); animation-timing-function: ease-in; }
  76%, 100% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
}
@keyframes lm-squash {
  0%, 74% { transform: none; }
  80% { transform: scale(1.04, .9); }
  88%, 100% { transform: none; }
}
@keyframes lm-face {
  0%, 80% { opacity: 0; transform: scale(.3); }
  90% { opacity: 1; transform: scale(1.2); }
  100% { opacity: 1; transform: scale(1); }
}

/* ===== 사이드바 ===== */
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 22px;
  padding: 24px 16px 20px;
  background: #fff;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 6px 0; margin-bottom: 18px; }
.icon-btn.sidebar-close { display: none; margin-left: auto; }

/* 오른쪽 끝선: + 버튼 · 지역 숫자 · "준비 중" · 바로 보기 숫자를 모두 안쪽 12px 선에 맞춘다 */
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; padding: 0 12px; }
.side-label { padding: 0 12px 8px; font-size: 12px; font-weight: 500; color: var(--text-3); }
.side-head .side-label { padding: 0; }
.side-plus {
  display: inline-grid; place-items: center; width: 28px; height: 28px;
  border: 0; border-radius: 8px; background: var(--primary-soft); color: var(--primary-ink); cursor: pointer;
}
.side-plus svg.ic { width: 15px; height: 15px; stroke-width: 2; }
.side-plus:hover { background: var(--primary-line); }

.side-list { display: flex; flex-direction: column; gap: 2px; }
.side-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 42px; padding: 0 12px;
  border: 0; border-radius: 12px; background: none; cursor: pointer;
  color: var(--text-2); font-size: 13.5px; font-weight: 500; text-align: left;
}
.side-item svg.ic { width: 17px; height: 17px; color: var(--text-4); }
.side-item:hover { background: var(--hover); color: var(--text); }
.side-item.is-active { background: var(--primary-soft); color: var(--primary-ink); font-weight: 600; }
.side-item.is-active svg.ic { color: var(--primary-ink); }
.side-text { flex: 1; min-width: 0; }
.side-num { font-size: 12px; font-weight: 500; color: var(--text-4); font-variant-numeric: tabular-nums; }
.side-item.is-active .side-num { color: var(--primary-ink); }

/* 지역 */
.region-item { position: relative; }
.region-btn { min-height: 46px; font-size: 15px; }
.region-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: #c9cfda; }
.region-btn.is-current .region-dot { background: var(--primary); }
.region-btn.is-active { font-weight: 700; }
.region-count { min-width: 26px; padding: 0 7px; border-radius: 7px; background: #fff; color: var(--primary-ink); font-size: 12px; font-weight: 600; line-height: 22px; text-align: center; box-shadow: 0 1px 2px rgba(27, 36, 55, 0.06); }
.region-btn:not(.is-active) .region-count { background: var(--gray-soft); color: var(--text-3); box-shadow: none; }
.region-soon { font-size: 12px; color: var(--text-4); white-space: nowrap; }
/* 지우기(×)는 숫자 왼쪽에 — 숫자는 항상 오른쪽 끝선에 그대로 */
.region-del {
  position: absolute; top: 50%; right: 62px; transform: translateY(-50%);
  display: inline-grid; place-items: center; width: 26px; height: 26px;
  border: 0; border-radius: 8px; background: none; color: var(--text-3); cursor: pointer; opacity: 0;
}
.region-del svg.ic { width: 14px; height: 14px; }
.region-item:hover .region-del, .region-del:focus-visible { opacity: 1; }
.region-del:hover { background: #ffe9ee; color: var(--danger); }
@media (hover: none) {
  .region-del { opacity: 1; }
}

.add-region {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; margin-top: 2px; padding: 0 12px 0 8px;
  border: 0; border-radius: 12px; background: none; cursor: pointer;
  color: var(--text-3); font-size: 13.5px; font-weight: 500; text-align: left;
}
.add-box { display: inline-grid; place-items: center; width: 26px; height: 26px; border: 1.5px dashed #c5ccd8; border-radius: 8px; color: var(--text-4); }
.add-box svg.ic { width: 14px; height: 14px; }
.add-region:hover { background: var(--hover); color: var(--text); }
.add-region:hover .add-box { border-color: var(--primary); color: var(--primary-ink); }

.side-divider { width: calc(100% - 16px); margin: 0 8px; border: 0; border-top: 1px solid var(--line); }

.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(27, 36, 55, 0.36); }
.scrim-top { z-index: 80; }

.appbar { display: none; }

/* ===== 공통 조각 ===== */
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: 12px; background: none; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.link-btn { padding: 0; border: 0; background: none; color: var(--text-2); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-btn:hover { color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 42px; padding: 0 16px; border: 1px solid transparent; border-radius: 12px;
  font-size: 14.5px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn svg.ic { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: var(--on-primary); text-shadow: var(--on-primary-shadow); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { border-color: var(--line-strong); background: #fff; color: var(--text-2); }
.btn-ghost:hover { border-color: var(--text-3); color: var(--text); }
.btn-ghost[aria-pressed="true"] { border-color: var(--primary-line); background: var(--primary-soft); color: var(--primary-ink); }
.btn-ghost[aria-pressed="true"] svg.ic { fill: currentColor; }
.btn.is-disabled { background: var(--gray-soft); color: var(--text-3); cursor: default; }

.kid-pill {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 30px 0 12px;
  border-radius: 12px; background: #fff; box-shadow: var(--shadow); color: var(--text-2); font-size: 13.5px; white-space: nowrap;
}
.kid-pill > svg.ic:first-child { width: 17px; height: 17px; color: var(--text-4); }
.kid-pill > svg.ic:last-child { position: absolute; right: 10px; width: 14px; height: 14px; color: var(--text-3); pointer-events: none; }
.kid-label { font-weight: 500; color: var(--text-3); }
.kid-pill select { appearance: none; border: 0; background: none; font: inherit; font-weight: 600; color: var(--text); cursor: pointer; }
.kid-pill select:focus { outline: none; }
.kid-pill:focus-within { box-shadow: 0 0 0 2px var(--primary), var(--shadow); }
.kid-pill.is-set { background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary-line), var(--shadow); }
.kid-pill.is-set > svg.ic:first-child, .kid-pill.is-set select { color: var(--primary-ink); }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 12px; background: #fff; box-shadow: var(--shadow); font-size: 13.5px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.pill svg.ic { width: 16px; height: 16px; color: var(--primary-ink); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; cursor: pointer;
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
}
.chip:hover { border-color: var(--text-3); color: var(--text); }
.chip[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); font-weight: 600; }

.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 7px; background: var(--gray-soft); color: var(--text-2); font-size: 12.5px; font-weight: 500; }

.badge { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 7px; font-size: 12.5px; font-weight: 600; }
.s-open    { background: var(--mint-soft);   color: var(--mint-ink); }
.s-closing { background: var(--coral-soft);  color: var(--coral-ink); }
.s-soon    { background: var(--sky-soft);    color: var(--sky-ink); }
.s-wait    { background: var(--yellow-soft); color: var(--yellow-ink); }
.s-walkin  { background: var(--purple-soft); color: var(--purple-ink); }
.s-closed, .s-ended { background: var(--gray-soft); color: var(--gray-ink); }
.s-unknown { background: var(--gray-soft); color: var(--text-2); }

.type-tag { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--tink, var(--text-2)); white-space: nowrap; }
.type-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tc, var(--text-3)); }

.select { position: relative; display: inline-flex; align-items: center; }
.select select {
  appearance: none; height: 34px; padding: 0 30px 0 12px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 500; color: var(--text);
}
.select select.is-set { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); font-weight: 600; }
.select svg.ic { position: absolute; right: 9px; width: 14px; height: 14px; color: var(--text-3); pointer-events: none; }

.search {
  display: flex; align-items: center; gap: 8px; width: 300px; height: 40px; padding: 0 14px;
  border-radius: 12px; background: #fff; box-shadow: var(--shadow); color: var(--text-3);
}
.search:focus-within { box-shadow: 0 0 0 2px var(--primary), var(--shadow); }
.search input { flex: 1; width: 100%; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font: inherit; font-size: 14.5px; color: var(--text); }
.search input::placeholder { color: #8f97a8; }

/* ===== 페이지 머리 ===== */
/* 제목 칸이 380px보다 좁아지면 도구(우리 아이·검색·수집일)를 제목 아래 줄로 내린다 */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-title { flex: 1 1 380px; min-width: 0; }
.hero-eyebrow { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 13.5px; font-weight: 500; color: var(--text-2); }
.sparkle { width: 18px; height: 18px; flex: none; }
.hero-title { font-family: var(--font-point); font-size: 34px; font-weight: 400; line-height: 1.2; letter-spacing: -0.01em; color: var(--text); }
.hero-title .hl { color: var(--hl-color); background: var(--hl-bg, none); }
.page-sub { margin-top: 6px; font-size: 14px; color: var(--text-3); }
.page-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; flex: 0 1 auto; }

/* ===== 카드 ===== */
.card {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  padding: 18px 20px;
  border: 1px solid var(--card-line); border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.card-note { font-size: 13px; font-weight: 500; color: var(--text-3); white-space: nowrap; }

/* ===== 요약 카드 ===== */
.view-dashboard { display: flex; flex-direction: column; gap: var(--gap); } /* 요약 카드 줄과 아래 카드 사이 */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.kpi {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px;
  min-width: 0; padding: 14px 16px 13px;
  border: 1px solid var(--card-line); border-radius: var(--radius);
  background: #fff; box-shadow: var(--shadow); cursor: pointer; text-align: left; white-space: normal;
  transition: box-shadow .15s, border-color .15s;
}
.kpi:hover { border-color: var(--line-strong); }
.kpi[aria-pressed="true"] { border-color: var(--kc); background: var(--ksoft); box-shadow: 0 0 0 1px var(--kc), var(--shadow); }
.kpi-flag { position: absolute; top: 12px; right: 12px; padding: 0 8px; border-radius: 999px; background: #fff; color: var(--kink); font-size: 11.5px; font-weight: 600; line-height: 20px; box-shadow: 0 0 0 1px var(--kc); }
.kpi-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kpi-top { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; color: var(--text-2); }
.kpi-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 10px; background: var(--ksoft); color: var(--kink); }
.kpi-icon svg.ic { width: 16px; height: 16px; }
.kpi-value { margin-top: 6px; font-size: 28px; font-weight: 700; line-height: 1.1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kpi-value small { margin-left: 2px; font-size: 15px; font-weight: 500; color: var(--text-3); }
.kpi-viz { display: flex; align-items: flex-end; gap: 6px; min-width: 0; }
.kpi-sub { font-size: 12.5px; color: var(--text-3); }
.k-mint   { --kc: var(--mint);   --ksoft: var(--mint-soft);   --kink: var(--mint-ink); }
.k-coral  { --kc: var(--coral);  --ksoft: var(--coral-soft);  --kink: var(--coral-ink); }
.k-purple { --kc: var(--purple); --ksoft: var(--purple-soft); --kink: var(--purple-ink); }
.k-sky    { --kc: var(--sky);    --ksoft: var(--sky-soft);    --kink: var(--sky-ink); }

/* 요약 카드 안의 작은 그래프 */
.ring { display: block; width: 54px; height: 54px; flex: none; }
.ring circle { fill: none; stroke-width: 6; }
.ring .ring-bg { stroke: var(--gray-soft); }
.ring .ring-fg { stroke: var(--kc); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; }
.ring .ring-seg { stroke: var(--tc); transform: rotate(-90deg); transform-origin: 50% 50%; }
.ring text { font-size: 10px; font-weight: 700; fill: var(--kink); text-anchor: middle; dominant-baseline: central; }
.minicols { display: flex; align-items: flex-end; gap: 6px; height: 40px; }
.minicol { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; width: 26px; height: 100%; }
.minicol b { display: block; width: 100%; min-height: 3px; border-radius: 4px 4px 2px 2px; background: var(--kc); }
.minicol.is-zero b { background: var(--gray-soft); }
.minicol span { font-size: 11px; font-weight: 500; color: var(--text-3); line-height: 1; }

/* ===== 보드 ===== */
/* 요약 카드와 같은 4칸 격자: 지도 1칸 · 목록 2칸 · 오른쪽 1칸 → 열 시작선이 위아래로 맞음 */
.board { display: grid; gap: var(--gap); grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-areas: "l m m r"; align-items: start; }
.col { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; min-height: 0; }
.col-l { grid-area: l; }
.col-m { grid-area: m; }
.col-r { grid-area: r; }

/* 지도 */
.map-wrap { position: relative; height: 300px; container-type: size; }
.map-stage { position: absolute; left: 50%; top: 50%; transform: translate(calc(-50% + var(--shift, 0px)), -50%); width: min(100cqw, calc(100cqh * var(--ratio, 1))); aspect-ratio: var(--ratio, 1); }
.map-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; shape-rendering: geometricPrecision; }
/* 단색 면 + 동 경계는 얇은 흰 선 */
.map-dong { stroke: #fff; stroke-width: 1; stroke-opacity: .85; stroke-linejoin: round; transition: fill .15s, opacity .15s; }
.map-area { cursor: pointer; }
.map-area:hover .map-dong { filter: brightness(0.97); }
.map-area.is-dim .map-dong { opacity: 0.45; }
.map-lead { stroke: var(--text); stroke-width: 1.5; fill: none; }
.map-label {
  position: absolute; transform: translateY(-50%);
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  border: 0; border-radius: 10px; background: var(--text); color: #fff; cursor: pointer;
  font-size: 13px; font-weight: 500; box-shadow: 0 6px 14px rgba(27, 36, 55, 0.18);
}
/* 가로로 넓은 구: 지도는 카드 폭에 맞게, 동별 숫자 칩은 지도 아래 */
.map-flat { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.map-flat svg { display: block; flex: 0 1 auto; width: 100%; min-height: 0; max-height: calc(100% - 84px); overflow: visible; }
.map-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.map-chips .map-label { position: static; transform: none; }
.map-label b { font-size: 14px; font-weight: 700; color: var(--label-count); font-variant-numeric: tabular-nums; }
.map-label.is-zero { background: #eef1f6; color: var(--text-3); box-shadow: none; }
.map-label.is-zero b { color: var(--text-3); }
.map-label[aria-pressed="true"], .map-label.is-zero[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); text-shadow: var(--on-primary-shadow); }
.map-label[aria-pressed="true"] b, .map-label.is-zero[aria-pressed="true"] b { color: var(--on-primary); }
.map-foot { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; font-size: 12.5px; color: var(--text-3); }
.map-legend { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.map-legend i { width: 18px; height: 8px; border-radius: 2px; }
.map-legend span:first-child { margin-right: 2px; }
.map-legend span:last-child { margin-left: 2px; }
.map-empty { position: absolute; inset: 0; display: grid; place-items: center; }
.map-empty-badge { padding: 6px 12px; border-radius: 999px; background: #fff; box-shadow: var(--shadow); font-size: 13px; font-weight: 500; color: var(--text-2); }
.gu-shape { fill: var(--gray-soft); stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }

/* 막대 목록 */
.bars { display: flex; flex-direction: column; gap: 4px; }
.stat-bar { display: grid; grid-template-columns: 92px minmax(0, 1fr) 34px; align-items: center; gap: 10px; padding: 6px 4px; }
.bar-label { font-size: 13.5px; color: var(--text-2); white-space: nowrap; }
.bar-track { height: 10px; border-radius: 5px; background: var(--gray-soft); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 5px; background: var(--tc, var(--mint)); }
.bar-num { font-size: 13.5px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* 날짜 칸 */
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--gray-soft); }
.seg button { height: 28px; padding: 0 10px; border: 0; border-radius: 8px; background: none; cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--text-3); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(27, 36, 55, 0.12); }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 7px 0 6px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--heat, var(--gray-soft)); color: var(--text);
}
.day:disabled { cursor: default; }
.day .dw { font-size: 11px; font-weight: 500; color: var(--text-3); }
.day .dd { font-size: 14px; font-weight: 700; line-height: 1.2; }
.day .dc { font-size: 11px; font-weight: 600; min-height: 15px; }
.day.has-count { background: var(--heat); color: var(--on-primary); text-shadow: var(--on-primary-shadow); }
.day.has-count .dw, .day.has-count .dc { color: var(--on-primary); }
.day.is-empty { color: var(--text-3); }
.day.is-empty .dc { color: var(--text-4); font-weight: 500; }
.day.is-today { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--text); }
.day[aria-pressed="true"] { background: var(--text); color: #fff; }
.day[aria-pressed="true"] .dw, .day[aria-pressed="true"] .dc { color: #fff; }
.day.is-empty.is-sun .dw { color: var(--coral-ink); }
.day.is-empty.is-sat .dw { color: var(--sky-ink); }
.days-cap { margin-top: 10px; font-size: 12.5px; color: var(--text-3); }

/* 이번 주말 */
.wk-day { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 38px; border-radius: 9px; background: var(--purple-soft); color: var(--purple-ink); font-size: 13px; font-weight: 700; line-height: 1.15; }
.wk-day small { font-size: 10.5px; font-weight: 500; }
.wk-day.is-sun { background: var(--coral-soft); color: var(--coral-ink); }
.mini-more { width: 100%; height: 36px; margin-top: 4px; border: 0; border-radius: 10px; background: var(--hover); color: var(--text-2); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.mini-more:hover { background: var(--gray-soft); color: var(--text); }

/* 곧 마감 */
.mini-list { display: flex; flex-direction: column; gap: 2px; }
.mini-item {
  display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 10px;
  width: 100%; padding: 7px 8px; border: 0; border-radius: 10px; background: none; cursor: pointer; text-align: left;
}
.mini-item:hover { background: var(--hover); }
.mini-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.mini-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--text-3); }
.mini-empty { padding: 8px; font-size: 13.5px; color: var(--text-3); }

/* ===== 프로그램 목록 ===== */
.card-list { container: list / inline-size; }
.tabs-wrap { margin: 0 -20px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 18px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
/* 탭이 넘치면 마우스로 끌어서(스와이프) 넘긴다 */
.tabs.is-draggable { cursor: grab; }
.tabs.is-dragging { cursor: grabbing; user-select: none; }
.tabs.is-dragging .tab { cursor: grabbing; }
.tabs::-webkit-scrollbar { display: none; }
.tabs-wrap.fade-right .tabs { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
.tabs-wrap.fade-left .tabs { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent); }
.tabs-wrap.fade-left.fade-right .tabs { -webkit-mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 42px; padding: 0 2px; border: 0; background: none; cursor: pointer;
  color: var(--text-3); font-size: 14.5px; font-weight: 500;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); font-weight: 700; }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; border-radius: 3px; background: var(--primary); }
.tab-count { min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--gray-soft); color: var(--text-3); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; }
.tab[aria-selected="true"] .tab-count { background: var(--primary); color: var(--on-primary); text-shadow: var(--on-primary-shadow); }

.list-title-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; }
.scope-chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 6px 0 10px; border: 0; border-radius: 8px; background: var(--ksoft); color: var(--kink); font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: inset 0 0 0 1px var(--kc); }
.scope-chip svg.ic { width: 14px; height: 14px; }
.card-list.is-pulse { animation: list-pulse .9s ease-out; }
@keyframes list-pulse { 0% { box-shadow: 0 0 0 0 var(--primary-line), var(--shadow); } 100% { box-shadow: 0 0 0 12px transparent, var(--shadow); } }

.list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 0 10px; }
.list-tools .select-sort { margin-left: auto; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 10px; }
.af { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 6px 0 10px; border: 0; border-radius: 8px; background: var(--purple-soft); color: var(--purple-ink); cursor: pointer; font-size: 13px; font-weight: 500; }
.af svg.ic { width: 14px; height: 14px; }
.af-reset { background: none; color: var(--text-3); padding: 0 8px; }
.af-reset:hover { color: var(--text); }

.list-scroll { margin: 0 -12px; padding: 0 12px; }
.plist { display: flex; flex-direction: column; }
.prog { position: relative; border-top: 1px solid var(--line); }
.prog:first-child { border-top: 0; }
.prog-main {
  display: grid; grid-template-columns: 104px minmax(0, 1fr) 128px; column-gap: 14px; align-items: start;
  width: 100%; padding: 14px 48px 14px 8px; border: 0; border-radius: 12px; background: none; cursor: pointer; text-align: left;
}
.prog-main { white-space: normal; } /* 버튼 기본 한 줄 규칙을 풀어 대상·장소 글이 칸 안에서 줄바꿈되게 */
.prog-main:hover { background: var(--hover); }
.prog-status { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.prog-due { padding-left: 8px; font-size: 12.5px; color: var(--text-3); }
.prog-due.is-urgent { color: var(--coral-ink); font-weight: 600; }
.prog-kicker { display: block; overflow: hidden; margin-bottom: 2px; font-size: 12.5px; color: var(--text-3); white-space: nowrap; text-overflow: ellipsis; }
.prog-title { display: block; font-size: 15.5px; font-weight: 600; line-height: 1.45; color: var(--text); text-wrap: balance; }
.unit { display: inline-block; text-wrap: balance; }
.prog-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-top: 4px; font-size: 13px; color: var(--text-3); }
.prog-meta > span + span::before { content: "·"; margin-right: 8px; color: var(--line-strong); }
.prog-when { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text-2); text-align: right; }
.prog-when b { font-size: 13.5px; font-weight: 600; color: var(--text); }
.fee-free { color: var(--mint-ink); font-weight: 600; }
.prog.is-closed .prog-title { color: var(--text-3); }
.fav-btn {
  position: absolute; top: 10px; right: 4px;
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border: 0; border-radius: 50%; background: none; color: #a3aab8; cursor: pointer;
}
.fav-btn:hover { background: var(--primary-soft); color: var(--primary-ink); }
.fav-btn svg.ic { width: 19px; height: 19px; }
.fav-btn[aria-pressed="true"] { color: var(--primary); }
.fav-btn[aria-pressed="true"] svg.ic { fill: currentColor; }
.more-btn { margin: 8px auto 0; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 48px 20px; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 6px; border-radius: 16px; background: var(--primary-soft); color: var(--primary-ink); }
.empty-icon svg.ic { width: 24px; height: 24px; }
.empty-title { font-size: 16.5px; font-weight: 700; }
.empty-desc { font-size: 14px; color: var(--text-3); }
.empty .btn { margin-top: 10px; }

/* 목록 카드가 좁을 때: 세로로 쌓기 */
@container list (max-width: 560px) {
  .prog-main { grid-template-columns: minmax(0, 1fr); row-gap: 8px; padding-right: 44px; }
  .prog-status { flex-direction: row; align-items: center; gap: 8px; }
  .prog-due { padding-left: 0; }
  .prog-when { flex-direction: row; flex-wrap: wrap; gap: 2px 10px; text-align: left; }
  .prog-when > span + span::before { content: "·"; margin-right: 10px; color: var(--line-strong); }
  .list-tools .select-sort { margin-left: 0; }
}

/* ===== 이번 주 일정 ===== */
.week-grid { display: grid; grid-template-columns: repeat(var(--days, 7), minmax(0, 1fr)); gap: 12px; align-items: start; }
.week-day { padding: 14px 12px; min-height: 160px; }
.week-list, .week-item, .week-title, .week-place { min-width: 0; max-width: 100%; }
.week-item { white-space: normal; } /* 버튼 기본 한 줄 규칙을 풀어 제목이 칸 안에서 줄바꿈되게 */
.week-head { display: flex; align-items: baseline; gap: 6px; padding: 0 4px 10px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.week-head b { font-size: 20px; font-weight: 700; }
.week-head span { font-size: 13.5px; color: var(--text-3); }
.week-head .today { margin-left: auto; padding: 0 7px; border-radius: 6px; background: var(--primary-soft); color: var(--primary-ink); font-size: 12px; font-weight: 600; line-height: 22px; }
.week-day.is-sun .week-head span:not(.today) { color: var(--coral-ink); }
.week-day.is-sat .week-head span:not(.today) { color: var(--sky-ink); }
.week-list { display: flex; flex-direction: column; gap: 6px; }
.week-item {
  display: flex; flex-direction: column; gap: 3px; width: 100%; padding: 9px 10px;
  border: 0; border-left: 3px solid var(--tc); border-radius: 8px; background: var(--hover); cursor: pointer; text-align: left;
}
.week-item:hover { background: var(--tsoft); }
.week-meta { display: flex; align-items: flex-start; gap: 6px; min-width: 0; line-height: 1.45; }
.week-time { flex: none; font-size: 12px; font-weight: 600; color: var(--tink); font-variant-numeric: tabular-nums; }
.week-place { flex: 1 1 auto; min-width: 0; font-size: 12px; color: var(--text-3); } /* 긴 장소 이름은 시간 옆 칸 안에서 줄바꿈 */
.week-time + .week-place::before { content: "·"; margin-right: 6px; color: var(--line-strong); }
.week-saved { flex: none; margin-left: auto; color: var(--primary-hover); }
.week-saved svg.ic, .week-legend-mark svg.ic { width: 14px; height: 14px; fill: currentColor; }
.week-title { font-size: 13.5px; font-weight: 600; line-height: 1.4; text-wrap: balance; }
.week-item.is-saved { box-shadow: inset 0 0 0 1.5px var(--primary); background: var(--primary-soft); }
.week-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 12px; }
.week-legend { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-3); }
.week-legend-mark { display: inline-flex; color: var(--primary-hover); }
.chip:disabled { opacity: .5; cursor: default; }
.week-none { padding: 6px 4px; font-size: 13px; color: var(--text-4); }

/* ===== 무료 프로그램 ===== */

/* ===== 무료 프로그램 ===== */
.free-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.free-bar .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-n { margin-left: 2px; font-size: 12px; font-weight: 600; color: var(--text-4); }
.chip[aria-pressed="true"] .chip-n { color: var(--primary-ink); }
.free-group + .free-group { margin-top: 26px; }
.free-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 18px 0 12px; }
.free-head h2 { font-size: 17px; font-weight: 700; white-space: nowrap; }
.fold-btn {
  display: inline-flex; align-items: center; gap: 2px; padding: 4px 0; border: 0; background: none; cursor: pointer;
  color: var(--text-2); font-size: 13.5px; font-weight: 600;
  text-decoration: underline; text-decoration-color: var(--text-3); text-underline-offset: 4px; text-decoration-thickness: 1px;
}
.fold-btn svg.ic { width: 15px; height: 15px; }
.fold-btn:hover { color: var(--text); text-decoration-color: currentColor; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.pcard { position: relative; display: flex; min-width: 0; border: 1px solid var(--card-line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.pcard-main {
  display: flex; flex-direction: column; gap: 6px; width: 100%; min-width: 0; padding: 14px 44px 14px 16px;
  border: 0; border-radius: 16px; background: none; cursor: pointer; text-align: left; white-space: normal;
}
.pcard-main:hover { background: var(--hover); }
.pcard-top { display: flex; align-items: center; gap: 8px; }
.pcard-top .prog-due { padding-left: 0; }
.pcard-title { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 15px; font-weight: 600; line-height: 1.45; text-wrap: balance; }
.pcard-meta { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 12.5px; color: var(--text-3); }
.pcard-meta > span + span::before { content: "·"; margin-right: 8px; color: var(--line-strong); }
.pcard-foot { display: flex; flex-direction: column; gap: 1px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-3); }
.pcard-foot b { font-weight: 600; color: var(--text); }
.pcard .fav-btn { top: 8px; right: 6px; }
.pcard.is-closed .pcard-title { color: var(--text-3); }

/* ===== 저장 · 데이터 출처 ===== */
.source-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.card-full { padding: 8px 20px; }
.source-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.source-card { gap: 10px; }
.source-card h2 { font-size: 18px; font-weight: 700; }
.source-meta { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 13.5px; }
.source-meta dt { color: var(--text-3); }
.source-meta dd { margin: 0; overflow-wrap: anywhere; }
.source-meta a { color: var(--sky-ink); text-underline-offset: 2px; }
.fac-list { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; }
.fac-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; color: var(--text-2); }
.fac-list .tag { height: 22px; font-size: 12px; }
.method-public { color: var(--primary-ink); font-weight: 600; }

/* ===== 푸터 ===== */
.site-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px;
  margin-top: auto; padding: 14px 2px 18px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--text-3);
}

/* ===== 상세 패널 ===== */
.drawer {
  position: fixed; top: 12px; right: 12px; bottom: 12px; z-index: 90;
  display: flex; flex-direction: column; width: min(460px, calc(100% - 24px));
  border-radius: 22px; background: #fff; box-shadow: 0 24px 60px rgba(27, 36, 55, 0.22);
  animation: drawer-in .2s ease-out;
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 10px 24px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 4px 24px 24px; }
.drawer-foot { display: flex; gap: 8px; padding: 14px 24px 20px; border-top: 1px solid var(--line); }
.drawer-foot .btn-primary, .drawer-foot .is-disabled { flex: 1; }
.drawer-foot .btn-ghost { flex: none; padding: 0 14px; }
.share-wrap { position: relative; display: flex; }
.share-menu {
  position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 5; width: 220px; padding: 6px;
  border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 12px 32px rgba(27, 36, 55, 0.18);
}
.share-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; padding: 0 10px;
  border: 0; border-radius: 9px; background: none; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.share-item svg.ic { width: 17px; height: 17px; color: var(--text-2); }
.share-item:hover, .share-item:focus-visible { background: var(--hover); }
.share-note { margin: 4px 0 2px; padding: 8px 10px 4px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); }

/* 이미지 칸: 포스터가 있으면 윗부분을 보여 주고, 없으면 같은 크기의 안내 칸 */
.d-media { position: relative; display: block; height: 200px; margin: 0 0 18px; overflow: hidden; border-radius: 16px; background: var(--tsoft, var(--gray-soft)); }
.d-media img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.d-media a { display: block; height: 100%; }
.d-media-zoom { position: absolute; right: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border-radius: 8px; background: rgba(31, 41, 55, 0.72); color: #fff; font-size: 12px; font-weight: 500; }
.d-media-zoom svg.ic { width: 13px; height: 13px; }

.d-status { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13.5px; color: var(--text-2); }
.d-status .is-urgent { color: var(--coral-ink); font-weight: 600; }
.d-kicker { margin-bottom: 4px; font-size: 13px; color: var(--text-3); }
.drawer-body h2 { font-size: 21px; font-weight: 700; line-height: 1.4; letter-spacing: -0.02em; }
.d-place { margin-top: 4px; font-size: 14.5px; color: var(--text-3); }
.d-info { display: grid; grid-template-columns: 92px minmax(0, 1fr); margin: 20px 0 0; border-top: 1px solid var(--line); }
.d-info dt, .d-info dd { padding: 12px 0; border-bottom: 1px solid var(--line); }
.d-info dt { font-size: 13.5px; font-weight: 500; color: var(--text-3); }
.d-info dd { margin: 0; font-size: 14.5px; }
.d-info .sub { display: block; margin-top: 2px; font-size: 13px; color: var(--text-3); }
.d-route { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.d-route a {
  display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 9px; background: #fff;
  color: var(--text-2); font-size: 12.5px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.d-route a svg.ic { width: 14px; height: 14px; }
.d-route a:hover { border-color: var(--text-3); color: var(--text); }
.meter { height: 6px; margin-top: 8px; border-radius: 3px; background: var(--gray-soft); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 3px; background: var(--primary); }
.d-desc { margin-top: 20px; }
.d-desc h3 { margin-bottom: 6px; font-size: 14.5px; font-weight: 700; }
.d-desc p { font-size: 15px; line-height: 1.7; color: var(--text-2); }
.d-note { display: flex; gap: 8px; margin-top: 20px; padding: 12px 14px; border-radius: 12px; background: var(--bg); font-size: 13px; color: var(--text-2); }
/* 비슷한 프로그램 */
.d-sim { margin-top: 24px; padding-top: 20px; border-top: 1.5px dashed var(--line-strong); }
.d-sim h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.d-sim-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-ink); }
.d-sim-icon svg.ic { width: 16px; height: 16px; }
.d-sim h3 small { margin-left: -2px; font-size: 12.5px; font-weight: 500; color: var(--text-3); }
.d-sim ul { margin: 8px 0 0; padding: 0; list-style: none; }
.sim-item {
  display: block; width: 100%; padding: 12px 0; border: 0; border-top: 1px solid var(--line);
  background: none; text-align: left; white-space: normal; color: inherit; font: inherit; cursor: pointer;
}
.d-sim li:last-child .sim-item { border-bottom: 1px solid var(--line); }
.sim-item:hover .sim-title { text-decoration: underline; text-underline-offset: 3px; }
.sim-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.sim-title { font-size: 14.5px; font-weight: 600; line-height: 1.45; }
.sim-top .badge { flex: none; height: 22px; font-size: 12px; }
.sim-meta { display: block; margin-top: 2px; font-size: 13px; color: var(--text-3); }
.sim-why { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.sim-why span { padding: 0 7px; border-radius: 6px; background: var(--gray-soft); color: var(--gray-ink); font-size: 12px; font-weight: 600; line-height: 21px; white-space: nowrap; }
.sim-why .w-age { background: var(--primary-soft); color: var(--primary-ink); }
.d-note svg.ic { width: 16px; height: 16px; margin-top: 2px; color: var(--text-3); }

/* ===== 지역 추가 ===== */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(27, 36, 55, 0.4); }
.modal-card { width: min(760px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 22px 24px 24px; border-radius: 22px; background: #fff; box-shadow: 0 24px 60px rgba(27, 36, 55, 0.25); animation: drawer-in .2s ease-out; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h2 { font-family: var(--font-point); font-size: 24px; font-weight: 400; }
.modal-desc { margin-top: 4px; font-size: 14px; color: var(--text-3); }
.picker { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; margin-top: 18px; align-items: start; }
.picker-map svg { display: block; width: 100%; height: auto; }
.pick-gu { fill: #eef1f6; stroke: #fff; stroke-width: 1.2; cursor: pointer; transition: fill .12s; }
.pick-gu:hover, .pick-gu:focus-visible { fill: var(--primary-line); outline: none; }
.pick-gu.is-added { fill: var(--primary); }
.pick-name { font-size: 7.5px; font-weight: 500; fill: var(--text-2); pointer-events: none; text-anchor: middle; dominant-baseline: middle; }
.pick-gu.is-added + .pick-name { fill: var(--on-primary); }
.picker-list { display: flex; flex-wrap: wrap; gap: 6px; }
.gu-chip { height: 34px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--text-2); }
.gu-chip:hover { border-color: var(--primary); color: var(--text); }
.gu-chip:disabled { border-color: transparent; background: var(--primary-soft); color: var(--primary-ink); cursor: default; }
.gu-chip .chip-n { margin-left: 4px; }
.picker-legend { display: flex; flex-wrap: wrap; gap: 12px; width: 100%; margin-top: 8px; font-size: 12.5px; color: var(--text-3); }
.picker-legend span { display: inline-flex; align-items: center; gap: 6px; }
.picker-legend i { width: 10px; height: 10px; border-radius: 3px; }

/* ===== 인트로: 처음 열 때 로고가 굴러와 안착 (약 2초, 누르면 바로 넘어감) ===== */
.intro { display: none; }
html.intro-on body { overflow: hidden; }
html.intro-on .intro {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center; align-content: center; gap: 14px;
  background: #fff; cursor: pointer;
  transition: opacity .35s ease, visibility .35s;
}
.intro.is-out { opacity: 0; visibility: hidden; }
.intro-logo { display: flex; align-items: center; gap: 10px; }
.intro .logo-mark { width: 88px; height: 88px; }
.intro .logo-word { font-size: 60px; opacity: 0; animation: intro-fade .35s .2s forwards; }
.intro-sub { font-size: 15px; color: var(--text-3); opacity: 0; animation: intro-fade .35s .7s forwards; }
.intro .logo-mark.is-playing .lm-drop,
.intro .logo-mark.is-playing .lm-base,
.intro .logo-mark.is-playing .lm-face { animation-duration: 1.3s; }
.intro .logo-mark:not(.is-playing) .lm-drop { opacity: 0; }
.intro .logo-mark:not(.is-playing) .lm-face { opacity: 0; }
@keyframes intro-fade { to { opacity: 1; } }
@media (max-width: 599px) {
  .intro .logo-mark { width: 64px; height: 64px; }
  .intro .logo-word { font-size: 44px; }
}

/* ===== 알림 ===== */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 120; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px);
  padding: 10px 10px 10px 18px; border-radius: 14px; background: var(--text); color: #fff;
  font-size: 14px; font-weight: 500; box-shadow: 0 12px 30px rgba(27, 36, 55, 0.3);
}
.toast button { height: 32px; padding: 0 12px; border: 0; border-radius: 9px; background: rgba(255, 255, 255, 0.14); color: #c9c2ff; cursor: pointer; font-weight: 600; }

/* ===== 한 화면 대시보드 (넓고 충분히 높은 화면) ===== */
@media (min-height: 700px) {
  @container main (min-width: 1040px) {
    .content.is-dashboard { height: calc(100vh - var(--appbar-h)); }
    .view-dashboard { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--gap); }
    .board { flex: 1; min-height: 0; align-items: stretch; }
    .col-l, .col-r { min-height: 0; }
    .card-map { flex: 1; }
    .map-wrap { flex: 1; height: auto; min-height: 0; }
    .card-weekend { flex: 1; min-height: 0; overflow: hidden; }
    .card-days { flex: none; }
    .card-weekend .mini-list { overflow-y: auto; min-height: 0; }
    .card-list { min-height: 0; }
    .list-scroll { flex: 1; min-height: 0; overflow-y: auto; }
    .site-foot { margin-top: 0; padding: 10px 2px 14px; }
  }
}
/* 높이가 낮은 창: 요약 카드를 한 줄로 */
@media (min-height: 700px) and (max-height: 819px) {
  @container main (min-width: 1040px) {
    .content { padding-top: 16px; gap: 12px; }
    .view-dashboard, .kpis, .board, .col { gap: 12px; }
    .kpi { padding: 10px 14px; align-items: center; }
    .kpi-main { flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; }
    .kpi-value { margin-top: 0; font-size: 24px; }
    .kpi-sub, .kpi-viz, .kpi-flag { display: none; }
    .hero-title { font-size: 28px; }
    .hero-eyebrow { margin-bottom: 2px; font-size: 13px; }
    .page-sub { margin-top: 2px; }
    .card { padding: 14px 18px; }
    .card-head { margin-bottom: 8px; }
  }
}

/* ===== 중간 폭: 2단 ===== */
@container main (max-width: 1039px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "l m" "r m"; align-items: stretch; }
  .card-list { min-height: 0; }
  .list-scroll { flex: 1 1 0; min-height: 420px; overflow-y: auto; }
  .source-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ===== 좁은 폭: 1단 ===== */
@container main (max-width: 699px) {
  .page-head { flex-direction: column; align-items: stretch; }
  .page-title { flex: none; }
  .page-tools { flex-wrap: wrap; }
  .search { flex: 1; width: auto; }
  .kid-pill { flex: 1 1 100%; }
  .kid-pill select { flex: 1; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .board { grid-template-columns: minmax(0, 1fr); grid-template-areas: "l" "m" "r"; }
  .list-scroll { flex: none; min-height: 0; overflow: visible; }
  .source-grid, .week-grid, .source-stats { grid-template-columns: minmax(0, 1fr); }
  /* 무료 프로그램: 좁은 화면에서는 묶음마다 옆으로 넘겨 보기 (세로 스크롤을 줄인다) */
  .pgrid { display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 10px; scroll-snap-type: x mandatory; scroll-padding: 0 16px; scrollbar-width: none; }
  .pgrid::-webkit-scrollbar { display: none; }
  .pgrid > .pcard { flex: 0 0 82%; scroll-snap-align: start; }
  .pgrid > .empty { flex: 1 0 100%; }
  .free-head .card-note::after { content: ' · 옆으로 넘겨 보세요'; }
  .free-group.is-folded .card-note::after { content: none; }
  .week-day { min-height: 0; }
  .site-foot { flex-direction: column; align-items: flex-start; }
}
@container main (max-width: 440px) {
  .content { padding: 18px 16px 0; gap: 12px; }
  .hero-title { font-size: 28px; }
  .hero-eyebrow { font-size: 13px; }
  .card { padding: 16px; }
  .tabs-wrap { margin: 0 -16px; padding: 0 16px; }
  .kpi { grid-template-columns: minmax(0, 1fr); padding: 14px 14px 12px; }
  .kpi-top { font-size: 13px; gap: 7px; white-space: nowrap; }
  .kpi-icon { width: 24px; height: 24px; border-radius: 8px; }
  .kpi-icon svg.ic { width: 14px; height: 14px; }
  .kpi-value { font-size: 25px; }
  .kpi-sub { font-size: 12px; }
  .kpi-viz { display: none; }
  .pill { height: 36px; padding: 0 12px; font-size: 13px; }
  .search { height: 40px; }
}

/* ===== 사이드바 접기 (화면 폭 기준) ===== */
@media (max-width: 1199px) {
  :root { --appbar-h: 56px; }
  .app { grid-template-columns: minmax(0, 1fr); background: none; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 70; width: 280px; height: auto;
    transform: translateX(-100%); visibility: hidden;
    transition: transform .2s ease, visibility .2s;
    box-shadow: 16px 0 40px rgba(27, 36, 55, 0.12);
  }
  .sidebar.is-open { transform: none; visibility: visible; }
  .icon-btn.sidebar-close { display: inline-grid; }
  .appbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 6px;
    height: var(--appbar-h); padding: 0 16px 0 8px; background: rgba(244, 246, 251, 0.92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 599px) {
  .drawer { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; }
  .drawer-head { padding: 12px 10px 6px 20px; }
  .drawer-body { padding: 4px 20px 20px; }
  .drawer-foot { padding: 12px 20px 16px; }
  .d-media { height: 170px; }
  .picker { grid-template-columns: minmax(0, 1fr); }
  .modal { align-items: end; padding: 0; }
  .modal-card { border-radius: 22px 22px 0 0; max-height: 92vh; padding: 20px 16px 24px; }
}
/* 아주 좁은 화면: 저장·공유는 아이콘만 (글자는 화면 읽기용으로 남김) */
@media (max-width: 419px) {
  .drawer-foot .btn-ghost { width: 42px; padding: 0; }
  .drawer-foot .btn-ghost .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

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