/* 전체 스타일 초기화 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* 인증 팝업 스타일 */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.popup-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    min-width: 300px;
}

.popup-content h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 24px;
}

.popup-content input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    text-align: center;
}

.popup-content button {
    background: #4CAF50;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.popup-content button:hover {
    background: #45a049;
}

.error-message {
    color: #ff4444;
    margin-top: 10px;
    font-size: 14px;
}

/* 메인 콘텐츠 */
.main-content {
    display: none;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.main-content.active {
    display: block;
}

/* 배너 스타일 */
.banner {
    text-align: center;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #333;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.banner h1 {
    font-size: 2.5em;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* 주의 문구 스타일 */
.warning-notice {
    background: #fff3cd;
    border: 2px solid #ffeaa7;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.warning-notice p {
    font-size: 16px;
    font-weight: bold;
    color: #856404;
}

/* 로또 머신 컨테이너 */
.lottery-machine-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
}

.attempts-counter {
    position: absolute;
    top: -10px;
    right: 20px;
    background: #ff6b6b;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 로또 머신 스타일 */
.lottery-machine {
    text-align: center;
    padding: 20px;
}

.machine-body {
    background: linear-gradient(145deg, #e0e0e0, #f0f0f0);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: inset 0 5px 15px rgba(0, 0, 0, 0.1);
}

.ball-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* 로또 공 스타일 */
.lottery-ball {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    transition: transform 0.3s ease;
    background: linear-gradient(145deg, #999999, #666666);
}

.lottery-ball:hover {
    transform: scale(1.1);
}

.lottery-ball.spinning {
    animation: spin 1s linear infinite;
    background: linear-gradient(45deg, #ff6b6b, #ffa500);
}

.lottery-ball.revealed {
    animation: reveal 0.5s ease-in-out;
}

/* 로또 공 색상 (번호에 따라) */
.lottery-ball[data-color="yellow"] {
    background: linear-gradient(145deg, #FFD700, #FFA500);
}

.lottery-ball[data-color="blue"] {
    background: linear-gradient(145deg, #4169E1, #0066CC);
}

.lottery-ball[data-color="red"] {
    background: linear-gradient(145deg, #FF6B6B, #FF4444);
}

.lottery-ball[data-color="black"] {
    background: linear-gradient(145deg, #333333, #000000);
}

.lottery-ball[data-color="green"] {
    background: linear-gradient(145deg, #4CAF50, #2E7D32);
}

/* 시작/정지 버튼 */
.start-stop-btn {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 20px;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.start-stop-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.3);
}

.start-stop-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
}

.start-stop-btn.stop {
    background: linear-gradient(45deg, #ff6b6b, #ff4444);
}

/* 결과 섹션 */
.results-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.results-section h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
    font-size: 24px;
}

.result-row {
    display: flex !important;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: nowrap !important;
    flex-direction: row !important;
}

.result-label {
    font-weight: bold;
    margin-right: 10px;
    min-width: 60px;
}

.result-numbers {
    display: flex !important;
    justify-content: center;
    gap: 8px;
    flex-wrap: nowrap !important;
    flex-direction: row !important;
}

.screenshot-btn {
    display: block;
    margin: 20px auto;
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.screenshot-btn:hover {
    background: #545b62;
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* 당첨번호 테이블 섹션 */
.winning-numbers-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.winning-numbers-section h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
    font-size: 24px;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

table th,
table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #ddd;
}

table th {
    background: #f8f9fa;
    font-weight: bold;
    color: #333;
}

table tr:hover {
    background: #f5f5f5;
}

/* 카운트 업 효과 */
.count-up {
    display: inline-block;
    font-weight: bold;
    color: #004EA2;
    animation: countUpPulse 0.8s ease-in-out;
    transition: all 0.3s ease;
}

@keyframes countUpPulse {
    0% { 
        transform: scale(1);
        opacity: 0.8;
    }
    30% { 
        transform: scale(1.05);
        opacity: 1;
    }
    70% { 
        transform: scale(1.02);
        opacity: 1;
    }
    100% { 
        transform: scale(1);
        opacity: 1;
    }
}

.winning-numbers {
    display: flex;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
}

.winning-numbers .lottery-ball {
    width: 35px;
    height: 35px;
    font-size: 16px;
}

.bonus-ball {
    margin-left: 10px;
    border: 2px solid #ff6b6b !important;
    width: 35px;
    height: 35px;
    font-size: 16px;
}

.more-btn {
    display: block;
    margin: 0 auto;
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 30px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
}

.more-btn:hover {
    background: #545b62;
}

/* 애니메이션 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes reveal {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .banner h1 {
        font-size: 1.8em;
    }
    
    /* 로또 머신 공들 1줄에 6개로 배치 */
    .ball-container {
        gap: 8px;
        justify-content: center;
        max-width: 100%;
        flex-wrap: nowrap;
    }
    
    .lottery-ball {
        width: 45px;
        height: 45px;
        font-size: 14px;
        border-radius: 50%;
        min-width: 45px;
        min-height: 45px;
        flex-shrink: 0;
    }
    
    .attempts-counter {
        position: static;
        margin-bottom: 15px;
        display: inline-block;
    }
    
    .lottery-machine-container {
        padding: 15px;
    }
    
    .start-stop-btn {
        padding: 12px 30px;
        font-size: 18px;
    }
    
    /* 결과 표시 - 1줄에 6개 공 */
    .result-row {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        margin-bottom: 20px;
        flex-wrap: nowrap;
    }
    
    .result-row .lottery-ball {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    /* 결과 번호들을 1줄에 배치 */
    .result-numbers {
        display: flex;
        gap: 8px;
        justify-content: center;
        flex-wrap: nowrap;
    }
    
    /* 당첨번호 테이블 모바일 최적화 */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        font-size: 12px;
        min-width: 100%;
        width: auto;
    }
    
    table th,
    table td {
        padding: 6px 4px;
        white-space: nowrap;
        vertical-align: middle;
    }
    
    /* 당첨번호 공들 크기 조정 */
    .winning-numbers {
        flex-direction: row;
        gap: 2px;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .winning-numbers .lottery-ball {
        width: 20px;
        height: 20px;
        font-size: 11px;
    }
    
    /* 보너스 공 크기 맞춤 */
    .bonus-ball {
        width: 20px !important;
        height: 20px !important;
        font-size: 11px !important;
        margin-left: 0;
    }
    
    /* 테이블 셀 간격 조정 */
    table th:nth-child(1),
    table td:nth-child(1) {
        width: 12%;
    }
    
    table th:nth-child(2),
    table td:nth-child(2) {
        width: 15%;
    }
    
    table th:nth-child(3),
    table td:nth-child(3) {
        width: 25%;
    }
    
    table th:nth-child(4),
    table td:nth-child(4) {
        width: 8%;
    }
    
    table th:nth-child(5),
    table td:nth-child(5) {
        width: 12%;
    }
    
    table th:nth-child(6),
    table td:nth-child(6) {
        width: 18%;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 10px;
    }
    
    .banner h1 {
        font-size: 1.5em;
    }
    
    /* 로또 머신 공들 더 작게 조정 */
    .lottery-ball {
        width: 40px;
        height: 40px;
        font-size: 16px;
        border-radius: 50%;
        min-width: 40px;
        min-height: 40px;
        flex-shrink: 0;
    }
    
    .ball-container {
        gap: 6px;
        max-width: 100%;
        flex-wrap: nowrap;
    }
    
    .popup-content {
        margin: 20px;
        min-width: auto;
    }
    
    /* 결과 번호들을 1줄에 6개 배치 */
    .result-row {
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
    }
    
    .result-row .lottery-ball {
        width: 35px;
        height: 35px;
        font-size: 15px;
    }
    
    .result-numbers {
        gap: 6px;
    }
    
    /* 당첨번호 테이블 더 작게 */
    .winning-numbers .lottery-ball {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
    
    .bonus-ball {
        width: 18px !important;
        height: 18px !important;
        font-size: 10px !important;
    }
    
    table {
        font-size: 11px;
    }
    
    table th,
    table td {
        padding: 4px 2px;
    }
}

/* 360px 기준 초소형 모바일 최적화 */
@media (max-width: 360px) {
    .main-content {
        padding: 8px;
    }
    
    .banner h1 {
        font-size: 1.3em;
        padding: 15px;
    }
    
    .warning-notice {
        padding: 12px;
        font-size: 14px;
    }
    
    .lottery-machine-container {
        padding: 12px;
    }
    
    /* 로또 머신 공들 360px 기준 최적화 */
    .lottery-ball {
        width: 35px;
        height: 35px;
        font-size: 14px;
        border-radius: 50%;
        min-width: 35px;
        min-height: 35px;
        flex-shrink: 0;
    }
    
    .ball-container {
        gap: 4px;
        max-width: 100%;
        flex-wrap: nowrap;
    }
    
    .start-stop-btn {
        padding: 10px 25px;
        font-size: 16px;
    }
    
    /* 결과 표시 360px 최적화 */
    .result-row {
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
    }
    
    .result-row .lottery-ball {
        width: 30px;
        height: 30px;
        font-size: 12px;
        border-radius: 50%;
        min-width: 30px;
        min-height: 30px;
        flex-shrink: 0;
    }
    
    .result-numbers {
        gap: 4px;
    }
    
    .result-label {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    /* 당첨번호 테이블 360px 최적화 */
    .winning-numbers .lottery-ball {
        width: 16px;
        height: 16px;
        font-size: 9px;
        border-radius: 50%;
        min-width: 16px;
        min-height: 16px;
        flex-shrink: 0;
    }
    
    .bonus-ball {
        width: 16px !important;
        height: 16px !important;
        font-size: 9px !important;
        border-radius: 50% !important;
        min-width: 16px !important;
        min-height: 16px !important;
        flex-shrink: 0 !important;
    }
    
    table {
        font-size: 10px;
    }
    
    table th,
    table td {
        padding: 3px 1px;
    }
    
    /* 테이블 셀 너비 360px 최적화 */
    table th:nth-child(1),
    table td:nth-child(1) {
        width: 10%;
    }
    
    table th:nth-child(2),
    table td:nth-child(2) {
        width: 12%;
    }
    
    table th:nth-child(3),
    table td:nth-child(3) {
        width: 30%;
    }
    
    table th:nth-child(4),
    table td:nth-child(4) {
        width: 8%;
    }
    
    table th:nth-child(5),
    table td:nth-child(5) {
        width: 10%;
    }
    
    table th:nth-child(6),
    table td:nth-child(6) {
        width: 20%;
    }
    
    .screenshot-btn {
        padding: 8px 16px;
        font-size: 14px;
    }
}
