* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background-color: #121212;
    color: #f5f5f5;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

h1 {
    text-align: center;
    margin-bottom: 10px;
    color: #ff7e00;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    font-size: 2.2rem;
    animation: titleGlow 2s infinite alternate;
}

@keyframes titleGlow {
    from { text-shadow: 2px 2px 4px rgba(0,0,0,0.5); }
    to { text-shadow: 0 0 10px rgba(255, 126, 0, 0.8), 0 0 20px rgba(255, 126, 0, 0.5); }
}

@keyframes sceneEntrance {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.input-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

textarea {
    width: 100%;
    height: 100px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #555;
    background-color: #2a2a2a;
    color: #f5f5f5;
    resize: vertical;
}

button {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background-color: #4d8aff;
    color: #ffffff;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    background-color: #80aaff;
}

button:disabled {
    background-color: #555;
    color: #888;
    cursor: not-allowed;
}

.movie-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#movie-frame {
    width: 100%;
    aspect-ratio: 16/9;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.scene-transition-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.controls {
    display: flex;
    gap: 10px;
}

/* Loading spinner */
.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid #ff4d4d;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loading {
    display: none;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.checkbox-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-container label {
    cursor: pointer;
}

/* Speech bubble base styles */
.speech-bubble {
    position: absolute;
    background: white;
    color: black;
    padding: 10px 15px;
    border-radius: 15px;
    max-width: 200px;
    font-size: 14px;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    z-index: 100; /* Ensure speech bubbles are above other elements */
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 20px;
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: white transparent;
}

.warning {
    color: #ff9800;
    font-size: 0.9rem;
    margin-top: 5px;
    display: none;
}

.warning.visible {
    display: block;
}

/* Background selector styles */
.background-selector {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.background-option {
    width: 80px;
    height: 45px;
    border: 2px solid #555;
    border-radius: 5px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.background-option:hover {
    transform: scale(1.05);
}

.background-option.selected {
    border-color: #4d8aff;
    box-shadow: 0 0 8px rgba(77, 138, 255, 0.7);
}

.background-option img, 
.background-option svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Curtain styles */
.curtain-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    pointer-events: none;
    z-index: 10;
}

.curtain {
    height: 100%;
    width: 50%;
    background-color: #00337a;
    transition: transform 1s ease-in-out;
    position: relative;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.curtain::before {
    content: '';
    position: absolute;
    top: 0;
    height: 100%;
    width: 10%;
    background: linear-gradient(to right, #001f4d, #00337a);
}

.curtain-left {
    background: linear-gradient(to right, #001f4d, #00337a);
}

.curtain-left::before {
    right: 0;
    background: linear-gradient(to right, #00337a, #0047ab);
}

.curtain-right {
    background: linear-gradient(to left, #001f4d, #00337a);
}

.curtain-right::before {
    left: 0;
    background: linear-gradient(to left, #00337a, #0047ab);
}

.movie-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.invalid-character-warning {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    z-index: 1000;
    animation: fadeInOut 2s ease-in-out;
}

.warning-smiley {
    width: 100px;
    height: 100px;
    margin: 0 auto 15px;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    10%, 90% { opacity: 1; }
}

/* Character Selector Styles */
.character-selector {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #2a2a2a;
    border-radius: 15px;
    padding: 20px;
    width: 80%;
    max-width: 800px;
    max-height: 80%;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.character-series-header {
    color: #ff7e00;
    margin-top: 20px;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 2px solid #555;
    font-size: 1.3rem;
}

.character-grid {
    display: block; /* Change from grid to block to allow headers and nested grids */
    margin-bottom: 20px;
}

.series-character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
}

.character-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.character-option img {
    max-width: 100px;
    max-height: 100px;
    object-fit: contain;
}

.character-option:hover {
    background-color: rgba(255,255,255,0.1);
}

.character-option.selected {
    background-color: #4d8aff;
    color: white;
}

#choose-characters-btn {
    margin-top: 10px;
    background-color: #4CAF50;
}

#confirm-characters-btn {
    width: 100%;
    margin-top: 15px;
}

.hidden {
    display: none !important;
}