/* 헤더 '맛' 글자용 한글 손글씨 폰트 — 약간 굵고 둥근 Gaegu */
@import url('https://fonts.googleapis.com/css2?family=Gaegu:wght@700&display=swap');

:root {
  --bg-primary: #0f1117;
  --bg-card: #171a22;
  --bg-hover: #282c3a;
  --border: #2a2f3d;
  --text-primary: #e9ebf2;
  --text-secondary: #7c838f;
  --accent: #4f8cff;
  --red: #ef4444;
  --green: #22c55e;
  --orange: #f59e0b;
  --purple: #a855f7;
  --shadow-drawer: -4px 0 16px rgba(0, 0, 0, 0.4);
  --shadow-cta: 0 2px 8px rgba(79, 140, 255, 0.35);
  --shadow-close: 0 2px 6px rgba(239, 68, 68, 0.3);
  --active-tint: rgba(79, 140, 255, 0.08);
  --disclaimer-tint: rgba(245, 158, 11, 0.08);
  --tooltip-bg: rgba(23, 26, 34, 0.96);   /* bg-card 계열 반투명 */
  --tooltip-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

/* ── 라이트(크림) 테마 ── */
html[data-theme="light"] {
  --bg-primary: #f6efe0;
  --bg-card: #fdf9ed;
  --bg-hover: #ebe2c9;
  --border: #d4c8aa;
  --text-primary: #2a2318;
  --text-secondary: #7a6f5a;
  --accent: #2563eb;
  --red: #dc2626;
  --green: #16a34a;
  --orange: #b45309;
  --purple: #7c3aed;
  --shadow-drawer: -4px 0 16px rgba(80, 60, 20, 0.18);
  --shadow-cta: 0 2px 8px rgba(37, 99, 235, 0.28);
  --shadow-close: 0 2px 6px rgba(220, 38, 38, 0.28);
  --active-tint: rgba(37, 99, 235, 0.08);
  --disclaimer-tint: rgba(180, 83, 9, 0.1);
  --tooltip-bg: rgba(253, 249, 237, 0.97);
  --tooltip-shadow: 0 4px 14px rgba(80, 60, 20, 0.22);
}

/* ── 새콤달콤 테마 (젊은 여성 취향 파스텔 핑크) ── */
html[data-theme="sweet"] {
  --bg-primary: #fff3f6;
  --bg-card: #ffffff;
  --bg-hover: #ffe0ec;
  --border: #f5c7d6;
  --text-primary: #4a2238;
  --text-secondary: #a67384;
  --accent: #ff6fa8;
  --red: #e64a6b;
  --green: #3bbf8a;
  --orange: #f5a742;
  --purple: #b57bd8;
  --shadow-drawer: -4px 0 16px rgba(255, 111, 168, 0.18);
  --shadow-cta: 0 2px 10px rgba(255, 111, 168, 0.35);
  --shadow-close: 0 2px 6px rgba(230, 74, 107, 0.3);
  --active-tint: rgba(255, 111, 168, 0.1);
  --disclaimer-tint: rgba(245, 167, 66, 0.12);
  --tooltip-bg: rgba(255, 255, 255, 0.97);
  --tooltip-shadow: 0 4px 14px rgba(255, 111, 168, 0.25);
}

/* ── 밝은 그레이 테마 ── 쿨 톤 라이트 그레이 (크림 테마와 웜/쿨로 구분) */
html[data-theme="gray"] {
  --bg-primary: #eceef2;       /* 라이트 쿨 그레이 배경 */
  --bg-card: #ffffff;          /* 카드는 순백으로 대비 */
  --bg-hover: #dde1e8;         /* hover */
  --border: #c9cfd8;           /* 보더 */
  --text-primary: #1f2328;     /* 본문 (근흑) */
  --text-secondary: #5a6070;   /* 보조 (중간 그레이) */
  --accent: #4a6fa5;           /* 딥 스틸 블루 포인트 */
  --red: #d14343;
  --green: #2e8b57;
  --orange: #d97b2b;
  --purple: #7851a9;
  --shadow-drawer: -4px 0 16px rgba(31, 35, 40, 0.1);
  --shadow-cta: 0 2px 10px rgba(74, 111, 165, 0.3);
  --shadow-close: 0 2px 6px rgba(209, 67, 67, 0.25);
  --active-tint: rgba(74, 111, 165, 0.1);
  --disclaimer-tint: rgba(217, 123, 43, 0.12);
  --tooltip-bg: rgba(255, 255, 255, 0.97);
  --tooltip-shadow: 0 4px 14px rgba(31, 35, 40, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Malgun Gothic", sans-serif;
  font-size: 13px;
}

/* ── 상단 고정 영역 (header + filter + 컬럼 라벨 묶음) ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
}

header {
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-card);
}
header h1 { margin: 0; font-size: 16px; font-weight: 700; }
/* ── 브랜드 로고 (세콤달.콤 주식맛집) ──
   '세콤달.콤' 글자별 컬러 (핫핑크 / 파랑 / 앰버 / 퍼플) — 새콤달콤 사탕 분위기.
   '주식맛집' 중 '맛' 은 brand-mat 클래스로 손글씨 + 기울임 강조,
   나머지는 기본 텍스트색 유지.  */
header .brand-h1 { line-height: 1.15; letter-spacing: -0.01em; white-space: nowrap; }
header .brand-name { display: inline-block; }
header .brand-name .bc {
  display: inline-block;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}
header .brand-name .c1 { color: #ff3d8a; }  /* 핫핑크 (세, 마지막 콤) */
header .brand-name .c2 { color: #2b7ed8; }  /* 파랑 (콤) */
header .brand-name .c3 { color: #f59e0b; }  /* 앰버 (달) */
header .brand-name .c4 { color: #9b59b6; }  /* 퍼플 (.) */
header .brand-sub {
  color: var(--text-primary);
  font-weight: 700;
  margin-left: 4px;
}
/* '맛' 글자 — 손글씨 느낌 + 약간 비뚤어진 그래픽 강조 */
header .brand-mat {
  display: inline-block;
  font-family: 'Gaegu', 'Gungsuh', cursive;
  font-weight: 700;
  color: #ff6b35;                          /* 따뜻한 주황 — '맛집' 무드 */
  font-size: 1.25em;
  line-height: 1;
  padding: 0 1px;
  transform: rotate(-7deg) translateY(-1px);
  transform-origin: 50% 60%;
}
header .subtitle { color: var(--text-secondary); font-size: 12px; margin-left: 8px; }
header .meta { color: var(--text-secondary); font-size: 11px; }
header .nav-left { display: flex; align-items: baseline; gap: 0; min-width: 0; }
header .nav-right { display: flex; align-items: center; gap: 14px; }

/* 좌측 홈 버튼 (Apple SF Symbols house.fill 스타일) */
header .home-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text-primary);
  text-decoration: none;
  line-height: 1;
  margin-right: 10px;
  flex: 0 0 auto;
  align-self: center;     /* baseline 정렬 무시하고 중앙 */
  transition: background 0.15s, transform 0.08s, border-color 0.15s, color 0.15s;
}
header .home-btn:hover {
  background: rgba(245, 158, 11, 0.12);
  border-color: #f59e0b;
  color: #f59e0b;
  transform: translateY(-1px);
}
header .home-btn:active { transform: translateY(0); }
header .home-btn .home-ico {
  width: 17px;
  height: 17px;
  display: block;
}

/* '마지막 데이터 날짜 기준' 하이라이트 */
header .subtitle-highlight {
  display: inline-block;
  color: #f59e0b;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.14);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  margin-left: 2px;
  letter-spacing: 0.02em;
}

/* 모바일: 헤더의 'KOSPI / KOSDAQ · ' 접두 문구만 숨김 (날짜 뱃지는 유지) */
@media (max-width: 640px) {
  header .subtitle-markets { display: none; }
}

/* ── 햄버거 버튼 (20% 축소) ── */
.nav-toggle {
  width: 26px;
  height: 22px;
  background: transparent;
  border: 0;
  padding: 3px 0;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: background 0.15s;
}
.nav-toggle:hover span { background: var(--accent); }

/* ── 테마 토글 버튼 ── */
.theme-toggle {
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  color: var(--text-primary);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.theme-toggle:hover { background: var(--bg-hover); border-color: var(--accent); }
.theme-toggle:active { transform: scale(0.92); }

/* ── 카카오 로그인 / 유저 칩 (헤더 우상단 #authSlot) ── */
.auth-slot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}
/* 카카오 공식 브랜드 컬러 (#fee500 배경 + #3c1e1e 글자), 라이트·다크 공통 */
.kakao-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  background: #fee500;
  color: #3c1e1e;
  border: 0;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s, transform 0.08s;
}
.kakao-btn:hover { filter: brightness(0.96); }
.kakao-btn:active { transform: scale(0.96); }
.kakao-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* 카카오 말풍선 아이콘 (SVG data URI, #3c1e1e) */
.kakao-icon {
  width: 14px;
  height: 14px;
  background: transparent no-repeat center/contain;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%233c1e1e'><path d='M12 3C6.48 3 2 6.58 2 11c0 2.79 1.79 5.24 4.5 6.67L5.2 21.5c-.1.29.22.52.47.35L10.4 19c.52.06 1.06.1 1.6.1 5.52 0 10-3.58 10-8S17.52 3 12 3z'/></svg>");
}

/* 로그인 유저 칩 */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px 0 4px;
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 12px;
  line-height: 1;
  max-width: 160px;
}
.user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-secondary);
  object-fit: cover;
  flex-shrink: 0;
}
.user-avatar--fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
}
.user-nick {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100px;
}

/* 칩을 버튼으로 쓸 때 (아바타 탭 → 드롭다운) */
.auth-chip-wrap { position: relative; display: inline-block; }
.user-chip.user-chip--btn {
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
}
.user-chip.user-chip--btn:hover { background: var(--active-tint); border-color: var(--accent); }
.user-chip.user-chip--btn:active { transform: scale(0.97); }
.user-chip.user-chip--btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.user-chip-caret {
  font-size: 10px;
  color: var(--text-secondary);
  margin-left: 2px;
  transition: transform 0.15s;
}
.user-chip--btn[aria-expanded="true"] .user-chip-caret { transform: rotate(180deg); }

/* 아바타 드롭다운 메뉴 */
.auth-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  padding: 6px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.auth-menu[hidden] { display: none; }
.auth-menu-head {
  padding: 6px 10px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.auth-menu-nick {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.auth-menu-item {
  text-align: left;
  background: transparent;
  border: 0;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.auth-menu-item:hover { background: var(--bg-hover); color: var(--accent); }

/* 텍스트 링크형 버튼 (로그아웃 등 — 구 스타일 유지) */
.btn-link {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 6px;
  white-space: nowrap;
}
.btn-link:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ── 관심종목 버튼 ── */
.star-btn {
  background: transparent;
  border: 0;
  padding: 2px 4px;
  font-size: 14px;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.12s, background 0.12s, border-color 0.12s, transform 0.08s;
}
.star-btn:hover { color: #f59e0b; background: var(--bg-hover); }
.star-btn:active { transform: scale(0.96); }
.star-btn--on { color: #f59e0b; }
.star-btn--lg { font-size: 22px; padding: 4px 8px; }
.star-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 별 대신 '☆ 관심종목 추가' / '★ 담김' 라벨을 노출하는 pill 버튼 변형.
   행(cl-info) 과 모달 헤더 양쪽에서 공통 사용. */
.star-btn--pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  white-space: nowrap;
}
.star-btn--pill:hover {
  color: #f59e0b;
  border-color: #f59e0b;
  background: var(--bg-hover);
}
.star-btn--pill.star-btn--on {
  color: #f59e0b;
  border-color: #f59e0b;
  background: var(--disclaimer-tint);
}
/* 모달 헤더에선 살짝 크게 */
.modal-header .star-btn--pill { font-size: 12px; padding: 4px 10px; }

/* '관심종목만' 필터 체크박스 */
.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;                 /* 글자 한 칸 정도 */
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  flex: 0 0 auto;           /* 라벨 자체가 늘어나지 않도록 */
}
.filter-check input {
  margin: 0 !important;
  padding: 0 !important;
  cursor: pointer;
  accent-color: #f59e0b;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}
.filter-check span { line-height: 1; }
.filter-check:hover { color: var(--text-primary); }

/* Contact 페이지 인라인 카카오 CTA (크게) */
.kakao-btn.kakao-btn--lg {
  height: 40px;
  padding: 0 16px;
  font-size: 14px;
  border-radius: 20px;
  gap: 8px;
}
.kakao-btn.kakao-btn--lg .kakao-icon { width: 18px; height: 18px; }

/* ── 네비게이션 드로어 ── */
.nav-drawer {
  position: fixed;
  top: 0;
  right: -280px;
  width: 260px;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-drawer);
  z-index: 200;
  padding: 72px 0 24px;
  transition: right 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-drawer.open { right: 0; }
.nav-drawer a {
  display: block;
  padding: 14px 24px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.nav-drawer a:hover { background: var(--bg-hover); }
.nav-drawer a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--active-tint);
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 150;
  display: none;
}
.nav-backdrop.show { display: block; }

.filter-bar {
  display: flex;
  gap: 10px;
  padding: 12px 24px;
  align-items: center;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.filter-bar select,
.filter-bar input:not([type="checkbox"]) {
  padding: 6px 10px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}
.filter-bar input[type="text"] { width: 240px; }
.filter-bar .status { margin-left: auto; color: var(--text-secondary); font-size: 12px; }

/* 일봉 / 주봉 / 월봉 세그먼트 토글 */
.tf-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-card);
  flex: 0 0 auto;
}
.tf-btn {
  appearance: none;
  background: transparent;
  color: var(--text-secondary);
  border: 0;
  border-left: 1px solid var(--border);
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  min-width: 46px;
  line-height: 1;
}
.tf-btn:first-child { border-left: 0; }
.tf-btn:hover { color: var(--text-primary); background: var(--bg-hover, rgba(255,255,255,0.04)); }
.tf-btn.is-active {
  background: #f59e0b;
  color: #1a1a1a;
  font-weight: 700;
}

main { padding: 12px 24px 24px; }

.cl-header {
  display: grid;
  grid-template-columns: 130px minmax(0, 9fr) minmax(0, 4fr) 160px;
  gap: 6px;
  padding: 6px 32px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  background: var(--bg-primary);
}

#stockList {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.cl-row {
  position: relative;
  display: grid;
  grid-template-columns: 130px minmax(0, 9fr) minmax(0, 4fr) 160px;
  grid-template-areas: "info chart supply meta";
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  min-width: 0;
}
.cl-row .cl-info { grid-area: info; }
.cl-row .cl-chart { grid-area: chart; }
.cl-row .cl-supply { grid-area: supply; }
.cl-row .cl-meta { grid-area: meta; }
.cl-row:hover { background: var(--bg-hover); }
.cl-row .cl-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
/* 관심종목 pill 은 info 컬럼 최상단에 위치 — 이름과 겹치지 않음 */
.cl-row .cl-info .star-btn--pill {
  align-self: flex-start;
  margin-bottom: 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cl-row .cl-info .cl-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-row .cl-info .cl-code { color: var(--text-secondary); font-family: monospace; font-size: 11px; }
.cl-row .cl-info .cl-group {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 6px;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  max-width: fit-content;
}
[data-theme="light"] .cl-row .cl-info .cl-group {
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
  border-color: rgba(217, 119, 6, 0.3);
}

/* 공매도 잔고 비중 배지 — 6단계 */
.cl-row .cl-info .cl-short,
.short-badge {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  max-width: fit-content;
  border: 1px solid transparent;
}
.cl-short--good_strong, .short-badge--good_strong { background: rgba(16,185,129,0.15); color: #047857; border-color: rgba(16,185,129,0.35); }
.cl-short--good,        .short-badge--good        { background: rgba(132,204,22,0.16); color: #4d7c0f; border-color: rgba(132,204,22,0.35); }
.cl-short--neutral,     .short-badge--neutral     { background: rgba(234,179,8,0.16);  color: #92400e; border-color: rgba(234,179,8,0.35);  }
.cl-short--warn,        .short-badge--warn        { background: rgba(249,115,22,0.16); color: #c2410c; border-color: rgba(249,115,22,0.4);  }
.cl-short--high,        .short-badge--high        { background: rgba(239,68,68,0.16);  color: #b91c1c; border-color: rgba(239,68,68,0.4);   }
.cl-short--alert,       .short-badge--alert       { background: rgba(127,29,29,0.18);  color: #fff;    border-color: #7f1d1d; }

.cl-row .cl-chart { min-width: 0; }
.cl-row .cl-chart canvas { border-radius: 4px; display: block; width: 100%; height: 180px; }
.cl-row .cl-supply { font-size: 9px; line-height: 1.4; overflow: hidden; display: flex; flex-direction: column; gap: 2px; }
.cl-row .cl-supply canvas { width: 100%; height: 100px; border-radius: 4px; }
.cl-row .cl-supply .sup-summary { display: flex; gap: 6px; justify-content: center; font-size: 10px; margin-top: 2px; }
.cl-row .cl-supply .sup-pos { color: var(--red); }
.cl-row .cl-supply .sup-neg { color: var(--accent); }
.cl-row .cl-meta { font-size: 12px; line-height: 1.7; color: var(--text-secondary); }
.cl-row .cl-meta span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.loading, .empty {
  padding: 40px;
  text-align: center;
  color: var(--text-secondary);
}
.spinner {
  display: inline-block;
  width: 22px; height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.load-more {
  text-align: center;
  padding: 16px;
  color: var(--text-secondary);
  font-size: 12px;
}

/* ── 모달 ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}
.modal-backdrop.show { display: flex; }

.modal {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 1100px;
  padding: 20px 24px;
  /* 영역 선택·복사·iOS 롱프레스 콜아웃·이미지 드래그 차단.
     차트 툴팁 제스처나 스크롤을 방해하지 않으면서, 차트 밖 텍스트/이미지의
     우연한 선택과 복사를 막는다. */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}
/* 링크나 input 처럼 사용자가 실제로 상호작용해야 하는 요소는 선택 허용 */
.modal input,
.modal textarea,
.modal [contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
}
.modal-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { margin: 0; font-size: 18px; }
.modal-header code { color: var(--text-secondary); font-size: 13px; }
/* 종목명 라인 — 이름 + 지연 태그 가로 정렬 */
.modal-title-row { display: flex; align-items: center; gap: 8px; }
.header-delay-tag,
.header-base-date {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-hover, rgba(148,163,184,0.08));
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.header-base-date {
  /* 기준일자 — 약간 강조해서 사용자 시선이 데이터 시점을 즉시 인식 */
  color: var(--text-primary);
  background: var(--active-tint, rgba(79,140,255,0.12));
  border-color: var(--accent);
}
.modal-header .close {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-close);
  transition: background 0.15s, transform 0.1s;
}
.modal-header .close:hover { background: #dc2626; }
.modal-header .close:active { transform: translateY(1px); }

.section { margin-top: 16px; }
.section h3 { margin: 0 0 8px; font-size: 14px; }

/* 섹션 헤더: 왼쪽 제목 + 오른쪽 봉주기 토글 */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.section-head h3 { margin: 0; }
.tf-group--modal .tf-btn { padding: 5px 10px; font-size: 11px; min-width: 42px; }
@media (max-width: 520px) {
  .tf-group--modal .tf-btn { padding: 4px 7px; min-width: 36px; font-size: 10px; }
}

.chart-tabs { display: flex; gap: 4px; margin-top: 12px; border-bottom: 1px solid var(--border); }
.chart-tab {
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
}
.chart-tab:hover { color: var(--text-primary); }
.chart-tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }

.chart-pane { display: none; margin-top: 8px; }
.chart-pane.active { display: block; }

.chart-legend {
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--text-secondary);
  padding: 6px 0;
}
.chart-legend .dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.snapshot-cell {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
}
.snapshot-cell .label { color: var(--text-secondary); font-size: 11px; }
.snapshot-cell .value { font-size: 14px; font-weight: 600; margin-top: 2px; }
/* 부호 색상 (KR 관행: 상승=빨강, 하락=파랑) */
.val-up { color: var(--red); }
.val-dn { color: var(--accent); }

/* ── 지연 시세 배지 (캔들 차트 상단) ─────────────
   Naver Finance 20분 지연 시세를 쓴다는 것을 분명히 고지하고,
   현재가/전일대비/거래시각을 한 줄로 보여준다. */
.delay-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 2px 0 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-hover, rgba(148, 163, 184, 0.08));
  border: 1px solid var(--border);
  border-radius: 999px;
  line-height: 1.4;
}
.delay-badge-ico { font-size: 13px; opacity: 0.85; }
.delay-badge-main { color: var(--text-primary); font-weight: 600; }
.delay-badge-sep { color: var(--text-secondary); opacity: 0.6; }
.delay-badge-price { color: var(--text-primary); font-weight: 600; }
.delay-badge-chg { font-weight: 600; }
.delay-badge-time { color: var(--text-secondary); }

/* 스냅샷 섹션 — 지연 안내 노트 */
.snapshot-section { margin-bottom: 4px; }
.snapshot-delay-note {
  margin: 0 0 6px;
  padding: 5px 10px;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-hover, rgba(148,163,184,0.08));
  border-left: 2px solid var(--border);
  border-radius: 4px;
  line-height: 1.5;
}
.snapshot-delay-note strong { color: var(--text-primary); font-weight: 600; }


/* ── 회사 기본정보 섹션 ────────────────────────── */
.cinfo-section h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.cinfo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 4px 18px;
  margin: 0;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.cinfo-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
}
.cinfo-row:last-child { border-bottom: none; }
.cinfo-row dt {
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  margin: 0;
}
.cinfo-row dd {
  margin: 0;
  font-size: 13px;
  color: var(--text-primary);
  word-break: break-all;
}
.cinfo-sub {
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 400;
  margin-left: 4px;
}
.cinfo-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}
.cinfo-link:hover { opacity: 0.85; }
.cinfo-note {
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--text-secondary);
  text-align: right;
}

.cinfo-overview {
  margin-top: 10px;
  padding: 10px 14px 12px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.cinfo-overview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.cinfo-overview-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}
.cinfo-overview-date {
  font-size: 10.5px;
  color: var(--text-secondary);
}
.cinfo-overview-list {
  margin: 0;
  padding-left: 18px;
  list-style: disc;
  color: var(--text-primary);
}
.cinfo-overview-list li {
  font-size: 12.5px;
  line-height: 1.65;
  padding: 2px 0;
}
.cinfo-overview-list li::marker {
  color: var(--accent);
}

@media (max-width: 640px) {
  .cinfo-grid { grid-template-columns: 1fr; gap: 2px 0; padding: 8px 10px; }
  .cinfo-row { grid-template-columns: 80px 1fr; padding: 3px 0; }
  .cinfo-row dd { font-size: 12.5px; }
  .cinfo-overview { padding: 8px 10px 10px; }
  .cinfo-overview-list { padding-left: 16px; }
  .cinfo-overview-list li { font-size: 12px; line-height: 1.6; }
}

.cl-tooltip {
  position: fixed;
  z-index: 200;
  background: var(--tooltip-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-primary);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--tooltip-shadow);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.cl-tooltip .tt-label { color: var(--text-secondary); margin-right: 6px; }
.cl-tooltip .tt-up { color: var(--red); }
.cl-tooltip .tt-dn { color: var(--accent); }

.chart-wrap { position: relative; width: 100%; }
.chart-wrap canvas {
  display: block;
  width: 100%;
  /* 캔버스 위에서 드래그/터치 시 브라우저 기본 선택(파란 하이라이트)·
     iOS 롱프레스 콜아웃·핀치줌 등을 차단. touch-action: pan-y 로 세로 스크롤은 허용. */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: pan-y;
}

footer {
  padding: 16px 24px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 11px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

/* ─────────────────────────────────────────────
   Home / About 공용 정적 페이지
   ───────────────────────────────────────────── */
.home-main, .static-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 24px 28px;
}

/* Home: Hero */
.hero {
  text-align: center;
  padding: 28px 16px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.hero h2 {
  margin: 0 0 10px;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}
.hero .hero-sub {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.55;
  margin: 0 auto 18px;
  max-width: 640px;
}
.hero .hero-sub strong { color: var(--orange); }

/* 로그인 상태에 따라 hero 문구·버튼 토글. html.is-signed-in 은 auth.js 가 세팅 */
.signed-in-only { display: none !important; }
html.is-signed-in .signed-out-only { display: none !important; }
html.is-signed-in .signed-in-only { display: revert !important; }
/* hero 안의 블록 엘리먼트(문구) 는 revert 대신 block 이 자연스러움 */
html.is-signed-in p.hero-sub.signed-in-only { display: block !important; }
/* kakao 버튼은 inline-flex 가 기본 */
html.is-signed-in .kakao-btn.signed-in-only { display: inline-flex !important; }

/* Hero CTA 버튼 가로 정렬 — 모양·크기는 통일, 색상만 서로 다르게. */
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
}
.hero-actions + .hero-actions { margin-top: 12px; }

/* Hero — split: 좌측 텍스트, 우측 CTA 버튼 (와이드 화면) */
.hero.hero--split {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  text-align: left;
  padding: 32px 24px 28px;
}
.hero.hero--split .hero-text {
  flex: 1 1 auto;
  min-width: 0;
}
.hero.hero--split h2 {
  margin: 0 0 10px;
  font-size: 26px;
  line-height: 1.3;
}
.hero.hero--split .hero-sub {
  margin: 0;
  max-width: none;
  text-align: left;
}
.hero.hero--split .hero-actions {
  flex: 0 0 auto;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  min-width: 220px;
}
.hero.hero--split .hero-actions .cta,
.hero.hero--split .hero-actions .kakao-btn.kakao-btn--lg {
  width: 100%;
  justify-content: center;
}
@media (max-width: 720px) {
  .hero.hero--split {
    flex-direction: column;
    text-align: center;
    gap: 16px;
    padding: 24px 16px 22px;
  }
  .hero.hero--split .hero-sub { text-align: center; }
  .hero.hero--split .hero-actions {
    flex-direction: row;
    justify-content: center;
    width: 100%;
  }
  .hero.hero--split .hero-actions .cta,
  .hero.hero--split .hero-actions .kakao-btn.kakao-btn--lg { width: auto; }
}

/* Hero — Blog 섹션: 두 번째 hero 로 구분해서 독립된 섹션으로 렌더 */
.hero.hero--blog {
  padding: 20px 16px 20px;
  margin-top: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.hero.hero--blog h2 { font-size: 20px; margin-bottom: 8px; }
.hero.hero--blog .hero-sub { font-size: 13px; margin-bottom: 14px; }
.hero.hero--blog .brand-mat {
  font-family: "Gaegu", "Nanum Pen Script", "HY산B", "나눔고딕", sans-serif;
  color: var(--orange);
  font-weight: 900;
  font-size: 1.15em;
  letter-spacing: -0.02em;
}

/* hero 안에서는 .cta / .kakao-btn 모두 같은 치수·모양을 갖도록 override */
.hero-actions .cta,
.hero-actions .kakao-btn.kakao-btn--lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  min-width: 180px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.1px;
  white-space: nowrap;
}
/* 카카오 버튼 내부 아이콘 여백 보정 */
.hero-actions .kakao-btn.kakao-btn--lg .kakao-icon {
  width: 16px;
  height: 16px;
}
/* Secondary (블로그) 버튼은 같은 치수지만 outline */
.hero-actions .cta.cta-secondary {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  box-shadow: none;
}
.hero-actions .cta.cta-secondary:hover {
  background: var(--active-tint);
  opacity: 1;
}

.cta {
  display: inline-block;
  padding: 12px 28px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
  box-shadow: var(--shadow-cta);
}
.cta:hover { opacity: 0.9; }
.cta:active { transform: translateY(1px); }
.cta.cta-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  box-shadow: none;
}
.cta.cta-secondary:hover { background: var(--active-tint); }

/* Home: Features */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.feature {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  text-align: center;
  transition: border-color 0.15s, transform 0.15s;
}
.feature:hover { border-color: var(--accent); transform: translateY(-2px); }
.feature .feature-icon { font-size: 26px; margin-bottom: 6px; }
.feature h3 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--text-primary);
}
.feature p {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.cta-block {
  text-align: center;
  padding: 32px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.cta-block p {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* About 페이지 */
.about-content h2 {
  margin: 0 0 8px;
  font-size: 24px;
  color: var(--accent);
}
.about-content .lead {
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.7;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.about-content section { margin-top: 28px; }
.about-content h3 {
  margin: 0 0 10px;
  font-size: 16px;
  color: var(--text-primary);
}
.about-content p, .about-content li {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.about-content ul { padding-left: 20px; margin: 8px 0; }
.about-content li { margin-bottom: 4px; }
.about-content strong { color: var(--text-primary); }
.about-content a { color: var(--accent); text-decoration: none; }
.about-content a:hover { text-decoration: underline; }
.about-content .disclaimer {
  padding: 12px 14px;
  background: var(--disclaimer-tint);
  border-left: 3px solid var(--orange);
  border-radius: 4px;
}

/* ── 개인정보처리방침 — 수탁사(제3자) 표 ── */
.vendor-table-wrap {
  margin-top: 10px;
  overflow-x: auto;               /* 모바일 가로 스크롤 */
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}
.vendor-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  color: var(--text-primary);
  min-width: 620px;               /* 너무 좁아지면 자동으로 스크롤 활성화 */
}
.vendor-table thead th {
  background: var(--bg-hover);
  color: var(--text-primary);
  font-weight: 700;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}
.vendor-table tbody td {
  padding: 10px 12px;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  line-height: 1.6;
  color: var(--text-secondary);
}
.vendor-table tbody tr:last-child td { border-bottom: 0; }
.vendor-table tbody strong { color: var(--text-primary); }
.vendor-table a {
  color: var(--accent);
  text-decoration: none;
  font-size: 11.5px;
}
.vendor-table a:hover { text-decoration: underline; }

/* ─────────────────────────────────────────────
   Contact Us 페이지 — 피드백 폼
   ───────────────────────────────────────────── */
.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
  padding: 18px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.feedback-form .field { display: flex; flex-direction: column; gap: 4px; }
.feedback-form label {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 600;
}
.feedback-form label .opt { color: var(--text-secondary); font-weight: 400; font-size: 11px; }
.feedback-form label .req { color: var(--red); font-weight: 700; }
.feedback-form input,
.feedback-form textarea {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.15s;
}
.feedback-form input:focus,
.feedback-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.feedback-form .hint {
  font-size: 10px;
  color: var(--text-secondary);
  text-align: right;
}
.feedback-form .actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
}
.feedback-form .actions .cta {
  padding: 9px 22px;
  font-size: 13px;
}
.feedback-form .actions .cta:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.feedback-form .actions .status {
  font-size: 12px;
  color: var(--text-secondary);
}
.feedback-form .actions .status.ok { color: var(--green); }
.feedback-form .actions .status.err { color: var(--red); }

/* 관리자 전용 메뉴 — 기본 숨김. auth.js 가 admins 검증 후 html.is-admin 추가 시 노출 */
.admin-only { display: none !important; }
html.is-admin .admin-only { display: revert !important; }

/* 메인 섹션 소제목 */
.section-heading {
  max-width: 960px;
  margin: 28px auto 12px;
  padding: 0 8px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
}

/* 메인페이지 최신 글 미리보기 */
.recent-posts {
  max-width: 960px;
  margin: 24px auto 12px;
  padding: 0 8px;
}
.recent-posts-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.recent-posts-title {
  margin: 0;
  padding: 0;
}
.recent-posts-more {
  font-size: 14px;
  color: var(--text-secondary, #64748b);
  text-decoration: none;
  white-space: nowrap;
}
.recent-posts-more:hover { color: var(--text-primary, #1e293b); }
.recent-posts-loading,
.recent-posts-empty {
  grid-column: 1 / -1;
  padding: 30px;
  text-align: center;
  color: var(--text-secondary, #64748b);
  font-size: 14px;
}
.recent-posts .blog-grid {
  /* 메인 페이지에서는 좀 더 컴팩트한 그리드 */
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* 자동 데이터 포스트(daily-/batch-) 카드 — 약간 옅고 '데이터' 배지 */
.blog-card-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 3px;
  background: rgba(100, 116, 139, 0.15);
  color: #475569;
  vertical-align: middle;
}
[data-theme="dark"] .blog-card-badge {
  background: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
}

/* ─────────────────────────────────────────────
   페이지 설명 박스 — SEO + 사용자 가이드
   ───────────────────────────────────────────── */
.page-intro {
  max-width: 960px;
  margin: 24px auto;
  padding: 20px 24px;
  background: var(--card, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary, #1e293b);
}
.page-intro h2 {
  font-size: 20px;
  margin: 0 0 12px;
  color: var(--text-primary);
}
.page-intro h3 {
  font-size: 15px;
  margin: 16px 0 6px;
  color: var(--text-primary);
}
.page-intro p { margin: 0 0 10px; }
.page-intro ul { padding-left: 22px; margin: 8px 0; }
.page-intro li { margin: 4px 0; }
.page-intro a { color: #f59e0b; text-decoration: underline; }
.page-intro--compact { padding: 14px 18px; margin: 10px 0 14px; }
.page-intro--compact h2 { font-size: 17px; margin-bottom: 8px; }
.page-intro-note {
  margin-top: 14px !important;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  color: var(--text-secondary);
  font-size: 12px;
}

/* ─────────────────────────────────────────────
   AdSense 배너 영역
   ───────────────────────────────────────────── */
.ad-slot {
  margin: 12px auto 8px;
  max-width: 960px;
  min-height: 90px;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
}
.ad-slot .ad-placeholder {
  color: var(--text-secondary);
  font-size: 11px;
  letter-spacing: 0.04em;
}
.ad-slot ins.adsbygoogle { width: 100%; }

/* 상단(헤더 바로 아래) 광고 배너 */
.ad-slot.ad-top {
  margin: 0;                   /* 헤더 바로 아래 — 자체 여백 제거 */
  max-width: none;
  width: 100%;
  min-height: 70px;            /* 흔한 leaderboard(728x90) 축소본에 맞춘 높이 */
  padding: 8px 16px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: var(--bg-primary);
  box-sizing: border-box;
}
@media (max-width: 640px) {
  .ad-slot.ad-top { min-height: 56px; padding: 6px 12px; }
}

/* ─────────────────────────────────────────────
   모바일 가로보기 (orientation: landscape, 작은 폰)
   - 종목 + 업종/PER/시총 → 한 컬럼으로 합침 (종목 위, 메타 아래)
   - 차트와 수급 폭을 넓힘
   ───────────────────────────────────────────── */
@media (orientation: landscape) and (max-width: 950px) and (max-height: 500px) {
  header { padding: 8px 14px; }
  header h1 { font-size: 14px; }
  header .subtitle { font-size: 10px; }
  header .subtitle-highlight { font-size: 9px; padding: 1px 5px; }
  header .home-btn { width: 26px; height: 26px; margin-right: 6px; }
  header .home-btn .home-ico { width: 14px; height: 14px; }
  header .meta { font-size: 10px; }

  .filter-bar { padding: 6px 14px; gap: 6px; }
  .filter-bar input[type="text"] { width: 160px; }
  .filter-bar .status { display: none; }

  main { padding: 8px 12px 20px; }

  /* 컬럼 라벨 — 가로보기에서는 숨김 */
  .cl-header { display: none; }

  /* info + meta 한 컬럼으로 합치고 차트/수급을 넓힘 */
  .cl-row {
    grid-template-columns: minmax(120px, 1.3fr) minmax(0, 3fr) minmax(0, 2fr);
    grid-template-areas:
      "info  chart supply"
      "meta  chart supply";
    row-gap: 4px;
    column-gap: 8px;
    padding: 8px 10px;
    align-items: start;
  }
  .cl-row .cl-info { grid-area: info; }
  .cl-row .cl-info .star-btn--pill { font-size: 10px; padding: 2px 7px; margin-bottom: 3px; }
  .cl-row .cl-meta {
    grid-area: meta;
    font-size: 10px;
    line-height: 1.5;
    padding-top: 4px;
    border-top: 1px dashed var(--border);
  }
  .cl-row .cl-meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cl-row .cl-info .cl-name { font-size: 12px; }
  .cl-row .cl-info .cl-code { font-size: 10px; }

  /* 수급 컬럼은 표시하고 폭을 키움 */
  .cl-row .cl-supply {
    display: flex !important;
    grid-area: supply;
    align-self: stretch;
    justify-content: center;
  }
  .cl-row .cl-supply canvas { height: 80px; }
  .cl-row .cl-chart { grid-area: chart; align-self: stretch; }
  .cl-row .cl-chart canvas { height: 120px; }
}

/* ─────────────────────────────────────────────
   모바일 세로보기 (orientation: portrait, 폭 ≤ 640px)
   - 종목명/가격/업종·PER·시총 → 1줄
   - 캔들 차트 → 2줄
   - 수급 컬럼 숨김
   ───────────────────────────────────────────── */
@media (max-width: 640px) and (orientation: portrait) {
  header {
    padding: 10px 14px;
    gap: 8px;
  }
  header h1 { font-size: 14px; line-height: 1.15; }
  /* 모바일: 세콤달.콤 / 주식맛집 2줄 분리 */
  header .brand-h1 { white-space: normal; }
  header .brand-sub {
    display: block;
    margin-left: 0;
    margin-top: 1px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-secondary);
  }
  /* 모바일에서는 '맛' 글자만 본문 색이 아닌 액센트 유지 */
  header .brand-mat { font-size: 1.3em; }
  header .nav-left { align-items: center; }
  header .subtitle { font-size: 10px; margin-left: 6px; }
  header .subtitle-highlight { font-size: 9px; padding: 1px 5px; }
  header .home-btn { width: 28px; height: 28px; margin-right: 6px; }
  header .home-btn .home-ico { width: 15px; height: 15px; }
  header .meta { display: none; }
  header .nav-right { gap: 8px; }

  /* 좁은 화면 — 헤더의 카카오 버튼은 글자 숨기고 아이콘만. 큰 CTA(kakao-btn--lg)는 예외 */
  .auth-slot .kakao-btn .kakao-btn-label { display: none; }
  .auth-slot .kakao-btn { padding: 0 8px; gap: 0; }
  /* 로그인 칩: 모바일에서는 아바타만 보이게. 캐럿/닉네임 숨김. */
  .auth-slot .user-chip { padding: 0 3px; max-width: 44px; }
  .auth-slot .user-chip .user-nick,
  .auth-slot .user-chip .user-chip-caret { display: none; }
  /* 드롭다운 메뉴는 화면 우측 끝에 맞추기 */
  .auth-slot .auth-menu { right: 0; min-width: 180px; }

  .filter-bar {
    padding: 8px 14px;
    gap: 6px;
  }
  .filter-bar input[type="text"] { width: 100%; min-width: 140px; flex: 1; }
  .filter-bar .status { display: none; }
  .tf-btn { padding: 5px 8px; min-width: 40px; font-size: 11px; }

  main { padding: 8px 12px 20px; }

  /* 컬럼 라벨은 모바일에서 의미 없음 → 숨김 */
  .cl-header { display: none; }

  /* 행 레이아웃 재배치: info+meta 한 줄 → 차트 한 줄 */
  .cl-row {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    grid-template-areas:
      "info meta"
      "chart chart";
    row-gap: 8px;
    padding: 10px 10px;
    align-items: start;
  }
  /* 수급 컬럼 숨김 */
  .cl-row .cl-supply { display: none; }

  /* 종목 정보 축소 + 관심 pill 타이트하게 */
  .cl-row .cl-info .cl-name { font-size: 13px; }
  .cl-row .cl-info .cl-code { font-size: 10px; }
  .cl-row .cl-info .star-btn--pill { font-size: 10px; padding: 2px 7px; margin-bottom: 3px; }

  /* 메타(업종·PER·시총) 오른쪽 정렬 + 압축 */
  .cl-row .cl-meta {
    font-size: 11px;
    line-height: 1.45;
    text-align: right;
  }
  .cl-row .cl-meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* 캔들 차트 풀폭 + 높이 축소 */
  .cl-row .cl-chart canvas { height: 140px; }

  /* 모달 여백 */
  .modal-backdrop { padding: 12px 8px; }
  .modal { padding: 14px 14px; border-radius: 8px; }
  .modal-header h2 { font-size: 16px; }
  .snapshot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .snapshot-cell { padding: 6px 8px; }
  .snapshot-cell .value { font-size: 13px; }

  /* Home/About 페이지 모바일 축소 */
  .home-main, .static-main { padding: 14px 16px 20px; }
  .hero { padding: 18px 8px 20px; margin-bottom: 16px; }
  .hero h2 { font-size: 19px; }
  .hero .hero-sub { font-size: 12px; margin-bottom: 14px; }
  .hero.hero--blog { padding: 16px 8px 18px; margin-bottom: 16px; }
  .hero.hero--blog h2 { font-size: 16px; }
  .hero.hero--blog .hero-sub { font-size: 11px; margin-bottom: 12px; }
  /* 모바일에서 버튼 2개가 한 줄에 안 들어가면 자연스럽게 wrap → 세로 스택 */
  .hero-actions { gap: 10px; width: 100%; flex-direction: column; align-items: stretch; }
  .hero-actions .cta,
  .hero-actions .kakao-btn.kakao-btn--lg { width: 100%; justify-content: center; }
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .feature { padding: 16px 12px; }
  .feature .feature-icon { font-size: 24px; }
  .feature h3 { font-size: 13px; }
  .feature p { font-size: 11px; }
  .cta-block { padding: 22px 12px; }
  .about-content h2 { font-size: 20px; }
  .about-content h3 { font-size: 14px; }
}

/* ── 블로그 ─────────────────────────────────────── */
.blog-hero {
  padding: 24px 0 12px;
  text-align: center;
}
.blog-hero h2 {
  font-size: 24px;
  margin: 0 0 6px;
}
.blog-hero .lead {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.blog-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.blog-card:hover {
  transform: translateY(-2px);
  border-color: #f59e0b;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}
.blog-card-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--bg-hover, rgba(255,255,255,0.04));
}
.blog-card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.blog-card-date {
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.blog-card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-primary);
}
.blog-card-summary {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.blog-tag {
  display: inline-block;
  font-size: 10px;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.24);
  padding: 2px 7px;
  border-radius: 999px;
  line-height: 1.3;
}

/* 개별 글 */
.blog-article {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 0;
}
.blog-article-head {
  margin-bottom: 20px;
}
.blog-breadcrumb {
  margin-bottom: 12px;
  font-size: 12px;
}
.blog-breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}
.blog-breadcrumb a:hover { color: #f59e0b; }
.blog-article-head h2 {
  font-size: 26px;
  line-height: 1.3;
  margin: 0 0 10px;
}
.blog-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}
.blog-cover {
  width: 100%;
  margin-top: 16px;
  border-radius: 10px;
  display: block;
}

.blog-body {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-primary);
}
.blog-body h1,
.blog-body h2 { font-size: 22px; margin: 32px 0 12px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.blog-body h3 { font-size: 17px; margin: 28px 0 10px; }
.blog-body h4 { font-size: 15px; margin: 22px 0 8px; }
.blog-body p { margin: 12px 0; }
.blog-body ul,
.blog-body ol { padding-left: 22px; margin: 12px 0; }
.blog-body li { margin: 6px 0; }
.blog-body strong { color: var(--text-primary); font-weight: 700; }
.blog-body a {
  color: #f59e0b;
  text-decoration: none;
  border-bottom: 1px dashed rgba(245, 158, 11, 0.5);
}
.blog-body a:hover { border-bottom-style: solid; }
.blog-body code {
  background: rgba(148, 163, 184, 0.14);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.blog-body pre {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
}
.blog-body pre code { background: transparent; padding: 0; }
.blog-body blockquote {
  border-left: 3px solid #f59e0b;
  margin: 14px 0;
  padding: 6px 14px;
  background: rgba(245, 158, 11, 0.06);
  color: var(--text-secondary);
  border-radius: 0 6px 6px 0;
}
.blog-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 13px;
}
.blog-body th,
.blog-body td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}
.blog-body th { background: var(--bg-hover, rgba(255,255,255,0.04)); font-weight: 700; }
.blog-body hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }
.blog-body img {
  max-width: 100%;
  border-radius: 8px;
  display: block;
  margin: 14px auto;
}

/* 이전/다음 */
.blog-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.blog-nav a {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color 0.15s, color 0.15s;
}
.blog-nav a:hover { border-color: #f59e0b; color: #f59e0b; }
.blog-nav-prev { text-align: left; }
.blog-nav-next { text-align: right; }

.blog-cta {
  margin-top: 36px;
  padding: 20px;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.blog-cta p { margin: 0 0 10px; color: var(--text-secondary); font-size: 13px; }

@media (max-width: 520px) {
  .blog-hero h2 { font-size: 20px; }
  .blog-article-head h2 { font-size: 20px; }
  .blog-body { font-size: 14px; }
  .blog-body h2 { font-size: 18px; }
  .blog-body h3 { font-size: 15px; }
  .blog-nav { grid-template-columns: 1fr; }
  .blog-nav-next { text-align: left; }
}

/* ─────────────────────────────────────────────
   내 정보 모달 — 테마 선택 + 회원 탈퇴
   ───────────────────────────────────────────── */
.myinfo-modal { max-width: 520px; }
.myinfo-backdrop { padding: 40px 16px; }
.myinfo-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 16px;
}
.myinfo-section { display: flex; flex-direction: column; gap: 8px; }
.myinfo-heading {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.myinfo-heading--danger { color: var(--red); }
.myinfo-desc { margin: 0; font-size: 12px; color: var(--text-secondary); line-height: 1.55; }

.myinfo-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}
.myinfo-avatar {
  width: 48px; height: 48px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-hover);
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.myinfo-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.myinfo-avatar--fallback {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 20px;
}
.myinfo-profile-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.myinfo-nick { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.myinfo-provider { font-size: 11px; color: var(--text-secondary); }

/* 테마 스와치 4열 */
.theme-swatch-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.theme-swatch {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 6px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.12s, transform 0.08s, box-shadow 0.15s;
  color: var(--text-primary);
  font-family: inherit;
}
.theme-swatch:hover { border-color: var(--accent); }
.theme-swatch:active { transform: scale(0.97); }
.theme-swatch.is-active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--active-tint); }
.theme-swatch-icon { font-size: 22px; line-height: 1; }
.theme-swatch-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); }
.theme-swatch.is-active .theme-swatch-label { color: var(--text-primary); }
.theme-swatch-badge {
  position: absolute;
  top: 4px; right: 6px;
  font-size: 11px;
  color: var(--accent);
  font-weight: 700;
}
/* 테마별 미니 컬러 프리뷰 (아이콘 배경) */
.theme-swatch--dark { background: linear-gradient(135deg, #1a1f2b 0%, #0f1117 100%); }
.theme-swatch--dark .theme-swatch-icon { color: #e9ebf2; }
.theme-swatch--light { background: linear-gradient(135deg, #f6efe0 0%, #fdf9ed 100%); }
.theme-swatch--light .theme-swatch-icon { color: #b45309; }
.theme-swatch--light .theme-swatch-label { color: #7a6f5a; }
.theme-swatch--sweet { background: linear-gradient(135deg, #ffe0ec 0%, #fff3f6 100%); }
.theme-swatch--sweet .theme-swatch-icon { color: #ff6fa8; }
.theme-swatch--sweet .theme-swatch-label { color: #a67384; }
.theme-swatch--gray { background: linear-gradient(135deg, #ffffff 0%, #dde1e8 100%); }
.theme-swatch--gray .theme-swatch-icon { color: #4a6fa5; }
.theme-swatch--gray .theme-swatch-label { color: #5a6070; }

/* 위험 영역 (회원 탈퇴) */
.myinfo-danger-zone {
  padding: 14px;
  border: 1px solid rgba(229, 72, 72, 0.35);
  border-radius: 10px;
  background: rgba(229, 72, 72, 0.05);
}
.btn-danger {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--red);
  color: #fff;
  border: 0;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.08s;
  font-family: inherit;
}
.btn-danger:hover { background: #b91c1c; }
.btn-danger:active { transform: translateY(1px); }
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--border); }

/* ── 회원 탈퇴 확인 모달 ──
   내 정보 모달 위에 겹쳐 뜨는 2차 확인 모달 */
.delete-confirm-backdrop { z-index: 200; }          /* myinfo-backdrop(100) 보다 위 */
.delete-confirm-modal {
  max-width: 440px;
  border: 1.5px solid var(--red);
  box-shadow: 0 8px 28px rgba(229, 72, 72, 0.35);
}
.delete-confirm-modal .modal-header h2 { color: var(--red); }
.delete-confirm-body {
  padding-top: 4px;
}

.myinfo-warn-list {
  margin: 6px 0 12px;
  padding-left: 18px;
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.7;
}
.myinfo-warn-list li { margin-bottom: 2px; }
.myinfo-confirm-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.myinfo-confirm-label input {
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: inherit;
}
.myinfo-confirm-label input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(229, 72, 72, 0.2);
}
.myinfo-confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.myinfo-error {
  margin-top: 10px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--red);
  background: rgba(229, 72, 72, 0.1);
  border-radius: 6px;
  white-space: pre-wrap;
  line-height: 1.5;
}

/* 내 정보 모달 — 모바일 최적화 */
@media (max-width: 520px) {
  .myinfo-modal { padding: 14px 14px; }
  .theme-swatch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .myinfo-confirm-actions { flex-direction: column-reverse; }
  .myinfo-confirm-actions .btn-danger,
  .myinfo-confirm-actions .btn-secondary { width: 100%; justify-content: center; }
}

/* ─── 그룹사 관계 카드 (모달) ─────────────────────────── */
.chaebol-section { margin-top: 12px; }
.chaebol-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.chaebol-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 12px;
  align-items: start;
}
.chaebol-row dt {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  padding-top: 4px;
}
.chaebol-row dd {
  margin: 0;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
}
.chaebol-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chaebol-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 12px;
  font-family: inherit;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.chaebol-chip:hover {
  background: var(--active-tint);
  border-color: var(--accent);
  color: var(--accent);
}
.chaebol-chip code {
  font-size: 10px;
  font-family: monospace;
  color: var(--text-secondary);
  letter-spacing: .02em;
}
.chaebol-chip--unlisted {
  cursor: default;
  background: transparent;
  color: var(--text-secondary);
  border-style: dashed;
}
.chaebol-chip--unlisted:hover {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}
.chaebol-chip--share {
  cursor: default;
}
.chaebol-pct {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  font-family: monospace;
}
.chaebol-rel {
  font-size: 10px;
  color: var(--text-secondary);
  background: var(--bg-card);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.chaebol-note {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--disclaimer-tint);
  padding: 6px 10px;
  border-radius: 6px;
  line-height: 1.55;
}
.chaebol-note-link {
  color: var(--accent);
  margin-left: 6px;
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════
   Relations 페이지 (재벌 가계도 + 그룹사 관계도)
   ═══════════════════════════════════════════════════════════ */

.rel-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 20px 60px;
}
.rel-disclaimer {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--disclaimer-tint);
  border: 1px solid var(--orange);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-primary);
}
.rel-disclaimer-icon { font-size: 16px; flex-shrink: 0; }
.rel-disclaimer-text strong { color: var(--orange); }
.rel-disclaimer-text a { color: var(--accent); text-decoration: underline; }

.rel-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.rel-mode-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-primary);
}
.rel-mode-btn {
  padding: 8px 14px;
  font-size: 13px;
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.rel-mode-btn:hover { color: var(--text-primary); }
.rel-mode-btn.is-active {
  background: var(--accent);
  color: #fff;
}

.rel-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.rel-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.rel-control-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.rel-select {
  padding: 6px 10px;
  font-size: 13px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 140px;
}
.rel-view-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.rel-view-btn {
  padding: 6px 10px;
  font-size: 12px;
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  cursor: pointer;
  border-right: 1px solid var(--border);
}
.rel-view-btn:last-child { border-right: 0; }
.rel-view-btn:hover { color: var(--text-primary); }
.rel-view-btn.is-active {
  background: var(--accent);
  color: #fff;
}
.rel-control--check {
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
}
.rel-control--check input { accent-color: var(--accent); }

.rel-canvas-wrap {
  position: relative;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 600px;
  overflow: hidden;
}
html[data-theme="dark"] .rel-canvas-wrap { background: #f8fafc; }
.rel-status {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 5;
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.92);
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.rel-canvas { width: 100%; height: 600px; }
.rel-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}

/* 트리 뷰 */
.rel-tree {
  padding: 24px;
  font-family: 'Pretendard', system-ui, sans-serif;
  overflow-x: auto;
}
.rel-tree-root, .rel-tree-children {
  list-style: none;
  margin: 0;
  padding-left: 0;
}
.rel-tree-children {
  margin-left: 24px;
  border-left: 2px dashed var(--border);
  padding-left: 18px;
  padding-top: 8px;
}
.rel-tree-node { margin: 6px 0; }
.rel-tree-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: #1f2328;
}
html[data-theme="dark"] .rel-tree-card { background: #f8fafc; }
.rel-tree-name { font-weight: 600; }
.rel-tree-code {
  font-family: monospace;
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
  background: var(--active-tint);
  padding: 1px 6px;
  border-radius: 4px;
}
.rel-tree-code:hover { text-decoration: underline; }
.rel-tree-pct {
  font-family: monospace;
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  margin-right: 4px;
}
.rel-tree-badge {
  font-size: 10px;
  background: #dbeafe;
  color: #1e40af;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
}
.rel-tree-badge--rep {
  background: #fef3c7;
  color: #92400e;
}

/* 테이블 뷰 */
.rel-table-wrap { padding: 16px; overflow-x: auto; }
.rel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
  color: #1f2328;
  border-radius: 8px;
  overflow: hidden;
}
html[data-theme="dark"] .rel-table { background: #f8fafc; }
.rel-table th, .rel-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.rel-table th {
  background: var(--bg-hover);
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
  position: sticky;
  top: 0;
}
.rel-table tbody tr:hover { background: var(--active-tint); }
.rel-table a { color: var(--accent); font-family: monospace; text-decoration: none; }
.rel-table a:hover { text-decoration: underline; }

/* 범례 */
.rel-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.rel-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.leg-box {
  display: inline-block;
  width: 18px;
  height: 12px;
  border-radius: 2px;
}
.leg-arrow {
  font-family: monospace;
  color: #94a3b8;
}
.leg-line {
  display: inline-block;
  width: 22px;
  height: 2px;
}
.leg-line--dashed {
  background: transparent !important;
  border-top: 2px dashed;
}
.leg-hint {
  margin-left: auto;
  color: var(--text-secondary);
  font-style: italic;
  font-size: 11px;
}

/* 모바일 */
@media (max-width: 720px) {
  .rel-toolbar { padding: 10px; gap: 10px; }
  .rel-controls { gap: 8px; }
  .rel-canvas { height: 500px; }
  .rel-table th, .rel-table td { padding: 8px; font-size: 12px; }
  .rel-tree-children { margin-left: 12px; padding-left: 10px; }
}
