:root {
    --bg-gradient-start: #e0eafc;
    --bg-gradient-end: #cfdef3;
    --container-bg: rgba(255, 255, 255, 0.95);
    --text-color: #333;
    --placeholder-text: #999;
    --lotto-row-bg: #fff;
    --lotto-row-border: #f0f0f0;
    --row-label-bg: #333;
    --row-label-text: #fff;
    --shadow-heavy: rgba(0, 0, 0, 0.1);
    --shadow-light: rgba(0, 0, 0, 0.05);
    --title-gradient-start: #4285F4;
    --title-gradient-end: #34A853;
}

[data-theme="dark"] {
    --bg-gradient-start: #232526;
    --bg-gradient-end: #414345;
    --container-bg: rgba(40, 42, 44, 0.95);
    --text-color: #f1f1f1;
    --placeholder-text: #888;
    --lotto-row-bg: #333537;
    --lotto-row-border: #444;
    --row-label-bg: #f1f1f1;
    --row-label-text: #333;
    --shadow-heavy: rgba(255, 255, 255, 0.08);
    --shadow-light: rgba(255, 255, 255, 0.04);
    --title-gradient-start: #00C9FF;
    --title-gradient-end: #92FE9D;
}

/* 전체 페이지 스타일 */
body {
    font-family: 'Noto Sans KR', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    color: var(--text-color);
    transition: background 0.3s ease, color 0.3s ease;
}

/* 메인 컨테이너 */
.container {
    position: relative;
    background-color: var(--container-bg);
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 20px 60px var(--shadow-heavy), 0 10px 20px var(--shadow-light);
    text-align: center;
    max-width: 600px;
    width: 100%;
    backdrop-filter: blur(10px);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

#theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: 1px solid var(--placeholder-text);
    color: var(--text-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

#theme-toggle:hover {
    background: var(--lotto-row-border);
    transform: scale(1.1);
}

h1 {
    margin: 0 0 30px 0;
    font-size: 32px;
    font-weight: 900;
    background: linear-gradient(to right, var(--title-gradient-start), var(--title-gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 결과 영역 */
#result {
    margin-bottom: 40px;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
}

/* 초기 안내 문구 */
.placeholder-text {
    color: var(--placeholder-text);
    font-size: 18px;
    margin-top: 120px;
    animation: pulse 2s infinite ease-in-out;
}

/* 한 줄(게임) 스타일 - 카드 형태 */
.lotto-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--lotto-row-bg);
    padding: 12px 20px;
    border-radius: 16px;
    box-shadow: 0 4px 12px var(--shadow-light);
    animation: slideUp 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    opacity: 0;
    transform: translateY(30px);
    border: 1px solid var(--lotto-row-border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* A, B, C... 라벨 스타일 */
.row-label {
    font-weight: 900;
    font-size: 18px;
    color: var(--row-label-text);
    background-color: var(--row-label-bg);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 15px;
    flex-shrink: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.balls-wrapper {
    display: flex;
    gap: 8px;
}

/* 공 스타일 (입체감 추가) */
.ball {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15), inset 0 -2px 5px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}

/* 공 상단 반사광 효과 */
.ball::after {
    content: '';
    position: absolute;
    top: 5%;
    left: 10%;
    width: 40%;
    height: 40%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.8), rgba(255,255,255,0.1));
    border-radius: 50%;
    filter: blur(2px);
}

/* 버튼 스타일 */
#generate {
    background: linear-gradient(45deg, #4285F4, #0F9D58);
    color: white;
    border: none;
    padding: 18px 45px;
    font-size: 20px;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(66, 133, 244, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

#generate:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(66, 133, 244, 0.5);
    background: linear-gradient(45deg, #5295ff, #1fb86b);
}

#generate:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 4px 10px rgba(66, 133, 244, 0.3);
}

/* 애니메이션 정의 */
@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* 모바일 대응 */
@media (max-width: 520px) {
    .container { padding: 25px 20px; }
    h1 { font-size: 26px; }
    .ball {
        width: 34px; height: 34px; font-size: 15px;
    }
    .row-label {
        width: 28px; height: 28px; font-size: 14px; margin-right: 10px;
    }
    .lotto-row { padding: 10px 15px; }
    .balls-wrapper { gap: 4px; }
    #generate {
        padding: 15px 35px; font-size: 18px; width: 100%; justify-content: center;
    }
}

/* Formspree Form Styles */
#contact-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
}

#contact-form input[type="email"],
#contact-form textarea {
    padding: 12px;
    border: 1px solid var(--lotto-row-border);
    border-radius: 8px;
    font-size: 16px;
    background-color: var(--lotto-row-bg);
    color: var(--text-color);
    transition: border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

#contact-form input[type="email"]::placeholder,
#contact-form textarea::placeholder {
    color: var(--placeholder-text);
}

#contact-form input[type="email"]:focus,
#contact-form textarea:focus {
    outline: none;
    border-color: #4285F4;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.2);
}

#contact-form button[type="submit"] {
    background: linear-gradient(45deg, #FF6B6B, #EE9A49);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
}

#contact-form button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(255, 107, 107, 0.5);
    background: linear-gradient(45deg, #FF7B7B, #F0A55A);
}

#contact-form button[type="submit"]:active {
    transform: translateY(1px) scale(0.99);
    box-shadow: 0 4px 10px rgba(255, 107, 107, 0.3);
}

h2 {
    color: var(--text-color);
    margin-top: 40px;
    font-size: 28px;
    font-weight: 900;
    transition: color 0.3s ease;
}
