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

body {
    font-family: 'Spectral', serif;
    overflow: hidden;
    height: 100vh;
    background-color: #0d0d0d;
    user-select: none;
    position: fixed;
    width: 100%;
    touch-action: none;
    image-rendering: auto;
}

#language-select {
    font-family: 'Spectral', serif;
    font-size: 16px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #f0f0f0;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 5px 10px;
    border-radius: 3px;
    outline: none;
    margin-right: 10px;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

#panorama-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    overflow: hidden;
}

#ui-overlay {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    color: white;
    pointer-events: auto;
    font-family: 'Spectral', serif;
    width: 90%;
    max-width: 800px;
}

#location-info {
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    padding: 20px 30px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
    opacity: 0;
    animation: fadeInFull 1s forwards 0.3s;
}

#location-title {
    font-family: 'Cinzel Decorative', serif;
    font-size: 32px;
    margin-bottom: 10px;
    color: #e0e0e0;
    animation: ghostly-flicker 2s infinite alternate;
}

#character-thoughts {
    margin-top: 15px;
    font-size: 18px;
    line-height: 1.5;
    font-style: italic;
    color: #d3d3d3;
    animation: ghostly-flicker 2.5s infinite alternate-reverse;
    border-top: 1px dashed rgba(255, 255, 255, 0.2);
    padding-top: 12px;
}

#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0d0d0d;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 1s ease-out;
}

#audio-controls {
    position: fixed;
    top: 60px;
    left: 14px;
    z-index: 20;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: fadeInHalf 1s forwards 0.2s;
    display: none;
    border-radius: 5px;
}

#audio-controls:hover {
    opacity: 1.0;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.volume-icon {
    color: #f0f0f0;
    width: 24px;
    height: 24px;
}

.volume-control input[type="range"] {
    -webkit-appearance: none;
    width: 100px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #f0f0f0;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
    cursor: pointer;
}

.volume-control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #f0f0f0;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
    cursor: pointer;
    border: none;
}

.splash-content {
    text-align: center;
    color: white;
}

.splash-content h2 {
    font-family: 'Cinzel Decorative', serif;
    font-size: 64px;
    margin-bottom: 10px;
    letter-spacing: 10px;
    color: #e0e0e0;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.7), 0 0 30px rgba(255, 255, 255, 0.5);
}

.splash-text {
    font-family: 'Spectral', serif;
    font-size: 24px;
    opacity: 0.9;
    color: #d3d3d3;
}

#eye-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    transition: all 1.5s ease-in-out;
}

.eye-shape {
    fill: black;
}

.eye-closed .top-lid {
    transform: translateY(0);
    transition: transform 0.12s ease-in-out;
}

.eye-closed .bottom-lid {
    transform: translateY(0);
    transition: transform 0.12s ease-in-out;
}

.eye-closed path.top-lid {
    d: path("M0,0 L100,0 L100,50 L0,50 Z");
}

.eye-closed path.bottom-lid {
    d: path("M0,100 L100,100 L100,50 L0,50 Z");
}

.top-lid {
    transform: translateY(-30%);
    transition: transform 0.3s ease-in-out;
}

.bottom-lid {
    transform: translateY(30%);
    transition: transform 0.3s ease-in-out;
}

#story-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    z-index: 50;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#story-panel.visible {
    opacity: 1;
}

.story-panel-content {
    background-color: rgba(0, 0, 0, 0.7);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.2);
    color: white;
    font-family: 'Spectral', serif;
    border-radius: 10px;
}

.story-panel-content h2 {
    font-family: 'Cinzel Decorative', serif;
    color: #e0e0e0;
    text-align: center;
    font-size: 38px;
    margin-bottom: 25px;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
}

.story-option-group {
    margin-bottom: 30px;
}

.story-option-group h3 {
    font-family: 'Cinzel Decorative', serif;
    color: #d3d3d3;
    font-size: 24px;
    margin-bottom: 12px;
}

.story-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.story-option {
    background-color: rgba(30, 30, 30, 0.8);
    padding: 12px 18px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    color: #f0f0f0;
}

.story-option:hover {
    background-color: rgba(50, 50, 50, 0.8);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), 0 0 15px rgba(255, 255, 255, 0.3);
}

.story-option.selected {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
}

.story-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
}

.story-controls button {
    background-color: rgba(30, 30, 30, 0.8);
    color: #f0f0f0;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 12px 25px;
    font-family: 'Spectral', serif;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 5px;
}

.story-controls button:hover:not([disabled]) {
    background-color: rgba(50, 50, 50, 0.8);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
}

.story-controls button[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

#story-begin {
    background-color: rgba(255, 255, 255, 0.1);
}

#story-begin:hover:not([disabled]) {
    background-color: rgba(255, 255, 255, 0.25);
}

.custom-input-container {
    display: flex;
    align-items: center;
    margin-top: 15px;
}

.custom-input-container label {
    font-family: 'Spectral', serif;
    font-size: 18px;
    color: #d3d3d3;
    margin-right: 10px;
}

.custom-input {
    flex: 1;
    padding: 8px 12px;
    background-color: rgba(30, 30, 30, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    font-family: 'Spectral', serif;
    font-size: 18px;
    color: #f0f0f0;
    caret-color: #f0f0f0;
}

#control-panel {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 20;
    display: flex;
    gap: 15px;
    opacity: 0;
    animation: fadeInHalf 1s forwards;
    transition: opacity 0.3s ease;
}

#control-panel:hover {
    opacity: 1.0;
}

.control-icon {
    width: 45px;
    height: 45px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #f0f0f0;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.control-icon:hover {
    background-color: rgba(0, 0, 0, 0.7);
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.5);
    transform: scale(1.08);
}

#settings-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 50;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    backdrop-filter: blur(12px);
}

#settings-panel.visible {
    opacity: 1;
    pointer-events: auto;
}

.settings-panel-content {
    background-color: rgba(0, 0, 0, 0.7);
    width: 90%;
    max-width: 550px;
    padding: 30px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.2);
    color: white;
    font-family: 'Spectral', serif;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
}

.settings-panel-content h2 {
    font-family: 'Cinzel Decorative', serif;
    color: #e0e0e0;
    text-align: center;
    font-size: 38px;
    margin-bottom: 25px;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
}

.settings-group {
    margin-bottom: 25px;
}

.settings-group h3 {
    font-family: 'Cinzel Decorative', serif;
    color: #d3d3d3;
    font-size: 24px;
    margin-bottom: 12px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.setting-item label {
    font-size: 18px;
    color: #f0f0f0;
}

.setting-item input[type="checkbox"] {
    transform: scale(1.3);
    margin-left: 10px;
    accent-color: rgba(255, 255, 255, 0.5);
}

.setting-item input[type="range"] {
    -webkit-appearance: none;
    width: 150px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #f0f0f0;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
    cursor: pointer;
}

.setting-item input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #f0f0f0;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
    cursor: pointer;
    border: none;
}

.settings-controls {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.settings-controls button {
    background-color: rgba(30, 30, 30, 0.8);
    color: #f0f0f0;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 12px 25px;
    font-family: 'Spectral', serif;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 10px;
    border-radius: 5px;
}

.settings-controls button:hover {
    background-color: rgba(50, 50, 50, 0.8);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
}

.music-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    align-items: center;
    margin-top: 15px;
}

.music-button {
    background-color: rgba(30, 30, 30, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #f0f0f0;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.music-button:hover {
    background-color: rgba(50, 50, 50, 0.8);
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.5);
}

.music-button svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.custom-bubble-input {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    padding: 20px;
    font-family: 'Spectral', serif;
    font-size: 28px;
    color: #f0f0f0;
    outline: none;
    width: 80%;
    max-width: 600px;
    text-align: center;
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.4);
    caret-color: #f0f0f0;
}

#location-history-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    z-index: 50;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

#location-history-panel.visible {
    opacity: 1;
    pointer-events: auto;
}

.location-history-content {
    background-color: rgba(0, 0, 0, 0.7);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.2);
    color: white;
    font-family: 'Spectral', serif;
    border-radius: 10px;
}

.location-history-content h2 {
    font-family: 'Cinzel Decorative', serif;
    color: #e0e0e0;
    text-align: center;
    font-size: 38px;
    margin-bottom: 25px;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
}

.location-entry {
    background-color: rgba(30, 30, 30, 0.8);
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.location-entry:hover {
    background-color: rgba(50, 50, 50, 0.8);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), 0 0 15px rgba(255, 255, 255, 0.3);
}

.location-entry h3 {
    font-family: 'Cinzel Decorative', serif;
    color: #d3d3d3;
    font-size: 24px;
    margin-bottom: 10px;
}

.location-entry p {
    margin-bottom: 8px;
    color: #f0f0f0;
}

.location-entry .direction-taken {
    color: #a0a0a0;
    font-style: italic;
    margin-top: 10px;
    font-size: 16px;
}

.history-controls {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.history-controls button {
    background-color: rgba(30, 30, 30, 0.8);
    color: #f0f0f0;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 12px 25px;
    font-family: 'Spectral', serif;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 10px;
    border-radius: 5px;
}

.history-controls button:hover {
    background-color: rgba(50, 50, 50, 0.8);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
}

.story-panel-content,
.location-history-content {
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 600px) {
    .story-panel-content {
        padding: 20px;
    }
    
    .story-option {
        font-size: 16px;
        padding: 10px 15px;
    }
    
    .story-panel-content h2 {
        font-size: 32px;
    }
    
    .story-options {
        gap: 10px;
    }
    
    .settings-panel-content {
        max-height: 80vh;
        padding: 20px;
        width: 95%;
        -webkit-overflow-scrolling: touch;
    }
    
    .setting-item {
        margin-bottom: 15px;
    }

    #location-title {
        font-size: 28px;
    }

    #character-thoughts {
        font-size: 16px;
    }

    .splash-content h2 {
        font-size: 48px;
    }

    .splash-text {
        font-size: 20px;
    }

    .control-icon {
        width: 40px;
        height: 40px;
    }

    .settings-panel-content h2, .location-history-content h2 {
        font-size: 32px;
    }

    .settings-group h3, .location-entry h3 {
        font-size: 20px;
    }

    .story-controls button, .settings-controls button, .history-controls button {
        font-size: 18px;
        padding: 10px 20px;
    }

    .music-button {
        width: 45px;
        height: 45px;
    }
    .music-button svg {
        width: 24px;
        height: 24px;
    }
}

@keyframes fadeInHalf {
    from { opacity: 0; }
    to { opacity: 0.5; }
}

@keyframes fadeInFull {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes ghostly-flicker {
    0% { text-shadow: 0 0 5px rgba(255, 255, 255, 0.6), 0 0 10px rgba(255, 255, 255, 0.3); }
    50% { text-shadow: 0 0 8px rgba(255, 255, 255, 1), 0 0 15px rgba(255, 255, 255, 0.5), 0 0 25px rgba(255, 255, 255, 0.2); }
    100% { text-shadow: 0 0 5px rgba(255, 255, 255, 0.6), 0 0 10px rgba(255, 255, 255, 0.3); }
}