/* 스크리너 화면 전체 스타일. 색은 전부 여기 변수로만 있고 JS 는 색을 만지지 않는다.
   (JS 가 style 속성에 쓰는 것은 슬라이더 채움 **기하**(--cap-lo/--cap-hi) 하나뿐이다.)
   블로그 본문 안에 뜨는 밝은 배경 전제. 다크 모드는 v1 대상이 아니다. */

:root {
  --bg: #ffffff;
  --fg: #1a1d21;
  --muted: #6b7480;
  --line: #e3e6ea;
  --head-bg: #f6f8fa;
  --row-hover: #f7f9fb;
  --accent: #1f6feb;
  --accent-weak: #eaf1fe;
  --ok: #0b7a4b;
  /* 오늘 신고가 돌파. `--ok`(상태가 정상)와 색은 같지만 뜻이 다르다 — 이쪽은 **값**이다.
     변수를 나눠 두면 나중에 상태색만 바꿔도 표의 뜻이 따라 변하지 않는다. */
  --up: #0b7a4b;
  --err: #b3261e;
  --err-bg: #fdecea;
  --warn-bg: #fff8e6;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
}

.page { max-width: 1120px; margin: 0 auto; padding: 16px 16px 24px; }
/* iframe 안에서는 블로그 본문 여백 위에 우리 여백을 또 얹지 않는다 (embed.js 가 붙인다). */
html.is-embedded .page { padding-top: 8px; }

/* ── 헤더 ─────────────────────────────────────────────────────────── */
.title { margin: 0 0 4px; font-size: 20px; }
.lede { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.asof {
  margin: 0; padding: 6px 10px; border-radius: var(--radius);
  background: var(--accent-weak); font-size: 14px; font-weight: 600;
}
.asof time { font-variant-numeric: tabular-nums; }
.asof-note { margin-left: 6px; font-weight: 400; color: var(--muted); font-size: 12px; }

/* ── 시가총액 범위 ────────────────────────────────────────────────── */
.controls { margin: 16px 0 8px; }
.controls-title { margin: 0 0 10px; font-size: 14px; color: var(--muted); font-weight: 600; }

.cap-slider { position: relative; height: 32px; }
.cap-track {
  position: absolute; left: 10px; right: 10px; top: 50%; height: 6px;
  transform: translateY(-50%); background: var(--line); border-radius: 999px;
}
.cap-fill {
  position: absolute; top: 0; bottom: 0;
  left: var(--cap-lo, 0%); right: calc(100% - var(--cap-hi, 100%));
  background: var(--accent); border-radius: 999px;
}
/* 입력 두 개를 겹쳐 놓고 **손잡이만** 포인터를 받게 한다. 트랙 전체가 위쪽 입력에
   가려 아래쪽 손잡이를 못 잡는 것이 이 패턴의 유일한 함정이다. */
.cap-input {
  position: absolute; inset: 0; width: 100%; margin: 0;
  -webkit-appearance: none; appearance: none; background: none; pointer-events: none;
}
.cap-lo { z-index: 3; }
.cap-hi { z-index: 2; }
.cap-slider.cap-hi-front .cap-hi { z-index: 4; }
.cap-input::-webkit-slider-runnable-track { height: 100%; background: transparent; }
.cap-input::-moz-range-track { height: 100%; background: transparent; }
/* 오른쪽 RS 슬라이더(`.rs-slider`)는 `accent-color` 만 주고 브라우저 기본 썸을 쓴다 —
   테두리도 그림자도 없는 단색 원이다. 여기도 같은 모양으로 맞춘다.
   `-webkit-appearance: none` 과 `pointer-events: auto` 는 남는다: 이 슬라이더는 두 개의
   input 을 겹쳐 놓은 2핸들 구조라, 트랙은 클릭을 통과시키고 썸만 잡혀야 한다.
   webkit/moz 크기가 20/18 로 달랐던 것도 함께 맞췄다. */
.cap-input::-webkit-slider-thumb {
  -webkit-appearance: none; pointer-events: auto; cursor: pointer;
  width: 18px; height: 18px; border-radius: 50%; border: 0;
  background: var(--accent);
}
.cap-input::-moz-range-thumb {
  pointer-events: auto; cursor: pointer;
  width: 18px; height: 18px; border-radius: 50%; border: 0;
  background: var(--accent);
}
.cap-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.cap-ticks {
  display: flex; list-style: none; margin: 2px 0 0; padding: 0;
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.cap-ticks li { flex: 1 1 0; text-align: center; }
.cap-ticks li:first-child { text-align: left; }
.cap-ticks li:last-child { text-align: right; }
.cap-ticks li.is-edge { color: var(--accent); font-weight: 700; }
.cap-ticks li.is-inside { color: var(--fg); }

/* ── 상태 ─────────────────────────────────────────────────────────── */
/* 요약 줄은 왼쪽(종목수·조건)과 오른쪽(기준일 캡션) 두 덩이다. `flex` 로 눕히고 캡션만
   오른쪽 끝으로 민다 — 좁아지면 캡션이 다음 줄로 흐르고 표는 밀리지 않는다. */
.summary-line {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px;
  margin: 12px 0 8px; font-size: 14px;
}
.summary { font-weight: 600; }
/* 표 위 오른쪽 캡션. 있는 줄 알면 되는 값이라 작고 조용하다(강조하지 않는다). */
.row-dates {
  margin-left: auto; color: var(--muted); font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.busy-chip { display: none; margin-left: 8px; color: var(--muted); font-size: 12px; }
#app.is-busy .busy-chip { display: inline-block; }
#app.is-busy .table-wrap { opacity: .5; }

.panel { display: none; padding: 14px; border-radius: var(--radius); font-size: 14px; }
.panel-loading { background: var(--head-bg); color: var(--muted); }
.panel-empty { background: var(--warn-bg); }
.panel-error { background: var(--err-bg); color: var(--err); }
#app[data-state="loading"] .panel-loading,
#app[data-state="empty"] .panel-empty,
#app[data-state="error"] .panel-error { display: block; }
/* 표는 결과가 있을 때만 보인다. 0건과 실패를 빈 표로 보여 주면 둘이 구별되지 않는다. */
#app:not([data-state="ok"]) .table-wrap,
#app:not([data-state="ok"]) .pager { display: none; }

.retry-btn {
  margin-left: 8px; padding: 4px 12px; border: 1px solid var(--err);
  border-radius: 6px; background: var(--bg); color: var(--err); cursor: pointer; font: inherit;
}
.note { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.panel-error .note { display: block; color: var(--err); }

/* ── 면책 ─────────────────────────────────────────────────────────── */
.foot { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--line); }
.disclaimer { margin: 0; font-size: 13px; color: var(--muted); }
.disclaimer strong { color: var(--fg); }

@media (max-width: 720px) {
  .page { padding: 12px 12px 20px; }
  .cap-ticks li:not(:first-child):not(:last-child) { display: none; }
}
