/* ============================================================
   Fonts
   ============================================================ */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable.css');
@import url('https://cdn.jsdelivr.net/npm/spoqa-han-sans@2.1.3/css/SpoqaHanSansNeo-subset.css');

/* ============================================================
   Theme Variables — Dark (default)
   ============================================================ */
:root {
  --bg-body:          #0D1117;
  --bg-card:          #161B22;
  --bg-hover:         #1C2333;
  --bg-th:            #0D1117;
  --border:           #1E2736;
  --border-row:       #1A2030;
  --text:             #CDD5DF;
  --text-h1:          #F0F6FC;
  --text-h2:          #8B949E;
  --text-muted:       #4D6075;
  --text-faint:       #3D4F66;
  --text-nav:         #8B949E;
  --text-nav-hover:   #F0F6FC;
  --accent:           #60A5FA;
  --accent-2:         #3B82F6;
  --accent-3:         #1D4ED8;
  --accent-text:      #EFF6FF;
  --link-hover:       #93C5FD;
  --hit:              #3FB950;
  --miss:             #F85149;
  --na:               #3D4F66;
  --up:               #F85149;
  --down:             #60A5FA;
  --skel-1:           #161B22;
  --skel-2:           #1C2333;
  --chart-grid:       #1E2736;
  --chart-tick:       #4D6075;
  --chart-legend:     #8B949E;
  --search-bg:        #161B22;
  --search-focus-bg:  #1C2333;
  --rh-green:         #60A5FA;       /* 기존 accent 색으로 통일 */
  --rh-green-dim:     rgba(96,165,250,0.12);
  --rh-green-glow:    rgba(96,165,250,0.08);
}

/* ============================================================
   Theme Variables — Light
   ============================================================ */
[data-theme="light"] {
  --bg-body:          #F6F8FA;
  --bg-card:          #FFFFFF;
  --bg-hover:         #F3F4F6;
  --bg-th:            #F6F8FA;
  --border:           #D0D7DE;
  --border-row:       #EAEEF2;
  --text:             #1F2328;
  --text-h1:          #1F2328;
  --text-h2:          #656D76;
  --text-muted:       #656D76;
  --text-faint:       #8C959F;
  --text-nav:         #24292F;
  --text-nav-hover:   #000000;
  --accent:           #0969DA;
  --accent-2:         #0550AE;
  --accent-3:         #0550AE;
  --accent-text:      #FFFFFF;
  --link-hover:       #0550AE;
  --hit:              #1A7F37;
  --miss:             #CF222E;
  --na:               #8C959F;
  --up:               #CF222E;
  --down:             #0969DA;
  --skel-1:           #D8DEE4;
  --skel-2:           #EEF0F3;
  --chart-grid:       #D0D7DE;
  --chart-tick:       #656D76;
  --chart-legend:     #1F2328;
  --search-bg:        #FFFFFF;
  --search-focus-bg:  #F6F8FA;
}

/* ============================================================
   Reset & Base
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Pretendard Variable', 'Pretendard', 'Spoqa Han Sans Neo', -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg-body);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   Navbar
   ============================================================ */
.navbar {
    background: var(--bg-body);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    height: 54px;
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0 max(2rem, calc((100% - 1360px) / 2));
}

.navbar .logo {
    color: var(--accent);
    font-size: 1.05rem;
    font-weight: 700;
    text-decoration: none;
    margin-right: 2rem;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    align-items: center;
}
.nav-links > a {
    color: var(--text-nav);
    text-decoration: none;
    margin-right: 1.4rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s;
}
.nav-links > a:hover { color: var(--text-nav-hover); }

.nav-group {
    display: inline-flex;
    align-items: center;
    margin-right: 1.4rem;
}
.nav-main {
    color: var(--text-nav);
    font-size: 0.875rem;
    font-weight: 500;
    margin-right: 0.35rem;
}
.nav-main.nav-active { color: var(--accent); font-weight: 700; }

/* Compact market-switcher inside navbar — inline pill */
.navbar .nav-ms {
    display: inline-flex;
    gap: 1px;
    padding: 2px;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    backdrop-filter: none;
    box-shadow: none;
}
.navbar .nav-ms .market-tab {
    padding: 0.1rem 0.4rem;
    font-size: 0.68rem;
    border-radius: 4px;
    margin-right: 0;
    font-weight: 500;
}
[data-theme="light"] .navbar .nav-ms {
    background: transparent;
    border: 1px solid var(--border);
    box-shadow: none;
}

.nav-group-label {
    color: var(--text-faint);
    font-size: 0.72rem;
    margin-right: 0.5rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.nav-separator { color: var(--border); margin-right: 1.4rem; }

/* ============================================================
   Container & Typography
   ============================================================ */
.container { max-width: 1360px; margin: 2rem auto; padding: 0 1.5rem; }

h1 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-h1);
}

h2 {
    margin: 2rem 0 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-h2);
    letter-spacing: -0.01em;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin: -0.5rem 0 1.25rem;
}
.ranking-search-wrap {
    margin-bottom: 1rem;
}
.ranking-search-wrap .search-box {
    max-width: 320px;
    width: 100%;
}

/* ============================================================
   Tabs
   ============================================================ */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: 0.65rem 1.2rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-family: inherit;
    transition: color 0.15s;
}
.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent-2);
    font-weight: 600;
}
.tab:hover { color: var(--text); }

/* Glass-style period tabs (13F detail page) */
.glass-tabs {
    border-bottom: none;
    gap: 0.35rem;
    padding: 0.4rem;
    background: rgba(22,27,34,0.58);
    backdrop-filter: blur(14px) saturate(150%);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 14px;
    display: inline-flex;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 2px 12px rgba(0,0,0,0.25);
    margin-bottom: 1.5rem;
}
.glass-tabs .tab {
    border-radius: 9px;
    border-bottom: none;
    margin-bottom: 0;
    padding: 0.45rem 1.1rem;
    background: transparent;
    transition: background 0.18s, color 0.18s;
}
.glass-tabs .tab.active {
    background: rgba(96,165,250,0.18);
    color: var(--accent);
    font-weight: 600;
    border-bottom: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.10), 0 2px 8px rgba(96,165,250,0.12);
}
.glass-tabs .tab:hover:not(.active) {
    background: rgba(255,255,255,0.05);
    color: var(--text);
}
[data-theme="light"] .glass-tabs {
    background: rgba(255,255,255,0.65);
    border: 1px solid rgba(255,255,255,0.75);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 2px 10px rgba(0,0,0,0.06);
}
[data-theme="light"] .glass-tabs .tab.active {
    background: rgba(9,105,218,0.12);
}

/* Generic table card */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 2rem;
}
.table-card table {
    border-radius: 0;
    border: none;
    margin-bottom: 0;
}

/* Holdings card (13F detail) */
.holdings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 2rem;
}
.holdings-card-header {
    padding: 0.85rem 1rem 0.65rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.holdings-card table {
    border-radius: 0;
    border: none;
}
.view-more-btn {
    display: block;
    width: calc(100% - 2rem);
    margin: 0.75rem 1rem;
    padding: 0.55rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
    text-align: center;
}
.view-more-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

/* ============================================================
   Table
   ============================================================ */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}

th {
    background: var(--bg-th);
    padding: 0.7rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border-row);
    font-size: 0.875rem;
    color: var(--text);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

td a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}
td a:hover { color: var(--link-hover); text-decoration: underline; }

/* ============================================================
   Search Box
   ============================================================ */
.search-box {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    background: var(--search-bg);
    color: var(--text-h1);
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s;
}
.search-box::placeholder { color: var(--text-faint); }
.search-box:focus {
    outline: none;
    border-color: var(--accent-2);
    background: var(--search-focus-bg);
}

/* ============================================================
   Stats Grid / Cards
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    text-align: center;
    transition: border-color 0.2s;
}
.stat-card:hover { border-color: var(--accent-2); }

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
    letter-spacing: 0.03em;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.02em;
}

/* ============================================================
   Hit / Miss
   ============================================================ */
.hit  { color: var(--hit);  font-weight: 700; }
.miss { color: var(--miss); font-weight: 700; }
.na   { color: var(--na); }

/* ============================================================
   Accuracy Badge (inline next to analyst name)
   ============================================================ */
.accuracy-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 9px;
    color: #fff;
    margin-left: 6px;
    vertical-align: text-bottom;
    line-height: 1.3;
    white-space: nowrap;
    transition: opacity 0.2s ease, background-color 0.3s ease;
}

/* Accuracy toggle (segmented control in th) */
.accuracy-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 5px;
    overflow: hidden;
    margin-left: 8px;
    vertical-align: middle;
}
.accuracy-toggle button {
    padding: 2px 7px;
    border: none;
    border-right: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
    line-height: 1.6;
}
.accuracy-toggle button:last-child { border-right: none; }
.accuracy-toggle button.active {
    background: var(--accent-3);
    color: var(--accent-text);
    font-weight: 600;
}
.accuracy-toggle button:hover:not(.active) { color: var(--text); }

/* ============================================================
   Chart Section
   ============================================================ */
.chart-section {
    background: var(--bg-card);
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

/* 차트 캔버스 높이 래퍼 */
.chart-canvas-wrap {
    position: relative;
    height: 350px;
}

/* 13F detail: AUM차트 + 파이차트 나란히 배치 */
.chart-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    align-items: stretch;
}
.chart-row > .chart-section {
    flex: 1 1 50%;
    min-width: 0;
    margin-bottom: 0;
    padding: 1.25rem;
}

/* 파이차트 + 범례 나란히 배치 */
.pie-chart-area {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
}
.pie-chart-canvas-wrap {
    flex: 0 0 200px;
    width: 200px;
    height: 200px;
    position: relative;
}
.pie-legend-wrap {
    flex: 1;
    min-width: 0;
    align-self: center;
}

/* Portfolio change card: 4-column grid */
.perf-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 900px) {
    .perf-grid { grid-template-columns: repeat(2, 1fr); }
    .perf-grid > div:nth-child(1) { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
    .perf-grid > div:nth-child(2) { border-right: none !important; border-bottom: 1px solid var(--border); }
    .perf-grid > div:nth-child(3) { border-right: 1px solid var(--border); }
    .perf-grid > div:nth-child(4) { border-right: none !important; }
}
@media (max-width: 600px) {
    .perf-grid { grid-template-columns: 1fr; }
    .perf-grid > div { border-right: none !important; border-bottom: 1px solid var(--border); }
    .perf-grid > div:last-child { border-bottom: none; }
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.current-price {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-h1);
    letter-spacing: -0.03em;
}

.price-change {
    font-size: 0.95rem;
    margin-left: 0.5rem;
    font-weight: 600;
}
.price-change.up   { color: var(--up); }
.price-change.down { color: var(--down); }

.chart-tabs { display: flex; gap: 0.3rem; }

.chart-tab {
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    font-family: inherit;
    transition: all 0.15s;
}
.chart-tab.active {
    background: var(--accent-3);
    color: var(--accent-text);
    border-color: var(--accent-3);
    font-weight: 600;
}
.chart-tab:hover { border-color: var(--text-faint); color: var(--text); }

/* ============================================================
   Lang Toggle & Theme Toggle
   ============================================================ */
.lang-toggle, .theme-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-nav);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    letter-spacing: 0.05em;
    font-family: inherit;
    transition: all 0.15s;
}
.lang-toggle { margin-left: auto; }
.theme-toggle { margin-left: 0.4rem; font-size: 0.9rem; padding: 0.15rem 0.45rem; letter-spacing: 0; }
.lang-toggle:hover, .theme-toggle:hover { border-color: var(--text-faint); color: var(--text-h1); }

/* ============================================================
   Nav Toggle (mobile hamburger)
   ============================================================ */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-nav);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    line-height: 1;
    margin-left: 0.5rem;
}

/* ============================================================
   Skeleton Loading
   ============================================================ */
@keyframes shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position: 600px 0; }
}

.skel-heading, .skel-card, .skel-row {
    background: linear-gradient(90deg, var(--skel-1) 25%, var(--skel-2) 50%, var(--skel-1) 75%);
    background-size: 1200px 100%;
    animation: shimmer 1.6s infinite linear;
    border-radius: 6px;
}
.skel-heading {
    width: 260px; height: 20px;
    margin: 2rem 0 1rem;
}
.skel-card  { height: 88px; }
.skel-row   { height: 40px; margin-bottom: 4px; border-radius: 4px; }

/* ============================================================
   Market Ticker
   ============================================================ */
.ticker-wrap {
    background: var(--bg-body);
    border-bottom: 1px solid var(--border);
    height: 30px;
    overflow: hidden;
    position: sticky;
    top: 54px;
    z-index: 99;
    cursor: default;
    user-select: none;
}

.ticker-track {
    display: inline-flex;
    align-items: center;
    height: 100%;
    white-space: nowrap;
    animation: ticker-scroll linear infinite;
    will-change: transform;
}
.ticker-wrap:hover .ticker-track { animation-play-state: paused; }

@keyframes ticker-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

.ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0 1.4rem;
    border-right: 1px solid var(--border);
    height: 100%;
}
.ticker-name {
    font-size: 0.72rem;
    color: var(--text-h2);
    font-weight: 600;
    letter-spacing: -0.01em;
}
.ticker-val {
    font-size: 0.72rem;
    color: var(--text-h1);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}
.ticker-up { font-size: 0.7rem; color: var(--up);   font-weight: 500; font-variant-numeric: tabular-nums; }
.ticker-dn { font-size: 0.7rem; color: var(--down); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ============================================================
   Mobile Responsive
   ============================================================ */
@media (max-width: 768px) {
    .navbar { flex-wrap: wrap; height: auto; padding: 0 1rem; }
    .navbar .logo { padding: 0.85rem 0; flex: 1; }
    .nav-toggle { display: block; }
    .nav-links {
        display: none;
        width: 100%;
        padding-bottom: 0.8rem;
        background: var(--bg-body);
        border-top: 1px solid var(--border);
    }
    .nav-links.open { display: block; }
    .nav-links > a { display: block; margin: 0.45rem 0; margin-right: 0; font-size: 0.95rem; }
    .nav-group { display: flex; margin: 0.45rem 0; margin-right: 0; }
    .nav-main { font-size: 0.95rem; }
    .nav-ms .market-tab { font-size: 0.75rem; padding: 0.15rem 0.55rem; margin-right: 0; }
    .nav-group-label { display: block; margin: 0.6rem 0 0.2rem; font-size: 0.72rem; }
    .nav-separator { display: none; }

    .container { margin: 1rem auto; padding: 0 1rem; }
    h1 { font-size: 1.25rem; margin-bottom: 1rem; }
    h2 { font-size: 0.95rem; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    .stat-value { font-size: 1.3rem; }

    table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    th, td { padding: 0.6rem 0.7rem; font-size: 0.82rem; white-space: nowrap; }

    .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; padding-bottom: 2px; }
    .tab { padding: 0.6rem 1rem; font-size: 0.85rem; }

    .chart-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .current-price { font-size: 1.4rem; }
    .chart-tabs { flex-wrap: wrap; gap: 0.4rem; }

    .lang-toggle { margin-left: 0.5rem; min-height: 36px; padding: 0.35rem 0.65rem; }
    .theme-toggle { margin-left: 0.3rem; min-height: 36px; padding: 0.35rem 0.5rem; }

    /* iOS 입력창 자동 줌 방지 (font-size < 16px → zoom 발생) */
    .search-box, .lcard-search-input, input[type="text"] { font-size: 1rem; }

    /* 테이블 카드 가로 스크롤 허용 */
    .table-card { overflow-x: auto; }

    /* 차트 높이 줄이기 */
    .chart-canvas-wrap { height: 220px; }
}

/* ============================================================
   600px — 차트 행/파이차트 세로 전환
   ============================================================ */
@media (max-width: 600px) {
    .chart-row { flex-direction: column; }
    .chart-row > .chart-section { flex: none; }

    .pie-chart-area { flex-direction: column; align-items: center; gap: 0.75rem; }
    .pie-chart-canvas-wrap { flex: none; }
    .pie-legend-wrap { width: 100%; }
}

/* ============================================================
   480px — 소형 폰 전용 (iPhone SE, 갤럭시 A시리즈 등)
   ============================================================ */
@media (max-width: 480px) {
    h1 { font-size: 1.1rem; }
    .container { padding: 0 0.75rem; }

    /* stat 카드: 1열 + 가로 레이아웃 */
    .stats-grid { grid-template-columns: 1fr; gap: 0.6rem; }
    .stat-card {
        display: flex;
        align-items: center;
        text-align: left;
        padding: 0.85rem 1rem;
        gap: 1rem;
    }
    .stat-label { margin-bottom: 0; font-size: 0.8rem; flex: 1; }
    .stat-value { font-size: 1.25rem; }

    /* 차트 더 작게 */
    .chart-canvas-wrap { height: 200px; }

    /* 랜딩 카드 */
    .lcard { min-height: 200px; }
    .landing-hero h1 { font-size: 1.5rem; }

    /* glass-tabs 줄바꿈 허용 */
    .glass-tabs { flex-wrap: wrap; display: flex; }
    .glass-tabs .tab { padding: 0.4rem 0.75rem; font-size: 0.8rem; }

    /* 테이블 더 compact */
    th, td { padding: 0.5rem 0.55rem; font-size: 0.78rem; }
}

/* ============================================================
   Landing Page
   ============================================================ */
.landing-hero {
    padding: 2.5rem 0 1.5rem;
    text-align: center;
}
.landing-hero h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-h1) 60%, var(--rh-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}
.landing-hero p {
    color: var(--text-h2);
    font-size: 0.95rem;
}

.landing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.1rem;
    padding-bottom: 2.5rem;
}

.lcard {
    background: rgba(22, 27, 34, 0.68);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 18px;
    padding: 1.1rem 1.2rem;
    min-height: 340px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    box-shadow:
        inset 0 1.5px 0 rgba(255,255,255,0.09),
        inset 0 -1px 0 rgba(0,0,0,0.18),
        0 4px 24px rgba(0,0,0,0.38);
}
.lcard::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 48%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.045) 0%, transparent 100%);
    border-radius: 18px 18px 0 0;
    pointer-events: none;
    z-index: 0;
}
.lcard > * { position: relative; z-index: 1; }
.lcard:hover {
    transform: translateY(-4px);
    border-color: rgba(96,165,250,0.22);
    box-shadow:
        inset 0 1.5px 0 rgba(255,255,255,0.13),
        inset 0 -1px 0 rgba(0,0,0,0.18),
        0 16px 44px rgba(96,165,250,0.13),
        0 4px 16px rgba(0,0,0,0.45);
}
[data-theme="light"] .lcard {
    background: rgba(255,255,255,0.72);
    border: 1px solid rgba(255,255,255,0.65);
    box-shadow:
        inset 0 1.5px 0 rgba(255,255,255,0.92),
        0 4px 20px rgba(0,0,0,0.07);
}
[data-theme="light"] .lcard::before {
    background: linear-gradient(to bottom, rgba(255,255,255,0.5) 0%, transparent 100%);
}
[data-theme="light"] .lcard:hover {
    border-color: rgba(9,105,218,0.28);
    box-shadow:
        inset 0 1.5px 0 rgba(255,255,255,0.92),
        0 16px 44px rgba(9,105,218,0.10),
        0 4px 16px rgba(0,0,0,0.09);
}

.lcard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.9rem;
    flex-shrink: 0;
}
.lcard-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0;
    color: var(--rh-green);
}
.lcard-sub {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 0.18rem;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
}
.lcard-section-title {
    grid-column: 1 / -1;
    margin-bottom: -0.4rem;
}
.lcard-section-title h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-h1);
    margin: 0;
}
.lcard-section-title p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0.25rem 0 0;
}
.lcard-report-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.1rem;
}
.lcard-elite-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.1rem;
}
.lcard-elite-row .lcard { min-height: 300px; }

.lcard-more {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}
.lcard-more:hover { color: var(--rh-green); }

/* 검색 카드 */
.lcard-search {
    justify-content: center;
    gap: 1rem;
}
.lcard-search .search-tagline {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-h1);
    line-height: 1.4;
}
.lcard-search .search-sub {
    font-size: 0.8rem;
    color: var(--text-h2);
    margin-top: 0.25rem;
}
.lcard-search-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.lcard-search-input {
    flex: 1;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    color: var(--text);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.15s;
}
.lcard-search-input:focus { border-color: var(--rh-green); }
.lcard-search-btn {
    background: var(--rh-green);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
    white-space: nowrap;
}
.lcard-search-btn:hover { opacity: 0.88; }
.lcard-search-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.25rem;
}
.lcard-hint-chip {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.2rem 0.6rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    text-decoration: none;
}
.lcard-hint-chip:hover { color: var(--rh-green); border-color: var(--rh-green); }

/* 리포트 리스트 */
.lreport-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
    overflow: hidden;
}
.lreport-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.42rem 0;
    border-bottom: 1px solid var(--border-row);
    text-decoration: none;
    color: inherit;
    transition: background 0.12s;
}
.lreport-item:last-child { border-bottom: none; }
.lreport-item:hover { background: var(--bg-hover); margin: 0 -0.4rem; padding-left: 0.4rem; padding-right: 0.4rem; border-radius: 6px; }

.lreport-grade {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    flex-shrink: 0;
}
.lreport-grade.BUY  { background: rgba(63,185,80,0.12); color: var(--hit); }
.lreport-grade.SELL { background: rgba(248,81,73,0.12); color: var(--miss); }
.lreport-grade.HOLD { background: var(--bg-hover); color: var(--text-h2); }

.lreport-body { flex: 1; min-width: 0; }
.lreport-ticker {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-h1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lreport-co {
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 0.25em;
}
.lreport-sub {
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lreport-date {
    font-size: 0.65rem;
    color: var(--text-faint);
    flex-shrink: 0;
}

/* 운용사 카드 */
.lcard-fund-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.8rem;
    flex-shrink: 0;
}
.lcard-fund-rank {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--rh-green);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.15rem;
}
.lcard-fund-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-h1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}
.lcard-fund-return {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--hit);
    flex-shrink: 0;
}
.lcard-fund-return.negative { color: var(--miss); }

.lcontrib-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
    overflow: hidden;
}
.lcontrib-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.38rem 0;
    border-bottom: 1px solid var(--border-row);
    text-decoration: none;
    color: inherit;
    transition: background 0.12s;
}
.lcontrib-item:last-child { border-bottom: none; }
.lcontrib-item:hover { background: var(--bg-hover); margin: 0 -0.4rem; padding-left: 0.4rem; padding-right: 0.4rem; border-radius: 6px; }
.lcontrib-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--rh-green-dim);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.6rem; font-weight: 700; color: var(--rh-green);
    flex-shrink: 0;
}
.lcontrib-body { flex: 1; min-width: 0; }
.lcontrib-ticker {
    font-size: 0.78rem; font-weight: 700; color: var(--text-h1);
}
.lcontrib-name {
    font-size: 0.66rem; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lcontrib-ret {
    font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}
.lcontrib-ret.pos { color: var(--hit); }
.lcontrib-ret.neg { color: var(--miss); }

/* 검색 결과 페이지 */
.search-results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-top: 1.5rem;
}
.search-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.2rem;
    min-height: 200px;
}
.search-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--rh-green);
    margin: 0 0 0.9rem 0;
}
.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border-row);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background 0.12s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-hover); margin: 0 -0.5rem; padding-left: 0.5rem; padding-right: 0.5rem; border-radius: 6px; }
.search-result-main { font-size: 0.85rem; font-weight: 700; color: var(--text-h1); }
.search-result-sub  { font-size: 0.72rem; color: var(--text-muted); }
.search-result-cnt  { font-size: 0.68rem; color: var(--text-faint); margin-left: auto; flex-shrink: 0; }
.search-empty { font-size: 0.82rem; color: var(--text-muted); padding: 1rem 0; }

@media (max-width: 900px) {
    .landing-grid { grid-template-columns: 1fr; }
    .lcard { height: auto; min-height: 280px; }
    .lcard-report-row { grid-template-columns: 1fr; }
    .lcard-elite-row { grid-template-columns: 1fr; }
    .search-results-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Nav active state
   ============================================================ */
.nav-links a.nav-active {
    color: var(--accent);
    font-weight: 700;
}

/* ============================================================
   Market Switcher (한국 / 미국 glass pill tabs inside pages)
   ============================================================ */
.market-switcher {
    display: inline-flex;
    gap: 0.3rem;
    margin-bottom: 1.25rem;
    align-items: center;
    padding: 0.3rem;
    background: rgba(22,27,34,0.58);
    backdrop-filter: blur(14px) saturate(150%);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 2px 12px rgba(0,0,0,0.25);
}
.market-tab {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.9rem;
    border-radius: 8px;
    border: none;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-muted);
    background: transparent;
    transition: background 0.18s, color 0.18s;
    letter-spacing: -0.01em;
}
.market-tab:hover:not(.active) {
    background: rgba(255,255,255,0.05);
    color: var(--text);
}
.market-tab.active {
    background: rgba(96,165,250,0.18);
    color: var(--accent);
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.10), 0 2px 8px rgba(96,165,250,0.12);
}
[data-theme="light"] .market-switcher {
    background: rgba(255,255,255,0.65);
    border: 1px solid rgba(255,255,255,0.75);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 2px 10px rgba(0,0,0,0.06);
}
[data-theme="light"] .market-tab.active {
    background: rgba(9,105,218,0.12);
}

/* ============================================================
   Sortable Table Headers (13F style)
   ============================================================ */
th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
th.sortable:hover { color: var(--accent); }
th.sortable.active { color: var(--accent); }
th.sortable .sort-icon {
    opacity: 0.35;
    font-size: 0.82em;
    margin-left: 0.15em;
}
th.sortable.active .sort-icon { opacity: 1; }

/* Column header help (?) button */
.th-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.6rem;
    font-weight: 700;
    cursor: default;
    margin-left: 0.3em;
    vertical-align: middle;
    line-height: 1;
    flex-shrink: 0;
}
.th-help:hover { border-color: var(--accent); color: var(--accent); }

/* JS-driven tooltip popup (position:fixed — bypasses overflow:hidden on .table-card) */
#th-tip-popup {
    position: fixed;
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 400;
    line-height: 1.45;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    width: 210px;
    white-space: normal;
    text-align: left;
    box-shadow: 0 4px 18px rgba(0,0,0,0.3);
    pointer-events: none;
    z-index: 9999;
    transition: opacity 0.12s;
}

/* ============================================================
   Accessibility helpers
   ============================================================ */
.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;
}
.sr-only:focus {
    position: fixed;
    top: 0; left: 0;
    width: auto; height: auto;
    padding: 0.75rem 1.5rem;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
    background: var(--accent);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    z-index: 99999;
    border-radius: 0 0 8px 0;
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 3rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
}
