/* --- Global Styles & Resets --- */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; 
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a1a1a; 
    color: #F5F5DC;
}

#viewport-constraint {
    width: 100%;
    height: 100%;
    max-width: 2200px; 
    margin: 0 auto; 
    position: relative;
    overflow: hidden; 
}

/* --- Main Game Container --- */
#game-container {
    position: relative; 
    width: 100%;
    height: 100%;
}

/* --- Background Image --- */
#background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: background-image 0.5s ease-in-out; 
}

/* --- Character Display --- */
#characters {
    position: absolute;
    bottom: 0;
    width: 100%;
    max-width: 1800px; /* max width for ultrawides */
    margin-left: auto;
    margin-right: auto;
    height: 100%; 
    display: flex;
    justify-content: space-between; 
    align-items: flex-end; 
    pointer-events: none; 
    left: 50%;
    transform: translateX(-50%);
}

.character-sprite {
    height: 88vh; 
    min-height: 200px;
    max-height: 700px; 
    max-width: 40%;
    object-fit: contain;
    object-position: center bottom;
    opacity: 0; 
    transition: opacity 0.5s ease-in-out, filter 0.5s ease-in-out;
}

#character-right {
    transform: rotateY(180deg); 
}

/* character states (speaking vs non-speaking) */
.character-sprite.speaking {
    filter: brightness(1); 
}
#character-left.speaking {
    animation: bob-left 0.8s ease-in-out infinite alternate;
}
#character-right.speaking {
    animation: bob-right 0.8s ease-in-out infinite alternate;
}

.character-sprite.dimmed {
    filter: brightness(0.5); 
}

@keyframes bob-left {
    0% { transform: translateY(0) rotateY(0deg); }
    100% { transform: translateY(3px) rotateY(0deg); }
}

@keyframes bob-right {
    0% { transform: translateY(0) rotateY(180deg); }
    100% { transform: translateY(3px) rotateY(180deg); }
}


/* dialog interface  */
#speaker-name {
    display: inline-block; 
    padding: 8px 20px;
    font-size: 1.2em;
    font-weight: 700; 
    position: absolute;
    bottom: 100%;
    left: 0px;
    margin-bottom: 8px;
    visibility: hidden; 
    border-radius: 5px;
    background-color: rgba(25, 25, 25, 0.85);
    border: 2px solid #F5F5DC;
    color: #F5F5DC; 
    font-family: 'Inter', sans-serif;
    z-index: 11;
}

#dialog-interface {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1000px; 
    z-index: 10;
    background-color: rgba(30, 30, 30, 0.8);
    border: 2px solid #F5F5DC;
    border-radius: 5px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    color: #F5F5DC; 
    font-family: 'Inter', sans-serif;
}

#dialog-box {
    padding: 20px;
    min-height: 100px; 
    position: relative; 
    font-family: 'Inter', sans-serif;
}

#dialog-text {
    margin: 0;
    padding-right: 120px; 
    font-size: 1.3em;
    line-height: 1.5;
    min-height: 50px; 
    color: #F5F5DC;
    font-family: 'Inter', sans-serif;
}

#next-button {
    position: absolute;
    right: 20px;
    bottom: 15px;
    background-color: rgba(30, 30, 30, 0.7);
    border: 2px solid #F5F5DC;
    color: #F5F5DC;
    padding: 10px 20px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: 'Inter', sans-serif;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}
#next-button:hover {
    background-color: rgba(46, 139, 87, 0.7);
    border-color: #3CB371;
    color: #F5F5DC;
    box-shadow: 0 0 8px #2E8B57, 0 0 12px #3CB371;
}

/* dialog choices  */
#choices-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20; 
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 25px;
    background-color: rgba(30, 30, 30, 0.85);
    border: 2px solid #F5F5DC;
    border-radius: 5px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-family: 'Inter', sans-serif;
    width: 400px;
}

.choice-button {
    background-color: rgba(30, 30, 30, 0.7);
    color: #F5F5DC;
    border: 2px solid #F5F5DC;
    padding: 15px 30px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    border-radius: 5px;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: 'Inter', sans-serif;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}
.choice-button:hover {
    background-color: rgba(46, 139, 87, 0.7);
    border-color: #3CB371;
    color: #F5F5DC;
    box-shadow: 0 0 8px #2E8B57, 0 0 12px #3CB371;
}

/* title screen styles */
#title-screen-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    background-color: transparent;
}

#title-bg-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#title-block {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translateX(-50%) translateY(-64px);
    text-align: center;
    color: #F5F5DC;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: transparent !important;
    border: none !important;
    padding: 0 !important;
    backdrop-filter: none !important;
}
#title-block h1 {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 128px;
    font-weight: 900;
    margin: 0; 
    line-height: 1; 
    color: #F5F5DC;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
}
#title-block p {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 24px;
    font-weight: 500;
    margin-top: 10px;
    margin-bottom: 1.5em;
    color: #F5F5DC;
    text-transform: uppercase;
}

#play-button, #chapter-select-button {
    background-color: rgba(30, 30, 30, 0.7);
    color: #F5F5DC;
    border: 2px solid #F5F5DC;
    padding: 15px 30px;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    border-radius: 5px;
    margin: 10px;
    width: 300px;
    box-sizing: border-box;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

#chapter-select-button {
    margin-bottom: 0;
}

#play-button:hover, #chapter-select-button:hover {
    background-color: rgba(46, 139, 87, 0.7);
    border: 2px solid #3CB371;
    color: #F5F5DC;
    box-shadow: 0 0 8px #2E8B57, 0 0 12px #3CB371;
}

/* chapter select modal */
#chapter-select-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

#chapter-select-panel {
    background-color: rgba(30, 30, 30, 0.85);
    border: 2px solid #F5F5DC;
    border-radius: 5px;
    padding: 20px;
    min-width: 300px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    font-family: 'Inter', sans-serif;
    color: #F5F5DC;
}

#chapter-list { 
    list-style-type: none; 
    padding: 0; 
    margin: 0; 
    width: 100%;
}

#chapter-list li a {
    display: block;
    padding: 12px 15px;
    color: #F5F5DC;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: 4px;
    margin-bottom: 8px;
    background-color: rgba(45, 45, 45, 0.7);
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: 'Inter', sans-serif;
}

#chapter-list li a:hover {
    background-color: rgba(46, 139, 87, 0.7);
    border-color: #3CB371;
    color: #F5F5DC;
    box-shadow: 0 0 6px #2E8B57, 0 0 10px #3CB371;
}

/* --- audio settings ui (hidden) --- */
#audio-settings-button {
    display: none;
}

#audio-settings-overlay {
    display: none !important;
}

/* #audio-settings-panel h2 { */
    /* margin-top: 0; */
    /* color: #F5F5DC; */
    /* text-align: center; */
    /* font-weight: 700; */
    /* font-family: 'Inter', sans-serif; */
/* } */
/* #volume-slider-container { */
    /* margin: 20px 0; */
    /* display: flex; */
    /* align-items: center; */
    /* gap: 10px; */
/* } */
/* #volume-slider-container label { */
    /* font-weight: 500; */
    /* color: #F5F5DC; */
    /* font-family: 'Inter', sans-serif; */
/* } */
/* #volume-slider { */
    /* flex-grow: 1; */
    /* cursor: pointer; */
    /* -webkit-appearance: none; */
    /* appearance: none; */
    /* width: 100%; */
    /* height: 8px; */
    /* background: rgba(20,20,20,0.7); */
    /* outline: none; */
    /* border-radius: 4px; */
    /* border: 1px solid rgba(85,85,85,0.5); */
/* } */
/* #volume-slider::-webkit-slider-thumb { */
    /* -webkit-appearance: none; */
    /* appearance: none; */
    /* width: 20px; */
    /* height: 20px; */
    /* background: #F5F5DC; */
    /* cursor: pointer; */
    /* border-radius: 50%; */
    /* border: 2px solid rgba(46,139,87,0.7); */
    /* transition: background-color 0.2s ease, border-color 0.2s ease; */
/* } */
/* #volume-slider::-webkit-slider-thumb:hover { */
    /* background: #3CB371; */
    /* border-color: #F5F5DC; */
/* } */
/* #volume-slider::-moz-range-thumb { */
    /* width: 18px; */ 
    /* height: 18px; */
    /* background: #F5F5DC; */
    /* cursor: pointer; */
    /* border-radius: 50%; */
    /* border: 2px solid rgba(46,139,87,0.7); */
    /* transition: background-color 0.2s ease, border-color 0.2s ease; */
/* } */
/* #volume-slider::-moz-range-thumb:hover { */
    /* background: #3CB371; */
    /* border-color: #F5F5DC; */
/* } */