/* v14: Pretendard self-host — 오프라인 PWA에서도 타이포 유지, CDN 장애 무관 */
@font-face {
  font-family: "Pretendard Variable";
  src: url("../fonts/PretendardVariable.woff2") format("woff2-variations");
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f2f4f6;
  --card: #ffffff;
  --text: #191f28;
  --text-sub: #4e5968;
  --text-weak: #8b95a1;
  --accent: #3182f6;
  --up: #f04452;
  --down: #3182f6;
  --flat: #8b95a1;
  --chip-bg: #ffffff;
  --badge-high-bg: rgba(240, 68, 82, 0.08);
  --spark-fill: rgba(139, 149, 161, 0.10);
  --nav-bg: rgba(242, 244, 246, 0.82);
  --sk-base: #e8ebee;
  --sk-shine: #f6f8fa;
  --radius: 20px;
  --radius-s: 10px;
  --radius-m: 14px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 22px;
  --divider: rgba(128, 128, 128, 0.12);
  --grad-morning: linear-gradient(135deg, #1d4ed8, #7c3aed 55%, #f59e0b 120%);
  --grad-evening: linear-gradient(135deg, #1e1b4b, #86198f 55%, #ea580c 120%);
  --grad-review: linear-gradient(135deg, #3b0764, #6d28d9 60%, #2563eb 120%);
  --shadow: 0 1px 3px rgba(0, 27, 55, 0.06), 0 4px 14px rgba(0, 27, 55, 0.04);
  --shadow-hover: 0 4px 10px rgba(0, 27, 55, 0.08), 0 8px 24px rgba(0, 27, 55, 0.07);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101014;
    --card: #1b1b20;
    --text: #e4e6ea;
    --text-sub: #9aa0a8;
    --text-weak: #6b7178;
    --accent: #4593fc;
    --up: #ff6b75;
    --down: #5c9dff;
    --chip-bg: #1b1b20;
    --badge-high-bg: rgba(255, 107, 117, 0.14);
    --spark-fill: rgba(154, 160, 168, 0.10);
    --nav-bg: rgba(16, 16, 20, 0.82);
    --sk-base: #1b1b20;
    --sk-shine: #26262c;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.25);
    --shadow-hover: 0 4px 10px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  --bg: #101014;
  --card: #1b1b20;
  --text: #e4e6ea;
  --text-sub: #9aa0a8;
  --text-weak: #6b7178;
  --accent: #4593fc;
  --up: #ff6b75;
  --down: #5c9dff;
  --chip-bg: #1b1b20;
  --badge-high-bg: rgba(255, 107, 117, 0.14);
  --spark-fill: rgba(154, 160, 168, 0.10);
  --nav-bg: rgba(16, 16, 20, 0.82);
  --sk-base: #1b1b20;
  --sk-shine: #26262c;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.25);
  --shadow-hover: 0 4px 10px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* 글자 크기 3단계 */
:root[data-fontsize="s"] { font-size: 15px; }
:root[data-fontsize="l"] { font-size: 17.5px; }

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

/* hidden 속성은 display 지정보다 항상 우선 (모달·토글·스트립 숨김 보장) */
[hidden] { display: none !important; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  line-height: 1.5;
  font-size: 1rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.app {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

/* ── 히어로 헤더 ───────────────────── */
.hero {
  position: relative;
  border-radius: 24px;
  padding: 22px 20px 24px;
  color: #fff;
  overflow: hidden;
  background: var(--grad-morning);
  box-shadow: var(--shadow-hover);
  isolation: isolate;
}

/* 판별 그라데이션은 오버레이 레이어의 opacity 전환으로 크로스페이드 */
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.45s ease;
  z-index: -1;
}
.hero::before { background-image: var(--grad-evening); }
.hero::after { background-image: var(--grad-review); }
.hero[data-edition="evening"]::before { opacity: 1; }
.hero[data-edition="review"]::after { opacity: 1; }

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.hero-date { font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.82); }

.hero-actions { display: flex; align-items: center; gap: 7px; }

.hero-updated { font-size: 11px; color: rgba(255, 255, 255, 0.6); margin-right: 2px; }

.glass-btn {
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-radius: 999px;
  width: 31px;
  height: 31px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.glass-btn:active { transform: scale(0.92); }
@media (hover: hover) { .glass-btn:hover { background: rgba(255, 255, 255, 0.28); } }

.hero-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 12px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.12);
}

.hero-headline {
  margin-top: 10px;
  font-size: 17px; /* v14: 본문(15px)과 위계 분리 */
  font-weight: 600;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: -0.01em;
  word-break: keep-all;
}

/* 아침/저녁 세그먼트 (히어로 위 유리 스타일) */
.edition-toggle {
  display: inline-flex;
  gap: 2px;
  margin-top: 12px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.edition-toggle .seg {
  border: none;
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.edition-toggle .seg:active { transform: scale(0.95); }
.edition-toggle .seg.active { background: #fff; color: #1d4ed8; }

/* ── 섹션 퀵 네비게이션 ─────────────── */
.section-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 16px;
  margin: 0 -16px;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  scrollbar-width: none;
}
.section-nav::-webkit-scrollbar { display: none; }

.nav-chip {
  flex: 0 0 auto;
  border: none;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-weak);
  background: transparent;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-chip.active { background: var(--accent); color: #fff; }

/* 앵커 점프 시 sticky 바에 안 가리게 */
.anchor-target { scroll-margin-top: 56px; }

/* ── 스켈레톤 로딩 ─────────────────── */
.skeleton-wrap { padding-top: 18px; }

.sk {
  border-radius: 16px;
  background: linear-gradient(90deg, var(--sk-base) 25%, var(--sk-shine) 45%, var(--sk-base) 65%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.sk-strip { display: flex; gap: 10px; overflow: hidden; margin-bottom: 14px; }
.sk-ind { flex: 0 0 132px; height: 104px; }
.sk-block { height: 150px; border-radius: var(--radius); margin-bottom: 14px; }
.sk-tall { height: 260px; }

/* ── 등장 애니메이션 ────────────────── */
.reveal {
  animation: reveal-in 0.35s ease-out both;
}
@keyframes reveal-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* 판·날짜 전환 크로스페이드 (v14: show()가 .fading 부착·해제) */
#content { transition: opacity 0.15s ease, transform 0.15s ease; }
#content.fading { opacity: 0; transform: translateY(6px); }

@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; }
  .sk { animation: none; }
  #content { transition: none; }
  * { scroll-behavior: auto !important; }
}

/* ── 상태 메시지 ───────────────────── */
.state-msg {
  padding: 48px 0;
  text-align: center;
  color: var(--text-weak);
  font-size: 15px;
}

/* ── 레이아웃 (모바일 1컬럼 / 태블릿·데스크톱 2컬럼) ── */
.layout { padding-top: 18px; }

/* v14: 600-819px 태블릿 세로 — 읽기 폭만 소폭 확대 */
@media (min-width: 600px) and (max-width: 819px) {
  .app { max-width: 740px; }
}

@media (min-width: 820px) {
  .app { max-width: 1080px; }
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    grid-template-areas: "main strips" "main side";
    grid-template-rows: auto 1fr;
    column-gap: 24px;
    align-items: start;
  }
  #mainArea { grid-area: main; }
  #stripsArea { grid-area: strips; }
  #sideArea { grid-area: side; }

  /* 사이드바에선 지표를 세로 리스트로 */
  #stripsArea .indicators {
    flex-direction: column;
    overflow: visible;
    margin: 0;
    padding: 2px 0 14px;
  }
  #stripsArea .indicator { width: 100%; }
}

/* ── 지표·종목 스트립 ───────────────── */
.strip-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-weak);
  padding: 4px 4px 8px;
}

.indicators {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 16px 14px;
  margin: 0 -16px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.indicators::-webkit-scrollbar { display: none; }

.indicator {
  flex: 0 0 auto;
  border: 0; font: inherit; color: inherit; text-align: left;  /* button 으로 쓰여도 동일 렌더 */
  min-width: 132px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px 16px 10px;
  scroll-snap-align: start;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.indicator.tappable { cursor: pointer; }
.indicator.tappable:active { transform: scale(0.96); }
/* v14: 뉴스 카드와 동일한 호버 리프트 */
@media (hover: hover) {
  .indicator.tappable:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
}

.indicator-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-weak);
  white-space: nowrap;
}

.indicator-value {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-top: 2px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.indicator-change {
  font-size: 13px;
  font-weight: 700;
  margin-top: 2px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.chg-up { color: var(--up); }
.chg-down { color: var(--down); }
.chg-flat { color: var(--flat); }

.sparkline { display: block; margin-top: 6px; width: 100%; height: 30px; }

/* ── 카드 공통 ─────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 14px;
}

.card-title { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; word-break: keep-all; }

.summary-card .summary-text {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-sub);
  word-break: keep-all;
}

/* ── 커스텀 오디오 플레이어 ──────────── */
.audio-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
}

/* v14: 좁은 폭에선 2단 — 1행 제목+시크바 전체폭, 2행 버튼 4개 중앙 정렬.
 * 한 줄 flex에서 고정폭 버튼 4개가 제목 폭을 압축해 글자단위 줄바꿈되던 버그의 근본 해소. */
@media (max-width: 430px) {
  .audio-card { flex-wrap: wrap; row-gap: 10px; justify-content: center; }
  /* .audio-card 접두사로 특이도를 올려 뒤에 오는 기본 .audio-main{flex:1 1 auto}를 확실히 이긴다 */
  .audio-card .audio-main { flex-basis: 100%; order: -1; }
}

.play-btn {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.1s ease, filter 0.15s ease;
}
.play-btn:active { transform: scale(0.92); }
@media (hover: hover) { .play-btn:hover { filter: brightness(1.08); } }
.play-btn svg { width: 22px; height: 22px; fill: #fff; }

.audio-main { flex: 1 1 auto; min-width: 0; }

.audio-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 7px;
}
.audio-title { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-time {
  font-size: 12px;
  color: var(--text-weak);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.audio-seek {
  width: 100%;
  height: 5px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  /* 진행분은 JS가 --p(0~100%)로 갱신 */
  background: linear-gradient(to right, var(--accent) var(--p, 0%), var(--bg) var(--p, 0%));
}
.audio-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2.5px solid var(--card);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.audio-seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2.5px solid var(--card);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.speed-btn {
  flex: 0 0 auto;
  border: none;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-sub);
  background: var(--bg);
  border-radius: 999px;
  padding: 7px 11px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: transform 0.1s ease;
}
.speed-btn:active { transform: scale(0.92); }

/* ── 인사이트 카드 ─────────────────── */
.insight-card .insight-title {
  margin-top: 10px;
  font-size: 16px;
  font-weight: 700;
  word-break: keep-all;
}

.insight-card .insight-body p {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-sub);
  word-break: keep-all;
}

.checkpoints {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: 14px;
}

.checkpoints-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-weak);
  margin-bottom: 8px;
}

.checkpoints li {
  list-style: none;
  font-size: 14px;
  color: var(--text-sub);
  padding: 3px 0 3px 22px;
  position: relative;
  word-break: keep-all;
}

.checkpoints li::before {
  content: "✓";
  position: absolute;
  left: 2px;
  color: var(--accent);
  font-weight: 800;
}

/* ── 캘린더 ───────────────────────── */
.calendar-card #calendarList { margin-top: 8px; }

.cal-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--bg);
}
.cal-row:first-child { border-top: none; }

.cal-dday {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
  background: var(--badge-high-bg);
  border-radius: 8px;
  padding: 4px 8px;
  min-width: 48px;
  text-align: center;
}
.cal-dday.soon { color: var(--up); }

.cal-body { min-width: 0; }
.cal-event { font-size: 14px; font-weight: 600; word-break: keep-all; }
.cal-date { font-size: 12px; color: var(--text-weak); margin-top: 1px; }

/* ── 뉴스 섹션 ─────────────────────── */
.section { margin-top: 26px; }

.section-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
  padding: 0 4px 10px;
}

.news-item {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 10px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.news-item:active { transform: scale(0.985); }

/* v19/C10: 액션 버튼을 <a> 밖 형제로 뺐다(접근 가능한 이름 오염 방지).
   .news-item 의 카드 스타일은 그대로 둔다 — 종목 뉴스는 wrapper 없이 같은 클래스를 쓴다. */
.news-item-wrap { position: relative; }
.news-actions {
  position: absolute; top: 15px; right: 16px;
  display: flex; align-items: flex-start; gap: 4px;
}
/* 제목이 액션 줄 밑으로 파고들지 않게 첫 줄에만 자리를 비워 둔다 */
.news-item-wrap .news-head { padding-right: 76px; }
.news-item-wrap.has-thread .news-head { padding-right: 134px; }

@media (hover: hover) {
  .news-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
  }
  .news-item:hover .news-title { color: var(--accent); }
}

.news-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.news-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  word-break: keep-all;
  transition: color 0.12s ease;
}

.badge-high {
  flex: 0 0 auto;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--up);
  background: var(--badge-high-bg);
  border-radius: 999px;
  padding: 2px 8px;
}

.news-summary {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-sub);
  word-break: keep-all;
}

.news-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-weak);
  display: flex;
  align-items: center;
  gap: 6px;
}

.news-source { font-weight: 600; }

/* ── 북마크 버튼 ───────────────────── */
.bookmark-btn {
  flex: 0 0 auto;
  /* 실측 21×17px 이라 빗맞으면 밑에 깔린 기사 링크가 새 탭으로 열렸다(v22).
     시각 크기는 그대로 두고 히트 영역만 넓힌다. */
  min-width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: -2px;
  border: none;
  background: transparent;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-weak);
  padding: 0 2px;
  transition: transform 0.1s ease;
}
.bookmark-btn:active { transform: scale(1.25); }
.bookmark-btn.on { color: #f5b400; }

/* ── 아카이브 · 검색 ────────────────── */
.archive { margin-top: 34px; }

.archive-title {
  font-size: 16px;
  font-weight: 800;
  padding: 0 4px 10px;
  color: var(--text-sub);
}

.search-input {
  width: 100%;
  border: none;
  background: var(--card);
  box-shadow: var(--shadow);
  border-radius: 12px;
  padding: 11px 14px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 10px;
}
.search-input::placeholder { color: var(--text-weak); }

.search-results { margin-bottom: 10px; }
.search-result {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: var(--card);
  box-shadow: var(--shadow);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 6px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
}
.search-result .sr-head { font-size: 13px; font-weight: 700; word-break: keep-all; }
.search-result .sr-meta { font-size: 11px; color: var(--text-weak); margin-top: 2px; }
.search-empty { font-size: 13px; color: var(--text-weak); padding: 6px 4px; }

.archive-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 4px 8px;
  scrollbar-width: none;
}
.archive-chips::-webkit-scrollbar { display: none; }

/* 데스크톱·태블릿 사이드바에선 칩 줄바꿈 */
@media (min-width: 820px) {
  #sideArea .archive { margin-top: 14px; }
  #sideArea .archive-chips { flex-wrap: wrap; overflow: visible; }
}

.chip {
  flex: 0 0 auto;
  border: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  background: var(--chip-bg);
  box-shadow: var(--shadow);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, transform 0.1s ease;
}
.chip:active { transform: scale(0.94); }

.chip.active {
  background: var(--accent);
  color: #fff;
}

.chip-weekly.active { background: #8b5cf6; }

.link-btn {
  border: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  padding: 8px 4px;
  margin-top: 4px;
}

.month-group { margin-top: 10px; }
.month-group-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-weak);
  padding: 0 4px 6px;
}

/* ── 모달 공통 ─────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 0;
}

.modal {
  background: var(--card);
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 22px 22px 0 0;
  padding: 22px 20px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 30px rgba(0, 0, 0, 0.25);
  animation: sheet-up 0.2s ease;
}

@keyframes sheet-up { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }

@media (min-width: 560px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 22px; }
}

/* v14: 유리질감 — 지원 브라우저에서만 배경 블러(비지원 시 기존 딤 유지) */
@supports (backdrop-filter: blur(6px)) {
  .modal-backdrop { backdrop-filter: blur(6px); background: rgba(0, 0, 0, 0.35); }
}
:root[data-theme="dark"] .modal { border: 1px solid rgba(255, 255, 255, 0.06); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .modal { border: 1px solid rgba(255, 255, 255, 0.06); }
}

@media (prefers-reduced-motion: reduce) { .modal { animation: none; } }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.modal-title { font-size: 18px; font-weight: 800; }

.icon-btn {
  border: none;
  background: var(--bg);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
}

/* ── 차트 모달 ─────────────────────── */
.chart-value { margin-bottom: var(--sp-2); }
.chart-value-main { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.chart-price { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.chart-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.chart-badge.chg-up { color: var(--up); background: var(--badge-high-bg); }
.chart-badge.chg-down { color: var(--down); background: var(--spark-fill); }
.chart-badge.chg-flat { color: var(--flat); background: var(--spark-fill); }
.chart-sub { font-size: 12px; color: var(--text-weak); margin-top: 3px; font-variant-numeric: tabular-nums; }
.chart-box { width: 100%; position: relative; }
.chart-box svg { width: 100%; height: auto; display: block; touch-action: none; }
.chart-tip {
  position: absolute;
  pointer-events: none;
  background: var(--card);
  border-radius: var(--radius-s);
  box-shadow: var(--shadow-hover);
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.45;
  white-space: nowrap;
  z-index: 5;
  font-variant-numeric: tabular-nums;
}
.chart-tip .tip-date { color: var(--text-weak); font-size: 11px; }
.chart-tip .tip-price { font-weight: 800; font-size: 13px; }

.range-buttons { display: flex; gap: 8px; margin-top: 14px; }
.range-btn {
  flex: 1;
  border: none;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-sub);
  background: var(--bg);
  border-radius: 10px;
  padding: 9px 0;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.range-btn:active { transform: scale(0.96); }
.range-btn.active { background: var(--accent); color: #fff; }

/* ── 설정 모달 ─────────────────────── */
.settings-msg { font-size: 14px; color: var(--text-weak); padding: 20px 0; text-align: center; }
.settings-hint, .settings-note { font-size: 13px; color: var(--text-weak); margin: 8px 0; }
.settings-account { font-size: 13px; color: var(--text-sub); margin-bottom: 12px; }
.settings-account b { color: var(--text); }

.primary-btn {
  border: none;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 12px;
  padding: 11px 18px;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.primary-btn:active { transform: scale(0.96); }
.primary-btn.small { padding: 9px 14px; font-size: 13px; }

.chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.stock-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg);
  border-radius: 999px;
  padding: 7px 12px;
}
.stock-chip button {
  border: none;
  background: transparent;
  color: var(--text-weak);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.add-row { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.add-input {
  flex: 1 1 40%;
  min-width: 0;
  border: none;
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
}

.catalog { margin-bottom: 16px; }
.catalog-group-title { font-size: 12px; font-weight: 700; color: var(--text-weak); margin: 10px 0 6px; }
.catalog-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.catalog-chip {
  border: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  background: var(--bg);
  border-radius: 999px;
  padding: 6px 11px;
  cursor: pointer;
}
.catalog-chip:disabled { opacity: 0.4; cursor: default; }

.settings-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }

.catalog-chip.on { background: var(--accent); color: #fff; }

/* ── 설정 탭 ──────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 16px;
}
.tab {
  flex: 1;
  border: none;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-weak);
  background: transparent;
  border-radius: 9px;
  padding: 9px 0;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.tab.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

.prefs-label { font-size: 13px; font-weight: 700; color: var(--text-sub); margin-bottom: 8px; }

/* ── 종목 상세 뉴스 (차트 모달 내) ────── */
.stock-news { margin-top: 20px; border-top: 1px solid var(--bg); padding-top: 16px; }
.stock-news-title { font-size: 15px; font-weight: 800; margin-bottom: 10px; }
.stock-news .news-item { padding: 14px 16px; }
.stock-news .news-title { font-size: 14px; }

/* ── 토스트 ───────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  background: rgba(25, 31, 40, 0.92);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── 푸터 ─────────────────────────── */
.footer {
  margin-top: 44px;
  padding: 0 4px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-weak);
  text-align: center;
}

@media (min-width: 480px) {
  .hero-title { font-size: 30px; }
  .hero-headline { font-size: 18px; }
}

/* ── v6: 포트폴리오·타임라인·히트맵·하이라이트 ── */
.strip-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.strip-btn { padding: 0 4px; margin: 0; font-size: 12.5px; }

.indicator-pnl {
  font-size: 12px;
  font-weight: 700;
  margin-top: 1px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pnl-total {
  margin-left: 8px;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* 오늘의 속보 타임라인 */
.breaking {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 6px 16px;
  margin-bottom: 14px;
}
.breaking-row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 9px 0;
}
.breaking-row + .breaking-row { border-top: 1px solid var(--divider); }
.breaking-time {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-weak);
  font-variant-numeric: tabular-nums;
}
.breaking-text { font-size: 13.5px; font-weight: 500; line-height: 1.5; word-break: keep-all; }
.breaking-text a { color: var(--text); text-decoration: none; }
.breaking-text a:active { color: var(--accent); }

/* 캘린더 실적 배지 */
.cal-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(49, 130, 246, 0.12);
  border-radius: 6px;
  padding: 1px 6px;
  vertical-align: 1px;
}

/* 키워드 하이라이트 */
mark.kw {
  background: rgba(240, 68, 82, 0.14);
  color: inherit;
  border-radius: 4px;
  padding: 0 2px;
  font-weight: 700;
}

/* 월간 등락 히트맵 */
.heatmap-scroll { overflow-x: auto; margin: 4px -4px 0; padding: 0 4px; }
.heatmap { border-collapse: collapse; font-size: 12px; white-space: nowrap; }
.heatmap th {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-weak);
  padding: 5px 6px;
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--card);
}
.heatmap thead th { position: static; text-align: center; }
.heatmap td.hm-cell {
  padding: 5px 6px;
  text-align: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border-radius: 4px;
  min-width: 44px;
}
.heatmap-note { font-size: 12px; color: var(--text-weak); margin-top: 10px; }

/* 설정: 종목 편집 패널 */
.stock-chip.selectable { cursor: pointer; }
.stock-chip.active {
  background: var(--accent);
  color: #fff;
}
.stock-chip.active button { color: rgba(255, 255, 255, 0.8); }
.stock-edit {
  background: var(--bg);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
}
.stock-edit .add-input { background: var(--card); }
.stock-edit .add-row { margin-bottom: 8px; }
.stock-edit .settings-hint { margin: 2px 0 0; }
.stock-edit-title { font-size: 13.5px; font-weight: 700; margin-bottom: 10px; }

/* ═══ v7: 신선도·날씨·도넛·읽음·뮤트·캘린더 구독 ═══ */

/* 새 브리핑 도착 배너 */
.fresh-banner {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  box-shadow: var(--shadow-hover);
  cursor: pointer;
  animation: freshIn 0.35s ease;
}
@keyframes freshIn {
  from { opacity: 0; transform: translate(-50%, -12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* 히어로 날씨 한 줄 */
.hero-date-wrap { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.hero-weather { font-size: 13px; opacity: 0.85; white-space: nowrap; }

/* 읽은 기사 */
.news-item.read .news-title { color: var(--text-weak); font-weight: 500; }
.news-item.read .news-summary { opacity: 0.65; }

/* 차단 키워드 접힘 링크 */
.muted-toggle { font-size: 12.5px; color: var(--text-weak); padding: 6px 0 0; }

/* 포트폴리오 배분 도넛 */
.pnl-donut {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 2px 2px 14px;
  padding: 12px 14px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.donut-ring {
  width: 72px;
  height: 72px;
  flex: none;
  border-radius: 50%;
  -webkit-mask: radial-gradient(circle, transparent 54%, #000 55%);
  mask: radial-gradient(circle, transparent 54%, #000 55%);
}
.donut-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.donut-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text-sub);
  white-space: nowrap;
}
.donut-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* 캘린더 구독 버튼 (카드 타이틀 줄) */
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ═══ v8: 톱3·배당 배지·단축키 포커스 ═══ */

/* 오늘의 톱3 */
.top3-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 2px;
  text-decoration: none;
  color: inherit;
  border-radius: 10px;
}
.top3-row + .top3-row { border-top: 1px solid var(--sk-base); }
.top3-row:hover .top3-title { color: var(--accent); }
.top3-num {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.top3-title { font-size: 15px; font-weight: 700; line-height: 1.45; }
.top3-row.read .top3-title { color: var(--text-weak); font-weight: 500; }
.top3-body .news-meta { margin-top: 2px; }

/* 배당 배지 (실적 배지와 동일 형태, 초록 계열) */
.cal-badge.div { background: rgba(18, 184, 134, 0.12); color: #12b886; }

/* j/k 단축키 포커스 표시 */
.news-item:focus-visible, .top3-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ═══ v9: 뒤로가기 모달·오프라인·읽지않음 필터·카드 숨김·북마크 검색·도움말 ═══ */

/* 사용자 카드 숨김 — async 렌더가 hidden을 다시 켜도 이긴다 */
.user-hidden { display: none !important; }

/* 오프라인 배너 (.fresh-banner 변형, 클릭 요소 아님) */
.offline-banner {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  background: var(--text-weak);
  box-shadow: var(--shadow-hover);
  animation: freshIn 0.35s ease;
}

/* 읽지 않은 기사만 보기 */
.unread-bar { display: flex; justify-content: flex-end; margin: 2px 2px 6px; }
#unreadToggle { font-size: 12.5px; color: var(--text-weak); }
#unreadToggle.active { color: var(--accent); font-weight: 700; }
/* wrapper 를 숨긴다 — 링크만 숨기면 액션 줄이 남아 '보이지만 빈 행'이 된다(v19/C10) */
#sections.hide-read .news-item-wrap.read:not(.just-read) { display: none; }
#sections .section.all-read { display: none; }
.all-read-msg {
  padding: 28px 0;
  text-align: center;
  font-size: 14px;
  color: var(--text-sub);
}

/* 북마크 검색·정렬 */
.bm-controls { display: flex; gap: 8px; margin: 10px 0 4px; }
.bm-controls .search-input { flex: 1; margin: 0; min-width: 0; }
.bm-sort {
  flex: none;
  font: inherit;
  font-size: 13px;
  color: var(--text-sub);
  background: var(--card);
  border: 1px solid var(--sk-base);
  border-radius: 10px;
  padding: 0 8px;
}

/* 오디오 ±15초 스킵 */
.skip-btn {
  flex: 0 0 auto;
  border: none;
  font: inherit;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-sub);
  background: var(--bg);
  border-radius: 999px;
  padding: 7px 9px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: transform 0.1s ease;
}
.skip-btn:active { transform: scale(0.92); }

/* 화면 표시 카드 설정 (설정 모달, 로그인 불필요) */
.display-prefs { margin-bottom: 16px; }
.display-prefs .prefs-label { margin-bottom: 8px; }

/* 도움말 모달 */
.help-section-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-sub);
  margin: 16px 0 8px;
}
.kbd-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.kbd-table td { padding: 6px 4px; border-bottom: 1px solid var(--sk-base); }
.kbd-table td:first-child { width: 90px; white-space: nowrap; }
kbd {
  display: inline-block;
  min-width: 20px;
  padding: 2px 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--sk-base);
  border-bottom-width: 2px;
  border-radius: 6px;
}
.help-list { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.8; color: var(--text-sub); }
.footer #helpLink { margin-top: 6px; font-size: 12.5px; color: var(--text-weak); }

/* ══════════════ v12 UX 라운드 ══════════════ */

/* 접근성: 본문 바로가기 (평소 숨김, 키보드 포커스 시 노출) */
.skip-link {
  position: fixed; top: -60px; left: 12px; z-index: 200;
  padding: 10px 16px; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 700;
  text-decoration: none; box-shadow: var(--shadow-hover);
  transition: top .18s ease;
}
.skip-link:focus { top: 12px; }

/* v14: 스크린리더 전용 (라이브 리전 등) */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 접근성: 키보드 포커스만 아웃라인 (마우스 클릭엔 안 뜸) */
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
:focus:not(:focus-visible) { outline: none; }

/* 읽기 진행바 (상단 고정) */
.read-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 90;
  background: transparent; pointer-events: none;
}
.read-progress > span {
  display: block; height: 100%; width: 0;
  background: var(--accent); border-radius: 0 3px 3px 0;
  transform-origin: left; transition: width .08s linear;
}

/* 예상 소요시간 배지 (히어로) */
.read-time {
  align-self: center; font-size: 11.5px; font-weight: 600;
  color: var(--text-weak); white-space: nowrap;
}

/* 당겨서 새로고침 인디케이터 */
.ptr-indicator {
  position: fixed; top: 0; left: 50%; transform: translate(-50%, -44px);
  z-index: 95; width: 34px; height: 34px; border-radius: 50%;
  background: var(--card); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s ease;
}
.ptr-indicator.visible { opacity: 1; }
.ptr-spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2.5px solid var(--sk-base); border-top-color: var(--accent);
}
.ptr-indicator.spinning .ptr-spinner { animation: ptr-spin .7s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* 위로가기 플로팅 버튼 */
.to-top {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 80; width: 44px; height: 44px; border-radius: 50%;
  background: var(--card); color: var(--text); border: 1px solid var(--sk-base);
  box-shadow: var(--shadow-hover); font-size: 20px; cursor: pointer;
  /* visibility 까지 감춰야 한다 — opacity 0 만으로는 탭 순서와 접근성 트리에 남아
     키보드 포커스가 화면에 없는 버튼으로 들어간다(WCAG 2.4.7 위반 — v19/C11).
     transition 에 visibility 를 넣어야 사라지는 애니메이션이 잘리지 않는다. */
  opacity: 0; transform: translateY(8px); pointer-events: none; visibility: hidden;
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}
.to-top.visible { opacity: 1; transform: translateY(0); pointer-events: auto; visibility: visible; }
.to-top:hover { background: var(--bg); }

/* 이어서 읽기 알약 (하단 중앙) */
.resume-pill {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 81;
  padding: 9px 16px; border-radius: 999px;
  background: var(--accent); color: #fff; border: none;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow-hover);
}

/* 첫 방문 코치마크 */
.coach-card {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 10px; padding: 10px 12px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--sk-base); box-shadow: var(--shadow);
  font-size: 12.5px; color: var(--text-sub); line-height: 1.5;
}
.coach-card .coach-text { flex: 1; }
.coach-card kbd {
  padding: 1px 5px; font-size: 11px; font-weight: 700; color: var(--text);
  background: var(--bg); border: 1px solid var(--sk-base); border-radius: 5px;
}
.coach-close {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px;
  background: transparent; border: none; color: var(--text-weak);
  font-size: 14px; cursor: pointer;
}
.coach-close:hover { background: var(--bg); }

/* 기사 개별 공유 버튼 (북마크 버튼 옆) */
.share-btn {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px;
  background: transparent; border: none; color: var(--text-weak);
  font-size: 14px; cursor: pointer; line-height: 1;
}
.share-btn:hover { background: var(--bg); color: var(--accent); }

/* 커맨드 팔레트 */
.cmdk-backdrop { align-items: flex-start; }
.cmdk {
  width: min(560px, 92vw); margin-top: 12vh; background: var(--card);
  border-radius: 16px; box-shadow: var(--shadow-hover); overflow: hidden;
  display: flex; flex-direction: column; max-height: 68vh;
}
.cmdk-input {
  width: 100%; padding: 16px 18px; border: none; outline: none;
  background: transparent; color: var(--text); font: inherit; font-size: 16px;
  border-bottom: 1px solid var(--sk-base);
}
.cmdk-list { overflow-y: auto; padding: 6px; -webkit-overflow-scrolling: touch; }
.cmdk-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border: none; border-radius: 10px; cursor: pointer;
  background: transparent; color: var(--text); font: inherit; font-size: 14px; text-align: left;
}
.cmdk-item .cmdk-ic { flex-shrink: 0; width: 20px; text-align: center; }
.cmdk-item .cmdk-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item .cmdk-hint { flex-shrink: 0; font-size: 11.5px; color: var(--text-weak); }
.cmdk-item.active, .cmdk-item:hover { background: var(--bg); }
.cmdk-item.active { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cmdk-empty { padding: 20px; text-align: center; color: var(--text-weak); font-size: 13.5px; }
.cmdk-group { padding: 8px 12px 4px; font-size: 11px; font-weight: 700; color: var(--text-weak); letter-spacing: .02em; }

@media (prefers-reduced-motion: reduce) {
  .read-progress > span, .to-top, .ptr-indicator, .skip-link { transition: none; }
  .ptr-indicator.spinning .ptr-spinner { animation: none; }
}

/* ══════════ v16: 스토리라인 · 종목 AI 코멘트 · 성과·리스크 · 시스템 상태 ══════════ */

/* 기사 카드의 "N일째" 배지 — badge-high 와 같은 크기, 색만 중립 */
.badge-thread {
  flex: 0 0 auto;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(49, 130, 246, 0.10);
  border: 0;
  border-radius: 999px;
  padding: 2px 8px;
  cursor: pointer;
}
.badge-thread:hover { background: rgba(49, 130, 246, 0.18); }

/* ── 스토리라인 모달 ── */
.thread-meta {
  font-size: 13px;
  color: var(--text-weak);
  margin-bottom: var(--sp-3);
}
.thread-timeline { display: flex; flex-direction: column; gap: var(--sp-2); }
.thread-day {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: var(--sp-3);
  border: 0;
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-s);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.thread-day:hover { background: var(--sk-base); }
.thread-date { font-size: 12px; font-weight: 700; color: var(--accent); }
.thread-headline { font-size: 13.5px; line-height: 1.5; color: var(--text-sub); }

/* ── 차트 모달 안의 종목 AI 코멘트 ── */
.stock-ai {
  margin: var(--sp-3) 0;
  padding: var(--sp-3);
  border-radius: var(--radius-m);
  background: var(--bg);
}
.stock-ai-head { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.stock-ai-trend { font-size: 13px; font-weight: 800; }
.stock-ai-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-weak);
  border: 1px solid var(--divider);
  border-radius: 999px;
  padding: 1px 7px;
}
.stock-ai-impact { font-size: 12px; font-weight: 800; letter-spacing: -0.2px; }
.stock-ai-summary { font-size: 13.5px; line-height: 1.65; color: var(--text-sub); margin: 0; }
.stock-ai-watch { font-size: 13px; line-height: 1.6; color: var(--text); margin: var(--sp-2) 0 0; font-weight: 600; }

/* ── 인과 체인 (v21) — 분기가 없으므로 flex 한 줄기면 충분하다 ── */
.causal-chain { margin-top: var(--sp-4); }
.causal-chain-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-weak);
  margin-bottom: var(--sp-2);
}
.chain { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.chain-node {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--divider);
  border-radius: var(--radius-m);
  background: var(--bg);
  max-width: 100%;
}
.chain-node-name { font-size: 12.5px; font-weight: 800; }
.chain-node-note { font-size: 11.5px; color: var(--text-weak); line-height: 1.45; }
.chain-arrow { font-size: 13px; font-weight: 800; color: var(--text-weak); }

/* ── SEC 공시 (v21) ── */
.stock-filings { margin: var(--sp-3) 0; }
.stock-filings-head {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-weak);
  margin-bottom: var(--sp-2);
}
.filing-item {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding: var(--sp-2) 0;
  border-top: 1px solid var(--divider);
  text-decoration: none;
  color: inherit;
}
.filing-form { font-size: 11.5px; font-weight: 800; color: var(--accent, #3182f6); }
.filing-desc { font-size: 13px; color: var(--text-sub); flex: 1 1 auto; }
.filing-date { font-size: 11.5px; color: var(--text-weak); }

/* ── 성과 · 리스크 모달 ── */
.perf-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin: var(--sp-3) 0;
  font-size: 12.5px;
  color: var(--text-sub);
}
.perf-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.perf-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.perf-metrics { display: flex; flex-direction: column; gap: 1px; }
.perf-metric {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--divider);
  font-size: 13.5px;
}
.perf-metric:last-child { border-bottom: 0; }
.perf-metric-label { color: var(--text-sub); }
.perf-metric-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.perf-note, .perf-empty {
  font-size: 12px;
  color: var(--text-weak);
  line-height: 1.6;
  margin-top: var(--sp-3);
}
.perf-empty { text-align: center; padding: var(--sp-5) 0; }

/* ── 시스템 상태 모달 ── */
.health-rate { font-size: 15px; font-weight: 800; }
.health-sub { font-size: 12.5px; color: var(--text-weak); margin-top: 2px; }
.health-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: var(--sp-4) 0;
}
.health-cell {
  width: 15px;
  height: 15px;
  border: 0;
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
}
.health-cell.ok { background: #12b886; }
.health-cell.fail { background: var(--up); }
/* 성공이지만 fail-soft 단계가 실패한 회차 — 초록도 빨강도 아니다 (v20) */
.health-cell.warn { background: #f59e0b; }
.health-cell:hover { outline: 2px solid var(--text-weak); outline-offset: 1px; }
.health-detail-head { font-size: 13.5px; font-weight: 700; margin-bottom: var(--sp-2); }
.health-fail-note, .health-warn-note {
  font-size: 12.5px;
  line-height: 1.6;
  border-radius: var(--radius-s);
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-2);
  word-break: break-all;
}
.health-fail-note { color: var(--up); background: var(--badge-high-bg); }
.health-warn-note { color: var(--text-sub); background: var(--bg); }
.health-steps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 2px var(--sp-3);
}
.health-step {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  font-size: 12.5px;
  padding: 3px 0;
  color: var(--text-sub);
}
.health-step.fail { color: var(--up); font-weight: 700; }
.health-step.ok::before { content: "✓ "; color: #12b886; }
.health-step.fail::before { content: "✕ "; }
.health-step-sec { color: var(--text-weak); font-variant-numeric: tabular-nums; }

/* ══ v17 체크포인트 결산 ══ */
.review-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.review-item {
  padding: 10px 12px; border-radius: 10px;
  background: var(--bg-subtle, rgba(127, 127, 127, .07));
  border-left: 3px solid var(--border, rgba(127, 127, 127, .3));
}
.review-item.v-hit { border-left-color: #12b886; }
.review-item.v-miss { border-left-color: #f04452; }
.review-item.v-unknown { border-left-color: #f28f28; }
.review-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.review-verdict { font-size: .82rem; font-weight: 700; white-space: nowrap; }
.v-hit .review-verdict { color: #12b886; }
.v-miss .review-verdict { color: #f04452; }
.v-unknown .review-verdict { color: #f28f28; }
.review-text { font-size: .92rem; font-weight: 600; line-height: 1.45; }
.review-note {
  margin: 6px 0 0; font-size: .84rem; line-height: 1.5;
  color: var(--text-muted, #888);
}
.review-score {
  margin-top: 12px; padding-top: 10px; font-size: .84rem;
  color: var(--text-muted, #888);
  border-top: 1px solid var(--border, rgba(127, 127, 127, .2));
}

/* ══ v17 진행 중인 이슈 ══ */
#threadsList { display: grid; gap: 6px; }
.thread-row {
  display: flex; gap: 10px; align-items: baseline; width: 100%;
  padding: 9px 11px; border: 0; border-radius: 10px; cursor: pointer;
  text-align: left; font: inherit;
  background: var(--bg-subtle, rgba(127, 127, 127, .07));
  color: inherit;
}
.thread-row:hover { background: var(--bg-hover, rgba(127, 127, 127, .14)); }
.thread-row-day {
  flex: none; font-size: .74rem; font-weight: 700;
  color: var(--accent, #3182f6);
}
.thread-row-title {
  font-size: .87rem; line-height: 1.4;
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* v26: 정적 페이지(소개·방침·아카이브)로 나가는 푸터 링크 — 크롤러의 진입 경로이기도 하다 */
.footer-links { margin: 10px 0 0; font-size: .85rem; }
.footer-links a { color: var(--muted, #7a828e); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
