/* 홈 뷰 전용 스타일. main.css 와 병행 사용.
   body 가 max-width:480px + margin:0 auto 로 이미 viewport 가운데 정렬되므로
   home-wrap 은 자연 흐름으로 두면 자동으로 가운데 + 460px 폭. */

.home-wrap {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 2px 12px 80px;
  box-sizing: border-box;
  width: 100%;
}

/* AI 종합판단 큰 카드 — 오렌지 글로우 강조 */
/* AI 브리핑 카드 — base = 라이트(기본 테마는 data-theme 미설정), 다크는 아래 [data-theme="dark"] 로 오버라이드 */
.home-ai-card {
  background: linear-gradient(180deg, #FFF7ED, #FFFFFF 72%);
  border: 1px solid rgba(234, 88, 12, 0.28);
  border-radius: 18px;
  padding: 14px 18px;
  margin: 0 0 20px;
  box-shadow: 0 4px 18px -8px rgba(234, 88, 12, 0.18);
}
[data-theme="dark"] .home-ai-card {
  background:
    linear-gradient(180deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.04) 60%, rgba(20, 20, 26, 0) 100%),
    rgba(20, 20, 26, 0.65);
  border: 1px solid rgba(245, 158, 11, 0.35);
  box-shadow: 0 6px 24px -8px rgba(245, 158, 11, 0.15);
}
.home-ai-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: -6px;
}
.home-ai-label {
  font-size: 11px; color: #EA580C;
  font-weight: 600; letter-spacing: 0.3px;
}
[data-theme="dark"] .home-ai-label { color: rgba(245, 158, 11, 0.85); }
.home-ai-badge {
  background: rgba(234, 88, 12, 0.12); color: #EA580C;
  font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 10px;
  letter-spacing: 0.5px;
}
[data-theme="dark"] .home-ai-badge { background: rgba(245, 158, 11, 0.18); color: #f59e0b; }
.home-ai-body {
  font-size: 18px; font-weight: 800; line-height: 1.1;
  color: var(--text);                          /* 테마 변수 — 라이트 #1C1C1E / 다크 #E8E8EC */
  letter-spacing: -0.2px;
  white-space: pre-line;                       /* 백엔드 \n 분리 → 요약/인사이트 줄바꿈 */
}
/* 인라인 모드 첫 자식 = brief-inline-top 위 공백 차단 */
.home-ai-body .brief-inline > *:first-child { margin-top: 0 !important; }
.home-ai-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0;
  margin: 6px 0 18px;
  font-size: 11.5px; color: var(--sub);
}
.home-ai-meta .meta-item {
  display: inline-flex; align-items: center; gap: 4px;
}
.home-ai-meta .meta-item + .meta-item::before {
  content: ''; display: inline-block;
  width: 3px; height: 3px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.18);
  margin: 0 8px;
}
[data-theme="dark"] .home-ai-meta .meta-item + .meta-item::before { background: rgba(255, 255, 255, 0.25); }
.home-ai-meta .meta-key { color: var(--sub); }
.home-ai-meta .meta-val { color: var(--text); font-weight: 700; }
.home-ai-meta .meta-val.up   { color: var(--green); }
.home-ai-meta .meta-val.down { color: var(--red); }

/* ── AI 브리핑 진입 바 (home-ai-body 내부) ─────────────────────── */
.home-ai-body .brief-bar {
  display: flex; flex-direction: column; gap: 6px;
  width: 100%; text-align: left;
  background: transparent; border: 0; cursor: pointer;
  padding: 0; font-family: inherit; color: inherit;
}
.home-ai-body .brief-bar-time {
  font-size: 11px; font-weight: 600;
  color: rgba(255, 255, 255, 0.45); letter-spacing: -0.1px;
}
.home-ai-body .brief-bar-line {
  font-size: 17px; font-weight: 800; line-height: 1.4;
  letter-spacing: -0.3px; color: var(--text-primary, #fff);
}
.home-ai-body .brief-bar-badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 800; letter-spacing: -0.1px;
  padding: 3px 9px; border-radius: 8px; margin-right: 8px;
  vertical-align: middle;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
}
.home-ai-body .brief-bar-hint {
  font-size: 11.5px; font-weight: 600; letter-spacing: -0.1px;
  color: #f59e0b; margin-top: 2px;
}
/* 2026-05-28: AI 브리핑 — 메인 카드(메타+헤드라인+요약) + 카드 밖 섹션 타일 */
.home-ai-body .brief-inline {
  display: block; text-align: left;
  padding: 0;
}
.home-ai-body .brief-inline-top {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 4px;
}
.home-ai-body .brief-inline .bm-meta { margin-bottom: 0; }
.home-ai-body .brief-inline .bm-headline {
  font-size: 19px; line-height: 1.3; margin: 0 0 10px;
}
.home-ai-body .brief-inline .bm-summary { margin: 0; padding: 12px 14px; }

/* 카드 밖 섹션 타일 — 조용한 회색 카드, emoji 원형 뱃지 + title + body */
.ai-section-tile {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--card, rgba(255,255,255,0.04));
  border: 1px solid var(--sep, rgba(255,255,255,0.07));
  border-radius: 14px;
  padding: 14px 16px;
  margin: 10px 0;
}
.ai-section-tile .ast-icon {
  flex-shrink: 0; width: 36px; height: 36px;
  border-radius: 50%; background: rgba(245, 158, 11, 0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1;
}
.ai-section-tile .ast-body { flex: 1; min-width: 0; }
.ai-section-tile .ast-title {
  font-size: 14.5px; font-weight: 800; letter-spacing: -0.2px;
  margin: 0 0 4px; color: var(--text, #1a1a1a);
}
.ai-section-tile .ast-text {
  font-size: 13px; line-height: 1.6; color: var(--sub, #6b7280);
  margin: 0; letter-spacing: -0.1px;
}
[data-theme="light"] .ai-section-tile {
  background: #fff; border-color: #ececec;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
[data-theme="light"] .ai-section-tile .ast-icon { background: #FFF4E5; }
[data-theme="light"] .ai-section-tile .ast-text { color: #4b5563; }

.ai-brief-disclaimer {
  font-size: 11px; line-height: 1.5; color: var(--sub, #9ca3af);
  text-align: center; margin: 14px 4px 18px;
  letter-spacing: -0.1px;
}
.home-ai-body .brief-pm {
  display: inline-block; margin-left: 8px;
  font-size: 10.5px; font-weight: 800; letter-spacing: -0.1px;
  padding: 2px 7px; border-radius: 6px; vertical-align: middle;
}
.home-ai-body .brief-pm.up { background: rgba(16, 185, 129, 0.16); color: #10b981; }
.home-ai-body .brief-pm.down { background: rgba(239, 68, 68, 0.16); color: #ef4444; }
.home-ai-body .brief-bar:hover .brief-bar-line { opacity: 0.85; }
.home-ai-body .brief-bar:hover .brief-bar-hint { opacity: 0.8; }
[data-theme="light"] .home-ai-body .brief-bar-time { color: #9ca3af; }
[data-theme="light"] .home-ai-body .brief-bar-line { color: #1a1a1a; }

/* ── 주요 뉴스 피드 (홈) ───────────────────────────────────────── */
.news-feed { margin-bottom: 20px; }
.news-feed .nf-list {
  display: flex; flex-direction: column;
  background: rgba(28, 28, 34, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px; overflow: hidden;
}
[data-theme="light"] .news-feed .nf-list { background: #fafafa; border-color: #ececf0; }
.nf-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px; text-decoration: none;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  transition: background .12s;
}
.nf-item:first-child { border-top: 0; }
.nf-item:hover { background: rgba(245, 158, 11, 0.06); }
[data-theme="light"] .nf-item { border-top-color: #f0f0f3; }
.nf-text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.nf-src {
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  color: #f59e0b;
}
.nf-title {
  font-size: 14px; font-weight: 700; line-height: 1.35;
  color: var(--text-primary, #fff); letter-spacing: -0.2px;
}
[data-theme="light"] .nf-title { color: #1a1a1a; }
.nf-snippet {
  font-size: 12px; font-weight: 400; line-height: 1.45;
  color: rgba(255, 255, 255, 0.5);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
[data-theme="light"] .nf-snippet { color: #374151; }
.nf-meta {
  font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, 0.4);
  margin-top: 2px;
}
[data-theme="light"] .nf-meta { color: #6b7280; }
[data-theme="light"] .nf-meta { color: #9ca3af; }
.nf-thumb {
  flex-shrink: 0; width: 76px; height: 76px; border-radius: 12px;
  background-size: cover; background-position: center;
  background-color: rgba(255, 255, 255, 0.06);
}
.nf-thumb-ph {
  background-image: linear-gradient(135deg, rgba(245,158,11,0.25), rgba(234,88,12,0.12));
  position: relative;
}
.nf-thumb-ph::after {
  content: '📰'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; opacity: 0.55;
}
.nf-item { width: 100%; text-align: left; background: transparent; border: 0; cursor: pointer; font-family: inherit; }

/* ── 뉴스 상세 시트 (.brief-modal 재사용) ──────────────────────── */
.ns-hero {
  width: 100%; height: 180px; border-radius: 14px;
  background-size: cover; background-position: center;
  background-color: rgba(255,255,255,0.06); margin-bottom: 16px;
}
.ns-src { font-size: 11px; font-weight: 800; letter-spacing: 0.04em; color: #f59e0b; margin-bottom: 6px; }
.ns-title {
  font-size: 20px; font-weight: 800; line-height: 1.35;
  letter-spacing: -0.3px; color: var(--text-primary, #fff); margin: 0 0 8px;
}
[data-theme="light"] .ns-title { color: #111; }
.ns-meta { font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.4); margin-bottom: 16px; }
[data-theme="light"] .ns-meta { color: #9ca3af; }
.ns-summary {
  font-size: 14px; line-height: 1.7; font-weight: 400;
  color: rgba(255,255,255,0.78); margin: 0 0 20px;
}
[data-theme="light"] .ns-summary { color: #374151; }
.ns-open {
  display: block; text-align: center; text-decoration: none;
  padding: 14px; border-radius: 12px;
  background: linear-gradient(135deg, #f59e0b, #ea580c); color: #fff;
  font-size: 14px; font-weight: 800; letter-spacing: -0.2px;
}
.ns-open:active { transform: scale(0.98); }
.nf-rest { display: flex; flex-direction: column; }
.nf-more {
  width: 100%; padding: 12px; border: 0; cursor: pointer;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: transparent; color: rgba(255,255,255,0.55);
  font-size: 12px; font-weight: 700; font-family: inherit;
  transition: color .15s, background .15s;
}
.nf-more:hover { color: #f59e0b; background: rgba(245,158,11,0.05); }
[data-theme="light"] .nf-more { color: #6b7280; border-top-color: #f0f0f3; }

/* ── AI 브리핑 상세 모달 ───────────────────────────────────────── */
body.brief-modal-open { overflow: hidden; }
.brief-modal {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, 0);
  transition: background .24s ease;
}
.brief-modal.open { background: rgba(0, 0, 0, 0.55); }
.brief-modal .bm-sheet {
  width: 100%; max-width: 480px; max-height: 92vh;
  display: flex; flex-direction: column;
  background: #15151b;
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.2, .8, .25, 1);
}
.brief-modal.open .bm-sheet { transform: translateY(0); }
[data-theme="light"] .brief-modal .bm-sheet { background: #fff; }
.bm-head {
  position: relative; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
[data-theme="light"] .bm-head { border-bottom-color: rgba(0, 0, 0, 0.08); }
.bm-head-title { font-size: 15px; font-weight: 800; color: var(--text-primary, #fff); letter-spacing: -0.2px; }
[data-theme="light"] .bm-head-title { color: #1a1a1a; }
.bm-close {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border: 0; border-radius: 8px;
  background: transparent; cursor: pointer;
  color: rgba(255, 255, 255, 0.6); font-size: 16px;
}
.bm-close:hover { background: rgba(255, 255, 255, 0.08); }
[data-theme="light"] .bm-close { color: #6b7280; }
.bm-scroll { overflow-y: auto; padding: 20px 18px 32px; -webkit-overflow-scrolling: touch; }
.bm-meta { font-size: 12.5px; color: rgba(255, 255, 255, 0.5); font-weight: 600; margin-bottom: 12px; }
[data-theme="light"] .bm-meta { color: #6b7280; }
.bm-headline {
  font-size: 22px; font-weight: 800; line-height: 1.35;
  letter-spacing: -0.4px; color: var(--text-primary, #fff);
  margin: 0 0 16px;
}
[data-theme="light"] .bm-headline { color: #111; }
.bm-summary {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px; padding: 14px 16px; margin-bottom: 20px;
}
[data-theme="light"] .bm-summary { background: #f6f7f9; border-color: #eceef1; }
.bm-summary-label {
  font-size: 12px; font-weight: 800; color: rgba(255, 255, 255, 0.5);
  margin-bottom: 8px; letter-spacing: 0.02em;
}
[data-theme="light"] .bm-summary-label { color: #6b7280; }
.bm-summary ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.bm-summary li {
  position: relative; padding-left: 14px;
  font-size: 13.5px; line-height: 1.55; color: rgba(255, 255, 255, 0.82); font-weight: 500;
}
.bm-summary li::before { content: '·'; position: absolute; left: 2px; color: #f59e0b; font-weight: 800; }
[data-theme="light"] .bm-summary li { color: #374151; }
.bm-section { margin-bottom: 20px; }
.bm-sec-title {
  font-size: 15px; font-weight: 800; line-height: 1.4;
  color: var(--text-primary, #fff); margin: 0 0 6px; letter-spacing: -0.2px;
}
[data-theme="light"] .bm-sec-title { color: #1a1a1a; }
.bm-sec-body {
  font-size: 13.5px; line-height: 1.65; font-weight: 500;
  color: rgba(255, 255, 255, 0.72); margin: 0;
}
[data-theme="light"] .bm-sec-body { color: #4b5563; }
.bm-sources { border-top: 1px solid rgba(255, 255, 255, 0.08); padding-top: 16px; margin-top: 4px; }
[data-theme="light"] .bm-sources { border-top-color: #eceef1; }
.bm-sources-label { font-size: 12px; font-weight: 800; color: rgba(255, 255, 255, 0.5); margin-bottom: 10px; }
[data-theme="light"] .bm-sources-label { color: #6b7280; }
.bm-sources ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bm-sources a {
  display: flex; flex-direction: column; gap: 2px;
  text-decoration: none; padding: 8px 10px; border-radius: 10px;
  transition: background .15s;
}
.bm-sources a:hover { background: rgba(245, 158, 11, 0.1); }
.bm-src-name { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; color: #f59e0b; }
.bm-src-title { font-size: 13px; font-weight: 500; line-height: 1.4; color: rgba(255, 255, 255, 0.82); }
[data-theme="light"] .bm-src-title { color: #374151; }
.bm-disclaimer {
  margin-top: 18px; font-size: 10.5px; line-height: 1.5;
  color: rgba(255, 255, 255, 0.35); font-weight: 500;
}
[data-theme="light"] .bm-disclaimer { color: #9ca3af; }

/* 섹션 라벨 — Coinbase "Watchlist / Trending" 스타일 (작고 회색) */
.home-section-label {
  font-size: 13px; font-weight: 700; color: var(--text-primary, #fff);
  margin: 16px 4px 10px;
  letter-spacing: -0.1px;
}
.home-section-label:first-of-type { margin-top: 8px; }

/* 2열 그리드 — 카드형 home-tile 들을 격자로 배치 */
.home-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}
@media (max-width: 360px) {
  .home-tiles { gap: 8px; }
}

/* 행 리스트 — 한 섹션에 여러 행이 들어감. 행 간 1px hairline. */
.home-rows {
  display: flex;
  flex-direction: column;
  background: rgba(28, 28, 34, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 8px;
}

/* 행 — 좌: 아이콘, 가운데: 제목+부제, 우: 화살표 */
.home-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 14px 14px 12px;
  background: transparent;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
  /* tile 시절의 column flex 와 min-height 무력화 */
  flex-direction: row !important;
  min-height: 0 !important;
  border-radius: 0;
}
.home-row:first-child { border-top: 0; }
.home-row:not(:disabled):hover { background: rgba(255, 255, 255, 0.03); }
.home-row:not(:disabled):active { background: rgba(245, 158, 11, 0.06); }

/* 아이콘 — 행 좌측, 38x38 */
.hr-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  background: rgba(245, 158, 11, 0.10);
  border-radius: 10px;
  color: #f59e0b;
}
.hr-icon svg { width: 22px; height: 22px; display: block; }

/* 텍스트 — 가운데 영역, 제목 + 부제 세로 stack */
.hr-text {
  flex: 1 1 auto;
  display: flex; flex-direction: column;
  min-width: 0;
}
.hr-title {
  font-size: 15px; font-weight: 700;
  color: var(--text-primary, #fff);
  letter-spacing: -0.1px;
  line-height: 1.25;
}
.hr-sub {
  font-size: 12px; color: var(--text-secondary, #9ca3af);
  margin-top: 2px;
  line-height: 1.3;
}

/* 우측 chevron — sub 색, 작게 */
.hr-chev {
  flex-shrink: 0;
  color: var(--text-secondary, #9ca3af);
  opacity: 0.5;
  display: inline-flex;
  align-items: center;
}
.hr-chev svg { width: 16px; height: 16px; display: block; }
.home-row:hover .hr-chev { opacity: 0.85; }
.home-tile {
  position: relative;
  background: rgba(28, 28, 34, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 16px 14px 14px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
  display: flex; flex-direction: column; gap: 6px;
  min-height: 116px;
}
.home-tile:not(:disabled):hover {
  border-color: rgba(245, 158, 11, 0.25);
  background: rgba(36, 36, 44, 0.9);
}
.home-tile:not(:disabled):active { transform: scale(0.97); }
.home-tile:disabled { opacity: 0.45; cursor: default; }

/* KR 모드 미지원 타일 — 회색 + "준비 중" 배지 */
.home-tile.tile-disabled {
  opacity: 0.42;
  cursor: not-allowed;
  position: relative;
}
.home-tile.tile-disabled:hover {
  border-color: var(--sep, rgba(255,255,255,0.06));
  background: rgba(36, 36, 44, 0.4);
}
.home-tile .tile-soon {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  letter-spacing: 0.3px;
}

/* 아이콘 — 둥근 사각형 컨테이너에 오렌지 line svg */
.ht-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  background: rgba(245, 158, 11, 0.12);
  border-radius: 10px;
  color: #f59e0b;
  margin-bottom: 6px;
}
.ht-icon svg {
  width: 22px; height: 22px;
  display: block;
}
.ht-title {
  font-size: 14px; font-weight: 700;
  color: var(--text-primary, #fff);
  letter-spacing: -0.1px;
}
.ht-sub {
  font-size: 11px; color: var(--text-secondary, #9ca3af);
  margin-top: 1px;
}

/* NEW 배지 — 오렌지 pill, 우상단 */
.ht-badge {
  position: absolute; top: 10px; right: 10px;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
  font-size: 9px; font-weight: 800;
  padding: 3px 8px; border-radius: 999px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px -1px rgba(245, 158, 11, 0.4);
}

/* "← 홈" 플로팅 버튼 — 480px 컬럼 안쪽 좌상단에 위치 */
.back-to-home-btn {
  position: fixed;
  top: 14px;
  left: max(12px, calc(50% - 228px));
  z-index: 100;
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--sep);
  border-radius: 999px;                         /* pill */
  padding: 7px 14px 7px 11px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: transform .12s, box-shadow .15s, border-color .15s;
}
.back-to-home-btn::before {
  content: '';
  width: 14px; height: 14px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M15 18l-6-6 6-6'/></svg>") center/contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M15 18l-6-6 6-6'/></svg>") center/contain no-repeat;
  flex-shrink: 0;
  color: var(--accent);
}
.back-to-home-btn:hover { transform: translateY(-1px); border-color: var(--accent); box-shadow: 0 6px 18px rgba(234, 88, 12, 0.18); }
.back-to-home-btn:active { transform: scale(0.97); }
[data-theme="dark"] .back-to-home-btn { box-shadow: 0 2px 14px rgba(0, 0, 0, 0.45); }
.back-to-home-btn[hidden] { display: none !important; }

/* with-back 상태에서 헤더 좌측 padding 불필요 — main.css 가 .menu-btn 을 visibility:hidden 으로
   처리해 grid track 이 그대로 남아있고 col 2(date+title) 가 자연 중앙 정렬됨. */

/* 탭 바 영구 숨김 — 네비는 홈 타일 + ← 홈 버튼만 사용 */
.tab-bar { display: none !important; }

/* 탭 페이지 제목 (섹터 펀더멘털 갭, 섹터 모멘텀) */
.page-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary, #fff);
  margin: 4px 4px 16px;
  letter-spacing: -0.2px;
}

/* 섹터 모달 — 앱 형식: 480px 폭 viewport 가운데 정렬, 양옆은 backdrop */
.home-modal {
  position: fixed;
  top: 0; bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 200;
  background: var(--bg-primary, #0f172a);
  overflow-y: auto;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,0.6);  /* 좌우 viewport 를 어둡게 (backdrop) */
  clip-path: inset(0 -100vmax);                /* 그림자가 viewport 끝까지 펴지도록 */
}
.home-modal-head {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-primary, #0f172a);
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.06));
  font-size: 14px; font-weight: 700; color: var(--text-primary, #fff);
}
.home-modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 24px; line-height: 1; color: var(--text-primary, #fff);
  width: 28px; padding: 0;
}
.home-modal-body { padding: 16px; }

/* 섹터 모멘텀 테이블 */
.sm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sm-table th {
  text-align: left; color: var(--text-secondary, #9ca3af);
  font-weight: 800; padding: 10px 6px; border-bottom: 1px solid var(--sep);
  letter-spacing: -0.01em;
}
.sm-table td {
  padding: 12px 6px; border-bottom: 1px solid var(--sep);
  color: var(--text-primary, #fff);
  font-weight: 700;
}
.sm-table .num { font-family: ui-monospace, monospace; text-align: right; font-weight: 800; }
.sm-chip {
  display: inline-block; padding: 2px 8px; border-radius: 8px;
  font-size: 11px; font-weight: 700; min-width: 36px; text-align: center;
}
.sm-chip.over   { background: rgba(96, 165, 250, 0.2); color: #60a5fa; }
.sm-chip.under  { background: rgba(248, 113, 113, 0.2); color: #f87171; }
.sm-chip.flat   { background: rgba(156, 163, 175, 0.2); color: #9ca3af; }

/* 섹터 밸류 히트맵 (CSS grid 기반, ECharts 안 써도 되도록) */
.sv-grid {
  display: grid; grid-template-columns: 1fr auto auto; gap: 6px 10px;
  font-size: 12px;
  align-items: center;                         /* 셀 세로 가운데 정렬 — sv-name 2줄일 때 옆 박스 중앙 */
}
.sv-grid .sv-h {
  font-weight: 600; color: var(--text-secondary, #9ca3af);
  padding-bottom: 6px; border-bottom: 1px solid var(--sep);
}
.sv-cell {
  padding: 6px 10px; border-radius: 6px;
  font-family: ui-monospace, monospace; font-weight: 600; text-align: right;
  color: var(--text);                          /* 라이트=어둠, 다크=밝음 — 틴트 배경 위 텍스트 가독 */
}
.sv-name {
  color: var(--text-primary, #fff); padding: 6px 0;
  word-break: keep-all;                        /* 한국어 단어 단위 줄바꿈 — '필수 소비재' 공백서만 깨짐 */
  line-height: 1.3;
}
.sv-label { padding: 6px 8px; font-weight: 700; text-align: center; font-size: 11px; }

/* 시장 밸류 — 분해 상세페이지 트리거 (메인엔 버튼 1개만) */
.mv-detail-trigger {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; margin: 8px 0;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  color: var(--text-primary, #fff);
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
}
.mv-detail-trigger:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.15); }
.mv-detail-trigger:active { transform: scale(0.99); }
.mv-trigger-label { font-weight: 700; font-size: 14px; }
.mv-trigger-sub   { flex: 1; font-size: 11px; color: var(--text-secondary, #9ca3af); text-align: left; }
.mv-trigger-arrow { font-size: 16px; color: #ff8c00; }
.sv-phase {
  margin-bottom: 12px; font-size: 12px; color: var(--text-secondary, #9ca3af);
}
.sv-phase strong { color: var(--text-primary, #fff); font-weight: 700; }

/* ── Market Valuation (ERP / Fed Model) 페이지 ─────────────────────── */
.mv-formula {
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary, #9ca3af);
  margin: 8px 0 16px;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.2px;
}
.mv-gauge {
  position: relative;
  width: 100%; height: 130px;
  display: flex; align-items: flex-end; justify-content: center;
  margin-bottom: 18px;
}
.mv-gauge svg { width: 220px; height: 120px; overflow: visible; }
.mv-gauge .mv-label {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  font-size: 14px; font-weight: 700;
  background: rgba(245, 158, 11, 0.85); color: #1c1c1e;
  padding: 3px 10px; border-radius: 8px;
}
.mv-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.2em;
  color: var(--text-secondary, #9ca3af);
  margin: 18px 4px 8px;
  text-transform: uppercase;
}
.mv-decompose {
  background: rgba(28, 28, 34, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 4px 14px;
}
.mv-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
}
.mv-row:last-child { border-bottom: none; }
.mv-row.mv-highlight {
  margin: 4px -14px -4px;
  padding: 12px 14px;
  background: rgba(239, 68, 68, 0.10);
  border-radius: 0 0 11px 11px;
  border-bottom: none;
}
.mv-row.mv-highlight .mv-key { font-weight: 700; color: var(--text); }
.mv-key { color: var(--text-secondary, #9ca3af); display: flex; align-items: center; gap: 8px; }
.mv-key .mv-op { color: #6b7280; font-family: ui-monospace, monospace; width: 14px; text-align: center; }
.mv-val { font-family: ui-monospace, monospace; font-weight: 700; }
.mv-history {
  background: rgba(28, 28, 34, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 14px;
}
.mv-history svg { width: 100%; height: 120px; display: block; }
.mv-interpretation {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.18), rgba(245, 158, 11, 0.10));
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary, #fff);
}
.mv-interpretation .mv-avg {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-secondary, #9ca3af);
}
