* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: #ffffff;
    color: #333333;
    font-family:
        Arial,
        "Noto Sans KR",
        "Malgun Gothic",
        sans-serif;
    font-size: 14px;
}

button,
input {
    font-family: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

.site-container {
    width: min(1380px, calc(100% - 40px));
    margin: 0 auto;
}


/* =========================
   TICKER
========================= */

.market-ticker {
    background: #f4f4f4;
    border-top: 4px solid #574227;
    border-bottom: 1px solid #dddddd;
}

.ticker-inner {
    height: 43px;
    display: flex;
    align-items: center;
    gap: 48px;
    overflow: hidden;
    white-space: nowrap;
}

.ticker-item {
    display: flex;
    gap: 10px;
    align-items: center;
    color: #777;
    font-size: 13px;
}

.ticker-item strong {
    color: #555;
}

.down {
    color: #3778d4;
    font-weight: 700;
}


/* =========================
   HEADER
========================= */

.main-header {
    border-bottom: 1px solid #e5e5e5;
}

.header-row {
    height: 83px;
    display: flex;
    align-items: center;
}

.brand {
    font-size: 28px;
    font-weight: 800;
    color: #111;
    white-space: nowrap;
}

.brand-v {
    display: inline-flex;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    background: #f2643d;
    color: white;
    border-radius: 50%;
    font-size: 13px;
    vertical-align: 3px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 34px;
    margin-left: 55px;
    font-size: 18px;
    font-weight: 700;
}

.main-nav .active {
    color: #ff5a35;
}

.language {
    margin-left: auto;
    color: #777;
}


/* =========================
   SUB HEADER
========================= */

.sub-header {
    border-bottom: 1px solid #ddd;
}

.sub-header-inner {
    height: 80px;
    display: flex;
    align-items: center;
}

.menu-button {
    border: 0;
    background: none;
    font-size: 28px;
    cursor: pointer;
    margin-right: 30px;
}

.sub-nav {
    display: flex;
    gap: 28px;
    font-size: 14px;
}

.sub-nav .active {
    font-weight: 700;
}

.search-box {
    width: 365px;
    height: 48px;
    margin-left: auto;
    border: 1px solid #d6d6d6;
    display: flex;
    background: white;
}

.search-box input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    padding: 0 18px;
    color: #555;
}

.search-box button {
    width: 52px;
    border: 0;
    background: white;
    color: #5382a5;
    font-size: 24px;
    cursor: pointer;
}


/* =========================
   RANKING
========================= */

.ranking-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    padding-top: 35px;
}

.section-head {
    height: 38px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 2px solid #222;
}

.section-head h2 {
    margin: 0;
    font-size: 17px;
}

.section-head span {
    font-size: 14px;
}

.section-head small {
    margin-left: auto;
    color: #aaa;
}

.stock-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.stock-table td {
    padding: 10px 8px;
    border-right: 1px solid #ddd;
    white-space: nowrap;
}

.stock-table td:last-child {
    border-right: 0;
    color: #777;
    text-align: right;
}

.stock-table .rank {
    width: 30px;
    text-align: center;
    font-weight: 700;
}

.stock-table .red {
    color: #ff3b30;
    text-align: right;
}

.stock-table .blue {
    color: #176cff;
    text-align: right;
}


/* =========================
   NEWS
========================= */

.news-layout {
    margin-top: 60px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 390px;
    gap: 35px;
}

.feature-news {
    height: 225px;
    display: grid;
    grid-template-columns: 350px 1fr;
    background: #181b21;
    color: white;
}

.feature-image {
    background: #29303b;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 17px;
}

.feature-content {
    padding: 35px 30px;
}

.feature-content h2 {
    margin: 0 0 25px;
    font-size: 20px;
    line-height: 1.55;
    color: #152235;
}

.feature-content p {
    color: #aaa;
    line-height: 1.9;
    font-size: 13px;
}

.bottom-news-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 45px;
    margin-top: 25px;
}

.policy-news h3,
.gain-ranking h3,
.popular-news h3 {
    border-bottom: 1px solid #aaa;
    padding-bottom: 12px;
    margin: 0 0 13px;
    font-size: 15px;
}

.policy-news a {
    display: block;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    text-decoration: underline;
    line-height: 1.4;
}

.gain-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.gain-header h3 {
    flex: 1;
}

.gain-header button {
    border: 1px solid #ccc;
    background: white;
    padding: 6px 12px;
}

.gain-header .selected {
    background: #f5f5f5;
}

.gain-ranking table {
    width: 100%;
    border-collapse: collapse;
}

.gain-ranking td {
    padding: 11px 8px;
    border-right: 1px solid #ddd;
}

.gain-ranking td:nth-child(3),
.gain-ranking td:nth-child(4) {
    text-align: right;
}

.red {
    color: #ff3737;
}

.popular-news ol {
    margin: 0;
    padding-left: 35px;
}

.popular-news li {
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    line-height: 1.5;
}

.popular-news li::marker {
    color: #ff5b22;
    font-weight: 700;
}


/* =========================
   EXCHANGE
========================= */

.exchange-card {
    margin-top: 55px;
    border: 1px solid #d7d7d7;
    padding: 25px 25px 30px;
    background: white;
}

.exchange-header h2 {
    margin: 0 0 7px;
    font-size: 23px;
    color: #222;
}

.price-line {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.current-price {
    font-size: 44px;
    font-weight: 500;
    color: #10b981;
    letter-spacing: -1px;
}

.change-wrapper {
    color: #10b981;
    font-size: 17px;
}

.realtime {
    color: #777;
    margin-top: 5px;
    font-size: 12px;
}

.chart-divider {
    border-top: 1px solid #ddd;
    margin-top: 17px;
}

.chart-controls {
    display: flex;
    margin-top: 12px;
}

.chart-controls button {
    min-width: 42px;
    height: 35px;
    background: white;
    border: 1px solid #ccc;
    border-right: 0;
    color: #555;
    cursor: pointer;
}

.chart-controls button:last-child {
    border-right: 1px solid #ccc;
}

.chart-controls button.active {
    background: #0d7ce8;
    color: white;
    border-color: #0d7ce8;
}

.chart-area {
    width: 100%;
    height: 365px;
    margin-top: 15px;
    border-bottom: 1px solid #ddd;
    position: relative;
}

.chart-area canvas {
    width: 100% !important;
    height: 100% !important;
}

.exchange-info {
    margin-top: 15px;
}

.info-row {
    min-height: 47px;
    display: grid;
    grid-template-columns:
        180px
        minmax(100px, 1fr)
        180px
        minmax(120px, 1fr);
    align-items: center;
    border-top: 1px solid #e6e6e6;
}

.info-label {
    color: #666;
    padding-left: 12px;
}

.info-value {
    color: #394455;
    font-weight: 700;
}

.right-label {
    padding-left: 40px;
}

.right-value {
    text-align: right;
    padding-right: 12px;
}

.result-bar {
    display: grid;
    grid-template-columns:
        1fr 1fr 1fr 1fr 1fr;
    margin-top: 12px;
    background: #282828;
    color: white;
}

.result-cell {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #111;
    font-size: 16px;
}

.result-cell:last-child {
    border-right: 0;
}

.result-cell.label {
    font-weight: 700;
}

.result-cell.value {
    font-size: 21px;
    font-weight: 700;
}

.result-date {
    text-align: right;
    color: #999;
    font-size: 11px;
    margin-top: 15px;
}


/* =========================
   HISTORY
========================= */

.history-section {
    margin-top: 45px;
    margin-bottom: 50px;
}

.history-title {
    margin: 0 0 22px 5px;
    font-size: 29px;
    color: #333;
}

.history-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.history-table th {
    height: 48px;
    background: #f0f0f0;
    border: 1px solid #d2d2d2;
    font-size: 14px;
    font-weight: 700;
}

.history-table td {
    height: 48px;
    border: 1px solid #d6d6d6;
    text-align: center;
    font-size: 14px;
}

.history-table tbody tr:hover {
    background: #fafafa;
}


/* =========================
   FOOTER
========================= */

.footer-nav {
    border-top: 1px solid #ddd;
}

.footer-nav-inner {
    min-height: 66px;
    display: flex;
    align-items: center;
    gap: 25px;
    flex-wrap: wrap;
}

.footer-nav-inner strong {
    color: #111;
    font-size: 17px;
    margin-right: 20px;
}

.footer-nav-inner a {
    color: #666;
    font-size: 12px;
}

.footer {
    background: #191919;
    color: #aaa;
}

.footer-inner {
    min-height: 170px;
    display: grid;
    grid-template-columns: 230px 1fr 150px;
    align-items: center;
}

.footer-logo {
    color: white;
    font-size: 30px;
    font-weight: 700;
}

.footer-info {
    font-size: 12px;
    line-height: 1.8;
}

.footer-info strong {
    color: #ddd;
}

.footer-info p {
    margin: 3px 0;
}

.footer-language {
    text-align: right;
}


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

@media (max-width: 1100px) {

    .main-nav {
        gap: 18px;
        margin-left: 30px;
    }

    .sub-nav {
        display: none;
    }

    .ranking-section {
        grid-template-columns: 1fr;
    }

    .news-layout {
        grid-template-columns: 1fr;
    }

    .feature-news {
        grid-template-columns: 280px 1fr;
    }

}


@media (max-width: 768px) {

    .site-container {
        width: calc(100% - 24px);
    }

    .ticker-inner {
        gap: 25px;
    }

    .header-row {
        height: 70px;
    }

    .brand {
        font-size: 22px;
    }

    .main-nav {
        display: none;
    }

    .language {
        font-size: 11px;
    }

    .sub-header-inner {
        height: 65px;
    }

    .search-box {
        width: calc(100% - 60px);
    }

    .ranking-section {
        padding-top: 20px;
    }

    .ranking-box {
        overflow-x: auto;
    }

    .stock-table {
        min-width: 650px;
    }

    .news-layout {
        margin-top: 35px;
    }

    .feature-news {
        height: auto;
        grid-template-columns: 1fr;
    }

    .feature-image {
        min-height: 180px;
    }

    .feature-content {
        padding: 25px 20px;
    }

    .bottom-news-grid {
        grid-template-columns: 1fr;
    }

    .exchange-card {
        margin-top: 35px;
        padding: 18px 12px 22px;
    }

    .current-price {
        font-size: 34px;
    }

    .change-wrapper {
        font-size: 14px;
    }

    .chart-area {
        height: 300px;
    }

    .chart-controls {
        overflow-x: auto;
    }

    .chart-controls button {
        flex: 0 0 40px;
    }

    .info-row {
        grid-template-columns: 100px 1fr;
        padding: 8px 0;
    }

    .right-label {
        padding-left: 12px;
    }

    .right-value {
        text-align: left;
        padding-right: 0;
    }

    .result-cell {
        font-size: 12px;
        min-height: 45px;
    }

    .result-cell.value {
        font-size: 16px;
    }

    .history-title {
        font-size: 23px;
    }

    .history-table {
        min-width: 600px;
    }

    .footer-inner {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 35px 0;
    }

    .footer-language {
        text-align: left;
    }

}


@media (max-width: 480px) {

    .market-ticker {
        display: none;
    }

    .price-line {
        flex-wrap: wrap;
        gap: 5px 10px;
    }

    .current-price {
        width: 100%;
    }

    .exchange-header h2 {
        font-size: 19px;
    }

    .chart-area {
        height: 260px;
    }

}