/* ============================================================
 * 돈산 국장 캘린더 — 디자인 토큰
 * ============================================================ */
:root {
  --bg: #f3f4f1;
  --surface: #ffffff;
  --surface-2: #f7f8f6;
  --surface-3: #eef0ec;
  --line: #e3e6e1;
  --line-strong: #cdd3cc;
  --text: #0f1512;
  --text-2: #49524d;
  --muted: #89928d;
  --accent: #0d6b4e;
  --accent-2: #13926a;
  --accent-soft: #e3f1ea;
  --silver: #98a1a7;
  --solid: #0f1512;
  --on-solid: #ffffff;
  --up: #e0313a;
  --down: #2563eb;
  --sat: #2563eb;
  --sun: #dc2626;
  --hot: #e11d48;
  --today: #0d6b4e;
  --hl: #ffef6e;
  --hl-text: #17191c;
  --shadow-sm: 0 1px 2px rgba(15, 25, 20, .04), 0 6px 20px -10px rgba(15, 25, 20, .14);
  --shadow: 0 18px 50px -12px rgba(15, 25, 20, .25), 0 4px 12px rgba(15, 25, 20, .06);
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #080b0a; --surface: #101513; --surface-2: #141a17; --surface-3: #1a221e;
    --line: #212a26; --line-strong: #33403a;
    --text: #e8edea; --text-2: #adb7b2; --muted: #75807b;
    --accent: #3fc495; --accent-2: #5ad6a9; --accent-soft: #11261e; --silver: #c3cacf;
    --solid: #e8edea; --on-solid: #0a0e0c;
    --up: #ff5a62; --down: #5b8def; --sat: #6b9cff; --sun: #ff6b6b; --hot: #ff4d73; --today: #3fc495;
    --hl: #e5cf45; --hl-text: #0b0d0c;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    --shadow: 0 20px 50px -10px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #080b0a; --surface: #101513; --surface-2: #141a17; --surface-3: #1a221e;
  --line: #212a26; --line-strong: #33403a;
  --text: #e8edea; --text-2: #adb7b2; --muted: #75807b;
  --accent: #3fc495; --accent-2: #5ad6a9; --accent-soft: #11261e; --silver: #c3cacf;
  --solid: #e8edea; --on-solid: #0a0e0c;
  --up: #ff5a62; --down: #5b8def; --sat: #6b9cff; --sun: #ff6b6b; --hot: #ff4d73; --today: #3fc495;
  --hl: #e5cf45; --hl-text: #0b0d0c;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow: 0 20px 50px -10px rgba(0,0,0,.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.012em;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 0;
  transition: background-color .25s ease, color .25s ease;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
svg { display: block; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
.eyebrow {
  display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
}

/* ── 마스트헤드 (상단 다크 배너) ── */
.masthead {
  position: relative; overflow: hidden; color: #eef3f0;
  background:
    radial-gradient(900px 380px at 88% -30%, rgba(214, 222, 228, .13), transparent 62%),
    radial-gradient(800px 420px at -5% -10%, rgba(19, 146, 106, .38), transparent 60%),
    linear-gradient(180deg, #0b1a15 0%, #08120f 100%);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.masthead::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
}
.mast-inner { position: relative; max-width: 1280px; margin: 0 auto; padding: 22px 24px 26px; }
.mast-top { display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: radial-gradient(40px 32px at 80% 10%, #fff1f1, transparent 70%), linear-gradient(180deg, #ffffff, #eef1f3);
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.06), 0 1px 0 rgba(255,255,255,.35), 0 8px 20px -8px rgba(0,0,0,.55);
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-mark path { stroke: #d81f2c; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.brand-text .eyebrow { color: rgba(214, 221, 226, .72); letter-spacing: .18em; font-size: 10px; }
.brand h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.035em; color: #fff; line-height: 1.25; }
.mast-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.updated {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: rgba(255,255,255,.82); white-space: nowrap;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  font-variant-numeric: tabular-nums;
}
.updated:empty { display: none; }
.updated i { width: 7px; height: 7px; border-radius: 50%; background: #3fe0a5; box-shadow: 0 0 0 0 rgba(63,224,165,.6); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(63,224,165,.55); } 70% { box-shadow: 0 0 0 8px rgba(63,224,165,0); } 100% { box-shadow: 0 0 0 0 rgba(63,224,165,0); } }
.theme-btn {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); color: #fff;
  transition: background .15s, transform .15s;
}
.theme-btn:hover { background: rgba(255,255,255,.12); }
.theme-btn:active { transform: scale(.94); }
.theme-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: block; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: none; }
}

/* 히어로: 최근 주도섹터 타일 */
.hero { margin-top: 22px; }
.hero:empty { display: none; }
.hero-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.hero-head h2 { font-size: 15px; font-weight: 700; color: rgba(255,255,255,.92); order: -1; }
.hero-head .eyebrow { color: rgba(255,255,255,.5); }
.hero-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.hero-tile {
  position: relative; text-align: left; color: #fff; overflow: hidden;
  display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 15px; border-radius: 14px;
  background: linear-gradient(160deg, rgba(255,255,255,.085), rgba(255,255,255,.03));
  border: 1px solid rgba(255,255,255,.1);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.hero-tile::before {
  content: ""; position: absolute; left: 0; top: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--c, var(--silver)), transparent 85%);
}
.hero-tile::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--c, #c3cacf) 30%, transparent), transparent);
  opacity: .55; pointer-events: none;
}
.hero-tile:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.22); background: linear-gradient(160deg, rgba(255,255,255,.11), rgba(255,255,255,.04)); }
.ht-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ht-rank { font-size: 11px; font-weight: 800; letter-spacing: .12em; color: color-mix(in srgb, var(--c, #c3cacf) 70%, #fff); }
.ht-cnt { font-size: 11.5px; font-weight: 600; color: rgba(255,255,255,.55); }
.hero-tile strong { font-size: 21px; font-weight: 800; letter-spacing: -0.035em; line-height: 1.2; }
.ht-reason {
  font-size: 12.5px; color: rgba(255,255,255,.62); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ht-stocks { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.ht-stocks span {
  font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.1);
}
.hero .rate { color: #ff7c82; font-size: 13px; }
.hero .rate.limit { background: #f0444c; color: #fff; font-size: 11.5px; padding: 2px 7px; }
.ev-tile ul { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.ev-tile li { display: flex; gap: 10px; font-size: 13px; line-height: 1.4; color: rgba(255,255,255,.88); min-width: 0; }
.ev-tile li b { flex: 0 0 34px; color: #d3dade; font-weight: 700; font-variant-numeric: tabular-nums; }
.ev-tile li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-tile mark.hl { background: none; color: #fbe38a; padding: 0; font-weight: 700; }

/* ── 메인 탭 (지표 띠 바로 아래 → 스크롤하면 맨 위에 고정) ── */
:root { --nav-h: 70px; }
.masthead { border-bottom: 0; padding-top: env(safe-area-inset-top); }
.masthead::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 56px; pointer-events: none; background: linear-gradient(180deg, rgba(8,18,15,0), #08120f); }
.masthead .mast-inner { z-index: 1; }
.mast-inner { padding-bottom: 16px; }
.topnav {
  position: sticky; top: 0; z-index: 30;
  background: #08120f;
  transition: background-color .2s, box-shadow .2s;
}
.topnav::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(220,228,233,.38), transparent);
  opacity: 0; transition: opacity .2s;
}
.topnav.stuck {
  background: rgba(8, 18, 15, .88);
  -webkit-backdrop-filter: saturate(1.5) blur(16px); backdrop-filter: saturate(1.5) blur(16px);
  box-shadow: 0 10px 28px -14px rgba(0,0,0,.65);
  padding-top: env(safe-area-inset-top);
}
.topnav.stuck::after { opacity: 1; }
.topnav-inner { max-width: 1280px; margin: 0 auto; padding: 4px 24px 10px; }
.topnav.stuck .topnav-inner { padding-top: 10px; }

/* 세그먼트 컨트롤: 홈이 파인 트랙 + 플래티넘(은색) 썸이 미끄러지듯 이동 */
.tabs {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  max-width: 560px; padding: 5px; border-radius: 17px;
  background: linear-gradient(180deg, rgba(0,0,0,.28), rgba(255,255,255,.045));
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.45), 0 1px 0 rgba(255,255,255,.05);
}
.tab-thumb {
  position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc(50% - 5px); border-radius: 12px;
  /* 브러시드 메탈: 가는 결 + 위는 밝고 아래로 은은하게 어두워지는 플래티넘 */
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0) 0 2px, rgba(120,132,140,.035) 2px 3px),
    linear-gradient(180deg, #ffffff 0%, #f0f2f4 36%, #dce1e4 62%, #c9cfd4 100%);
  box-shadow:
    0 12px 26px -14px rgba(220,228,234,.55),
    0 2px 6px rgba(0,0,0,.32),
    inset 0 1px 0 #fff,
    inset 0 -1px 0 rgba(70,82,90,.22);
  transition: transform .34s cubic-bezier(.3,.75,.2,1);
}
.tabs[data-active="events"] .tab-thumb { transform: translateX(100%); }
.tabs button {
  position: relative; z-index: 1; min-width: 0;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 12px; border: 0; border-radius: 12px; background: none;
  font-size: 15.5px; font-weight: 700; letter-spacing: -0.025em; color: rgba(238,243,240,.6);
  -webkit-tap-highlight-color: transparent;
  transition: color .25s, transform .12s;
}
.tabs button span { white-space: nowrap; }
.tabs button svg { width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.tabs button:not([aria-selected="true"]):hover { color: rgba(255,255,255,.92); }
.tabs button[aria-selected="true"] { color: #0e1512; font-weight: 800; }
.tabs button[aria-selected="true"] svg { opacity: 1; }
.tabs button:active { transform: scale(.97); }
.tabs button:focus-visible { outline: 2px solid #e4e9ec; outline-offset: -2px; }
.tab-badge {
  font-style: normal; font-size: 11.5px; font-weight: 800; line-height: 1; padding: 4px 7px; border-radius: 999px;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
  background: rgba(222,229,234,.09); color: #cfd6db; box-shadow: inset 0 0 0 1px rgba(222,229,234,.16);
  transition: background .25s, color .25s, box-shadow .25s;
}
.tab-badge:empty { display: none; }
.tabs button[aria-selected="true"] .tab-badge { background: #121a17; color: #eef2f4; box-shadow: 0 1px 0 rgba(255,255,255,.5); }

/* 최근 주도섹터 (탭 아래, 마스트헤드와 이어지는 어두운 띠) */
.hero-band { background: #08120f; border-bottom: 1px solid rgba(255,255,255,.06); color: #eef3f0; }
.hero-band:has(.hero:empty) { display: none; }
.hero-inner { max-width: 1280px; margin: 0 auto; padding: 8px 24px 26px; }
.hero-inner .hero { margin-top: 0; }

/* ── 컨트롤 바 (월/주·기간) ── */
.controls {
  position: sticky; top: calc(var(--nav-h) + env(safe-area-inset-top)); z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(14px); backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--line);
  scroll-margin-top: calc(var(--nav-h) + env(safe-area-inset-top));
}
.controls-inner { max-width: 1280px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.seg {
  display: inline-flex; padding: 4px; gap: 2px;
  background: var(--surface-3); border: 1px solid var(--line); border-radius: 12px;
}
.seg button {
  border: 0; background: transparent; padding: 7px 16px; border-radius: 9px;
  font-weight: 700; color: var(--text-2); white-space: nowrap; font-size: 13.5px;
  transition: background .15s, color .15s, box-shadow .15s;
}
.seg button:not([aria-pressed="true"]):hover { color: var(--text); }
.seg button { padding: 7px 14px; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 1px var(--line); }

.period { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.period strong { font-size: 18px; font-weight: 800; letter-spacing: -0.03em; min-width: 118px; text-align: center; font-variant-numeric: tabular-nums; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center; color: var(--text-2);
  box-shadow: 0 1px 2px rgba(0,0,0,.04); transition: border-color .15s, color .15s, transform .1s;
}
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { border-color: var(--line-strong); color: var(--text); }
.icon-btn:active { transform: scale(.95); }
.pill-btn {
  height: 34px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 700; font-size: 13px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.pill-btn:hover { border-color: var(--accent); color: var(--accent); }

.wrap { max-width: 1280px; margin: 0 auto; padding: 20px 24px 48px; }

/* ── 툴바 (월간/주간) ── */
.toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.section-desc { color: var(--muted); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.section-desc::before { content: ""; width: 14px; height: 2px; border-radius: 2px; background: var(--silver); }

/* 주도테마: 평일 5열 */
.dow.five, .grid.five, .week.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid.five .cell { border-right: 1px solid var(--line); }
.grid.five .cell:nth-child(5n) { border-right: 0; }
.grid.five .cell { min-height: 118px; }
.dow.five div:nth-child(6), .dow.five div:nth-child(7) { color: inherit; }
.sec .st { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; font-weight: 700; color: var(--text); line-height: 1.45; min-width: 0; }
.sec .sn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec .sr { flex: 0 0 auto; color: var(--up); font-weight: 800; font-size: 11px; font-variant-numeric: tabular-nums; }
.sec { display: flex; flex-direction: column; gap: 1px; }

/* 주간 - 주도섹터 블록 */
.wsec { border-radius: 12px; padding: 11px 11px 10px; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 12%, var(--surface)), color-mix(in srgb, var(--c) 4%, var(--surface))); border: 1px solid color-mix(in srgb, var(--c) 26%, var(--line)); }
.wsec .n { display: block; font-weight: 800; font-size: 14px; color: color-mix(in srgb, var(--c) 75%, var(--text)); }
.wsec .r { display: block; font-size: 11.5px; color: var(--text-2); line-height: 1.4; margin: 2px 0 6px; }
.wsec ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.wsec li { display: flex; justify-content: space-between; gap: 6px; font-size: 12.5px; font-weight: 700; background: var(--surface); border: 1px solid color-mix(in srgb, var(--c) 12%, var(--line)); border-radius: 8px; padding: 5px 8px; }
.wsec li .rate { font-size: 11.5px; flex: 0 0 auto; }
.wsec li > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wsec li .rate.limit { font-size: 10.5px; padding: 0 4px; }

/* 다른 캘린더로 연결 */
.xlink {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 18px;
  box-shadow: var(--shadow-sm); transition: border-color .15s, transform .15s;
}
.xlink:hover { border-color: var(--accent); transform: translateY(-1px); }
.xl-k { font-weight: 800; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.xl-v { flex: 1 1 240px; min-width: 0; display: flex; gap: 6px; flex-wrap: wrap; font-size: 13.5px; color: var(--text-2); }
.xl-v b { color: var(--hot); font-weight: 700; }
.xl-a { font-weight: 700; font-size: 13px; color: var(--accent); white-space: nowrap; }

/* 섹션별 강조색: 일정·재료 탭은 탭 색을 살짝 다르게 */


/* 형광펜 */
mark.hl {
  background: linear-gradient(transparent 12%, var(--hl) 12%, var(--hl) 92%, transparent 92%);
  color: var(--hl-text); padding: 0 2px; border-radius: 2px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.hot mark.hl, mark.hl { font-weight: inherit; }
.ev.hot mark.hl, .witem.hot mark.hl, .day-events li.hot mark.hl, .pop-list li.hot mark.hl { color: #b0001e; }

/* ── 필터 칩 ── */
.filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 13px;
  border: 1px solid color-mix(in srgb, var(--c) 35%, var(--line));
  background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.04);
  transition: opacity .15s, background .15s, border-color .15s;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.chip:hover { border-color: var(--c); }
.chip .cnt { color: var(--c); font-weight: 800; font-variant-numeric: tabular-nums; font-size: 12px; background: color-mix(in srgb, var(--c) 12%, transparent); padding: 0 7px; border-radius: 999px; min-width: 22px; text-align: center; }
.chip.off { background: transparent; border-color: var(--line); color: var(--muted); box-shadow: none; }
.chip.off .cnt { background: transparent; }
.chip.off .label, .chip.off .cnt { text-decoration: line-through; color: var(--muted); }
.chip.off .dot { opacity: .4; }

.switch { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text-2); cursor: pointer; margin-left: auto; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { width: 36px; height: 20px; background: var(--line-strong); border-radius: 999px; position: relative; transition: background .15s; }
.switch-thumb { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .switch-track { background: var(--hot); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── 주도섹터 요약 ── */
.sector-summary { margin-bottom: 14px; }
.sector-summary:empty { display: none; }
.summary-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.summary-row .lbl { font-weight: 700; color: var(--muted); margin-right: 4px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.s-tag {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 10px; border-radius: 999px;
  font-weight: 700; font-size: 13px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--c) 30%, var(--line));
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.s-tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.s-tag b { font-weight: 800; color: var(--c); }

/* ── 캘린더 ── */
.calendar {
  background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) + 2px);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.calendar.enter > * { animation: rise .35s cubic-bezier(.2,.7,.2,1) both; }
.calendar.enter > *:nth-child(2) { animation-delay: .04s; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.dow, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.dow { background: var(--surface-2); border-bottom: 1px solid var(--line); }
.dow div { padding: 11px 14px; font-weight: 700; font-size: 11.5px; color: var(--muted); letter-spacing: .08em; }
.dow div:nth-child(6) { color: var(--sat); }
.dow div:nth-child(7) { color: var(--sun); }

.cell {
  min-height: 132px; padding: 8px 8px 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 3px; min-width: 0; cursor: pointer; position: relative;
  background: var(--surface); text-align: left; border-top: 0; border-left: 0; border-radius: 0;
  transition: background .12s;
}
.grid:not(.five) .cell:nth-child(7n) { border-right: 0; }
.cell:hover { background: var(--surface-2); }
.cell.out { background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, color-mix(in srgb, var(--surface-2) 60%, var(--surface)) 6px 12px); }
.cell.out > * { opacity: .45; }
.cell.selected { box-shadow: inset 0 0 0 2px var(--accent); background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); z-index: 1; }
.cell .dnum {
  font-weight: 700; font-size: 13.5px; color: var(--text-2); width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 50%; margin: -2px 0 2px -2px; font-variant-numeric: tabular-nums;
}
.cell.sat .dnum { color: var(--sat); }
.cell.sun .dnum { color: var(--sun); }
.cell.today .dnum { background: var(--today); color: var(--on-solid); box-shadow: 0 3px 10px -3px color-mix(in srgb, var(--today) 70%, transparent); }
:root:not([data-theme="dark"]) .cell.today .dnum { color: #fff; }

.ev {
  display: flex; align-items: center; gap: 6px; font-size: 12.5px; line-height: 1.35;
  white-space: nowrap; overflow: hidden; min-width: 0; color: var(--text);
}
.ev .dot { flex: 0 0 auto; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.ev .t { overflow: hidden; text-overflow: ellipsis; }
.ev.hot .t { color: var(--hot); font-weight: 700; }
.more { font-size: 12px; font-style: italic; color: var(--text-2); font-weight: 600; padding: 2px 0 0 12px; border: 0; background: none; text-align: left; }
.more:hover { color: var(--accent); text-decoration: underline; }
.mdots { display: none; }

/* 주도섹터 셀 */
.sec {
  border-radius: 9px; padding: 6px 8px; min-width: 0;
  background: linear-gradient(150deg, color-mix(in srgb, var(--c) 13%, var(--surface)), color-mix(in srgb, var(--c) 5%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--c) 20%, transparent);
  box-shadow: inset 3px 0 0 var(--c);
}
.sec .n { font-weight: 800; font-size: 12.5px; color: color-mix(in srgb, var(--c) 75%, var(--text)); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec .s { font-size: 11.5px; color: var(--text-2); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell .evcount { margin-top: auto; font-size: 11px; color: var(--muted); font-weight: 600; }

/* 주간 보기 */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.wcol { border-right: 1px solid var(--line); min-height: 420px; display: flex; flex-direction: column; min-width: 0; }
.wcol:last-child { border-right: 0; }
.whead { padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); display: flex; align-items: baseline; gap: 7px; }
.whead b { font-size: 22px; font-weight: 800; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.whead span { color: var(--text-2); font-weight: 600; font-size: 13px; white-space: nowrap; }
.wcol.sat .whead b, .wcol.sat .whead span { color: var(--sat); }
.wcol.sun .whead b, .wcol.sun .whead span { color: var(--sun); }
.wcol.today .whead { background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }
.wcol.today .whead b { color: var(--accent); }
.wbody { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.wbody .sec { margin-bottom: 4px; }
.witem {
  border: 1px solid var(--line); box-shadow: inset 3px 0 0 var(--c); border-radius: 10px;
  padding: 8px 10px 8px 12px; font-size: 12.5px; line-height: 1.4; background: var(--surface);
}
.witem.hot { border-color: color-mix(in srgb, var(--hot) 35%, var(--line)); box-shadow: inset 3px 0 0 var(--hot); background: color-mix(in srgb, var(--hot) 5%, var(--surface)); }
.witem.hot .t { color: var(--hot); font-weight: 700; }
.witem .c { display: block; font-size: 11px; color: var(--c); font-weight: 700; margin-bottom: 1px; }
.wempty { color: var(--muted); font-size: 12.5px; padding: 6px 2px; }

/* ── 상세 영역 ── */
.detail { margin-top: 30px; display: flex; flex-direction: column; gap: 16px; }
.detail:empty { display: none; }
.d-head { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; padding-bottom: 4px; }
.d-head .eyebrow { color: var(--accent); margin-bottom: 2px; }
.d-head h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.2; }
.d-head .sub { color: var(--muted); font-weight: 600; font-size: 15px; letter-spacing: -0.02em; margin-left: 4px; }
.d-nav { margin-left: auto; display: flex; gap: 6px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-sm); }
.card h3 { font-size: 16px; font-weight: 800; letter-spacing: -0.025em; margin-bottom: 14px; display: flex; align-items: center; gap: 9px; }
.card h3::before { content: ""; width: 4px; height: 15px; border-radius: 3px; background: linear-gradient(var(--accent-2), var(--accent)); }
.card h3 .badge { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); padding: 1px 8px; border-radius: 999px; }

.leads { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.lead {
  border-radius: var(--radius); padding: 20px; position: relative; overflow: hidden;
  background:
    radial-gradient(420px 200px at 100% 0%, color-mix(in srgb, var(--c) 18%, transparent), transparent 70%),
    var(--surface);
  border: 1px solid color-mix(in srgb, var(--c) 28%, var(--line));
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease;
}
.lead::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 10%, transparent)); }
.lead:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.lead .rank { display: flex; align-items: baseline; gap: 8px; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .1em; }
.lead .rank b { font-size: 26px; font-weight: 800; color: var(--c); letter-spacing: -0.04em; line-height: 1; }
.lead h4 { margin: 8px 0 4px; font-size: 24px; font-weight: 800; letter-spacing: -0.04em; }
.lead p { color: var(--text-2); font-size: 13px; margin-bottom: 12px; }
.lead ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lead li {
  display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 11px; padding: 10px 13px;
}
.lead li .nm { font-weight: 800; font-size: 15px; flex: 1; min-width: 0; }
.lead li .amt { color: var(--text-2); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lead li .na { color: var(--muted); font-size: 12px; }

.comment {
  position: relative; padding: 4px 0 4px 34px; white-space: pre-line;
  color: var(--text); font-size: 15px; line-height: 1.65; font-weight: 500;
}
.comment::before { content: "\201C"; position: absolute; left: 0; top: -10px; font-size: 48px; font-weight: 800; color: var(--silver); line-height: 1; font-family: Georgia, serif; }
.comment b { color: var(--text); }

.rate { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--up); white-space: nowrap; }
.rate.neg { color: var(--down); }
.rate.limit { background: linear-gradient(135deg, var(--up), color-mix(in srgb, var(--up) 75%, #000)); color: #fff; padding: 1px 7px; border-radius: 6px; font-size: 12px; }

.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.theme { border: 1px solid var(--line); border-radius: 13px; overflow: hidden; display: flex; flex-direction: column; background: var(--surface); transition: border-color .15s; }
.theme:hover { border-color: var(--line-strong); }
.theme.is-lead { border-color: color-mix(in srgb, var(--c) 55%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 35%, transparent); }
.theme-h { padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.theme.is-lead .theme-h { background: color-mix(in srgb, var(--c) 12%, var(--surface)); }
.theme-h strong { font-size: 14px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.theme-h .lead-flag { font-size: 10.5px; font-weight: 800; color: #fff; background: var(--c); padding: 1px 7px; border-radius: 999px; }
.theme-h p { font-size: 12px; color: var(--text-2); margin-top: 3px; line-height: 1.4; }
.theme ul { list-style: none; margin: 0; padding: 6px 12px 10px; }
.theme li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.theme li:last-child { border-bottom: 0; }
.theme li.lead-stock .nm { font-weight: 800; }
.theme li.lead-stock .nm::after { content: "주도"; margin-left: 6px; font-size: 10px; font-weight: 800; color: var(--c); border: 1px solid var(--c); padding: 0 5px; border-radius: 999px; vertical-align: 1px; }

.tbl-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 560px; }
th { text-align: left; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .06em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.rk { color: var(--muted); font-weight: 700; width: 32px; }
td.nm { font-weight: 700; white-space: nowrap; }
td.nm .tag { font-size: 10.5px; font-weight: 800; padding: 1px 6px; border-radius: 999px; margin-left: 6px; color: #fff; background: var(--c, var(--accent)); vertical-align: 1px; }
td.rs { color: var(--text-2); }
td.rs mark { background: none; color: var(--up); font-weight: 600; }
.amt-big { font-weight: 800; color: var(--text); }
.amt-small { color: var(--muted); }
.tbl-note { font-size: 12px; color: var(--muted); margin-top: 10px; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.day-events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.day-events li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.day-events li .dot { margin-top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: 0 0 auto; }
.day-events li.hot .t { color: var(--hot); font-weight: 700; }
.day-events li .c { font-size: 11px; color: var(--c); font-weight: 700; margin-left: 4px; white-space: nowrap; }

.empty {
  text-align: center; padding: 36px 16px; color: var(--muted);
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface);
}
.empty strong { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 4px; }

/* ── 팝오버 ── */
.popover { position: fixed; inset: 0; z-index: 50; }
.popover-card {
  position: absolute; width: 320px; max-height: 70vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  padding: 14px 16px; animation: pop .14s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: none; } }
.popover-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.popover-head strong { font-size: 14px; }
.popover-head .icon-btn { width: 28px; height: 28px; }
.popover-head .icon-btn svg { width: 13px; height: 13px; }
.pop-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.pop-list li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; line-height: 1.4; }
.pop-list li .dot { margin-top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: 0 0 auto; }
.pop-list li.hot .t { color: var(--hot); font-weight: 700; }

.foot { max-width: 1280px; margin: 8px auto 0; padding: 22px 24px 44px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; border-top: 1px solid var(--line); }
.foot-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--text); font-size: 13px; margin-bottom: 4px; letter-spacing: -0.02em; }
.brand-mark.sm { width: 22px; height: 22px; border-radius: 7px; box-shadow: inset 0 0 0 1px var(--line), 0 1px 2px rgba(0,0,0,.06); }
.brand-mark.sm svg { width: 14px; height: 14px; }
.detail > * { animation: rise .3s cubic-bezier(.2,.7,.2,1) both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── 반응형 ── */
@media (max-width: 900px) {
  .two { grid-template-columns: 1fr; }
  .week, .week.five { grid-template-columns: 1fr; }
  .wcol { border-right: 0; border-bottom: 1px solid var(--line); min-height: 0; }
  .wcol:last-child { border-bottom: 0; }
  .wcol.empty-day .wbody { display: none; }
}
@media (max-width: 720px) {
  .mast-inner { padding: 16px 16px 18px; }
  .brand { gap: 10px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .brand-mark svg { width: 20px; height: 20px; }
  .brand-text .eyebrow { font-size: 8.5px; letter-spacing: .14em; }
  .mast-tools { gap: 6px; }
  .u-long { display: none; }
  .brand h1, .brand-text .eyebrow { white-space: nowrap; }
  .brand-text { min-width: 0; }
  .brand-text .eyebrow { overflow: hidden; text-overflow: ellipsis; }
  .updated { height: 30px; padding: 0 10px; font-size: 11px; gap: 6px; }
  .theme-btn { width: 32px; height: 32px; }
  .hero { margin-top: 16px; }
  .hero-head { margin-bottom: 10px; }
  .hero-head h2 { font-size: 14px; }
  .hero-head .eyebrow { font-size: 9.5px; }
  .hero-tiles {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px;
    margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none;
  }
  .hero-tiles::-webkit-scrollbar { display: none; }
  .hero-tile { flex: 0 0 78%; scroll-snap-align: start; padding: 14px 15px 13px; }
  .hero-tile:hover { transform: none; }
  .hero-tile strong { font-size: 19px; }

  .controls { position: static; }
  .controls-inner { padding: 10px 16px; gap: 8px; }
  :root { --nav-h: 62px; }
  .mast-inner { padding-bottom: 14px; }
  .topnav-inner { padding: 2px 12px 8px; }
  .topnav.stuck .topnav-inner { padding-top: 8px; }
  .tabs { max-width: none; padding: 4px; border-radius: 15px; }
  .tab-thumb { top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 11px; }
  .tabs button { height: 44px; padding: 0 6px; gap: 6px; font-size: 15px; }
  .tabs button svg { width: 15px; height: 15px; }
  .hero-inner { padding: 6px 16px 18px; }
  .hero-inner .hero { margin-top: 0; }
}
@media (max-width: 360px) { .tabs button svg { display: none; } }
@media (max-width: 430px) {
  .tabs button { font-size: 14.5px; gap: 5px; padding: 0 4px; }
  .tab-badge { font-size: 10.5px; padding: 3px 6px; }
  .seg button { padding: 6px 12px; font-size: 12.5px; }
  .period { margin-left: auto; gap: 4px; }
  .period strong { font-size: 15px; min-width: 92px; }
  .icon-btn { width: 30px; height: 30px; }
  .pill-btn { height: 30px; padding: 0 10px; font-size: 12.5px; }
  .wrap { padding: 14px 16px 32px; }
  .switch { margin-left: 0; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; width: calc(100% + 32px); }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; }

  .dow div { padding: 8px 0; text-align: center; font-size: 12px; }
  .cell { min-height: 64px; padding: 6px 2px; align-items: center; gap: 4px; }
  .cell .dnum { margin: 0; font-size: 13px; }
  .cell .ev, .cell .more, .cell .evcount { display: none; }
  .cell .mdots { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; max-width: 100%; }
  .cell .mdots i { width: 5px; height: 5px; border-radius: 50%; background: var(--c); }
  .cell .sec { padding: 3px 4px 3px 6px; box-shadow: inset 2px 0 0 var(--c); border-radius: 6px; width: 100%; }
  .cell .sec .n { font-size: 10.5px; text-align: center; }
  .cell .sec .s { display: none; }
  .grid.five .cell { min-height: 92px; align-items: stretch; padding: 6px 3px; }
  .grid.five .cell .dnum { align-self: center; }
  .cell .sec .n { text-align: left; font-size: 10.5px; }
  .cell .sec .st { font-size: 10px; line-height: 1.3; font-weight: 600; }
  .cell .sec .sn { white-space: normal; word-break: keep-all; overflow-wrap: anywhere; }
  .cell .sec .sr { display: none; }

  .card { padding: 16px; }
  .tbl-wrap { margin: 0; padding: 0; overflow: visible; }
  /* 모바일: 표를 카드형 리스트로 */
  table { min-width: 0; }
  thead { display: none; }
  table, tbody { display: block; }
  tr {
    display: grid; grid-template-columns: auto 1fr auto auto; column-gap: 10px; align-items: center;
    padding: 10px 0; border-bottom: 1px solid var(--line);
  }
  tr:last-child { border-bottom: 0; }
  td { padding: 0; border: 0; }
  td.rk { width: auto; min-width: 16px; }
  td.nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  td.rs { grid-column: 1 / -1; font-size: 12.5px; margin-top: 4px; line-height: 1.45; }
  tr:not(:has(.rk)) { grid-template-columns: 1fr auto auto; }
  tr:has(.rk) td.rs { padding-left: 26px; }

  .themes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .theme-h { padding: 8px 10px; }
  .theme-h strong { font-size: 13px; flex-wrap: wrap; }
  .theme-h p { font-size: 11px; }
  .theme ul { padding: 4px 10px 8px; }
  .theme li { font-size: 12px; gap: 4px; }
  .theme li .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .theme li.lead-stock .nm::after { display: none; }
  .theme li.lead-stock .nm { color: var(--c); }
  .theme .rate.limit { font-size: 11px; padding: 0 4px; }
  .brand h1 { font-size: 18px; }
  .period strong { font-size: 15px; min-width: 0; }
  .brand { flex: 0 1 auto; min-width: 0; }
  .period { gap: 3px; }
  .period .icon-btn { width: 28px; height: 28px; }
  .period .pill-btn { padding: 0 8px; height: 28px; }
  .d-head h2 { font-size: 21px; }
  .d-head .sub { display: block; margin: 2px 0 0; font-size: 13px; }
  .lead { padding: 16px; }
  .lead h4 { font-size: 20px; }
  .lead .rank b { font-size: 22px; }
  .card { padding: 16px; }
  .comment { font-size: 14px; padding-left: 28px; }
  .comment::before { font-size: 40px; }
  .dow div { letter-spacing: 0; }
  .foot { padding: 18px 16px 36px; }

  .popover { background: rgba(0,0,0,.35); }
  .popover-card { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100%; max-height: 75vh; border-radius: 18px 18px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); animation: sheet .2s ease-out; }
  @keyframes sheet { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
}

/* ============================================================
 * 종목 링크 · 공유 · 설치 · 모바일 첫 화면
 * ============================================================ */
a.stk { color: inherit; text-decoration: none; cursor: pointer; }
a.stk:hover { text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: 3px; }
.lead li a.stk::after, td.nm a.stk::after {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-left: 5px; vertical-align: 0; opacity: .35;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 18l6-6 4 4 6-8'/%3E%3Cpath d='M15 8h5v5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 18l6-6 4 4 6-8'/%3E%3Cpath d='M15 8h5v5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.wsec li a.stk { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ht-stocks a.stk {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; color: #fff;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.1); position: relative; z-index: 1;
}
.ht-stocks a.stk:hover { background: rgba(255,255,255,.16); text-decoration: none; }
.ht-stocks a.stk em { font-style: normal; font-size: 11px; font-weight: 800; color: #ff8a8f; }
.hero-tile { cursor: pointer; }
.hero-tile:focus-visible { outline: 2px solid var(--silver); outline-offset: 2px; }

.d-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.d-tools .d-nav { margin-left: 0; }
.share-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; }
.share-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.install-btn[hidden] { display: none; }
.pop-list li.step { align-items: flex-start; gap: 10px; }
.pop-list li.step .no { flex: 0 0 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--accent-soft); color: var(--accent); }
.pop-list li.step .t { padding-top: 1px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: #0f1512; color: #fff; font-size: 13.5px; font-weight: 700; padding: 11px 18px; border-radius: 999px;
  box-shadow: 0 10px 30px -8px rgba(0,0,0,.45); transition: opacity .2s, transform .2s; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 모바일 첫 화면: 최근 주도섹터를 가로 스크롤 대신 세로로 한눈에 */
@media (max-width: 720px) {
  .hero-tiles { display: flex; flex-direction: column; overflow: visible; margin: 0; padding: 0; gap: 8px; scroll-snap-type: none; }
  .hero-tile { flex: none; padding: 12px 14px 12px; gap: 4px; }
  .hero-tile .ht-top { display: none; }
  .hero-tile strong { font-size: 18px; }
  .ht-reason { font-size: 12px; -webkit-line-clamp: 1; }
  .ht-stocks { margin-top: 3px; }
  .ht-stocks a.stk { font-size: 13px; padding: 5px 10px; }
  .ev-tile { padding: 12px 14px; }
  .ev-tile .ht-top { display: flex; }
  .ev-tile li { font-size: 12.5px; }
  .ev-tile li:nth-child(n+4) { display: none; }
  .d-tools { width: 100%; }
  .d-tools .share-btn { margin-right: auto; height: 32px; padding: 0 12px; font-size: 12.5px; }
}
.detail { scroll-margin-top: calc(var(--nav-h) + env(safe-area-inset-top) + 76px); }
@media (max-width: 720px) { .detail { scroll-margin-top: calc(var(--nav-h) + env(safe-area-inset-top) + 8px); } }

/* 종목명 말줄임(…) 없이 줄바꿈 — 글씨 크게 설정한 폰에서도 이름이 다 보이게 */
.wsec li a.stk, .wsec li > span:first-child { white-space: normal; overflow: visible; text-overflow: clip; word-break: keep-all; overflow-wrap: anywhere; line-height: 1.35; }
.wsec li { align-items: center; }
.ht-stocks a.stk { white-space: normal; word-break: keep-all; overflow-wrap: anywhere; }
@media (max-width: 720px) {
  /* 이름+등락률이 한 줄에 안 들어가면 등락률만 아랫줄(오른쪽)로 내림 */
  .theme li { flex-wrap: wrap; align-items: center; column-gap: 6px; row-gap: 1px; }
  .theme li .rate { margin-left: auto; }
  .theme li .nm { flex: 0 1 auto; min-width: 0; white-space: normal; overflow: visible; text-overflow: clip; word-break: keep-all; overflow-wrap: anywhere; line-height: 1.35; }
  .theme li .rate { flex: 0 0 auto; }
  .theme .rate.limit { font-size: 10.5px; padding: 1px 4px; letter-spacing: -0.02em; }
  td.nm { white-space: normal; overflow: visible; text-overflow: clip; word-break: keep-all; overflow-wrap: anywhere; line-height: 1.35; }
  .lead li .nm { word-break: keep-all; overflow-wrap: anywhere; line-height: 1.35; }
}

/* ── 시장 지표 띠 (마스트헤드 안, 항상 어두운 배경) ── */
.market { margin-top: 18px; --mk-up: #ff6b72; --mk-down: #6ea2ff; }
.mk-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.mk-head .eyebrow { color: rgba(255,255,255,.5); }
.mk-time { font-size: 11.5px; color: rgba(255,255,255,.55); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mk-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
@media (min-width: 1100px) { .mk-row { grid-template-columns: repeat(8, 1fr); } }
.mk-item {
  position: relative; display: flex; flex-direction: column; gap: 1px; min-width: 0;
  padding: 9px 11px 8px; border-radius: 12px; text-decoration: none; color: #fff;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.09);
  transition: background .15s, border-color .15s;
}
.mk-item:hover { background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.18); }
.mk-name { display: flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: rgba(255,255,255,.62); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-name i { font-style: normal; font-size: 9.5px; font-weight: 700; padding: 0 5px; border-radius: 4px; color: rgba(255,255,255,.55); background: rgba(255,255,255,.08); }
.mk-price { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.3; }
.mk-chg { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: rgba(255,255,255,.6); }
.mk-chg small { font-size: 10.5px; font-weight: 600; opacity: .8; }
.mk-item.up .mk-chg { color: var(--mk-up); }
.mk-item.down .mk-chg { color: var(--mk-down); }
.mk-spark { position: absolute; right: 9px; top: 11px; width: 28px; height: 15px; overflow: visible; }
.mk-spark polyline { fill: none; stroke: rgba(255,255,255,.45); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.mk-item.up .mk-spark polyline { stroke: var(--mk-up); }
.mk-item.down .mk-spark polyline { stroke: var(--mk-down); }
.mk-base { stroke: rgba(255,255,255,.2); stroke-width: 1; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; }
.mk-item:has(.mk-spark) .mk-name { padding-right: 32px; }
.mk-item:has(.mk-name i) .mk-spark { display: none; }
.mk-item:has(.mk-name i) .mk-name { padding-right: 0; }
@media (max-width: 720px) {
  .market { margin-top: 14px; }
  .mk-row {
    display: flex; overflow-x: auto; scroll-snap-type: x proximity; gap: 7px;
    margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none;
  }
  .mk-row::-webkit-scrollbar { display: none; }
  .mk-item { flex: 0 0 114px; scroll-snap-align: start; padding: 8px 10px 7px; }
  .mk-price { font-size: 15px; }
  .mk-time { font-size: 10.5px; }
}

/* ============================================================
 * 장전뉴스 (세 번째 탭)
 * ============================================================ */
/* 탭 3개: 썸 너비 1/3, 위치 0 / 100% / 200% */
.tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 720px; }
.tab-thumb { width: calc((100% - 10px) / 3); }
.tabs[data-active="events"] .tab-thumb { transform: translateX(100%); }
.tabs[data-active="news"] .tab-thumb { transform: translateX(200%); }
@media (max-width: 720px) {
  .tab-thumb { width: calc((100% - 8px) / 3); }
  .tabs button { flex-direction: column; gap: 2px; height: 52px; font-size: 14px; }
  .tabs button svg { display: none; }
  .tab-badge { font-size: 10px; padding: 2px 6px; }
}
@media (max-width: 430px) {
  .tabs button { font-size: 13.5px; gap: 2px; padding: 0 2px; }
  .tab-badge { font-size: 10px; padding: 2px 6px; }
}

/* 첫 화면: 최신 장전뉴스 한 줄 */
.newsbar { margin-top: 18px; }
.newsbar[hidden] { display: none; }
.hero-inner .newsbar + .hero { margin-top: 16px; }
.nb {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left; color: #fff;
  padding: 11px 14px; border-radius: 13px; cursor: pointer;
  background: linear-gradient(100deg, rgba(251,227,138,.12), rgba(255,255,255,.035) 55%);
  border: 1px solid rgba(251,227,138,.22);
  transition: border-color .2s, background .2s;
}
.nb:hover { border-color: rgba(251,227,138,.45); }
.nb-k { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; color: #fbe38a; white-space: nowrap; }
.nb-k b { color: #fff; font-weight: 800; }
.nb-k svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.nb-list { flex: 1; min-width: 0; display: flex; gap: 14px; overflow: hidden; }
.nb-i { min-width: 0; flex: 0 1 auto; font-size: 13px; color: rgba(255,255,255,.86); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-i em { font-style: normal; font-weight: 800; font-size: 11.5px; margin-right: 6px; padding: 1px 7px; border-radius: 999px; color: #fff; background: color-mix(in srgb, var(--c) 55%, transparent); }
.nb-more { flex: 0 0 auto; font-size: 12px; font-weight: 700; color: rgba(255,255,255,.6); white-space: nowrap; }
@media (max-width: 900px) {
  .nb { flex-wrap: wrap; row-gap: 7px; }
  .nb-list { flex: 1 1 100%; order: 3; flex-direction: column; gap: 5px; }
  .nb-i { flex: none; }
  .nb-more { margin-left: auto; }
}
@media (max-width: 720px) { .newsbar { margin-top: 2px; } .hero-inner .newsbar + .hero { margin-top: 14px; } }

/* 달력 칸: 테마 이름만 */
.cell .nsec .n { white-space: normal; word-break: keep-all; overflow-wrap: anywhere; line-height: 1.3; }
.cell .nmore { font-size: 11px; font-weight: 700; color: var(--muted); }

/* 상세: 테마 바로가기 + 테마별 묶음 */
.pm-jump { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 6px; }
.pm-jump a {
  font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; text-decoration: none; white-space: nowrap;
  color: color-mix(in srgb, var(--c) 70%, var(--text)); background: color-mix(in srgb, var(--c) 9%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c) 26%, var(--line));
}
.pm-jump a b { font-weight: 800; margin-left: 2px; opacity: .75; }
.pm-jump a:hover { border-color: var(--c); }
.pm-group { margin-top: 18px; scroll-margin-top: calc(var(--nav-h) + 80px); }
.pm-group h4 {
  display: flex; align-items: center; gap: 8px; padding-bottom: 6px; margin: 0;
  font-size: 16px; font-weight: 800; letter-spacing: -0.03em; color: color-mix(in srgb, var(--c) 72%, var(--text));
  border-bottom: 2px solid color-mix(in srgb, var(--c) 45%, transparent);
}
.pm-group h4::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--c); }
.pm-group h4 .cnt { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 0; }
.pm-note { margin-top: 14px; font-size: 12px; color: var(--muted); }
.cell .nsec .n b { font-weight: 700; opacity: .65; }

/* 상세: 뉴스 모음 (제목 + 출처 + 원문 링크) */
.pm-news { list-style: none; margin: 0; padding: 0; }
.pm-news li { border-bottom: 1px solid var(--line); }
.pm-news li:last-child { border-bottom: 0; }
@media (min-width: 901px) { .pm-news { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; } .pm-news li:nth-last-child(2):nth-child(odd) { border-bottom: 0; } }
/* 1줄: 기사 제목 / 2줄: 출처 · 발행날짜 · 원문 보기 */
.pm-news a { display: flex; flex-direction: column; gap: 5px; padding: 11px 4px; color: inherit; text-decoration: none; }
.pm-news .t { font-size: 14.5px; font-weight: 600; line-height: 1.45; color: var(--text); word-break: keep-all; overflow-wrap: anywhere; }
.pm-news a:hover .t { color: var(--accent); }
.pm-news .m { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; }
.pm-news .src { font-weight: 600; color: var(--muted); }
.pm-news .dt { display: inline-flex; align-items: baseline; gap: 9px; font-variant-numeric: tabular-nums; }
.pm-news .dt b { font-weight: 800; color: var(--text); }
.pm-news .dt i { font-style: normal; font-weight: 500; color: var(--muted); }
.pm-news .src + .dt::before { content: "·"; margin-right: 10px; color: var(--muted); font-weight: 400; }
.pm-news .go {
  display: inline-flex; align-items: center; gap: 1px; white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--muted);
}
.pm-news .src + .dt + .go::before, .pm-news .src + .go::before { content: "·"; margin-right: 10px; color: var(--muted); font-weight: 400; }
.pm-news a:hover .go { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.pm-news .go svg { width: 11px; height: 11px; opacity: .8; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 720px) {
  .pm-news .t { font-size: 15px; }
  .pm-group { scroll-margin-top: calc(var(--nav-h) + 12px); }
}
.empty .pill-btn { margin-top: 10px; display: inline-flex; align-items: center; }
