/* ===========================
   기본 설정
=========================== */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    background: #121212;
    color: white;
    text-align: center;
    font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ===========================
   게임 페이지 — 첫 화면 꽉 채움
=========================== */
#gamePage {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ===========================
   헤더 타이틀 + 소리 버튼
=========================== */
#headerTitle {
    position: relative;
    font-size: 17px;
    padding: 0 52px;
    height: 44px;
    line-height: 44px;
    background: #1f1f1f;
    border-bottom: 1px solid #333;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

#muteBtn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #2a7aff;
    border: none;
    border-radius: 20px;
    color: white;
    font-size: 12px;
    font-weight: 700;
    height: 32px;
    min-width: 68px;
    padding: 0 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    transition: opacity 0.15s;
}

#gameSwitchBtn {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #3a3a55;
    border: 1px solid #5a5a80;
    border-radius: 20px;
    color: white;
    font-size: 11px;
    font-weight: 700;
    height: 32px;
    padding: 0 9px;
    cursor: pointer;
    white-space: nowrap;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

#gameSwitchBtn:active {
    opacity: 0.7;
    transform: translateY(-50%) scale(0.95);
}

#muteBtn.muted {
    background: #444;
    color: #888;
}

#muteBtn:active {
    opacity: 0.7;
    transform: translateY(-50%) scale(0.95);
}

/* ===========================
   게임 캔버스
=========================== */
#gameWrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
}

#gameCanvas {
    display: block;
    background: black;
    border-radius: 0;
    touch-action: none;
    max-width: 100%;
}

/* ===========================
   행운 번호 표시
=========================== */
#luckyNumbers {
    height: 32px;
    line-height: 32px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 1px;
    overflow: hidden;
    flex-shrink: 0;
}

/* ===========================
   공유 버튼
=========================== */
#shareButtons {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
    flex-shrink: 0;
}

#shareButtons.visible {
    opacity: 1;
    pointer-events: auto;
}

#shareButtons button {
    flex: 1;
    max-width: 108px;
    height: 34px;
    font-size: 12px;
    font-weight: 700;
    border: none;
    border-radius: 17px;
    color: white;
    background: linear-gradient(135deg, #3d7bff, #365ed6);
    cursor: pointer;
    white-space: nowrap;
    touch-action: manipulation;
}

#shareButtons button:active {
    opacity: 0.75;
    transform: scale(0.96);
}

/* ===========================
   스크롤 유도
=========================== */
#scrollHint {
    height: 28px;
    line-height: 28px;
    font-size: 11px;
    color: #555;
    flex-shrink: 0;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(3px); }
}

/* ===========================
   콘텐츠 영역
=========================== */
#contentArea {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 16px 32px;
    text-align: left;
}

.info-section {
    background: #1e1e1e;
    border-radius: 14px;
    padding: 20px 16px;
    margin: 16px 0;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 6px;
    color: #fff;
}

.section-desc {
    font-size: 12px;
    color: #888;
    margin: 0 0 14px;
}

/* ===========================
   내 번호 기록
=========================== */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.history-item {
    background: #2a2a2a;
    border-radius: 10px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-date {
    font-size: 10px;
    color: #555;
    white-space: nowrap;
}

.history-balls {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
    justify-content: flex-start;
}

.ball {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.ball.b1  { background: #f0ad00; }
.ball.b2  { background: #69c8f2; }
.ball.b3  { background: #ff6363; }
.ball.b4  { background: #aaa; }
.ball.b5  { background: #b0d840; color: #333; }

.empty-msg {
    font-size: 13px;
    color: #666;
    text-align: center;
    padding: 16px 0;
    margin: 0;
    line-height: 1.8;
}

.toggle-btn {
    background: none;
    border: 1px solid #2a7aff;
    color: #2a7aff;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    display: block;
    margin: 8px auto 4px;
    width: 100%;
}

.toggle-btn:active { opacity: 0.6; }

.clear-btn {
    background: none;
    border: 1px solid #444;
    color: #666;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 11px;
    cursor: pointer;
    display: block;
    margin: 6px auto 0;
}

.clear-btn:active { opacity: 0.6; }

/* ===========================
   번호 통계
=========================== */
.stats-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.tab-btn {
    flex: 1;
    height: 34px;
    border: 1px solid #444;
    border-radius: 8px;
    background: none;
    color: #888;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.tab-btn.active {
    background: #2a7aff;
    border-color: #2a7aff;
    color: white;
}

.stats-chart {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.stat-bar-wrap {
    flex: 1;
    height: 14px;
    background: #2a2a2a;
    border-radius: 7px;
    overflow: hidden;
}

.stat-bar {
    height: 100%;
    border-radius: 7px;
    background: linear-gradient(90deg, #2a7aff, #5aa0ff);
    transition: width 0.4s ease;
}

.stat-bar.cold {
    background: linear-gradient(90deg, #4a9eff88, #4a9eff44);
}

.stat-count {
    width: 32px;
    font-size: 11px;
    color: #888;
    text-align: right;
    flex-shrink: 0;
}

.stats-note {
    font-size: 11px;
    color: #555;
    margin: 10px 0 0;
    text-align: right;
}

/* ===========================
   최신 당첨번호
=========================== */
.latest-result {
    text-align: center;
}

.latest-round {
    font-size: 13px;
    color: #888;
    margin-bottom: 10px;
}

.latest-balls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.ball-bonus {
    position: relative;
}

.ball-bonus::before {
    content: '보';
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: #aaa;
}

.latest-prize {
    margin-top: 14px;
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.prize-item {
    background: #2a2a2a;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 12px;
    color: #ccc;
    text-align: center;
}

.prize-item strong {
    display: block;
    font-size: 15px;
    color: #f0ad00;
    margin-top: 2px;
}

.stale-note,
.compare-note {
    font-size: 11px;
    font-weight: 400;
    color: #888;
    margin: 10px 0 0;
    line-height: 1.6;
}

.compare-area {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #2a2a2a;
}

.compare-title {
    font-size: 13px;
    color: #888;
    margin: 0 0 8px;
    text-align: center;
}

#compareResult {
    text-align: center;
    font-size: 14px;
    font-weight: 700;
}

.loading-msg {
    font-size: 13px;
    color: #666;
    text-align: center;
    padding: 12px 0;
    margin: 0;
}

/* ===========================
   D-day
=========================== */
.dday-count {
    font-size: 48px;
    font-weight: 900;
    color: #2a7aff;
    text-align: center;
    margin: 8px 0 4px;
    letter-spacing: -1px;
}

/* ===========================
   당첨 기준 테이블
=========================== */
.guide-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.guide-table th {
    background: #2a2a2a;
    color: #aaa;
    padding: 8px 10px;
    font-weight: 600;
    text-align: center;
}

.guide-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #2a2a2a;
    text-align: center;
    color: #ccc;
}

.guide-table tr:first-child td { color: #f0ad00; font-weight: 700; }
.guide-table tr:last-child td  { border-bottom: none; }

/* ===========================
   푸터
=========================== */
.site-footer {
    max-width: 640px;
    margin: 0 auto;
    padding: 20px 16px 28px;
    border-top: 1px solid #2a2a2a;
    text-align: center;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 14px;
    margin-bottom: 12px;
}

.footer-nav a {
    font-size: 12px;
    color: #888;
    text-decoration: none;
}

.footer-nav a:hover { color: #2a7aff; }

.footer-copy {
    font-size: 11px;
    color: #444;
    margin: 0;
    line-height: 1.7;
}

/* ===========================
   아티클 페이지
=========================== */
.article-page {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 16px 32px;
    text-align: left;
}

.article-header {
    padding: 20px 0 6px;
}

.article-header a.home-link {
    font-size: 13px;
    color: #2a7aff;
    text-decoration: none;
}

.article-page h1 {
    font-size: 22px;
    font-weight: 800;
    line-height: 1.4;
    margin: 12px 0 4px;
}

.article-date {
    font-size: 12px;
    color: #666;
    margin: 0 0 20px;
}

.article-page h2 {
    font-size: 17px;
    font-weight: 700;
    margin: 28px 0 10px;
    color: #fff;
}

.article-page p,
.article-page li {
    font-size: 14px;
    line-height: 1.8;
    color: #ccc;
}

.article-page ul,
.article-page ol {
    padding-left: 22px;
    margin: 8px 0 16px;
}

.article-page table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin: 10px 0 16px;
}

.article-page th {
    background: #2a2a2a;
    color: #aaa;
    padding: 8px 10px;
    font-weight: 600;
    text-align: center;
}

.article-page td {
    padding: 8px 10px;
    border-bottom: 1px solid #2a2a2a;
    text-align: center;
    color: #ccc;
}

.article-page .note-box {
    background: #1e1e1e;
    border-left: 3px solid #2a7aff;
    border-radius: 0 10px 10px 0;
    padding: 12px 14px;
    margin: 14px 0;
    font-size: 13px;
    color: #aaa;
    line-height: 1.7;
}

/* ===========================
   읽을거리
=========================== */
.story-list {
    display: grid;
    gap: 10px;
    margin: 16px 0 8px;
}

.story-card {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 14px 16px;
    background: #262633;
    border-radius: 12px;
    color: #fff;
    text-decoration: none;
    text-align: left;
}

.story-card:hover { background: #30303f; }

.story-card strong {
    font-size: 15px;
    line-height: 1.45;
}

.story-tag {
    align-self: flex-start;
    font-size: 11px;
    font-weight: 700;
    color: #8fb4ff;
}

.story-desc {
    font-size: 13px;
    line-height: 1.6;
    color: #aaa;
}

.story-more {
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
}

.story-sources {
    margin-top: 32px;
    padding-top: 8px;
    border-top: 1px solid #2a2a2a;
}

.story-sources h2 {
    font-size: 14px;
    margin-top: 12px;
    color: #aaa;
}

.article-page .story-sources li,
.article-page .story-sources p {
    font-size: 12px;
    color: #888;
}

.story-sources a {
    color: #8fb4ff;
    word-break: break-all;
}

.story-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 24px 0 8px;
}

.story-nav a {
    flex: 1;
    font-size: 13px;
    line-height: 1.5;
    color: #8fb4ff;
    text-decoration: none;
}

.story-nav a:last-child { text-align: right; }

/* ===========================
   PC (769px 이상)
=========================== */
@media (min-width: 769px) {

    #gamePage {
        min-height: 100dvh;
    }

    #headerTitle {
        font-size: 20px;
        height: 52px;
        line-height: 52px;
        padding: 0 64px;
    }

    #muteBtn {
        right: 14px;
        height: 36px;
        min-width: 76px;
        font-size: 13px;
    }

    #gameSwitchBtn {
        left: 14px;
        height: 36px;
        font-size: 13px;
        padding: 0 12px;
    }

    #gameCanvas {
        border-radius: 10px;
    }

    #luckyNumbers {
        height: 40px;
        line-height: 40px;
        font-size: 20px;
    }

    #shareButtons {
        height: 52px;
        gap: 12px;
    }

    #shareButtons button {
        max-width: 130px;
        height: 40px;
        font-size: 14px;
    }

    #contentArea {
        max-width: 720px;
        padding: 0 24px 40px;
    }

    .info-section {
        padding: 24px 24px;
    }

    .section-title {
        font-size: 18px;
    }

    .dday-count {
        font-size: 64px;
    }

    .article-page {
        max-width: 720px;
        padding: 0 24px 40px;
    }

    .article-page h1 { font-size: 26px; }
    .article-page h2 { font-size: 19px; }
    .article-page p,
    .article-page li { font-size: 15px; }
}
