:root {
    --primary-bg: #0f0c29;
    --secondary-bg: #302b63;
    --tertiary-bg: #24243e;
    --accent-gold: #FFD700;
    --text-white: #f8f9fa;
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
}

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

body {
    font-family: 'Noto Sans KR', sans-serif;
    /* 부드러운 심해 그라데이션으로 변경 */
    background: linear-gradient(180deg, var(--primary-bg), var(--secondary-bg), var(--tertiary-bg));
    color: var(--text-white);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
}

/* 은은한 빛 효과 추가 */
.stars-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(74, 20, 140, 0.2), transparent 70%);
    z-index: -1;
}

.container {
    width: 100%;
    max-width: 500px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

header {
    text-align: center;
    padding: 30px 0 10px;
}

header h1 {
    font-size: 1.8rem;
    color: var(--accent-gold);
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    letter-spacing: -1px;
}

.subtitle {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-top: 5px;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

.ads-box {
    width: 100%;
    min-height: 80px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.ads-label {
    font-size: 0.6rem;
    position: absolute;
    top: 5px;
    left: 8px;
    opacity: 0.4;
    letter-spacing: 1px;
}

textarea {
    width: 100%;
    height: 140px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    color: white;
    padding: 15px;
    margin: 20px 0;
    font-family: inherit;
    resize: none;
    font-size: 1rem;
    line-height: 1.5;
    outline: none;
    transition: border-color 0.3s;
}

textarea:focus {
    border-color: var(--accent-gold);
}

button {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #FFD700, #FFB900);
    color: #1a1a1a;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.3);
}

button:active {
    transform: translateY(0);
}

.hidden { display: none; }

#loading-section {
    text-align: center;
    padding: 50px 0;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 215, 0, 0.1);
    border-top: 3px solid var(--accent-gold);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.result-card {
    margin-bottom: 25px;
}

.result-card h3 {
    font-size: 0.9rem;
    color: var(--accent-gold);
    margin-bottom: 12px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#interpretation-text {
    line-height: 1.7;
    font-size: 1rem;
    word-break: keep-all;
    font-weight: 300;
}

.balls-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.ball {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 1.1rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    animation: bounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes bounceIn {
    0% { opacity: 0; transform: translateY(20px) scale(0.5); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* 로또 번호대별 색상 개선 */
.ball.y1 { background: radial-gradient(circle at 30% 30%, #ffeb3b, #fbc02d); color: #444; }
.ball.y11 { background: radial-gradient(circle at 30% 30%, #4fc3f7, #0288d1); }
.ball.y21 { background: radial-gradient(circle at 30% 30%, #ff8a65, #e64a19); }
.ball.y31 { background: radial-gradient(circle at 30% 30%, #bdbdbd, #616161); }
.ball.y41 { background: radial-gradient(circle at 30% 30%, #81c784, #388e3c); }

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.info-item {
    background: rgba(255, 255, 255, 0.04);
    padding: 18px 10px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.info-item .label {
    display: block;
    font-size: 0.7rem;
    opacity: 0.5;
    margin-bottom: 6px;
}

.info-item .value {
    font-weight: 600;
    font-size: 1rem;
    color: var(--accent-gold);
}

footer {
    text-align: center;
    padding: 30px 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    font-size: 0.8rem;
}

.footer-links a {
    color: var(--text-white);
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.footer-links a:hover { opacity: 1; }

.divider { opacity: 0.2; }

.copyright {
    font-size: 0.75rem;
    opacity: 0.4;
}

#retry-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    margin-top: 10px;
}

#retry-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

@media (max-width: 400px) {
    .container { padding: 15px; }
    .glass { padding: 20px; }
    .ball { width: 38px; height: 38px; font-size: 1rem; }
    header h1 { font-size: 1.5rem; }
}