@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");

:root {
  --brand: #fa9c2a;
  --brand-strong: #e8820e;
  --brand-deep: #d97706;
  --brand-tint: #fff7ec;
  --bg: #f4f5f7;
  --fg: #111418;
  --fg-sub: #4e5561;
  --fg-mute: #8b929e;
  --card: #ffffff;
  --line: #eceef1;
  --line-strong: #dfe2e7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 24, 33, 0.03);
  --shadow-hover: 0 2px 8px rgba(20, 24, 33, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    system-ui, Roboto, "Helvetica Neue", "Segoe UI", "Apple SD Gothic Neo",
    "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------- 검색 히어로 ---------- */
body { background: linear-gradient(180deg, #fff8f0 0%, #ffffff 240px, var(--bg) 420px) no-repeat, var(--bg); }
.hero {
  position: relative;
  padding: 14px 20px 0;
}
.hero-main { display: flex; align-items: center; gap: 28px; max-width: 760px; margin: 0 auto; }
.hero .logo { display: inline-block; flex-shrink: 0; }
.hero .logo img { height: 26px; width: auto; }
.hero .search-form {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  max-width: none;
  margin: 0;
  background: var(--card);
  border: 2px solid var(--brand);
  border-radius: 26px;
  padding: 4px 4px 4px 20px;
  box-shadow: 0 2px 8px rgba(20, 24, 33, 0.06);
  transition: box-shadow 180ms ease;
}
.hero .search-form:focus-within { box-shadow: 0 3px 12px rgba(20, 24, 33, 0.1); }
.hero .search-form input {
  flex: 1;
  border: 0;
  outline: 0;
  font-size: 16px;
  font-family: inherit;
  background: transparent;
  color: var(--fg);
}
.hero .search-form input::placeholder { color: var(--fg-mute); }
.hero .search-form button {
  border: 0;
  background: var(--brand);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 150ms ease;
}
.hero .search-form button:hover { background: var(--brand-strong); }

/* ---------- 검색 아래 주요 메뉴 ---------- */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex-wrap: wrap;
  padding: 7px 0 8px;
  border-bottom: 1px solid var(--line);
}
.site-nav a, .site-nav button {
  border: 0;
  border-radius: 7px;
  padding: 7px 10px;
  background: transparent;
  color: var(--fg-sub);
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
}
.site-nav a:hover, .site-nav button:hover { color: var(--fg); background: rgba(20, 24, 33, 0.045); }
.site-nav-divider {
  width: 1px;
  height: 14px;
  margin: 0 5px;
  background: var(--line-strong);
}
html:not([data-mode]) .site-nav [data-mode="basic"],
html[data-mode="links"] .site-nav [data-mode="links"] {
  background: #fff;
  color: var(--fg);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(20, 24, 33, 0.12);
}

#mode-links, #mode-apps { display: none; }
#mode-apps { display: none !important; }
html[data-mode] #mode-basic { display: none; }
html[data-mode="links"] #mode-links,
html[data-mode="apps"] #mode-apps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}
@media (max-width: 900px) {
  html[data-mode="links"] #mode-links,
  html[data-mode="apps"] #mode-apps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  html[data-mode="links"] #mode-links { grid-template-columns: 1fr; gap: 12px; }
  .shortcut-directory .dir-card { padding: 16px; }
}
/* 모바일앱 모드: 카테고리별 앱 그리드 */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px 6px;
}
.app-card { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.app-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 8px 4px 0;
  border-radius: var(--radius-sm);
  min-width: 0;
  width: 100%;
}
.app-main img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 9px;
  transition: transform 150ms ease, border-color 150ms ease;
}
.app-main:hover img { transform: translateY(-2px); border-color: #c9ced6; }
.app-name {
  font-size: 12px;
  font-weight: 500;
  color: #3c4046;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stores { display: flex; gap: 3px; }
.stores a {
  font-size: 10px;
  color: var(--fg-mute);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
}
.stores a:hover { color: var(--fg); border-color: #c9ced6; }

.shortcut-directory .dir-card {
  position: relative;
  overflow: hidden;
  height: 100%;
  box-sizing: border-box;
  padding: 18px;
  border: 1px solid #e4e6eb;
  border-radius: 16px;
  background: linear-gradient(145deg, #fff 0%, #fff 72%, #fffaf4 100%);
  box-shadow: 0 5px 16px rgba(20, 24, 33, .045);
}
.shortcut-directory .dir-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), #ffd08c);
}
.dir-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 700;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
}
.dir-card h3::before {
  content: "";
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--brand), var(--brand-deep));
  flex-shrink: 0;
}
.dir-count { margin-left: auto; color: var(--fg-mute); font-size: 11px; font-weight: 600; }
.dir-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 8px;
}

/* ---------- 본문 2단 그리드 ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 332px;
  gap: 14px;
  align-items: start;
}
@media (max-width: 1023px) {
  .layout { grid-template-columns: 1fr; }
}
.main-col, .rail-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* ---------- 카드 공통 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 17px 20px 18px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15.5px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}
.card-head h2::before {
  content: "";
  width: 4px;
  height: 15px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--brand), var(--brand-deep));
  flex-shrink: 0;
}
.card-head .more {
  font-size: 12px;
  color: var(--fg-mute);
}
.card-head .more:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- 뉴스피드 ---------- */
.news-tabs {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin: -4px 0 6px;
  border-bottom: 1px solid var(--line);
}
.news-tabs button {
  border: 0;
  background: transparent;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--fg-mute);
  padding: 7px 1px 9px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  min-height: 36px;
}
.news-tabs button:hover { color: var(--fg); }
.news-tabs button.active { color: var(--fg); font-weight: 700; border-bottom-color: var(--fg); }
.news-panel { display: none; }
.news-panel.active { display: block; }
.news-headline {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--line);
}
.news-headline img {
  width: 148px;
  height: 96px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
  background: var(--line);
}
.news-headline .txt { min-width: 0; }
.news-headline .hl-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.4;
  color: var(--fg);
}
.news-headline:hover .hl-title { text-decoration: underline; text-underline-offset: 3px; }
.news-headline .src { display: block; font-size: 12px; color: #9aa0a8; margin-top: 6px; }
.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(var(--rows, 5), auto);
  grid-auto-flow: column;
  gap: 0 28px;
}
@media (max-width: 700px) {
  .news-list { grid-template-columns: 1fr; grid-auto-flow: row; grid-template-rows: none; }
  .news-headline img { width: 110px; height: 76px; }
  .news-headline .hl-title { font-size: 15px; }
}
.news-list li { min-width: 0; }
.news-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f1f3f5;
  min-height: 42px;
}
.news-list li.col-bottom a { border-bottom: 0; }
.news-list img {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--line);
}
.news-list .txt { min-width: 0; }
.news-list .title {
  font-size: 13px;
  font-weight: 400;
  color: #26282b;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  letter-spacing: -0.01em;
  line-height: 1.45;
}
.news-list a:hover .title { text-decoration: underline; text-underline-offset: 2px; }
.news-list .src { display: block; font-size: 11px; color: #9aa0a8; margin-top: 2px; }

/* ---------- 인기영상 ---------- */
.video-grid { display: none; grid-template-columns: repeat(4, 1fr); gap: 16px 14px; }
.video-grid.active { display: grid; }
@media (max-width: 700px) { .video-grid { grid-template-columns: 1fr; } }
.video-card { display: block; min-width: 0; }
.video-dots { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.video-dots button { width: 8px; height: 8px; padding: 0; border: none; border-radius: 50%; background: var(--line); cursor: pointer; }
.video-dots button.active { width: 20px; border-radius: 4px; background: var(--brand); }
.video-card .thumb {
  display: block;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--line);
}
.video-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 250ms ease; }
.video-card:hover .thumb img { transform: scale(1.04); }
.video-card .thumb::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 40%;
  background: linear-gradient(180deg, transparent, rgba(10, 14, 20, 0.28));
  pointer-events: none;
}
.video-card .play {
  position: absolute;
  left: 8px;
  bottom: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(17, 20, 24, 0.72);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-card .title {
  font-size: 13px;
  font-weight: 500;
  margin-top: 8px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  letter-spacing: -0.01em;
}
.video-card .channel { display: block; }
.video-card:hover .title { text-decoration: underline; text-underline-offset: 2px; }
.video-card .channel { font-size: 11.5px; color: var(--fg-mute); margin-top: 2px; }

/* ---------- 오늘 위젯: 날씨 + 증시 (레일) ---------- */
.today-card { padding: 12px 12px 14px; }
.weather {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 9px;
  padding: 14px 16px;
}
.weather-link { position: relative; color: inherit; transition: filter 150ms ease; }
.weather-link:hover { filter: brightness(.98); }
.detail-arrow { position: absolute; top: 10px; right: 12px; color: currentColor; font-size: 14px; opacity: .48; }
.w-bg-sunny  { background: linear-gradient(120deg, #fff3dd 0%, #fffdf6 70%); }
.w-bg-cloudy { background: linear-gradient(120deg, #eef1f6 0%, #fafbfd 70%); }
.w-bg-rain   { background: linear-gradient(120deg, #e7f0fc 0%, #f8fbff 70%); }
.w-bg-snow   { background: linear-gradient(120deg, #eaf6fd 0%, #fbfeff 70%); }
.w-icon { flex-shrink: 0; display: flex; }
.w-sunny { color: #f59e0b; }
.w-cloudy { color: #8895a7; }
.w-rain { color: #4d94f2; }
.w-snow { color: #5ec3ef; }
.w-main { display: flex; flex-direction: column; min-width: 0; }
.w-temp { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.w-desc { font-size: 12.5px; color: var(--fg-sub); margin-top: 2px; }
.w-sub {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 12px;
  color: var(--fg-mute);
}
.w-sub b { font-weight: 600; }
.dust-good { color: #2563eb; }
.dust-normal { color: #16a34a; }
.dust-bad { color: #dc2626; }
.today-sep { border: 0; margin: 6px 0 2px; }
.finance-list { list-style: none; margin: 0; padding: 0 8px; }
.finance-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4.5px 0;
  font-size: 13px;
}
.finance-link { position: relative; display: flex; align-items: center; width: 100%; color: inherit; }
.finance-link:hover { color: var(--brand-deep); }
.finance-link .detail-arrow { position: static; margin-left: 7px; font-size: 12px; }
.f-name { color: var(--fg-sub); }
.f-value { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.f-change { font-size: 12px; min-width: 64px; text-align: right; color: var(--fg-mute); font-variant-numeric: tabular-nums; }
/* 국내 관례: 상승 빨강 / 하락 파랑 */
.f-change.up { color: #dc2626; }
.f-change.down { color: #2563eb; }

/* ---------- 실시간 이슈 키워드 (레일) ---------- */
.trend-list { list-style: none; margin: 0; padding: 0; }
.trend-list a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 0;
  font-size: 13px;
  min-height: 30px;
}
.trend-list .rank {
  width: 20px;
  height: 20px;
  line-height: 20px;
  font-weight: 700;
  font-size: 12px;
  color: var(--fg-mute);
  text-align: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  border-radius: 6px;
}
.trend-list li:nth-child(-n+3) .rank {
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: #fff;
}
.trend-list .kw {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.trend-list a:hover .kw { color: var(--brand-strong); text-decoration: underline; text-underline-offset: 2px; }
.tr-badges { display: flex; align-items: center; gap: 5px; margin-left: auto; flex-shrink: 0; }
.tr-up { color: #dc2626; font-size: 10px; }
.tr-down { color: #2563eb; font-size: 10px; }
.tr-new { color: var(--brand-strong); font-size: 10px; font-weight: 700; }
.tr-hot { color: #ea580c; font-size: 10px; font-weight: 700; }

/* ---------- 오늘의 이슈 (레일, LLM 클러스터링) ---------- */
.topic-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: #3c4046;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 11px;
  transition: border-color 130ms ease, color 130ms ease;
}
.topic-chip b {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--brand-strong);
}
.topic-chip:hover { border-color: var(--brand); color: var(--brand-deep); }

/* ---------- 추천상품 ---------- */
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; list-style: none; margin: 0; padding: 0; }
.product-grid a { display: block; min-width: 0; }
.product-image { display: block; overflow: hidden; aspect-ratio: 1; border-radius: 9px; background: var(--line); }
.product-image img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 180ms ease; }
.product-grid a:hover .product-image img { transform: scale(1.04); }
.product-name { display: -webkit-box; overflow: hidden; margin-top: 7px; font-size: 13px; line-height: 1.4; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.product-grid a:hover .product-name { color: var(--brand-deep); }
.product-price { display: block; margin-top: 3px; color: var(--brand-deep); font-size: 13.5px; font-weight: 700; }
.keyword-products { padding-bottom: 20px; }
.keyword-product-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.keyword-product-group { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.keyword-product-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.keyword-product-head a { color: var(--fg); }
.keyword-product-head a:hover { color: var(--brand-deep); }
.keyword-product-head strong { font-size: 15px; }
.keyword-product-head span { color: var(--fg-mute); font-size: 12px; }
.keyword-product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; list-style: none; margin: 0; padding: 0; }
.keyword-product-grid a { display: block; min-width: 0; }
.keyword-product-image { display: block; overflow: hidden; aspect-ratio: 1; border-radius: 9px; background: var(--line); }
.keyword-product-image img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 180ms ease; }
.keyword-product-grid a:hover .keyword-product-image img { transform: scale(1.04); }
.keyword-product-name { display: -webkit-box; overflow: hidden; margin-top: 5px; font-size: 11.5px; line-height: 1.35; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.keyword-product-price { display: block; margin-top: 2px; color: var(--brand-deep); font-size: 12px; font-weight: 700; }

@media (max-width: 760px) {
  .keyword-product-groups { grid-template-columns: 1fr; }
}

/* ---------- 쇼핑 트렌드 ---------- */
.shop-trend-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.shop-trend-item { display: block; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 9px; }
.shop-trend-item:hover { border-color: var(--brand); background: var(--brand-tint); }
.shop-trend-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.shop-trend-top strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.shop-keyword-category { flex-shrink: 0; color: var(--fg-mute); font-size: 10px; }
.shop-trend-state { flex-shrink: 0; font-size: 10.5px; font-weight: 700; }
.shop-trend-state.surging { color: #d66b00; }
.shop-trend-state.fading { color: #4f7fba; }
.shop-trend-state.steady { color: var(--fg-mute); }
.shop-spark { display: flex; align-items: end; gap: 3px; height: 30px; margin-top: 9px; }
.shop-spark i { flex: 1; min-width: 2px; border-radius: 2px 2px 0 0; background: var(--brand); opacity: .72; }
.shop-trend-meta { display: block; overflow: hidden; margin-top: 7px; color: var(--fg-mute); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 쇼핑 바로가기 (레일) ---------- */
.partner-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  font-size: 13px;
  color: var(--fg-sub);
}
.partner-links a {
  padding: 4px 2px;
  font-weight: 500;
}
.partner-links a:hover { color: var(--brand-strong); }
.partner-links .sep { color: var(--line-strong); padding: 4px 7px; }

/* ---------- SW TOP10 (레일) ---------- */
.sw-tabs {
  display: flex;
  gap: 14px;
  margin-bottom: 6px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.sw-tabs button {
  border: 0;
  background: transparent;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-mute);
  padding: 5px 1px 8px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.sw-tabs button:hover { color: var(--fg); }
.sw-tabs button.active { color: var(--fg); font-weight: 700; border-bottom-color: var(--fg); }
.sw-list { list-style: none; margin: 0; padding: 0; display: none; }
.sw-list.active { display: block; }
.sw-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6.5px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.sw-list li:last-child a { border-bottom: 0; }
.sw-list .rank {
  width: 18px;
  height: 18px;
  line-height: 18px;
  font-weight: 700;
  font-size: 11.5px;
  color: var(--fg-mute);
  text-align: center;
  flex-shrink: 0;
  border-radius: 5px;
}
.sw-list li:nth-child(-n+3) .rank {
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: #fff;
}
.sw-list a:hover { color: var(--brand-strong); }

/* ---------- 광고 ---------- */
.ad-slot { overflow: hidden; }
.ad-slot:empty { display: none; }
/* AdSense가 광고를 채우지 못한 슬롯은 빈 카드로 남지 않게 접는다 */
ins.adsbygoogle[data-ad-status="unfilled"] { display: none !important; }
.ad-slot:has(> ins.adsbygoogle[data-ad-status="unfilled"]) { display: none; }

/* ---------- 카테고리 바로가기 (하단) ---------- */
.category-card .cat-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.cat-tabs button {
  border: 1px solid var(--line-strong);
  background: var(--card);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-sub);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 130ms ease, color 130ms ease;
  min-height: 34px;
}
.cat-tabs button:hover { border-color: #c9ced6; color: var(--fg); }
.cat-tabs button.active {
  background: #26282b;
  border-color: #26282b;
  color: #fff;
  font-weight: 600;
}
.link-grid {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  gap: 8px;
}
.link-grid.active { display: grid; }
.link-card {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  min-height: 44px;
  box-sizing: border-box;
  background: #fff;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}
.link-card:hover {
  border-color: var(--brand);
  background: #fffaf5;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(20, 24, 33, .06);
}
.link-card img { width: 24px; height: 24px; padding: 3px; object-fit: contain; border: 1px solid #eef0f3; border-radius: 7px; background: #fff; }
.link-card span { font-size: 13px; font-weight: 500; letter-spacing: -0.01em; color: #3c4046; }

/* ---------- 폴백 ---------- */
.content-fallback { font-size: 13px; color: var(--fg-mute); padding: 10px 0; }
.error-card { text-align: center; padding: 48px 20px; }
.error-card h1 { font-size: 18px; margin: 0 0 8px; }
.error-ref { font-size: 12.5px; color: var(--fg-mute); margin: 10px 0 0; }
.error-ref code { background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; }
.error-home-link {
  display: inline-block;
  margin-top: 20px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--brand-deep);
  border: 1px solid var(--brand);
  border-radius: 8px;
  padding: 8px 18px;
}
.error-home-link:hover { background: var(--brand-tint); }

/* ---------- 푸터 ---------- */
.site-footer {
  margin-top: 40px;
  padding: 26px 0 48px;
  border-top: 1px solid var(--line-strong);
  font-size: 12.5px;
  color: var(--fg-mute);
}
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-bottom: 12px; }
.footer-links a:hover { color: var(--brand-strong); }
.footer-copy { color: #a8aeb8; text-align: center; }

/* ---------- 서브페이지 헤더 (법적 페이지 등) ---------- */
.sub-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.sub-header .inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 0;
}
.sub-header .logo img { height: 24px; width: auto; }
.sub-header .search-form {
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 440px;
  border: 1.5px solid var(--brand);
  border-radius: 20px;
  padding: 3px 3px 3px 16px;
}
.sub-header .search-form input { flex: 1; border: 0; outline: 0; font-size: 14px; font-family: inherit; background: transparent; }
.sub-header .search-form button {
  border: 0;
  background: var(--brand);
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- 검색 결과 페이지 ---------- */
.search-header .search-form { max-width: 560px; }
.search-tabs {
  display: flex;
  gap: 18px;
  padding: 0 20px;
  border-top: 1px solid var(--line);
}
.search-tabs a {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--fg-mute);
  padding: 9px 1px 10px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.search-tabs a:hover { color: var(--fg); }
.search-tabs a.active { color: var(--fg); font-weight: 700; border-bottom-color: var(--brand); }
.search-layout { margin-top: 16px; }
.mock-note {
  font-size: 12px;
  color: var(--brand-deep);
  background: var(--brand-tint);
  border-radius: 8px;
  padding: 7px 12px;
  margin: 0;
}
/* 위키 즉답카드 */
.answer-card { border-color: var(--brand); display: flex; gap: 16px; align-items: flex-start; }
.answer-card-img { width: 96px; height: 120px; object-fit: cover; object-position: top; border-radius: 8px; flex-shrink: 0; background: var(--line); }
.answer-card-body { min-width: 0; flex: 1; }
.answer-card .card-head { display: flex; align-items: baseline; gap: 8px; }
.answer-card-type {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--brand-deep);
  background: var(--brand-tint);
  border-radius: 999px;
  padding: 2px 9px;
}
.answer-card-summary {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--fg-sub);
  margin: 6px 0 10px;
}
.answer-card-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px 16px;
  margin: 0;
}
.answer-card-fields > div { display: flex; gap: 8px; font-size: 13px; }
.answer-card-fields dt { color: #9aa0a8; flex-shrink: 0; }
.answer-card-fields dd { margin: 0; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.answer-card-src { font-size: 11px; color: #9aa0a8; margin: 10px 0 0; }
.answer-card-src a { color: #1a56b0; }
.answer-card-src a:hover { text-decoration: underline; text-underline-offset: 2px; }

.answer-disambig-list { list-style: none; margin: 8px 0 0; padding: 0; }
.answer-disambig-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #f1f3f5;
}
.answer-disambig-list li:last-child { border-bottom: 0; }
.answer-disambig-list a { font-size: 14.5px; font-weight: 700; color: #1a56b0; }
.answer-disambig-list a:hover { text-decoration: underline; text-underline-offset: 2px; }
.answer-disambig-year { font-size: 12px; color: #9aa0a8; }
.answer-disambig-type {
  font-size: 11.5px;
  color: var(--brand-deep);
  background: var(--brand-tint);
  border-radius: 999px;
  padding: 2px 9px;
}

/* 사이트 바로가기 (gourl) */
.gourl-card { border-color: var(--brand); }
.gourl-list { list-style: none; margin: 0; padding: 0; }
.gourl-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f1f3f5;
  min-height: 40px;
}
.gourl-list li:last-child a { border-bottom: 0; }
.gourl-list img { width: 22px; height: 22px; border-radius: 5px; object-fit: contain; flex-shrink: 0; }
/* title/desc를 한 컨테이너로 묶어 min-width:0을 줘야 url(끊어질 수 없는 긴 문자열)이
   flex 계산에서 이 칸을 0에 가깝게 짜부러뜨리는 걸 막을 수 있다 — 안 그러면 한글이
   세로로 한 글자씩 쌓이는 렌더링이 나온다 */
.g-text {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
  overflow: hidden;
}
.g-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #1a56b0;
  flex-shrink: 0;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gourl-list a:hover .g-title { text-decoration: underline; text-underline-offset: 2px; }
.g-desc {
  font-size: 12.5px;
  color: var(--fg-mute);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.g-url {
  font-size: 12px;
  color: #2e9e44;
  flex-shrink: 0;
  max-width: 220px;
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-suggest {
  font-size: 13.5px;
  color: var(--fg-mute);
  margin: 0 0 12px;
}
.sr-suggest a { color: #1a56b0; }
.sr-suggest a:hover { text-decoration: underline; text-underline-offset: 2px; }

.sr-sort {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  font-size: 12.5px;
  color: var(--fg-mute);
  margin: 0 0 8px;
}
.sr-sort a { font-weight: 500; }
.sr-sort a:hover { color: var(--fg); }
.sr-sort a.active { color: var(--brand-deep); font-weight: 700; }

.sr-list { list-style: none; margin: 0; padding: 0; }
.sr-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 13px 0;
  border-bottom: 1px solid #f1f3f5;
}
.sr-list li:last-child .sr-item { border-bottom: 0; }
.sr-item .txt { min-width: 0; flex: 1; }
.sr-item img {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: var(--line);
}
.sr-title {
  display: block;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.45;
  color: #1a56b0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.sr-item:hover .sr-title { text-decoration: underline; text-underline-offset: 2px; }
.sr-title strong, .sr-desc strong { font-weight: 700; color: inherit; }
.search-layout .video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 14px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.video-item {
  display: block;
  min-width: 0;
  color: inherit;
}
.video-thumb {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 9px;
  background: var(--line);
}
.video-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease;
}
.video-item:hover .video-thumb img { transform: scale(1.035); }
.video-play {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  padding-left: 2px;
  border-radius: 50%;
  background: rgba(15, 18, 24, 0.78);
  color: #fff;
  font-size: 12px;
}
.video-text { display: block; padding: 9px 2px 0; }
.video-item .sr-title { color: var(--fg); font-weight: 700; }
.video-item:hover .sr-title { color: var(--brand-deep); text-decoration: none; }
.video-item .sr-meta { margin-top: 6px; }
.sr-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  color: var(--fg-sub);
  margin-top: 4px;
  line-height: 1.5;
}
.sr-meta { display: block; font-size: 12px; color: #9aa0a8; margin-top: 5px; }
.sr-empty { font-size: 14.5px; margin: 4px 0 2px; }
.sr-paging {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding-top: 14px;
  margin-top: 4px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--fg-sub);
}
.sr-paging a { font-weight: 600; }
.sr-paging a:hover { color: var(--brand-deep); }
.sr-more-link {
  display: block;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-sub);
  padding: 12px 0 2px;
  margin-top: 4px;
  border-top: 1px solid var(--line);
}
.sr-more-link:hover { color: var(--brand-deep); }

/* ---------- 법적 페이지 ---------- */
.legal-page {
  max-width: 860px;
  margin: 28px auto;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 36px;
}
.legal-page h1 { font-size: 21px; margin-top: 0; letter-spacing: -0.02em; }
.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 13px;
  color: var(--fg-sub);
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.legal-nav a:hover { color: var(--brand-strong); }
.legal-nav a.active { color: var(--brand-strong); font-weight: 700; }

/* 레거시 약관 HTML을 현재 폭·타이포그래피에 맞춤 */
.legal-page { max-width: 960px; margin: 24px auto 40px; padding: 26px 32px 40px; border: 1px solid var(--line); }
.legal-page > h1 { margin: 0 0 20px; font-size: 24px; letter-spacing: -0.04em; }
.legal-nav { gap: 6px; margin-bottom: 26px; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.legal-nav a { padding: 8px 11px; border-radius: 7px; font-size: 12.5px; transition: background 140ms ease, color 140ms ease; }
.legal-nav a:hover { background: var(--card); color: var(--fg); }
.legal-nav a.active { background: var(--card); color: var(--brand-deep); box-shadow: 0 1px 3px rgba(20, 24, 33, .08); }
.legal-content { min-width: 0; overflow-wrap: anywhere; color: var(--fg-sub); font-size: 14px; line-height: 1.75; }
.legal-content .title-all { display: none; }
.legal-content .terms-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin: 0 0 28px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.legal-content .terms-list ul { margin: 0; padding: 0; list-style: none; }
.legal-content .terms-list li { display: flex; gap: 7px; align-items: baseline; margin: 0; }
.legal-content .terms-list h2 { flex-shrink: 0; margin: 0; color: var(--fg-mute); font-size: 11px; }
.legal-content .terms-list a { color: var(--fg-sub); font-size: 12px; }
.legal-content .terms-list a:hover { color: var(--brand-deep); }
.legal-content .chapter, .legal-content .item { margin: 0 0 24px; }
.legal-content .chapter > h3, .legal-content > h2, .legal-content .agreement > h2 { margin: 30px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line-strong); color: var(--fg); font-size: 18px; line-height: 1.4; }
.legal-content .itemtitle, .legal-content .item > h2, .legal-content .item > h3 { margin: 20px 0 7px; color: var(--fg); font-size: 15px; font-weight: 700; line-height: 1.5; }
.legal-content .itembody { margin: 0; }
.legal-content p, .legal-content dl, .legal-content ol, .legal-content ul { margin: 0 0 12px; }
.legal-content ol, .legal-content ul { padding-left: 22px; }
.legal-content li { margin: 3px 0; }
.legal-content dt { margin-top: 10px; font-weight: 600; }
.legal-content dd { margin: 3px 0 3px 16px; }
.legal-content a { color: var(--brand-deep); text-decoration: underline; text-underline-offset: 2px; }
.legal-content table { width: 100% !important; max-width: 100%; margin: 14px 0 18px; border-collapse: collapse; border: 1px solid var(--line-strong) !important; background: var(--card) !important; font-size: 12.5px; line-height: 1.55; }
.legal-content th, .legal-content td { height: auto !important; padding: 9px 10px !important; border: 1px solid var(--line) !important; background: transparent !important; text-align: left !important; vertical-align: top; }
.legal-content th { background: var(--bg) !important; color: var(--fg); font-weight: 700; }
.legal-content img { max-width: 100%; height: auto; }
.legal-content font { color: inherit; font: inherit; }
.legal-content .agree_top { margin-bottom: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.legal-content .agree_top img { display: none; }
.legal-content [style*="width:920px"] { width: 100% !important; }

@media (max-width: 640px) {
  .legal-page { margin: 14px 0 28px; padding: 20px 16px 30px; border-right: 0; border-left: 0; border-radius: 0; }
  .legal-page > h1 { font-size: 21px; }
  .legal-content { font-size: 13.5px; }
  .legal-content .terms-list { grid-template-columns: 1fr 1fr; padding: 10px; }
  .legal-content table { display: block; overflow-x: auto; white-space: nowrap; }
}

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

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

@media (max-width: 640px) {
  .search-layout .video-grid { grid-template-columns: 1fr; gap: 16px; }
  .hero { padding-top: 10px; }
  .hero-main { display: block; }
  .hero .logo { display: block; width: fit-content; margin: 0 auto; }
  .hero .search-form { margin-top: 8px; }
  .site-nav { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; }
  .site-nav a, .site-nav button { padding-left: 9px; padding-right: 9px; }
  .sub-header .inner { flex-wrap: wrap; gap: 10px; }
}
