/* 알사탕 방탈출 게임 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Serif KR', serif;
    background-color: #f8f1ff;
    color: #333;
    line-height: 1.6;
}

/* 화면 공통 스타일 */
.screen {
    display: none;
    width: 100%;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.content {
    max-width: 900px;
    width: 90%;
    background-color: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(138, 43, 226, 0.2);
    text-align: center;
}

/* 제목 스타일 */
.title {
    font-size: 2.5rem;
    color: #8a2be2;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.5rem;
    color: #9370db;
    margin-bottom: 30px;
}

/* 스토리 소개 스타일 */
.story-intro {
    text-align: left;
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f0e6ff;
    border-radius: 10px;
}

.story-intro h3 {
    color: #8a2be2;
    margin-top: 20px;
    margin-bottom: 10px;
}

.warning-box {
    background-color: #ffe6e6;
    border-left: 5px solid #ff4d4d;
    padding: 15px;
    margin-top: 20px;
    border-radius: 5px;
}

.warning-box h4 {
    color: #ff4d4d;
    margin-bottom: 10px;
}

/* 버튼 스타일 */
.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 10px;
}

.btn-primary {
    background-color: #8a2be2;
    color: white;
    box-shadow: 0 4px 8px rgba(138, 43, 226, 0.3);
}

.btn-primary:hover {
    background-color: #7b25c9;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(138, 43, 226, 0.4);
}

.btn-secondary {
    background-color: #e0cfff;
    color: #8a2be2;
}

.btn-secondary:hover {
    background-color: #d1b8ff;
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
    position: relative;
    z-index: 30;
}

/* 방 선택 화면 스타일 */
.room-selection-intro {
    margin-bottom: 30px;
}

.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.room-card {
    background-color: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
}

.room-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(138, 43, 226, 0.2);
}

.room-card h4 {
    color: #8a2be2;
    margin-bottom: 10px;
}

.room-info {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    font-size: 0.9rem;
    color: #666;
}

.room-status {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5rem;
}

/* 게임 화면 스타일 */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    padding: 10px 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    width: 100%;
    max-width: 900px;
}

.timer {
    font-size: 1.2rem;
    font-weight: bold;
    color: #ff4d4d;
}

.progress {
    flex-grow: 1;
    margin: 0 20px;
}

.progress-bar {
    height: 10px;
    background-color: #e0e0e0;
    border-radius: 5px;
    margin-top: 5px;
}

.progress-fill {
    height: 100%;
    background-color: #8a2be2;
    border-radius: 5px;
    width: 0%;
    transition: width 0.5s ease;
}

.current-room {
    font-weight: bold;
    color: #8a2be2;
}

/* 방 내부 화면 스타일 */
.room-view {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 900px;
    overflow: hidden;
}

.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #f0e6ff;
    border-bottom: 1px solid #e0cfff;
}

.room-content {
    padding: 20px;
    text-align: center;
}

.room-description {
    margin-bottom: 20px;
    text-align: center;
}

.room-objects {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
    justify-content: center;
}

.room-object {
    background-color: #f8f1ff;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.room-object:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(138, 43, 226, 0.2);
}

.room-object-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.lock-section {
    background-color: #f0e6ff;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    text-align: center;
}

.lock-input {
    display: flex;
    justify-content: center;
    margin-top: 15px;
}

.lock-input input {
    padding: 10px 15px;
    border: 2px solid #d1b8ff;
    border-radius: 5px;
    font-size: 1rem;
    width: 150px;
    text-align: center;
    margin-right: 10px;
}

.lock-input input::placeholder {
    font-size: 0.85rem;
    color: #999;
}

/* 모달 스타일 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: white;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #f0e6ff;
    border-bottom: 1px solid #e0cfff;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #8a2be2;
}

.modal-body {
    padding: 20px;
    text-align: center;
}

.question-text {
    margin-bottom: 20px;
    font-size: 1.1rem;
    text-align: center;
}

.question-hint {
    background-color: #f0e6ff;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-style: italic;
    color: #666;
    text-align: center;
}

.question-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.question-option {
    padding: 10px 15px;
    border: 2px solid #d1b8ff;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.question-option:hover {
    background-color: #f0e6ff;
}

.question-option.selected {
    background-color: #d1b8ff;
    border-color: #8a2be2;
}

.key-number {
    font-size: 1.2rem;
    font-weight: bold;
    color: #8a2be2;
    margin-top: 15px;
    padding: 10px;
    background-color: #f0e6ff;
    border-radius: 5px;
    display: inline-block;
}

/* 효과 스타일 */
.effect-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.effect-overlay.hidden {
    display: none;
}

.effect-content {
    background-color: white;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(138, 43, 226, 0.4);
    animation: popIn 0.5s ease;
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* 폭죽 효과 */
.fireworks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.final-fireworks {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.firework {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: #8a2be2;
    animation: explode 1.5s ease-out forwards;
    box-shadow: 0 0 10px 2px rgba(138, 43, 226, 0.7);
    opacity: 0.9;
}

.firework:nth-child(2n) { background-color: #ff4d4d; animation-delay: 0.2s; }
.firework:nth-child(3n) { background-color: #4dff4d; animation-delay: 0.4s; }
.firework:nth-child(4n) { background-color: #4d4dff; animation-delay: 0.6s; }
.firework:nth-child(5n) { background-color: #ffff4d; animation-delay: 0.8s; }
.firework:nth-child(7n) { background-color: #ff4dff; animation-delay: 0.3s; }
.firework:nth-child(11n) { background-color: #4dffff; animation-delay: 0.5s; }

@keyframes explode {
    0% { transform: translate(0, 0) scale(0); opacity: 1; }
    25% { opacity: 1; }
    100% { transform: translate(calc(var(--direction-x, 1) * 50px), calc(var(--direction-y, 1) * 50px)) scale(20); opacity: 0; }
}

/* 자물쇠 해제 애니메이션 */
.lock-unlock-animation {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    font-size: 3rem;
}

.lock, .key, .unlocked {
    margin: 0 15px;
}

.key {
    animation: keyMove 2s ease infinite;
}

@keyframes keyMove {
    0% { transform: translateX(0); }
    50% { transform: translateX(-30px); }
    100% { transform: translateX(0); }
}

/* 게임 클리어 화면 스타일 */
#clearScreen {
    position: relative;
    overflow: hidden;
}

#clearScreen h1, 
#clearScreen h2 {
    position: relative;
    z-index: 10;
    text-shadow: 0 0 10px white, 0 0 20px white;
}

/* 게임 클리어 화면 스타일 */
#clearScreen .content {
    position: relative;
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 30px rgba(138, 43, 226, 0.4);
}

.certificate {
    background-color: #fff9e6;
    border: 5px solid #ffd700;
    border-radius: 10px;
    padding: 20px;
    margin: 30px 0;
    position: relative;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    z-index: 20;
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.5);
}

.certificate:before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 2px solid #ffd700;
    border-radius: 5px;
    pointer-events: none;
}

.certificate-header {
    margin-bottom: 20px;
    border-bottom: 2px solid #ffd700;
    padding-bottom: 10px;
}

.certificate-title {
    font-size: 1.5rem;
    color: #8a2be2;
    font-weight: bold;
}

.certificate-body {
    margin-bottom: 20px;
}

.special-title {
    margin-top: 20px;
    font-size: 1.2rem;
}

.title-label {
    color: #666;
}

.title-text {
    color: #8a2be2;
    font-weight: bold;
}

.certificate-footer {
    border-top: 2px solid #ffd700;
    padding-top: 10px;
    font-size: 0.9rem;
    color: #666;
}

.ending-message {
    margin: 30px 0;
    font-style: italic;
    color: #8a2be2;
    position: relative;
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.7);
    padding: 15px;
    border-radius: 10px;
}

/* 게임 오버 화면 스타일 */
#gameOverScreen .content {
    background-color: #ffe6e6;
}

#gameOverScreen h1 {
    color: #ff4d4d;
}

.game-over-message {
    margin: 30px 0;
}

/* 반응형 스타일 */
@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1.2rem;
    }
    
    .room-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .game-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .progress {
        width: 100%;
        margin: 10px 0;
    }
    
    .room-objects {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .room-object-icon {
        font-size: 1.8rem;
    }
    
    .room-object-name {
        font-size: 0.9rem;
    }
    
    .modal-content {
        width: 95%;
        max-height: 80vh;
    }
    
    .question-options {
        max-width: 100%;
    }
    
    .btn-primary, .btn-secondary {
        padding: 10px 20px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .content {
        padding: 20px 15px;
        width: 95%;
    }
    
    .title {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1.1rem;
    }
    
    .room-objects {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .room-object {
        padding: 10px;
    }
    
    .room-object-icon {
        font-size: 1.5rem;
    }
    
    .certificate {
        padding: 15px;
    }
    
    .certificate-title {
        font-size: 1.3rem;
    }
}

/* 유틸리티 클래스 */
.hidden {
    display: none !important;
} 