/* ==========================================================================
   ALL-IN-ONE 터미널 - 공통 스타일
   색: 다크 기본. 상승/하락은 한국식(빨강↑/파랑↓) 기본, data-colors="us" 면 미국식(초록↑/빨강↓)
   ========================================================================== */
:root {
  color-scheme: light;
  --bg: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --surface-3: #e7e6e1;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: rgba(11, 11, 11, 0.18);
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --up: #d03b3b;
  --down: #2a78d6;
  --up-bg: rgba(208, 59, 59, 0.10);
  --down-bg: rgba(42, 120, 214, 0.10);
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --tier-a: #0ca30c; --tier-b: #2a78d6; --tier-c: #ec835a;
  --warn: #fab219;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232321;
  --surface-3: #2c2c2a;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #f0efec;
  --text-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --accent: #3987e5;
  --up: #e66767;
  --down: #3987e5;
  --up-bg: rgba(230, 103, 103, 0.14);
  --down-bg: rgba(57, 135, 229, 0.14);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #0ca30c; --s7: #9085e9; --s8: #e66767;
  --tier-b: #3987e5;
}
:root[data-colors="us"] { --up: #0ca30c; --down: #d03b3b; --up-bg: rgba(12,163,12,.12); --down-bg: rgba(208,59,59,.12); }
:root[data-theme="dark"][data-colors="us"] { --up: #0ca30c; --down: #e66767; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.num, .mono { font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- 상단바 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  height: 52px; padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; white-space: nowrap; font-size: 15px; }
.brand b { color: var(--accent); }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav-link {
  text-decoration: none; padding: 6px 12px; border-radius: 8px;
  color: var(--text-2); white-space: nowrap; font-weight: 500;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--surface-3); color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.search { position: relative; }
.search input {
  width: 220px; height: 34px; padding: 0 12px;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); outline: none;
}
.search input:focus { border-color: var(--accent); }
.search-results {
  position: absolute; right: 0; top: 40px; width: 320px; max-height: 420px; overflow: auto;
  margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0,0,0,.35);
}
.search-results li { display: flex; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.search-results li b { min-width: 72px; }
.search-results li span { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results li[aria-selected="true"], .search-results li:hover { background: var(--surface-3); }
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); cursor: pointer;
}
.icon-btn:hover { border-color: var(--border-strong); }

.mkt-status { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; color: var(--text-2); white-space: nowrap; }
.mkt-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.mkt-status.s-open i { background: var(--tier-a); animation: pulse 1.6s infinite; }
.mkt-status.s-pre i, .mkt-status.s-after i { background: var(--warn); }
.mkt-status .num { color: var(--muted); }

.wl-strip { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 0 10px; align-items: center; min-height: 34px; }
.wl-strip::-webkit-scrollbar { display: none; }
.wl-item { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; white-space: nowrap; font-size: 12px; }
.wl-item b { font-size: 13px; }
.wl-item:hover { border-color: var(--border-strong); }
.wl-item.cur { border-color: var(--accent); }
.star-btn { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 2px; }
.star-btn.on { color: var(--warn); }
.star-btn:hover { color: var(--warn); }

.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); cursor: pointer; transition: .15s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; border-radius: 50%; background: var(--text-2); transition: .15s; }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::before { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.chart-error { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; z-index: 4; color: var(--text-2); }
.chart-error b { display: block; font-size: 16px; color: var(--text); margin-bottom: 6px; }

.dev-banner {
  padding: 6px 16px; font-size: 12px; text-align: center;
  background: rgba(250, 178, 25, 0.12); color: var(--text-2); border-bottom: 1px solid var(--border);
}

/* ---------- 공통 컴포넌트 ---------- */
.page { flex: 1; width: 100%; max-width: 1680px; margin: 0 auto; padding: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.card-h h2, .card-h h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card-b { padding: 12px 14px; }
.page-title { margin: 4px 0 4px; font-size: 22px; }
.page-sub { margin: 0 0 16px; color: var(--text-2); }
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2);
  cursor: pointer; white-space: nowrap; text-decoration: none; font-size: 13px;
}
.btn:hover { border-color: var(--border-strong); background: var(--surface-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.seg button { white-space: nowrap; border: 0; background: none; padding: 4px 10px; border-radius: 6px; cursor: pointer; color: var(--text-2); font-size: 13px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border-strong); }
.chip { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.chip.tier-A { background: rgba(12,163,12,.14); color: var(--tier-a); }
.chip.tier-B { background: rgba(57,135,229,.14); color: var(--tier-b); }
.chip.tier-C { background: rgba(236,131,90,.16); color: var(--tier-c); }
.chip.rumor { background: rgba(250,178,25,.16); color: var(--warn); }
.chip.hot { background: var(--up-bg); color: var(--up); }
.chip.ticker { background: var(--surface-3); color: var(--text); text-decoration: none; cursor: pointer; }
.chip.ticker:hover { box-shadow: 0 0 0 1px var(--accent); }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 100; font-weight: 500;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.ad-slot { margin: 16px 0; }
/* 광고가 안 채워지면(미승인·차단·재고 없음) 흰 빈 박스 대신 자리 자체를 없앤다 */
.ad-slot:has(ins.adsbygoogle[data-ad-status="unfilled"]), .ad-slot.ad-off { display: none; }
ins.adsbygoogle[data-ad-status="unfilled"] { display: none !important; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 12px; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.data td.r, table.data th.r { text-align: right; }
table.data tr:hover td { background: var(--surface-2); }

/* ---------- 피드 아이템 ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed-item { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.feed-item.new { animation: flash 2.5s ease-out; }
@keyframes flash { from { background: var(--up-bg); } to { background: transparent; } }
.feed-item.imp-3 { box-shadow: inset 3px 0 0 var(--up); }
.feed-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.feed-meta .src { color: var(--text-2); font-weight: 600; }
.feed-title { margin: 0; font-size: 14px; line-height: 1.45; word-break: keep-all; overflow-wrap: anywhere; }
.feed-title a { text-decoration: none; }
.feed-title a:hover { text-decoration: underline; }
.feed-orig { margin: 3px 0 0; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.feed-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.feed-confirm { font-size: 12px; color: var(--tier-a); margin-top: 4px; }

/* ---------- 차트 페이지 ---------- */
.chart-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 12px; }
.chart-head { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px 16px; padding: 12px 14px 8px; }
.sym-name { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.sym-name h1 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.sym-name .co { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.price-big { font-size: 22px; font-weight: 600; }
.price-chg { font-weight: 600; }
.ohlc { font-size: 12px; color: var(--text-2); display: flex; gap: 10px; flex-wrap: wrap; }
.ohlc b { color: var(--muted); font-weight: 500; margin-right: 2px; }
.chart-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 0 14px 10px; }
.chart-tools .spacer { flex: 1; }
#chart { position: relative; height: 620px; border-top: 1px solid var(--border); }
#chart .wm { position: absolute; left: 12px; top: 8px; z-index: 3; pointer-events: none; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
#chart .wm .lg { display: flex; gap: 10px; flex-wrap: wrap; }
#chart .wm .lg span::before { content: ""; display: inline-block; width: 10px; height: 2px; margin-right: 4px; vertical-align: middle; background: var(--c); }
.chart-loading { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--surface) 70%, transparent); z-index: 5; }
.event-tip {
  position: absolute; z-index: 6; pointer-events: none; max-width: 300px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.event-tip b { display: block; margin-bottom: 2px; }

/* 켜진 지표 칩 */
.ind-row { padding: 0 14px 10px; }
.ind-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ind-chip { display: inline-flex; align-items: center; height: 28px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; overflow: hidden; }
.ind-chip button { border: 0; background: none; height: 100%; cursor: pointer; color: var(--text); padding: 0 6px 0 10px; }
.ind-chip button:first-child::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: 0; }
.ind-chip button[data-x] { padding: 0 9px 0 4px; color: var(--muted); font-size: 15px; }
.ind-chip button[data-x]:hover { color: var(--up); }
.ind-chip:hover { border-color: var(--border-strong); }
.ind-chip.add { padding: 0 12px; color: var(--accent); border-style: dashed; cursor: pointer; background: none; }

/* 그리기 도구 */
.chart-wrap { display: flex; border-top: 1px solid var(--border); }
.chart-wrap #chart { flex: 1; min-width: 0; border-top: 0; }
.draw-bar { display: flex; flex-direction: column; gap: 2px; padding: 6px 4px; border-right: 1px solid var(--border); background: var(--surface); }
.draw-bar button { width: 52px; min-height: 44px; padding: 5px 2px 4px; border: 0; border-radius: 6px; background: none; color: var(--text-2); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.draw-bar button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.draw-bar button span { font-size: 10.5px; line-height: 1.1; white-space: nowrap; letter-spacing: -.02em; }
.draw-bar button:hover { background: var(--surface-3); color: var(--text); }
.draw-bar button.on { background: var(--accent); color: #fff; }
.draw-bar button:disabled { opacity: .35; cursor: default; }
.draw-bar .sep { height: 1px; background: var(--border); margin: 4px 2px; }
/* 가로로 넘치는 줄: 가장자리를 흐리게 해서 옆으로 더 있다는 걸 보여준다 (common.js 가 more-l/more-r 부여) */
.more-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
.more-l { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 32px), transparent); }
.more-l.more-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); }
.marker-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-2); }
.marker-legend span { display: inline-flex; align-items: center; gap: 4px; }
.marker-legend i { display: inline-block; flex: none; }
.marker-legend .mk-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.marker-legend .mk-sq { width: 9px; height: 9px; border-radius: 2px; background: var(--c); }
.marker-legend .mk-up { width: 0; height: 0; border: 5px solid transparent; border-bottom: 8px solid var(--c); border-top: 0; }
.marker-legend .mk-down { width: 0; height: 0; border: 5px solid transparent; border-top: 8px solid var(--c); border-bottom: 0; margin-left: 4px; }
.draw-layer { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.draw-layer.active { pointer-events: auto; cursor: crosshair; touch-action: none; }

/* 지표 창 */
body.no-scroll { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.modal-panel { position: relative; width: min(760px, calc(100vw - 32px)); height: min(640px, calc(100vh - 48px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: 0 24px 64px rgba(0,0,0,.45); overflow: hidden; }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.modal-h h2 { margin: 0; font-size: 16px; white-space: nowrap; }
.modal-h input { flex: 1; min-width: 0; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); padding: 0 12px; outline: none; font-size: 14px; }
.modal-h input:focus { border-color: var(--accent); }
.preset-row { display: flex; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; align-items: center; font-size: 12px; }
.preset-row::-webkit-scrollbar { display: none; }
.preset-row > * { flex: none; white-space: nowrap; }
.chip-btn { white-space: nowrap; height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-size: 12px; }
.chip-btn:hover { border-color: var(--accent); }
.chip-btn.user { display: inline-flex; align-items: center; padding: 0; overflow: hidden; }
.chip-btn.user button { border: 0; background: none; height: 100%; cursor: pointer; padding: 0 6px 0 10px; }
.chip-btn.user button[data-del] { padding: 0 9px 0 2px; color: var(--muted); }
.modal-body { flex: 1; min-height: 0; display: flex; }
.ind-cats { width: 140px; flex: none; border-right: 1px solid var(--border); padding: 6px; overflow-y: auto; }
.ind-cats button { display: flex; justify-content: space-between; width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 8px; cursor: pointer; color: var(--text-2); font-size: 13px; }
.ind-cats button.on { background: var(--surface-3); color: var(--text); font-weight: 600; }
.ind-cats .cnt { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 11px; }
.ind-list { flex: 1; list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.ind-item { border-radius: 10px; }
.ind-item.on { background: var(--surface-2); }
.ind-item.flash { animation: flash 1.5s ease-out; }
.ind-main { display: flex; align-items: center; gap: 10px; padding: 10px; cursor: pointer; border-radius: 10px; }
.ind-main:hover { background: var(--surface-3); }
.ind-main:focus-visible { outline: 2px solid var(--accent); }
.ind-sw { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.ind-txt { flex: 1; min-width: 0; }
.ind-txt b { font-size: 14px; }
.ind-txt small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.ind-main .switch { pointer-events: none; }
.ind-params { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 0 10px 12px 30px; font-size: 12px; color: var(--text-2); }
.ind-params label { display: inline-flex; align-items: center; gap: 4px; }
.ind-params input { width: 64px; height: 30px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); padding: 0 6px; font-size: 13px; }
.ind-params input[type="text"] { width: 80px; text-transform: uppercase; }
.modal-f { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 12px; }
.modal-f .opt { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); }
.modal-f select { height: 28px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); }
.modal-f .spacer { flex: 1; }

.toggles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--border); }
.tgroup { padding: 10px 14px; border-right: 1px solid var(--border); }
.tgroup:last-child { border-right: 0; }
.tgroup h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.tgroup label { display: flex; align-items: center; gap: 6px; padding: 3px 0; cursor: pointer; font-size: 13px; user-select: none; }
.tgroup label .sw { width: 10px; height: 10px; border-radius: 2px; background: var(--c, var(--muted)); flex: none; }
.tgroup label .param { margin-left: auto; color: var(--muted); font-size: 11px; }
.tgroup input[type="checkbox"] { accent-color: var(--accent); margin: 0; }

.side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.side .card { display: flex; flex-direction: column; min-height: 0; }
.side-feed { max-height: 760px; overflow-y: auto; }
.side-tabs { padding: 0 6px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; }

.analysis-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.analysis-grid .card-b p { margin: 0 0 8px; }
.note { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.stat-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.stat { min-width: 90px; }
.stat .v { font-size: 18px; font-weight: 600; }
.stat .l { font-size: 12px; color: var(--muted); }
.bar-list { display: flex; flex-direction: column; gap: 4px; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 64px; align-items: center; gap: 8px; font-size: 12px; }
.bar-track { position: relative; height: 14px; background: var(--surface-2); border-radius: 4px; }
.bar-track .mid { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--axis); }
.bar-fill { position: absolute; top: 2px; bottom: 2px; border-radius: 3px; }
.form-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; font-size: 13px; }
.form-row select, .form-row input { height: 30px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); padding: 0 8px; }
.form-row input[type="number"] { width: 70px; }
.mini-chart { height: 160px; margin-top: 8px; }

.seo-text { margin-top: 16px; color: var(--text-2); font-size: 13px; }
.seo-text h2 { color: var(--text); font-size: 16px; margin: 0 0 8px; }

/* ---------- 속보/뉴스 페이지 ---------- */
.live-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.filters input[type="search"] { height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); padding: 0 10px; min-width: 180px; flex: 1; }
.filters label { display: inline-flex; gap: 4px; align-items: center; font-size: 13px; color: var(--text-2); }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--tier-a); margin-right: 6px; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- 찌라시 ---------- */
.rumor-item { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.rumor-status { font-weight: 700; font-size: 12px; }
.st-unverified { color: var(--warn); }
.st-confirmed { color: var(--tier-a); }
.st-partial { color: var(--s4); }
.st-denied { color: var(--up); }
.st-fizzled { color: var(--muted); }
.vote { display: flex; gap: 6px; margin-top: 8px; align-items: center; font-size: 12px; }
.vote-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--down); overflow: hidden; max-width: 160px; }
.vote-bar i { display: block; height: 100%; background: var(--up); }

/* ---------- 히트맵 ---------- */
.heatmap { position: relative; height: 640px; }
.hm-sector { position: absolute; border: 2px solid var(--bg); overflow: hidden; }
.hm-sector-label { position: absolute; left: 4px; top: 2px; font-size: 11px; font-weight: 700; color: rgba(255,255,255,.85); z-index: 2; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.hm-cell { position: absolute; border: 1px solid var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; color: #fff; overflow: hidden; text-align: center; line-height: 1.2; }
.hm-cell b { font-size: 13px; }
.hm-cell span { font-size: 11px; opacity: .9; }
.hm-cell:hover { outline: 2px solid var(--text); z-index: 3; }
.idx-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.idx { min-width: 120px; padding: 8px 12px; text-decoration: none; }
.idx .n { font-size: 12px; color: var(--muted); }
.idx .p { font-weight: 600; }
.legend-scale { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.legend-scale i { width: 26px; height: 12px; border-radius: 2px; display: inline-block; }

/* ---------- 리서치 / 캘린더 ---------- */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.filing { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.filing-h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.summary { white-space: pre-wrap; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; margin-top: 8px; font-size: 13px; line-height: 1.6; }
.col-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.col-card { padding: 12px 14px; text-decoration: none; display: block; }
.col-card h3 { margin: 0 0 4px; font-size: 14px; line-height: 1.4; }
.col-card p { margin: 0; font-size: 12px; color: var(--muted); }
.cal-day { margin-bottom: 12px; }
.cal-day h3 { font-size: 14px; margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.stars { color: var(--warn); letter-spacing: -2px; }

/* ---------- 스크리너 ---------- */
.scr-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-bottom: 12px; }
.scr-preset { text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.scr-preset b { font-size: 14px; }
.scr-preset span { font-size: 11px; color: var(--muted); }
.scr-preset:hover { border-color: var(--border-strong); }
.scr-preset.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.table-wrap { overflow-x: auto; }
.scr-table th[data-s] { cursor: pointer; user-select: none; }
.scr-table th[data-s]:hover { color: var(--text); }
.scr-table th.sorted { color: var(--accent); }
.scr-table tbody tr { cursor: pointer; }
.scr-table td { white-space: nowrap; }

/* ---------- 오늘의 미장 ---------- */
.mk-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.mk-card { padding: 18px; max-width: 1100px; }
.mk-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.mk-title { font-size: 20px; }
.mk-idx { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.mk-i { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: 12px; }
.mk-i b { font-size: 15px; }
.mk-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.mk-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mk-box { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.mk-box h3 { margin: 4px 0 8px; font-size: 13px; }
.mk-box h3 + * + h3 { margin-top: 12px; }
.mk-box .bar-row { grid-template-columns: 110px 1fr 56px; }
.mk-rank { margin: 0; padding-left: 18px; font-size: 13px; }
.mk-rank li { display: flex; justify-content: space-between; padding: 2px 0; }
.mk-rank a { text-decoration: none; }
.mk-news { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.mk-news li { padding: 5px 0; border-bottom: 1px solid var(--border); line-height: 1.45; }
.mk-news li:last-child { border-bottom: 0; }
.mk-news a { text-decoration: none; }
.mk-news a:hover { text-decoration: underline; }
.mk-foot { margin: 6px 0 0; }

/* ---------- 푸터 ---------- */
.footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: 24px; }
.footer-inner { max-width: 1680px; margin: 0 auto; padding: 18px 16px 28px; font-size: 12px; color: var(--muted); }
.footer .disclaimer { margin: 0 0 10px; max-width: 900px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 8px; }
.footer-links a { text-decoration: none; color: var(--text-2); }
.footer-links a:hover { text-decoration: underline; }
.copy { margin: 0; }

/* ---------- 반응형 ---------- */
@media (max-width: 1240px) {
  .mkt-status .num { display: none; }
}
@media (max-width: 1100px) {
  .chart-layout, .live-layout { grid-template-columns: minmax(0, 1fr); }
  .side-feed { max-height: 520px; }
  .toggles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tgroup:nth-child(2) { border-right: 0; }
  .tgroup:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
}
@media (max-width: 760px) {
  .topbar { gap: 8px; padding: 0 10px; flex-wrap: wrap; height: auto; padding-top: 8px; }
  .brand span { display: none; }
  .topbar-right { margin-left: auto; }
  .search input { width: 150px; }
  .nav { order: 3; flex-basis: 100%; padding-bottom: 6px; }
  .mkt-status .num { display: none; }
  /* 휴대폰: 옆으로 밀어야 보이던 줄을 접어서 한 화면에 다 보이게 (지표·알림 버튼이 화면 밖에 숨던 문제) */
  .chart-tools { padding: 0 10px 8px; gap: 6px; }
  .chart-tools .spacer { display: none; }
  #tfSeg { display: flex; flex: 1 1 100%; }
  #tfSeg button { flex: 1 1 auto; padding: 5px 0; font-size: 12.5px; letter-spacing: -.03em; }
  .chart-tools .push-pop-wrap { margin-left: auto; }
  .ind-row { padding-left: 10px; padding-right: 10px; }
  /* 휴대폰: 그리기 도구는 차트 위 가로 줄, 지표 창은 아래에서 올라오는 시트 */
  .chart-wrap { flex-direction: column; }
  .chart-wrap #chart { flex: none; }
  .draw-bar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-right: 0; border-bottom: 1px solid var(--border); padding: 4px 6px; }
  .draw-bar button { width: auto; min-height: 40px; }
  .draw-bar .sep { display: none; }
  .modal { place-items: end stretch; }
  .modal-panel { width: 100vw; height: 88vh; border-radius: 16px 16px 0 0; }
  .modal-body { flex-direction: column; }
  .ind-cats { width: auto; display: flex; gap: 4px; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; flex: none; }
  .ind-cats button { width: auto; white-space: nowrap; flex: none; padding: 7px 12px; }
  .modal-h h2 { display: none; }
  #chart .wm .lg { max-height: 34px; overflow: hidden; }
  .chart-head { padding: 10px 12px 6px; }
  .sym-name .co { max-width: 140px; }
  .page { padding: 10px; }
  #chart { height: 460px; }
  .analysis-grid, .two-col { grid-template-columns: minmax(0, 1fr); }
  .tgroup { padding: 8px 10px; }
  .tgroup label { font-size: 12px; }
  .tgroup label .param { display: none; }
  .search-results { width: calc(100vw - 20px); right: -50px; }
  .heatmap { height: 900px; }
  .mk-idx { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mk-grid, .mk-grid.two { grid-template-columns: minmax(0, 1fr); }
  .mk-card { padding: 12px; }
  .scr-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 비슷하게 움직인 종목 */
.sim-list { display: flex; flex-direction: column; }
.sim-row { display: grid; grid-template-columns: minmax(70px, 1fr) 120px 64px 72px; gap: 10px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.sim-row:last-child { border-bottom: 0; }
.sim-row:hover { background: var(--hover, rgba(127,127,127,.08)); }
.sim-sym, .sim-v { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.sim-sym small, .sim-v small { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sim-v { text-align: right; }
@media (max-width: 480px) { .sim-row { grid-template-columns: minmax(56px, 1fr) 90px 52px 64px; gap: 6px; } .sim-row svg { width: 90px; } }

/* 스크리너 전 종목 */
.scr-name { display: block; max-width: 160px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.scr-more { display: flex; justify-content: center; padding: 12px 0 4px; }
.scr-more[hidden] { display: none; }

/* 푸시 알림 종류 */
.push-groups { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.push-group { display: flex; flex-direction: column; gap: 1px; }
.push-group > b { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.push-opt { display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 8px; align-items: start; padding: 6px 6px; margin: 0 -6px; border-radius: 8px; cursor: pointer; }
.push-opt:hover { background: var(--surface-2); }
.push-opt input { grid-row: span 2; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); }
.push-opt span { font-size: 13.5px; font-weight: 600; color: var(--text); line-height: 1.35; }
.push-opt small { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
/* 사이트를 보는 중 온 푸시: 위에서 내려오는 1줄 배너 */
.headsup { position: fixed; top: 10px; left: 50%; z-index: 1000; display: flex; align-items: center; gap: 8px; width: max-content; max-width: min(620px, calc(100vw - 20px)); padding: 9px 8px 9px 12px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: 0 10px 30px rgba(0, 0, 0, .3); text-decoration: none; white-space: nowrap; transform: translate(-50%, calc(-100% - 20px)); transition: transform .28s ease; }
.headsup.show { transform: translate(-50%, 0); }
.headsup .hu-t { flex: 0 0 auto; max-width: 48%; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.headsup .hu-b { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 13px; color: var(--text-2); }
.headsup .hu-x { flex: none; border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; padding: 0 4px; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .headsup { transition: none; } }

/* 차트 툴바 푸시 알림 팝업 */
.push-pop-wrap { position: relative; }
.push-cta { display: block; width: 100%; margin: 4px 0 12px; padding: 10px; font-size: 14px; font-weight: 700; }
.push-cta[hidden] { display: none; }
.push-pop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 200; width: min(340px, calc(100vw - 32px)); margin: 0; box-shadow: 0 8px 28px rgba(0, 0, 0, .25); }
.push-pop[hidden] { display: none; }
@media (max-width: 760px) { .push-pop { position: fixed; top: auto; bottom: 12px; left: 16px; right: 16px; width: auto; max-height: 70vh; overflow: auto; } }
