* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', 'Pretendard', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

/* ========== 페이지 레이아웃: 좌우 여백에 이미지 ========== */
.page-wrapper {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    gap: 0;
    min-height: calc(100vh - 40px);
}

/* 좌우 여백 이미지 영역 */
.margin-images {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px 0;
    align-items: center;
}

.margin-img {
    width: 100%;
    max-width: 200px;
    height: auto;
    border-radius: 16px;
    object-fit: cover;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.margin-img:hover {
    transform: scale(1.03);
}

.margin-img-second {
    max-height: 220px;
    object-fit: cover;
}

.margin-left .margin-img { border: 3px solid rgba(255,255,255,0.4); }
.margin-right .margin-img { border: 3px solid rgba(255,255,255,0.4); }

/* ========== 메인 컨테이너 ========== */
.container {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ========== 헤더 + 이미지 ========== */
header {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0;
    text-align: center;
    min-height: 200px;
    overflow: hidden;
}

.header-images {
    position: absolute;
    inset: 0;
    opacity: 0.35;
}

.header-bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-content {
    position: relative;
    z-index: 1;
    padding: 40px 20px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 800;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

/* ========== 메인 콘텐츠 ========== */
main {
    padding: 40px;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    margin-bottom: 30px;
}

.input-group {
    width: 100%;
    max-width: 300px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.input-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.input-group select:focus {
    border-color: #667eea;
    outline: none;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #f5f5f5;
    color: #666;
}

.btn-secondary:hover {
    background: #e8e8e8;
}

.btn-copy {
    margin-top: 20px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.btn-copy:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
}

.icon {
    font-size: 1.2em;
}

.hidden {
    display: none;
}

.result-container {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
}

.result-container h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.timestamp {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.lotto-set {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lotto-set-title {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 15px;
}

.lotto-balls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.ball {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s;
    animation: bounceIn 0.5s ease-out;
    animation-delay: var(--delay);
}

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

@keyframes bounceIn {
    from {
        opacity: 0;
        transform: scale(0.5, 0.5);
    }
    to {
        opacity: 1;
        transform: scale(1, 1);
    }
}

.ball-yellow { background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%); }
.ball-blue { background: linear-gradient(135deg, #4285F4 0%, #3367D6 100%); }
.ball-red { background: linear-gradient(135deg, #EA4335 0%, #C5221F 100%); }
.ball-green { background: linear-gradient(135deg, #34A853 0%, #287936 100%); }
.ball-gray { background: linear-gradient(135deg, #9E9E9E 0%, #757575 100%); }

.bonus-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #e0e0e0;
}

.bonus-label {
    font-weight: 600;
    color: #764ba2;
    font-size: 0.95rem;
}

.ball-bonus {
    border: 3px solid #764ba2;
    box-shadow: 0 4px 12px rgba(118, 75, 162, 0.4);
}

/* ========== 푸터 + 이미지 ========== */
footer {
    position: relative;
    background: #f8f9fa;
    padding: 0;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    overflow: hidden;
}

.footer-images {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    opacity: 0.2;
}

.footer-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.footer-content {
    position: relative;
    z-index: 1;
    padding: 20px;
}

footer .small {
    font-size: 0.8rem;
    color: #999;
    margin-top: 10px;
}

/* ========== 반응형: 좁은 화면에서 여백 이미지 숨김 ========== */
@media (max-width: 1100px) {
    .margin-images {
        flex: 0 0 140px;
    }
    .margin-img {
        max-width: 140px;
    }
}

@media (max-width: 900px) {
    .page-wrapper {
        flex-direction: column;
        align-items: center;
    }

    .margin-images {
        display: none;
    }

    .container {
        width: 100%;
    }
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .page-wrapper {
        min-height: auto;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .header-content {
        padding: 28px 16px;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    main {
        padding: 20px;
    }

    .ball {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}
