/* 시장 관계 맵(3D 온톨로지) 공통 스타일 — PC·모바일 같이 씀. shared/graph.js 와 짝 */
.graph-card { padding-bottom: 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--dim); font-size: 12px; margin: -2px 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg { width: 10px; height: 10px; display: inline-block; border-radius: 50%; }
.lg-macro { background: var(--fam-macro); border-radius: 1px; transform: rotate(45deg) scale(.85); }
.lg-stock { background: var(--fam-stock); }
.lg-etf { background: var(--fam-stock); border-radius: 2px; }
.lg-crypto { background: var(--fam-crypto); }
.lg-news { background: var(--fam-news); width: 7px; height: 7px; }
.lg-line { width: 18px; height: 0; border-top: 1.5px solid #4a505c; display: inline-block; }
.lg-line.lg-ai { border-top: 2px dashed var(--accent); }
.graph {
  position: relative; height: clamp(420px, 62vh, 680px); background: var(--bg); border: 1px solid var(--grid);
  border-radius: 8px; overflow: hidden; touch-action: none;
}
.graph-svg { width: 100%; height: 100%; display: block; user-select: none; }
.edge { stroke: #3f4552; transition: opacity .2s; }
.edge-news { stroke: #343944; stroke-dasharray: 2 3; }
.edge-holding { stroke: #6b6f79; }
.edge-ai { stroke: var(--accent); stroke-dasharray: 6 4; opacity: .85; }
.edge.on { stroke: var(--text); opacity: 1; }
.edge-ai.on { stroke: var(--accent); }
.edge.dim { opacity: .12; }
.edge-label { fill: var(--accent); font-size: 11px; text-anchor: middle; paint-order: stroke; stroke: var(--bg); stroke-width: 3px;
  opacity: 0; transition: opacity .2s; pointer-events: none; }
.edge-label.show { opacity: 1; }
.node { cursor: pointer; transition: opacity .2s; outline: none; }
.node .mark { stroke: var(--bg); stroke-width: 2px; }
.fam-macro .mark { fill: var(--fam-macro); }
.fam-stock .mark { fill: var(--fam-stock); }
.fam-crypto .mark { fill: var(--fam-crypto); }
.fam-news .mark { fill: var(--fam-news); }
.grp-category .mark { fill: var(--panel-2); stroke: var(--fam-category, #f2a0bf); stroke-width: 2.5px; }
.lg-category { background: transparent; border: 2px solid var(--fam-category, #f2a0bf); }
.grp-hub .mark { fill: var(--panel-2); stroke-width: 2.5px; }
.grp-hub.fam-macro .mark { stroke: var(--fam-macro); }
.grp-hub.fam-stock .mark { stroke: var(--fam-stock); }
.grp-hub.fam-crypto .mark { stroke: var(--fam-crypto); }
.grp-portfolio .mark { fill: var(--panel-2); stroke: var(--accent); stroke-width: 2.5px; }
.held-ring { fill: none; stroke: var(--accent); stroke-width: 1.5px; stroke-dasharray: 3 2; }
.hub-label { fill: var(--text); font-size: 11px; font-weight: 700; pointer-events: none; paint-order: stroke; stroke: var(--bg); stroke-width: 3px; }
.node-label { fill: var(--text); font-size: 11.5px; pointer-events: none; paint-order: stroke; stroke: var(--bg); stroke-width: 3px; }
.node-pct { font-size: 10.5px; pointer-events: none; paint-order: stroke; stroke: var(--bg); stroke-width: 3px; font-variant-numeric: tabular-nums; }
.node-pct.up { fill: var(--up); } .node-pct.down { fill: var(--down); } .node-pct.flat { fill: var(--dim); }
.node.focus .mark { stroke: var(--text); }
.node:focus-visible .mark { stroke: var(--accent); stroke-width: 3px; }
.node.dim { opacity: .18; }
.grp-news:hover .mark, .grp-news.focus .mark { fill: var(--text); }
.graph-tip {
  position: absolute; display: none; pointer-events: none; max-width: 300px; z-index: 2;
  background: var(--title); border: 1px solid var(--border); border-radius: 6px; padding: 6px 9px; font-size: 12.5px;
  font-variant-numeric: tabular-nums; box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
.graph-tip .tip-title { font-weight: 600; margin-bottom: 2px; }
.graph-tip div:not(.tip-title) { color: var(--dim); }
.graph-detail { margin-top: 8px; min-height: 22px; font-size: 13px; }
.gd-head { margin-bottom: 4px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.gd-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 3px 18px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* 녹색 테마 */
.legend { gap: 5px 12px; font-size: 10px; }
.graph { height: clamp(450px, 54vh, 620px); background: radial-gradient(ellipse at 50% 50%, #1c4d3440, transparent 65%), #08140f; border-radius: 8px; border-color: #294535; }
.graph::before { content: ''; position: absolute; z-index: 0; inset: 0; opacity: .25; background-image: radial-gradient(#689c7980 .6px, transparent .6px); background-size: 19px 19px; pointer-events: none; }
.graph canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.graph-svg { position: absolute; inset: 0; cursor: grab; touch-action: none; }
.graph-svg:active { cursor: grabbing; }
.graph-toolbar { position: absolute; left: 10px; top: 10px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; z-index: 3; max-width: calc(100% - 20px); }
.graph-toolbar button { background: #10261ee8; border-color: #365941; min-width: 30px; min-height: 30px; padding: 3px 8px; font-size: 11px; }
.graph-toolbar button[aria-pressed=true] { color: #10261e; background: var(--accent); }
.graph-mode { color: var(--accent); font: 600 9px/1 Inter, sans-serif; letter-spacing: 1px; background: #10261ee8; border: 1px solid #365941; padding: 10px 8px; border-radius: 5px; }
.graph-help { color: var(--dim); font-size: 10px; margin: 9px 0 0; line-height: 1.6; }
.graph-detail { font-size: 12px; }
.gd-list { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.graph .node .mark { stroke: #bddfce; stroke-width: .7px; fill: none; }
.graph .node.focus .mark, .graph .node:focus-visible .mark { stroke: #fff; stroke-width: 2; }
.graph .node .hit { fill: transparent; stroke: none; }
.graph .node .sphere-fallback { stroke: none; }
.graph .node-label, .graph .hub-label { font: 500 10px/1.4 "Noto Sans KR", sans-serif; fill: var(--text); stroke: #08140f; stroke-width: 3px; }
.node-label-leader { stroke: #6a987b; stroke-width: .6px; opacity: .55; }
.graph .hub-label { font-size: 10px; font-weight: 700; }
.graph .node-pct { font-size: 9px; }
.graph .node.dim { opacity: .28; }
.graph .edge { stroke: #5f9975; }
.graph .edge-ai { stroke: #e6cf85; }
.graph .edge-label { font-size: 9px; }
.graph-render-status { position: absolute; right: 10px; bottom: 8px; font-size: 9px; color: var(--dim); pointer-events: none; }
.graph-tip { z-index: 4; background: #0c1b15f5; font-size: 12px; max-width: min(300px, calc(100% - 8px)); }
.graph-empty { position: absolute; inset: 60px 16px 30px; display: grid; align-content: center; text-align: center; pointer-events: none; color: var(--dim); font-size: 12px; }

@media (max-width: 700px) {
  .graph { height: 470px; }
  .graph-help { font-size: 10px; }
}

/* ── 전체화면 (툴바의 ⛶ 전체화면). 브라우저 전체화면이 안 되는 곳은 화면을 덮는 겹침 창 ── */
.graph-full {
  position: fixed !important; inset: 0; z-index: 1000; margin: 0 !important; max-width: none !important; width: auto !important;
  display: flex; flex-direction: column; gap: 6px; border-radius: 0 !important; overflow: auto;
  background: var(--bg, #070f0e) !important; backdrop-filter: none; box-shadow: none; padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.graph-full .graph { flex: 1 1 auto; height: auto !important; min-height: 320px; }
.graph-full .graph-detail { flex: 0 0 auto; max-height: 26vh; overflow: auto; margin-top: 0; }
.graph-full .graph-help { display: none; }
.graph-full .graph-toolbar button { min-height: 34px; font-size: 12px; }
html.graph-full-open, html.graph-full-open body { overflow: hidden; }
