/* 색상 사용 안 함 — 음영(grayscale)+테두리로만 구분 */
:root {
  --ink: #1a1a1a;
  --line: #1a1a1a;
  --shade-0: #ffffff;
  --shade-1: #f0f0f0;
  --shade-2: #e0e0e0;
  --shade-3: #cccccc;
  --gap: 12px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background: var(--shade-1);
  line-height: 1.5;
  font-size: 17px;
}

/* ===== 상단바 ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex; flex-direction: column;
  background: var(--shade-0);
  border-bottom: 2px solid var(--line);
}
.topbar-row {
  display: flex; align-items: center; gap: var(--gap);
  padding: 14px 16px;
}
.topbar-extra:empty { display: none; }
.topbar h1 { font-size: 18px; font-weight: 700; }
.title-pop { animation: titlePop 0.35s cubic-bezier(.4,1.2,.5,1); }
@keyframes titlePop {
  0% { opacity: 0; transform: translateX(-8px) scale(0.96); }
  60% { opacity: 1; transform: translateX(2px) scale(1.02); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}
.back-btn {
  font-size: 16px;
  padding: 6px 12px;
  background: var(--shade-0);
  border: 2px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

/* ===== 본문 ===== */
#app { padding: 16px; max-width: 1120px; margin: 0 auto; }
/* 드릴다운 목록은 좁게(읽기 편함), 후보 그리드는 넓게 */
.list { margin: 0; }
.loading { text-align: center; padding: 40px 0; }

/* 드릴다운 목록 — 데스크탑 4열, 모바일 3열 */
.list { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
.dong-group { padding: 12px 0; border-top: 1px solid var(--shade-3); }
.dong-group:first-of-type { border-top: none; padding-top: 4px; }
.dong-group-h { font-size: 12px; font-weight: 700; color: #777; margin-bottom: 8px; }
@media (max-width: 560px) {
  .list { grid-template-columns: repeat(3, 1fr); }
}
.list-item {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  padding: 22px 12px;
  background: var(--shade-0);
  border: 2px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

/* 선거 종류 섹션 헤더 */
.election-section { margin-bottom: 28px; }
.election-head {
  font-size: 20px;
  font-weight: 700;
  padding: 8px 0 12px;
  border-bottom: 2px solid var(--line);
  margin-bottom: var(--gap);
}

/* ===== 후보 그리드 — 모바일 1열 기본, 넓으면 2~3열 ===== */
.election-section { margin-bottom: 32px; }
.election-head .count { font-size: 14px; font-weight: 600; color: #555; }
.card-grid { display: grid; grid-template-columns: 1fr; gap: var(--gap); align-items: start; }
@media (min-width: 600px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 920px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }

/* ===== 규격화 후보 카드 ===== */
.card {
  position: relative;
  background: var(--shade-0);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.card-summary { display: flex; align-items: center; gap: 12px; }
.card-detail { margin-top: 12px; padding-top: 8px; border-top: 1.5px dashed var(--shade-3); }

.num-badge {
  position: absolute; top: 10px; right: 12px;
  min-width: 26px; height: 26px; padding: 0 7px;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 800;
  background: var(--shade-2); border: 1.5px solid var(--line); border-radius: 6px;
}
.photo {
  flex: 0 0 auto;
  width: 90px; height: 112px;
  object-fit: cover;
  background: var(--shade-3); border: 2px solid var(--line); border-radius: 8px;
}
.photo.empty { display: grid; place-items: center; font-size: 11px; color: #666; }
.name-block { flex: 1 1 auto; min-width: 0; }
.cand-name { font-size: 20px; font-weight: 800; line-height: 1.2; }
.cand-party { font-size: 13px; padding: 1px 7px; display: inline-block; margin-top: 3px;
  background: var(--shade-1); border: 1.5px solid var(--line); border-radius: 6px; }
.cand-meta { font-size: 13px; color: #555; margin-top: 3px; }

.disc-src { font-size: 12px; margin-top: 8px; }
.disc-src a, .nodata a { color: var(--ink); font-weight: 700; }
.crime-link { font-size: 12px; font-weight: 700; color: var(--ink); white-space: nowrap; }
/* ===== 필터 바 (전체/전과있음/전과없음) ===== */
/* A안: 지역구=탭, 후보=미니카드(사각배지+이름), 필터=텍스트 */
.anchor-bar {
  padding: 8px 16px; margin: 0 auto;
  max-width: 1120px;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  border-top: 1.5px solid var(--shade-3);
}

.dong-picker {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 14px;
  background: var(--shade-1); border: 1.5px solid var(--shade-3); border-radius: 8px;
}
.dong-picker label { font-size: 13px; font-weight: 700; color: #444; }
.dong-picker select {
  flex: 1 1 200px; min-width: 200px; padding: 7px 10px;
  font: inherit; font-size: 14px;
  background: var(--shade-0); border: 1.5px solid var(--line); border-radius: 6px;
  cursor: pointer;
}
.dong-applied {
  padding: 10px 14px; margin-bottom: 14px;
  font-size: 13px; color: var(--ink);
  background: var(--shade-1); border-left: 3px solid var(--ink); border-radius: 4px;
}
.dong-applied b { font-weight: 800; }
.dong-change { font-size: 12px; font-weight: 700; color: var(--ink); margin-left: 6px; }

.dong-change-btn {
  font: inherit; font-size: 12px; font-weight: 700;
  padding: 3px 10px; cursor: pointer; margin-left: 6px;
  background: var(--shade-0); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 999px;
}

.dong-clear {
  font: inherit; font-size: 13px; font-weight: 700;
  padding: 6px 12px; cursor: pointer;
  background: var(--shade-0); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 6px;
}
.anchor-bar:not(.grouped) .anchor-chip { flex: 0 0 calc((100% - 16px) / 3); min-width: 0; max-width: 200px; }
.anchor-bar.grouped { flex-direction: column; gap: 12px; }
@media (max-width: 560px) {
  .anchor-bar { padding: 8px 12px; }
}
.anchor-bar.grouped { display: flex; flex-direction: column; gap: 12px; }

/* 선거구별 후보 리스트 (탭 제거, 항상 그룹 노출) */
.anchor-lists { display: flex; flex-direction: column; gap: 12px; }
.anchor-sub {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px; background: var(--shade-1);
  border: 1px dashed var(--shade-3); border-radius: 8px;
}
.anchor-sub-h {
  font-size: 14px; font-weight: 800; color: var(--ink);
  text-decoration: none; display: inline-block; padding: 0 2px;
}
.anchor-sub-h:hover { text-decoration: underline; }
.anchor-sub-h .ash-n { font-size: 11px; color: #777; margin-left: 4px; font-weight: 700; }
.anchor-sub-row { display: flex; gap: 6px; flex-wrap: wrap; }
.anchor-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 700; padding: 0; padding-right: 10px;
  background: var(--shade-0); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 4px;
  text-decoration: none; overflow: hidden;
}
.anchor-chip::before {
  content: attr(data-num);
  display: inline-grid; place-items: center; min-width: 22px;
  padding: 4px 6px;
  background: var(--chip-bg, var(--shade-2));
  color: var(--chip-fg, var(--ink));
  font-weight: 800; border-right: 1.5px solid var(--line);
}
.anchor-chip:hover { background: var(--shade-2); }
.filter-bar {
  display: flex; gap: 14px; margin-bottom: var(--gap); flex-wrap: wrap;
  font-size: 13px; color: #666;
}
.f-btn {
  font: inherit; padding: 2px 0; cursor: pointer; color: #777;
  background: none; border: none; border-bottom: 2px solid transparent;
}
.f-btn .fb-n { font-weight: 700; margin-left: 3px; color: #999; }
.f-btn:hover { color: var(--ink); }
.f-btn.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 700; }
.f-btn.on .fb-n { color: var(--ink); }
/* 필터 적용: 매칭 안 되는 카드 숨김 */
/* 키워드 하이라이트: 선택 기준 단어 강조 */
mark[class^="hl-"] { padding: 0 3px; border-radius: 3px; font-weight: 700; }
.hl-labor    { background: #fde2c2; color: #9a3412; }  /* 주황: 노동 */
.hl-civic    { background: #e9d8fd; color: #6b21a8; }  /* 보라: 시민단체 */
.hl-religion { background: #c7e3ff; color: #1e40af; }  /* 파랑: 종교 */
.hl-mil      { background: #d1d5db; color: #1f2937; }  /* 회색: 군 */
.hl-law      { background: #fef3c7; color: #78350f; }  /* 황: 법조 */
.hl-biz      { background: #d1fae5; color: #065f46; }  /* 녹: 기업 */
.hl-pl-tag   { background: var(--ink); color: var(--shade-0); font-size: 0.85em; padding: 1px 6px; }  /* 공약 인라인 태그(액션) */
.hl-pl-state { background: transparent; color: #555; font-size: 0.9em; padding: 0 4px; border: 1px solid #aaa; font-weight: 600; }  /* 상태 키워드(약하게) */

/* 선거구 필터는 JS가 인라인 display 토글로 처리 */
.race-view.f-warn  .card[data-crime="0"] { display: none; }
.race-view.f-clean .card[data-crime="1"] { display: none; }
.race-view.f-debt  .card[data-debt="0"]  { display: none; }
.race-view.f-unfit  .card:not([data-mil="unfit"]) { display: none; }
.race-view.f-incum  .card[data-incumbent="0"] { display: none; }
.race-view.f-repeat .card[data-runs="1"], .race-view.f-repeat .card[data-runs="0"] { display: none; }
.badge-incumbent {
  display: inline-block; font-size: 11px; font-weight: 700; margin-left: 6px; vertical-align: middle;
  padding: 1px 6px; background: var(--ink); color: var(--shade-0); border-radius: 4px;
}
.addr-line, .edu-line { font-size: 13px; color: #444; line-height: 1.5; margin: 2px 0 4px; }
.addr-line { color: #555; }

.area-note {
  font-size: 13px; color: #444; line-height: 1.5; margin: -4px 0 12px;
  padding: 8px 12px; background: var(--shade-1);
  border: 1.5px solid var(--shade-3); border-radius: 8px;
}

/* 정보공개 */
.disclosure .disc-row { display: flex; gap: 8px; font-size: 14px; padding: 4px 6px; border-radius: 4px; }
.disc-k { flex: 0 0 70px; font-weight: 700; color: #444; }
.disc-v { flex: 1 1 auto; }
/* 전과 있음 = 빨간 글씨 + 음영/테두리 강조 */
.disc-row.warn { background: var(--shade-2); border: 2px solid #c0181f; font-weight: 700; color: #c0181f; }
.disc-row.warn .disc-k, .disc-row.warn .disc-v, .disc-row.warn .crime-link { color: #c0181f; }
/* 체납 있음 = 주황(전과보다 약하게) */
.disc-row.caution { background: #fff4e0; border: 1.5px solid #d97706; font-weight: 700; color: #b45309; }
.disc-row.caution .disc-k, .disc-row.caution .disc-v { color: #b45309; }
/* 병역(남자) 볼드 */
.disc-row.strong { font-weight: 700; }
.disc-row.strong .disc-k { color: var(--ink); }
.nodata { font-size: 13px; color: #888; line-height: 1.5; }
li.nodata { background: none; border: none; padding: 4px 0; }

.card-section { margin-top: 14px; }
.card-section h4 {
  font-size: 14px; font-weight: 700; color: #444;
  padding-bottom: 4px; margin-bottom: 6px;
  border-bottom: 1.5px dashed var(--shade-3);
}
.card-section h4 .count {
  font-size: 12px; font-weight: 700; margin-left: 4px;
  padding: 0 6px; background: var(--shade-2); border: 1.5px solid var(--line); border-radius: 8px;
}
.pledges { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.pledge {
  padding: 12px 14px;
  background: var(--shade-1); border: 1.5px solid var(--shade-3); border-left: 5px solid var(--ink);
  border-radius: 6px;
}
.pledge-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pledge-sum { cursor: pointer; list-style: none; }
.pledge-sum::-webkit-details-marker { display: none; }
.pledge-sum::marker { display: none; }
.pledge details > summary .pledge-tog {
  margin-left: auto;
  display: inline-block;
  font-size: 13px; font-weight: 700; color: var(--ink);
  padding: 6px 14px;
  background: var(--shade-0); border: 1.5px solid var(--line); border-radius: 999px;
}
.pledge details > summary:hover .pledge-tog { background: var(--shade-2); }
.pl-tog-open, .pl-tog-closed { display: none; }
.pledge details[open] > summary .pl-tog-open { display: inline; }
.pledge details:not([open]) > summary .pl-tog-closed { display: inline; }
.pledge details:not([open]) > summary .pledge-title { margin-bottom: 0; }
.pledge-n {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px;
  padding: 0 6px; font-size: 12px; font-weight: 800;
  background: var(--ink); color: var(--shade-0); border-radius: 11px;
}
.realm {
  display: inline-block; font-size: 12px; font-weight: 700;
  padding: 1px 8px; background: var(--shade-0); border: 1.5px solid var(--line); border-radius: 5px;
}
.pledge-title {
  font-size: 17px; font-weight: 700; line-height: 1.4; color: var(--ink);
  margin-bottom: 6px;
}
.pt-main { display: block; }
.pt-sub { display: block; margin-top: 4px; font-size: 13px; font-weight: 500; color: #555; line-height: 1.45; }

/* pl-sub([N]번호 카운터 옆) / pl-num li(숫자 옆): 앞부분은 같은 줄, 뒷부분만 줄내림 */
.pl-sub .pt-main, .pl-num li .pt-main { display: inline; }
.pl-sub .pt-sub, .pl-num li .pt-sub { display: block; margin-top: 2px; margin-left: 0; font-size: 12px; font-weight: 400; color: #555; line-height: 1.5; }
.pledge-cont {
  font-family: inherit; font-size: 14px; line-height: 1.6; color: #333;
  padding: 12px 14px; background: var(--shade-0);
  border: 1.5px solid var(--shade-3); border-radius: 6px;
}

/* 마크다운 의무화 적용 렌더 — 정형 위계 */
.md > *:first-child { margin-top: 0 !important; }
.md > *:last-child { margin-bottom: 0 !important; }
.md-slogan {
  margin: 0 0 14px; padding: 8px 14px;
  border-left: 4px solid var(--ink); background: var(--shade-1);
  font-style: normal; color: #333; font-size: 14px;
}
.md-h3 {
  font-size: 16px; font-weight: 800; color: var(--ink);
  margin: 18px 0 8px; padding-bottom: 4px;
  border-bottom: 2px solid var(--ink);
}
.md-h4 {
  font-size: 14px; font-weight: 700; color: #222;
  margin: 14px 0 6px;
}
.md-h4 .pt-main { display: inline; }
.md-h4 .pt-sub { display: block; margin-top: 3px; font-size: 13px; font-weight: 400; color: #555; line-height: 1.5; }
.md-p { margin: 6px 0; line-height: 1.65; }
.md-p .pt-main { display: inline; font-weight: 600; }
.md-p .pt-sub { display: block; margin-top: 3px; font-size: 13px; font-weight: 400; color: #555; line-height: 1.5; }
.md-tag { margin: 6px 0; font-size: 13px; color: #555; }
.md-tag-row { margin: 10px 0 4px; }
.md-ol {
  margin: 4px 0 8px 22px; padding: 0; list-style: decimal;
}
.md-ol li { margin: 4px 0; padding-left: 4px; line-height: 1.6; }
.md-ol li .pt-main { display: inline; font-weight: 600; }
.md-ol li .pt-sub { display: block; margin-top: 3px; font-size: 13px; font-weight: 400; color: #555; line-height: 1.5; }
.md-ul { margin: 4px 0 8px 20px; padding: 0; list-style: disc; }
.md-ul li { margin: 4px 0; padding-left: 4px; line-height: 1.6; }
.md-h5 { font-size: 13.5px; font-weight: 700; color: #333; margin: 12px 0 4px; }
.md-h6 { font-size: 13px; font-weight: 700; color: #444; margin: 10px 0 4px; }
.md-tbl {
  border-collapse: collapse; width: 100%; margin: 10px 0;
  font-size: 13px; line-height: 1.5;
}
.md-tbl th, .md-tbl td {
  border: 1px solid var(--shade-3); padding: 6px 8px; text-align: left; vertical-align: top;
}
.md-tbl th { background: var(--shade-2); font-weight: 700; }

.rewrite-note {
  font-size: 11px; color: #777; padding: 4px 8px;
  background: var(--shade-2); border-radius: 4px; margin-bottom: 8px;
  display: inline-block;
}
.pledge-cont > * { margin: 0; }
.pledge-cont > * + * { margin-top: 4px; }
.pl-slogan { padding: 6px 10px; background: var(--shade-2); border-left: 3px solid var(--ink); font-size: 14px; }
.pl-slogan b { margin-right: 6px; }
.pl-tag { font-size: 13px; }
.pl-tag-k { display: inline-block; padding: 0 6px; background: var(--shade-2); border: 1px solid var(--line); border-radius: 4px; font-weight: 700; margin-right: 4px; }
.pl-sec { font-weight: 800; color: var(--ink); margin-top: 10px !important; font-size: 14px; }
.pl-box {
  margin-top: 10px !important;
  border: 1.5px solid var(--shade-3); border-radius: 10px;
  background: var(--shade-1); overflow: hidden;
}
.pl-box:first-child { margin-top: 0 !important; }
.pl-box-h {
  margin: 0; padding: 8px 12px;
  font-size: 13px; font-weight: 800; color: var(--ink);
  background: var(--shade-2); border-bottom: 1.5px solid var(--shade-3);
}
.pl-box-body { padding: 10px 12px; }
.pl-box-body > *:first-child { margin-top: 0 !important; }
.pl-sub { margin-left: 12px; font-weight: 700; color: #222; margin-top: 6px !important; }
.pl-box-body { counter-reset: pl-sub; }
.pledge-cont { counter-reset: pl-sub; }
/* pl-sub가 2개 이상일 때만 [N] 번호 표시 (단일이면 의미없음) */
.pl-box-body:has(.pl-sub ~ .pl-sub) .pl-sub::before,
.pledge-cont:has(.pl-sub ~ .pl-sub) .pl-sub::before {
  counter-increment: pl-sub; content: "[" counter(pl-sub) "] "; color: var(--ink); margin-right: 2px;
}
.pl-bul { list-style: none; padding: 0; margin-left: 26px !important; }
.pl-bul li { position: relative; padding-left: 12px; margin: 2px 0; }
.pl-bul li::before { content: ""; position: absolute; left: 2px; top: 0.7em; width: 5px; height: 1px; background: #666; }
.pl-taggroup { margin-top: 8px !important; margin-left: 24px; }
.pl-taggroup + .pl-num { margin-top: 4px !important; margin-left: 40px !important; }
.pl-num { padding-left: 0; margin-left: 30px !important; }
.pl-num li { margin: 2px 0; }
.pl-p { white-space: pre-wrap; margin-left: 24px !important; }
.pl-box-body > .pl-p:first-child { margin-left: 0 !important; }

.fund-chips {
  margin-top: 10px; font-size: 12px; color: #555;
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
}
.fund-chip {
  display: inline-block; padding: 2px 8px;
  background: var(--shade-1); color: #444;
  border: 1px solid var(--shade-3); border-radius: 999px;
  font-weight: 600; cursor: help;
}
.fund-chip.fund-miss { background: #fff4e0; color: #b45309; border-color: #d97706; }

.pledge-raw {
  display: inline-block; margin-top: 8px;
  font-size: 12px; font-weight: 700;
  padding: 5px 10px; cursor: pointer;
  background: var(--shade-0); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 999px;
}
.pledge-raw:hover { background: var(--shade-2); }

.raw-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: none; z-index: 1000; padding: 20px;
}
.raw-modal.open { display: flex; align-items: center; justify-content: center; }
.raw-modal-box {
  background: #fff; border-radius: 8px;
  max-width: 720px; width: 100%; max-height: 90vh; display: flex; flex-direction: column;
}
.raw-modal-bar { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1.5px solid var(--shade-3); }
.raw-modal-title { flex: 1; font-weight: 700; font-size: 15px; }
.raw-close { background: none; border: none; font-size: 28px; cursor: pointer; line-height: 1; padding: 0 4px; }
.raw-modal-body {
  flex: 1; overflow: auto; margin: 0; padding: 16px 20px;
  white-space: pre-wrap; font-family: inherit; font-size: 14px; line-height: 1.7;
}
.career { list-style: none; font-size: 15px; }
.career li { padding: 3px 0; }
.career li::before { content: "· "; }
.career li.cr-past { color: #888; }
.career li.cr-past mark[class^="hl-"] { opacity: 0.7; }
.career li.cr-curr { font-weight: 600; }

.xlinks {
  margin-top: 14px; padding: 10px 12px;
  background: var(--shade-1); border: 1.5px solid var(--shade-3); border-radius: 8px;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.xlinks-h { font-size: 12px; font-weight: 700; color: #555; width: 100%; margin-bottom: 2px; }
.xlink {
  font-size: 13px; font-weight: 700; padding: 5px 12px;
  background: var(--shade-0); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 999px;
  text-decoration: none;
}
.xlink:hover { background: var(--shade-2); }

.gongbo-btn {
  display: block; width: 100%; text-align: center;
  font-size: 16px; font-weight: 600; margin-top: 14px; padding: 12px;
  background: var(--shade-2); border: 2px solid var(--line); border-radius: 10px;
  text-decoration: none; color: var(--ink);
}

/* ===== 자리 개요 (ballot) ===== */
.ballot-intro { margin: 0 0 18px; text-align: center; }
.ballot-lead { font-size: 18px; line-height: 1.5; }
.ballot-lead b { font-size: 20px; }
.ballot-count {
  font-size: 16px; margin: 12px auto; display: inline-block;
  padding: 8px 18px; background: var(--shade-2);
  border: 2px solid var(--line); border-radius: 999px;
}
.ballot-count b { font-size: 22px; }
.ballot-note { font-size: 13px; color: #555; line-height: 1.5; margin-top: 4px; }

.race-list { margin: 0; display: flex; flex-direction: column; gap: var(--gap); }

/* 3×3 위계 그리드 — 컬럼별 위계 (시·도 / 구·시·군 / 교육) */
.ballot-board { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.ballot-board-h { font-size: 16px; font-weight: 800; color: var(--ink); display: flex; align-items: baseline; gap: 10px; padding-left: 2px; margin-bottom: 4px; }
.ballot-count-inline { font-size: 13px; font-weight: 700; color: #555; padding: 3px 10px; background: var(--shade-1); border: 1.5px solid var(--shade-3); border-radius: 999px; }
.ballot-count-inline b { color: var(--ink); }
.ballot-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ballot-slot {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
  padding: 16px 14px; min-height: 150px;
  background: var(--shade-0); color: var(--ink);
  border: 2px dashed var(--shade-3); border-radius: 24px;
  cursor: pointer; text-align: left;
}
.ballot-slot:hover { background: var(--shade-1); border-color: var(--line); border-style: solid; }
.ballot-slot-empty { min-height: 150px; border-radius: 24px; }
.slot-top { display: flex; align-items: center; gap: 8px; }
.slot-icon { width: 32px; height: 32px; color: #888; flex: 0 0 auto; }
.ballot-slot:hover .slot-icon { color: var(--ink); }
.slot-label { font-size: 15px; font-weight: 800; line-height: 1.25; }
.slot-role { font-size: 12px; color: #555; line-height: 1.45; }
.slot-sum { font-size: 11px; color: #777; line-height: 1.5; padding: 5px 10px; background: var(--shade-1); border: 1px solid var(--shade-3); border-radius: 14px; align-self: flex-start; max-width: 100%; }
.slot-term { font-size: 11px; color: #999; }
@media (max-width: 560px) {
  .slot-label { font-size: 14px; }
  .slot-role { display: none; }
}
.race-row {
  display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 4px 12px;
  width: 100%; text-align: left; padding: 14px 18px; cursor: pointer;
  background: var(--shade-0); border: 2px solid var(--line); border-radius: 12px;
}
.race-label { grid-column: 1; font-size: 19px; font-weight: 700; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.term { font-size: 12px; font-weight: 700; padding: 1px 7px;
  background: var(--shade-2); border: 1.5px solid var(--line); border-radius: 999px; }
.race-role { grid-column: 1; font-size: 13px; color: #333; line-height: 1.45; }
.race-sum { grid-column: 1; font-size: 12px; color: #666; }
.race-arrow { grid-row: 1 / 4; grid-column: 2; align-self: center; font-size: 24px; color: #888; }

.race-intro {
  margin: 0 0 14px; padding: 14px 16px;
  background: var(--shade-1); border: 2px solid var(--line); border-radius: 12px;
}
.race-intro-h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font-size: 20px; font-weight: 800; }
.race-intro-role { display: block; margin-top: 6px; font-size: 14px; color: #333; line-height: 1.5; }
.race-intro-what { display: block; margin-top: 6px; font-size: 13px; color: #555; line-height: 1.5; }
.race-intro-stat { display: inline-block; margin-top: 10px; padding: 4px 10px; font-size: 13px; font-weight: 700;
  background: var(--shade-2); border: 1.5px solid var(--line); border-radius: 999px; }
.race-intro-refs { display: block; margin-top: 8px; font-size: 12px; color: #555; }
.race-intro-refs a { color: var(--ink); font-weight: 700; }

/* 용어 각주 + 팝오버 */
.gl { border-bottom: 1px dotted #888; cursor: help; }
.gl:focus { outline: 2px solid var(--shade-3); outline-offset: 1px; }
.gl sup { font-size: 10px; padding-left: 1px; color: #555; font-weight: 700; }
.glossary-fn {
  list-style: none; padding: 10px 12px; margin: 12px 0 0;
  border: 1px solid #ddd; background: #f7f7f6;
  font-size: 12px; line-height: 1.55; border-radius: 4px;
}
.glossary-fn li { margin: 2px 0; }
.glossary-fn li b { font-weight: 700; }
.gl-pop {
  position: absolute; z-index: 100; display: none;
  background: #fff; border: 1px solid #555; border-radius: 4px;
  padding: 8px 10px; font-size: 12px; line-height: 1.45;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

.vote-note {
  margin: 0 0 14px; font-size: 14px; line-height: 1.5;
  padding: 10px 14px; background: var(--shade-1);
  border: 1.5px solid var(--line); border-left: 4px solid var(--line); border-radius: 6px;
}

/* 정보공개 카피 */
.disclosure { border-left: 4px solid var(--line); padding-left: 10px; }
.disc-copy { font-size: 14px; line-height: 1.55; margin-bottom: 6px; }

/* ===== PDF 모달 뷰어 ===== */
.pdf-modal {
  display: none; position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.6); padding: 16px;
}
.pdf-modal.open { display: flex; align-items: center; justify-content: center; }
.pdf-modal-box {
  display: flex; flex-direction: column; width: 100%; max-width: 800px; height: 92vh;
  background: var(--shade-0); border: 2px solid var(--line); border-radius: 12px; overflow: hidden;
}
.pdf-modal-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-bottom: 2px solid var(--line); font-weight: 700;
}
.pdf-nav { font-size: 14px; padding: 4px 10px; cursor: pointer;
  background: var(--shade-2); border: 1.5px solid var(--line); border-radius: 8px; }
.pdf-pageno { font-size: 14px; font-weight: 700; min-width: 48px; text-align: center; }
.pdf-modal-bar .pdf-ext { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--ink); }
.pdf-close {
  font-size: 18px; line-height: 1; padding: 4px 10px; cursor: pointer;
  background: var(--shade-2); border: 1.5px solid var(--line); border-radius: 8px;
}
.pdf-stage { position: relative; flex: 1 1 auto; min-height: 0; }
.pdf-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--shade-1); }
.pdf-loading {
  position: absolute; inset: 0; display: flex; gap: 10px; align-items: center; justify-content: center;
  background: var(--shade-1); font-size: 14px; color: #555;
}
.spinner {
  width: 18px; height: 18px; border: 3px solid var(--shade-3); border-top-color: var(--line);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pdf-hint { font-size: 12px; color: #666; text-align: center; padding: 6px; }

.footer {
  font-size: 12px; color: #555; text-align: center;
  padding: 24px 16px; border-top: 1.5px solid var(--shade-3); margin-top: 20px;
}
.footer-fine { font-size: 11px; color: #777; margin-top: 6px; max-width: 720px; margin-left: auto; margin-right: auto; line-height: 1.5; }

/* ===== 모바일 미세조정 ===== */
@media (max-width: 560px) {
  body { font-size: 16px; }
  #app { padding: 12px; }
  .topbar { padding: 12px 14px; }
  .topbar h1 { font-size: 16px; }
  .list-item { padding: 18px 16px; font-size: 18px; }
  .race-row { padding: 16px 16px; }
  .race-label { font-size: 18px; }
  .ballot-lead { font-size: 17px; }
  .pledge-title { font-size: 16px; }
}
