:root{
  --bg:#0b1020; --card:#0f1733; --muted:#8ea3c7;
  --primary:#6ae0da; --primary-2:#35cfc7;
  --border:#1f2a4a; --white:#f7fbff; --text:#111827;
  --radius:16px; --radius-sm:12px;
  --shadow:0 10px 30px rgba(0,0,0,.25);
}

/* ========== Reset & Base ========== */
*{box-sizing:border-box}
html,body{height:100%}
html{scroll-behavior:smooth}
body{
  margin:0; font-family:-apple-system,BlinkMacSystemFont,"Noto Sans KR","Pretendard",system-ui,sans-serif;
  color:var(--text); background:#fff;
}
a{text-decoration:none;color:var(--primary)}
a:hover{color:var(--primary-2)}
.is-hidden{display:none !important} /* ✅ 검색 전 툴바 숨김 유지 */

/* ========== App Layout ========== */
#app{min-height:100vh;display:flex;flex-direction:column}
.site-header{
  background:linear-gradient(180deg,#0b1020,#0b1228);
  color:var(--white); border-bottom:1px solid var(--border);
}
.site-main{flex:1 0 auto;background:#fff;padding:24px 0;min-height:40vh}
.site-footer{background:#0b1226;color:#cfe1ff;border-top:1px solid var(--border)}
.container{max-width:1200px;margin:0 auto;padding:0 18px}
.container--narrow{max-width:900px}
.container--fluid{max-width:none;padding-left:clamp(12px,4vw,28px);padding-right:clamp(12px,4vw,28px)}
.header-inner{display:flex;align-items:center;justify-content:space-between;padding:16px 0}
.logo{display:flex;align-items:center;gap:10px;font-weight:800;letter-spacing:.2px;color:#fff}
.logo .spark{
  width:34px;height:34px;border-radius:12px;
  background:radial-gradient(circle at 30% 30%,#8af7f1 0%,#35cfc7 45%,#0d6f7a 100%);
  box-shadow:0 6px 24px rgba(53,207,199,.45), inset 0 0 20px rgba(255,255,255,.2)
}
.logo b{color:#fff}
.logo em{font-style:normal;color:var(--primary)}

/* ========== Hero / Search ========== */
.hero{margin:0 auto}
.hero--center{
  display:flex;flex-direction:column;justify-content:center;align-items:center;
  min-height:min(30vh,680px);
  padding-top:clamp(16px,5vh,48px); padding-bottom:clamp(12px,4vh,40px);
  text-align:center;
}
.hero .title{font-size:clamp(24px,3.2vw,36px);font-weight:800;margin:0 0 8px}
.hero .subtitle{color:#444;margin:0 0 16px;line-height:180%;word-wrap: break-word;
  overflow-wrap: break-word;text-align:left;
  word-break: keep-all;
  white-space: normal;}
.t-primary{color:#0aa9a3}

.searchbar{
  display:flex;gap:10px;align-items:center;
  background:#f1f5f9;border:1px solid #e2e8f0;border-radius:var(--radius);
  padding:14px;width:min(780px,100%);margin:0 auto;
}
.searchbar input{flex:1;padding:12px 14px;border:1px solid #d1d5db;border-radius:12px;outline:none}
.btn{
  padding:12px 16px;border:0;border-radius:12px;cursor:pointer;
  color:#00101a;font-weight:700;white-space:nowrap;
  background:linear-gradient(180deg,var(--primary) 0%,var(--primary-2) 100%);
  box-shadow:0 8px 18px rgba(106,224,218,.25);
}

/* ========== Source chips ========== */
.sources{
  display:flex;
  flex-wrap: wrap; /* (★추가) 화면이 좁아지면 줄 바꿈을 허용합니다. */
  justify-content: center; /* (★추가) 줄 바꿈 시 아이템들을 가운데 정렬합니다. */
  gap:12px;
  align-items:center;
  margin-top:10px;
  color:#334155;
  font-size:13px
}
.pill{display:inline-flex;align-items:center;gap:8px;background:#eef2f7;border:1px solid #e2e8f0;border-radius:999px;padding:8px 12px}
.hint{font-size:12px;color:#64748b}

/* ========== Loading bars ========== */
.inline-loading{
  height:3px;border-radius:999px;background:#e2e8f0;margin:12px 0 0;
  overflow:hidden;position:relative;opacity:0;transition:opacity .2s ease;
}
.inline-loading.active{opacity:1}
.inline-loading::after{
  content:"";position:absolute;left:-30%;top:0;width:30%;height:100%;
  background:linear-gradient(90deg,transparent,#1fbfb8,transparent);animation:loadline 1.2s infinite;
}
@keyframes loadline{0%{left:-30%}100%{left:100%}}
.overlay{
  position:fixed;inset:0;display:none;align-items:center;justify-content:center;
  background:rgba(9,12,24,.35);z-index:9999;backdrop-filter:blur(2px)
}
.overlay.active{display:flex}
.loading-card{
  background:#0e1630;color:#d9f9f7;border:1px solid var(--border);
  border-radius:var(--radius);padding:16px 18px;box-shadow:var(--shadow);
  display:flex;gap:10px;align-items:center
}
.dots::after{
  content:"";display:inline-block;width:40px;height:10px;margin-left:6px;
  background:radial-gradient(circle,#9af1eb 30%,transparent 31%) 0 50%/10px 10px repeat-x;
  animation:dots 1.2s steps(4) infinite
}
@keyframes dots{to{transform:translateX(40px)}}


.card .meta .size-line{
  font-size:.85rem;
  color:#64748b;
  margin:2px 0 4px;
}


/* ========== Search Form Section (검색창 섹션) ========== */
.search-form-section{
  position:sticky; top:0; z-index:45;
  padding:16px clamp(12px,4vw,28px);
  background:linear-gradient(180deg,#f8fafc 0%,#ffffff 100%);
  border-bottom:2px solid #e2e8f0;
  box-shadow:0 2px 8px rgba(0,0,0,.08);
}

/* ========== Results Toolbar (선택 다운로드 옵션) ========== */
/* ✅ 검색 전엔 .is-hidden으로 안보임. 검색 결과 렌더되면 JS가 클래스 제거 */
.results-toolbar{
  position:sticky; top:var(--search-section-height, 120px); z-index:44;
  display:flex; flex-wrap:wrap; gap:12px; align-items:center; justify-content:space-between;
  padding:12px clamp(12px,4vw,28px);
  background:linear-gradient(180deg,#0b1226 0%,#0b142e 100%);
  color:#f8fafc; border-bottom:1px solid rgba(255,255,255,.1);
  box-shadow:0 3px 8px rgba(0,0,0,.25);
}
.toolbar-left{display:flex;gap:18px;flex-wrap:wrap;align-items:center}
.toolbar-right{display:flex;gap:12px;align-items:center;margin-left:auto}
.results-toolbar label,
.results-toolbar span,
.results-toolbar .hint{color:#e2e8f0}
.results-toolbar .hint{opacity:.8}
.results-toolbar .btn{
  background:linear-gradient(180deg,#35cfc7 0%,#18a8a0 100%);
  color:#fff; border:1px solid rgba(255,255,255,.2); box-shadow:0 6px 16px rgba(53,207,199,.35);
  transition:all .15s ease;
}
.results-toolbar .btn:hover{transform:translateY(-1px);background:linear-gradient(180deg,#43dfd5 0%,#14b8a6 100%)}




/* ========== Grid ========== */
.grid{
  width:100%; display:grid;
  grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
  gap:14px; padding:18px 0 26px;
}
.card{
  background:#fff;border:1px solid #e5e7eb;border-radius:var(--radius-sm);
  overflow:hidden;box-shadow:0 2px 10px rgba(0,0,0,.06);position:relative
}
.card img{width:100%;height:clamp(200px,26vh,280px);object-fit:cover;background:#f1f5f9}
.badge{
  position:absolute;top:10px;left:10px;font-size:12px;
  padding:6px 10px;border-radius:999px;background:rgba(255,255,255,.9);
  border:1px solid #e5e7eb;color:#334155
}
.select{
  position:absolute;top:10px;right:10px;font-size:12px;
  padding:6px 10px;border-radius:10px;background:#14b8a6;color:#001118;
  font-weight:800;cursor:pointer;box-shadow:0 6px 16px rgba(20,184,166,.25)
}
.meta{
  display:flex;justify-content:space-between;align-items:center;gap:8px;
  padding:10px 12px;color:#475569;font-size:12px;border-top:1px solid #e5e7eb
}
.meta a{color:#0ea5e9}

/* ========== Footer ========== */
.footer-inner{display:flex;flex-wrap:wrap;gap:12px;align-items:center;justify-content:space-between;padding:18px 0}
.fine{font-size:12px;color:#b9c8e6}
.src-note{margin-top:6px;font-size:12px;color:#9db2d6}

/* ========== Single Mobile Breakpoint: 공통 처리 (<=720px) ========== */
@media (max-width: 720px){
  /* 검색 입력 UI 세로 스택 */
  .searchbar{flex-direction:column;align-items:stretch}

  /* 툴바는 세로 스택 + 버튼은 오른쪽 정렬 유지 */
  .results-toolbar{align-items:stretch}
  .toolbar-left,.toolbar-right{width:100%}
  .toolbar-left{order:1;justify-content:space-between;row-gap:8px}
  .toolbar-right{order:2;justify-content:flex-end}

  /* 그리드 폭 줄었을 때 카드 높이 살짝 낮춤(가독) */
  .card img{height:clamp(180px,28vh,260px)}


  .hero .title{font-size:18px;font-weight:800;margin:0 0 8px}
  .hero .subtitle{font-size:14px}

  .site-footer{padding:0px 10px}
  
  /* 검색 폼 섹션 모바일 대응 */
  .search-form-section{padding:12px;}
  
  /* 모바일에서 툴바 위치 조정 */
  .results-toolbar{top:var(--search-section-height, 140px);}
}


/* ========================= */
/* 정책보기 모달 스타일 (추가) */
/* ========================= */

.modal-overlay {
  /* 1. 기본 상태: 숨김 & 전체 화면 덮기 */
  display: none; /* (★) 기본 숨김 */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  
  /* 2. 배경 (바닥 레이어) */
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px); /* (선택) 뒷배경 흐리게 */
  z-index: 1000;
  
  /* 3. 내용물(팝업)을 중앙 정렬 (flex) */
  align-items: center;
  justify-content: center;
  
  /* (참고) .is-visible 클래스가 붙으면 display: flex;로 보임 */
}

/* (★) JS가 이 클래스를 붙여서 모달을 보이게 함 */
.modal-overlay.is-visible {
  display: flex; 
}

/* 4. 실제 팝업창 (흰색 박스) */
.modal-content {
  background: #fff;
  padding: 1.5em 2.5em 2.5em 2.5em; /* 닫기 버튼 공간 확보 */
  border-radius: 8px;
  max-width: 700px; /* 팝업 최대 가로폭 */
  width: 90%; /* 모바일 화면 대응 */
  max-height: 80vh; /* 화면보다 길어지지 않게 */
  overflow-y: auto; /* 내용 길어지면 스크롤 */
  position: relative; /* 닫기 버튼 기준점 */
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* 5. 팝업 내부 닫기 버튼 (X) */
.modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 2.2rem;
  font-weight: bold;
  color: #aaa;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.modal-close:hover {
  color: #333;
}

/* ========================= */
/* (★추가) 선택 카드 스타일 */
/* ========================= */

/* 2. 카드 전체를 클릭 가능하게 (마우스 커서) */
.card {
  cursor: pointer;
  outline: 3px solid transparent; /* 선택 시 테두리 공간 확보 */
  transition: outline 0.15s ease-in-out;
}

/* 2. 카드가 선택되었을 때 (is-selected 클래스) */
.card.is-selected {
  outline: 3px solid #14b8a6; /* jQuery .css() 대신 클래스로 제어 */
}

/* 3. '선택' 텍스트 대신 '숫자 배지' 스타일 */
.select-badge {
  /* (기본) 숨김 */
  display: none; 
  
  /* (공통) 위치 */
  position: absolute;
  top: 8px;
  right: 8px;
  
  /* (디자인) 빨간 원 + 흰 글씨 */
  background-color: #ef4444; /* 빨간색 */
  color: #ffffff; /* 흰색 */
  font-size: 14px;
  font-weight: bold;
  line-height: 1;
  
  /* (크기) 원형 */
  width: 28px;
  height: 28px;
  border-radius: 50%;
  
  /* (정렬) 숫자 가운데 정렬 */
  align-items: center;
  justify-content: center;
  
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  z-index: 5;
}

/* 카드가 선택되었을 때(is-selected)만 숫자 배지를 보여줌 */
.card.is-selected .select-badge {
  display: flex;
}



/* === [광고 카드: 이미지 카드와 동일한 칸/높이로 반응형] === */
.grid .card.card--ad {
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:var(--radius-sm);
  overflow:hidden;
  box-shadow:0 2px 10px rgba(0,0,0,.06);
  text-align:center;
}
.grid .card.card--ad .adsbygoogle {
  width:100%;
  height:clamp(200px,26vh,280px);
  display:block;
}
