@font-face {
    font-family: "QuestaSansLight";
    src:
        url("./fonts/questa_sans_light-webfont.woff2") format("woff2"),
        url("./fonts/questa_sans_light-webfont.woff") format("woff");
    font-weight: normal;
    font-style: normal;
}

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

body {
    font-family: "QuestaSansLight", sans-serif;
    background: #1a1a1a;
    overflow: hidden;
    user-select: none;
    letter-spacing: 1.75px;
    box-sizing: border-box;
}

/* Constrain viewport to match image aspect ratio (2.33:1 for 5950x2550 images) - desktop only */
@media (min-width: 769px) {
    body {
        max-width: calc(100vh * 2.33);
        margin: 0 auto;
    }
}

.visual-novel-container {
    position: relative;
    width: 100%;
    height: 100vh;
    cursor: grab;
}
.visual-novel-container.dragging {
    cursor: grabbing;
}

.background-container {
    position: absolute;
    width: 350%; /* Wide enough for 7000px images without grey space */
    height: 120%;
    top: -10%;
    left: -125%; /* Adjusted to center the wider container */
    transition: transform 0.15s ease-out, opacity 0.2s ease-in-out;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Disable all transitions and hide pseudo-elements during dragging to prevent flickering */
:root[style*="--dragging: 1"] .background-container,
:root[style*="--dragging: 1"] .background-image,
:root[style*="--dragging: 1"] .background-image::before,
:root[style*="--dragging: 1"] .background-image::after {
    transition: none !important;
    animation: none !important;
}

/* Completely hide pseudo-elements during dragging to eliminate flickering */
:root[style*="--dragging: 1"] .background-image::before,
:root[style*="--dragging: 1"] .background-image::after {
    display: none !important;
}
.background-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.background-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("/assets/images/Full-Day.jpg") center/cover;
    z-index: 1;
}

/* OLD SYSTEM DISABLED - Using new JavaScript overlay system instead */
/*
.background-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("images/Full-Night.jpg") center center;
    background-size: auto 100%;
    background-repeat: no-repeat;
    opacity: 0;
    z-index: 2;
    transition: opacity 4s cubic-bezier(0.4, 0, 0.2, 1);
}
*/

/* Hide only the before pseudo-element when scene is active, keep after (night overlay) */
.background-image.scene-active::before {
    display: none;
}

/* OLD SYSTEM DISABLED - Using new JavaScript overlay system instead */
/*
body.high-contrast .background-image.scene-active::after {
    display: block;
}
*/

/* Override background-size for scrollable scenes and street view */
.background-image.scene-active {
    background-size: auto 100% !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
    object-fit: none !important;
}

.interactive-points {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Connection lines between points - HIDDEN */
.connection-lines {
    display: none; /* Hide pink connection lines as requested */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* Hide connection lines in panorama mode */
.panorama-view .connection-lines {
    display: none;
}

.connection-line {
    position: absolute;
    height: 3px;
    transform-origin: left center;
    transition: all 0.3s ease;
}

.road-path {
    background: linear-gradient(90deg, #895353 0%, #9d6e6d 50%, #b18988 100%);
    border-top: 1px solid rgba(137, 83, 83, 0.3);
    border-bottom: 1px solid rgba(137, 83, 83, 0.3);
    height: 4px;
}

.dirt-path {
    background: repeating-linear-gradient(
        90deg,
        #c5a6a5 0px,
        #c5a6a5 4px,
        #d9c3c2 4px,
        #d9c3c2 8px
    );
    height: 2px;
    opacity: 0.7;
}

.river-path {
    background: linear-gradient(
        90deg,
        rgba(157, 110, 109, 0.4) 0%,
        rgba(177, 137, 136, 0.6) 50%,
        rgba(197, 166, 165, 0.4) 100%
    );
    height: 4px;
    border-radius: 2px;
    animation: flow 4s infinite ease-in-out;
}

@keyframes flow {
    0%,
    100% {
        opacity: 0.6;
    }
    50% {
        opacity: 0.9;
    }
}

@keyframes gentlePulse {
    0%, 15% {
        transform: scale(1);
        opacity: 0.8;
        box-shadow: 0 0 0 0 rgba(249, 193, 206, 0.3);
    }
    50% {
        transform: scale(1.15);
        opacity: 1;
        box-shadow: 0 0 0 16px rgba(249, 193, 206, 0.2);
    }
    85%, 100% {
        transform: scale(1);
        opacity: 0.8;
        box-shadow: 0 0 0 0 rgba(249, 193, 206, 0.3);
    }
}

@keyframes hoverGrow {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.25);
    }
}

@keyframes hoverPulse {
    0%, 100% {
        transform: scale(1.25);
        box-shadow:
            inset 4px 4px 16px rgba(255, 255, 255, 0.4),
            inset -4px -4px 16px rgba(0, 0, 0, 0.5),
            0 12px 40px rgba(249, 193, 206, 0.4),
            0 0 50px rgba(249, 193, 206, 0.3),
            0 0 0 4px rgba(249, 193, 206, 0.2);
    }
    50% {
        transform: scale(1.3);
        box-shadow:
            inset 4px 4px 16px rgba(255, 255, 255, 0.5),
            inset -4px -4px 16px rgba(0, 0, 0, 0.6),
            0 16px 50px rgba(249, 193, 206, 0.5),
            0 0 70px rgba(249, 193, 206, 0.4),
            0 0 0 6px rgba(249, 193, 206, 0.3);
    }
}
.point {
    position: fixed;
    width: 130px;
    height: 130px;
    background: rgba(249, 193, 206, 0.6);
    border: 3px dashed #f9c1ce;
    border-radius: 50%;
    cursor: crosshair;
    pointer-events: all;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    transform-origin: center center;
    box-shadow:
        inset 2px 2px 8px rgba(255, 255, 255, 0.8),
        inset -2px -2px 8px rgba(249, 193, 206, 0.6),
        0 0 0 2px rgba(249, 193, 206, 0.9),
        0 0 0 4px rgba(255, 255, 255, 0.5),
        0 6px 16px rgba(0, 0, 0, 0.6),
        0 12px 32px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(249, 193, 206, 0.4);
    transform: scale(1);
    animation: gentlePulse 6s ease-in-out infinite;
}

/* Disable pulse animation for visited points */
.point.visited {
    animation: none;
}

/* Create overlay to dim everything except selected circle */
.dimming-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease-out;
    z-index: 9;
}

.dimming-overlay.active {
    opacity: 1;
}

/* Reset background brightness when no circle is selected */
.background-container {
    filter: brightness(1) contrast(1);
    transition: filter 0.5s ease-out;
}

/* Ensure visited points don't pulse even when deselecting */
.point.visited.deselecting {
    animation: shrinkCircle 0.3s ease-out;
}

.point:hover {
    border-color: #f9c1ce;
    background: linear-gradient(
        145deg,
        rgba(249, 193, 206, 0.2),
        rgba(157, 110, 109, 0.3)
    );
    box-shadow:
        inset 2px 2px 8px rgba(255, 255, 255, 0.4),
        inset -2px -2px 8px rgba(0, 0, 0, 0.5),
        0 6px 20px rgba(249, 193, 206, 0.4),
        0 0 25px rgba(249, 193, 206, 0.3),
        0 0 0 2px rgba(249, 193, 206, 0.2);
    animation: hoverGrow 0.4s ease-out forwards, hoverPulse 3s ease-in-out infinite 0.4s;
}

.point.selected {
    background: rgba(157, 110, 109, 0.3);
    border-color: #f9c1ce;
    animation: selectedPulse 2s infinite ease-in-out, rotateBorder 90s linear infinite, growCircle 0.3s ease-out;
    box-shadow:
        0 0 0 0 rgba(249, 193, 206, 0.7),
        0 0 20px rgba(249, 193, 206, 0.5),
        inset 2px 2px 8px rgba(255, 255, 255, 0.4),
        inset -2px -2px 8px rgba(0, 0, 0, 0.4);
    transform: scale(4);
    backdrop-filter: brightness(1.0) contrast(1.0) saturate(1.0);
}

.point.deselecting {
    animation: shrinkCircle 0.3s ease-out;
    transform: scale(1);
}

/* Scene circles inherit all styling from .point - no custom overrides */

.point.zooming {
    z-index: 1000;
    animation: pulseZoom 0.4s ease-out;
}

@keyframes pulseZoom {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(249, 193, 206, 0.4);
    }
    30% {
        transform: scale(1.1);
        box-shadow: 0 0 0 30px rgba(249, 193, 206, 0.3);
    }
    60% {
        transform: scale(1.15);
        box-shadow: 0 0 0 50px rgba(249, 193, 206, 0.2);
    }
    100% {
        transform: scale(1.2);
        box-shadow: 0 0 0 70px rgba(249, 193, 206, 0);
    }
}

@keyframes rotateBorder {
    0% {
        border-color: #f9c1ce;
        transform: scale(4) rotate(0deg);
    }
    25% {
        border-color: rgba(249, 193, 206, 0.8);
    }
    50% {
        border-color: rgba(249, 193, 206, 0.6);
    }
    75% {
        border-color: rgba(249, 193, 206, 0.9);
    }
    100% {
        border-color: #f9c1ce;
        transform: scale(4) rotate(360deg);
    }
}

@keyframes growCircle {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(4);
    }
}

@keyframes shrinkCircle {
    0% {
        transform: scale(4);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes selectedPulse {
    0% {
        box-shadow:
            0 0 0 0 rgba(249, 193, 206, 0.7),
            0 0 20px rgba(249, 193, 206, 0.5),
            inset 2px 2px 8px rgba(255, 255, 255, 0.4),
            inset -2px -2px 8px rgba(0, 0, 0, 0.4);
    }
    50% {
        box-shadow:
            0 0 0 0 rgba(249, 193, 206, 0.7),
            0 0 40px rgba(249, 193, 206, 0.8),
            inset 2px 2px 8px rgba(255, 255, 255, 0.4),
            inset -2px -2px 8px rgba(0, 0, 0, 0.4);
    }
    100% {
        box-shadow:
            0 0 0 0 rgba(249, 193, 206, 0.7),
            0 0 20px rgba(249, 193, 206, 0.5),
            inset 2px 2px 8px rgba(255, 255, 255, 0.4),
            inset -2px -2px 8px rgba(0, 0, 0, 0.4);
    }
}

/* Connection lines between points - HIDDEN */
.connection-lines {
    display: none; /* Hide pink connection lines as requested */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.simple-line {
    display: none; /* Hide pink connection lines as requested */
    position: absolute;
    background: #9d6e6d;
    opacity: 0.8;
    pointer-events: none;
    border-radius: 2px;
}

@keyframes pulse {
    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.9;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 1;
    }
}

/* Improved dialogue panel */
.dialogue-panel {
    position: fixed;
    top: 25vh;
    right: 0;
    width: 450px;
    height: 60vh;
    background: rgba(153, 111, 105, 0.8);
    backdrop-filter: blur(20px);
    border-left: 2px solid rgba(249, 193, 206, 0.4);
    border-top: 2px solid rgba(249, 193, 206, 0.4);
    border-bottom: 2px solid rgba(249, 193, 206, 0.4);
    border-right: 2px solid rgba(249, 193, 206, 0.4);
    border-radius: 16px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s ease-out;
    z-index: 5000; /* High enough to block background clicks, below help overlay */
    pointer-events: auto; /* Ensure dialogue blocks clicks to background */
}

/* Speech bubble line */
.dialogue-panel::before {
    content: '';
    position: absolute;
    left: 0;
    top: var(--line-top, 50%);
    width: var(--line-length, 20px);
    height: 3px;
    background: rgba(249, 193, 206, 0.6);
    transform-origin: right center;
    transform: translateX(-100%) translateY(-50%) rotate(var(--line-angle, 0deg));
    transition: all 0.5s ease-out;
    opacity: 0;
    border-radius: 2px;
}

.dialogue-panel.visible::before {
    opacity: 0.8;
}
.dialogue-panel.visible {
    opacity: 1;
    transform: translateX(0) scale(1);
    animation: dialogueOpen 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dialogueOpen {
    0% {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    70% {
        opacity: 1;
        transform: translateY(0) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dialogue-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dialogue-header {
    padding: 15px 0 0px 20px;
    border-top: 1.5px solid rgba(153, 170, 187, 0.5);
    /* background: rgba(5, 8, 5, 0.7); */
}

.location-title {
    color: #ece1e0;
    font-family: monospace;
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 8px;
}

.dialogue-scroll-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* Text fade masks for scroll areas */
.dialogue-text-container {
    height: 100%;
    overflow-y: auto;
    padding: 25px;
    padding-bottom: 80px;
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0px,
        black 30px,
        black calc(100% - 30px),
        transparent 100%
    );
    mask-image: linear-gradient(
        to bottom,
        transparent 0px,
        black 30px,
        black calc(100% - 30px),
        transparent 100%
    );
}

/* Custom scrollbar styling to match toggle colors */
.dialogue-text-container::-webkit-scrollbar {
    width: 8px;
}

.dialogue-text-container::-webkit-scrollbar-track {
    background: rgba(249, 193, 206, 0.1);
    border-radius: 4px;
}

.dialogue-text-container::-webkit-scrollbar-thumb {
    background: rgba(249, 193, 206, 0.4);
    border-radius: 4px;
    border: 1px solid rgba(249, 193, 206, 0.2);
}

.dialogue-text-container::-webkit-scrollbar-thumb:hover {
    background: rgba(249, 193, 206, 0.6);
    border-color: rgba(249, 193, 206, 0.4);
}

.dialogue-text-container::-webkit-scrollbar-thumb:active {
    background: rgba(249, 193, 206, 0.8);
}

/* Firefox scrollbar styling */
.dialogue-text-container {
    scrollbar-width: thin;
    scrollbar-color: rgba(249, 193, 206, 0.4) rgba(249, 193, 206, 0.1);
}


.dialogue-entry {
    margin-bottom: 25px;
    line-height: 1.7;
}

/* Improved text legibility across all text */
.section-text, .dialogue-speaker, .location-title, .help-item {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6), 0 0 6px rgba(0, 0, 0, 0.25);
    font-weight: 400;
}

.dialogue-speaker {
    font-weight: 500; /* Slightly bolder for speakers */
}

.location-title {
    font-weight: 600; /* Bolder for titles */
}

/* Enhance text contrast */
.section-text {
    color: #f0f0f0; /* Slightly brighter than default */
}

.dialogue-speaker {
    color: #ffffff; /* Pure white for speakers */
}

.location-title {
    color: #ffffff; /* Pure white for location info */
}

.subtitle {
    color: #f9c1ce;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9em;
    margin-bottom: 8px;
}
.dialogue-speaker {
    color: #f9c1ce;
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.dialogue-text {
    color: blue;
    font-size: 1.05em;
}

.section-text {
    color: #ece1e0;
    font-size: 1.2em;
    line-height: 1.65;
    margin-bottom: 18px;
}
.highlight-text {
    color: #f9c1ce;
    /* font-weight: bold; */
    text-decoration: underline dotted;
    transition: color 0.2s ease;
}

.highlight-text:hover {
    color: #ffffff;
}

.dialogue-text-container.typing {
    cursor: pointer;
}

.dialogue-text-container.typing::before {
    content: "Click to skip";
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    /* background: rgba(249, 193, 206, 0.1); */
    color: #ece1e0;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    z-index: 5;
    pointer-events: none;
    transition: color 4s cubic-bezier(0.4, 0, 0.2, 1);
}

.interactive-text {
    color: #f9c1ce;
    text-decoration: underline dotted;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 2px 4px;
    border-radius: 3px;
}

.interactive-text:hover {
    background: rgba(249, 193, 206, 0.2);
    text-decoration: underline solid;
    transform: translateY(-1px);
}

/* Visited interactive text - appears same as regular text once read */
.interactive-text.visited {
    color: rgba(249, 193, 206, 0.6); /* Pale pink - more subtle but still visibly a link */
    text-decoration: underline solid rgba(249, 193, 206, 0.4); /* Keep underline but paler */
    opacity: 1.0;
}

.interactive-text.visited:hover {
    color: rgba(249, 193, 206, 0.9);
    background: rgba(249, 193, 206, 0.1);
    text-decoration: underline solid rgba(249, 193, 206, 0.7);
    transform: none; /* No lift animation for visited links */
}

/* Minimized dialogue tab for 360° views - matches dialogue panel styling */
.minimized-dialogue-tab {
    position: fixed;
    right: 0;
    top: 20%; /* Same top position as dialogue panel */
    height: 60vh; /* Same height as dialogue panel */
    width: 60px;
    background: rgba(153, 111, 105, 0.8); /* Same background as dialogue panel */
    color: #f9c1ce;
    padding: 20px 8px;
    border-left: 2px solid rgba(249, 193, 206, 0.4);
    border-top: 2px solid rgba(249, 193, 206, 0.4);
    border-bottom: 2px solid rgba(249, 193, 206, 0.4);
    border-radius: 16px 0 0 16px; /* Rounded left side, flat right side */
    cursor: pointer;
    z-index: 1000;
    font-size: 16px;
    font-weight: 600;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(20px); /* Same blur as dialogue panel */
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
    
    /* Animation properties */
    transform: translateX(100%);
    transition: all 0.5s ease-out;
    animation: glow-pulse 2s ease-in-out infinite;
}

/* Show animation for the tab */
.minimized-dialogue-tab.show {
    transform: translateX(0);
}

.minimized-dialogue-tab:hover {
    background: rgba(249, 193, 206, 0.1);
    transform: translateX(-10px);
    box-shadow: -8px 0 20px rgba(249, 193, 206, 0.3);
}

/* Glowing animation to make the tab noticeable */
@keyframes glow-pulse {
    0%, 100% {
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3), 0 0 10px rgba(249, 193, 206, 0.3);
    }
    50% {
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3), 0 0 20px rgba(249, 193, 206, 0.6);
    }
}

/* Back to street view button for 360° views */
.back-to-street-button {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(153, 111, 105, 0.9);
    color: #f9c1ce;
    padding: 12px 20px;
    border: 2px solid rgba(249, 193, 206, 0.4);
    border-radius: 25px;
    cursor: pointer;
    z-index: 1000;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(20px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.back-to-street-button:hover {
    background: rgba(249, 193, 206, 0.2);
    transform: translateX(-50%) translateY(-3px);
    box-shadow: 0 8px 20px rgba(249, 193, 206, 0.3);
}

.back-to-street-button svg {
    flex-shrink: 0;
}

/* Text styling classes - non-clickable text effects */
.text-bold {
    font-weight: 600;
    color: #e8e8e8;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.1);
}


/* Hover title for circle points */
.hover-title {
    position: fixed;
    background: rgba(153, 111, 105, 0.9);
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 28px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6), 0 0 6px rgba(0, 0, 0, 0.25);
    border: 2px solid rgba(217, 195, 194, 0.5);
    box-shadow: 
        0 15px 40px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    z-index: 9999;
    pointer-events: none;
    white-space: nowrap;
    opacity: 0;
    transform: scale(0.8) translateY(10px);
    transition: all 0.2s ease-out;
    backdrop-filter: blur(20px);
}

.hover-title.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.back-button {
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
    color: #f9c1ce;
    opacity: 0.9;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(249, 193, 206, 0.1);
    border: 1px solid rgba(249, 193, 206, 0.3);
    font-size: 14px;
    width: fit-content;
}

.back-button:hover {
    opacity: 1;
    color: #ffffff;
    background: rgba(249, 193, 206, 0.25);
    border-color: rgba(249, 193, 206, 0.5);
    transform: translateY(-1px);
}

.back-button svg {
    vertical-align: middle;
    fill: currentColor;
}

/* Enhanced gradient fade - attached to dialogue panel for consistent positioning */
.dialogue-panel::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--gradient-height, 60px); /* Use dynamic height or fallback to 60px */
    background: linear-gradient(transparent, rgba(249, 193, 206, 0.3));
    pointer-events: none;
    z-index: 10;
    border-radius: 0 0 16px 16px; /* Match dialogue panel border radius */
    transition: height 0.5s cubic-bezier(0.23, 1, 0.32, 1); /* Smooth height transition to match dialogue growth */
}

/* Help overlay */
.help-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(153, 111, 105, 0.8);
    backdrop-filter: blur(15px);
    border-radius: 16px;
    padding: 30px;
    z-index: 10000; /* Increased to be above dialogue panels */
    transition: all 0.4s ease, background-color 4s cubic-bezier(0.4, 0, 0.2, 1), border-color 4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(217, 195, 194, 0.5);
    min-width: 600px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 16px;
    pointer-events: auto; /* Ensure clicks work */
}

.help-overlay.hidden {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
    pointer-events: none;
}

.help-close {
    align-self: center;
    margin-top: 8px;
    font-family: monospace;
    background: rgba(249, 193, 206, 0.3);
    border: 2px solid rgba(249, 193, 206, 0.7);
    border-radius: 8px;
    color: #f9c1ce;
    padding: 15px 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 1em;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001; /* Ensure button is clickable */
    position: relative;
    pointer-events: auto;
    /* Ensure button is above everything */
    isolation: isolate;
}

.help-close:hover {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #ffffff;
    color: #ffffff;
    transform: translateY(-2px);
}

.help-item {
    display: flex;
    align-items: center;
    color: #ece1e0;
    font-size: 1.1em;
    margin-bottom: 16px;
}

.help-icon {
    width: 28px;
    height: 28px;
    margin-right: 16px;
    flex-shrink: 0;
}

/* Pink text demo */
.pink-text-demo {
    color: #f9c1ce;
    font-size: 0.8em;
    text-decoration: underline dotted;
    cursor: pointer;
    width: auto;
    height: auto;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Desktop/mobile text variants */
.desktop-text {
    display: inline;
}

.mobile-text {
    display: none;
}

.help-icon svg {
    fill: #ece1e0;
    stroke: #ece1e0;
    transition: all 0.4s ease, fill 4s cubic-bezier(0.4, 0, 0.2, 1), stroke 4s cubic-bezier(0.4, 0, 0.2, 1);
}

.speed-toggle-icon {
    width: 28px;
    height: 28px;
    margin-right: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(249, 193, 206, 0.2);
    border: 1px solid rgba(249, 193, 206, 0.5);
    border-radius: 4px;
    color: #f9c1ce;
    font-size: 0.5em;
    font-weight: 500;
    padding: 1px 2px;
    text-align: center;
}

.help-icon.clickpoint-style {
    background: radial-gradient(
        circle at 30% 30%,
        rgba(255, 255, 255, 0.2),
        rgba(0, 0, 0, 0.1)
    );
    border: 2px dashed #e8e8e8;
    border-radius: 50%;
    box-shadow:
        inset 2px 2px 6px rgba(255, 255, 255, 0.3),
        inset -2px -2px 6px rgba(0, 0, 0, 0.4),
        0 4px 12px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Separate intro overlay - appears first */
.intro-overlay {
    position: fixed;
    top: 20vh;
    right: 20px;
    width: 500px;
    max-height: 70vh;
    background: rgba(153, 111, 105, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 30px;
    z-index: 10001; /* Higher than help overlay */
    transition: all 0.4s ease;
    border: 2px solid rgba(217, 195, 194, 0.5);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    text-align: left;
    pointer-events: auto;
    overflow-y: auto;
    /* Same scrollbar styling as dialogue panels */
    scrollbar-width: thin;
    scrollbar-color: rgba(217, 195, 194, 0.4) rgba(217, 195, 194, 0.1);
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

.intro-overlay.visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}


.intro-content {
    width: 100%;
}

.intro-text {
    margin-bottom: 30px;
}

.intro-text p {
    color: #ece1e0;
    font-size: 1.2em;
    line-height: 1.65;
    margin-bottom: 18px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6), 0 0 6px rgba(0, 0, 0, 0.25);
    font-weight: 400;
    text-align: left;
}

.intro-text p:last-child {
    margin-bottom: 0;
}

.intro-text strong {
    font-weight: 600;
    color: #e8e8e8;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.1);
    padding: 2px 4px;
}

.intro-continue {
    align-self: center;
    padding: 15px 35px;
    border: 2px solid rgba(249, 193, 206, 0.7);
    background: rgba(249, 193, 206, 0.3);
    color: #f9c1ce;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 1.1em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 150px;
}

.intro-continue:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #ffffff;
    color: #ffffff;
    transform: translateY(-2px);
}

/* Mobile responsive */
@media (max-width: 480px) {
    /* Fix viewport stretching */
    body, html {
        width: 100vw;
        height: 100vh;
        overflow: hidden;
        position: fixed;
    }
    
    .visual-novel-container {
        width: 100vw;
        height: 100vh;
        overflow: hidden;
        position: relative;
    }
    
    /* Mobile background - full height with very wide draggable width */
    .background-container {
        width: 800%; /* Much wider for full image width access */
        height: 100vh; /* Full viewport height */
        top: 0; /* Align to top - don't push up over buttons */
        left: -350%; /* Center the much wider container */
        overflow: visible; /* Allow dragging beyond bounds */
    }
    
    .background-image {
        width: 100%;
        height: 100vh; /* Use viewport height */
        object-fit: cover; /* Cover entire area for street view */
        background-position: center center;
        background-repeat: no-repeat;
        position: relative;
    }
    
    /* Scene-specific mobile background - allow full width scrolling */
    .background-image.scene-active {
        background-size: auto 100vh !important; /* Full height, auto width for horizontal scrolling */
        background-position: center center !important;
        background-repeat: no-repeat !important;
    }
    
    /* Ensure background image pseudo-element covers full width on mobile */
    .background-image::before {
        width: 100%;
        height: 100%;
        background-size: cover !important;
        background-position: center center !important;
    }
    
    .dialogue-panel {
        width: calc(100% - 30px); /* Offset left and right */
        height: 35vh; /* Increased size for better readability */
        max-height: 35vh; /* Prevent stretching beyond this */
        top: 70vh;
        bottom: 25px; /* Offset from bottom - increased to clear gradient */
        left: 15px; /* Offset from left */
        /* top: 70px; */
        border-left: 2px solid rgba(249, 193, 206, 0.4);
        border-top: 2px solid rgba(249, 193, 206, 0.4);
        border-right: 2px solid rgba(249, 193, 206, 0.4);
        border-bottom: 2px solid rgba(249, 193, 206, 0.4);
        border-radius: 8px;
        overflow: hidden; /* Prevent content from stretching panel */
        box-sizing: border-box; /* Include borders in size calculation */
    }
    
    /* Hide connector lines on mobile - they don't point correctly */
    .dialogue-panel::before {
        display: none !important;
    }
    
    /* Mobile-specific dialogue opening animation */
    .dialogue-panel.visible {
        animation: dialogueOpenMobile 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    
    @keyframes dialogueOpenMobile {
        0% {
            opacity: 0;
            transform: translateY(50px) scale(0.9);
        }
        70% {
            transform: translateY(-5px) scale(1.02);
        }
        100% {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }
    
    /* Mobile dialogue close animation */
    .dialogue-panel.closing {
        animation: dialogueCloseMobile 0.3s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards;
    }
    
    @keyframes dialogueCloseMobile {
        0% {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
        100% {
            opacity: 0;
            transform: translateY(30px) scale(0.95);
        }
    }
    .help-overlay {
        min-width: 92%;
        padding: 15px;
        gap: 8px;
    }
    
    .help-item {
        font-size: 0.95em;
        margin-bottom: 8px;
    }
    
    .help-icon {
        width: 40px;
        height: 40px;
        margin-right: 20px;
    }
    
    /* Show TAP instead of CLICK on mobile */
    .desktop-text {
        display: none;
    }
    
    .mobile-text {
        display: inline;
    }
    
    .help-close {
        font-size: 1.1em;
        min-width: 80px;
        margin-top: 10px;
        padding: 12px 25px;
    }
    
    .intro-overlay {
        position: fixed;
        bottom: 20px;
        left: 20px;
        right: 20px;
        top: auto;
        width: auto;
        max-height: 60vh;
        padding: 20px;
        opacity: 0;
        transform: scale(0.8);
        pointer-events: none;
    }
    
    .intro-overlay.visible {
        opacity: 1;
        transform: scale(1);
        pointer-events: auto;
    }
    
    
    .intro-text {
        margin-bottom: 20px;
    }
    
    .intro-text p {
        font-size: 1.0em;
        margin-bottom: 15px;
        line-height: 1.5;
    }
    
    .intro-continue {
        font-size: 1.0em;
        padding: 15px 30px;
        min-width: 120px;
        align-self: center;
    }
    

    .ui-overlay {
        top: 15px;
        left: 15px;
        font-size: 0.85em;
        padding: 12px;
    }
    .point {
        width: 80px;
        height: 80px;
        border-width: 2px;
    }
    
    .point.active,
    .point:hover {
        width: 110px;
        height: 110px;
    }
    .dialogue-text-container {
        padding: 0px 26px 0 10px;
        max-height: calc(50vh - 80px); /* Ensure it fits within dialogue panel */
        overflow-y: auto; /* Allow scrolling if content is too long */
        box-sizing: border-box;
    }
    .dialogue-header {
        padding: 15px 0 5px 20px; /* Reduced bottom padding to close gap with mobile-paragraph-container */
        display: flex;
        align-items: center; /* Vertically center the content */
        min-height: 50px; /* Ensure enough height for proper centering */
    }
    .text-speed-control {
        font-size: 0.55em;
        padding: 1px 4px;
        border-width: 1px;
        border-radius: 2px;
        margin-right: 8px;
    }
    
    .dialogue-header-controls {
        padding-right: 10px;
    }

    .section-text {
        font-size: 1.0em;
        line-height: 1.5;
        margin-top: 20px; /* More spacing before section text */
    }
    
    .dialogue-speaker {
        font-size: 0.8em;
        margin-top: 14px; /* More spacing above speaker */
        margin-bottom: -7px; /* More spacing after speaker */
    }
    
    .location-title {
        font-size: 1.1em;
    }
    
    
    /* Mobile panorama points - smaller for better mobile experience */
    .panorama-point.interactive-link {
        width: 60px;
        height: 60px;
        border: 3px dotted #f9c1ce;
    }
    
    .panorama-point.back-to-street {
        width: 45px;
        height: 45px;
        border: 2px solid #f9c1ce;
    }
    
    .panorama-point.back-to-street svg {
        width: 18px;
        height: 18px;
    }
    
    /* Mobile paragraph dialogue system styles */
    .mobile-paragraph-container {
        position: relative;
        padding: 10px 0;
    }
    
    /* Ensure mobile paragraph text uses same styling as desktop */
    .mobile-paragraph-container .section-text,
    .mobile-paragraph-container .section-text *,
    .mobile-expanded-container .section-text,
    .mobile-expanded-container .section-text * {
        color: #ece1e0 !important;
        font-size: 1.0em;
        line-height: 1.5;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6), 0 0 6px rgba(0, 0, 0, 0.25);
        font-weight: 400;
    }
    
    .mobile-paragraph-container .dialogue-speaker,
    .mobile-expanded-container .dialogue-speaker {
        color: #f9c1ce !important;
        font-weight: bold;
        font-size: 0.8em;
        text-transform: uppercase;
        margin-bottom: 8px;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6), 0 0 6px rgba(0, 0, 0, 0.25);
    }
    
    /* Override any default text colors that might be applied */
    .mobile-paragraph-container,
    .mobile-expanded-container,
    .dialogue-panel .mobile-paragraph-container,
    .dialogue-panel .mobile-expanded-container,
    .dialogue-panel .mobile-paragraph-container *,
    .dialogue-panel .mobile-expanded-container * {
        color: #ece1e0 !important;
    }
    
    /* Force all text elements in mobile containers to use proper colors */
    .dialogue-panel .mobile-paragraph-container .dialogue-entry,
    .dialogue-panel .mobile-expanded-container .dialogue-entry,
    .dialogue-panel .mobile-paragraph-container .dialogue-entry *,
    .dialogue-panel .mobile-expanded-container .dialogue-entry * {
        color: #ece1e0 !important;
    }
    
    /* Ensure interactive text has proper styling */
    .mobile-paragraph-container .interactive-text,
    .mobile-expanded-container .interactive-text {
        color: #f9c1ce !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6), 0 0 6px rgba(0, 0, 0, 0.25);
    }
    
    .mobile-paragraph-container .interactive-text:hover,
    .mobile-expanded-container .interactive-text:hover {
        background: rgba(249, 193, 206, 0.2) !important;
    }
    
    .mobile-next-arrow {
        display: inline;
        margin-left: 0px;
        color: #f9c1ce;
        cursor: pointer;
        opacity: 0;
        transition: opacity 0.3s ease;
        vertical-align: baseline; /* Align with text baseline */
    }
    
    .mobile-next-arrow svg {
        fill: #f9c1ce;
        width: 16px;
        height: 12px;
        vertical-align: baseline;
    }
    
    /* Expanded mobile dialogue view */
    .dialogue-panel.mobile-expanded {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        z-index: 1000;
    }
    
    .mobile-expanded-container {
        height: 100%;
        overflow-y: auto;
        padding: 20px;
        padding-top: 60px; /* Space for close button */
    }
    
    .mobile-close-button {
        position: absolute;
        top: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        background: rgba(249, 193, 206, 0.9);
        border: 2px solid #f9c1ce;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        color: #1a1a1a;
        cursor: pointer;
        transition: all 0.3s ease;
        z-index: 1001;
    }
    
    .mobile-close-button:hover {
        background: #f9c1ce;
        transform: scale(1.1);
    }
    
    /* Dynamic height sizing for mobile paragraphs */
    .dialogue-panel.dynamic-height {
        /* Height is controlled by JavaScript for smooth animation */
        overflow-y: auto; /* Allow scrolling when content exceeds height */
        display: flex;
        flex-direction: column;
        /* Transition is set by JavaScript for smooth stretching */
    }
    
    /* Content sizes naturally to its contents */
    .dialogue-panel.dynamic-height .dialogue-content {
        height: auto;
        display: flex;
        flex-direction: column;
        overflow: visible;
    }
    
    .dialogue-panel.dynamic-height .dialogue-text-container {
        height: auto; /* Size to content */
        flex: none; /* Don't expand beyond content */
        overflow: visible; /* No scrolling for single paragraphs */
        padding-bottom: 10px;
        padding-left: 0; /* Remove default padding to align with header */
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Smooth content growth */
    }
    
    /* Align mobile paragraph container with location title/subtitle */
    .mobile-paragraph-container {
        padding-left: 20px; /* Match dialogue-header mobile padding */
        padding-right: 20px;
        line-height: 1.6; /* Add more line spacing */
    }
    
    .dialogue-panel.dynamic-height .dialogue-scroll-area {
        height: auto; /* Size to content */
        flex: none; /* Don't expand beyond content */
        overflow: visible; /* No scrolling for single paragraphs */
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Smooth scroll area growth */
    }

    /* Hide "click to skip" text in mobile dialogue system */
    .dialogue-text-container.typing::before {
        display: none !important;
    }

    /* Ensure subtitle is visible in mobile */
    /* location-subtitle removed */
    
}

/* Tablet responsive */
@media (min-width: 481px) and (max-width: 768px) {
    /* Back to street button - position near day/night toggle */
    .back-to-street-button {
        top: 90px; /* Below day/night toggle */
        right: 20px; /* Same horizontal position as day/night toggle */
        left: auto;
        bottom: auto;
        transform: none;
        padding: 12px 18px;
        font-size: 15px;
    }
    
    /* Fix viewport stretching for tablet */
    body, html {
        width: 100vw;
        height: 100vh;
        overflow: hidden;
        position: fixed;
    }
    
    .visual-novel-container {
        width: 100vw;
        height: 100vh;
        overflow: hidden;
        position: relative;
    }
    
    /* Tablet background - similar to mobile but less extreme */
    .background-container {
        width: 380%; /* Wide enough for good draggability to match 7000px images */
        height: 105vh; /* Slightly taller to prevent gaps */
        top: -2.5vh; /* Center vertically */
        left: -140%; /* Center the wider container */
        overflow: visible; /* Allow dragging beyond bounds */
    }
    
    .background-image {
        width: 100%;
        height: 100%; /* Fill container completely */
        object-fit: cover; /* Cover entire area */
        background-size: cover; /* Cover the container */
        background-position: center center;
        background-repeat: no-repeat;
        transform: scale(1.05); /* Moderate zoom for tablet */
        transform-origin: center center;
        min-height: 105vh; /* Match container height */
    }
    
    /* Ensure background image pseudo-element covers full width on tablet */
    .background-image::before {
        width: 100%;
        height: 100%;
        background-size: cover !important;
        background-position: center center !important;
    }
    
    .dialogue-panel {
        width: calc(100% - 40px); /* Similar to mobile with margins */
        height: 45vh; /* Reasonable height for tablet */
        max-height: 45vh;
        bottom: 20px; /* Position from bottom like mobile */
        left: 20px; /* Margin from left */
        top: auto; /* Override top positioning */
        right: auto; /* Override right positioning */
        border-left: 2px solid rgba(249, 193, 206, 0.4);
        border-top: 2px solid rgba(249, 193, 206, 0.4);
        border-bottom: 2px solid rgba(249, 193, 206, 0.4);
        border-right: 2px solid rgba(249, 193, 206, 0.4);
        border-radius: 8px;
        overflow: hidden;
        box-sizing: border-box;
    }
    .help-overlay {
        min-width: 85%;
        padding: 25px;
    }
    
    /* Allow dynamic height resizing on tablet */
    .dialogue-panel.dynamic-height {
        /* Height controlled by JavaScript for smooth animation */
        max-height: none !important;
    }
    
    .help-item {
        font-size: 1.1em;
    }
    
    .help-icon {
        width: 58px; /* Scaled up proportionally from 28px */
        height: 58px;
        margin-right: 32px; /* Scaled up proportionally from 16px */
    }
    
    .help-close {
        font-size: 1.1em; /* Scale up text */
        padding: 31px 63px; /* Scale up padding proportionally */
        min-width: 252px; /* Scale up min-width proportionally */
        margin-top: 16px; /* Scale up margin */
    }
    
    .intro-overlay {
        min-width: 85%;
        max-width: 85%;
        padding: 30px;
    }
    
    .intro-text p {
        font-size: 1.1em;
        margin-bottom: 18px;
        line-height: 1.65;
    }
    
    .intro-continue {
        font-size: 1.05em;
        padding: 16px 32px;
    }
    .point {
        width: 130px;
        height: 130px;
        border-width: 3px;
    }
    
    .point.active,
    .point:hover {
        width: 182px;
        height: 182px;
    }
    
    /* Use medium size (scale 3) instead of largest size (scale 4) for selected circles on tablet */
    .point.selected {
        transform: scale(3);
        animation: selectedPulse 2s infinite ease-in-out, tabletRotateBorder 90s linear infinite, tabletGrowCircle 0.3s ease-out;
    }
    
    .point.deselecting {
        animation: tabletShrinkCircle 0.3s ease-out;
        transform: scale(1);
    }
    
    /* Tablet-specific animations with scale 3 */
    @keyframes tabletRotateBorder {
        0% {
            border-color: #f9c1ce;
            transform: scale(3) rotate(0deg);
        }
        25% {
            border-color: rgba(249, 193, 206, 0.8);
        }
        50% {
            border-color: rgba(249, 193, 206, 0.6);
        }
        75% {
            border-color: rgba(249, 193, 206, 0.9);
        }
        100% {
            border-color: #f9c1ce;
            transform: scale(3) rotate(360deg);
        }
    }
    
    @keyframes tabletGrowCircle {
        0% {
            transform: scale(1);
        }
        100% {
            transform: scale(3);
        }
    }
    
    @keyframes tabletShrinkCircle {
        0% {
            transform: scale(3);
        }
        100% {
            transform: scale(1);
        }
    }
    .dialogue-text-container {
        padding: 10px 25px 0 20px; /* Reduced from 20px to 10px top padding */
        max-height: calc(45vh - 80px); /* Reduced max-height to give more space */
        overflow-y: auto; /* Allow scrolling if content is too long */
        box-sizing: border-box;
    }
    .dialogue-header {
        padding: 10px 0 5px 20px; /* Reduced from 15px/10px to 10px/5px */
    }
    .dialogue-header-controls {
        top: 10px !important; /* Center align with locationTitle - adjusted for new header padding */
    }
    .text-speed-control {
      font-size: 0.6em;
      padding: 2px 6px;
    }

    .section-text {
        font-size: 1.3em;
        line-height: 1.5;
        margin-top: 20px; /* More spacing before section text */
    }
    
    .dialogue-speaker {
        font-size: 1.4em;
        margin-top: 25px; /* More spacing above speaker */
        margin-bottom: 15px; /* More spacing after speaker */
    }
    
    .location-title {
        font-size: 1.3em;
    }
    
    /* location-subtitle removed */
    .spiral-logo {
        width: 60px;
        height: 60px;
        top: 10px;
        right: 10px;
    }
}

/* Desktop responsive */
@media (min-width: 769px) and (max-width: 1024px) {
    .dialogue-panel {
        width: 400px;
    }
    .point {
        width: 104px;
        height: 104px;
    }
    .spiral-logo {
        width: 60px;
        height: 60px;
        right: 160px;
    }
}

@media (min-width: 1025px) {
    .dialogue-panel {
        width: 450px;
    }
    .point {
        width: 130px;
        height: 130px;
    }
    .spiral-logo {
        width: 60px;
        height: 60px;
        right: 160px;
    }
}

/* Custom dialogue positioning */
.dialogue-panel.dialogue-left {
    left: 20px;
    right: auto;
    transform: translateX(-100%);
}

.dialogue-panel.dialogue-left.visible {
    transform: translateX(0);
}

.dialogue-panel.dialogue-right {
    right: 20px;
    left: auto;
    transform: translateX(100%);
}

.dialogue-panel.dialogue-right.visible {
    transform: translateX(0);
}

.dialogue-panel.dialogue-top {
    top: 15vh; /* More centered position instead of flush to top */
    bottom: auto;
    transform: translateY(-100%);
}

.dialogue-panel.dialogue-top.visible {
    transform: translateY(0);
}

/* Ensure mobile top dialogues respect header space */
@media (max-width: 480px) {
    .dialogue-panel.dialogue-top {
        top: 70px;
    }
}

.dialogue-panel.dialogue-bottom {
    bottom: 20px;
    top: auto;
    transform: translateY(100%);
}

.dialogue-panel.dialogue-bottom.visible {
    transform: translateY(0);
}

/* Ensure bottom positioned dialogue panels can grow with content on mobile */
@media (max-width: 480px) {
    .dialogue-panel.dialogue-bottom {
        height: 150px !important; /* Start small */
        max-height: 60vh !important;
        min-height: 150px;
        overflow: hidden; /* Prevent overflow during animation */
    }
    
    .dialogue-panel.dialogue-bottom.dynamic-height {
        height: auto !important; /* Allow growth when dynamic-height is added */
        min-height: auto !important;
        overflow-y: auto; /* Allow scrolling when needed */
    }
    
    .dialogue-panel.dialogue-bottom .dialogue-scroll-area {
        height: auto !important;
        max-height: 50vh;
        overflow-y: auto;
    }
}

/* Day/Night toggle at top center */
.day-night-toggle {
    position: fixed;
    top: 10px;
    right: 80px; /* Next to help button */
    width: 60px;
    height: 60px;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 6000; /* Above dialogue panels */
    padding: 0; /* Remove padding for better centering */
}

.day-night-toggle:hover {
    /* background: rgba(255, 255, 255, 1); */
    border-color: #f9c1ce; /* Pink border on hover in day mode */
}

.day-night-toggle svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: white; /* Default white */
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: all 0.3s ease;
}

/* Pink active state when night mode is active */
body.high-contrast .day-night-toggle svg {
    stroke: #f9c1ce; /* Pink when night mode active */
}

.day-night-toggle:hover svg {
    stroke: #f9c1ce; /* Pink on hover */
}

/* Pink hover even in night mode */
body.high-contrast .day-night-toggle:hover svg {
    stroke: #ffffff; /* White on hover when in night mode */
}

/* Help button at top right */
.help-button {
    position: fixed;
    top: 10px;
    right: 163px;
    width: 60px;
    height: 60px;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: none; /* Hidden by default until help overlay is closed first time */
    align-items: center;
    justify-content: center;
    z-index: 6000; /* Above dialogue panels */
    padding: 0; /* Remove padding for better centering */
    font-family: 'Raleway', sans-serif;
}

.help-button svg {
    width: 30px;
    height: 30px;
    stroke: white; /* Default white when inactive */
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    transition: all 0.3s ease;
}

/* Pink active state when help overlay is visible */
.help-overlay:not(.hidden) ~ .help-button svg,
.help-button.active svg {
    stroke: #f9c1ce; /* Pink when help overlay is active */
}

.help-button.show {
    display: flex;
}

.help-button:hover svg {
    stroke-width: 3;
    transform: scale(1.1);
    stroke: #f9c1ce; /* Pink on hover */
}

/* White hover when help overlay is active */
.help-overlay:not(.hidden) ~ .help-button:hover svg,
.help-button.active:hover svg {
    stroke: #ffffff; /* White on hover when active */
}

/* Help button in high contrast mode */
body.high-contrast .help-button {
    border-color: #f9c1ce;
    color: #f9c1ce;
}

body.high-contrast .help-button:hover {
    border-color: #ffffff;
    color: #ffffff;
}

/* Dialogue Header Controls */
.dialogue-header {
    position: relative;
    padding-right: 120px;
}

.dialogue-header-controls {
    position: absolute;
    top: 10px;
    right: 15px;
    display: flex;
    gap: 20px; /* More padding for finger tapping */
    z-index: 10;
}

.header-control {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px; /* More padding for easier tapping */
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-control:hover {
    opacity: 0.7;
}

.header-control svg {
    width: 22px;
    height: 22px;
    fill: none; /* Remove fill for outlined icons */
    stroke: #ffffff; /* White outlined icons */
    stroke-width: 1.5; /* Make outline more visible */
    stroke-linecap: round;
    stroke-linejoin: round;
}

.text-speed-control {
    background: rgba(249, 193, 206, 0.2);
    border: 1px solid rgba(249, 193, 206, 0.5);
    border-radius: 4px;
    color: #f9c1ce;
    padding: 4px 8px;
    font-size: 0.9em;
}

.text-speed-control:hover {
    color: #ffffff;
    border-color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.text-speed-control.speed-changed {
    border-color: rgba(249, 193, 206, 0.5);
    color: #f9c1ce;
    box-shadow: 0 0 5px rgba(249, 193, 206, 0.3);
}

/* High contrast mode styles */
body.high-contrast {
    /* filter: contrast(150%) brightness(120%); */
}

/* Add smooth transitions to all elements that change color in high contrast mode */
.dialogue-panel {
    transition: background-color 4s cubic-bezier(0.4, 0, 0.2, 1), border-color 4s cubic-bezier(0.4, 0, 0.2, 1);
}

.interactive-text, .back-button, .location-title, .section-text, .help-item, .header-control svg, .text-speed-control, .speed-toggle-icon, .help-close, .point {
    transition: color 0.2s ease, fill 0.2s ease, stroke 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.panorama-point {
    /* No transitions to prevent bounce-back effect */
}

/* OLD SYSTEM DISABLED - Using new JavaScript overlay system instead */
/*
body.high-contrast .background-image::after {
    opacity: 1;
}
*/

body.high-contrast .dialogue-panel {
    background: rgba(26, 26, 26, 1);
    border-color: #f9c1ce;
}

body.high-contrast .interactive-text {
    color: #ffffff;
}

body.high-contrast .interactive-text:hover {
    background: rgba(249, 193, 206, 0.4);
    color: #f9c1ce;
}

body.high-contrast .back-button {
    color: #ffffff;
}

body.high-contrast .back-button:hover {
    background: rgba(249, 193, 206, 0.4);
    color: #f9c1ce;
}

body.high-contrast .location-title {
    color: #f9c1ce;
}

body.high-contrast .section-text {
    color: #f9c1ce;
}

body.high-contrast .help-overlay {
    background: rgba(0, 0, 0, 0.95);
    border-color: #f2f2f2;
}

body.high-contrast .help-item {
    color: #ffffff;
}

body.high-contrast .intro-overlay {
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #f2f2f2;
}

body.high-contrast .intro-text p {
    color: #f9c1ce;
}

body.high-contrast .intro-text strong {
    color: #ffffff;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.3);
}

body.high-contrast .intro-continue {
    color: #ffffff;
    border-color: #ffffff;
    background: transparent;
}

body.high-contrast .intro-continue:hover {
    color: #f9c1ce;
    border-color: #f9c1ce;
    background: rgba(249, 193, 206, 0.4);
}

/* Keep dark hover title styling in night mode */
body.high-contrast .hover-title {
    background: rgba(26, 26, 26, 0.95);
    color: rgba(249, 193, 206, 0.7);
    border: 2px solid rgba(249, 193, 206, 0.2);
    text-shadow: 0 0 10px rgba(249, 193, 206, 0.3);
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.4),
        0 0 15px rgba(249, 193, 206, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Imprint overlay styles - based on help overlay */
.imprint-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(153, 111, 105, 0.8);
    backdrop-filter: blur(15px);
    border-radius: 16px;
    padding: 30px;
    min-width: 500px;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: left;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
    border: 2px solid rgba(217, 195, 194, 0.5);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.imprint-overlay.hidden {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
    pointer-events: none;
}

.imprint-content {
    width: 100%;
}

.imprint-title {
    color: #ffffff;
    font-size: 1.8em;
    font-weight: bold;
    margin-bottom: 20px;
    text-transform: uppercase;
    text-align: center;
}

.imprint-section {
    margin-bottom: 16px;
}

.imprint-role {
    color: #f9c1ce;
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.imprint-name {
    color: #ffffff;
    font-size: 1em;
    margin: 0;
    line-height: 1.4;
}

.imprint-close {
    align-self: center;
    margin-top: 20px;
    padding: 8px 20px;
    border: 2px solid #ece1e0;
    background: transparent;
    color: #ece1e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 1em;
}

.imprint-close:hover {
    border-color: #f9c1ce;
    color: #f9c1ce;
    background: rgba(249, 193, 206, 0.1);
}

/* Imprint overlay mobile responsiveness */
@media (max-width: 480px) {
    .imprint-overlay {
        min-width: 90%;
        padding: 20px;
    }
    
    .imprint-title {
        font-size: 1.5em;
    }
    
    .imprint-role {
        font-size: 1em;
    }
}

/* Imprint overlay tablet responsiveness */
@media (min-width: 481px) and (max-width: 768px) {
    .imprint-overlay {
        min-width: 85%;
        padding: 25px;
    }
}

/* High contrast mode support for imprint overlay */
body.high-contrast .imprint-overlay {
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #f2f2f2;
}

body.high-contrast .imprint-title,
body.high-contrast .imprint-name {
    color: #ffffff;
}

body.high-contrast .imprint-role {
    color: #f9c1ce;
}

body.high-contrast .imprint-close {
    color: #ffffff;
    border-color: #ffffff;
    background: transparent;
}

body.high-contrast .imprint-close:hover {
    color: #f9c1ce;
    border-color: #f9c1ce;
    background: rgba(249, 193, 206, 0.4);
}

.credits-overlay.hidden {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
    pointer-events: none;
}

.credits-content {
    width: 100%;
}

.credits-title {
    color: #ffffff;
    font-size: 1.8em;
    font-weight: bold;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.credits-section {
    margin-bottom: 16px;
}

.credits-role {
    color: #f9c1ce;
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.credits-name, .credits-contributors {
    color: #ffffff;
    font-size: 1em;
    margin: 0;
    line-height: 1.4;
}

.credits-close {
    align-self: center;
    margin-top: 20px;
    padding: 8px 20px;
    border: 2px solid #ece1e0;
    background: transparent;
    color: #ece1e0;
    border-radius: 4px;
    cursor: pointer;
    font-family: "QuestaSansLight", sans-serif;
    font-size: 0.9em;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.credits-close:hover {
    border-color: #f9c1ce;
    color: #f9c1ce;
    background: rgba(249, 193, 206, 0.1);
}

/* Credits overlay mobile responsiveness */
@media (max-width: 480px) {
    .credits-overlay {
        min-width: 90%;
        padding: 20px;
    }
    
    .credits-title {
        font-size: 1.5em;
    }
    
    .credits-role {
        font-size: 1em;
    }
}

/* Credits overlay tablet responsiveness */
@media (min-width: 481px) and (max-width: 768px) {
    .credits-overlay {
        min-width: 85%;
        padding: 25px;
    }
}

/* Credits overlay high contrast mode */
body.high-contrast .credits-overlay {
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #f2f2f2;
}

body.high-contrast .credits-title,
body.high-contrast .credits-name,
body.high-contrast .credits-contributors {
    color: #ffffff;
}

body.high-contrast .credits-role {
    color: #f9c1ce;
}

body.high-contrast .credits-close {
    color: #ffffff;
    border-color: #ffffff;
    background: transparent;
}

body.high-contrast .credits-close:hover {
    color: #f9c1ce;
    border-color: #f9c1ce;
    background: rgba(249, 193, 206, 0.4);
}

body.high-contrast .help-icon svg {
    fill: #ece1e0;
    stroke: #ece1e0;
}

body.high-contrast .header-control svg {
    fill: #ffffff;
    stroke: #ffffff;
}

/* Moon icon turns white on hover in dark mode */
body.high-contrast .header-control:hover svg {
    fill: #ffffff;
    stroke: #ffffff;
}

body.high-contrast .header-control:hover {
    border-color: #ffffff;
}

/* Sun icon center goes white on hover */
.header-control:hover svg circle {
    fill: #ffffff;
}

/* Sun icon paths (rays) also go white on hover */
.header-control:hover svg path {
    stroke: #ffffff;
}

body.high-contrast .text-speed-control {
    color: #ffffff;
    border-color: #ffffff;
    background: transparent;
}

body.high-contrast .text-speed-control:hover {
    color: #f9c1ce;
    border-color: #f9c1ce;
    background: rgba(249, 193, 206, 0.1);
}

/* Style ZEN text in help overlay to match text speed toggle in dark mode */
body.high-contrast .speed-toggle-icon {
    color: #ffffff;
    border-color: #ffffff;
    background: transparent;
}

/* Style OK button in help panel white, pink on hover in dark mode */
body.high-contrast .help-close {
    color: #ffffff;
    border-color: #ffffff;
    background: transparent;
}

body.high-contrast .help-close:hover {
    color: #f9c1ce;
    border-color: #f9c1ce;
    background: rgba(249, 193, 206, 0.4);
}

/* Day/Night toggle in high contrast mode */
body.high-contrast .day-night-toggle {
    border-color: #f9c1ce;
}

body.high-contrast .day-night-toggle svg {
    fill: #f9c1ce; /* Pink moon icon in night mode */
    stroke: #f9c1ce;
}

body.high-contrast .day-night-toggle:hover {
    border-color: #f9c1ce; /* Pink border on hover in night mode */
}

body.high-contrast .day-night-toggle:hover svg {
    fill: #f9c1ce; /* Pink icon on hover in night mode */
    stroke: #f9c1ce;
}

/* Point circles in high contrast mode */
body.high-contrast .point {
    border-color: #f9c1ce;
}

body.high-contrast .point:hover {
    border-color: #ffffff;
}

/* Panorama point circles in high contrast mode */
body.high-contrast .panorama-point {
    border-color: #f9c1ce;
}

body.high-contrast .panorama-point:hover {
    border-color: #ffffff;
}
.spiral-logo {
    position: fixed;
    top: 10px;
    right: 10px; /* Move to rightmost position */
    width: 60px;
    height: 60px;
    z-index: 2000;
    opacity: 0.8;
    transition: opacity 0.3s ease, transform 0.2s ease;
    overflow: visible;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spiral-logo svg {
    width: 45px;
    height: 45px;
    transition: fill 4s cubic-bezier(0.4, 0, 0.2, 1);
}

.spiral-logo:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Pink spiral logo in dark mode */
body.high-contrast .spiral-logo svg {
    fill: #f9c1ce;
}


/* Panorama container */
.panorama-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    transition: opacity 0.5s ease-in-out;
}

.panorama-container canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* Panorama overlay for HTML click points */
.panorama-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* Allow drag events to pass through */
    display: block; /* Show panorama circles again */
}

/* Panorama overlay points */
.panorama-point {
    position: absolute;
    width: 150px;
    height: 150px;
    background: radial-gradient(
        circle at 30% 30%,
        rgba(255, 255, 255, 0.2),
        rgba(0, 0, 0, 0.1)
    );
    border: 7px dashed #e8e8e8;
    border-radius: 50%;
    cursor: crosshair;
    pointer-events: auto;
    z-index: 11;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translate(-50%, -50%) scale(1);
    box-shadow:
        inset 5px 5px 15px rgba(255, 255, 255, 0.3),
        inset -5px -5px 15px rgba(0, 0, 0, 0.4),
        0 10px 30px rgba(0, 0, 0, 0.3),
        0 0 0 2px rgba(255, 255, 255, 0.1);
    animation: gentlePulse 6s ease-in-out infinite;
}

/* Interactive link panorama points - smaller and with different styling */
.panorama-point.interactive-link {
    width: 100px;
    height: 100px;
    border: 5px dotted #f9c1ce;
    background: radial-gradient(
        circle at 30% 30%,
        rgba(249, 193, 206, 0.3),
        rgba(157, 110, 109, 0.2)
    );
    box-shadow:
        inset 3px 3px 10px rgba(249, 193, 206, 0.4),
        inset -3px -3px 10px rgba(0, 0, 0, 0.3),
        0 8px 20px rgba(249, 193, 206, 0.3),
        0 0 0 2px rgba(249, 193, 206, 0.2);
}

.panorama-point:hover {
    border-color: #f9c1ce;
    background: linear-gradient(
        145deg,
        rgba(249, 193, 206, 0.2),
        rgba(157, 110, 109, 0.3)
    );
    box-shadow:
        inset 5px 5px 20px rgba(255, 255, 255, 0.4),
        inset -5px -5px 20px rgba(0, 0, 0, 0.5),
        0 15px 50px rgba(249, 193, 206, 0.4),
        0 0 60px rgba(249, 193, 206, 0.3),
        0 0 0 5px rgba(249, 193, 206, 0.2);
    transform: translate(-50%, -50%) scale(1.33);
}

.panorama-point.selected {
    background: rgba(157, 110, 109, 0.3);
    border-color: #f9c1ce;
    animation: panoramaSelectedPulse 2s infinite ease-in-out, panoramaRotateBorder 90s linear infinite, panoramaGrowCircle 0.3s ease-out;
    box-shadow:
        0 0 0 0 rgba(249, 193, 206, 0.7),
        0 0 50px rgba(249, 193, 206, 0.5),
        inset 5px 5px 20px rgba(255, 255, 255, 0.4),
        inset -5px -5px 20px rgba(0, 0, 0, 0.4);
    transform: translate(-50%, -50%) scale(2);
}

/* Ensure visited points don't pulse even when deselecting */
.panorama-point.visited.deselecting {
    animation: panoramaShrinkCircle 0.3s ease-out;
}

.panorama-point.deselecting {
    animation: panoramaShrinkCircle 0.3s ease-out;
    transform: translate(-50%, -50%) scale(1);
}

/* Panorama point animations */
@keyframes panoramaRotateBorder {
    0% {
        border-color: #f9c1ce;
        transform: translate(-50%, -50%) scale(2) rotate(0deg);
    }
    25% {
        border-color: rgba(249, 193, 206, 0.8);
    }
    50% {
        border-color: rgba(249, 193, 206, 0.6);
    }
    75% {
        border-color: rgba(249, 193, 206, 0.9);
    }
    100% {
        border-color: #f9c1ce;
        transform: translate(-50%, -50%) scale(2) rotate(360deg);
    }
}

@keyframes panoramaGrowCircle {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
    }
}

@keyframes panoramaShrinkCircle {
    0% {
        transform: translate(-50%, -50%) scale(2);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Disable pulse animation for visited panorama points */
.panorama-point.visited {
    animation: none;
}

/* Back to street view button in panorama - styled as dashed circle like other points */
.panorama-point.back-to-street {
    width: 55px;
    height: 55px;
    background: rgba(249, 193, 206, 0.8);
    border: 3px solid #f9c1ce;
    border-radius: 50%;
    cursor: pointer;
    /* No transition to prevent bounce-back effect */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        inset 2px 2px 8px rgba(255, 255, 255, 0.6),
        inset -2px -2px 8px rgba(157, 110, 109, 0.4),
        0 0 0 2px rgba(249, 193, 206, 0.3),
        0 6px 16px rgba(0, 0, 0, 0.4),
        0 12px 32px rgba(0, 0, 0, 0.2);
    animation: gentlePulse 6s ease-in-out infinite;
}

.panorama-point.back-to-street:hover {
    border-color: #ffffff;
    background: rgba(249, 193, 206, 1.0);
    box-shadow:
        inset 2px 2px 8px rgba(255, 255, 255, 0.8),
        inset -2px -2px 8px rgba(157, 110, 109, 0.6),
        0 0 0 3px rgba(255, 255, 255, 0.4),
        0 8px 20px rgba(0, 0, 0, 0.5),
        0 15px 40px rgba(0, 0, 0, 0.3);
    transform: translate(-50%, -50%); /* Removed scale to prevent bounce-back */
}

.panorama-point.back-to-street svg {
    width: 24px;
    height: 24px;
    fill: #ffffff;
    stroke: #ffffff;
}

.panorama-point.back-to-street:hover svg {
    fill: #ffffff;
    stroke: #ffffff;
}

@keyframes panoramaSelectedPulse {
    0% {
        box-shadow:
            0 0 0 0 rgba(249, 193, 206, 0.7),
            0 0 20px rgba(249, 193, 206, 0.5),
            inset 2px 2px 8px rgba(255, 255, 255, 0.4),
            inset -2px -2px 8px rgba(0, 0, 0, 0.4);
    }
    50% {
        box-shadow:
            0 0 0 0 rgba(249, 193, 206, 0.7),
            0 0 40px rgba(249, 193, 206, 0.8),
            inset 2px 2px 8px rgba(255, 255, 255, 0.4),
            inset -2px -2px 8px rgba(0, 0, 0, 0.4);
    }
    100% {
        box-shadow:
            0 0 0 0 rgba(249, 193, 206, 0.7),
            0 0 20px rgba(249, 193, 206, 0.5),
            inset 2px 2px 8px rgba(255, 255, 255, 0.4),
            inset -2px -2px 8px rgba(0, 0, 0, 0.4);
    }
}



/* Mobile responsive for toggles */
@media (max-width: 480px) {

    
    .day-night-toggle {
        width: 50px;
        height: 50px;
        top: 5px;
        right: 45px;
        left: auto;
        transform: none;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }
    
    .day-night-toggle svg {
        width: 22px;
        height: 22px;
    }
    
    .help-button {
        width: 50px;
        height: 50px;
        font-size: 20px;
        top: 5px;
        right: 95px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }
    
    .spiral-logo {
        width: 50px;
        height: 50px;
        top: 5px;
        right: 0px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .spiral-logo svg {
        width: 35px;
        height: 35px;
    }
    
    /* Mobile help close button with better touch responsiveness */
    .help-close {
        font-size: 1.1em;
        padding: 20px 40px; /* Increased padding for better touch target */
        min-width: 140px;
        margin-top: 12px;
        touch-action: manipulation; /* Improve touch responsiveness */
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        /* Better visual feedback on mobile */
        -webkit-tap-highlight-color: rgba(249, 193, 206, 0.3);
    }
    
    .help-close:active {
        background: rgba(249, 193, 206, 0.5);
        transform: translateY(1px);
    }
    
    /* Back to street button - positioned dynamically by JavaScript on mobile */
    .back-to-street-button {
        /* Position will be set by JavaScript based on dialogue location */
        padding: 10px 15px;
        z-index: 1000; /* Ensure it stays above other elements */
        font-size: 14px;
    }
    
    
    /* Make text speed and day/night toggles take up more header width */
    .dialogue-header-controls {
        top: 50%; /* Center vertically in header */
        transform: translateY(-50%); /* Perfect vertical centering */
        right: 5px; /* Closer to right edge */
        left: 50%; /* Start from middle of header */
        gap: 8px; /* Reasonable gap between controls */
        display: flex;
        justify-content: flex-end;
        width: calc(50% - 10px); /* Take up half the header width */
    }
    
    .text-speed-control {
        font-size: 0.7em; /* Larger than before but still compact */
        padding: 6px 4px; /* Much narrower horizontal padding */
        border-width: 1px;
        border-radius: 3px;
        margin-right: 0; /* Remove extra margin */
        flex: 0 0 auto; /* Don't grow, just fit content */
        min-width: auto; /* Let it size naturally */
        white-space: nowrap; /* Prevent text wrapping */
    }
    
    .header-control {
        padding: 6px; /* More substantial padding */
        flex-shrink: 0; /* Don't shrink the icon button */
    }
    
    .header-control svg {
        width: 20px; /* Larger icon */
        height: 20px; /* Larger icon */
    }
}



/* Click to skip text should be pink in day/night mode */
body.high-contrast .dialogue-text-container.typing::before {
    color: #f9c1ce;
}

/* 2D Panoramic View System - works like street view */
.panorama-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #1a1a1a;
    z-index: 10;
    overflow: hidden;
}

.panorama-view .panorama-container {
    position: absolute;
    width: 350%; /* Wide 2D panoramic image for horizontal scrolling */
    height: 120%; /* Slightly taller for vertical movement */
    top: -10%;
    left: -125%; /* Center the wide container */
    cursor: grab;
    transition: transform 0.15s ease-out;
    z-index: 1;
}

.panorama-view .panorama-container:active {
    cursor: grabbing;
}

.panorama-view .panorama-container.dragging {
    cursor: grabbing;
}

.panorama-view .panorama-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}


