/* ============================================================
   대장주픽 — 기존(라이트) 색감 유지
   ============================================================ */

/* 사이트 공통 규칙: 상승=빨강 / 하락=파랑 */
.second-page .positive { color: #e71909; }
.second-page .negative { color: #115bcb; }

.lp-container {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    /* .site-header(로고/메뉴)가 absolute라 흐름 밖에 있음 —
       다른 페이지의 .container처럼 상단 여백으로 겹침 방지 */
    padding: 80px 0 0;
}

@media (max-width: 768px) {
    .lp-container { padding-top: 48px; }
}

/* ── 상단 타이틀 바 ───────────────────────────────────── */
.lp-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    margin: 8px 10px 0;
    border-radius: 12px;
    background: #f5f6f8;
    border: 1px solid #e5e8eb;
}
.lp-title {
    font-size: 16px;
    font-weight: 800;
    color: #333d4b;
}
.lp-loading {
    padding: 60px 20px;
    text-align: center;
    color: #8b95a1;
    font-size: 14px;
}

/* ── 아코디언 ─────────────────────────────────────────── */
.lp-accordion {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 10px;
    box-sizing: border-box;
}

.lp-card {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
    background: #fff;
    border: 1px solid #e5e8eb;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: flex-grow 0.3s ease;
}

/* 펼친 상태: 컨테이너 높이 고정이 풀리므로 카드들은 내용 크기 기반 */
.lp-accordion.has-active .lp-card { flex: 0 0 auto; }

/* 접힌(3등분) 상태에서는 헤더를 세로 중앙에 */
.lp-accordion:not(.has-active) .lp-card { justify-content: center; }

.lp-card:not(.active) .lp-card-body { display: none; }

/* ── 카드 헤더 ────────────────────────────────────────── */
.lp-card-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 14px 16px;
    background: transparent;
    border: none;
    color: inherit;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

/* 좌측 세로 컬럼: 테마 아이콘(테마명 줄과 같은 높이) + 순위(아래) */
.lp-head-left {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 26px;
}

.lp-rank {
    display: flex;
    align-items: center;
    justify-content: center;
}
.lp-crown { width: 22px; height: auto; }
.lp-rank-num {
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: #f5f6f8;
    border: 1px solid #e5e8eb;
    font-size: 12px; font-weight: 800; color: #4e5968;
}

/* 테마 아이콘: 테마명 텍스트 줄 높이(24px)와 동일하게 맞춘다 */
.lp-theme-icon {
    position: relative;
    width: 24px; height: 24px; flex-shrink: 0;
    border-radius: 50%;
    background: #eef1f4; color: #4e5968;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
    overflow: hidden;
    border: 1px solid #e5e8eb;
}
.lp-theme-icon img {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
}
.lp-theme-icon.has-img .lp-theme-initial { visibility: hidden; }

.lp-head-main { flex: 1; min-width: 0; }

.lp-theme-name {
    font-size: 17px;
    font-weight: 700;
    color: #333d4b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 24px; /* 좌측 테마 아이콘(24px)과 같은 줄 높이 */
}
.lp-counts {
    display: flex;
    gap: 12px;
    margin-top: 5px;
    font-size: 12px;
    font-weight: 600;
}
.lp-up { color: #e71909; }
.lp-down { color: #115bcb; }

.lp-head-value {
    margin-top: 4px;
    font-size: 12px;
    color: #6b7684;
}
.lp-head-value b { color: #333d4b; font-weight: 700; }

.lp-head-right { text-align: right; flex-shrink: 0; }
.lp-live {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    font-size: 11px;
    color: #8b95a1;
}
.lp-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #20c997;
}
.lp-head-change {
    margin-top: 3px;
    font-size: 19px;
    font-weight: 800;
}

/* ── 카드 본문 ────────────────────────────────────────── */
/* 내부 스크롤 금지: 펼치면 내용만큼 늘어나고 페이지가 스크롤된다 */
.lp-card-body {
    padding: 4px 14px 16px;
}

/* 대장주 섹션 */
.lp-leader {
    margin-top: 10px;
    padding: 12px;
    border-radius: 12px;
    background: #f9fafb;
    border: 1px solid #e5e8eb;
}
.lp-leader-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.lp-leader-title { font-size: 14px; font-weight: 700; color: #333d4b; }

/* 대장주 종목 행 */
.lp-ls {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.lp-ls-rank {
    width: 26px; flex-shrink: 0;
    display: flex; flex-direction: column; align-items: center;
    font-size: 13px; font-weight: 800; color: #4e5968;
    line-height: 1.1;
}
.lp-crown-sm { width: 18px; height: auto; margin-bottom: 1px; }
.lp-ls-icon {
    position: relative;
    width: 34px; height: 34px; flex-shrink: 0;
    border-radius: 50%;
    background: #eef1f4; color: #4e5968;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    overflow: hidden;
}
.lp-ls-icon img {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
}
.lp-ls-icon.has-img .lp-ls-initial { visibility: hidden; }
.lp-ls-main { flex: 1; min-width: 0; }
.lp-ls-name {
    font-size: 14px; font-weight: 700; color: #333d4b;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lp-ls-code { font-size: 11px; color: #8b95a1; margin-top: 1px; }
.lp-ls-change { font-size: 15px; font-weight: 800; flex-shrink: 0; }
.lp-ls-chart { width: 74px; height: 36px; flex-shrink: 0; }
.lp-ls-chart .mini-chart { width: 100%; height: 100%; }

.lp-ls-metrics {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.lp-ls-metrics span {
    flex: 1;
    font-size: 12px;
    color: #6b7684;
    background: #fff;
    border: 1px solid #e5e8eb;
    border-radius: 8px;
    padding: 8px 10px;
}
.lp-ls-metrics b { color: #333d4b; font-weight: 700; margin-left: 4px; }

/* 종목 리스트 */
.lp-list { margin-top: 14px; }
.lp-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.lp-list-title { font-size: 14px; font-weight: 700; color: #333d4b; }
.lp-sort {
    background: #fff;
    color: #333d4b;
    border: 1px solid #d6dae0;
    border-radius: 8px;
    padding: 5px 8px;
    font-size: 12px;
    outline: none;
}

.lp-table { width: 100%; border-collapse: collapse; }
.lp-table th {
    font-size: 11px; color: #8b95a1; font-weight: 600;
    text-align: right; padding: 6px 6px; border-bottom: 1px solid #e5e8eb;
}
.lp-table th:first-child { text-align: left; }
.lp-table td {
    padding: 9px 6px;
    font-size: 13px;
    border-bottom: 1px solid #f0f2f4;
    text-align: right;
    color: #333d4b;
}
.lp-t-rank { color: #8b95a1; font-weight: 700; text-align: center !important; width: 24px; }
.lp-t-name { text-align: left !important; }
.lp-t-name > div:first-child { font-weight: 600; }
.lp-t-code { font-size: 11px; color: #8b95a1; margin-top: 1px; }
.lp-t-change { font-weight: 700; }

.lp-table tbody tr { cursor: pointer; }
.lp-table tbody tr:hover { background: #f9fafb; }

/* ── 시간별 주도테마 ─────────────────────────────────── */
.lp-history { margin-top: 4px; padding-bottom: 20px; }
.lp-history.hidden { display: none; }

.lp-history-timeline {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 10px;
    margin: 8px 10px 0;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e5e8eb;
    -webkit-overflow-scrolling: touch;
}
.lp-ht-col {
    flex: 0 0 auto;
    min-width: 86px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    border-radius: 8px;
    background: #f9fafb;
    border: 1px solid #f0f2f4;
}
.lp-ht-time {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #6b7684;
    padding-bottom: 2px;
    border-bottom: 1px solid #e5e8eb;
    margin-bottom: 2px;
}
.lp-ht-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #333d4b;
    min-height: 18px;
}
.lp-ht-item.lp-ht-empty { color: #b0b8c1; justify-content: center; }
.lp-ht-crown { width: 13px; height: auto; flex-shrink: 0; }
.lp-ht-num {
    width: 13px;
    text-align: center;
    font-weight: 800;
    color: #8b95a1;
    flex-shrink: 0;
}
.lp-ht-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

/* 1·2·3위 변동 없는 구간 */
.lp-ht-col.lp-ht-nochange {
    min-width: 64px;
    background: #fff;
    border: 1px dashed #d6dae0;
    justify-content: center;
}
.lp-ht-nochange-label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #b0b8c1;
    white-space: nowrap;
}

.lp-history-chart-wrap {
    margin: 8px 10px 0;
    padding: 10px 6px 6px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e5e8eb;
}
.lp-history-chart { width: 100%; height: 260px; }

/* ── 모바일 대응: 대장주 행이 좁은 화면에서 깨지지 않게 ── */
@media (max-width: 480px) {
    .lp-ls { gap: 6px; }
    .lp-ls-rank { width: 18px; }
    .lp-crown-sm { width: 15px; }
    .lp-ls-icon { width: 30px; height: 30px; }
    .lp-ls-name { font-size: 13px; }
    .lp-ls-change { font-size: 13px; }
    .lp-ls-chart { width: 56px; height: 30px; }
    .lp-ls-metrics { flex-direction: column; gap: 6px; }
    .lp-ls-metrics span { font-size: 11px; padding: 7px 8px; }
    .lp-theme-name { font-size: 15px; line-height: 22px; }
    .lp-head-change { font-size: 16px; }
    .lp-crown { width: 20px; }
    .lp-theme-icon { width: 22px; height: 22px; font-size: 10px; }
    .lp-rank-num { width: 20px; height: 20px; font-size: 11px; }
    .lp-head-left { width: 24px; }
    .lp-card-header { gap: 8px; padding: 12px; }
    .lp-card-body { padding: 4px 10px 14px; }
    .lp-leader { padding: 10px; }
    .lp-table td { font-size: 12px; padding: 8px 4px; }
    .lp-table th { padding: 6px 4px; }
}

/* 접기 버튼 (리스트 아래) */
.lp-collapse {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 11px;
    border-radius: 10px;
    background: #f5f6f8;
    border: 1px solid #d6dae0;
    color: #4e5968;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.lp-collapse:hover { background: #eef1f4; color: #333d4b; }
