/* 예측 시나리오 — 기존 토큰 재사용. 공포↔탐욕 발산색은 검증된 쌍(색각 이상 대비 확인) */
:root { --fear: #0a84c1; --greed: #d9731a; }
@media (prefers-color-scheme: dark) { :root { --fear: #2e9bd6; --greed: #d27020; } }

.sg { display: flex; flex-direction: column; gap: 12px; }
.sg-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.sg-tabs button { flex: none; border: 0; background: none; padding: 9px 14px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.sg-tabs button[aria-selected='true'] { color: var(--ink); border-bottom-color: var(--greed); }
.sg-fresh { font-size: 11px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.sg-body { display: flex; flex-direction: column; gap: 12px; }
.sg-foot { font-size: 11px; color: var(--muted); text-align: center; margin: 0; }
.sg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.sg-head h2 { margin: 0; font-size: 14px; }
.sg-head > :last-child:not(h2) { margin-left: auto; }
.sg-na { color: var(--muted); font-weight: 500; }
.sg-note { font-size: 11px; color: var(--muted); margin: 6px 0 0; line-height: 1.5; }
.sg-warn { color: var(--danger); font-size: 11px; font-weight: 600; }
.sg-disclaimer { font-size: 12px; color: var(--ink-2); background: var(--surface-2); border-radius: 8px; padding: 8px 10px; margin: 10px 0 0; }
.sg-conf { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; background: var(--surface-2); color: var(--ink-2); }
.sg-conf.c-높음 { color: var(--plan); background: var(--done-bg); }
.sg-conf.c-보통 { color: var(--accent); background: var(--cur-bg); }
.sg-conf.c-낮음 { color: var(--muted); }
.sg-2col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.sg-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.sg-seg button { border: 0; background: var(--surface); padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--muted); }
.sg-seg button.on { background: var(--surface-2); color: var(--ink); }

/* 히어로 */
.sg-hero { border-top: 3px solid var(--greed); }
.sg-hero-main { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px 28px; }
.sg-lab { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.sg-score { display: flex; align-items: baseline; gap: 6px; margin: 2px 0; }
.sg-score b { font-size: 44px; letter-spacing: -0.03em; line-height: 1; }
.sg-score span { color: var(--muted); font-weight: 600; }
.sg-state { font-style: normal; font-weight: 800; font-size: 16px; margin-left: 8px; }
.sg-sub { font-size: 12px; color: var(--ink-2); }
.sg-hero-side { display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.sg-hero-side > div { display: flex; flex-direction: column; }
.sg-hero-side b { font-size: 16px; }
.sg-hero-side .sg-why { align-self: flex-start; margin-top: 2px; }
.sg-why { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 8px; cursor: pointer; color: var(--accent); }
.sg-drop { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.sg-gauge { position: relative; margin: 12px 0 4px; }
.sg-gauge-bar { height: 10px; border-radius: 999px; background: linear-gradient(90deg, var(--fear), color-mix(in srgb, var(--fear) 25%, var(--surface-2)) 40%, var(--surface-2) 50%, color-mix(in srgb, var(--greed) 25%, var(--surface-2)) 60%, var(--greed)); }
.sg-gauge i { position: absolute; top: -4px; width: 4px; height: 18px; margin-left: -2px; background: var(--ink); border-radius: 2px; box-shadow: 0 0 0 2px var(--surface); }
.sg-gauge-lab { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-top: 4px; }

/* 요약 카드 */
.sg-minis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.sg-mini { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sg-mini span { font-size: 11px; color: var(--muted); }
.sg-mini b { font-size: 15px; overflow-wrap: anywhere; }
.sg-mini em { font-style: normal; font-size: 11px; color: var(--ink-2); }

/* 시나리오 */
.sg-scen { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sg-scen-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.sg-scen-title { font-weight: 800; font-size: 13px; }
.sg-scen-prob { display: flex; align-items: baseline; gap: 6px; margin: 6px 0; }
.sg-scen-prob b { font-size: 26px; }
.sg-scen-prob span { font-size: 11px; color: var(--muted); }
.sg-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.sg-bar i { display: block; height: 100%; background: var(--ink-2); border-radius: 999px; }
.sg-scen-card.k-A .sg-bar i { background: var(--greed); }
.sg-scen-card.k-B .sg-bar i { background: var(--fear); }
.sg-t { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.sg-t th, .sg-t td { padding: 6px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.sg-t th { color: var(--muted); font-weight: 500; }
.sg-t .l, .sg-t th:first-child { text-align: left; }
.sg-t td.l { white-space: normal; }
.sg-t tr.pk td { font-weight: 800; background: var(--surface-2); }
.sg-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.sg-lagcard { font-weight: 700; margin-bottom: 8px; }
.sg-lagnum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sg-lagnum div { display: flex; flex-direction: column; }
.sg-lagnum span { font-size: 11px; color: var(--muted); }
.sg-lagnum b { font-size: 18px; }

/* 인간지표 차트 */
.sg-chart-t { font-size: 11px; font-weight: 700; color: var(--ink-2); margin-top: 4px; }
.sg-chart svg { display: block; touch-action: pan-y; }
.sg-grid { stroke: var(--line); stroke-width: 1; }
.sg-axis { fill: var(--muted); font-size: 10px; font-family: inherit; }
.sg-band.greed { fill: color-mix(in srgb, var(--greed) 12%, transparent); }
.sg-band.fear { fill: color-mix(in srgb, var(--fear) 12%, transparent); }
.sg-line-score { fill: none; stroke: var(--greed); stroke-width: 2; stroke-linejoin: round; }
.sg-line-price { fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linejoin: round; }
.sg-hair { stroke: var(--muted); stroke-width: 1; }
.sg-mark { font-size: 12px; }
.sg-bt-title { font-weight: 700; font-size: 13px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sg-bt-title small { color: var(--muted); font-weight: 500; }

/* 물림지도 */
.sg-cb { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; margin-top: 12px; }
.sg-prof { display: flex; flex-direction: column; gap: 2px; max-height: 620px; overflow: auto; }
.sg-prof-row { display: grid; grid-template-columns: 82px 1fr 92px; gap: 8px; align-items: center; font-size: 11px; }
.sg-prof-p { text-align: right; color: var(--muted); }
.sg-prof-bar { height: 12px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.sg-prof-bar i { display: block; height: 100%; border-radius: 0 3px 3px 0; background: color-mix(in srgb, var(--ink-2) 45%, var(--surface)); }
.sg-prof-row.zone.above .sg-prof-bar i { background: var(--greed); }
.sg-prof-row.zone.below .sg-prof-bar i { background: var(--fear); }
.sg-prof-row.cur { font-weight: 800; }
.sg-prof-row.cur .sg-prof-p, .sg-prof-row.cur .sg-prof-v { color: var(--ink); }
.sg-prof-row.cur .sg-prof-bar { box-shadow: 0 0 0 2px var(--ink); }
.sg-cb-side { display: flex; flex-direction: column; gap: 8px; }
.sg-zone { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; }
.sg-zone.main { border-color: var(--greed); }
.sg-zone span { font-size: 11px; color: var(--muted); }
.sg-zone b { font-size: 15px; }
.sg-zone em { font-style: normal; font-size: 11px; color: var(--ink-2); }
.sg-details { margin-top: 12px; font-size: 12px; color: var(--ink-2); }
.sg-details summary { cursor: pointer; font-weight: 700; }

/* 자금흐름 */
.sg-nodes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sg-node { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sg-node > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.sg-node > b { font-size: 18px; }
.sg-node small { font-size: 11px; color: var(--muted); font-weight: 500; }
.sg-node-row { display: flex; justify-content: space-between; gap: 6px; font-size: 11px; color: var(--ink-2); }
.sg-node-row em { font-style: normal; }
.sg-dir { font-size: 14px; font-weight: 800; }
.sg-node-date { font-size: 10px; color: var(--muted); }
.sg-chain { display: flex; flex-direction: column; gap: 6px; }
.sg-link { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border: 1px solid var(--line); border-left: 3px solid var(--ink-2); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.sg-link.strong { border-left-width: 5px; border-left-color: var(--greed); }
.sg-link.weak { border-left-style: dashed; color: var(--muted); }
.sg-link-arrow { font-weight: 800; color: var(--muted); }
.sg-link-stat { margin-left: auto; font-size: 12px; font-weight: 700; }
.sg-cbar { display: inline-block; position: relative; width: 120px; height: 8px; background: var(--surface-2); border-radius: 999px; vertical-align: middle; }
.sg-cbar::after { content: ''; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--line); }
.sg-cbar i { position: absolute; top: 0; height: 100%; border-radius: 999px; }
.sg-cbar i.pos { left: 50%; background: var(--greed); }
.sg-cbar i.neg { right: 50%; background: var(--fear); }

/* Lag */
.sg-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.sg-form label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); }
.sg-form select, .sg-form input { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 8px; font-size: 13px; color: var(--ink); max-width: 260px; }
.sg-form input { width: 100px; }
.sg-lagchart { width: 100%; height: auto; display: block; }
.sg-lagchart rect.pos { fill: color-mix(in srgb, var(--greed) 55%, var(--surface)); }
.sg-lagchart rect.neg { fill: color-mix(in srgb, var(--fear) 55%, var(--surface)); }
.sg-lagchart rect.peak.pos { fill: var(--greed); }
.sg-lagchart rect.peak.neg { fill: var(--fear); }

@media (max-width: 1180px) {
  .sg-minis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sg-nodes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sg-hero-main, .sg-2col, .sg-cb { grid-template-columns: 1fr; }
  .sg-scen { grid-template-columns: 1fr; }
  .sg-minis, .sg-nodes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sg-t { display: block; overflow-x: auto; }
}
