/* Reset basic styles and lock scrollbars */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    font-family: 'Courier New', Courier, monospace;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 16:9 Widescreen Game Screen Container */
#novel-container {
    position: relative;
    width: 100vw;
    height: 56.25vw; /* Forces 16:9 aspect ratio */
    max-width: 100%;
    max-height: 100vh;
    background: #050505;
    border: 1px solid #222;
    overflow: hidden;
    box-sizing: border-box;
}

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

/* Character Sprite Layer */
#sprite-layer {
    position: absolute;
    bottom: 140px; /* Pushed up slightly */
    left: 50%;
    transform: translateX(-50%);
    height: 65%;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    pointer-events: none; /* Mouse ignores this layer completely */
}

#char-sprite {
    height: 100%;
    max-width: auto;
    object-fit: contain;
    transition: all 0.3s ease;
    pointer-events: none;
}

/* Dynamic Choices Box Overlay */
#choices-box {
    position: absolute;
    bottom: 150px; /* 🚀 Pushed up from 130px to clear the dialogue box safely */
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 999; /* 🚀 Lifted to the absolute highest tier */
    pointer-events: auto !important; /* Forces mouse interactions */
}

/* Individual Choice Buttons */
.choice-btn {
    background: #111;
    color: #ff3333;
    border: 1px solid #ff3333;
    padding: 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: monospace;
    font-weight: bold;
    text-align: center;
    transition: all 0.2s ease;
    pointer-events: auto !important; /* 🚀 Forces buttons to accept mouse clicks */
}

.choice-btn:hover {
    background: #ff3333;
    color: #000;
    box-shadow: 0 0 10px #ff3333;
}

/* Dialogue Frame at the Bottom */
#dialogue-container {
    position: absolute;
    bottom: 15px;
    left: 5%;
    width: 90%;
    height: 110px;
    background: rgba(10, 10, 10, 0.9);
    border: 1px solid #ff3333;
    box-shadow: 0 0 15px rgba(255, 51, 51, 0.2);
    border-radius: 6px;
    padding: 15px;
    box-sizing: border-box;
    z-index: 10; /* Lower than choices box */
    cursor: pointer;
}

/* Character Name Tag */
#speaker-name {
    color: #ff3333;
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 5px;
    text-shadow: 0 0 5px rgba(255, 51, 51, 0.5);
}

/* Story/Dialogue Text */
#dialogue-text {
    color: #ffffff;
    font-size: 14px;
    line-height: 1.4;
}
/* Overlay to handle the initial browser audio click restriction */
#start-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000; /* Must be higher than #choices-box (999) */
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: #ff3333;
    font-size: 24px;
    border: 1px solid #ff3333;
    box-sizing: border-box;
}

#start-overlay:hover {
    background: #000;
    text-shadow: 0 0 10px #ff3333;
}
/* Add to your style.css */
#language-controls button {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: 1px solid #fff;
    padding: 5px 10px;
    cursor: pointer;
    font-family: sans-serif;
    z-index: 9999;
}

#language-controls button:hover {
    background: #fff;
    color: #000;
    z-index: 9999;
}
#char-log-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: 1px solid #ff4a4a; /* Touhou Red border */
    padding: 8px 15px;
    cursor: pointer;
    font-family: monospace;
    z-index: 100;
}

#char-log-btn:hover {
    background: #ff4a4a;
}

/* The Modal Backdrop (Hidden by default) */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(0, 0, 0, 0.85); /* Dim the background game screen */
}

/* The Box in the Middle */
.modal-content {
    background-color: #1a1a1a;
    margin: 10% auto; 
    padding: 20px;
    border: 2px solid #ff4a4a;
    width: 60%;
    max-height: 70vh;
    overflow-y: auto; /* Adds a scrollbar if you have a lot of characters */
    color: #fff;
    font-family: monospace;
    border-radius: 5px;
}

/* Close Button (X) */
.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.close-btn:hover {
    color: #ff4a4a;
}

/* Individual Character Layout inside the list */
.char-card {
    display: flex;
    margin: 20px 0;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-left: 4px solid #ff4a4a;
}
.char-card img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    margin-right: 15px;
}
.char-info h3 {
    margin: 0 0 5px 0;
    color: #ff4a4a;
}
