:root {
    --primary-color: #6c5ce7;
    --primary-hover: #5f27cd;
    --text-light: #f1f2f6;
    --text-dark: #2f3542;
    --glass-bg: rgba(20, 20, 30, 0.75);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

body {
    background-color: #1a1a2e;
    font-family: 'Noto Sans KR', 'Noto Sans JP', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    color: var(--text-light);
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 1280px;
    height: 100vh;
    max-height: 720px;
    background-color: #2f3542;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    aspect-ratio: 16/9;
}

@media (min-width: 1280px) {
    #game-container {
        height: 720px;
        border-radius: 12px;
    }
}

#background-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    /* Default placeholder */
    background-size: cover;
    background-position: center;
    transition: background-image 1s ease-in-out;
    z-index: 1;
}

#character-layer {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: 2;
    pointer-events: none;
}

#character-image {
    width: 600px;
    /* Fixed max width for character sprite */
    max-width: 100%;
    height: 90vh;
    /* Most of the vertical space */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: bottom center;
    transition: opacity var(--transition-speed) ease-in-out, transform var(--transition-speed) ease-in-out;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 2rem;
}

#dialogue-box {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--glass-shadow);
    margin-bottom: 2rem;
    position: relative;
    pointer-events: auto;
    cursor: pointer;
    transition: opacity var(--transition-speed), transform var(--transition-speed);
}

#speaker-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffd32a;
    margin-bottom: 0.5rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.text-content {
    min-height: 80px;
}

#japanese-text {
    font-size: 2rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    letter-spacing: 1px;
}

#korean-translation {
    font-size: 1.2rem;
    color: #dfe4ea;
    font-weight: 400;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

#next-indicator {
    position: absolute;
    bottom: 20px;
    right: 20px;
    font-size: 1.5rem;
    color: #ffda79;
    animation: bounce 1s infinite alternate;
}

#choices-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 80%;
    max-width: 600px;
    pointer-events: auto;
    z-index: 20;
}

.choice-btn {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.2rem;
    color: white;
    font-family: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.choice-btn:hover {
    background: rgba(108, 92, 231, 0.8);
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(108, 92, 231, 0.5);
}

.choice-jp {
    font-size: 1.4rem;
    font-weight: 700;
}

.choice-kr {
    font-size: 1rem;
    color: #dcdde1;
}

#click-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    cursor: pointer;
}

/* Utilities */
.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

@keyframes bounce {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(10px);
    }
}