:root {
    --bg-color: #f0f2f5;
    --container-bg: white;
    --text-color: #333;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --placeholder-color: #888;
}

body.dark-mode {
    --bg-color: #1a1a1a;
    --container-bg: #2d2d2d;
    --text-color: #f0f2f5;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --placeholder-color: #bbb;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    transition: background-color 0.3s, color 0.3s;
}

/* 상단 컨트롤 버튼 그룹 */
.top-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 100;
}

.control-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: transform 0.2s, background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    transform: scale(1.1);
    background-color: rgba(0,0,0,0.1);
}

body.dark-mode .control-btn:hover {
    background-color: rgba(255,255,255,0.1);
}

.donate-btn {
    font-size: 1rem;
    border-radius: 20px;
    padding: 8px 16px;
    background-color: #ff4081;
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.donate-btn:hover {
    background-color: #f50057;
    transform: translateY(-2px);
}

/* 모달 스타일 */
.modal {
    display: none;
    position: fixed;
    z-index: 200;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(3px);
}

.modal-content {
    background-color: var(--container-bg);
    margin: 5% auto; /* 상단 여백 줄임 (내용이 많아져서) */
    padding: 2rem;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 10px;
    right: 20px;
}

.close-btn:hover,
.close-btn:focus {
    color: var(--text-color);
    text-decoration: none;
}

.donate-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.donate-info {
    color: var(--placeholder-color);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.modal-btn {
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    background-color: #f0f0f0;
    color: #333;
    transition: background-color 0.2s;
    font-weight: bold;
}

.modal-btn:hover {
    background-color: #e0e0e0;
}

.coffee-btn {
    background-color: #FFDD00;
    color: #000;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.coffee-btn:hover {
    background-color: #FFEA00;
    transform: translateY(-2px);
}

/* QR코드 이미지 스타일 */
.qr-image {
    max-width: 200px;
    width: 100%;
    height: auto;
    border-radius: 10px;
    border: 1px solid #ddd;
    margin-top: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.container {
    background-color: var(--container-bg);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 6px var(--shadow-color);
    text-align: center;
    max-width: 600px;
    width: 90%;
    transition: background-color 0.3s, box-shadow 0.3s;
}

h1 {
    color: var(--text-color);
    margin-bottom: 2rem;
}

.result-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    min-height: 60px;
    align-items: center;
}

.ball {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: white;
    font-size: 1.2rem;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    animation: popIn 0.3s ease-out;
}

/* 모바일 화면 최적화 */
@media (max-width: 480px) {
    .ball {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    .game-row {
        gap: 5px; /* 모바일에서 간격 줄임 */
        padding: 5px;
    }

    .container {
        padding: 1.5rem;
    }

    h1 {
        font-size: 1.5rem;
    }
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    80% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* 로또 번호 대역별 색상 */
.ball.range-1 { background-color: #fbc400; text-shadow: 1px 1px 2px rgba(0,0,0,0.3); } /* 1-10 노랑 */
.ball.range-2 { background-color: #69c8f2; } /* 11-20 파랑 */
.ball.range-3 { background-color: #ff7272; } /* 21-30 빨강 */
.ball.range-4 { background-color: #aaaaaa; } /* 31-40 회색 */
.ball.range-5 { background-color: #b0d840; } /* 41-45 초록 */

.placeholder {
    color: var(--placeholder-color);
    font-style: italic;
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 2rem;
}

.action-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    flex: 1;
    max-width: 150px;
}

.action-btn:hover {
    background-color: #45a049;
}

.action-btn:active {
    transform: translateY(1px);
}

#generateFiveBtn {
    background-color: #2196F3;
}

#generateFiveBtn:hover {
    background-color: #1976D2;
}

.game-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px;
    background-color: rgba(0,0,0,0.03);
    border-radius: 10px;
    flex-wrap: wrap;
}

body.dark-mode .game-row {
    background-color: rgba(255,255,255,0.05);
}

.footer {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: var(--placeholder-color);
    opacity: 0.7;
}