/* 지원모아: 화면 스타일
 *
 *  - 흰 바탕에 그림자 없는 평평한 면. 글자 #333, 제목 #111, 보조 면 #eee, 선 #dbdbdb
 *  - 조건은 회색 알약, 고른 것은 검정(#111 + 흰 글자). 노랑 #fae100은 화면마다 한 곳(원문 보기)만
 *  - 누르기·가리키기 반응은 즉시. 그래프만 화면에 처음 들어올 때 한 번 움직인다(움직임 줄이기 설정이면 없음)
 *  - 뜻이 정해진 색만 조금: 빨강 = 오늘~D-3 마감, 주황 = 7일 안 마감, 파랑 = 정보(신규 등)
 *  - 그래프 색은 자료 종류에 붙는다: 파랑 = 모집 공고, 초록 = 상시 제도, 회색 = 비교 대상(app.js SERIES_*)
 *  - 보조 글자 #666(흰 바탕 대비 4.5:1 이상), 누르는 칸은 44px 이상
 * 흰 화면으로 고정한다(index.html의 data-theme="light", color-scheme).
 * 층(z-index): 탭 10 / 상세 겹침 50 / 조건 겹침 60 / 알림 90.
 */
:root {
  --canvas: #ffffff;
  --fg: #333333;
  --fg-strong: #111111;
  --muted: #666666;
  --surface: #eeeeee;
  --surface-hover: #f3f3f3;
  --pressed: #dfdfdf;
  --line: #dbdbdb;
  --divider: #eeeeee;
  --dark: #111111;
  --dark-hover: rgba(17, 17, 17, .75);
  --on-dark: #ffffff;
  --dark-edge: #ffffff;
  --yellow: #fae100;
  --on-yellow: #000000;
  --warn-text: #b3261e;
  --red: #d03b3b;          /* 마감 임박 (흰 글자 4.8:1) */
  --orange: #b5410e;       /* 7일 안 마감 글자 (연주황 면 위 5.1:1) */
  --orange-weak: #fff0e6;
  --orange-icon: #c2410c;
  --blue: #256abf;         /* 정보: 신규 배지·아이콘 (흰 글자 5.4:1) */
  color-scheme: light;
}

/* ---------- 바탕 ---------- */
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
html[data-size="large"] { font-size: 120%; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--fg);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Malgun Gothic", "맑은 고딕", sans-serif;
  font-size: .875rem;
  line-height: 1.78;
  letter-spacing: -0.2px;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
body.lock { overflow: hidden; }
a { color: inherit; text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--canvas); padding: 8px 16px; z-index: 90; }
.skip:focus { left: 8px; }
.tab-count, .result-count, .chip .n, .toggle .n, .pill, .badge, .row-date { font-variant-numeric: tabular-nums; }
.ph { font-size: 1.15em; line-height: 1; flex: none; }
.wrap { max-width: 1720px; margin: 0 auto; padding-left: 44px; padding-right: 44px; } /* 휴대폰(639px 이하)은 16px */
/* ---------- 머리·탭 ---------- */
.top { background: var(--canvas); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 20px; padding-bottom: 8px; }
.brand { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; min-width: 0; }
.brand h1 { margin: 0; font-size: 1.875rem; line-height: 1.33; font-weight: 700; color: var(--fg-strong); letter-spacing: -1px; }

/* 글자 크기 단추: 투명, 누르면 회색 */
.iconbtn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border: 0; border-radius: 18px;
  background: transparent; color: var(--fg); cursor: pointer; font-size: .875rem;
}
.iconbtn:hover, .iconbtn:active { background: var(--surface); }
.iconbtn[aria-pressed="true"] { background: var(--surface); font-weight: 700; }

/* 탭: 알약 모양, 고른 탭은 검정 */
.tabs { position: sticky; top: 0; z-index: 10; background: var(--canvas); border-bottom: 1px solid var(--divider); }
.tabs-inner { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-top: 8px; padding-bottom: 10px; }
.tabs [role="tab"] {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; height: 37px; padding: 0 16px; border: 0; border-radius: 999px;
  background: transparent; color: var(--fg-strong); cursor: pointer; font-size: 1.0625rem; font-weight: 400;
}
.tabs [role="tab"]:hover, .tabs [role="tab"]:active { background: var(--surface-hover); }
.tabs [role="tab"][aria-selected="true"] { background: var(--dark); color: var(--on-dark); font-weight: 700; box-shadow: inset 0 0 0 2px var(--dark-edge); }
.tab-count { font-size: .8125rem; font-weight: 400; opacity: .7; }

/* ---------- 배치 ---------- */
.layout { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); padding-top: 20px; padding-bottom: 40px; }
.filters, .detail { display: none; }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 20px; border-radius: 24px; border: 0;
  background: var(--surface); color: var(--fg-strong); cursor: pointer; text-decoration: none;
  font-size: .875rem; font-weight: 700; white-space: nowrap;
}
/* 회색 알약: 누르면 더 진한 회색 */
.btn.gray:hover, .btn.gray:active, .btn:not(.yellow):not(.dark):active { background: var(--pressed); }
/* 검정 단추: #111, 흰 글자, 안쪽 2px 흰 테두리 */
.btn.dark { background: var(--dark); color: var(--on-dark); box-shadow: inset 0 0 0 2px var(--dark-edge); border-radius: 16px; }
.btn.dark:hover, .btn.dark:active { background: var(--dark-hover); }
/* 노랑 단추: 화면마다 한 곳(원문 보기·찾기)만. 2px 검정 테두리 */
.btn.yellow { background: var(--yellow); color: var(--on-yellow); box-shadow: inset 0 0 0 2px #000000; border-radius: 16px; letter-spacing: -0.5px; }
.btn.more { width: 100%; margin-top: 16px; }
.pill { display: inline-block; min-width: 1.6em; padding: 0 6px; border-radius: 999px; background: var(--dark); color: var(--on-dark); font-size: .75rem; line-height: 1.6; text-align: center; }

.label { display: block; font-weight: 700; font-size: .875rem; margin: 0 0 8px; padding: 0; color: var(--fg-strong); }
.check { display: flex; align-items: center; gap: 8px; font-size: .875rem; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--dark); }

/* 조건 칩: 회색 알약, 고른 칩은 검정 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 20px;
  border: 0; border-radius: 30px; background: var(--surface); color: var(--fg-strong); cursor: pointer;
  font-size: 1rem; font-weight: 700; line-height: 1.3;
}
.chip:active { background: var(--pressed); }
.chip[aria-pressed="true"] { background: var(--dark); color: var(--on-dark); box-shadow: inset 0 0 0 2px var(--dark-edge); }
.chip .n { font-size: .8125rem; font-weight: 400; opacity: .72; }

/* 상태 배지: 오늘~D-3 빨강, D-7까지 주황, 신규 파랑, 그 밖은 선·회색 */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 24px; border-radius: 999px; padding: 0 10px; font-size: .75rem; font-weight: 700; background: var(--surface); color: var(--fg); white-space: nowrap; letter-spacing: 0; }
.badge.urgent { background: var(--red); color: #ffffff; }
.badge.soon { background: var(--orange-weak); color: var(--orange); }
.badge.new { background: var(--blue); color: #ffffff; }
.badge.line { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--fg); }
.badge.soft { background: var(--surface); color: var(--muted); font-weight: 600; }

/* ---------- 조건 ---------- */
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sheet-head h2 { margin: 0; font-size: 1.0625rem; color: var(--fg-strong); }
.group { display: block; margin: 0 0 24px; padding: 0; border: 0; min-width: 0; }
.sheet-foot { display: flex; gap: 8px; }
.sheet-foot .btn { flex: 1; }

/* ---------- 목록 윗부분 ---------- */
/* 농업인을 골랐을 때만 나오는 짧은 안내 */
.note-box { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 16px; padding: 12px 16px; border-radius: 16px; background: var(--surface-hover); }
.note-box .ph { color: var(--blue); margin-top: .3em; }
.note-box a { font-weight: 700; color: var(--fg-strong); }

.searchbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px 16px; margin-bottom: 16px; }
.searchbar .field { margin: 0; min-width: 0; }
.input-icon { position: relative; }
.input-icon .ph { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--fg); pointer-events: none; }
/* 입력칸: 조건 칩과 같은 회색 알약 모양 */
input[type="search"], select {
  width: 100%; min-height: 48px; padding: 0 18px; border: 0; border-radius: 30px;
  background: var(--surface); color: var(--fg-strong); font-size: 1rem;
}
input[type="search"]::placeholder { color: var(--muted); opacity: 1; }
.input-icon input[type="search"], .input-icon select { padding-left: 46px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 17px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 40px; }
.national { color: var(--muted); }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toggle {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 18px;
  border: 0; border-radius: 30px; background: var(--surface); color: var(--fg-strong); cursor: pointer; font-weight: 700;
}
.toggle:active { background: var(--pressed); }
.toggle .n { font-weight: 700; }
.toggle[aria-pressed="true"] { background: var(--dark); color: var(--on-dark); box-shadow: inset 0 0 0 2px var(--dark-edge); }
#soonToggle .ph { color: var(--red); }
#soonToggle[aria-pressed="true"] { background: var(--red); color: #ffffff; box-shadow: none; }
#soonToggle[aria-pressed="true"] .ph { color: #ffffff; }
.toolbar-end { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.result-count { margin: 0; color: var(--fg-strong); font-weight: 700; }
.sort select { width: auto; min-height: 44px; font-size: .875rem; font-weight: 700; }

.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.active-filters .chip { min-height: 36px; padding: 0 14px; font-size: .875rem; background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.active-filters .chip:hover { background: var(--surface-hover); }
.linkish { border: 0; background: none; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 4px 6px; }

/* ---------- 목록: 선으로만 나눈 평평한 목록 ---------- */
.results { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--fg-strong); }
.results:empty { display: none; }
.results:focus { outline: none; }
.results li { border-bottom: 1px solid var(--divider); }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 20px; width: 100%; text-align: left; cursor: pointer;
  background: transparent; border: 0; padding: 20px 8px; color: var(--fg);
}
.row:hover { background: var(--surface-hover); }
.row[aria-current="true"] { background: var(--surface-hover); box-shadow: inset 4px 0 0 var(--fg-strong); }
.row-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.row-tags:empty { display: none; }
.row-title { font-weight: 700; font-size: 1rem; line-height: 1.5; color: var(--fg-strong); letter-spacing: -0.3px; }
/* 가리키면 제목 옆 화살표가 나타난다 */
.row-arrow { margin-left: 4px; vertical-align: -2px; opacity: 0; }
.row:hover .row-arrow, .row:focus-visible .row-arrow, .row[aria-current="true"] .row-arrow { opacity: 1; }
.row-meta { color: var(--muted); font-size: .875rem; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; min-width: 7.5em; }
.row-date { font-size: .875rem; color: var(--fg); font-weight: 600; }
.row-src { font-size: .75rem; color: var(--muted); }

.skeleton .row { cursor: default; }
.skeleton .row:hover { background: transparent; }
.skeleton .bar { display: block; height: .9em; border-radius: 999px; background: var(--surface); }
.skeleton .bar.w1 { width: 72%; height: 1.1em; }
.skeleton .bar.w2 { width: 40%; }
.skeleton .bar.w3 { width: 5em; }

.state { background: var(--surface-hover); border-radius: 24px; padding: 40px 20px; text-align: center; }
.state .ph { font-size: 2rem; color: var(--fg-strong); }
.state-title { margin: 8px 0 4px; font-weight: 700; font-size: 1rem; color: var(--fg-strong); }
.state p { margin: 0 0 16px; color: var(--muted); }
.state.error .ph { color: var(--warn-text); }
.basis-short { margin: 16px 4px 0; color: var(--muted); font-size: .75rem; line-height: 1.5; }
.basis-short .warn { color: var(--warn-text); font-weight: 700; }

/* ---------- 상세 ---------- */
.detail-bar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--canvas); border-bottom: 1px solid var(--divider); }
.detail-inner { padding: 24px 24px 32px; }
.detail .row-tags { margin-bottom: 12px; }
.detail h2 { margin: 0 0 20px; font-size: 1.75rem; line-height: 1.5; font-weight: 700; color: var(--fg-strong); letter-spacing: -0.5px; }
.detail h3 { margin: 28px 0 6px; font-size: 1rem; color: var(--fg-strong); }
.facts { display: grid; grid-template-columns: 5.5em minmax(0, 1fr); gap: 10px 16px; margin: 0; padding: 20px; background: var(--surface-hover); border-radius: 24px; }
.facts dt { color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; color: var(--fg-strong); }
.facts small, .muted { color: var(--muted); }
.pre { white-space: pre-line; margin: 0; max-width: 65ch; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 4px; }
.actions .btn.yellow { flex: 1 1 auto; }
.caution { font-size: .75rem; line-height: 1.5; color: var(--muted); border-top: 1px solid var(--divider); padding-top: 16px; margin: 32px 0 0; }
.guide { padding: 28px 24px 28px; }
.guide h2 { font-size: 1.25rem; margin: 0 0 12px; color: var(--fg-strong); }
.guide dl { display: grid; grid-template-columns: auto auto 1fr; gap: 8px 16px; margin: 0; }
.guide dt { font-weight: 700; color: var(--fg-strong); }
.guide dd { margin: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--dark); color: var(--on-dark); padding: 10px 20px; border-radius: 999px; z-index: 90; font-weight: 700; }

/* ---------- 홈 ---------- */
.brand h1 a { color: inherit; text-decoration: none; }
.home { padding-top: 28px; padding-bottom: 56px; }
.home-hero { padding-bottom: 32px; border-bottom: 1px solid var(--divider); margin-bottom: 32px; }
.hero-title { margin: 0; font-size: 3.36rem; line-height: 1.23; font-weight: 700; letter-spacing: -1px; color: var(--fg-strong); }
.hero-title strong { font-weight: 800; font-variant-numeric: tabular-nums; }
.hero-sub { margin: 12px 0 28px; color: var(--muted); font-size: 1rem; }
.hero-search { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px 16px; align-items: end; }
.hero-search .field { margin: 0; min-width: 0; }
.hero-go { min-height: 48px; padding: 0 36px; font-size: 1rem; }

.home-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; margin-bottom: 44px; }
.stat {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 20px; border: 0; border-radius: 24px;
  background: var(--surface-hover); color: var(--fg-strong); cursor: pointer; text-align: left;
}
.stat:hover, .stat:active { background: var(--surface); }
.stat-num { font-size: 1.875rem; line-height: 1.33; font-weight: 700; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.stat-label { display: flex; align-items: center; gap: 4px; font-weight: 700; }
.stat-label .ph-arrow-right { margin-left: 2px; }
.stat-label .tone-red { color: var(--red); }
.stat-label .tone-blue { color: var(--blue); }
.stat-label .tone-orange { color: var(--orange-icon); }

.home-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 44px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.block-head h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--fg-strong); }
.more-link { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 6px 4px; cursor: pointer; font-weight: 700; color: var(--fg-strong); }
.more-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.head-count { font-size: .9375rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.row-line { display: flex; min-width: 0; }
.row-line-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-line-extra { flex: none; white-space: nowrap; }
.row-line-extra.sep::before { content: "·"; margin: 0 6px; }
.list-empty { padding: 24px 8px; color: var(--muted); }
/* 넓은 화면에서 '더 보기'로 늘어난 목록은 칸 안에서 스크롤(높이는 app.js fitListHeight가 정함) */
.scroll-list { overflow-y: auto; scrollbar-width: thin; scrollbar-color: #c4c4c4 transparent; }
/* 홈 목록 줄 높이를 고르게: 제목 2줄, 보조 정보 1줄까지 */
.home-grid .row-title, .list-card .row-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.home-grid .row-meta, .list-card .row-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 가리킬 때만 보이는 화살표가 줄을 넘겨 빈칸을 만들지 않게: 홈 목록과 터치 화면에서는 뺀다 */
.home-grid .row-arrow { display: none; }
@media (hover: none) { .row-arrow { display: none; } }
/* 많이 찾는 지원사업의 제도/공고 전환 */
.seg-mini { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface); }
.seg-mini button { border: 0; background: none; height: 30px; padding: 0 12px; border-radius: 999px; cursor: pointer; font-size: .8125rem; font-weight: 700; color: var(--fg); }
.seg-mini button[aria-pressed="true"] { background: var(--dark); color: var(--on-dark); }
.who-card { background: var(--surface-hover); border-radius: 24px; padding: 24px; margin-bottom: 44px; }
.who-card h3 .ph { color: var(--blue); }
.who-card .chip { background: var(--canvas); }
.who-card .chip:active { background: var(--pressed); }

/* ---------- 홈 그래프 ----------
 * 한 계열 그래프는 한 색. 값·이름 글자는 계열 색이 아니라 글자색으로 쓴다.
 * 그래프 글자는 px로 둔다: app.js가 카드 실제 폭으로 그려 글자가 줄어들지 않는다.
 */
.home-charts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-bottom: 44px; }
.viz-card { border: 1px solid var(--line); border-radius: 24px; padding: 24px; background: var(--canvas); min-width: 0; display: flex; flex-direction: column; }
.viz-card h3 { margin: 0; font-size: 1.25rem; line-height: 1.4; color: var(--fg-strong); }
.viz-sub { margin: 4px 0 12px; color: var(--muted); font-size: .8125rem; line-height: 1.5; }
.viz-card h3 + .viz-body, .viz-head + .viz-body { margin-top: 14px; }
.viz-body { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
.viz-body svg { display: block; width: 100%; height: auto; max-height: 340px; overflow: visible; }
.viz-body text { font-family: inherit; letter-spacing: 0; }
.viz .tick { fill: var(--muted); font-size: 13px; }
.viz .val { fill: var(--fg-strong); font-size: 14px; font-weight: 700; }
.viz .cat { fill: var(--fg-strong); font-size: 14px; font-weight: 600; }
.viz .axis { stroke: var(--line); stroke-width: 1; }
.viz .bar { fill: var(--bar, #a3a3a3); }
.viz .hit { fill: transparent; }
.viz .mark { cursor: pointer; outline: none; }
.viz .mark.static { cursor: default; }
.viz .bar { transition: opacity .15s; }
.viz svg:has(.mark:hover) .mark:not(:hover) .bar,
.viz svg:has(.mark:focus-visible) .mark:not(:focus-visible) .bar { opacity: .3; }
.viz .mark:focus-visible .hit { stroke: var(--fg-strong); stroke-width: 2; }
/* 두 계열 이상 그래프의 범례, 카드 제목 옆 전환 단추 */
.viz-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.viz-fig { width: 100%; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 10px; font-size: .875rem; font-weight: 600; color: var(--fg-strong); }
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.viz-body svg.hb { max-height: none; }
.viz .val.sm { font-size: 13px; }
.viz .bar.muted { fill: #8a8a8a; }
/* 선 그래프 */
.viz .grid { stroke: var(--surface); stroke-width: 1; }
.viz .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz .line.dash { stroke-dasharray: 4 4; }
.viz .dot { stroke: var(--canvas); stroke-width: 2; }
.viz .dot.hollow { fill: var(--canvas); }
.viz .cross { stroke: var(--fg-strong); stroke-width: 1; opacity: 0; }
.viz .mark:hover .cross, .viz .mark:focus-visible .cross { opacity: .3; }
.viz .hover-dot { opacity: 0; stroke: var(--canvas); stroke-width: 2; }
.viz .mark:hover .hover-dot, .viz .mark:focus-visible .hover-dot { opacity: 1; }
.viz .halo { paint-order: stroke; stroke: var(--canvas); stroke-width: 4px; stroke-linejoin: round; }
/* 목록형 카드(곧 열릴 수 있는 공모): 가운데 정렬 대신 위에서부터 */
.viz-card.list-card .viz-body { display: block; }
.viz-card.list-card .results { border-top-width: 1px; }
.viz-card.list-card .row { padding: 12px 4px; }
.viz-card .viz-body.top { align-items: flex-start; padding-top: 8px; }
.viz-card .viz-body.bottom { align-items: flex-end; }
/* 그래프 움직임(app.js setupMotion): pending = 아직 화면 밖, play = 처음 들어옴, replay = 그래프만 다시 */
@media (prefers-reduced-motion: no-preference) {
  .viz-card.pending { opacity: 0; transform: translateY(24px); }
  .viz-card.play { animation: card-in .6s cubic-bezier(.2, .7, .2, 1) both; --d0: 180ms; }
  .viz .bar { transform-box: fill-box; transform-origin: 50% 100%; }
  .viz svg.hb .bar { transform-origin: 0 50%; }
  .viz-card:is(.play, .replay) .bar {
    animation: grow-y .7s cubic-bezier(.2, .7, .2, 1) both;
    animation-delay: calc(var(--d0, 0ms) + var(--i, 0) * 45ms);
  }
  .viz-card:is(.play, .replay) svg.hb .bar { animation-name: grow-x; }
  .viz-card:is(.play, .replay) .val {
    animation: fade-in .35s ease-out both;
    animation-delay: calc(var(--d0, 0ms) + var(--i, 0) * 45ms + 350ms);
  }
  .viz-card:is(.play, .replay) .line:not(.dash) { animation: draw 1.2s ease-out both; animation-delay: var(--d0, 0ms); }
  .viz-card:is(.play, .replay) .line.dash, .viz-card:is(.play, .replay) .halo {
    animation: fade-in .4s ease-out both;
    animation-delay: calc(var(--d0, 0ms) + 1.1s);
  }
  .viz-card:is(.play, .replay) .dot {
    transform-box: fill-box; transform-origin: center;
    animation: pop .35s ease-out both;
    animation-delay: calc(var(--d0, 0ms) + 150ms + var(--i, 0) * 90ms);
  }
  .viz-card:is(.play, .replay) .kmap-region {
    animation: fade-in .5s ease-out both;
    animation-delay: calc(var(--d0, 0ms) + var(--i, 0) * 35ms);
  }
}
@keyframes card-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: scale(1); } }
@keyframes draw { from { stroke-dasharray: 1; stroke-dashoffset: 1; } to { stroke-dasharray: 1; stroke-dashoffset: 0; } }
.viz-tip { position: fixed; z-index: 90; pointer-events: none; background: var(--dark); color: var(--on-dark); border-radius: 12px; padding: 8px 12px; font-size: .8125rem; line-height: 1.45; max-width: 240px; }
.viz-tip strong { display: block; font-size: 1rem; }

/* 지역 지도(svg-maps South Korea, CC BY 4.0): 지역 사이 흰 선 1px, 고른 지역은 굵은 테두리.
 * 선 굵기는 확대·축소와 관계없이 같게(vector-effect) */
.kmap-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px 24px; width: 100%; align-items: center; }
.kmap-wrap.wide { grid-template-columns: minmax(0, 1fr) 180px; }
.kmap-figure { display: grid; gap: 10px; justify-items: center; min-width: 0; }
.viz-body svg.kmap { width: 100%; max-width: 420px; max-height: none; height: auto; overflow: visible; }
.kmap path { stroke: var(--canvas); stroke-width: 1; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.kmap-region { cursor: pointer; outline: none; }
.kmap-outline { pointer-events: none; }
.kmap-outline path { fill: none; stroke: var(--fg-strong); stroke-width: 1.5; }
.kmap-outline.sel path { stroke-width: 3; }
/* 순위는 위에서 아래로 읽히게: 좁은 칸은 두 줄(세로로 1~8위, 9~16위), 넓은 칸은 한 줄 */
.kmap-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(8, auto); grid-auto-flow: column; gap: 2px 10px; }
.kmap-wrap.wide .kmap-list { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-flow: row; gap: 1px; }
.kmap-wrap.wide .kmap-list button { min-height: 29px; }
.kmap-list button {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; border: 0; background: none;
  padding: 4px 10px; border-radius: 10px; cursor: pointer; font-size: .875rem; color: var(--fg-strong); text-align: left;
}
.kmap-list button:hover, .kmap-list button.hover { background: var(--surface-hover); }
.kmap-list button[aria-pressed="true"] { background: var(--surface); font-weight: 700; box-shadow: inset 0 0 0 2px var(--fg-strong); }
.kmap-list i { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.kmap-list .name { flex: 1; }
.kmap-list .cnt { font-weight: 700; font-variant-numeric: tabular-nums; }

.scale { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .75rem; color: var(--muted); }
.scale span { display: inline-flex; align-items: center; gap: 4px; }
.scale i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; }

/* ---------- 바닥글: 원문 사이트 알약 ---------- */
.foot { border-top: 1px solid var(--divider); background: var(--canvas); color: var(--muted); font-size: .75rem; line-height: 1.6; }
.foot-inner { padding-top: 24px; padding-bottom: 40px; }
.foot p { margin: 0 0 8px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0 0 20px; padding: 0; }
.foot-links a { display: inline-flex; align-items: center; height: 40px; padding: 0 20px; border-radius: 24px; background: var(--surface); color: var(--fg-strong); text-decoration: none; font-size: .75rem; }

/* ---------- 좁은 화면(1099px 이하): 조건과 상세를 겹쳐 띄운다 ---------- */
@media (max-width: 1099px) {
  body.filters-open .filters {
    display: flex; flex-direction: column; position: fixed; inset: 0; z-index: 60; background: var(--canvas); overflow-y: auto; padding: 20px 20px 0;
  }
  body.filters-open .sheet-foot { position: sticky; bottom: 0; margin-top: auto; padding: 12px 0 20px; background: var(--canvas); border-top: 1px solid var(--divider); }
  body.detail-open .detail { display: block; position: fixed; inset: 0; z-index: 50; background: var(--canvas); overflow-y: auto; }
  .guide { display: none; }
}
@media (min-width: 760px) and (max-width: 1099px) {
  body.detail-open .detail { left: auto; width: min(600px, 92vw); border-left: 1px solid var(--line); }
}
@media (min-width: 640px) {
  .searchbar { grid-template-columns: minmax(0, 1fr) 15rem; }
  .searchbar .national { grid-column: 2; }
}
@media (min-width: 760px) {
  .hero-search { grid-template-columns: minmax(0, 1fr) 15rem auto; }
  .hero-search .national { grid-column: 1 / -1; }
}
@media (min-width: 900px) {
  .home-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 639px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .brand h1 { font-size: 1.5rem; }
  .hero-title { font-size: 1.875rem; line-height: 1.33; }
  .home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 16px; border-radius: 20px; }
  .stat-num { font-size: 1.5rem; }
  .who-card { padding: 20px; }
  .tabs-inner { gap: 2px; }
  .tabs [role="tab"] { padding: 0 12px; font-size: 1rem; }
  .row { grid-template-columns: minmax(0, 1fr); padding: 16px 4px; }
  .row-side { order: -1; flex-direction: row; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 8px; text-align: left; min-width: 0; }
  .row-src { margin-left: auto; }
  .toolbar-end { flex-basis: 100%; justify-content: space-between; margin-left: 0; }
  .detail-inner { padding: 20px 16px 32px; }
  .detail h2 { font-size: 1.375rem; }
  .facts { grid-template-columns: 5em minmax(0, 1fr); padding: 16px; border-radius: 20px; }
  .chip { font-size: .9375rem; }
  .viz .cat, .viz .val { font-size: 13px; }
  .viz .tick, .viz .val.sm { font-size: 12px; }
}
@media (max-width: 420px) {
  .tab-count { display: none; }
}
@media (min-width: 1100px) {
  .layout { grid-template-columns: 264px minmax(0, 1fr) minmax(360px, 440px); gap: 32px; align-items: start; }
  /* 홈 목록 셋을 나란히. 세 칸 높이를 같게 하고 '더 보기'는 바닥에, 줄 높이도 같게(제목 2줄 + 보조 1줄) */
  .home-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
  .home-grid .home-block { display: flex; flex-direction: column; }
  .home-grid .results { flex: 1 0 auto; margin-bottom: 16px; }
  .home-grid .block-head { min-height: 37px; }
  .home-grid .btn.more { margin-top: auto; }
  .home-grid .row-main { min-height: 4.85rem; }
  .filters, .detail { display: block; position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow-y: auto; }
  .filters { padding: 0 4px 0 0; }
  .detail { background: var(--canvas); border: 1px solid var(--line); border-radius: 24px; }
  .narrow-only { display: none !important; }
}

@media print {
  .top, .tabs, .filters, .list-pane, .foot, .actions, .detail-bar { display: none !important; }
  .layout { display: block; padding: 0; }
  .detail { display: block !important; position: static !important; max-height: none; overflow: visible; border: 0; }
  .facts { background: none; padding: 0; }
}
