/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --bg: #0d1117;
  --bg-soft: #0a0e14;
  --card: #161b24;
  --card-hi: #1a2130;
  --border: #232b38;
  --border-soft: #1b2230;
  --text: #eef2f7;
  --text-2: #c3cedd;
  --text-3: #9dabbf;

  --kr: #10b981;
  --kr-dim: rgba(16, 185, 129, 0.12);
  --global: #3b82f6;
  --global-dim: rgba(59, 130, 246, 0.12);
  --crypto: #f59e0b;
  --crypto-dim: rgba(245, 158, 11, 0.12);

  --insider: #a78bfa;
  --insider-dim: rgba(167, 139, 250, 0.12);

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 12px 32px -18px rgba(0, 0, 0, 0.9);
  --font: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Noto Sans KR", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

button {
  font-family: inherit;
  touch-action: manipulation;   /* 더블탭 확대·300ms 지연 없이 바로 반응 */
}

.card, .tab, .chip, .sort-btn, .stat, .detail-back, .detail-link { -webkit-tap-highlight-color: transparent; }

/* 상단바 실제 높이는 app.js 가 --topbar-h 로 넣는다(스티키 위치 계산용) */
:root { --topbar-h: 65px; }

/* ── Ambient glow ───────────────────────────────────────── */
.glow {
  position: fixed;
  inset: -30vh 0 auto 0;
  height: 70vh;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(50% 60% at 18% 0%, rgba(16, 185, 129, 0.10), transparent 70%),
    radial-gradient(45% 55% at 82% 4%, rgba(59, 130, 246, 0.10), transparent 70%),
    radial-gradient(35% 45% at 50% 0%, rgba(245, 158, 11, 0.06), transparent 70%);
}

/* ── Top bar ────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(13, 17, 23, 0.96);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border-soft);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 11px;
  color: var(--kr);
  background: linear-gradient(160deg, rgba(16, 185, 129, 0.18), rgba(59, 130, 246, 0.10));
  border: 1px solid rgba(16, 185, 129, 0.28);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text h1, .brand-text strong { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.brand-text > span:not(.brand-name) { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  flex: none;
  min-width: 0;
}

.updated { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 헤더의 새 브리핑 알림 벨 */
.brief-bell {
  position: relative;
  flex: none;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: var(--bg-soft);
  color: var(--text-2);
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
}
.brief-bell-icon { font-size: 13px; line-height: 1; opacity: 0.55; filter: grayscale(1); }
.brief-bell:hover { border-color: #33405a; }
.brief-bell.is-on { background: rgba(59, 130, 246, 0.16); border-color: rgba(59, 130, 246, 0.46); }
.brief-bell.is-on .brief-bell-icon { opacity: 1; filter: none; }
.brief-bell-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f85149;
  box-shadow: 0 0 0 2px #0d1117;
}
.brief-bell-dot[hidden] { display: none; }

/* 브리핑 탭의 새 글 점 */
.tab { position: relative; }
.tab.has-new::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f85149;
}
.updated-label { }
.updated-value { }
.updated-value-sm { display: none; }

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--kr);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ── Layout ─────────────────────────────────────────────── */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 20px 56px;
}

/* ── Summary ────────────────────────────────────────────── */
.summary {
  display: grid;
  grid-template-columns: 1.2fr repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.stat {
  background: linear-gradient(180deg, var(--card-hi), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 17px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow);
  text-align: left;
  color: inherit;
}

.stat-total { border-color: rgba(16, 185, 129, 0.32); }

.stat-btn {
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.stat-btn:hover { border-color: #33405a; transform: translateY(-1px); }
.stat-btn:active { transform: translateY(0); }

.stat-label {
  font-size: 12.5px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.lbl-sm { display: none; }
.dot-kr { background: var(--kr); }
.dot-global { background: var(--global); }
.dot-crypto { background: var(--crypto); }
.dot-insider { background: var(--insider); }

.stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat-total .stat-value {
  background: linear-gradient(92deg, #7ff0c6, #63b3ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ── Controls ───────────────────────────────────────────── */
.controls {
  position: sticky;
  top: var(--topbar-h, 65px);
  z-index: 10;
  background: #0d1117;
  box-shadow: 0 14px 26px -20px rgba(0, 0, 0, 0.95);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  padding: 0 14px;
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.16s ease, background 0.16s ease;
}

/* 좁은 화면에서는 탭 라벨을 짧게 (국내 스타트업 → 국내) */
.tab-short { display: none; }
.tab-long { display: inline; }

.tab:hover { color: var(--text); }

.tab.is-active {
  color: #0b1016;
  background: linear-gradient(180deg, #f2f6fb, #dbe4ef);
}

/* ── 탭 두 줄: 윗줄 시장 브리핑 / 아랫줄 나머지 6개 ──────────
 * 브리핑은 자기 줄을 쓰고, 아래 줄은 VC 딜·내부자·캘린더·공모주·🪙 고래·🪙 마진.
 * 360px 에서도 6개가 한 줄에 들어가도록 라벨·여백을 미디어쿼리에서 줄인다.
 */
.tabstack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tabs-feature { padding: 3px; }
.tab.tab-feature {
  flex: 1 1 auto;
  width: 100%;
  justify-content: flex-start;
  gap: 10px;
  min-height: 48px;
  padding: 7px 12px;
  text-align: left;
  white-space: normal;
}
.tab-feature-ico { flex: none; font-size: 18px; line-height: 1; }
.tab-feature-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}
.tab-feature-name {
  font-size: 14.5px;
  font-weight: 750;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.tab-feature-sub {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-3);
  line-height: 1.25;
}
.tab-feature-arrow {
  flex: none;
  display: inline-flex;
  align-items: center;
  color: var(--text-3);
  transition: transform 0.16s ease, color 0.16s ease;
}
.tab.tab-feature.is-active .tab-feature-sub { color: #45586f; }
.tab.tab-feature.is-active .tab-feature-arrow { color: #3d4f66; transform: translateX(2px); }
/* 새 브리핑 점은 화살표 바로 왼쪽에 붙인다(줄 전체 폭 버튼이라 오른쪽 끝은 멀다) */
.tab.tab-feature.has-new::after { top: 50%; right: 32px; width: 7px; height: 7px; margin-top: -3.5px; }

/* 코인 탭(고래·마진) 앞의 🪙 */
.tab-coin {
  display: inline-block;
  flex: none;
  margin-right: 3px;
  font-size: 1em;
  line-height: 1;
  vertical-align: -0.04em;
}

/* 모바일: 두 줄 탭이 360px 폭에 넘침 없이 들어가도록 라벨·여백을 줄인다 */
@media (max-width: 640px) {
  .tabstack { gap: 5px; }
  .tab.tab-feature { min-height: 46px; padding: 6px 10px; gap: 8px; }
  .tab-feature-name { font-size: 14px; }
  .tab-feature-sub { font-size: 12px; }
  .tab-coin { margin-right: 2px; }
  .tab.tab-feature.has-new::after { right: 28px; }
}
@media (max-width: 360px) {
  .tab.tab-feature { min-height: 44px; padding: 6px 9px; gap: 7px; }
  .tab-feature-ico { font-size: 16px; }
  .tab-feature-name { font-size: 13.5px; }
  .tab-feature-sub { font-size: 12px; }
  .tab-coin { margin-right: 2px; font-size: 1em; }
}

.search-row { display: flex; gap: 10px; align-items: center; }

.search {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 0 12px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.search:focus-within {
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.13);
}

.search-icon { color: var(--text-3); flex: none; }

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  padding: 11px 10px;
  outline: none;
}

.search input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button { display: none; }

.search-clear {
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px 2px;
}
.search-clear:hover { color: var(--text); }

.sort {
  display: flex;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 3px;
  flex: none;
}

.sort-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  padding: 0 11px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.sort-btn.is-active { background: #22303f; color: var(--text); }

.chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.chips[hidden] { display: none; }
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  padding: 0 13px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.chip:hover { border-color: #33405a; color: var(--text); }

.chip.is-active {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(59, 130, 246, 0.5);
  color: #bfd7ff;
}

/* ── 내부자 역할 필터 칩(내부자 매수 탭 전용) ─────────────── */
/* 모바일의 .chips{flex-wrap:nowrap} 규칙보다 우선해 5개 칩을 두 줄로 모두 보여 준다. */
.chips.insider-chips { flex-wrap: wrap; overflow-x: visible; row-gap: 6px; }
.insider-chips .chip { gap: 5px; }
.insider-chips .chip b {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-3);
}
.insider-chips .chip.is-active b { color: #bfd7ff; }

/* ── Result line ────────────────────────────────────────── */
.result-line[hidden] { display: none; }
.result-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text-2);
  padding: 2px 4px 12px;
}

.reset {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  padding: 0 11px;
  border-radius: 8px;
  cursor: pointer;
}
.reset:hover { color: var(--text); border-color: #33405a; }
.reset[hidden] { display: none; }

/* ── Cards ──────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  align-items: start;
  gap: 14px;
}

/* 카드·회사명 클릭 → 상세 모달 */
.card.is-clickable { cursor: pointer; }
.card.is-clickable:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 2px;
}
.card.is-clickable:hover .company-name {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 70%, transparent);
}
.company-name { text-underline-offset: 3px; }
.detail-mark {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 4px;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.card.is-clickable:hover .detail-mark {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.detail-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 11px 0 0;
  font-size: 12.5px;
  color: var(--text-3);
  letter-spacing: -0.01em;
}
.detail-hint i { font-style: normal; opacity: 0.8; }
.card.is-clickable:hover .detail-hint { color: var(--text-2); }

.card {
  position: relative;
  background: linear-gradient(180deg, var(--card-hi), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 17px 18px 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  animation: rise 0.32s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent, var(--kr));
  opacity: 0.85;
}

.card:hover {
  transform: translateY(-2px);
  border-color: #33405a;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.card.r-kr { --accent: var(--kr); }
.card.r-global { --accent: var(--global); }
.card.r-crypto { --accent: var(--crypto); }
.card.card-insider { --accent: var(--insider); }

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.name-wrap { min-width: 0; }

.company {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.company-en {
  display: block;
  font-size: 12.5px;
  color: var(--text-3);
  font-weight: 500;
  margin-top: 2px;
  letter-spacing: 0;
}

.date {
  flex: none;
  font-size: 12.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  padding: 3px 7px;
  white-space: nowrap;
}

.amount-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.amount {
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.025em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.amount.muted { color: var(--text-2); font-size: 15px; font-weight: 600; }

.badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.badge {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 3px 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-stage {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  border-color: color-mix(in srgb, var(--accent) 32%, transparent);
}

mark {
  background: rgba(245, 158, 11, 0.2);
  color: #ffe4b0;
  border-radius: 3px;
  padding: 0 1px;
}

.badge-region {
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

.badge-role {
  color: #cbb8ff;
  background: var(--insider-dim);
  border-color: rgba(167, 139, 250, 0.28);
}

/* ── 내부자 매수 카드 ──────────────────────────────────── */
.ticker {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #d9cbff;
  background: var(--insider-dim);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 6px;
  padding: 2px 7px;
  font-variant-numeric: tabular-nums;
}

.who {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #dfe6f1;
  margin-top: 6px;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.buy-date {
  color: #d9cbff;
  background: var(--insider-dim);
  border-color: rgba(167, 139, 250, 0.32);
  font-weight: 600;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 10px;
  padding: 9px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}

.facts > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.facts dt {
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0.01em;
}

.facts dd {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #dbe3ef;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 내부자 매수 차트 ──────────────────────────────────── */
.charts {
  position: relative;
  background: linear-gradient(180deg, var(--card-hi), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  animation: rise 0.3s ease both;
}

.charts-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 14px;
}

.charts-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.charts-sub {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.chart-block {
  display: flex;
  flex-direction: column;
  background: #0f141c;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 13px 14px 12px;
  min-width: 0;
}

.chart-title {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
  color: var(--text-2);
  margin: 0 0 10px;
}

.chart-title em {
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--insider);
}

.chart-empty {
  margin: 12px 0;
  font-size: 12.5px;
  color: var(--text-3);
}

/* 종목별 막대 */
.bar-list { display: flex; flex-direction: column; }

.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
}
.bar-row:last-child { border-bottom: 0; padding-bottom: 2px; }

.bar-head {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.bar-head b {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #d9cbff;
  flex: none;
}

.bar-co {
  font-size: 12px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  text-align: right;
}

.bar-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.bar-when {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  line-height: 1.2;
}

.bar-track {
  grid-column: 1 / -1;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(167, 139, 250, 0.55), #a78bfa);
  animation: grow 0.5s ease both;
}

@keyframes grow {
  from { transform: scaleX(0); transform-origin: left; }
  to { transform: scaleX(1); transform-origin: left; }
}

/* 일별 막대 */
.day-chart {
  display: flex;
  align-items: stretch;
  gap: 3px;
  flex: 1 1 auto;
  min-height: 170px;
  margin-top: 2px;
}

.day-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 3px;
}

.day-count {
  position: absolute;
  top: 3px;
  left: 0;
  right: 0;
  font-size: 12px;
  font-weight: 800;
  color: #16102c;
  text-align: center;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.day-bar-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: flex-end;
}

.day-bar {
  position: relative;
  display: block;
  width: 100%;
  max-width: 58px;
  min-height: 20px;
  margin: 0 auto;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #c4b5fd, #8b5cf6);
  animation: growY 0.5s ease both;
}

@keyframes growY {
  from { transform: scaleY(0); transform-origin: bottom; }
  to { transform: scaleY(1); transform-origin: bottom; }
}

.day-label {
  font-size: 11.5px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.2;
  height: 13px;
  overflow: hidden;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.chart-note {
  margin: 9px 0 0;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.4;
}

.round-note {
  font-size: 12.5px;
  color: var(--text-3);
  margin: 0 0 10px;
}

.summary-text {
  font-size: 13.5px;
  color: #cfd8e5;
  margin: 0 0 12px;
  line-height: 1.55;
}

.investors {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding-top: 11px;
  border-top: 1px solid var(--border-soft);
}

.inv {
  font-size: 12.5px;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 3px 7px;
}

.inv.lead {
  color: #dce7f7;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.09);
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  border-color: color-mix(in srgb, var(--accent) 26%, transparent);
}

.inv-label {
  font-size: 12px;
  color: var(--text-3);
  align-self: center;
  margin-right: 1px;
}

/* ── States ─────────────────────────────────────────────── */
.empty, .error {
  text-align: center;
  color: var(--text-2);
  font-size: 14px;
  padding: 48px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin: 10px 0 0;
}
.empty strong, .error strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 5px; }

/* ── Footer ─────────────────────────────────────────────── */
.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
  font-size: 12.5px;
  color: var(--text-3);
  text-align: center;
}
.foot-sep { opacity: 0.5; }

/* ── Focus & motion ─────────────────────────────────────── */
:where(button, input):focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.7);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 980px) {
  .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  /* 좁은 화면에서는 요약을 다섯 칸 한 줄로: 세로 공간을 아끼고 한눈에 본다 */
  .summary { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
  .stat-total { grid-column: auto; }
  .stat { padding: 11px 12px; gap: 3px; }
  .stat-label { font-size: 11px; }
  .stat-value { font-size: 20px; }
}

@media (max-width: 640px) {
  /* 상단바: 한 줄로 낮게 */
  .topbar-inner { padding: 8px 13px; gap: 10px; min-height: 48px; }
  .brand { gap: 9px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
  .brand-mark svg { width: 17px; height: 17px; }
  .brand-text strong { font-size: 15px; }
  .brand-text > span:not(.brand-name) { display: none; }
  .topbar-meta { gap: 6px; }
  .updated-label { display: none; }
  .updated-value { display: none; }
  .updated-value-sm { display: inline; font-size: 12px; }
  .live-dot { width: 6px; height: 6px; }

  .wrap { padding: 10px 12px 40px; }

  /* 요약: 3줄 카드 그리드 → 다섯 칸 한 줄 */
  .summary {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    margin: 0 0 12px;
  }
  .stat {
    min-width: 0;
    padding: 7px 8px;
    gap: 2px;
    border-radius: 12px;
  }
  .stat-total { grid-column: auto; }
  .stat-label { font-size: 10px; gap: 4px; white-space: nowrap; }
  .stat-value { font-size: 16px; }
  .lbl-long { display: none; }
  .lbl-sm { display: inline; }

  .controls { top: var(--topbar-h, 52px); padding: 8px; gap: 8px; border-radius: 14px; margin-bottom: 10px; }
  .tabs { gap: 2px; padding: 3px; }
  .tab { flex: 1 1 0; min-height: 38px; padding: 0 4px; font-size: 12.5px; }
  .tab-long { display: none; }
  .tab-short { display: inline; }
  .search-row { gap: 8px; }
  .search { padding: 0 10px; }
  .search input { padding: 10px 8px; font-size: 14px; min-height: 40px; }
  .search-clear { min-width: 34px; min-height: 34px; margin-right: -6px; font-size: 21px; }
  .sort-btn { min-height: 38px; padding: 0 10px; font-size: 12.5px; }
  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 0;
    /* 오른쪽 끝이 페이드되어 '더 있다'는 신호를 준다 */
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 16px), transparent 100%);
    mask-image: linear-gradient(to right, #000 calc(100% - 16px), transparent 100%);
  }
  .chip { min-height: 34px; padding: 0 12px; font-size: 12.5px; }
  .result-line { font-size: 13px; padding: 0 2px 8px; }
  .reset { min-height: 32px; padding: 0 10px; font-size: 12.5px; }

  .grid { grid-template-columns: 1fr; gap: 10px; }
  .card { padding: 14px 14px 12px; border-radius: 15px; }
  .company { font-size: 16px; }
  .amount { font-size: 19px; }
  .detail-hint { margin-top: 9px; }
  .foot { font-size: 12.5px; margin-top: 22px; }
  .charts { padding: 12px 12px 14px; }
  .chart-block { padding: 10px 10px 9px; }
  .day-chart { min-height: 132px; }
  .bar-co { max-width: 38vw; }
}

/* ── PWA footer: 개인정보처리방침 · 투자 유의 ─────────────── */
.foot-line {
  width: 100%;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
}
.foot-notice {
  display: block;
  max-width: 64ch;
  color: var(--text-3);
  line-height: 1.6;
}
.foot-links a {
  color: var(--text-2);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  /* 손가락으로 짚을 수 있는 최소 높이(24px)를 확보한다. */
  display: inline-block;
  padding: 4px 0 3px;
}
.foot-links a:hover { color: var(--text); }

/* ── 아주 좁은 화면(≤360px) ───────────────────────────── */
@media (max-width: 360px) {
  .tab { font-size: 12px; padding: 0 3px; }
  .stat { padding: 7px 6px; }
  .stat-label { font-size: 9.5px; gap: 3px; }
  .stat-value { font-size: 15px; }
  .card { padding: 13px 13px 12px; }
  .company { font-size: 15.5px; }
}
.foot-notice {
  align-items: flex-start;
  color: var(--text-2);
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.20);
  border-radius: 12px;
  padding: 11px 14px;
  margin-top: 6px;
  text-align: left;
}
.foot-warn { color: #f59e0b; flex: 0 0 auto; }

/* ── 상세 페이지 (딜·내부자) ─────────────────────────────────
 * 모달/바텀시트 대신 목록 위로 전체 화면 페이지가 열린다.
 * 주소는 #deal=<id> / #insider=<id>, 뒤로가기 = 목록 복귀.
 */
body.detail-open { overflow: hidden; }

.detail {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}
.detail[hidden] { display: none; }

.detail-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: rgba(13, 17, 23, 0.94);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border-soft);
  z-index: 3;
}

.detail-back {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 44px;
  padding: 0 14px 0 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.detail-back:hover { background: rgba(255, 255, 255, 0.09); border-color: #33405a; }
.detail-back:active { background: rgba(255, 255, 255, 0.13); }
.detail-back svg { flex: none; color: var(--text-2); }

.detail-bar-title {
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
  font-size: 13px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  outline: none;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.detail-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px calc(30px + env(safe-area-inset-bottom));
  animation: pageIn 0.24s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* 상세 강조색은 카드와 같은 지역 색을 따른다 */
.detail-inner.r-kr { --accent: var(--kr); }
.detail-inner.r-global { --accent: var(--global); }
.detail-inner.r-crypto { --accent: var(--crypto); }
.detail-inner.r-insider { --accent: var(--insider); }

.detail-head { padding-top: 2px; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.detail-company {
  margin: 0;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.3;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  overflow-wrap: anywhere;
}
.detail-company-en { font-size: 13px; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.detail-sub {
  margin: 7px 0 0;
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.detail-sub b { color: var(--text); font-weight: 650; }

.detail-section { margin-top: 20px; }
.detail-section > h3 {
  margin: 0 0 9px;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 7px;
}
.detail-section > h3::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}
.detail-text {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.72;
  color: var(--text-2);
  letter-spacing: -0.01em;
}
.detail-lede { margin-top: 10px; color: #cfd8e5; font-size: 14px; line-height: 1.62; }

.detail-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}
.detail-list li {
  position: relative;
  padding-left: 13px;
  font-size: 13px;
  line-height: 1.68;
  color: var(--text-2);
  letter-spacing: -0.01em;
}
.detail-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent, var(--kr));
  opacity: 0.75;
}

.detail-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--accent, var(--kr)) 35%, var(--border));
  background: color-mix(in srgb, var(--accent, var(--kr)) 8%, transparent);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.16s ease, border-color 0.16s ease;
}
.detail-link:hover { background: color-mix(in srgb, var(--accent, var(--kr)) 14%, transparent); }
.detail-link-host {
  font-weight: 500;
  font-size: 12.5px;
  color: var(--text-3);
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.detail-link-arrow { color: var(--accent, var(--kr)); flex: none; }
.detail-link-off {
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  color: var(--text-3);
  font-size: 13px;
}

.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-tags span {
  font-size: 12.5px;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 4px 9px;
}

.detail-note {
  margin: 22px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-3);
}

/* 차트 */
.chart-box {
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.015);
  padding: 12px 12px 9px;
}
.chart-holder { min-height: 40px; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 6px 2px 0;
  font-size: 12.5px;
  color: var(--text-3);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 14px; height: 2px; border-radius: 2px; display: inline-block; }
.chart-legend i.marker { width: 8px; height: 8px; border-radius: 50%; }
.chart-note {
  margin: 8px 2px 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-3);
}
.chart-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 9px 2px 0;
  font-size: 12.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.chart-stats b { color: var(--text); font-weight: 650; }
.chart-stats .up { color: #ef6b6b; }
.chart-stats .down { color: #4f9cf6; }

/* 공시 정보 표 */
.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(146px, 1fr));
  gap: 8px;
}
.kv-grid > div {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  padding: 9px 11px;
  min-width: 0;
}
.kv-grid dt {
  font-size: 12px;
  color: var(--text-3);
  margin: 0 0 3px;
  letter-spacing: 0;
}
.kv-grid dd {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.kv-grid dd small { display: block; font-size: 12px; font-weight: 500; color: var(--text-3); margin-top: 2px; }

@media (max-width: 640px) {
  .detail-bar { padding: calc(7px + env(safe-area-inset-top)) 10px 7px; gap: 6px; }
  .detail-back { padding: 0 12px 0 7px; font-size: 13px; }
  .detail-bar-title { font-size: 12.5px; }
  .detail-inner { padding: 14px 14px calc(28px + env(safe-area-inset-bottom)); }
  .detail-company { font-size: 20px; }
  .detail-badges { margin-bottom: 8px; }
  .detail-section { margin-top: 17px; }
  .detail-text, .detail-list li { font-size: 13px; }
  .detail-lede { font-size: 13.5px; }
  .chart-box { padding: 10px 10px 8px; border-radius: 13px; }
  .kv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .kv-grid > div { padding: 8px 10px; }
  .kv-grid dd { font-size: 13px; }
}

/* ── 시장 브리핑 (🇰🇷 KOSPI · 🇺🇸 미국시장) ─────────────────
 * '시장 브리핑' 탭 하나에서 pill 로 시장을 바꾼다. 카드 안에서
 * 헤드라인 → 지표 그리드 → 섹션 → 오늘 체크 → 면책 순으로 읽힌다.
 */
.market-switch { gap: 8px; }.market-switch .market-chip { min-height: 36px; padding: 0 14px; font-size: 13px; }
.market-chip .flag { margin-right: 6px; font-size: 14px; line-height: 1; }
.market-chip[data-market="kr"].is-active {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.5);
  color: #9df0cd;
}
.market-chip[data-market="us"].is-active {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(59, 130, 246, 0.5);
  color: #bfd7ff;
}

.briefings { display: flex; flex-direction: column; gap: 16px; }
.briefings[hidden] { display: none; }
/* .grid · .search-row 는 display 값을 직접 지정해서 [hidden] 만으로는 숨어지지 않는다. */
.grid[hidden], .search-row[hidden] { display: none; }

.bcard {
  position: relative;
  background: linear-gradient(180deg, var(--card), var(--card-hi));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 20px 16px;
  overflow: hidden;
}
.bcard::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 3px;
  background: linear-gradient(180deg, #10b981, rgba(16, 185, 129, 0.15));
}
.bcard-us::before { background: linear-gradient(180deg, #3b82f6, rgba(59, 130, 246, 0.15)); }

.bcard-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bcard-region {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--kr-dim);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: #7ff0c6;
}
.bcard-us .bcard-region {
  background: var(--global-dim);
  border-color: rgba(59, 130, 246, 0.3);
  color: #a9c9ff;
}
.bcard-date {
  font-size: 12.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.bcard-title {
  margin: 10px 0 0;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.34;
}

.bheadline {
  margin-top: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 12px 14px;
}
.bheadline-line { margin: 0; font-size: 13.5px; line-height: 1.62; color: #dfe7f2; }
.bheadline-line + .bheadline-line { margin-top: 6px; }

.mmacro {
  margin-top: 14px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.mtile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 9px 10px 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-soft);
  border-radius: 11px;
}
.mt-l {
  font-size: 12px;
  line-height: 1.3;
  color: var(--text-3);
  overflow-wrap: anywhere;
}
.mt-v {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
}
.mt-d {
  font-size: 12.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}
.mt-v.up, .mt-d.up { color: #ef6b6b; }
.mt-v.down, .mt-d.down { color: #4f9cf6; }

.bsecs { margin-top: 18px; display: flex; flex-direction: column; gap: 18px; }
.bsec-h {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.bsec-no {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  background: rgba(255, 255, 255, 0.055);
  border-radius: 6px;
  padding: 2px 6px;
  font-variant-numeric: tabular-nums;
}
.bsec-p { margin: 0; font-size: 13.5px; line-height: 1.68; color: #cfd8e5; }
.bsec-p + .bsec-p { margin-top: 7px; }
.bsec-em {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-left: 2px solid rgba(16, 185, 129, 0.55);
  background: rgba(16, 185, 129, 0.06);
  border-radius: 0 10px 10px 0;
  font-size: 13px;
  line-height: 1.62;
  color: #cfe6dd;
}
.bcard-us .bsec-em {
  border-left-color: rgba(59, 130, 246, 0.55);
  background: rgba(59, 130, 246, 0.07);
  color: #cddcf5;
}

.bchecks {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px dashed rgba(245, 158, 11, 0.32);
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.045);
}
.bchecks-h { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: #f0b45a; }
.bchecks ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.bchecks li { position: relative; padding-left: 15px; font-size: 13px; line-height: 1.55; color: #d7dfeb; }
.bchecks li::before {
  content: "";
  position: absolute;
  left: 0; top: 7px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #f0b45a;
}

.bnote {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-3);
}
.bfoot { margin: 4px 0 0; font-size: 12px; color: #8d9aac; }

@media (max-width: 900px) {
  .mmacro { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .bcard { padding: 15px 14px 13px; border-radius: 15px; }
  .bcard-title { font-size: 17.5px; }
  .bheadline { padding: 11px 12px; border-radius: 11px; }
  .bheadline-line { font-size: 13px; line-height: 1.6; }
  .briefings { gap: 12px; }
  .mmacro { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .mtile { padding: 8px 9px; border-radius: 10px; }
  .mt-v { font-size: 13.5px; }
  .bsecs { margin-top: 15px; gap: 15px; }
  .bsec-h { font-size: 14px; }
  .bsec-p { font-size: 13px; line-height: 1.66; }
  .bsec-em { font-size: 13px; }
  .bchecks { margin-top: 15px; padding: 11px 12px; }
  .bchecks li { font-size: 13px; }
  .market-switch .market-chip { flex: 1 1 0; min-width: 0; padding: 0 8px; min-height: 38px; }
}

@media (max-width: 360px) {
  .bcard-title { font-size: 16.5px; }
  .mt-v { font-size: 13px; }
  .market-switch .market-chip { font-size: 12.5px; }
}

/* ── 📅 경제 캘린더 ────────────────────────────────────────────
 * 미국 중요도 상 지표 · 한국은행 기준금리만. 앞으로 예정된 일정만 표시.
 * 카드마다 이전/예측/실제 3열 비교, 수치 영향 설명, 🔔 알림 설정 버튼.
 */
.tab-cal.is-active {
  background: linear-gradient(180deg, #e8f7f0, #cdeee0);
}

.calendar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.calendar[hidden] { display: none; }

.cal-filters {
  flex-wrap: wrap;
  overflow: visible;
  padding-bottom: 0;
  margin: 0 0 2px;
  -webkit-mask-image: none;
  mask-image: none;
}
.cal-filters[hidden] { display: none; }
.cal-filters .chip { min-height: 32px; font-size: 12.5px; padding: 0 11px; gap: 5px; }
.cal-filters .flag { font-size: 13px; }

.cal-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  align-items: start;
  gap: 12px;
}

.card-cal {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 15px 16px 14px;
  border-left: 3px solid rgba(59, 130, 246, 0.55);
}
.card-cal.cal-kr { border-left-color: rgba(16, 185, 129, 0.6); }

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cal-when {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-2);
}
.cal-flag { font-size: 14px; line-height: 1; }
.cal-date { font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.cal-rel {
  font-size: 12px;
  font-weight: 700;
  color: #7ff0c6;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.32);
  border-radius: 999px;
  padding: 2px 7px;
}
.cal-time { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--text-2); }

.cal-status {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  color: #bfd7ff;
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 999px;
  padding: 3px 9px;
}
.cal-status.is-released {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.32);
}

.cal-title {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.35;
}
.cal-star {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 6px;
  padding: 1px 5px;
  margin-top: 2px;
}

.cal-cmp {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}
.cal-cmp > div {
  min-width: 0;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 8px 9px;
}
.cal-cmp dt {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.02em;
}
.cal-cmp dd {
  margin: 3px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.cal-cmp-fc { border-color: rgba(59, 130, 246, 0.28); }
.cal-cmp-ac { border-color: rgba(167, 139, 250, 0.28); }
.cal-pending { color: var(--text-3); font-weight: 600; }
.cal-val.is-diff {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.10);
  border-radius: 5px;
  padding: 0 3px;
  margin: 0 -3px;
}

.cal-impact {
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.16);
  border-radius: 11px;
  padding: 10px 11px;
}
.cal-impact-h {
  margin: 0 0 5px;
  font-size: 12px;
  font-weight: 700;
  color: #9db9e8;
  letter-spacing: 0.01em;
}
.cal-impact-b {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-2);
}
.cal-impact-b + .cal-impact-b { margin-top: 4px; }

.cal-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 1px;
}
.cal-remind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  width: 100%;
  border: 1px solid rgba(59, 130, 246, 0.42);
  background: rgba(59, 130, 246, 0.12);
  color: #cfe0ff;
  font-size: 13px;
  font-weight: 700;
  border-radius: 11px;
  padding: 0 12px;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}
.cal-remind:hover { background: rgba(59, 130, 246, 0.2); }
.cal-remind.is-on {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.5);
  color: #b7f3d9;
}
.cal-remind-hint {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.45;
}

/* 알림 시점 선택 (1시간 / 1일 / 2일 / 3일 전) */
.cal-lead-h {
  margin: 2px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.01em;
}
.cal-lead-h em {
  font-style: normal;
  font-weight: 600;
  opacity: 0.7;
  margin-left: 4px;
}
.cal-lead {
  display: flex;
  gap: 5px;
  width: 100%;
}
.cal-lead-chip {
  flex: 1 1 0;
  min-width: 0;
  min-height: 32px;
  padding: 0 4px;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: var(--bg-soft);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.cal-lead-chip:hover { border-color: #33405a; color: var(--text); }
.cal-lead-chip.is-on {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(59, 130, 246, 0.5);
  color: #cfe0ff;
}
.cal-empty { grid-column: 1 / -1; }

@media (max-width: 900px) {
  .cal-list { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  /* 탭 7개가 360px 한 줄에 다 들어가도록 라벨·여백을 줄인다. */
  .tabs { gap: 1px; padding: 3px; }
  .tab { padding: 0 3px; font-size: 11.5px; letter-spacing: -0.02em; }
  .card-cal { padding: 13px 13px 12px; gap: 10px; border-radius: 15px; }
  .cal-title { font-size: 15.5px; }
  .cal-cmp > div { padding: 7px 8px; border-radius: 9px; }
  .cal-cmp dd { font-size: 13px; }
  .cal-impact { padding: 9px 10px; }
  .cal-impact-b { font-size: 12.5px; line-height: 1.58; }
  .cal-remind { min-height: 44px; font-size: 13px; }
}

@media (max-width: 360px) {
  .tab { font-size: 11px; padding: 0 2px; }
  .cal-filters .chip { font-size: 12.5px; padding: 0 9px; }
  .cal-cmp dd { font-size: 12.5px; }
}

/* ── 상단 실시간 배너 (KOSPI · 나스닥 · BTC + 예정 경제지표) ────────
 * 시세 슬라이드 1장 + 가까운 경제지표 슬라이드를 4.5초 간격으로 넘긴다.
 * 넘김은 track 의 translateX 로 처리해 레이아웃 점프가 없다.
 */
.ticker {
  position: relative;
  margin: 0 0 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, #121926, #0e141d);
  box-shadow: var(--shadow);
  overflow: hidden;
}
/* 카드 안의 종목 배지(span.ticker)와 엇갈리지 않게 배너(section)만 초기화한다 */
section.ticker {
  padding: 0;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: normal;
  color: var(--text);
}
.ticker::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, #10b981, #3b82f6 55%, #f59e0b);
  opacity: 0.85;
}
.ticker-clip { overflow: hidden; height: 78px; }
.ticker-track {
  display: flex;
  width: 100%;
  transition: transform 0.52s cubic-bezier(0.22, 0.8, 0.3, 1);
  will-change: transform;
}
.tslide {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  height: 100%;
  padding: 10px 18px 10px 16px;
  overflow: hidden;
}
.tslide-market { justify-content: space-between; gap: 8px; }

/* 한 칸 = 1줄 라벨 / 2줄 메인 가격 / 3줄 등락률·원화괄호/상태 */
.tq {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  flex: 1 1 0;
}
.tq + .tq { border-left: 1px solid var(--border-soft); padding-left: 10px; }
.tq-name {
  height: 13px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 13px;
  letter-spacing: 0.04em;
  color: var(--text-3);
  text-transform: uppercase;
  white-space: nowrap;
}
.tq-val {
  display: flex;
  align-items: center;
  height: 22px;
  font-size: 17px;
  font-weight: 750;
  line-height: 22px;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
}
.tq-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 15px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  line-height: 15px;
}
.tq-chg {
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tq-chg.up { color: #ff7b72; }
.tq-chg.down { color: #6ea8fe; }
.tq-krw {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tq-note {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* 오른쪽 세로 점 인디케이터 — 눌러서 슬라이드 선택 */
.ticker-dots {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  z-index: 3;
}
.ticker-dot {
  width: 14px;
  height: 14px;
  padding: 4px;
  border: 0;
  border-radius: 7px;
  background: rgba(148, 163, 184, 0.42);
  background-clip: content-box;
  cursor: pointer;
  transition: background 0.18s ease, height 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.ticker-dot:hover { background: rgba(148, 163, 184, 0.72); background-clip: content-box; }
.ticker-dot.is-on {
  height: 20px;
  background: #10b981;
  background-clip: content-box;
}

/* 좌우 스와이프(터치·마우스 드래그) */
.ticker { touch-action: pan-y; -webkit-user-select: none; user-select: none; cursor: grab; }
.ticker.is-dragging { cursor: grabbing; }
.ticker.is-dragging .ticker-track { transition: none !important; }

.tslide-econ {
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  justify-content: center;
}
.tecon-k {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #f85149;
}
.tecon-k i { font-style: normal; font-size: 8px; line-height: 1; animation: pulse-dot 1.8s ease-in-out infinite; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.tecon-t {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.34;
  color: #ff6b62;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

/* ── Series A~C 탭 내부 필터(지역 pill · 건수 요약) ─────────────── */
.subregions { gap: 7px; }
.subregions .chip { min-height: 34px; padding: 0 13px; font-size: 13px; }
.subregions .flag { margin-right: 5px; font-size: 13px; line-height: 1; }
.subregions .chip[data-sub="kr"].is-active {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.5);
  color: #9df0cd;
}
.subregions .chip[data-sub="global"].is-active {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(59, 130, 246, 0.5);
  color: #bfd7ff;
}
.subregions .chip[data-sub="crypto"].is-active {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.5);
  color: #ffd699;
}

.deal-counts {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: -1px 0 1px;
  padding: 8px 11px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  font-size: 12.5px;
  color: var(--text-2);
}
.deal-counts[hidden] { display: none; }
.deal-counts .dc { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.deal-counts .dc b { color: var(--text); font-weight: 750; font-variant-numeric: tabular-nums; }
.deal-counts .dc-kr b { color: #7ff0c6; }
.deal-counts .dc-global b { color: #a9c9ff; }
.deal-counts .dc-crypto b { color: #ffd08a; }

/* ── 예정 공모주 탭 ─────────────────────────────────────────── */
.tab-ipo.is-active { background: linear-gradient(180deg, #fff3e2, #f6dfc2); }

.ipo { display: flex; flex-direction: column; gap: 12px; }
.ipo[hidden] { display: none; }
.ipo-head { padding: 2px 2px 0; }
.ipo-head-t {
  margin: 0;
  font-size: 14px;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--text);
}
.ipo-head-s { margin: 3px 0 0; font-size: 12.5px; color: var(--text-3); }

.ipo-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
  align-items: start;
}
.ipo-list .empty { grid-column: 1 / -1; }

.card-ipo {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 15px 15px 13px;
  border-left: 3px solid rgba(245, 158, 11, 0.55);
}
.card-ipo:hover { border-color: #33405a; border-left-color: rgba(245, 158, 11, 0.85); }

.ipo-meta { font-size: 12.5px; font-weight: 600; color: var(--text-3); letter-spacing: 0.01em; }

.ipo-dday {
  flex: none;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #cfe0ff;
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 999px;
  padding: 3px 9px;
}
.ipo-dday.is-soon {
  color: #ffd699;
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.5);
}
.ipo-dday.is-live {
  color: #ffd0cc;
  background: rgba(248, 81, 73, 0.16);
  border-color: rgba(248, 81, 73, 0.5);
}
.ipo-dday.is-done {
  color: var(--text-3);
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.3);
}

.ipo-rows { display: flex; flex-direction: column; gap: 4px; }
.ipo-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-2);
}
.ipo-k {
  flex: none;
  min-width: 38px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.02em;
}
.ipo-v {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.ipo-x { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ipo-summary { margin: 2px 0 0; }
.ipo-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
  padding-top: 9px;
  border-top: 1px solid var(--border-soft);
}
.badge-broker {
  font-size: 12px;
  font-weight: 650;
  color: #c9d4e4;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 999px;
  padding: 2px 8px;
}
.ipo-more {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  color: #ffd08a;
  white-space: nowrap;
}
.ipo-more i { font-style: normal; }

/* 공모주 상세 */
.detail-inner.r-ipo { --accent: #f59e0b; }
.ipo-price-lede { font-weight: 750; color: #ffd9a8; }
.ipo-links { display: flex; flex-direction: column; gap: 8px; }
.detail-link-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.detail-link-sub { font-size: 12px; font-weight: 500; color: var(--text-3); }
.ipo-hint { margin: 9px 0 0; font-size: 12px; line-height: 1.55; color: var(--text-3); }
.ipo-remind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
  color: #ffd9a8;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: 12px;
  padding: 0 14px;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}
.ipo-remind:hover { background: rgba(245, 158, 11, 0.2); }
.ipo-remind.is-on {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.5);
  color: #b7f3d9;
}
.ipo-remind-hint {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-3);
}

@media (max-width: 900px) {
  .ipo-list { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .ticker { margin: 0 0 10px; border-radius: 13px; }
  .ticker-clip { height: 84px; }
  .tslide { padding: 8px 16px 8px 13px; gap: 7px; }
  .tq + .tq { padding-left: 7px; }
  .tq-name { height: 11px; font-size: 9.5px; line-height: 11px; }
  .tq-val { height: 19px; font-size: 14.5px; line-height: 19px; letter-spacing: -0.025em; }
  .tq-meta { height: 13px; gap: 4px; line-height: 13px; }
  .tq-chg { font-size: 10.5px; }
  .tq-krw { font-size: 10px; }
  .tq-note { font-size: 9px; }
  .tecon-t { font-size: 12.5px; }
  .tecon-k { font-size: 9.5px; }
  .subregions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; overflow: visible; padding: 0; -webkit-mask-image: none; mask-image: none; }
  .subregions .chip { min-height: 34px; padding: 0 8px; font-size: 12.5px; gap: 5px; justify-content: center; }
  .subregions .flag { font-size: 12px; }
  .deal-counts { font-size: 12px; padding: 7px 9px; gap: 3px 8px; }
  .ipo-head-t { font-size: 13px; }
  .card-ipo { padding: 13px 13px 12px; border-radius: 15px; gap: 8px; }
  .card-ipo .company { font-size: 16px; }
  .ipo-more { font-size: 12px; }
}

@media (max-width: 330px) {
  .tq-chg { font-size: 9.5px; }
  .tq-krw { font-size: 9px; }
  .tq-note { font-size: 8.5px; }
}

@media (max-width: 360px) {
  .tslide { padding: 8px 15px 8px 11px; gap: 6px; }
  .tq-val { font-size: 13.5px; }
  .tq-chg { font-size: 10px; }
  .tq-krw { font-size: 9.5px; }
  .tq + .tq { padding-left: 6px; }
  .tecon-t { font-size: 12px; line-height: 1.3; }
  .subregions .chip { padding: 0 9px; font-size: 12.5px; }
  .deal-counts { font-size: 12px; }
}

/* 공모주 상세: 주관사 링크에서 라벨이 두 줄로 접히지 않게(좁은 화면) */
.ipo-links .detail-link-main { flex: 1 1 auto; }
.ipo-links .detail-link-main > span:first-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ipo-links .detail-link-host { max-width: 44%; flex: 0 1 auto; }

/* ── 고래 추적 (온체인 대형 이동) ───────────────────────────
 * 데스크톱은 표, 좁은 화면은 카드처럼 보이도록 같은 DOM 을 grid-area 로 재배치한다.
 */
.whales { margin: 2px 0 8px; }

.whale-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
}
.whale-head-main { min-width: 0; }
.whale-title { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.whale-sub { margin: 3px 0 0; font-size: 13px; color: var(--text-3); }

/* 고래 이동 / 기관 매수·매도 세그먼트 */
.whale-switch {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0;
  overflow: visible;
}
.whale-switch .whale-chip {
  flex: 1 1 0;
  min-width: 0;
  justify-content: center;
  min-height: 40px;
  padding: 0 10px;
  font-size: 13px;
  gap: 6px;
}
.whale-chip .flag { font-size: 14px; line-height: 1; }
.whale-chip[data-wview="moves"].is-active {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.5);
  color: #9df0cd;
}
.whale-chip[data-wview="inst"].is-active {
  background: rgba(245, 196, 81, 0.14);
  border-color: rgba(245, 196, 81, 0.45);
  color: #f6d78d;
}
@media (max-width: 360px) {
  .whale-switch .whale-chip { font-size: 12.5px; padding: 0 7px; gap: 4px; }
  .whale-chip .flag { font-size: 13px; }
}

.whale-refresh {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.whale-refresh:hover { color: var(--text); border-color: #2f3a4b; }
.whale-refresh .wr-ico { font-size: 14px; line-height: 1; }
.whale-refresh.is-busy .wr-ico { display: inline-block; animation: wspin 0.8s linear infinite; }
@keyframes wspin { to { transform: rotate(360deg); } }

.whale-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
}
.whale-chips { flex: 1 1 auto; min-width: 0; flex-wrap: wrap; overflow: visible; row-gap: 6px; }
.whale-chips .chip { gap: 5px; }
.whale-chips .chip b {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-3);
}
.whale-chips .chip.is-active b { color: var(--text); }
.whale-chips .chip em {
  font-style: normal;
  font-size: 12px;
  color: var(--text-3);
}
.whale-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.whale-sort { display: flex; gap: 4px; flex: none; }
.wtoggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}
.wtoggle .wt-ico { font-size: 12.5px; line-height: 1; }
.wtoggle b { font-size: 12px; font-weight: 700; color: var(--text-3); }
.wtoggle:hover { color: var(--text); border-color: #33405a; }
.wtoggle.is-on {
  color: #bfd7ff;
  border-style: solid;
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.14);
}
.wtoggle.is-on b { color: #bfd7ff; }
.wsort {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.wsort.is-active { color: var(--text); border-color: var(--border); background: var(--card); }

.tok {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
  font-style: normal;
  line-height: 1;
  flex: none;
}
.tok-btc { background: #f7931a; color: #1b1206; }
.tok-eth { background: #8b9bf5; color: #0b1020; }
.tok-xrp { background: #e2e8f4; color: #0b1020; }
.tok-usdt { background: #26a17b; color: #04140f; }
.tok-usdc { background: #2775ca; color: #f2f7ff; }

.wtable {
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--card);
  overflow: hidden;
}
.whead,
.wrow {
  display: grid;
  grid-template-columns: 92px minmax(0, 1.05fr) 20px minmax(0, 1.05fr) 104px 74px minmax(112px, auto);
  gap: 10px;
  align-items: center;
  padding: 11px 16px;
}
.whead {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-3);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-soft);
}
.wh-amt, .wh-usd { text-align: right; }
.wrow { border-bottom: 1px solid rgba(255, 255, 255, 0.045); }
.wrow:last-child { border-bottom: 0; }
.wrow:hover { background: rgba(255, 255, 255, 0.018); }

.w-time { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.w-time b { font-size: 13px; font-weight: 700; color: #cfe0ff; letter-spacing: -0.01em; }
.w-clock { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.wflow {
  align-self: flex-start;
  margin-top: 3px;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.wflow-in { color: #34d399; background: rgba(16, 185, 129, 0.13); }
.wflow-out { color: #fb9a92; background: rgba(248, 81, 73, 0.13); }
.wflow-same { color: #a7b3c6; background: rgba(148, 163, 184, 0.12); }

.wp { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.wp-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wp-name.is-unknown { color: #94a2b6; font-weight: 500; }
.wp-more { font-style: normal; font-size: 12px; color: var(--text-3); margin-left: 2px; }
.wp-addr { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.w-arrow { color: var(--text-3); font-size: 13px; text-align: center; }

.w-amt {
  font-size: 14px;
  font-weight: 700;
  color: #ff8f8f;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.w-tok {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.w-usd {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.whale-empty {
  margin: 0;
  padding: 22px 18px;
  text-align: center;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-2);
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
}
.whale-empty strong { display: block; color: var(--text); margin-bottom: 4px; }

.whale-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.015);
  font-size: 12.5px;
  line-height: 1.62;
  color: var(--text-3);
}
.whale-note b { color: var(--text-2); font-weight: 600; }

/* 고래 이동 행 클릭(상세 열기) */
.wrow.is-clickable { cursor: pointer; }
.wrow.is-clickable:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.65);
  outline-offset: -2px;
}

/* 고래 이동 상세 — 지갑 카드 */
.wd-card {
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: var(--card);
}
.wd-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wd-name { font-size: 14px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.wd-name.is-unknown { color: var(--text-2); }
.wd-kind {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  color: var(--text-3);
}
.wd-kind.is-known { color: #bfd7ff; border-color: rgba(59, 130, 246, 0.45); background: rgba(59, 130, 246, 0.12); }
.wd-ent { margin: 4px 0 0; font-size: 12.5px; color: var(--text-3); }
.wd-addr-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
}
.wd-code {
  flex: 1 1 auto;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  word-break: break-all;
  overflow-wrap: anywhere;
}
.wd-code-hash { color: var(--text-3); font-size: 12px; }
.wd-copy {
  flex: none;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.wd-copy:hover { color: var(--text); border-color: #33405a; }
.wd-copy.is-done { color: #bfd7ff; border-color: rgba(59, 130, 246, 0.5); background: rgba(59, 130, 246, 0.12); }
.wd-link { margin-top: 10px; min-height: 42px; font-size: 13px; }
.wd-link .detail-link-main { flex: 1 1 auto; }
.wd-link .detail-link-arrow { margin-left: auto; }

@media (max-width: 420px) {
  .wd-addr-row { flex-wrap: wrap; }
  .wd-code { flex: 1 1 100%; }
  .wd-copy { flex: 0 0 auto; margin-left: auto; }
}

@media (max-width: 860px) {
  .whead,
  .wrow { grid-template-columns: 80px minmax(0, 1fr) 16px minmax(0, 1fr) 92px 62px minmax(100px, auto); gap: 8px; padding: 10px 12px; }
  .wp-name { font-size: 13px; }
}

@media (max-width: 760px) {
  .whale-title { font-size: 16.5px; }
  .whale-sub { font-size: 12.5px; }
  .whale-filters { flex-direction: column; align-items: stretch; gap: 8px; }
  .whale-chips { margin: 0 -2px; }
  .whale-tools { justify-content: space-between; }
  .whale-sort { justify-content: flex-end; }
  .whale-refresh .wr-txt { display: none; }
  .whale-refresh { padding: 0; width: 34px; justify-content: center; min-height: 34px; }

  .wtable { border: 0; background: transparent; border-radius: 0; overflow: visible; }
  .whead { display: none; }
  .wrow {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "time amt"
      "from amt"
      "to   usd";
    row-gap: 12px;
    column-gap: 12px;
    padding: 13px 14px;
    background: var(--card);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    margin-bottom: 8px;
  }
  .wrow:last-child { margin-bottom: 0; }
  .w-time { grid-area: time; flex-direction: row; align-items: baseline; gap: 8px; flex-wrap: wrap; }
  .w-time .wflow { margin-top: 0; }
  .w-from { grid-area: from; }
  .w-to { grid-area: to; }
  .w-arrow { display: none; }
  .w-amt { grid-area: amt; align-self: center; font-size: 15px; }
  .w-amt::after {
    content: " " attr(data-tok);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
    margin-left: 2px;
  }
  .w-tok { display: none; }
  .w-usd { grid-area: usd; align-self: end; font-size: 13px; color: var(--text-2); }

  .w-from::before,
  .w-to::before {
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--text-3);
    content: attr(data-lbl);
  }
  .wp-name { font-size: 13.5px; white-space: normal; overflow: visible; text-overflow: clip; }
  .whale-note { font-size: 12px; }
}

@media (max-width: 360px) {
  .whale-chips .chip { padding: 0 9px; font-size: 12.5px; }
  .whale-chips .chip em { display: none; }
  .wtoggle { padding: 0 9px; font-size: 12px; }
  .insider-chips .chip { padding: 0 10px; font-size: 12.5px; }
  .w-amt { font-size: 14px; }
}

/* ── 마진·청산 탭 ───────────────────────────────────────────
 * 롱·숏 비중 게이지(초록=롱, 빨강=숏)와 거래소별 카드, 실시간 청산 피드.
 */
.margin { display: flex; flex-direction: column; gap: 12px; margin: 2px 0 10px; }
.margin[hidden] { display: none; }

.mg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mg-head-main { min-width: 0; }
.mg-title { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.mg-sub { margin: 3px 0 0; font-size: 13px; color: var(--text-3); }
.mg-live {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, 0.32);
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.mg-live i {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  animation: mgpulse 2s ease-out infinite;
}
@keyframes mgpulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.45); }
  70% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}
.mg-live.is-wait { color: #93c5fd; border-color: rgba(59, 130, 246, 0.32); background: rgba(59, 130, 246, 0.12); }
.mg-live.is-off { color: #fbbf24; border-color: rgba(245, 158, 11, 0.34); background: rgba(245, 158, 11, 0.12); }
.mg-live.is-off i, .mg-live.is-wait i { animation: none; }

.mg-coins, .mg-tf {
  flex-wrap: wrap;
  overflow: visible;
  row-gap: 6px;
  -webkit-mask-image: none;
  mask-image: none;
  padding-bottom: 0;
  margin: 0;
}
.mg-coins { margin-top: 2px; }
.mg-coins .chip { gap: 6px; }
.mg-tf .chip { min-height: 32px; font-size: 12.5px; padding: 0 12px; }
.mg-tf { margin: -4px 0 2px; }
.tok-sol { background: #14f195; color: #04150f; }
.tok-zec { background: #f4b728; color: #1a1405; }

.mg-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mg-panel {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px 14px 13px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.mg-panel-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mg-k { font-size: 13px; font-weight: 700; color: var(--text-2); }
.mg-basis { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; text-align: right; }

.mg-bar {
  position: relative;
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #1b2230;
  gap: 1px;
}
.mg-bar-lg { height: 15px; }
.mg-fill { display: block; height: 100%; transition: width 0.4s ease; }
.mg-fill.long { background: linear-gradient(90deg, #0f9d70, #34d399); }
.mg-fill.short { background: linear-gradient(90deg, #f0736a, #f85149); }

.mg-legend { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.mg-lg { display: inline-flex; align-items: baseline; gap: 4px; color: var(--text-3); font-weight: 600; white-space: nowrap; }
.mg-lg b { font-size: 14px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.mg-lg.long b { color: #5ee6b4; }
.mg-lg.short b { color: #ff8f86; }
.mg-ratio { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

.mg-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mg-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px 13px 11px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.mg-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--ex, #3b82f6);
  opacity: 0.9;
}
.mg-card.is-err { opacity: 0.72; }
.mg-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.mg-ex { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; font-weight: 700; white-space: nowrap; }
.mg-ex-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ex, #3b82f6); flex: none; }
.mg-conn {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex: none;
  background: #3a4557;
  margin-left: 1px;
}
.mg-conn.is-wait { background: #3b82f6; animation: mgpulse 2s ease-out infinite; }
.mg-conn.is-on { background: #34d399; }
.mg-conn.is-off { background: #f59e0b; }
.mg-card-ratio { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mg-card-nums { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.mg-num { display: inline-flex; align-items: baseline; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.mg-num b { font-size: 17px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.mg-num.long b { color: #5ee6b4; }
.mg-num.short b { color: #ff8f86; }
.mg-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mg-spark { width: 76px; height: 22px; flex: none; opacity: 0.85; }
.mg-card-basis { font-size: 12px; color: var(--text-3); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mg-feed {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  overflow: hidden;
}
.mg-feed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-soft);
}
.mg-feed-t { margin: 0; font-size: 13px; font-weight: 700; }
.mg-feed-sub { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.mg-feed-list { display: flex; flex-direction: column; }
.mg-row {
  display: grid;
  grid-template-columns: 58px 84px minmax(0, 1fr) 88px;
  gap: 10px;
  align-items: center;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  font-size: 13px;
}
.mg-row:last-child { border-bottom: 0; }
.mg-row-t { color: var(--text-3); font-variant-numeric: tabular-nums; }
.mg-row-ex { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font-weight: 600; white-space: nowrap; }
.mg-side { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; white-space: nowrap; }
.mg-side.long { color: #5ee6b4; }
.mg-side.short { color: #ff8f86; }
.mg-side i { font-style: normal; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 5px; }
.mg-side.long i { background: rgba(16, 185, 129, 0.14); }
.mg-side.short i { background: rgba(248, 81, 73, 0.14); }
.mg-row-usd { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.mg-empty { margin: 0; padding: 16px 14px; font-size: 12.5px; color: var(--text-3); text-align: center; }
.mg-empty[hidden] { display: none; }
.mg-note { margin: 0; font-size: 12px; line-height: 1.65; color: var(--text-3); }

@media (max-width: 860px) {
  .mg-cards { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .mg-summary { grid-template-columns: 1fr; gap: 8px; }
  .mg-panel { padding: 11px 12px 12px; border-radius: 15px; gap: 8px; }
  .mg-title { font-size: 16px; }
  .mg-sub { font-size: 12.5px; }
  .mg-live { padding: 4px 9px; font-size: 12px; }
  .mg-card { padding: 11px 12px 10px; border-radius: 15px; gap: 8px; }
  .mg-num b { font-size: 16px; }
  .mg-row { grid-template-columns: 52px 76px minmax(0, 1fr) 80px; gap: 8px; padding: 9px 12px; font-size: 12.5px; }
  .mg-side i { font-size: 9.5px; padding: 1px 4px; }
  .mg-note { font-size: 12px; }
}
@media (max-width: 360px) {
  .mg-tf .chip { padding: 0 10px; font-size: 12.5px; }
  .mg-coins .chip { padding: 0 10px; font-size: 12.5px; }
  .mg-row { grid-template-columns: 48px 70px minmax(0, 1fr) 74px; font-size: 12.5px; }
  .mg-spark { width: 64px; }
}

/* OKX 카드: 스냅샷이 선택 구간보다 오래됐을 때만 조용히 알린다 */
.mg-card.is-late .mg-card-basis { color: #f0b45b; }
.mg-src { margin: 0; font-size: 12px; color: var(--text-3); letter-spacing: -0.01em; }

/* ── 거래소 입금 알림 ───────────────────────────────────── */
.wtoggle-alert { position: relative; }
.wtoggle-alert.is-on {
  color: #fde68a;
  border-style: solid;
  border-color: rgba(251, 191, 36, 0.5);
  background: rgba(251, 191, 36, 0.14);
}
.wa-dot {
  position: absolute;
  top: -3px; right: -3px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 2px var(--bg);
}
.wa-level { display: inline-flex; flex: none; }
.wa-level select {
  min-height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.wa-level select:focus-visible { outline: 2px solid var(--global); outline-offset: 1px; }

.walerts {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-radius: var(--radius-sm);
  background: rgba(251, 191, 36, 0.07);
}
.walerts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: #fde68a;
}
.walerts-clear {
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 7px;
  background: transparent;
  color: #fde68a;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.walerts-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.wa-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.wa-item:hover { border-color: #3a465c; background: var(--card-hi); }
.wa-item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wa-item-main b { font-size: 13px; }
.wa-item-usd { color: var(--text-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-item-time { color: var(--text-3); font-size: 12px; flex: none; }
.walerts-note { margin: 8px 0 0; color: var(--text-3); font-size: 12px; }

.wa-toasts {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 90;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100vw - 24px));
}
.wa-toast {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 12px;
  background: #1b1a12;
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 12px 28px -14px rgba(0, 0, 0, 0.95);
}
.wa-toast b { color: #fde68a; font-size: 12.5px; }
.wa-toast span { color: var(--text-2); font-size: 12.5px; line-height: 1.45; }

@media (max-width: 760px) {
  .whale-tools { flex-wrap: wrap; justify-content: flex-start; gap: 6px; }
  .wa-level select { min-height: 30px; }
  .walerts { padding: 9px 10px; }
}
@media (max-width: 360px) {
  .wtoggle-alert { padding: 0 8px; }
  .wa-level select { font-size: 12px; padding: 0 6px; }
}

/* 화면에는 보이지 않고 스크린리더에만 읽히는 라벨 */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
/* 코인 칩 토큰 글리프(Ξ 등)가 원 밖으로 넘치지 않게 */
.mg-coins .tok { font-size: 9.5px; overflow: hidden; }

/* 대형 포지션(상위 트레이더) — 요약 패널 3열 · 카드 안 미니 바 */
.mg-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mg-top-wrap { display: flex; flex-direction: column; gap: 5px; padding-top: 8px; border-top: 1px dashed rgba(255, 255, 255, 0.07); }
.mg-top-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.mg-top-k { font-size: 12px; font-weight: 700; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg-top-v { font-size: 12.5px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mg-bar-sm { height: 5px; }

/* 대형 청산 필터 · 요약 */
.mg-bigbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.014);
  flex-wrap: wrap;
}
.mg-bigf { flex-wrap: wrap; overflow: visible; row-gap: 6px; gap: 5px; -webkit-mask-image: none; mask-image: none; padding: 0; }
.mg-bigf .chip { min-height: 28px; padding: 0 10px; font-size: 12.5px; }
.mg-bigsum {
  margin: 0 0 0 auto;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .mg-summary { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .mg-bigbar { padding: 8px 12px; gap: 8px; }
  .mg-bigsum { margin-left: 0; width: 100%; font-size: 12px; }
  .mg-top-k { font-size: 12px; }
  .mg-top-v { font-size: 12px; }
}

/* ── 호가·유동성 밀집 가격대 · 청산 집중 가격대 ─────────────── */
.mg-depth {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 15px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.mg-depth-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.mg-depth-head-main { min-width: 0; }
.mg-depth-t { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: -0.02em; }
.mg-depth-sub { margin: 3px 0 0; font-size: 12.5px; color: var(--text-3); line-height: 1.45; }
.mg-depth-badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, 0.30);
  background: rgba(16, 185, 129, 0.10);
  color: #6ee7b7;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.mg-depth-badge.is-wait { color: #93c5fd; border-color: rgba(59, 130, 246, 0.30); background: rgba(59, 130, 246, 0.10); }
.mg-depth-badge.is-off { color: #fbbf24; border-color: rgba(245, 158, 11, 0.32); background: rgba(245, 158, 11, 0.10); }

/* 핵심 구간 요약 */
.mg-core { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mg-core-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 8px 10px 9px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.018);
}
.mg-core-row.sell { border-color: rgba(248, 81, 73, 0.26); background: rgba(248, 81, 73, 0.06); }
.mg-core-row.buy { border-color: rgba(16, 185, 129, 0.26); background: rgba(16, 185, 129, 0.06); }
.mg-core-k { font-size: 12px; font-weight: 700; color: var(--text-3); }
.mg-core-row.sell .mg-core-k { color: #ff8f86; }
.mg-core-row.buy .mg-core-k { color: #5ee6b4; }
.mg-core-range {
  font-size: 13.5px;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mg-core-meta { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 사다리 */
.mg-ladder { display: flex; flex-direction: column; gap: 4px; }
.mg-ladder-list { display: flex; flex-direction: column; gap: 4px; }
.mg-drow {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px 10px 8px;
  border-radius: 11px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.014);
}
.mg-drow.is-core.sell { border-color: rgba(248, 81, 73, 0.34); background: rgba(248, 81, 73, 0.07); }
.mg-drow.is-core.buy { border-color: rgba(16, 185, 129, 0.34); background: rgba(16, 185, 129, 0.07); }
.mg-drow-top { display: flex; align-items: baseline; gap: 8px; }
.mg-drow-range {
  min-width: 0;
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mg-drow-dist { flex: none; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mg-drow.sell .mg-drow-dist { color: #c99b98; }
.mg-drow.buy .mg-drow-dist { color: #8fcab4; }
.mg-drow-usd { flex: none; font-size: 13px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mg-drow.sell .mg-drow-usd { color: #ff8f86; }
.mg-drow.buy .mg-drow-usd { color: #5ee6b4; }
.mg-dbadge {
  flex: none;
  font-style: normal;
  font-size: 11.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 5px;
  color: #0d1117;
  background: #e7eef8;
  letter-spacing: 0;
}
.mg-dbar {
  position: relative;
  height: 7px;
  border-radius: 999px;
  background: #1b2230;
  overflow: hidden;
}
.mg-dfill { display: flex; height: 100%; border-radius: 999px; overflow: hidden; gap: 0; transition: width 0.35s ease; }
.mg-dseg { display: block; height: 100%; }
.mg-drow-ex { font-size: 12px; color: var(--text-3); letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg-dempty { margin: 0; padding: 7px 10px; font-size: 12.5px; color: var(--text-3); }

/* 현재가 줄 */
.mg-ladder-px {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 3px 0;
  padding: 8px 10px;
  border-radius: 11px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.035);
}
.mg-lpx-k { flex: none; font-size: 12px; font-weight: 700; color: var(--text-3); }
.mg-lpx-v { font-size: 15px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.mg-lpx-meta { margin-left: auto; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

.mg-depth-scope { margin: 0; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.mg-depth-scope b.buy { color: #5ee6b4; }
.mg-depth-scope b.sell { color: #ff8f86; }
.mg-depth-reach { margin: 0; font-size: 12px; color: var(--text-3); line-height: 1.5; }
.mg-depth-leg { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin: 0; font-size: 12px; color: var(--text-3); }
.mg-leg-dot { display: inline-block; width: 6px; height: 6px; border-radius: 2px; margin-left: 6px; }

/* 청산 집중 가격대 */
.mg-liqb {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 2px;
  padding-top: 11px;
  border-top: 1px dashed rgba(255, 255, 255, 0.09);
}
.mg-liqb-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.mg-liqb-t { margin: 0; font-size: 13px; font-weight: 700; }
.mg-liqb-sub { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; text-align: right; }
.mg-liqb-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: start; }
.mg-liqb-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mg-liqb-k { display: block; font-size: 12px; font-weight: 700; line-height: 1.4; }
.mg-liqb-k.short { color: #ff8f86; }
.mg-liqb-k.long { color: #5ee6b4; }
.mg-liqb-list { display: flex; flex-direction: column; gap: 3px; }
.mg-lrow {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-soft);
}
.mg-lrow-range { flex: 1; min-width: 0; font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg-lrow-dist { flex: none; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.mg-lrow-sum { flex: none; font-size: 12px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mg-liqb-note { margin: 0; font-size: 12px; line-height: 1.6; color: var(--text-3); }

@media (max-width: 640px) {
  .mg-depth { padding: 12px 12px 13px; gap: 9px; border-radius: 15px; }
  .mg-depth-t { font-size: 13px; }
  .mg-depth-sub { font-size: 12px; }
  .mg-core { gap: 6px; }
  .mg-core-row { padding: 7px 9px 8px; }
  .mg-core-range { font-size: 13px; }
  .mg-core-meta { font-size: 12px; }
  .mg-drow { padding: 6px 9px 7px; }
  .mg-drow-range { font-size: 12.5px; }
  .mg-drow-usd { font-size: 12.5px; }
  .mg-drow-ex { font-size: 11.5px; }
  .mg-lpx-v { font-size: 14px; }
}
@media (max-width: 380px) {
  .mg-core { grid-template-columns: 1fr; }
  .mg-drow-dist { font-size: 12px; }
  .mg-liqb-cols { grid-template-columns: 1fr; }
}

/* ── 기관 BTC·ETH 매수 현황 (고래 추적 탭 상단) ───────────── */
.inst {
  margin: 0 0 14px;
  padding: 14px 14px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card-hi), var(--card));
  box-shadow: var(--shadow);
}
.inst-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.inst-head-main { min-width: 0; flex: 1 1 auto; }
.inst-title { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.inst-sub { margin: 3px 0 0; font-size: 12.5px; color: var(--text-3); line-height: 1.45; }
.inst-chips { display: flex; gap: 6px; flex: 0 1 auto; flex-wrap: wrap; justify-content: flex-end; max-width: 100%; }
.inst-chips .chip { min-height: 30px; padding: 0 11px; font-size: 12.5px; gap: 5px; }
.inst-chips .chip .tok { width: 16px; height: 16px; font-size: 9.5px; }

.inst-panels { display: grid; gap: 10px; margin: 12px 0 0; }
.inst-panel {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: rgba(10, 14, 20, 0.5);
  padding: 10px 11px 11px;
}
.inst-ph { display: flex; align-items: center; gap: 7px; }
.inst-ph .tok { width: 18px; height: 18px; font-size: 10px; }
.inst-ph b { font-size: 13px; letter-spacing: 0.01em; }
.inst-ph em { margin-left: auto; font-style: normal; font-size: 12.5px; color: var(--text-3); }

.inst-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 9px 0 0;
}
.inst-kpi {
  position: relative;
  padding: 8px 9px 9px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-soft);
  min-width: 0;
}
.inst-kpi > span { display: block; font-size: 12px; color: var(--text-3); letter-spacing: -0.01em; }
.inst-kpi > b {
  display: block;
  margin-top: 3px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inst-kpi > b.is-neg { color: #f87171; }
.inst-kpi > b.is-pos { color: var(--kr); }
.inst-kpi > b.is-buy { color: #f87171; }
.inst-kpi > b.is-sell { color: #60a5fa; }
.inst-kpi > b.is-na { color: var(--text-3); font-weight: 600; font-size: 13px; }
.inst-kpi > i { display: block; margin-top: 2px; font-style: normal; font-size: 12px; color: var(--text-3); }
.inst-kpi > i.is-up { color: #fca5a5; }
.inst-kpi > i.is-down { color: #93c5fd; }

.inst-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 18px;
  margin-top: 6px;
}
.inst-bar {
  flex: 1 1 0;
  min-width: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--kr);
  opacity: 0.75;
}
.inst-bar.is-out { background: #f87171; }

.inst-block { margin: 14px 0 0; }
.inst-block-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 7px;
}
.inst-block-h b { font-size: 13px; }
.inst-block-h span { font-size: 12px; color: var(--text-3); }

.inst-sides { display: flex; gap: 5px; margin: 0 0 8px; }
.inst-sides .chip { min-height: 27px; padding: 0 11px; font-size: 12.5px; }

.inst-buys, .inst-holds { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }

.inst-buy {
  padding: 9px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.015);
}
.ib-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ib-top .tok { width: 15px; height: 15px; font-size: 9px; flex: none; }
.ib-top b {
  min-width: 0;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ib-tk { font-size: 12px; color: var(--text-3); flex: none; }
.ib-top time { margin-left: auto; font-size: 12px; color: var(--text-3); flex: none; font-variant-numeric: tabular-nums; }
.ib-amt { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.ib-amt b { font-size: 13px; color: var(--kr); font-variant-numeric: tabular-nums; }
.inst-buy.is-buy .ib-amt b { color: #f87171; }
.inst-buy.is-sell .ib-amt b { color: #60a5fa; }
.ib-side {
  flex: none;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.5;
  padding: 0 5px;
  border-radius: 5px;
  letter-spacing: -0.01em;
}
.ib-side.is-buy { color: #fca5a5; background: rgba(248, 113, 113, 0.13); border: 1px solid rgba(248, 113, 113, 0.32); }
.ib-side.is-sell { color: #93c5fd; background: rgba(96, 165, 250, 0.13); border: 1px solid rgba(96, 165, 250, 0.32); }
.ib-amt span { font-size: 12.5px; color: var(--text-2); }
.ib-note { margin: 4px 0 0; font-size: 12px; color: var(--text-3); line-height: 1.45; }

.inst-hold {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.015);
}
.ih-rank {
  flex: none;
  width: 18px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.ih-main { min-width: 0; flex: 1 1 auto; }
.ih-name { display: flex; align-items: center; gap: 5px; min-width: 0; }
.inst-hold, .inst-buy { min-width: 0; }
.ih-name .tok { width: 14px; height: 14px; font-size: 8.5px; flex: none; }
.ih-name b { min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ih-name span { font-size: 12px; color: var(--text-3); flex: none; }
.ih-bar {
  display: block;
  height: 3px;
  margin: 5px 0 0;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.ih-bar i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #3b82f6, #10b981); }
.ih-extra { display: block; margin-top: 3px; font-size: 12px; color: var(--text-3); }
.ih-qty { flex: 0 1 auto; min-width: 0; max-width: 42%; text-align: right; }
.ih-qty b { display: block; font-size: 13px; font-variant-numeric: tabular-nums; }
.ih-qty span { display: block; font-size: 12px; color: var(--text-3); }
.ih-qty i { display: block; font-style: normal; font-size: 12px; color: var(--text-3); margin-top: 1px; }

.inst-note { margin: 12px 0 0; font-size: 12px; color: var(--text-3); line-height: 1.5; }

@media (min-width: 720px) {
  .inst-flows { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inst-panels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inst-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inst-buys { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inst-holds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 360px) {
  .inst { padding: 12px 11px 10px; }
  .inst-kpi > b { font-size: 13px; }
  .inst-chips .chip { padding: 0 9px; font-size: 12.5px; }
}

/* ── 기관·개인·거래소 순매수(양방향 막대) ─────────────────── */
.inst-flowbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 13px 0 8px;
  flex-wrap: wrap;
}
.inst-flowbar-t { font-size: 13px; letter-spacing: -0.01em; }
.inst-periods { display: flex; gap: 5px; }
.inst-periods .chip { min-height: 28px; padding: 0 10px; font-size: 12.5px; }

.inst-flows { display: grid; gap: 9px; }
.flow-card {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: rgba(10, 14, 20, 0.55);
  padding: 9px 11px 8px;
}
.flow-h { display: flex; align-items: center; gap: 6px; margin: 0 0 4px; }
.flow-h .tok { width: 16px; height: 16px; font-size: 9px; }
.flow-h b { font-size: 13px; }
.flow-h em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--text-3); }

.flow-rows { display: grid; gap: 2px; }
.flow-row { padding: 3px 0; }
.flow-line { display: flex; align-items: center; gap: 8px; }
.flow-lbl { flex: 0 0 58px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.flow-track { position: relative; flex: 1 1 auto; height: 20px; min-width: 0; }
.flow-axis {
  position: absolute;
  left: 50%;
  top: -3px;
  bottom: -3px;
  width: 1px;
  background: #33405a;
}
.flow-bar { position: absolute; top: 4px; height: 12px; border-radius: 3px; }
.flow-bar.is-in { background: #f87171; }
.flow-bar.is-out { background: #60a5fa; }
.flow-val {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.flow-val.is-in { color: #f87171; }
.flow-val.is-out { color: #60a5fa; }
.flow-val.is-na { color: var(--text-3); font-weight: 600; font-size: 12px; }
.flow-detail {
  display: block;
  margin: 1px 0 0 66px;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.4;
}
@media (max-width: 360px) {
  .flow-lbl { flex-basis: 50px; font-size: 12px; }
  .flow-detail { margin-left: 58px; font-size: 11.5px; }
  .flow-val { font-size: 12px; }
}

/* ── 기관 카드·순매수 줄: 누를 수 있는 곳 표시 ───────────────── */
.inst-ph {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.inst-ph:hover b { color: #fff; }
.inst-ph:active { opacity: 0.82; }
.inst-go {
  font-style: normal;
  font-size: 13px;
  line-height: 1;
  margin-left: 4px;
  color: var(--text-3);
}

.inst-kpi {
  display: block;
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.inst-kpi:hover { border-color: #33405a; background: rgba(255, 255, 255, 0.045); }
.inst-kpi:active { background: rgba(255, 255, 255, 0.07); }
.inst-kpi > i.kpi-go {
  position: absolute;
  top: 5px;
  right: 8px;
  margin: 0;
  font-style: normal;
  font-size: 15px;
  line-height: 1;
  color: var(--text-2);
  opacity: 0.9;
}

.inst-buys > li,
.inst-holds > li { min-width: 0; }
.inst-buy {
  display: block;
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.inst-buy:hover { border-color: #33405a; background: rgba(255, 255, 255, 0.045); }
.inst-buy:active { background: rgba(255, 255, 255, 0.07); }
.ib-go {
  flex: none;
  font-style: normal;
  font-size: 12.5px;
  line-height: 1;
  color: var(--text-3);
}
.ib-note { display: block; }

.inst-hold {
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.inst-hold:hover { border-color: #33405a; background: rgba(255, 255, 255, 0.045); }
.inst-hold:active { background: rgba(255, 255, 255, 0.07); }
.ih-go {
  flex: none;
  font-style: normal;
  font-size: 12.5px;
  line-height: 1;
  color: var(--text-3);
}

.flow-h {
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.flow-h:hover em { color: var(--text-2); }
.flow-row {
  display: block;
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
}
.flow-row:hover .flow-lbl { color: var(--text); }
.flow-row:active { background: rgba(255, 255, 255, 0.04); }
.flow-chg {
  font-style: normal;
  font-size: 11.5px;
  font-weight: 600;
  margin-left: 3px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.flow-chg-line {
  display: block;
  margin: 1px 0 0 66px;
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

/* ── 기관 코인 상세 페이지 (#inst=) ─────────────────────────── */
.detail-inner.r-inst { --accent: var(--crypto); }
.idet-sub {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-3);
  letter-spacing: -0.01em;
}
.idet-flow {
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.015);
}
.idet-flow-h,
.idet-flow-r {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr 1fr;
  gap: 5px;
  align-items: center;
  padding: 8px 10px;
}
.idet-flow-h { background: rgba(255, 255, 255, 0.035); }
.idet-flow-h span { font-size: 12px; color: var(--text-3); }
.idet-flow-h b { font-size: 12px; color: var(--text-3); text-align: right; font-weight: 600; }
.idet-flow-r { border-top: 1px solid var(--border-soft); font-variant-numeric: tabular-nums; }
.idet-flow-r > span { font-size: 12.5px; color: var(--text-2); }
.idet-flow-r > b { font-size: 12.5px; text-align: right; font-weight: 700; white-space: nowrap; }
.idet-flow-r > b.is-in { color: #f87171; }
.idet-flow-r > b.is-out { color: #60a5fa; }
.idet-flow-r > b.is-na { color: var(--text-3); font-weight: 500; font-size: 12px; white-space: normal; }
.idet-flow-r > b i {
  display: block;
  font-style: normal;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
}
.idet-days {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.015);
}
.idet-days li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  font-size: 12.5px;
  border-top: 1px solid var(--border-soft);
  font-variant-numeric: tabular-nums;
}
.idet-days li:first-child { border-top: 0; }
.idet-days span { color: var(--text-3); }
.idet-days b { font-weight: 700; }
.idet-days b.is-in { color: #f87171; }
.idet-days b.is-out { color: #60a5fa; }
.idet-evs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.idet-ev {
  padding: 10px 11px;
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.015);
}
.idet-ev.is-focus { border-color: #64748b; box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.35); animation: detFlash 2s ease-out; }
.idet-ev-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.idet-ev-top b { font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idet-ev-top time { margin-left: auto; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.idet-ev-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.idet-cell {
  padding: 6px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  min-width: 0;
}
.idet-cell > span { display: block; font-size: 12px; color: var(--text-3); }
.idet-cell > b {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.idet-cell b i { font-style: normal; font-size: 11.5px; font-weight: 500; color: var(--text-3); }
.idet-ev-note { margin: 7px 0 0; font-size: 12px; line-height: 1.5; color: var(--text-3); }
.idet-na { color: var(--text-3); font-weight: 500; }
.detail-section.is-focus { animation: detSecFlash 2s ease-out; border-radius: 12px; }
@keyframes detFlash {
  0% { background: rgba(148, 163, 184, 0.18); }
  100% { background: rgba(255, 255, 255, 0.015); }
}
@keyframes detSecFlash {
  0% { background: rgba(148, 163, 184, 0.14); }
  100% { background: transparent; }
}

@media (min-width: 720px) {
  .idet-ev-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 360px) {
  .flow-chg-line { margin-left: 58px; font-size: 11.5px; }
  .idet-flow-h, .idet-flow-r { padding: 7px 8px; gap: 3px; }
  .idet-flow-r > b { font-size: 12px; }
  .idet-flow-r > b.is-na { font-size: 11.5px; }
}

.kv-grid dd b.is-buy { color: #f87171; }
.kv-grid dd b.is-sell { color: #60a5fa; }

.ih-qty b, .ih-qty span, .ih-qty i { white-space: nowrap; }

/* ── 상단 배너 시세 칸 = 버튼 (시세 상세 #quote= 로 이동) ─────────── */
button.tq {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease;
}
button.tq:hover .tq-val { color: #ffffff; }
button.tq:active { background: rgba(255, 255, 255, 0.055); }
button.tq:focus-visible {
  outline: 2px solid rgba(124, 141, 255, 0.75);
  outline-offset: 2px;
}
.tq-more {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  margin-left: 3px;
  opacity: 0.6;
  color: #8b9bb4;
  letter-spacing: 0;
}
button.tq:hover .tq-more { opacity: 0.9; }
@media (max-width: 400px) {
  .tq-more { font-size: 10px; margin-left: 2px; }
}

/* ── 시세 상세 페이지 (#quote=KOSPI · NASDAQ · BTC) ──────────────── */
.detail-inner.r-quote { --accent: #7c8dff; }

.qd-head { padding-top: 2px; }
.qd-quote {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}
.qd-big {
  font-size: 32px;
  font-weight: 780;
  line-height: 1.1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.qd-chg {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.qd-chg.up { color: #ff7b72; }
.qd-chg.down { color: #6ea8fe; }
.qd-abs { font-size: 13px; font-weight: 650; opacity: 0.8; }
.qd-krw {
  margin: 3px 0 0;
  font-size: 13px;
  font-weight: 650;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.qd-sub {
  margin: 5px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-3);
}
.qd-src-line {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-3);
  opacity: 0.9;
}

.qd-sec { margin-top: 22px; }
.qd-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}
/* 상세 섹션 제목(h3)의 기존 장식을 그대로 쓰되, 오른쪽 태그와 한 줄에 놓는다 */
.detail-section .qd-sec-head > h3 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1 1 auto;
  min-width: 0;
}
.detail-section .qd-sec-head > h3::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}
.qd-tag {
  flex: none;
  align-self: flex-start;
  margin-top: 1px;
  padding: 2px 7px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.08);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-3);
  white-space: nowrap;
}
.qd-tag-warm {
  border-color: rgba(245, 158, 11, 0.32);
  background: rgba(245, 158, 11, 0.1);
  color: #f0b45e;
}

.qd-tf {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  margin: 0 0 10px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}
.qd-tf-btn {
  -webkit-appearance: none;
  appearance: none;
  border: 0;
  margin: 0;
  padding: 6px 12px;
  border-radius: 8px;
  background: none;
  color: var(--text-3);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}
.qd-tf-btn:hover { color: var(--text-2); background: rgba(255, 255, 255, 0.05); }
.qd-tf-btn.is-on {
  background: rgba(124, 141, 255, 0.16);
  color: #cfd8ff;
  box-shadow: inset 0 0 0 1px rgba(124, 141, 255, 0.34);
}
.qd-tf-btn[disabled] { opacity: 0.4; cursor: default; }

.qd-chart {
  position: relative;
  width: 100%;
  touch-action: pan-y;
  cursor: crosshair;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(18, 25, 38, 0.72), rgba(13, 17, 23, 0.55));
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.qd-svg { display: block; width: 100%; height: auto; }
.qd-axis {
  font-size: 9.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.qd-tip {
  position: absolute;
  top: 9px;
  left: 8px;
  z-index: 3;
  min-width: 106px;
  padding: 7px 9px;
  border: 1px solid #2b3648;
  border-radius: 9px;
  background: rgba(8, 12, 19, 0.96);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.qd-tip[hidden] { display: none; }
.qd-tip-d {
  display: block;
  margin-bottom: 3px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-3);
  white-space: nowrap;
}
.qd-tip-r {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
}
.qd-tip-r i { font-style: normal; color: var(--text-3); }
.qd-tip-r b {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.qd-tip-r b.up { color: #ff7b72; }
.qd-tip-r b.down { color: #6ea8fe; }

.qd-cap {
  margin: 7px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.qd-empty {
  margin: 0;
  padding: 40px 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-3);
}
.qd-note {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-3);
}
.qd-why-head {
  margin: 2px 0 8px;
  font-size: 13.5px;
  font-weight: 750;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: #dfe7f3;
}
.qd-why li { font-size: 13px; line-height: 1.62; }

.qd-news-list { display: flex; flex-direction: column; gap: 8px; }
.qd-news {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.022);
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.qd-news:hover {
  background: rgba(255, 255, 255, 0.048);
  border-color: #33405a;
}
.qd-news:active { background: rgba(255, 255, 255, 0.07); }
.qd-news-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.qd-news-src { font-weight: 750; color: #8ea2ff; letter-spacing: 0.01em; }
.qd-news-time { flex: none; white-space: nowrap; }
.qd-news-title {
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--text);
}
.qd-news-arrow { margin-left: 4px; font-size: 12px; color: var(--text-3); }
.qd-news-sum {
  font-size: 12.5px;
  line-height: 1.58;
  color: var(--text-2);
}

@media (max-width: 480px) {
  .qd-big { font-size: 28px; }
  .qd-chg { font-size: 13.5px; }
  .qd-sec { margin-top: 18px; }
  .qd-why li, .qd-news-title { font-size: 13px; }
  .qd-news-sum { font-size: 12px; }
  .qd-tf-btn { padding: 6px 10px; font-size: 12px; }
}

/* ── 헤더 로고·이름 = 홈 링크 ──────────────────────────────── */
button.brand {
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  border-radius: 12px;
  padding: 2px;
  margin: -2px;
  transition: background 0.15s ease;
}
button.brand:hover { background: rgba(255, 255, 255, 0.045); }
button.brand:hover .brand-name { color: #ffffff; }
button.brand:focus-visible { outline: 2px solid var(--kr); outline-offset: 2px; }
.brand-text .brand-name { font-size: 16px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.2; white-space: nowrap; }

/* 윗줄 탭 두 개(홈 · 시장 브리핑)가 360px 에서도 나란히 들어가게 */
.tabs-feature .tab.tab-feature { flex: 1 1 0; width: auto; min-width: 0; }
.tab-feature-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-short { display: none; }
@media (max-width: 640px) {
  .sub-long { display: none; }
  .sub-short { display: inline; }
}

/* 상세 화면 상단의 로고·이름 → 홈 복귀 */
.detail-home {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 9px 0 5px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-2);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 750;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.detail-home:hover { background: rgba(255, 255, 255, 0.09); color: var(--text); border-color: #33405a; }
.dh-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  color: var(--kr);
  background: linear-gradient(160deg, rgba(16, 185, 129, 0.2), rgba(59, 130, 246, 0.12));
  border: 1px solid rgba(16, 185, 129, 0.3);
}
@media (max-width: 640px) {
  .detail-home { height: 32px; padding: 0 7px 0 4px; }
  .dh-name { display: none; }
}

/* ── 홈 화면 — 코스피 · 나스닥 · 코인 (데스크톱 3열 나란히 · 모바일 1열) ── */
.home { display: block; }
.home[hidden] { display: none; }
.home-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0 auto 10px;
  max-width: 880px;
}
.home-title { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.home-sub { margin: 0; font-size: 12.5px; color: var(--text-3); letter-spacing: -0.01em; }
.home-cards { display: flex; flex-direction: column; gap: 12px; max-width: 880px; margin: 0 auto; }
.home-loading { margin: 0; padding: 26px 0; text-align: center; color: var(--text-3); font-size: 13px; }
.home-note {
  max-width: 880px;
  margin: 12px auto 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-3);
}

/* 데스크톱(≥960px) — 홈은 화면 가로를 가득 채우고 세 시장을 3열로 나란히.
 * .wrap 에 is-home 이 붙은 동안만 넓어진다(다른 탭은 지금 폭 그대로). */
@media (min-width: 960px) {
  main.wrap.is-home {
    max-width: 1720px;
    padding-left: 24px;
    padding-right: 24px;
  }
  main.wrap.is-home .home-head,
  main.wrap.is-home .home-cards,
  main.wrap.is-home .home-note {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }
  main.wrap.is-home .home-head { margin-bottom: 12px; }
  main.wrap.is-home .home-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
  }
  main.wrap.is-home .hcard {
    display: flex;
    flex-direction: column;
    padding: 14px 16px 14px 18px;
  }
  main.wrap.is-home .hcard::before { top: 14px; bottom: 14px; }
  /* 3열 폭에서는 핵심 지표 4칸을 2×2 로 — 좁은 칸에서 숫자가 잘리지 않게 */
  main.wrap.is-home .hcard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: auto;
    padding-top: 10px;
  }
  main.wrap.is-home .hq-val { font-size: 27px; }
  /* 세 카드의 요약·지표 줄이 같은 높이에 오도록 접히는 부분만 늘린다 */
  main.wrap.is-home .hcard-why { flex: 1 1 auto; }
  main.wrap.is-home .home-note { margin-top: 14px; }
}

.hcard {
  position: relative;
  background: linear-gradient(180deg, var(--card-hi), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px 13px 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}
.hcard::before {
  content: "";
  position: absolute;
  left: 0;
  top: 13px;
  bottom: 13px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--edge, var(--kr));
  opacity: 0.85;
}
.hcard.h-kr { --edge: var(--kr); }
.hcard.h-us { --edge: var(--global); }
.hcard.h-coin { --edge: var(--crypto); }
.hcard:hover { border-color: #33405a; transform: translateY(-1px); }
.hcard:active { transform: translateY(0); }
.hcard:focus-visible { outline: 2px solid var(--kr); outline-offset: 2px; }

.hcard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.hcard-id { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.hcard-ico { font-size: 17px; line-height: 1.15; flex: none; }
.hcard-idt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.hcard-name { font-size: 15px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.hcard-name em {
  font-style: normal;
  margin-left: 6px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.02em;
  color: var(--text-3);
}
.hcard-status { font-size: 12px; color: var(--text-3); letter-spacing: -0.01em; }
.hcard-more {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 12px;
  font-weight: 750;
  color: var(--text-2);
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.hcard-more i { font-style: normal; font-weight: 800; }
.hcard:hover .hcard-more { background: #e8eef6; border-color: #e8eef6; color: #0b1016; }

.hcard-quote { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin: 9px 0 0; }
.hq-val { font-size: 29px; font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.hq-krw { font-size: 13px; font-weight: 700; color: var(--text-2); }
.hq-chg { font-size: 14px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hq-chg.up { color: #ff7b72; }
.hq-chg.down { color: #6ea8ff; }
.hq-abs { font-size: 12.5px; font-weight: 650; color: var(--text-3); font-variant-numeric: tabular-nums; }

.hcard-chart { margin: 7px 0 0; }
.hchart-svg { display: block; width: 100%; height: auto; }
.hchart-axis { font-size: 9px; font-weight: 600; fill: #9dabbf; font-variant-numeric: tabular-nums; }
.hchart-empty { margin: 0; padding: 28px 0; text-align: center; font-size: 12.5px; color: var(--text-3); }

.hcard-why {
  margin: 9px 0 0;
  padding: 9px 10px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.024);
}
.hwhy-head { display: flex; align-items: flex-start; gap: 7px; }
.hwhy-tag {
  flex: none;
  margin-top: 1px;
  padding: 2px 6px;
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.13);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #f5c26b;
  white-space: nowrap;
}
.hwhy-h { margin: 0; font-size: 13px; font-weight: 750; line-height: 1.4; letter-spacing: -0.01em; }
.hwhy-list { margin: 7px 0 0; padding-left: 15px; }
.hwhy-list li { font-size: 12.5px; line-height: 1.55; color: var(--text-2); }
.hwhy-list li + li { margin-top: 3px; }
.hwhy-note { margin: 7px 0 0; font-size: 12px; line-height: 1.5; color: var(--text-3); }

.hcard-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-top: 9px; }
.hcell {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--bg-soft);
}
.hc-k { display: block; font-size: 11.5px; font-weight: 750; letter-spacing: -0.01em; color: var(--text-3); }
.hc-v { display: block; margin-top: 3px; font-size: 13px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.3; overflow-wrap: anywhere; }
.hc-s { display: block; margin-top: 2px; font-size: 12px; line-height: 1.4; color: var(--text-2); overflow-wrap: anywhere; }

@media (max-width: 720px) {
  .hcard { padding: 12px 12px 12px 14px; }
  .hcard::before { top: 12px; bottom: 12px; }
  .hq-val { font-size: 26px; }
  .hcard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hwhy-list li { font-size: 12px; }
  .home-title { font-size: 16px; }
}
@media (max-width: 360px) {
  .hq-val { font-size: 24px; }
  .hcard-more { padding: 3px 7px; font-size: 12px; }
}

/* ── 가독성 정리 (2026-11-21) ──────────────────────────────────
 * ① 흐린 회색을 밝게(--text-2·--text-3 상향 + 하드코딩 회색 교체) ② 10~12px 보조 문구를 12~13px 로
 * ③ 본문·요약은 줄간격을 넉넉히, 카드 여백을 조금 더 ④ 목록 카드는 2줄 말줄임(상세에서 전체 확인)
 */
body { line-height: 1.58; }

/* 본문 · 요약 */
.summary-text { font-size: 14px; line-height: 1.68; color: #d9e2ee; }
.bheadline-line { font-size: 14px; line-height: 1.7; }
.bsec-p { font-size: 14.5px; line-height: 1.78; color: #d9e2ee; }
.bsec-p + .bsec-p { margin-top: 9px; }
.bsec-em { font-size: 14px; line-height: 1.72; }
.bchecks li { font-size: 13.5px; line-height: 1.66; }
.bnote { font-size: 12.5px; line-height: 1.7; }
.bfoot { font-size: 12px; color: #9dabbf; }
.detail-text { font-size: 14.5px; line-height: 1.78; }
.detail-list li { font-size: 13.5px; line-height: 1.72; }
.detail-lede { font-size: 14.5px; line-height: 1.7; }
.detail-section { margin-top: 24px; }
.qd-news-sum { font-size: 12.5px; line-height: 1.62; }
.qd-why li { font-size: 13.5px; line-height: 1.7; }
.qd-note { font-size: 12px; line-height: 1.65; color: var(--text-3); }
.round-note { color: var(--text-2); line-height: 1.6; }

/* 카드 여백 · 위계 */
.card { padding: 19px 18px 18px; }
.card .company { line-height: 1.3; }
.card .summary-text { margin-top: 2px; }
.bcard { padding: 20px 19px 18px; }
.controls { padding: 13px; gap: 11px; }
.chips { gap: 8px; }
.foot { margin-top: 34px; padding-top: 20px; }
.foot-line, .foot-notice { line-height: 1.7; font-size: 12.5px; }

/* 목록 카드 요약은 2줄까지 (전체 내용은 카드를 눌러 상세에서) */
.card .summary-text,
.card .round-note,
.ipo-summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.qd-news-title,
.qd-news-sum {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.qd-news-title { -webkit-line-clamp: 2; line-clamp: 2; }
.qd-news-sum { -webkit-line-clamp: 2; line-clamp: 2; }

/* 시장 브리핑 — 기본 3줄, '더 보기'로 펼침 */
.bsec-body.is-clamped .bsec-p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
.bsec-body.is-clamped .bsec-p + .bsec-p { display: none; }
.bsec-toggle {
  margin-top: 8px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.bsec-toggle:hover { background: rgba(255, 255, 255, 0.09); color: var(--text); }
.bsec-toggle i { font-style: normal; margin-left: 2px; }

/* 시세 상세 — 짧은 요약 + '자세한 이유 보기' */
.qd-more { margin-top: 10px; }
.qd-more summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: #bcd3ff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.qd-more summary::-webkit-details-marker { display: none; }
.qd-more summary::after { content: "▾"; font-size: 10px; }
.qd-more[open] summary::after { content: "▴"; }
.qd-more-list { margin-top: 10px; }

/* 홈 카드 */
.hcard-why { margin-top: 11px; padding: 10px 11px 11px; }
.hwhy-h { font-size: 13.5px; line-height: 1.45; }
.hwhy-list li {
  font-size: 12.5px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.hwhy-note { font-size: 11.5px; line-height: 1.55; color: #94a2b6; }
.hcard-grid { margin-top: 10px; gap: 8px; }
.hcell { padding: 9px 10px; }
.hc-k { color: #a9b7c9; }
.hc-v { font-size: 13px; }
.hc-s { font-size: 11.5px; line-height: 1.45; color: #bac6d6; }
.hcard-status { font-size: 12px; color: #a9b7c9; }
.hcard-more { font-size: 12px; }

/* 하단 안내·칩 라벨 대비 */
.chip { color: var(--text-2); }
.result-line, .deal-counts { color: var(--text-2); }
.empty { color: var(--text-2); }

/* 캘린더 카드 — '수치에 따른 영향'은 기본 2줄, 더 보기로 펼침 */
.cal-impact-body.is-clamped .cal-impact-b {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.cal-impact-body.is-clamped .cal-impact-b + .cal-impact-b { display: none; }
.cal-impact-toggle { margin-top: 7px; }
.cal-impact .bsec-toggle { font-size: 11.5px; padding: 5px 10px; }

/* 상단 시세 배너 — 모바일에서도 라벨·등락률을 읽을 수 있게 조금 키운다 */
@media (max-width: 640px) {
  .tq-name { height: 15px; font-size: 11.5px; line-height: 15px; letter-spacing: 0.02em; }
  .tq-val { height: 21px; font-size: 15px; line-height: 21px; }
  .tq-meta { line-height: 15px; gap: 5px; }
  .tq-chg { font-size: 11.5px; }
  .tq-krw, .tq-note { font-size: 11px; }
  .tecon-k { font-size: 11.5px; }
  .tecon-t { font-size: 13.5px; }
}
@media (max-width: 360px) {
  .tq-name { font-size: 11px; }
  .tq-val { font-size: 14px; }
  .tq-chg, .tq-krw { font-size: 11px; }
}

/* 상단 시세 배너 — 데스크톱 라벨도 조금 키운다(모바일 규칙은 위에서 따로) */
@media (min-width: 641px) {
  .tq-name { height: 14px; font-size: 11.5px; line-height: 14px; letter-spacing: 0.03em; }
  .tq-meta { height: 16px; line-height: 16px; }
  .tq-chg { font-size: 12px; }
  .tq-krw { font-size: 11.5px; }
  .tq-note { font-size: 11px; }
}

/* ── 홈 카드 '주목 섹터' 태그 ─────────────────────────────── */
.hcard-themes { margin-top: 10px; }
.hthemes-h {
  margin: 0 0 6px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #aab8ca;
}
.htags { display: flex; flex-wrap: wrap; gap: 6px; }
.htag {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  max-width: 100%;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  line-height: 1.35;
}
.htag b { font-weight: 750; color: var(--text); }
.htag i { font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--text-2); }
.htag.up { border-color: rgba(255, 123, 114, 0.34); background: rgba(255, 123, 114, 0.08); }
.htag.up i { color: #ff8f86; }
.htag.down { border-color: rgba(110, 168, 254, 0.34); background: rgba(110, 168, 254, 0.08); }
.htag.down i { color: #8fbaff; }
.htag.warn { border-color: rgba(240, 180, 90, 0.32); background: rgba(240, 180, 90, 0.08); }
.htag.warn i { color: #f0c07a; }
.htheme-note {
  margin: 7px 0 0;
  font-size: 11.5px;
  line-height: 1.55;
  color: #aab8ca;
}
@media (max-width: 360px) {
  .htag { font-size: 11.5px; padding: 4px 8px; }
  .htag i { font-size: 11px; }
}

/* 주목 섹터 태그 — 라벨을 태그와 같은 줄에 (한 줄 아끼기) */
.hcard-themes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 7px; margin-top: 10px; }
.hcard-themes .hthemes-h { margin: 0; flex: none; }
.hcard-themes .htags { flex: 1 1 auto; min-width: 0; }
.hcard-themes .htheme-note { flex: 1 0 100%; margin: 1px 0 0; }

/* 태그를 라벨 옆에서 바로 흐르게 (래퍼가 한 덩어리로 줄바꿈되지 않게) */
.hcard-themes .htags { display: contents; }

/* ── 데스크톱(≥768px) — 스크롤 시 상단 바가 화면을 덮지 않게 ──────────
 * 넓은 화면에서는 읽는 공간이 우선: 상단바(.topbar)와 탭·검색 바(.controls)를
 * sticky 에서 풀어 콘텐츠와 함께 위로 흐르게 한다. (모바일은 탭 전환이 늘 손 닿는
 * 곳에 있어야 해서 그대로 sticky 유지) */
@media (min-width: 768px) {
  .topbar,
  .controls {
    position: static;
    top: auto;
  }
}
