@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+KR:wght@300;400;500;700&family=Cinzel:wght@400;600&display=swap');

:root {
    --primary-color: #2c3e50;
    --secondary-color: #e74c3c;
    --accent-color: #f39c12;
    --text-light: #ecf0f1;
    --shadow-dark: rgba(0, 0, 0, 0.8);
}

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

body {
    position: relative;

    font-family: 'Noto Serif KR', serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: var(--text-light);
    overflow: hidden;
    height: 100vh;
}

.game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.scene-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: all 3s ease-in-out;
    z-index: 1;
}

.scene-background.library {
    background: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.6)), 
                url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect width="100" height="100" fill="%23654321"/><rect x="10" y="20" width="80" height="60" fill="%238B4513"/><rect x="15" y="25" width="70" height="50" fill="%23A0522D"/></svg>');
}

.scene-background.garden {
    background: linear-gradient(rgba(0,0,0,0.2), rgba(0,0,0,0.4)), 
                radial-gradient(circle at 30% 70%, #2E8B57 0%, #228B22 40%, #006400 100%);
}

.scene-background.cafe {
    background: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.5)), 
                linear-gradient(45deg, #8B4513 0%, #CD853F 50%, #DEB887 100%);
}

.scene-background.rooftop {
    background: linear-gradient(rgba(0,0,0,0.2), rgba(0,0,0,0.4)), 
                linear-gradient(to bottom, #4B0082 0%, #8A2BE2 30%, #FF69B4 100%);
}

.character-container {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 70%;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

.character {
    width: 300px;
    height: 500px;
    background: linear-gradient(to bottom, transparent 0%, rgba(255,255,255,0.1) 100%);
    border-radius: 50% 50% 0 0;
    position: relative;
    transition: all 1s ease-in-out;
    transform: translateY(50px);
    opacity: 0;
}

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

.character.talking {
    animation: breathe 3s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-5px) scale(1.02); }
}

.dialogue-box {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    min-height: 45%;
    max-height: 45%;
    background: linear-gradient(135deg, rgba(44, 62, 80, 0.95), rgba(52, 73, 94, 0.95));
    backdrop-filter: blur(10px);
    border-top: 3px solid var(--accent-color);
    z-index: 3;
    display: flex;
    flex-direction: column;
    padding: 20px;
    transform: translateY(100%);
    transition: transform 1s ease-out;
    overflow-y: hidden;
}

.dialogue-box.visible {
    transform: translateY(0);
}

.speaker-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 15px;
    font-family: 'Cinzel', serif;
    text-shadow: 2px 2px 4px var(--shadow-dark);
}

.dialogue-text {
    font-size: 1.2rem;
    line-height: 1.8;
    margin-bottom: 0px;
    white-space: pre-wrap; /* 줄바꿈을 위해 pre-wrap 사용 */
    width: 100%; /* 전체 너비 사용 */
    max-width: 95%;
    opacity: 0; /* 초기에는 투명하게, JS에서 1로 변경하여 페이드인 */
    transition: opacity 1s ease-in-out; /* 페이드인 효과 */
}

/* @keyframes typewriter {
    0% { width: 0; white-space: nowrap; border-right: 3px solid var(--accent-color); }
    99% { border-right: 3px solid var(--accent-color); }
    100% { width: 100%; white-space: pre-wrap; border-right: none; }
} */

.choices-container {
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.choice-button {
    background: linear-gradient(135deg, var(--secondary-color), #c0392b);
    border: none;
    padding: 12px 25px;
    border-radius: 20px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Serif KR', serif;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s forwards;
    position: relative;
    overflow: hidden;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.choice-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.5);
    background: linear-gradient(135deg, #e74c3c, #e67e22);
}

.music-control {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 24px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.music-control:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.6);
}

.fade-transition {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: black;
    opacity: 0;
    transition: opacity 1s ease;
    z-index: 20;
    pointer-events: none;
}

.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 5px;
    height: 5px;
    background: var(--accent-color);
    border-radius: 50%;
    opacity: 0.7;
    animation: float 10s linear infinite;
}

@keyframes float {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-10vh) rotate(360deg);
        opacity: 0;
    }
}

.title-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 30;
    transition: opacity 2s ease;
}

.game-title {
    font-size: 4rem;
    font-family: 'Cinzel', serif;
    margin-bottom: 20px;
    text-shadow: 0 0 30px var(--accent-color);
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    0% { filter: drop-shadow(0 0 20px rgba(243, 156, 18, 0.5)); }
    100% { filter: drop-shadow(0 0 40px rgba(243, 156, 18, 0.8)); }
}

.story-selection-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: hidden;
    width:90%;
}

.story-button {
    /* 기존 .start-button 스타일을 기반으로 하거나, 여기서 개별 스타일 지정 */
    padding: 15px 30px; /* 크기 약간 조정 */
    font-size: 1.1rem;
    min-width: 300px; /* 버튼 최소 너비 설정 */
    text-align: center;
}

.start-button {
    background: linear-gradient(135deg, var(--accent-color), #e67e22);
    border: none;
    padding: 20px 40px;
    border-radius: 30px;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 30px;
    font-family: 'Noto Serif KR', serif;
    font-weight: 500;
    box-shadow: 0 4px 25px rgba(243, 156, 18, 0.5);
}

.start-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(243, 156, 18, 0.7);
}

.description {
    max-width: 600px;
    text-align: center;
    line-height: 1.8;
    font-size: 1.1rem;
    margin-bottom: 30px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.save-indicator {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.save-indicator.visible {
    opacity: 1;
}

/* 클릭 프롬프트 스타일 */
.click-prompt {
    position: absolute;
    bottom: 15px;
    right: 30px;
    font-size: 0.9rem;
    color: var(--accent-color);
    opacity: 0.8;
    animation: pulse 1.5s ease-in-out infinite;
}

/* 중복 정의 제거 */

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* 클릭 가능한 대화창 스타일 */
.dialogue-box.clickable {
    cursor: pointer;
}

.dialogue-box.clickable:hover {
    box-shadow: 0 0 20px rgba(243, 156, 18, 0.3);
}
