* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: #0a0e27;
    color: #e0e0e0;
    min-height: 100vh;
    overflow: hidden;
}

/* Start Menu */
.start-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #0a0e27 0%, #1a2040 50%, #0a0e27 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.5s ease-in;
}

.start-menu.hidden {
    display: none;
}

.start-menu-content {
    text-align: center;
}

.game-title {
    font-size: 54px;
    font-weight: bold;
    color: #4a90e2;
    text-shadow: 0 0 30px rgba(74, 144, 226, 0.8), 0 0 60px rgba(74, 144, 226, 0.5);
    margin-bottom: 10px;
    letter-spacing: 10px;
}

.game-subtitle {
    font-size: 24px;
    color: #5aa0f2;
    margin-bottom: 60px;
    letter-spacing: 3px;
    opacity: 0.9;
}

.start-menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.menu-button {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.2) 0%, rgba(53, 122, 189, 0.2) 100%);
    border: 2px solid #4a90e2;
    border-radius: 12px;
    padding: 18px 60px;
    color: #e0e0e0;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 250px;
    backdrop-filter: blur(10px);
}

.menu-button:hover {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.4) 0%, rgba(53, 122, 189, 0.4) 100%);
    border-color: #5aa0f2;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(74, 144, 226, 0.5);
}

.menu-button.hidden {
    display: none;
}

#app {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* Background Image - Fullscreen */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    overflow: hidden;
}

.background-image {
    position: absolute;
    top: -5%;
    left: -5%;
    width: 110%;
    height: 80%;
    object-fit: cover;
    object-position: center;
    animation: fadeIn 0.5s ease-in;
    transform-origin: center center;
    will-change: transform;
}

.background-image.hidden {
    display: none;
}

/* Characters Container */
.characters-container {
    position: fixed;
    bottom: 280px;
    left: 0;
    width: 100vw;
    height: calc(100vh - 280px);
    z-index: 5;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0 50px;
    pointer-events: none;
}

.character {
    height: 550px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.8));
    transform-origin: bottom center;
}

/* Character speaking: slightly larger and brighter */
.character.speaking {
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.8)) brightness(1.1);
    z-index: 6;
}

/* Character not speaking: slightly smaller and dimmed */
.character:not(.speaking) {
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.8)) brightness(0.85);
}

.character.position-left {
    align-self: flex-end;
    margin-right: auto;
}

.character.position-right {
    align-self: flex-end;
    margin-left: auto;
}

/* Character Names Container */
.character-names-container {
    position: fixed;
    left: 0;
    width: 100vw;
    height: 40px;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 50px;
    pointer-events: none;
    bottom: calc(33vh + 15px);
}

.character-name-label {
    font-size: 18px;
    font-weight: bold;
    color: #4a90e2;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8), 0 0 20px rgba(74, 144, 226, 0.4);
    background: rgba(15, 20, 40, 0.85);
    padding: 8px 16px;
    border-radius: 6px;
    border: 2px solid rgba(74, 144, 226, 0.5);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease-out;
    transition: all 0.3s ease;
}

/* Name label when character is speaking */
.character-name-label.speaking {
    color: #5fc2f2;
    border-color: rgba(95, 194, 242, 0.8);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8), 0 0 25px rgba(95, 194, 242, 0.6);
    background: rgba(20, 30, 50, 0.95);
}

/* Name label when character is not speaking */
.character-name-label:not(.speaking) {
    opacity: 0.7;
}

.character-name-label.position-left {
    align-self: flex-start;
    margin-right: auto;
}

.character-name-label.position-right {
    align-self: flex-start;
    margin-left: auto;
}

/* Scene Container - Bottom aligned */
.scene-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    height: 33vh;
    max-height: 400px;
    background: rgba(15, 20, 40, 1);
    border-top: 3px solid #2d3561;
    padding: 25px 40px 30px;
    box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.8);
    animation: slideUpBottom 0.5s ease-out;
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Location Name - Top Right */
.location-name {
    position: fixed;
    top: 30px;
    right: 40px;
    z-index: 15;
    font-size: 18px;
    font-weight: bold;
    color: #f0a040;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8), 0 0 20px rgba(240, 160, 64, 0.4);
    background: rgba(15, 20, 40, 0.85);
    padding: 12px 20px;
    border-radius: 8px;
    border: 2px solid rgba(240, 160, 64, 0.5);
    backdrop-filter: blur(10px);
    display: none;
    animation: slideInRight 0.4s ease-out;
}

/* Content Area (scrollable) */
.scene-content {
    flex: 0 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 15px;
    padding-right: 10px;
    min-height: 0;
    max-height: 80%;
}

/* Actions Container (Continue + Choices) */
.actions-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    flex-shrink: 0;
}

.scene-content::-webkit-scrollbar {
    width: 8px;
}

.scene-content::-webkit-scrollbar-track {
    background: rgba(10, 14, 39, 0.3);
    border-radius: 4px;
}

.scene-content::-webkit-scrollbar-thumb {
    background: rgba(74, 144, 226, 0.5);
    border-radius: 4px;
}

.scene-content::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 144, 226, 0.8);
}

/* Scene Text with typewriter */
.scene-text {
    font-size: 19px;
    line-height: 1.7;
    margin-bottom: 15px;
    color: #e0e0e0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Markdown styles */
.scene-text strong {
    color: #4a90e2;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(74, 144, 226, 0.5);
}

.scene-text em {
    color: #f0a040;
    font-style: italic;
    text-shadow: 0 0 8px rgba(240, 160, 64, 0.3);
}

.scene-text em.thought {
    color: #22c55e;
    font-style: italic;
    text-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

/* Tooltip styles */
.scene-text em.has-tooltip {
    position: relative;
    cursor: help;
    border-bottom: 1px dotted #f0a040;
    transition: all 0.2s ease;
}

/* Disable tooltips during typing */
.scene-text.typing em.has-tooltip {
    cursor: text;
    border-bottom: none;
}

.scene-text em.has-tooltip:hover {
    text-shadow: 0 0 12px rgba(240, 160, 64, 0.6);
}

/* Don't show hover effect during typing */
.scene-text.typing em.has-tooltip:hover {
    text-shadow: 0 0 8px rgba(240, 160, 64, 0.3);
}

/* Tooltip popup (real DOM element) */
.tooltip-popup {
    position: fixed;
    background: linear-gradient(135deg, #1a2040 0%, #0f1428 100%);
    color: #e0e0e0;
    padding: 10px 15px;
    border-radius: 8px;
    border: 2px solid #f0a040;
    font-size: 14px;
    font-style: normal;
    white-space: normal;
    max-width: 300px;
    min-width: 150px;
    width: max-content;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 20px rgba(240, 160, 64, 0.3);
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    line-height: 1.4;
    transform: translateX(-50%);
}

/* Tooltip above */
.tooltip-popup.tooltip-above {
    transform: translateX(-50%) translateY(-100%);
}

/* Tooltip below */
.tooltip-popup.tooltip-below {
    transform: translateX(-50%);
}

/* Visible state */
.tooltip-popup.visible {
    opacity: 1;
}

/* Continue Button - Same design as choices */
.continue-button {
    background: linear-gradient(135deg, rgba(45, 53, 97, 0.85) 0%, rgba(26, 32, 64, 0.85) 100%);
    border: 2px solid #4a90e2;
    border-radius: 8px;
    padding: 14px 25px;
    color: #e0e0e0;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    backdrop-filter: blur(5px);
    display: inline-block;
    width: 100%;
}

.continue-button:hover {
    background: linear-gradient(135deg, rgba(61, 69, 113, 0.95) 0%, rgba(42, 48, 80, 0.95) 100%);
    border-color: #5aa0f2;
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(74, 144, 226, 0.5);
}

.continue-button:active {
    transform: translateY(0);
}

.continue-button.hidden {
    display: none;
}

/* Debug: Scene ID */
.scene-debug {
    position: absolute;
    bottom: 5px;
    right: 10px;
    font-size: 11px;
    color: rgba(74, 144, 226, 0.6);
    background: rgba(10, 14, 39, 0.7);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    user-select: none;
    pointer-events: none;
}

/* Choices Container */
.choices-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 1000px;
    margin: 0 auto;
    flex-shrink: 0;
    width: 100%;
}

.choice-button {
    background: linear-gradient(135deg, rgba(45, 53, 97, 0.85) 0%, rgba(26, 32, 64, 0.85) 100%);
    border: 2px solid #4a90e2;
    border-radius: 8px;
    padding: 14px 25px;
    color: #e0e0e0;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    backdrop-filter: blur(5px);
}

.choice-button:hover {
    background: linear-gradient(135deg, rgba(61, 69, 113, 0.95) 0%, rgba(42, 48, 80, 0.95) 100%);
    border-color: #5aa0f2;
    transform: translateX(8px);
    box-shadow: 0 0 15px rgba(74, 144, 226, 0.5);
}

.choice-button:active {
    transform: translateX(5px);
}

/* Typewriter cursor */
.scene-text.typing::after {
    content: '▌';
    animation: blink 0.7s infinite;
    color: #4a90e2;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUpBottom {
    from {
        opacity: 0;
        transform: translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Mobile Optimization */
@media (max-width: 768px) {
    .location-name {
        top: 15px;
        right: 15px;
        font-size: 14px;
        padding: 8px 15px;
    }
    
    .scene-container {
        height: 40vh;
        max-height: none;
        padding: 20px 25px;
    }

    .scene-text {
        font-size: 16px;
    }

    .continue-button {
        padding: 10px 20px;
        font-size: 15px;
    }

    .choice-button {
        padding: 12px 20px;
        font-size: 15px;
    }

    .characters-container {
        bottom: 40vh;
        gap: 10px;
        padding: 0 20px;
    }

    .character {
        height: 380px;
    }
    
    .character-names-container {
        bottom: calc(40vh + 10px);
        padding: 0 20px;
    }
    
    .character-name-label {
        font-size: 14px;
        padding: 6px 12px;
        letter-spacing: 1px;
    }
}

@media (max-width: 480px) {
    .location-name {
        top: 10px;
        right: 10px;
        font-size: 12px;
        padding: 6px 12px;
        letter-spacing: 1px;
    }
    
    .scene-container {
        height: 42vh;
        padding: 15px 20px;
    }

    .scene-text {
        font-size: 15px;
    }

    .continue-button {
        padding: 8px 15px;
        font-size: 14px;
    }

    .choice-button {
        padding: 10px 15px;
        font-size: 14px;
    }

    .characters-container {
        bottom: 42vh;
        padding: 0 10px;
    }

    .character {
        height: 220px;
    }
    
    .character-names-container {
        bottom: calc(41.5vh);
        padding: 0 10px;
    }
    
    .character-name-label {
        font-size: 12px;
        padding: 5px 10px;
        letter-spacing: 1px;
    }
}
