* {
            box-sizing: border-box;
        }

        :root {
            --bg-page: #0d1017;
            --bg-panel: #131722;
            --bg-panel-header: #1c2030;
            --border-color: #2a2e39;
            --text-primary: #ffffff;
            --text-secondary: #b2b5be;
            --accent: #2962ff;
            --chart-background: #0f0f0f;
            --chart-grid-color: rgba(242, 242, 242, 0.2);
        }

        body.light-mode {
            --bg-page: #f4f5f8;
            --bg-panel: #ffffff;
            --bg-panel-header: #eef0f5;
            --border-color: #dde1e8;
            --text-primary: #16181d;
            --text-secondary: #5b6270;
            --chart-background: #ffffff;
            --chart-grid-color: rgba(42, 46, 57, 0.15);
        }

        html,
        body {
            margin: 0;
            padding: 0;
            width: 100%;
            max-width: 100%;
            overflow-x: hidden;
            background-color: var(--bg-page);
            color: var(--text-primary);
            font-family: sans-serif;
            transition:
                background-color 0.2s ease,
                color 0.2s ease;
        }

        body {
            padding-top: 50px;
            min-height: 100vh;
        }

        main,
        #footer,
        .seo-info {
            max-width: 1440px;
            margin-left: auto;
            margin-right: auto;
        }

        /* =====================================================
           0. TOP FIXED MENU BAR
           ===================================================== */

        #top-menu-bar {
            position: fixed;
            top: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 100%;
            max-width: 1440px;
            height: 50px;

            background: var(--bg-panel-header);
            border-bottom: 2px solid var(--border-color);

            display: flex;
            align-items: center;
            justify-content: space-between;

            padding: 0 20px;
            z-index: 100001;
            box-sizing: border-box;
        }

        #top-menu-brand {
            font-weight: bold;
            font-size: 14px;
            color: var(--text-primary);
            white-space: nowrap;
            flex-shrink: 0;
        }

        #top-menu-items {
            flex: 1;
            min-width: 0;
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 0 20px;
            overflow-x: auto;
            scrollbar-width: thin;
        }

        #top-menu-controls {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        #theme-toggle-btn {
            background: var(--bg-panel);
            border: 1px solid var(--border-color);
            color: var(--text-primary);

            padding: 7px 14px;
            font-size: 12px;
            font-weight: bold;

            border-radius: 6px;
            cursor: pointer;
            white-space: nowrap;

            transition: all 0.2s ease;
        }

        #theme-toggle-btn:hover {
            border-color: var(--accent);
        }

        #top-menu-controls {
        display: flex;
        gap: 8px; /* 버튼 사이 간격 격자 지정 */
        align-items: center;
        }

        #lang-toggle-btn {
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            color: inherit;
            padding: 6px 12px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 12px;
            font-weight: bold;
        }

        #lang-toggle-btn:hover {
            background: rgba(255, 255, 255, 0.2);
        }

        /* =====================================================
           1. ADVERTISEMENT
           ===================================================== */

        #adv-banner {
            height: 50px;
            width: 100%;

            background: var(--bg-panel-header);
            border-bottom: 2px solid var(--border-color);
            border-top: 2px solid var(--border-color);

            display: flex;
            justify-content: center;
            align-items: center;

            color: var(--text-secondary);
            font-size: 12px;
            font-weight: bold;
        }

        /* =====================================================
           2. MARKET TICKER
           ===================================================== */

        #ticker-container {
            height: 40px;
            width: 100%;

            background: var(--bg-page);
            border-bottom: 2px solid var(--border-color);

            overflow: hidden;
        }

        /* =====================================================
           3. COMMON PANEL
           ===================================================== */

        .panel {
            margin: 18px 20px;

            border-radius: 10px;
            overflow: hidden;

            background: var(--bg-panel);
            border: 1px solid var(--border-color);

            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
        }

        .panel-header {
            padding: 10px 16px;

            font-size: 13px;
            font-weight: bold;

            color: var(--text-secondary);
            background: var(--bg-panel-header);

            border-bottom: 1px solid var(--border-color);

            display: flex;
            align-items: center;
            justify-content: space-between;

            flex-wrap: wrap;
            gap: 8px;
        }

        .panel-header .title {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        /* =====================================================
           CHART TOOLBAR
           ===================================================== */

        .charts-toolbar {
            display: flex;
            gap: 8px;
            align-items: center;
            flex-wrap: wrap;
        }

        .charts-toolbar input {
            background: var(--bg-panel);
            border: 1px solid var(--border-color);
            color: var(--text-primary);

            border-radius: 4px;
            padding: 6px 10px;

            font-size: 12px;
            width: 190px;
        }

        .charts-toolbar button,
        .tab-btn {
            background: var(--accent);
            border: none;
            color: #fff;

            padding: 7px 14px;

            font-size: 12px;
            font-weight: bold;

            border-radius: 4px;
            cursor: pointer;

            transition: all 0.2s ease;
            white-space: nowrap;
        }

        .charts-toolbar button:hover {
            background: #1e50e0;
        }

        .charts-toolbar button:disabled {
            background: var(--border-color);
            cursor: not-allowed;
            color: var(--text-secondary);
        }

        /* =====================================================
           4. CHART GRID
           ===================================================== */

        #charts-grid {
            display: grid;
            grid-template-columns:
                repeat(auto-fit, minmax(min(100%, 420px), 1fr));
            gap: 16px;
            padding: 16px;
        }

        .chart-panel {
            background: var(--chart-background);

            border: 1px solid var(--border-color);
            border-radius: 8px;

            overflow: hidden;
        }

        .chart-panel-header {
            display: flex;
            justify-content: space-between;
            align-items: center;

            padding: 6px 10px;

            background: var(--bg-panel-header);

            font-size: 12px;
            color: var(--text-secondary);
        }

        .chart-remove-btn {
            background: transparent;
            border: none;

            color: var(--text-secondary);

            cursor: pointer;

            font-size: 14px;
            line-height: 1;

            padding: 2px 6px;
            border-radius: 3px;
        }

        .chart-remove-btn:hover {
            background: var(--border-color);
            color: #ff4d4f;
        }

        .chart-panel-body {
            height: clamp(300px, 42vw, 400px);
            width: 100%;
        }

        .chart-watchlist-select {
            background: var(--bg-panel-header);
            color: var(--text-primary);
            border: 1px solid var(--border-color);
            border-radius: 4px;
            padding: 2px 6px;
            font-size: 12px;
            cursor: pointer;
            outline: none;
        }

        /* =====================================================
           5. TAB MENU
           ===================================================== */

        #tab-menu-bar {
            display: flex;
            align-items: center;

            padding: 12px 16px;

            gap: 10px;
            flex-wrap: wrap;

            background: var(--bg-panel-header);

            border-bottom: 1px solid var(--border-color);
        }

        .tab-btn {
            background: var(--border-color);
            color: var(--text-secondary);
        }

        .tab-btn:hover {
            background: var(--accent);
            color: #fff;
        }

        .tab-btn.active {
            background: var(--accent);
            color: #fff;

            box-shadow: 0 0 10px rgba(41, 98, 255, 0.5);
        }

        /* =====================================================
           6. TAB CONTENT
           ===================================================== */

        #dynamic-content-area {
            width: 100%;

            padding: 16px;

            background: var(--bg-panel);
        }

        .tab-content {
            width: 100%;
            height: clamp(420px, 55vh, 550px);

            display: none;
        }

        .tab-content.visible {
            display: block;
        }

        iframe,
        .tradingview-widget-container {
            width: 100% !important;
            height: 100% !important;

            border: none !important;
            display: block;
        }

        /* =====================================================
           7. SEO CONTENT
           ===================================================== */

/* 1. 가장 바깥쪽 details 태그의 브라우저 기본 여백을 초기화하고 강제 가두기 */
details.seo-info {
    width: 100%;
    box-sizing: border-box;
    margin: 20px auto;
    padding: 0; /* 브라우저 기본 패딩 원천 차단 */
}

/* 2. 접고 펴는 제목 부위도 양옆 공간을 깔끔하게 맞춤 */
details.seo-info summary {
    padding: 12px 20px;
    cursor: pointer;
    font-weight: bold;
    outline: none;
}

/* 3. 본문 상자 (여기가 텍스트를 감싸는 가두리 양식장) */
.seo-content {
    padding: 24px 24px !important; /* 안쪽 여백 상하좌우 24px 강제 고정 */
    margin: 10px 20px !important;  /* 상자 자체가 테두리에 붙지 않게 바깥 여백 강제 고정 */
    
    max-width: 1280px; 
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    line-height: 1.7;
    box-sizing: border-box !important; /* 중요: 패딩이 늘어나도 박스가 안 깨지게 함 */
}

/* 4. HTML에 새로 추가된 h3 태그 스타일도 h2와 동일하게 교정 */
.seo-content h2,
.seo-content h3 {
    margin: 24px 0 8px !important; /* 위아래 간격을 주어 문단과 딱 붙지 않게 차단 */
    color: var(--text-primary);
    font-size: 18px;
    line-height: 1.4;
    display: block; /* 줄바꿈 확실히 처리 */
}

/* 첫 번째 제목의 윗 여백은 너무 벌어지지 않게 0으로 리셋 */
.seo-content h2:first-child,
.seo-content h3:first-child {
    margin-top: 0 !important;
}

/* 5. 본문 문단 정렬 */
.seo-content p {
    margin: 0 0 16px !important; /* 문단과 문단 사이 하단 여백 확보 */
    font-size: 14px;
    display: block;
}


        /* =====================================================
           8. FLOATING CHAT
           ===================================================== */

        #floating-chat {
            position: fixed;

            bottom: 35px;
            right: 20px;

            width: min(360px, calc(100vw - 20px));
            height: 420px;

            min-width: 280px;
            min-height: 44px;

            max-width: 90vw;
            max-height: 85vh;

            background: #1c2030;

            border: 2px solid #00bcd4;
            border-radius: 8px;

            display: flex;
            flex-direction: column;

            z-index: 99999;

            box-shadow: 0 5px 25px rgba(0, 0, 0, 0.7);

            resize: both;
            overflow: hidden;
        }

        #floating-chat.collapsed {
    /* 1. [추가] 접혔을 때 원하는 가로 길이를 지정합니다 (예: 150px) */
    width: 40px !important; 
    max-width: 40px !important; 

    /* 기존 코드 */
    height: 44px !important;
    min-height: 44px;
    resize: none;
    overflow: hidden;
}


#chat-header {
    background: #131722;

    padding: 8px 10px;

    font-weight: bold;
    font-size: 13px;

    color: #00bcd4;

    border-top-left-radius: 6px;
    border-top-right-radius: 6px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    flex-shrink: 0;

    cursor: default;
    user-select: none;

    border-bottom: 1px solid #252a36;
}

        .chat-header-btns {
            display: flex;
            gap: 4px;
        }

.chat-header-btns button {
    background: #1c2030;

    border: 1px solid #2a3040;

    color: #00bcd4;

    width: 22px;
    height: 22px;

    border-radius: 4px;

    cursor: pointer;

    font-size: 12px;

    display: flex;
    align-items: center;
    justify-content: center;
}

  .chat-header-btns button:hover {
    background: #252a36;
    border-color: #00bcd4;
}
               .chat-header {
            background-color: #24293e;
            padding: 12px;
            font-weight: bold;
            display: flex;
            justify-content: space-between;
            border-bottom: 1px solid #2d3142;
        }
        #chat-messages {
            flex: 1;
            padding: 15px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        .chat-system {
            text-align: center;
            color: #848e9c;
            font-size: 0.85rem;
            background: #24293e;
            padding: 6px;
            border-radius: 4px;
        }
        .chat-msg {
            background-color: #24293e;
            padding: 8px 12px;
            border-radius: 6px;
            max-width: 85%;
            align-self: flex-start;
        }
        .chat-msg-meta {
            font-size: 0.75rem;
            color: #2962ff;
            margin-bottom: 4px;
            display: flex;
            gap: 8px;
        }
        .chat-msg-time { color: #848e9c; }
        .chat-msg-text { word-break: break-all; font-size: 0.95rem; }
        #chat-form {
            display: flex;
            padding: 10px;
            background-color: #1e2235;
            border-top: 1px solid #2d3142;
        }
        #chat-nickname {
            width: 80px;
            background: #131722;
            border: 1px solid #2d3142;
            color: white;
            padding: 8px;
            border-radius: 4px;
            margin-right: 6px;
            font-size: 0.85rem;
        }
        #chat-input {
            flex: 1;
            background: #131722;
            border: 1px solid #2d3142;
            color: white;
            padding: 8px;
            border-radius: 4px;
            outline: none;
        }
        #chat-send-btn {
            background-color: #2962ff;
            color: white;
            border: none;
            padding: 8px 14px;
            margin-left: 6px;
            border-radius: 4px;
            cursor: pointer;
            font-weight: bold;
        }
#chat-box {
    flex: 1;

    width: 100%;

    background: #0d1017;

    color: #d1d4dc;

    position: relative;

    overflow: hidden;

    min-height: 0;
}
         #chat-form {
            display: flex;
            padding: 10px;
            background-color: #1e2235;
            border-top: 1px solid #2d3142;
        }
        #floating-chat.collapsed #chat-box {
            display: none;
        }

        /* =====================================================
           9. FOOTER
           ===================================================== */

        #footer {
            width: 100%;
            background: var(--bg-page);
            font-size: 11px;
            color: var(--text-secondary);
            text-align: center;
            
            /* 💡 [교정] 영문 글귀가 많아졌으므로 위아래 안쪽 여백(Padding)을 30px로 넉넉히 넓혔습니다 */
            padding: 30px 15px; 
            border-top: 1px solid var(--border-color);
            line-height: 1.6; /* 💡 [추가] 행간을 넓혀서 영문 줄바꿈 시 글자가 겹치지 않게 조절 */
        }

        /* 💡 [추가] 하단 약관 링크들을 가로로 예쁘게 나열해 주는 디자인 규칙 */
        .footer-links {
            margin: 15px 0;
            display: flex;
            justify-content: center;
            gap: 12px;
            flex-wrap: wrap;
        }

        .footer-links a {
            color: var(--text-secondary);
            text-decoration: none;
        }

        .footer-links a:hover {
            color: var(--text-primary); /* 마우스를 올렸을 때 불빛이 들어오는 효과 */
        }
        /* 기존 footer 스타일 아래에 그대로 붙여넣으세요 */
        .footer-email {
            margin-top: 15px;
            font-size: 12px;
            color: var(--text-secondary);
        }

        .footer-email a {
            color: var(--accent); /* 사장님이 지정해 두신 파란색 포인트 컬러 적용 */
            text-decoration: none;
            font-weight: bold;
        }

        .footer-email a:hover {
            text-decoration: underline; /* 마우스 올리면 밑줄 생기는 효과 */
        }

        /* =====================================================
           MOBILE RESPONSIVE
           ===================================================== */

        @media (max-width: 900px) {
            #charts-grid {
                grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
            }

            .panel {
                margin: 14px 12px;
            }
        }

        @media (max-width: 700px) {

            body {
                padding-top: 72px;
            }

            #top-menu-bar {
                height: auto;
                min-height: 50px;
                padding: 8px 10px;
                flex-wrap: wrap;
                gap: 6px;
            }

            #top-menu-brand {
                font-size: 12px;
            }

            #top-menu-items {
                order: 3;
                width: 100%;
                padding: 0;
            }

            #charts-grid {
                grid-template-columns: 1fr;
                padding: 10px;
            }

            .panel {
                margin: 12px 10px;
            }

            .chart-panel-body {
                height: 300px;
            }

            .seo-content {
                margin: 12px 10px;
                padding: 22px 20px;
            }

            .seo-content h1 {
                font-size: 21px;
            }

            .seo-content h2 {
                font-size: 17px;
            }

            #floating-chat {
                right: 10px;
                bottom: 45px;

                width: min(320px, calc(100vw - 20px));
                max-width: calc(100vw - 20px);
            }
        }
.seo-info {
    max-width: 1400px;
    margin: 15px auto;
    padding: 0 15px;
    font-size: 12px;
    color: #888;
}

.seo-info summary {
    cursor: pointer;
    padding: 6px 0;
    font-size: 12px;
    color: #777;
}

.seo-content {
    line-height: 1.6;
    padding: 10px 0 20px;
}

.seo-content h2,
.seo-content h3 {
    font-size: 13px;
    margin: 12px 0 5px;
}

.seo-content p {
    margin: 0 0 8px;
}
/* =====================================================
   CRYPTO NEWS
   ===================================================== */

.crypto-news-content {
    height: 550px;
    overflow-y: auto;
    padding: 0 !important;
}

.crypto-news-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-panel-header);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 5;
}

.crypto-news-filter {
    background: var(--border-color);
    color: var(--text-secondary);
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
}

.crypto-news-filter.active,
.crypto-news-filter:hover {
    background: var(--accent);
    color: #fff;
}

.crypto-news-list {
    width: 100%;
}

.crypto-news-item {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
}

.crypto-news-item:hover {
    background: var(--bg-panel-header);
}
.crypto-news-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 10px;
    color: var(--text-secondary);
}

.crypto-news-source {
    font-weight: bold;
    color: var(--accent);
}

.crypto-news-time {
    color: var(--text-secondary);
}

.crypto-news-title {
    display: block;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: bold;
    line-height: 1.45;
}

.crypto-news-title:hover {
    color: var(--accent);
}

.crypto-news-loading,
.crypto-news-error,
.crypto-news-load-more,
.crypto-news-end {
    padding: 30px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
}

.crypto-news-load-more,
.crypto-news-end {
    padding: 16px;
}

.crypto-news-end {
    opacity: 0.75;
}
