/* OKAPISCAN 홈 다이어트 v1
   목적: 중복 지표 제거 후 남은 블록의 정렬, 접기(details) UI, 모바일 터치 타깃·본문 최소 글자 크기 보정 */

/* ── 거래소 혜택 CTA: 4장 → 3장 ── */
body.space-home .cta-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
body.space-home .cta-card {
  min-height: 74px;
  justify-content: center;
}
body.space-home .cta-card b { font-size: 14px; }
body.space-home .cta-card span { font-size: 12px; line-height: 1.5; }
body.space-home .cta-card small { font-size: 11px; }
.cta-strip-loading {
  grid-column: 1 / -1;
  margin: 0;
  padding: 14px 16px;
  border: 1px dashed #2c4463;
  border-radius: 10px;
  color: #8ba4c6;
  font-size: 12px;
  text-align: center;
}
.cta-strip-more {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin: -6px auto 18px;
  width: min(1160px, calc(100% - 32px));
}
.cta-strip-more a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: #9fc2ea;
  font-size: 12px;
  text-decoration: none;
}
.cta-strip-more a:hover { text-decoration: underline; }

/* ── feature 그리드: 김프 + 시장 스캔 + 트레이더 3장 ── */
body.space-home .feature-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
body.space-home .feature { min-height: 264px; }

/* 시장 스캔 카드: 판정 + 근거 2개(가격 위치·모멘텀) + 보조 참고 */
.trend-preview { margin: 12px 0 8px; display: grid; gap: 8px; }
.trend-main {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid #2b4159;
  border-radius: 9px;
  background: #0a1524;
}
.trend-main-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.trend-main-top span { font-size: 11.5px; color: #93a9c4; }
.trend-main-top span i { font-style: normal; color: #7d8ea5; }
.trend-main strong { font-size: 21px; line-height: 1.2; letter-spacing: -.03em; color: #f1f6ff; }
.trend-main strong.up { color: #3ddc97; }
.trend-main strong.down { color: #ff6b7a; }
.trend-main strong.neutral { color: #e5c274; }
/* 조건 충족 배지: 라벨과 별개로 몇 개 근거가 맞았는지 보여준다 */
.trend-cond {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid #35485f;
  border-radius: 999px;
  background: #101c2c;
  color: #9fb2c8;
  font-size: 10.5px;
  font-style: normal;
  font-weight: 650;
  letter-spacing: -.01em;
  white-space: nowrap;
}
body.space-home .panel-top .trend-cond { align-self: center; }
.trend-cond.ok { border-color: #2b5b48; background: #0f231d; color: #6fe0b0; }
.trend-cond.warn { border-color: #5a4b2a; background: #21190f; color: #e5c274; }
.trend-cond.bad { border-color: #5b2f38; background: #210f14; color: #ff8b99; }
.trend-reasons { display: grid; gap: 7px; }
.trend-reason {
  display: grid;
  gap: 5px;
  padding: 9px 11px;
  border: 1px solid #25374c;
  border-radius: 8px;
  background: #091220;
}
.trend-reason-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.trend-reason-head span { font-size: 11px; color: #8298b4; letter-spacing: -.01em; }
.trend-flag {
  padding: 2px 6px;
  border-radius: 5px;
  background: #16202e;
  color: #93a5bb;
  font-size: 10.5px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}
.trend-flag.ok { background: #10281f; color: #63d9a6; }
.trend-flag.bad { background: #2a141a; color: #ff8896; }
.trend-pair { display: grid; gap: 2px; margin: 0; }
.trend-pair > div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.trend-pair dt { margin: 0; font-size: 11px; color: #8298b4; }
.trend-pair dd { margin: 0; font-size: 12.5px; font-weight: 700; color: #dbe8f7; font-variant-numeric: tabular-nums; }
.trend-gauge { position: relative; height: 5px; border-radius: 999px; background: #162234; overflow: hidden; }
.trend-gauge-mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: #3b4f68; }
.trend-gauge-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
  border-radius: 999px;
  background: #4b8dff;
  transition: left .3s ease, width .3s ease;
}
.trend-reason[data-state="ok"] .trend-gauge-fill { background: #3ddc97; }
.trend-reason[data-state="bad"] .trend-gauge-fill { background: #ff6b7a; }
.trend-reason small { font-size: 10.5px; color: #8298b4; font-variant-numeric: tabular-nums; }
.trend-extra { margin: 0; font-size: 10.5px; line-height: 1.6; color: #7d8ea5; }
.trend-extra b { color: #b9c9db; font-weight: 700; font-variant-numeric: tabular-nums; }
.trend-note { margin: 0; font-size: 11px; line-height: 1.7; color: #8399b5; }

/* ── 접기(details) UI ── */
body.space-home .home-fold,
body.space-home .home-fold-section details.home-fold {
  display: block;
  margin: 14px auto 8px;
  border: 1px solid #263a52;
  border-radius: 12px;
  background: linear-gradient(155deg, #0a1524, #060e1b);
  overflow: hidden;
}
body.space-home .home-fold-section { margin: 14px auto; }
body.space-home .home-fold-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 60px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
}
body.space-home .home-fold-summary::-webkit-details-marker { display: none; }
body.space-home .home-fold-summary::marker { content: ''; }
body.space-home .home-fold-title { display: grid; gap: 3px; min-width: 0; }
body.space-home .home-fold-title strong { font-size: 15px; color: #eef5ff; letter-spacing: -.02em; }
body.space-home .home-fold-title small { font-size: 11.5px; color: #8ba1bd; line-height: 1.5; }
body.space-home .home-fold-toggle {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #38516e;
  border-radius: 50%;
  color: #a9c2df;
  font-size: 16px;
  transition: transform .18s ease;
}
body.space-home .home-fold[open] .home-fold-toggle { transform: rotate(45deg); }
body.space-home .home-fold[open] .home-fold-summary { border-bottom: 1px solid #22334a; }
body.space-home .home-fold-body { padding: 8px 18px 18px; }
body.space-home .home-fold-body .section-heading { margin-top: 4px; }

/* 접힌 증시 섹션은 카드 배경을 한 겹만 남긴다 */
body.space-home .stock-summary.home-fold-section { background: none; border: 0; padding: 0; }
body.space-home .stock-summary.home-fold-section .stock-panel { border: 1px solid #263a52; }

/* ── MARKET INDICES · LIVE MARKET OVERVIEW 두 접이식 섹션 균일화 ──
   stock-summary.css의 2열 grid 때문에 증시 섹션만 폭이 절반으로 줄던 문제를 없애고,
   접힌 카드의 폭·여백·테두리·헤더 높이를 뷰포트와 무관하게 같게 만든다. */
body.space-home .stock-summary.home-fold-section {
  display: block;
  grid-template-columns: none;
  width: 100%;
  max-width: 100%;
  margin: 16px 0 8px;
  box-sizing: border-box;
}
body.space-home .home-fold,
body.space-home .home-fold-section details.home-fold,
body.space-home details.home-fold.market-section {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 0;
  box-sizing: border-box;
  border: 1px solid #263a52 !important;
  border-radius: 12px !important;
  background: linear-gradient(155deg, #0a1524, #060e1b) !important;
}

/* ── 접힌 상태 실시간 요약 칩 ── */
body.space-home .home-fold-title { flex: 1 1 0%; min-width: 0; }
body.space-home .fold-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  margin-left: auto;
  min-width: 0;
}
body.space-home .fold-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid #26374d;
  border-radius: 999px;
  background: #0a121d;
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
}
body.space-home .fold-chip i {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: #77869a;
}
body.space-home .fold-chip b { font-weight: 650; color: #dbe6f4; font-variant-numeric: tabular-nums; }
body.space-home .fold-chip em { font-style: normal; font-weight: 600; color: #8b98ab; font-variant-numeric: tabular-nums; }
body.space-home .fold-chip em.up { color: var(--ui-up); }
body.space-home .fold-chip em.down { color: var(--ui-down); }

/* ── 모바일 터치 타깃 44px · 본문 12px 이상 ── */
body.space-home .hero-links a,
body.space-home .hero-primary,
body.space-home .hero-secondary {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding-top: 8px;
  padding-bottom: 8px;
}
body.space-home .market-glance .glance-item,
body.space-home .market-glance .glance-all {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 8px 6px;
}
body.space-home .tf-switch button {
  min-width: 40px;
  min-height: 32px;
}
body.space-home .quick-bottom-links a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
}
body.space-home .asset-related a { min-height: 40px; display: inline-flex; align-items: center; }
body.space-home .trader-more { min-height: 40px; display: inline-flex; align-items: center; }
body.space-home .stock-retry { min-height: 40px; padding: 0 14px; }
body.space-home .mini-search button { min-height: 40px; }
body.space-home .mini-search input { min-height: 40px; }

/* 12px 미만 보조 텍스트 정리 */
body.space-home small,
body.space-home .stock-date,
body.space-home .stock-axis,
body.space-home .kc-home-note,
body.space-home .kc-home-axis,
body.space-home .feature-heading p,
body.space-home .trader-note {
  font-size: 12px;
}
body.space-home .coin-strip span,
body.space-home .glance-item span { font-size: 12px; }

@media (max-width: 1100px) {
  body.space-home .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.space-home .cta-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  /* 좁은 화면에서는 요약 칩이 헤더 아래 한 줄로 내려가 두 섹션이 같은 높이를 유지한다 */
  body.space-home .home-fold-summary { flex-wrap: wrap; row-gap: 8px; }
  body.space-home .home-fold-title { order: 1; }
  body.space-home .home-fold-toggle { order: 2; }
  body.space-home .fold-chips {
    order: 3;
    flex: 1 1 100%;
    justify-content: flex-start;
    margin: 0;
  }
}
@media (max-width: 640px) {
  body.space-home .feature-grid { grid-template-columns: 1fr; }
  body.space-home .cta-strip { grid-template-columns: minmax(0, 1fr); }
  body.space-home .cta-card { min-height: 64px; }
  body.space-home .home-fold-summary { padding: 13px 14px; }
  body.space-home .home-fold-body { padding: 6px 14px 16px; }
  body.space-home .trend-main-top { flex-wrap: wrap; row-gap: 4px; }
  /* 좁은 화면: 칩을 2열 격자로 두어 두 섹션 모두 2줄로 떨어지게 한다 */
  body.space-home .fold-chips {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    width: 100%;
  }
  body.space-home .fold-chip {
    flex-wrap: wrap;
    row-gap: 1px;
    padding: 5px 8px;
    border-radius: 8px;
    font-size: 11px;
    white-space: normal;
  }
  body.space-home .fold-chip i { flex: 0 0 100%; font-size: 10px; }
  /* 섹션 설명문은 두 줄까지만 보여 주고 높이를 고정해 헤더 높이를 맞춘다 */
  body.space-home .home-fold-title small {
    display: -webkit-box;
    min-height: 36px;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* 2차 보정: 칩 라벨·차트 주석·헤더 링크의 최소 크기 */
body.space-home .hero-metric span,
body.space-home .market-glance .glance-title,
body.space-home .premium-chart-head span,
body.space-home .live-state,
body.space-home .live-state span { font-size: 11.5px; }
body.space-home .kc-stats span,
body.space-home .kc-stats strong { font-size: 11px; }
body.space-home .section-label { font-size: 10.5px; }
body.space-home .tf-switch button { min-width: 44px; min-height: 36px; font-size: 12px; }
body.space-home .brand { min-height: 36px; }
body.space-home .actions .lang { min-height: 36px; display: inline-flex; align-items: center; padding: 0 3px; }
body.space-home .stock-source { min-height: 36px; display: inline-flex; align-items: center; }
body.space-home .coin-strip span { font-size: 12px; }
@media (max-width: 640px) {
  body.space-home .tf-switch button { min-height: 44px; }
  body.space-home .actions .lang { min-height: 44px; padding: 0 5px; }
}

/* 접힌 증시·지표 블록의 보조 문구도 12px 아래로 내려가지 않게 */
body.space-home .stock-summary .stock-date,
body.space-home .stock-summary .stock-axis,
body.space-home .stock-summary .stock-source { font-size: 12px; line-height: 1.6; }
body.space-home .data-panel .metric-label,
body.space-home .data-panel small,
body.space-home .secondary-panel small { font-size: 12px; }
body.space-home .trend-note { font-size: 12px; }
body.space-home .actions .cs-trigger { min-height: 44px; }
