:root {
    --primary-color: #FF9E9E;
    --secondary-color: #FFD8D8;
    --accent-color: #FF5C5C;
    --text-color: #333;
    --light-color: #fff;
    --key-point-label: "핵심";
    --shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    --border-radius: 15px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Noto Sans KR', 'Malgun Gothic', sans-serif;
}

body {
    background-color: #f9f9f9;
    color: var(--text-color);
    line-height: 1.6;
    padding-bottom: 30px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: var(--light-color);
    text-align: center;
    padding: 30px 0;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
    pointer-events: none;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    position: relative;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
}

section {
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

section.visible {
    opacity: 1;
    transform: translateY(0);
}

h2 {
    color: var(--accent-color);
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.intro p {
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.rules ol {
    margin-left: 20px;
    margin-bottom: 20px;
}

.rules li {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.illustration {
    text-align: center;
    margin: 30px 0;
}

.illustration-container {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
    transition: transform 0.3s ease;
}

.illustration-container:hover {
    transform: scale(1.02);
}

.grandma-face {
    width: 100%;
    max-width: 300px;
    height: auto;
    margin: 0 auto;
    display: block;
}

.example {
    background-color: var(--secondary-color);
    padding: 20px;
    border-radius: var(--border-radius);
    margin: 20px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.example h3 {
    margin-bottom: 15px;
    color: var(--accent-color);
}

.example p {
    font-size: 1.1rem;
}

.tips {
    background-color: #f0f8ff;
}

.tips ul {
    margin-left: 20px;
}

.tips li {
    margin-bottom: 10px;
}

.demo-button {
    display: block;
    width: 200px;
    margin: 30px auto;
    padding: 15px;
    background-color: var(--accent-color);
    color: var(--light-color);
    text-align: center;
    border: none;
    border-radius: 30px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.demo-button:hover {
    background-color: #ff3c3c;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.demo-button:active {
    transform: translateY(0);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

.animation-box {
    width: 100%;
    max-width: 400px;
    height: 300px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

#grandma-animation {
    width: 100%;
    height: 100%;
}

.speech-bubble {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: white;
    border-radius: 20px;
    padding: 15px;
    box-shadow: var(--shadow);
    max-width: 150px;
    opacity: 0;
    transition: opacity 0.5s;
}

.speech-bubble:after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 0;
    height: 0;
    border: 15px solid transparent;
    border-right-color: white;
    border-left: 0;
    margin-top: -15px;
    margin-left: -15px;
}

.speech-bubble.visible {
    opacity: 1;
}

footer {
    text-align: center;
    padding: 20px;
    color: #777;
    font-size: 0.9rem;
}

/* 언어 전환 버튼 스타일 */
.lang-switch {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 100;
    display: flex;
    gap: 10px;
    transition: opacity 0.3s ease;
}

.lang-switch:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.lang-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.3s, color 0.3s;
    color: var(--accent-color);
}

.lang-btn.active {
    background-color: var(--accent-color);
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.lang-btn:hover:not(.active) {
    background-color: rgba(255, 92, 92, 0.1);
}

/* 로딩 애니메이션 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.95);
    z-index: 1000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--primary-color);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 주제 결과 애니메이션 */
#topic-result {
    transform: scale(0.9);
    transition: all 0.3s ease;
}

#topic-result.visible {
    transform: scale(1);
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

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

/* 모바일 최적화 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .illustration-container {
        max-width: 100%;
    }
    
    .grandma-face {
        max-width: 250px;
    }
    
    .animation-box {
        height: 250px;
    }

    .lang-switch {
        top: 10px;
        right: 10px;
        padding: 5px 10px;
    }
    
    .demo-button {
        width: 180px;
        padding: 12px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8rem;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    section {
        padding: 15px;
    }
    
    .grandma-face {
        max-width: 200px;
    }
    
    .animation-box {
        height: 200px;
    }

    .lang-btn {
        padding: 3px 6px;
        font-size: 0.85rem;
    }
    
    .example {
        padding: 15px;
    }
    
    .demo-button {
        width: 160px;
        padding: 10px;
        font-size: 0.9rem;
    }
}

/* Print styling */
@media print {
    .lang-switch, .demo-button {
        display: none;
    }
    
    body {
        background-color: white;
        color: black;
    }
    
    section {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    header {
        background: none;
        color: black;
        box-shadow: none;
        border-bottom: 2px solid var(--primary-color);
    }
}
