* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
    background: #000;
    overflow: hidden;
    user-select: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#background-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: opacity 1s ease-in-out, background-image 1s ease-in-out;
    z-index: 1;
}

#background-layer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.3) 100%);
    pointer-events: none;
}

#character-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.character {
    position: absolute;
    bottom: 0;
    width: 35%;
    height: 85%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: bottom center;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s ease;
    filter: drop-shadow(0 0 20px rgba(0,0,0,0.5));
}

.character.visible {
    opacity: 1;
}

#character-left {
    left: 5%;
    transform: translateX(-20px);
}

#character-left.visible {
    transform: translateX(0);
}

#character-center {
    left: 50%;
    transform: translateX(-50%) scale(0.95);
}

#character-center.visible {
    transform: translateX(-50%) scale(1);
}

#character-right {
    right: 5%;
    transform: translateX(20px);
}

#character-right.visible {
    transform: translateX(0);
}

#dialog-box {
    position: absolute;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 85%;
    max-width: 900px;
    min-height: 180px;
    background: linear-gradient(135deg, rgba(20, 20, 40, 0.95) 0%, rgba(30, 25, 50, 0.95) 100%);
    border: 2px solid rgba(255, 215, 150, 0.4);
    border-radius: 12px;
    padding: 25px 35px;
    z-index: 10;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

#dialog-box::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 215, 150, 0.6), rgba(200, 150, 100, 0.3));
    z-index: -1;
    opacity: 0.5;
    filter: blur(8px);
}

#speaker-name {
    position: absolute;
    top: -18px;
    left: 30px;
    padding: 6px 20px;
    background: linear-gradient(135deg, #8B6914 0%, #D4AF37 50%, #8B6914 100%);
    color: #1a1a2e;
    font-size: 18px;
    font-weight: bold;
    border-radius: 6px;
    letter-spacing: 2px;
    text-shadow: 0 1px 1px rgba(255,255,255,0.3);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
    min-width: 100px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#speaker-name.visible {
    opacity: 1;
}

#dialog-text {
    color: #F5E6CC;
    font-size: 20px;
    line-height: 1.8;
    letter-spacing: 1px;
    margin-top: 10px;
    min-height: 100px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

#click-indicator {
    position: absolute;
    bottom: 15px;
    right: 25px;
    color: #D4AF37;
    font-size: 16px;
    animation: bounce 1s ease-in-out infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#click-indicator.visible {
    opacity: 1;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

#choice-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

#choice-container.visible {
    opacity: 1;
    pointer-events: auto;
}

.choice-btn {
    padding: 15px 40px;
    background: linear-gradient(135deg, rgba(30, 30, 60, 0.95) 0%, rgba(50, 40, 80, 0.95) 100%);
    border: 2px solid rgba(255, 215, 150, 0.5);
    border-radius: 8px;
    color: #F5E6CC;
    font-size: 18px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
    min-width: 350px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
}

.choice-btn:hover {
    background: linear-gradient(135deg, rgba(60, 50, 100, 0.95) 0%, rgba(80, 60, 120, 0.95) 100%);
    border-color: rgba(255, 215, 150, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(212, 175, 55, 0.3);
}

#title-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    background: 
        radial-gradient(ellipse at center, rgba(30, 30, 60, 0.3) 0%, rgba(10, 10, 30, 0.9) 100%),
        linear-gradient(to bottom, #0a0a1a 0%, #1a1a3a 50%, #0f0f2f 100%);
    transition: opacity 0.8s ease;
}

#title-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

#title-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #fff, transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent),
        radial-gradient(2px 2px at 160px 120px, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 230px 80px, #fff, transparent),
        radial-gradient(2px 2px at 300px 150px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 350px 60px, #fff, transparent),
        radial-gradient(2px 2px at 420px 180px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 500px 100px, #fff, transparent),
        radial-gradient(2px 2px at 580px 50px, rgba(255,255,255,0.6), transparent);
    background-size: 600px 200px;
    animation: twinkle 4s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes twinkle {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

.game-title {
    font-size: 64px;
    color: #F5E6CC;
    letter-spacing: 12px;
    margin-bottom: 20px;
    text-shadow: 
        0 0 30px rgba(212, 175, 55, 0.8),
        0 0 60px rgba(212, 175, 55, 0.4),
        0 4px 8px rgba(0,0,0,0.8);
    animation: titleGlow 3s ease-in-out infinite alternate;
    z-index: 1;
}

@keyframes titleGlow {
    0% {
        text-shadow: 
            0 0 30px rgba(212, 175, 55, 0.8),
            0 0 60px rgba(212, 175, 55, 0.4),
            0 4px 8px rgba(0,0,0,0.8);
    }
    100% {
        text-shadow: 
            0 0 40px rgba(212, 175, 55, 1),
            0 0 80px rgba(212, 175, 55, 0.6),
            0 4px 8px rgba(0,0,0,0.8);
    }
}

.game-subtitle {
    font-size: 20px;
    color: rgba(245, 230, 204, 0.7);
    letter-spacing: 4px;
    margin-bottom: 60px;
    font-style: italic;
    z-index: 1;
}

.menu-btn {
    padding: 14px 60px;
    margin: 8px 0;
    background: transparent;
    border: 2px solid rgba(255, 215, 150, 0.5);
    border-radius: 6px;
    color: #F5E6CC;
    font-size: 18px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 4px;
    min-width: 250px;
    z-index: 1;
}

.menu-btn:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: rgba(255, 215, 150, 0.8);
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

#ui-layer {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 50;
    display: flex;
    gap: 10px;
}

.ui-btn {
    width: 45px;
    height: 45px;
    background: rgba(20, 20, 40, 0.8);
    border: 1px solid rgba(255, 215, 150, 0.4);
    border-radius: 8px;
    color: #D4AF37;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ui-btn:hover {
    background: rgba(60, 50, 100, 0.9);
    border-color: rgba(255, 215, 150, 0.8);
    transform: translateY(-2px);
}

.hidden {
    display: none !important;
}

.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #252545 100%);
    border: 2px solid rgba(255, 215, 150, 0.4);
    border-radius: 12px;
    padding: 40px 50px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.modal-content h2 {
    color: #D4AF37;
    font-size: 28px;
    margin-bottom: 25px;
    letter-spacing: 4px;
}

.modal-content p {
    color: #F5E6CC;
    font-size: 16px;
    line-height: 2;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .game-title {
        font-size: 36px;
        letter-spacing: 6px;
    }
    
    .game-subtitle {
        font-size: 14px;
        letter-spacing: 2px;
    }
    
    #dialog-box {
        width: 95%;
        min-height: 150px;
        padding: 20px 20px;
        bottom: 3%;
    }
    
    #dialog-text {
        font-size: 16px;
        line-height: 1.6;
    }
    
    #speaker-name {
        font-size: 15px;
        padding: 5px 15px;
    }
    
    .character {
        width: 50%;
        height: 75%;
    }
    
    .choice-btn {
        min-width: 280px;
        font-size: 16px;
        padding: 12px 30px;
    }
    
    .menu-btn {
        min-width: 200px;
        font-size: 16px;
        padding: 12px 40px;
    }
}
