/* ── 모바일 토글 버튼 (기본 숨김) ── */
.mobile-toggle-bar {
    display: none;
    margin-top: 8px;
    margin-bottom: 8px;
    gap: 8px;
}

.mobile-toggle-bar button {
    flex: 1;
    padding: 4px 0;
    font-size: 0.8rem;
    border: 1px solid #666;
    background: #222;
    color: #fff;
    border-radius: 4px;
}

.mobile-toggle-bar button.active {
    background: #444;
}

.stock-theme {
    color: red;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* global.css 또는 issue.css 등 적당한 파일에 추가 */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: white;
    z-index: 9998;
}

#splash-screen img {
    max-width: 50%;
    max-height: 50%;
}

.chart-toggle-btn {
    background: none;
    border: none;
    padding: 0;
    margin-left: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

/* 펼침/축소 토글 버튼 - 데스크탑에서는 항상 숨김 */
.expand-toggle-btn {
    display: none;
}

/* ── 펼쳐진 테마 뷰 (데스크탑에서는 숨김) ── */
.theme-expanded-view {
    display: none;
}

/* ── 펼쳐진 종목 뷰 (기본 숨김) ── */
.stock-expanded-view {
    display: none;
}

/* 처음엔 Bar 아이콘 숨기고 Line만 보이기 */
.chart-toggle-btn .icon-bar {
    display: none;
    height: 25px;
}

.chart-toggle-btn .icon-line {
    display: inline-block;
    height: 25px;
}

/* active 클래스가 붙으면 Line 숨기고 Bar 보이기 */
.chart-toggle-btn.active .icon-line {
    display: none;
}

.chart-toggle-btn.active .icon-bar {
    display: inline-block;
}

/* 토글 버튼도 inline-flex, 아이콘과 텍스트 사이 간격 유지 */
.combo-title .chart-toggle-btn {
    display: inline-flex;
    align-items: center;
    margin-left: 8px; /* 필요에 따라 조절 */
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
}

/* 아이콘 크기를 텍스트 높이에 맞추기 */
.combo-title .chart-toggle-btn img {
    height: 1em; /* 텍스트 1em 높이와 동일 */
    width: auto;
    display: block;
}

.panel {
    padding: 0 10px;
}

.combo-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.combo-left, .combo-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.combo-group {
    display: flex;
    gap: 10px;
}

.combo-group select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #e6e6e6;
    color: #333D4B;
    font-size: 0.85rem;
    padding: 8px 36px 8px 12px;
    border: none;
    border-radius: 6px;
    font-family: Pretendard Variable, Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 50 L70 100 L120 50' stroke='%23333' stroke-width='15' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.combo-group select:hover {
    background-color: #f0f0f0;
}

.combo-group select:focus {
    outline: none;
    box-shadow: 0 0 0 2px #4fabff;
}

/* ───────────── View Toggle Buttons ───────────── */
.view-toggle {
    display: none;
    gap: 6px;
    margin-bottom: 10px;
}

.view-toggle button {
    height: 36px;
    padding: 0 12px;
    font-size: 0.85rem;
    border-radius: 6px;
    background: #333;
    color: #fff;
    border: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    width: 50%;
}

/* ── 모바일에서 view-toggle 버튼 크기 축소 ── */
@media (max-width: 1023px) {
    .view-toggle {
        margin-bottom: 6px;
    }
    .view-toggle button {
        height: 25px;
        font-size: 0.7rem;
        padding: 0 8px;
    }
}

.view-toggle button.active {
    background: linear-gradient(90deg, #e71909, #e71909);
}

/* ───────────── Chart Bars ───────────── */
#bar-container,
#stock-bar-container {
    position: relative;
    height: 500px;
    margin-bottom: 20px;
    padding-left: 10px;
    width: 100%;
}

.chart-wrapper {
    position: relative;
    height: 400px;
    width: 100%;
    display: none;
}

.bar-item {
    position: absolute;
    width: calc(100%);
    height: 40px;
    display: flex;
    align-items: center;
    transition: top 0.5s ease;
    padding-left: 10px;
}

.stock-code {
    display: inline-block; /* 필요에 따라 block or inline-block */
    color: #888; /* 원하는 색으로 변경 */
    font-size: 0.9em; /* 필요하면 크기도 조절 */
    /*margin-top: 2px; !* 줄 간격 조정 *!*/
}

.chart-label .stock-code {
    margin-top: -3px;
}

.chart-theme-label {
    width: 120px;
    text-align: center;
    border-left: 1px solid white;
}

.chart-theme-label[data-theme-id] {
    cursor: pointer;
}

.chart-theme-label[data-theme-id]:hover {
    text-decoration: underline;
}

.chart-rank {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    min-width: 24px;
    text-align: right;
    margin-right: 8px;
    flex-shrink: 0;
}

.chart-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #e0e0e0;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
}

.chart-label {
    width: 130px;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
}

.bar {
    flex: 1;
    height: 100%;
    background: #686868;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    color: white;
}

.bar-fill {
    height: 100%;
    border-radius: 20px;
    transition: width 0.5s ease;
}

.right-panel .chart-value {
    left: 356px;
    color: white;
}

.left-panel .chart-value {
    left: 236px;
}

.chart-value {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.80rem;
    font-weight: 500;
    white-space: nowrap;
}

@media (max-width: 400px) {
    .chart-value {
        font-size: 0.55rem;
    }
}

/* ───────────── Pagination ───────────── */
#stock-pagination {
    text-align: center;
}

.stock-toggle-btn {
    background-color: #e6e6e6;
    color: #333D4B;
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}

/* ───────────── Modal ───────────── */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #2b2b3c;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
}

/* ───────────── Filter Bar ───────────── */
.filter-bar {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 1.1rem;
    background: #2b2b3c;
    padding: 20px;
    border-radius: 8px;
}

.modal .filter-bar {
    display: flex;
}

.filter-bar input.filter-input {
    width: 90px;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fafafa;
    color: #000;
}

.filter-bar button.filter-save-btn {
    padding: 7px 14px;
    background: #4fabff;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.filter-bar button.filter-save-btn:hover {
    background: #3486d1;
}


@media (min-width: 1024px) {

    .combo-title {
        font-size: 1.2rem;
        font-weight: 600;
        color: #333D4B;
        white-space: nowrap;
    }

    /* ── 데스크탑 펼쳐보기 버튼 스타일 ── */
    #themeExpandToggle {
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: #e6e6e6;
        color: #333D4B;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        height: 32px;
        width: 32px;
        padding: 0;
        margin-left: 8px;
    }

    #themeExpandToggle:hover {
        background-color: #f0f0f0;
    }

    #themeExpandToggle:focus {
        outline: none;
        box-shadow: 0 0 0 2px #4fabff;
    }

    #themeExpandToggle svg {
        width: 16px;
        height: 16px;
    }

    /* 기본: expand 아이콘 보이고, collapse 숨김 */
    #themeExpandToggle .icon-expand {
        display: block;
    }
    #themeExpandToggle .icon-collapse {
        display: none;
    }

    /* active 상태: collapse 아이콘 보이고, expand 숨김 */
    #themeExpandToggle.active .icon-expand {
        display: none;
    }
    #themeExpandToggle.active .icon-collapse {
        display: block;
    }

    /* ── 데스크탑 펼쳐보기 뷰 스타일 ── */
    .theme-expanded-view {
        display: none;
        flex-direction: column;
        padding: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .theme-expanded-view.active {
        display: flex;
    }

    .theme-expanded-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 0 4px;
        width: 100%;
        box-sizing: border-box;
    }

    .theme-card {
        background: #fff;
        border: 1px solid #eee;
        border-radius: 10px;
        padding: 14px;
        box-shadow: 0 2px 6px rgba(0,0,0,0.08);
        min-width: 0;
        overflow: hidden;
    }

    .theme-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;
        padding-bottom: 10px;
        border-bottom: 1px solid #f0f0f0;
        gap: 10px;
    }

    .theme-card-name {
        font-size: 1rem;
        font-weight: 600;
        color: #333;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex: 1;
        min-width: 0;
        cursor: pointer;
    }

    .theme-card-name:hover {
        text-decoration: underline;
    }

    .theme-card-metrics {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        flex-shrink: 0;
        line-height: 1.3;
    }

    .theme-card-change {
        font-size: 0.9rem;
        font-weight: 600;
        white-space: nowrap;
    }

    .theme-card-change.positive {
        color: #e71909;
    }

    .theme-card-change.negative {
        color: #0066cc;
    }

    .theme-card-value {
        font-size: 0.8rem;
        color: #666;
        white-space: nowrap;
    }

    .theme-card-sort-bar {
        display: flex;
        gap: 6px;
        margin-bottom: 8px;
    }

    .theme-card-sort-bar .card-sort-btn {
        flex: 1;
        padding: 5px 8px;
        font-size: 0.75rem;
        border: 1px solid #ddd;
        background: #f9f9f9;
        color: #666;
        border-radius: 5px;
        cursor: pointer;
        transition: all 0.15s;
    }

    .theme-card-sort-bar .card-sort-btn.active {
        background: #e71909;
        color: #fff;
        border-color: #e71909;
    }

    .theme-card-stocks {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .theme-stock-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 0.95rem;
        padding: 3px 0;
        gap: 10px;
    }

    .theme-stock-item .stock-icon {
        width: 28px;
        height: 28px;
        border-radius: 50%;
        background-color: #e0e0e0;
        background-size: cover;
        background-position: center;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.85rem;
        font-weight: 600;
        color: #666;
    }

    .theme-stock-item .stock-info-col {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-width: 0;
        gap: 1px;
    }

    .theme-stock-item .stock-name {
        color: #333;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        cursor: pointer;
    }

    .theme-stock-item .stock-name:hover {
        text-decoration: underline;
    }

    .theme-stock-item .stock-close {
        font-size: 0.8rem;
        color: #888;
    }

    .theme-stock-item .stock-metrics {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        flex-shrink: 0;
        line-height: 1.3;
    }

    .theme-stock-item .stock-change {
        font-weight: 500;
        white-space: nowrap;
    }

    .theme-stock-item .stock-change.positive {
        color: #e71909;
    }

    .theme-stock-item .stock-change.negative {
        color: #0066cc;
    }

    .theme-stock-item .stock-value {
        font-size: 0.75rem;
        color: #666;
        white-space: nowrap;
    }

    /* 1등주 강조 */
    .theme-stock-item.first .stock-name {
        font-weight: 700;
    }

    .theme-stock-item.first .stock-change {
        font-weight: 700;
    }

    /* ── 종목 펼쳐보기 뷰 스타일 ── */
    .stock-expanded-view {
        display: none;
        flex-direction: column;
        padding: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .stock-expanded-view.active {
        display: flex;
    }

    .stock-expanded-view .desktop-only {
        display: block;
    }

    .stock-expanded-view .stock-expanded-grid.desktop-only {
        display: flex;
    }

    .stock-expanded-view .mobile-only {
        display: none !important;
    }

    .stock-expanded-header {
        font-size: 1rem;
        font-weight: 600;
        color: #333;
        padding: 10px 4px;
        border-bottom: 2px solid #e71909;
        margin-bottom: 12px;
    }

    .stock-expanded-grid {
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding: 0 4px;
        width: 100%;
        box-sizing: border-box;
    }

    .stock-column-headers {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 4px 12px 4px 206px;
        font-size: 0.75rem;
        color: #888;
        border-bottom: 1px solid #eee;
        margin-bottom: 4px;
    }

    .stock-column-headers.desktop-only {
        display: flex;
    }

    .stock-column-headers .col-metrics {
        display: flex;
        flex-direction: row;
        align-items: center;
        flex-shrink: 0;
    }

    .stock-column-headers .col-change {
        flex: 0 0 70px;
        text-align: right;
    }

    .stock-column-headers .col-value {
        flex: 0 0 100px;
        text-align: right;
    }

    .stock-column-headers .col-theme {
        flex: 1;
        text-align: right;
    }

    .stock-expanded-card {
        background: #fff;
        border: 1px solid #eee;
        border-radius: 8px;
        padding: 8px 12px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.06);
        display: flex;
        align-items: center;
        gap: 12px;
        cursor: pointer;
        transition: background 0.15s;
    }

    .stock-expanded-card:hover {
        background: #f9f9f9;
    }

    .stock-expanded-card .stock-rank {
        font-size: 0.85rem;
        font-weight: 700;
        color: #e71909;
        min-width: 24px;
        flex-shrink: 0;
    }

    .stock-expanded-card .stock-icon {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background-color: #e0e0e0;
        background-size: cover;
        background-position: center;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1rem;
        font-weight: 600;
        color: #666;
    }

    .stock-expanded-card .stock-info {
        display: flex;
        flex-direction: column;
        width: 110px;
        flex-shrink: 0;
    }

    .stock-expanded-card .stock-name {
        font-size: 0.95rem;
        font-weight: 600;
        color: #333;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .stock-expanded-card .stock-close {
        font-size: 0.8rem;
        color: #888;
    }

    .stock-expanded-card .stock-metrics {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        flex-shrink: 0;
    }

    .stock-expanded-card .stock-change {
        font-size: 1rem;
        font-weight: 600;
        white-space: nowrap;
        width: 70px;
        text-align: right;
    }

    .stock-expanded-card .stock-change.positive {
        color: #e71909;
    }

    .stock-expanded-card .stock-change.negative {
        color: #0066cc;
    }

    .stock-expanded-card .stock-value {
        font-size: 1rem;
        color: #666;
        white-space: nowrap;
        width: 70px;
        text-align: right;
    }

    .stock-expanded-card .stock-theme {
        flex: 1;
        min-width: 0;
        font-size: 0.95rem;
        font-weight: 700;
        color: #555;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        text-align: right;
    }

    /* 종목 펼치기 토글 버튼 */
    #stockExpandToggle {
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: #e6e6e6;
        color: #333D4B;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        height: 32px;
        width: 32px;
        padding: 0;
        margin-left: 8px;
    }

    #stockExpandToggle:hover {
        background-color: #f0f0f0;
    }

    #stockExpandToggle:focus {
        outline: none;
        box-shadow: 0 0 0 2px #4fabff;
    }

    #stockExpandToggle svg {
        width: 16px;
        height: 16px;
    }

    #stockExpandToggle .icon-expand {
        display: block;
    }
    #stockExpandToggle .icon-collapse {
        display: none;
    }
    #stockExpandToggle.active .icon-expand {
        display: none;
    }
    #stockExpandToggle.active .icon-collapse {
        display: block;
    }
}

/* ── 모바일 전용 (≤1023px) ── */
@media (max-width: 1023px) {
    .container {
        width: 100%;
    }
    .panel {
        padding: 0;
    }

    #bar-container,
    #stock-bar-container {
        position: relative;
        height: 500px;
        margin-bottom: 20px;
        padding-left: 0;
        width: 100%;
    }

    .bar-item {
        padding-left: 0;
    }

    /* 토글 버튼 보이기 */
    .combo-title {
        display: none;
    }

    /*.mobile-toggle-bar {*/
    /*    display: flex;*/
    /*}*/
    .chart-theme-label {
        display: none;
    }

    .right-panel .chart-value {
        left: 216px;
    }

    .left-panel .chart-value {
        left: 216px;
    }
}

#stock-bar-container .chart-label .stock-name {
    font-size: clamp(0.8rem, 2vw, 0.9rem);
}

#stock-bar-container .chart-label .stock-name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0; /* flex 아이템이 축소될 수 있도록 허용 */
}

@media (max-width: 1023px) {
    .combo-title {
        display: none;
    }

    /* 모바일에서 "테마 상위", "종목 상위" 텍스트 숨김 */
    .combo-bar {
        display: flex;
        gap: 5px;
        margin-bottom: 10px;
    }

    /* 래퍼 div는 껍데기 처리 */
    .combo-left,
    .combo-right,
    .combo-group {
        display: contents;
    }

    /* 버튼/셀렉트 3개를 동일 규격으로 (축소) */
    #themeChartToggle,
    #themeMetricType,
    #themeTimeframe,
    #stockChartToggle,
    #stockMetricType,
    #stockTimeframe {
        flex: 1 1 0;
        min-width: 0;
        height: 25px;
        font-size: 0.7rem;
        font-family: 'Inter';
        border-radius: 4px;
    }

    /* 버튼 공통 스타일 (70% 축소) */
    #themeChartToggle,
    #stockChartToggle {
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: #e6e6e6;
        color: #333D4B;
        border: none;
        padding: 0 16px 0 16px; /* select padding과 맞춤 (축소) */
        cursor: pointer;
    }

    #themeChartToggle:hover,
    #stockChartToggle:hover {
        background-color: #f0f0f0;
    }

    #themeChartToggle:focus,
    #stockChartToggle:focus {
        outline: none;
        box-shadow: 0 0 0 2px #4fabff;
    }

    #themeChartToggle img,
    #stockChartToggle img {
        height: 12px;
        width: auto;
        display: block;
    }

    /* select 스타일 (70% 축소) */
    #themeMetricType,
    #themeTimeframe,
    #stockMetricType,
    #stockTimeframe {
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        background-color: #e6e6e6;
        color: #333D4B;
        padding: 0 24px 0 8px; /* 버튼과 동일 padding (축소) */
        border: none;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 50 L70 100 L120 50' stroke='%23333' stroke-width='15' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 8px center;
        background-size: 8px 8px;
        cursor: pointer;
        transition: background-color 0.2s ease;
    }

    #themeMetricType:hover,
    #themeTimeframe:hover,
    #stockMetricType:hover,
    #stockTimeframe:hover {
        background-color: #f0f0f0;
    }

    #themeMetricType:focus,
    #themeTimeframe:focus,
    #stockMetricType:focus,
    #stockTimeframe:focus {
        outline: none;
        box-shadow: 0 0 0 2px #4fabff;
    }

    /* 토글 상태 전환 */
    #themeChartToggle .icon-bar,
    #stockChartToggle .icon-bar {
        display: none;
    }

    #themeChartToggle.active .icon-line,
    #stockChartToggle.active .icon-line {
        display: none;
    }

    #themeChartToggle.active .icon-bar,
    #stockChartToggle.active .icon-bar {
        display: inline-block;
    }

    .chart-toggle-btn {
        margin-left: 0;
    }

    /* ── 테마 확장/축소 토글 버튼 (모바일 전용, 70% 축소) ── */
    #themeExpandToggle {
        display: none; /* 기본 숨김, JS에서 테마 활성화 시 표시 */
        justify-content: center;
        align-items: center;
        background-color: #e6e6e6;
        color: #333D4B;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        height: 25px;
        font-size: 0.6rem;
    }

    #themeExpandToggle:hover {
        background-color: #f0f0f0;
    }

    #themeExpandToggle:focus {
        outline: none;
        box-shadow: 0 0 0 2px #4fabff;
    }

    #themeExpandToggle svg {
        width: 12px;
        height: 12px;
    }

    /* 기본: expand 아이콘 보이고, collapse 숨김 */
    #themeExpandToggle .icon-expand {
        display: block;
    }
    #themeExpandToggle .icon-collapse {
        display: none;
    }

    /* active 상태: collapse 아이콘 보이고, expand 숨김 */
    #themeExpandToggle.active .icon-expand {
        display: none;
    }
    #themeExpandToggle.active .icon-collapse {
        display: block;
    }

    /* 테마 모드 활성화 시 themeExpandToggle과 themeChartToggle이 반반 너비 */
    .left-panel.show-expand-toggle #themeExpandToggle {
        display: flex;
        flex: 0.5 1 0;
        min-width: 0;
    }

    .left-panel.show-expand-toggle #themeChartToggle {
        flex: 0.5 1 0;
    }

    /* 종목 모드 활성화 시 stockExpandToggle 표시 */
    #stockExpandToggle {
        display: none;
        justify-content: center;
        align-items: center;
        background-color: #e6e6e6;
        color: #333D4B;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        height: 25px;
        font-size: 0.6rem;
    }

    #stockExpandToggle svg {
        width: 12px;
        height: 12px;
    }

    #stockExpandToggle .icon-expand {
        display: block;
    }
    #stockExpandToggle .icon-collapse {
        display: none;
    }
    #stockExpandToggle.active .icon-expand {
        display: none;
    }
    #stockExpandToggle.active .icon-collapse {
        display: block;
    }

    .right-panel.show-stock-expand-toggle #stockExpandToggle {
        display: flex;
        flex: 0.5 1 0;
        min-width: 0;
    }

    .right-panel.show-stock-expand-toggle #stockChartToggle {
        flex: 0.5 1 0;
    }

    /* ── 펼쳐진 종목 뷰 스타일 (모바일) ── */
    .stock-expanded-view {
        display: none;
        flex-direction: column;
        padding: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .stock-expanded-view.active {
        display: flex;
    }

    .stock-expanded-view .desktop-only {
        display: none !important;
    }

    .stock-expanded-view .mobile-only {
        display: flex !important;
    }

    .stock-expanded-mobile-columns {
        display: flex;
        gap: 8px;
        width: 100%;
    }

    .stock-expanded-column {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
    }

    .stock-expanded-view .stock-expanded-header {
        font-size: 0.85rem;
        font-weight: 600;
        color: #333;
        padding: 6px 4px;
        margin-bottom: 4px;
    }

    .stock-expanded-view .stock-expanded-list {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .stock-expanded-view .stock-expanded-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        padding: 0 4px;
        width: 100%;
        box-sizing: border-box;
    }

    .stock-expanded-view .stock-expanded-card {
        background: #fff;
        border: 1px solid #eee;
        border-radius: 6px;
        padding: 8px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
        display: flex;
        align-items: center;
        gap: 6px;
        cursor: pointer;
        min-width: 0;
        overflow: hidden;
    }

    .stock-expanded-view .stock-expanded-card .stock-rank {
        font-size: 0.75rem;
        font-weight: 700;
        color: #e71909;
        min-width: 10px;
        flex-shrink: 0;
    }

    .stock-expanded-view .stock-expanded-card .stock-info {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 1px;
    }

    .stock-expanded-view .stock-expanded-card .stock-name {
        font-size: 0.8rem;
        font-weight: 600;
        color: #333;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .stock-expanded-view .stock-expanded-card .stock-theme {
        font-size: 0.7rem;
        color: #888;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        cursor: pointer;
    }

    .stock-expanded-view .stock-expanded-card .stock-theme[data-theme-id]:hover {
        text-decoration: underline;
    }

    .stock-expanded-view .stock-expanded-card .stock-metrics {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        flex-shrink: 0;
        line-height: 1.2;
    }

    .stock-expanded-view .stock-expanded-card .stock-change {
        font-size: 0.75rem;
        font-weight: 600;
    }

    .stock-expanded-view .stock-expanded-card .stock-change.positive {
        color: #e71909;
    }

    .stock-expanded-view .stock-expanded-card .stock-change.negative {
        color: #0066cc;
    }

    .stock-expanded-view .stock-expanded-card .stock-value {
        font-size: 0.7rem;
        color: #666;
    }

    /* ── 펼쳐진 테마 뷰 스타일 (모바일) ── */
    .theme-expanded-view {
        display: none;
        flex-direction: column;
        padding: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .theme-expanded-view.active {
        display: flex;
    }

    .expanded-sort-bar {
        display: flex;
        gap: 8px;
        margin-bottom: 12px;
        padding: 0 4px;
    }

    .expanded-sort-bar .sort-btn {
        flex: 1;
        padding: 8px 12px;
        font-size: 0.85rem;
        border: 1px solid #ddd;
        background: #f5f5f5;
        color: #333;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.2s;
    }

    .expanded-sort-bar .sort-btn.active {
        background: #e71909;
        color: #fff;
        border-color: #e71909;
    }

    .theme-expanded-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 0 4px;
        width: 100%;
        box-sizing: border-box;
    }

    .theme-card {
        background: #fff;
        border: 1px solid #eee;
        border-radius: 8px;
        padding: 10px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        min-width: 0;
        overflow: hidden;
    }

    .theme-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 8px;
        padding-bottom: 8px;
        border-bottom: 1px solid #f0f0f0;
        gap: 8px;
    }

    .theme-card-name {
        font-size: 0.8rem;
        font-weight: 600;
        color: #333;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex: 1;
        min-width: 0;
        cursor: pointer;
    }

    .theme-card-name:hover {
        text-decoration: underline;
    }

    .theme-card-metrics {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        flex-shrink: 0;
        line-height: 1.2;
    }

    .theme-card-change {
        font-size: 0.7rem;
        font-weight: 600;
        white-space: nowrap;
    }

    .theme-card-change.positive {
        color: #e71909;
    }

    .theme-card-change.negative {
        color: #0066cc;
    }

    .theme-card-value {
        font-size: 0.65rem;
        color: #666;
        white-space: nowrap;
    }

    .theme-card-sort-bar {
        display: flex;
        gap: 4px;
        margin-bottom: 6px;
    }

    .theme-card-sort-bar .card-sort-btn {
        flex: 1;
        padding: 3px 6px;
        font-size: 0.6rem;
        border: 1px solid #ddd;
        background: #f9f9f9;
        color: #666;
        border-radius: 4px;
        cursor: pointer;
        transition: all 0.15s;
    }

    .theme-card-sort-bar .card-sort-btn.active {
        background: #e71909;
        color: #fff;
        border-color: #e71909;
    }

    .theme-card-stocks {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .theme-stock-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 0.7rem;
        padding: 2px 0;
        gap: 6px;
    }

    .theme-stock-item .stock-icon {
        display: none;
    }

    .theme-stock-item .stock-info-col {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-width: 0;
        gap: 1px;
    }

    .theme-stock-item .stock-name {
        color: #333;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        cursor: pointer;
    }

    .theme-stock-item .stock-name:hover {
        text-decoration: underline;
    }

    .theme-stock-item .stock-close {
        font-size: 0.6rem;
        color: #888;
    }

    .theme-stock-item .stock-metrics {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        flex-shrink: 0;
        line-height: 1.2;
    }

    .theme-stock-item .stock-change {
        font-weight: 500;
        white-space: nowrap;
    }

    .theme-stock-item .stock-change.positive {
        color: #e71909;
    }

    .theme-stock-item .stock-change.negative {
        color: #0066cc;
    }

    .theme-stock-item .stock-value {
        font-size: 0.6rem;
        color: #666;
        white-space: nowrap;
    }

    /* 1등주 강조 */
    .theme-stock-item.first .stock-name {
        font-weight: 700;
    }

    .theme-stock-item.first .stock-change {
        font-weight: 700;
    }
}
