:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --surface-3: #eceff4;
  --line: #e2e6ec;
  --text: #121821;
  --text-2: #4f5a69;
  --text-3: #8590a0;
  --accent: #2a78d6;
  --accent-soft: #e6f0fb;
  --series-a: #2a78d6;
  --series-b: #eb6834;
  --series-c: #4a3aa7;
  --bench: #98a1b0;
  --red: #d23a3a;
  --red-soft: #fdecec;
  --green: #13905a;
  --green-soft: #e6f5ee;
  --blue: #2a66c8;
  --blue-soft: #e8effb;
  --up: var(--red);
  --up-soft: var(--red-soft);
  --down: var(--green);
  --down-soft: var(--green-soft);
  --warn: #b46a00;
  --warn-soft: #fff3df;
  --ok: #1f7a8c;
  --ok-soft: #e3f3f6;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .10);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "PingFang TC", "Noto Sans TC",
          "Microsoft JhengHei", "PingFang SC", "Noto Sans SC", "Segoe UI", Roboto, sans-serif;
  --tabbar: 58px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0a0d12;
  --surface: #10151c;
  --surface-2: #161c25;
  --surface-3: #1d2530;
  --line: #222b37;
  --text: #e7ecf2;
  --text-2: #a1acba;
  --text-3: #6c7889;
  --accent: #3987e5;
  --accent-soft: #13233a;
  --series-a: #3987e5;
  --series-b: #d95926;
  --series-c: #9085e9;
  --bench: #6a7382;
  --red: #f06a6a;
  --red-soft: #3a1f22;
  --green: #3ec48a;
  --green-soft: #16332a;
  --blue: #6aa2f5;
  --blue-soft: #1b2a45;
  --warn: #f0b24a;
  --warn-soft: #33270f;
  --ok: #5cc3d6;
  --ok-soft: #133038;
  --shadow: none;
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
:root[data-lang="ko"] { --down: var(--blue); --down-soft: var(--blue-soft); }
:root[data-lang="en"] { --up: var(--green); --up-soft: var(--green-soft); --down: var(--red); --down-soft: var(--red-soft); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.55;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 14px; }

.topbar { position: sticky; top: 0; z-index: 6; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; min-height: 52px; gap: 10px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .01em; flex: none; font-size: 16px; }
.brand-mark { width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, #1b1f27 0 54%, var(--series-a) 54% 100%); }
.top-right { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pill-select { font: inherit; font-size: 13px; padding: 5px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); max-width: 46vw; }

.tabs a { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 13.5px; white-space: nowrap; }
.tabs svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current="page"] { color: var(--accent); font-weight: 650; }
.top-tabs { display: none; }
.bottom-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; display: grid; grid-template-columns: repeat(6, 1fr);
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); }
.bottom-tabs a { flex-direction: column; justify-content: center; gap: 2px; font-size: 11px; }

main { padding-top: 12px; padding-bottom: 24px; }
.notice { margin-bottom: 12px; padding: 9px 12px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.notice:empty { display: none; }
.hint { margin: -4px 0 12px; color: var(--text-2); font-size: 13px; }
.small { font-size: 12px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 14px 14px; margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
h2 { font-size: 16px; margin: 0; font-weight: 680; }
h3 { font-size: 13px; margin: 0 0 6px; font-weight: 680; color: var(--text-2); }
h3.gap { margin-top: 14px; }
.muted { color: var(--text-3); font-size: 12.5px; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0; }
.cols { display: grid; grid-template-columns: 1fr; gap: 14px; }
.empty { color: var(--text-3); font-size: 14px; padding: 10px 0 4px; }

.hero { display: flex; flex-direction: column; gap: 6px; margin: 2px 2px 12px; }
.hero-main { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hero-day { font-size: 26px; font-weight: 720; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.hero-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.hero-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--text-2); font-size: 12.5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); display: inline-block; margin-right: 6px; }
.dot.ok { background: var(--ok); }
.dot.fail { background: var(--warn); }

.chip { display: inline-flex; align-items: center; font-size: 12px; font-weight: 620; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.seg-live { background: var(--accent-soft); color: var(--accent); }
.badge { flex: none; font-size: 11.5px; font-weight: 620; padding: 3px 9px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); white-space: nowrap; }
.badge.verified { background: var(--ok-soft); color: var(--ok); }

.fn-row { display: block; padding: 9px 0; border-bottom: 1px solid var(--line); }
.fn-row:last-child { border-bottom: none; padding-bottom: 2px; }
.fn-top { display: flex; align-items: baseline; gap: 8px; }
.fn-idx { width: 18px; height: 18px; border-radius: 50%; background: var(--surface-2); color: var(--text-3); font-size: 11px; display: inline-grid; place-items: center; flex: none; font-weight: 650; }
.fn-name { font-weight: 620; flex: 1; min-width: 0; }
.fn-count { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.fn-bar { height: 6px; border-radius: 999px; background: var(--surface-2); margin: 6px 0 5px 26px; overflow: hidden; }
.fn-bar > span { display: block; height: 6px; border-radius: 999px; background: var(--accent); }
.fn-desc { margin-left: 26px; color: var(--text-3); font-size: 12px; }
a.fn-row:active { background: var(--surface-2); }

.arm-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.arm-name { font-size: 15.5px; font-weight: 680; display: flex; align-items: center; gap: 8px; }
.swatch { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.swatch.a { background: var(--series-a); }
.swatch.b { background: var(--series-b); }
.kpis, .tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.kpi { background: var(--surface-2); border-radius: 12px; padding: 9px 11px; min-width: 0; }
.kpi-label { font-size: 12px; color: var(--text-2); }
.kpi-value { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value.sm { font-size: 16px; }
.kpi-note { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--text-2); }

.legend { display: flex; gap: 12px; font-size: 12.5px; color: var(--text-2); flex-wrap: wrap; }
.legend.left { margin: -4px 0 6px; }
.lg::before { content: ""; display: inline-block; width: 13px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.lg-a::before, .lg-ma5::before { background: var(--series-a); }
.lg-b::before, .lg-ma20::before { background: var(--series-b); }
.lg-ma60::before { background: var(--series-c); }
.lg-bench::before { background: var(--bench); }

.chart { position: relative; width: 100%; height: 230px; touch-action: pan-y; }
.chart-sm { height: 170px; margin-bottom: 8px; }
.chart-k { height: 300px; }
.card-k { padding-bottom: 10px; }
.kc { display: flex; flex-direction: column; gap: 8px; }
.kc-bar, .kc-ind { display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding: 0 4px; }
.kc-bar::-webkit-scrollbar, .kc-ind::-webkit-scrollbar { display: none; }
.kc-btn { flex: none; display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  border-radius: 10px; padding: 6px 9px; font-size: 12px; cursor: pointer; min-height: 34px; }
.kc-btn span { display: none; }
.kc-btn:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.kc-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.kc-sep { flex: none; width: 1px; height: 22px; background: var(--line); margin: 0 3px; }
.kc-ind-label { flex: none; font-size: 11px; color: var(--text-3); margin: 0 2px 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.kc-ind-label:first-child { margin-left: 0; }
.kc-chip { flex: none; border: 1px solid var(--line); background: transparent; color: var(--text-2); border-radius: 999px; padding: 3px 10px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em; cursor: pointer; min-height: 28px; }
.kc-chip[aria-pressed="true"] { background: var(--text); color: var(--surface); border-color: var(--text); }
.kc-hint { min-height: 0; font-size: 12px; color: var(--accent); }
.kc-hint:empty { display: none; }
.kc-canvas { height: 420px; width: 100%; touch-action: pan-y; border-top: 1px solid var(--line); padding-top: 4px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text, .chart .xlab { fill: var(--text-3); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.chart .zero { stroke: var(--text-3); stroke-width: 1; }
.chart .mark { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .marklabel { fill: var(--text-3); font-size: 10.5px; }
.chart .l-a { fill: none; stroke: var(--series-a); stroke-width: 2; stroke-linejoin: round; }
.chart .l-b { fill: none; stroke: var(--series-b); stroke-width: 2; stroke-linejoin: round; }
.chart .l-bench { fill: none; stroke: var(--bench); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart .endlabel { font-size: 11px; fill: var(--text-2); font-weight: 620; }
.chart .cross { stroke: var(--text-3); stroke-width: 1; }
.chart .pt { stroke: var(--surface); stroke-width: 2; }
.chart .pt.a { fill: var(--series-a); }
.chart .pt.b { fill: var(--series-b); }
.chart .pt.bench { fill: var(--bench); }
.chart .c-up { stroke: var(--up); fill: var(--up); }
.chart .c-down { stroke: var(--down); fill: var(--down); }
.chart .vol { opacity: .45; stroke: none; }
.chart .ma { fill: none; stroke-width: 1.3; }
.chart .ma5 { stroke: var(--series-a); }
.chart .ma20 { stroke: var(--series-b); }
.chart .ma60 { stroke: var(--series-c); }
.chart .bar-pos { fill: var(--up); }
.chart .bar-neg { fill: var(--down); }
.chart .bar-label { font-size: 11px; fill: var(--text-2); font-variant-numeric: tabular-nums; }
.tip { position: absolute; top: 4px; pointer-events: none; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 4px 16px rgba(0, 0, 0, .14);
  border-radius: 10px; padding: 7px 9px; font-size: 12px; min-width: 150px; font-variant-numeric: tabular-nums; transform: translate(-50%, 0); z-index: 2; }
.tip b { display: block; margin-bottom: 3px; }
.tip .row { display: flex; justify-content: space-between; gap: 12px; }
.chart-empty { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--text-3); font-size: 13.5px; text-align: center; padding: 0 12px; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: transparent; padding: 4px 11px; border-radius: 999px; font-size: 12.5px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 650; box-shadow: var(--shadow); }
#arm-tabs { margin-bottom: 12px; }

.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
th { text-align: left; font-weight: 560; color: var(--text-3); font-size: 12px; padding: 6px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: top; }
tr:last-child td { border-bottom: none; }
th.num, td.num { text-align: right; }
.code { color: var(--text-3); font-size: 12px; }
.name { font-weight: 640; }
.stock-link:active .name { color: var(--accent); }
.reason { color: var(--text-2); font-size: 12.5px; white-space: normal; min-width: 130px; }
.side { font-size: 11.5px; font-weight: 680; padding: 2px 8px; border-radius: 6px; }
.side.buy { background: var(--up-soft); color: var(--up); }
.side.sell { background: var(--down-soft); color: var(--down); }

.cand-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px 2px; border-top: 1px solid var(--line); }
.cand-row:first-child { border-top: none; }
.cand-row:active { background: var(--surface-2); }
.rank { width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; font-weight: 680; font-size: 12.5px; }
.cand-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cand-title { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.cand-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.cand-chips:empty { display: none; }
.cand-sum { color: var(--text-2); font-size: 12.5px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.metrics { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.metrics b { color: var(--text); font-weight: 620; }
.rating { text-align: right; white-space: nowrap; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rating-inline { display: flex; align-items: center; gap: 8px; }
.stars { letter-spacing: 1px; font-size: 14px; color: var(--accent); }
.stars .off { color: var(--line); }
.conf { font-size: 11.5px; color: var(--text-3); }

.back { display: inline-block; margin: 0 0 10px 2px; color: var(--accent); font-size: 14px; font-weight: 600; }
.stock-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.stock-name { font-size: 22px; font-weight: 720; }
.stock-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.verdict { margin: 0 0 10px; font-size: 15px; }
.verdict-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.list { margin: 0; padding-left: 18px; font-size: 13.5px; }
.list li { margin-bottom: 5px; }
.flag { display: grid; grid-template-columns: auto 1fr; gap: 8px; font-size: 13.5px; margin-bottom: 7px; align-items: start; }
.masters { display: grid; grid-template-columns: 1fr; gap: 10px; }
.master { border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.master-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.master-head h3 { font-size: 14.5px; color: var(--text); margin: 0; }
.master-lab { font-size: 12px; font-weight: 620; margin-top: 3px; }
.master-rule { margin: 6px 0 8px; font-size: 12.5px; color: var(--text-2); }
.master-view { display: grid; grid-template-columns: auto 1fr; gap: 8px; font-size: 13px; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; align-items: start; }
.sfs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.sfs.one { grid-template-columns: 1fr; }
.sf { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dashed var(--line); padding-bottom: 3px; min-width: 0; }
.sf-label { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-thr { color: var(--text-3); opacity: .75; font-size: 11px; margin-left: 4px; }
.sf-val { font-weight: 600; white-space: nowrap; }
.sf-val.wrap { white-space: normal; text-align: right; font-weight: 500; }
.yes { color: var(--ok); font-weight: 700; }
.no { color: var(--text-3); }
.news { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.news li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.news li:last-child { border-bottom: none; }
.reason-text { margin: 0 0 10px; font-size: 13px; color: var(--text-2); }

.heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 6px; }
.tile { position: relative; border: 0; border-radius: 12px; padding: 9px 9px 8px; text-align: left; cursor: pointer; min-height: 70px; display: flex; flex-direction: column; gap: 2px;
  background: color-mix(in srgb, var(--accent) calc(var(--v) * 88% + 6%), var(--surface-2)); color: var(--text); overflow: hidden; }
.tile.dark { color: #fff; }
.tile.open { outline: 2px solid var(--text); outline-offset: 1px; }
.tile.hot::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(135deg, transparent 0 7px, color-mix(in srgb, var(--warn) 55%, transparent) 7px 9px); }
.tile-name { font-size: 12px; font-weight: 640; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; position: relative; z-index: 1; }
.tile-val { font-size: 15px; font-weight: 720; font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.tile-sub { font-size: 10.5px; opacity: .8; position: relative; z-index: 1; }
.heat-scale { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--text-3); font-size: 12px; flex-wrap: wrap; }
.scale-bar { width: 110px; height: 8px; border-radius: 999px; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 6%, var(--surface-2)), var(--accent)); }
.scale-hot { margin-left: 8px; padding: 1px 10px; border-radius: 6px; background: repeating-linear-gradient(135deg, var(--surface-2) 0 7px, color-mix(in srgb, var(--warn) 55%, transparent) 7px 9px); color: var(--text-2); }
.kpis.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 10px; }
.mini-cand { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mini-cand:last-child { border-bottom: none; }

.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 6px 0 10px; }
.progress > span { display: block; height: 8px; background: var(--accent); border-radius: 999px; }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.checks li:last-child { border-bottom: none; }
.st { font-weight: 640; white-space: nowrap; }
.st.pass { color: var(--ok); }
.st.wait { color: var(--text-3); }
.st.fail { color: var(--warn); }
.verify-note { color: var(--text-2); font-size: 12.5px; margin-top: 10px; }
.run-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.run-row:last-child { border-bottom: none; }
.run-row .err { color: var(--warn); font-size: 12.5px; white-space: normal; text-align: right; }

.login form { display: flex; gap: 8px; }
.login input { flex: 1; min-width: 0; font: inherit; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }
.login button { padding: 9px 16px; border-radius: 12px; border: 0; background: var(--accent); color: #fff; cursor: pointer; font-weight: 620; }
.foot { color: var(--text-3); font-size: 12px; text-align: center; padding: 6px 0 0; }

@media (min-width: 760px) {
  body { font-size: 15px; padding-bottom: 0; }
  .wrap { padding: 0 20px; }
  .bottom-tabs { display: none; }
  .top-tabs { display: flex; gap: 2px; flex: 1; margin-left: 18px; }
  .top-tabs a { padding: 6px 12px; border-radius: 10px; }
  .top-tabs a svg { display: none; }
  .top-tabs a[aria-current="page"] { background: var(--accent-soft); }
  .pill-select { max-width: none; }
  main { padding-top: 18px; padding-bottom: 40px; }
  .card { padding: 18px 18px 16px; margin-bottom: 16px; }
  .grid-2 { grid-template-columns: 1fr 1fr; gap: 16px; }
  .cols { grid-template-columns: 1fr 1fr; gap: 20px; }
  .chart { height: 280px; }
  .chart-sm { height: 190px; }
  .chart-k { height: 400px; }
  .kc-canvas { height: 560px; }
  .kc-btn span { display: inline; }
  .kc-bar { flex-wrap: wrap; overflow: visible; }
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hero-day { font-size: 30px; }
  #funnel { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
  .fn-row { border-bottom: none; padding: 0; border-right: 1px solid var(--line); padding-right: 10px; }
  .fn-row:last-child { border-right: none; }
  .fn-top { flex-direction: column; align-items: flex-start; gap: 2px; }
  .fn-name { order: 2; font-size: 13px; min-height: 2.6em; }
  .fn-count { order: 1; font-size: 24px; }
  .fn-idx { order: 0; }
  .fn-bar, .fn-desc { margin-left: 0; }
  .cand-row { grid-template-columns: 34px minmax(0, 1fr) auto; padding: 14px 4px; }
  .cand-row:hover, a.fn-row:hover, .mini-cand:hover { background: var(--surface-2); }
  .masters { grid-template-columns: 1fr 1fr; gap: 12px; }
  .heat { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
  .tile { min-height: 78px; }
   .stock-name { font-size: 26px; }
}

@media (min-width: 1200px) {
  .wrap { max-width: 1440px; padding: 0 32px; }
  .card { padding: 20px 22px 18px; }
  .cols, .grid-2 { gap: 22px; }
  .tiles, .kpis, .kpis.k4 { gap: 12px; }
  .tiles, .kpis.k4 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .heat { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .tile { min-height: clamp(72px, 6vw, 88px); }
  .tile-name { font-size: clamp(11px, .85vw, 13px); }
  .hero-day { font-size: clamp(26px, 2.2vw, 34px); }
  .stock-name { font-size: clamp(24px, 2vw, 30px); }
}

@media (min-width: 1600px) {
  .wrap { max-width: min(1720px, 92vw); }
}

@media (min-width: 1920px) {
  .wrap { max-width: 1920px; }
}

/* v3: status strip, theme, motion, stock page */
body { background: var(--bg); }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.icon-btn { flex: none; width: 32px; height: 32px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  display: inline-grid; place-items: center; cursor: pointer; padding: 0; }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { color: var(--text); }
:root[data-theme="dark"] .icon-btn .i-moon, :root[data-theme="light"] .icon-btn .i-sun { display: none; }
.topbar { background: color-mix(in srgb, var(--bg) 86%, transparent); }
.brand-mark { background: linear-gradient(135deg, var(--text) 0 54%, var(--series-a) 54% 100%); }

.strip { border-bottom: 1px solid var(--line); background: var(--surface); }
.strip:empty { display: none; }
.strip-inner { display: flex; align-items: center; gap: 6px 14px; min-height: 34px; overflow-x: auto; scrollbar-width: none; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.strip-inner::-webkit-scrollbar { display: none; }
.st-item { display: inline-flex; align-items: center; gap: 5px; flex: none; }
.st-paper { color: var(--warn); font-weight: 600; }
.st-paper .dot { background: var(--warn); margin-right: 0; }
.dot.pulse { box-shadow: 0 0 0 0 color-mix(in srgb, var(--warn) 60%, transparent); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--warn) 55%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.view:not([hidden]) { animation: fadeUp .28s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fn-bar > span { transform-origin: left center; animation: grow .9s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }
.chart .draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.2s var(--ease) .1s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.card { transition: border-color .2s; }
a.cand-row, .tile, .kc-btn, .subtabs button { transition: background-color .15s, color .15s, border-color .15s, transform .15s; }
.tile:hover { transform: translateY(-1px); }

.skel-card { display: flex; flex-direction: column; gap: 10px; }
.skel { height: 14px; border-radius: 8px; background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 40%, var(--surface-2) 80%); background-size: 300% 100%; animation: shimmer 1.4s infinite linear; }
.skel.w30 { width: 30%; } .skel.w40 { width: 40%; height: 22px; } .skel.w60 { width: 60%; } .skel.w70 { width: 70%; } .skel.w80 { width: 80%; } .skel.w90 { width: 90%; }
.skel.h120 { height: 120px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }

.stock-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "id ring" "px spark"; gap: 10px 12px; align-items: center; }
.sh-id { grid-area: id; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sh-id .stock-chips { margin-top: 2px; }
.sh-ring { grid-area: ring; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.sh-px { grid-area: px; }
.sh-spark { grid-area: spark; width: 140px; height: 40px; }
.px { font-size: 26px; font-weight: 720; font-variant-numeric: tabular-nums; letter-spacing: -.01em; line-height: 1.1; }
.chg { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: 100%; display: block; overflow: visible; }
.spark.up { color: var(--up); } .spark.down { color: var(--down); }
.spark-line { fill: none; stroke: currentColor; stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s var(--ease) .15s forwards; }
.spark-area { fill: currentColor; opacity: .09; stroke: none; }

.ring { display: block; overflow: visible; }
.ring-seg { fill: none; stroke: var(--surface-3); stroke-width: 7; stroke-linecap: butt; }
.ring-seg.on { stroke: var(--accent); }
@keyframes segIn { from { opacity: 0; } }
.ring-num { font-size: 19px; font-weight: 760; fill: var(--text); font-family: var(--font); }
.ring-of { font-size: 8px; fill: var(--text-3); font-family: var(--font); }

.subtabs { position: sticky; top: 52px; z-index: 5; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin: 0 -14px 12px; padding: 6px 14px;
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs button { flex: none; border: 0; background: transparent; color: var(--text-2); font-size: 13.5px; font-weight: 600; padding: 7px 12px; border-radius: 10px; cursor: pointer; }
.subtabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.stock-panel.enter { animation: fadeUp .24s var(--ease); }

.ai-top { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.ai-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.ai-label { font-size: 16px; font-weight: 700; }
.ai-conf { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.confbar { flex: 1; max-width: 180px; height: 6px; border-radius: 999px; background: linear-gradient(90deg, var(--accent) calc(var(--p) * 100%), var(--surface-3) 0); }
.ai-verdict .verdict { font-size: 15.5px; line-height: 1.6; }
.case { border-left: 3px solid var(--line); }
.case.bull { border-left-color: var(--up); }
.case.bear { border-left-color: var(--down); }
.case h3 { color: var(--text); font-size: 14px; }
.radar { display: block; width: 100%; max-width: 420px; margin: 0 auto; overflow: visible; }
.rd-grid { fill: none; stroke: var(--line); stroke-width: 1; }
.rd-area { stroke-width: 2; stroke-linejoin: round; }
.rd-series { animation: rdIn .7s var(--ease) both; transform-origin: 150px 128px; }
.rd-area.a { fill: color-mix(in srgb, var(--series-a) 16%, transparent); stroke: var(--series-a); }
.rd-area.b { fill: color-mix(in srgb, var(--series-b) 14%, transparent); stroke: var(--series-b); }
@keyframes rdIn { from { transform: scale(.2); } }
.rd-dot { stroke: var(--surface); stroke-width: 2; }
.rd-dot.a { fill: var(--series-a); } .rd-dot.b { fill: var(--series-b); }
.rd-label { font-size: 11.5px; fill: var(--text-2); font-family: var(--font); }

.trace summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.trace summary::-webkit-details-marker { display: none; }
.trace summary::after { content: "+"; font-size: 18px; color: var(--text-3); }
.trace[open] summary::after { content: "−"; }
.trace[open] summary { margin-bottom: 12px; }
.chips-row { display: flex; gap: 6px; flex-wrap: wrap; }
.raw { margin-top: 12px; }
.raw summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 600; }
.json { margin: 8px 0 0; max-height: 420px; overflow: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }

.kvs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.kv { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kv-label { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kv-val { font-size: 15.5px; font-weight: 680; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kv-val.mono { font-size: 13px; font-weight: 600; }
.meter { display: block; height: 5px; border-radius: 999px; margin-top: 4px; background: linear-gradient(90deg, var(--accent) calc(var(--p) * 100%), var(--surface-3) 0); }

@media (min-width: 760px) {
  .stock-hero { grid-template-columns: minmax(0, 1fr) 160px auto auto; grid-template-areas: "id spark px ring"; gap: 18px; }
  .sh-spark { width: 160px; height: 46px; }
  .sh-px { text-align: right; }
  .px { font-size: 30px; }
  .subtabs { top: 52px; margin: 0 0 14px; padding: 6px 0; border-radius: 0; }
  .kvs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .trace .kvs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.swatch.c { background: var(--series-c); }
.swatch + * { margin-left: 0; }
h2 .swatch { margin-right: 7px; vertical-align: 1px; }
.alt-names { font-size: 12.5px; color: var(--text-2); margin-top: 1px; }
.btn { border: 1px solid var(--line); background: var(--surface-2); color: var(--text); padding: 6px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.sm { padding: 3px 9px; font-size: 12px; border-radius: 8px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn[disabled] { opacity: .5; cursor: default; }
.callout { background: var(--accent-soft); color: var(--text); border-radius: 10px; padding: 9px 12px; font-size: 13px; margin: 8px 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.callout.warn { background: var(--warn-soft); }
.callout b { color: var(--accent); }
.callout.warn b { color: var(--warn); }
.hide-sm { display: none; }
td.ev-name { min-width: 150px; }
.dv { position: relative; height: 6px; margin-top: 5px; background: linear-gradient(90deg, transparent calc(50% - .5px), var(--line) calc(50% - .5px), var(--line) calc(50% + .5px), transparent calc(50% + .5px)); }
.dv-bar { position: absolute; top: 0; height: 6px; border-radius: 3px; }
.dv-bar.up { background: var(--up); } .dv-bar.down { background: var(--down); }
.exec li { justify-content: flex-start; }
.ok-mark { color: var(--ok); font-weight: 800; width: 16px; flex: none; }
.proof-bar { display: flex; align-items: center; gap: 12px; margin: 6px 0 10px; }
td.hash { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--text-2); }
.provs { display: grid; grid-template-columns: 1fr; gap: 0; }
.prov.off { opacity: .72; }
.prov-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.prov-name { font-weight: 720; font-size: 15.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prov-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.prov-models { margin-top: 6px; }
.prov-models summary { cursor: pointer; font-size: 13px; color: var(--text-2); font-weight: 600; padding: 4px 0; }
.prov-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
tr.hl td { background: var(--accent-soft); }
.kpis.mini .kpi-value { font-size: 16px; }
.var .kvs { margin-bottom: 10px; }
.form { display: grid; grid-template-columns: 1fr; gap: 10px; align-items: end; }
.form h3 { grid-column: 1 / -1; margin: 0; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); min-width: 0; }
.form input, .form select { font: inherit; font-size: 14px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); min-width: 0; }
.form .btn { justify-self: start; }
.share-url { justify-content: space-between; } .share-url .mono { overflow-wrap: anywhere; font-size: 12px; }
.ubars { display: flex; align-items: flex-end; gap: 2px; height: 120px; margin-top: 14px; padding-bottom: 2px; border-bottom: 1px solid var(--line); }
.ub { flex: 1; min-width: 2px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 1px; }
.ub span { display: block; border-radius: 2px; min-height: 0; }
.ub-o { background: var(--series-a); } .ub-f { background: var(--warn); } .ub-c { background: var(--bench); }
.ubars-axis { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; align-items: center; }
.lg-ok::before { background: var(--series-a); } .lg-fail::before { background: var(--warn); } .lg-cache::before { background: var(--bench); }
.src-chip { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; background: var(--surface-2); border-radius: 999px; padding: 2px 4px 2px 9px; }
.src-chip .chip { background: var(--surface); }
@media (min-width: 760px) {
  .hide-sm { display: table-cell; }
  .provs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
  .form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form label.wide { grid-column: 1 / -1; }
  .kpis.mini { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .chart .draw, .spark-line { stroke-dashoffset: 0; }
}
.provs { align-items: start; }
.prov.lead { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.prov-champ { margin-top: 6px; font-size: 13px; font-weight: 650; color: var(--accent); }
@media (min-width: 760px) { .prov.lead { grid-column: 1 / -1; } }
.other-arms { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; padding-top: 12px; padding-bottom: 12px; }
.oa { display: inline-flex; gap: 8px; align-items: center; font-size: 13.5px; flex-wrap: wrap; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px;
  background: rgba(0, 0, 0, .45); backdrop-filter: blur(8px) saturate(1.1); -webkit-backdrop-filter: blur(8px) saturate(1.1);
  animation: fadeIn .16s var(--ease) both;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  position: relative; width: min(720px, 100%); max-height: min(80vh, 900px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 20px 20px; box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
  animation: modalIn .18s var(--ease) both;
}
.modal-close { position: absolute; top: 10px; right: 12px; width: 32px; height: 32px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); font-size: 20px; line-height: 1; cursor: pointer; }
.modal-close:hover { color: var(--text); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@media (max-width: 768px) { .modal { width: 100%; max-height: 85vh; } }
@media (hover: hover) {
  .tile { transition: transform .15s var(--ease), box-shadow .15s var(--ease), border-color .15s var(--ease); }
  .tile:hover { transform: translateY(-1px) scale(1.02); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 60%, transparent), 0 8px 20px rgba(0, 0, 0, .28); }
}
