/* Style for the display view */
#display-view {
    font-family: 'Inter', sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-f, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';

    /* REMOVED: background-image is now set by JS */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* NEW: Add transition for smooth background changes */
    transition: background-image 1s ease-in-out;

    /* NEW: Add a subtle overlay to help text stand out */
    position: relative;
    color: white; /* Ensure text is white for contrast */

    /* NEW: For 3D transitions */
    perspective: 1000px;
    overflow: hidden; /* UPDATED: This now correctly stops the display from scrolling */
}

/* NEW: Overlay style */
#display-view::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3); /* Dark overlay */
    z-index: 1;
}


.park-icon-display,
.park-hours-display,
.ride-name-display,
.wait-time-container,
.countdown-timer,
/* NEW: Add welcome screen elements */
.welcome-resort-icon-display,
.welcome-message-display,
.welcome-countdown-timer {
    position: absolute;
    z-index: 3; /* Above parent containers and overlay */
    transition: top 0.3s ease, left 0.3s ease, bottom 0.3s ease, width 0.3s ease, height 0.3s ease, opacity 0.5s ease, transform 0.3s ease;

    /* NEW: Define CSS variables for default transform (will be overridden by JS) */
    --layout-scale: 1.0;
    --layout-translate-x: 0%;
}

/* NEW: Add welcome screen container */
#welcome-screen-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2; /* Below editable elements, above overlay */
    display: none; /* Hidden by default */
}


/* --- NEW: Hamburger Settings Button Styles --- */
.hamburger-menu-btn {
    position: absolute;
    /* REMOVED: top and left are now handled by pos-- classes */
    /* top: 1rem; */
    /* left: 1rem; */
    width: 44px;
    height: 44px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    z-index: 10;
    padding: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: top 0.3s ease, left 0.3s ease, bottom 0.3s ease, right 0.3s ease; /* NEW: Add transition */
}


.hamburger-line {
    width: 20px;
    height: 2px;
    background-color: white;
    margin: 2px 0;
    transition: all 0.3s ease;
}

/* --- FIX: Added Hamburger Position Overrides --- */
.hamburger-menu-btn.pos--top-left {
    top: 1rem;
    left: 1rem;
    bottom: auto;
    right: auto;
}
.hamburger-menu-btn.pos--top-right {
    top: 1rem;
    left: auto;
    bottom: auto;
    right: 1rem;
}
.hamburger-menu-btn.pos--bottom-left {
    top: auto;
    left: 1rem;
    bottom: 1rem;
    right: auto;
}
.hamburger-menu-btn.pos--bottom-right {
    top: auto;
    left: auto;
    bottom: 1rem;
    right: 1rem;
}
.hamburger-menu-btn.pos--none {
    display: none;
}

/* Add responsive padding for larger screens */
@media (min-width: 640px) {
    .hamburger-menu-btn.pos--top-left {
        top: 1.5rem;
        left: 1.5rem;
    }
    .hamburger-menu-btn.pos--top-right {
        top: 1.5rem;
        right: 1.5rem;
    }
    .hamburger-menu-btn.pos--bottom-left {
        bottom: 1.5rem;
        left: 1.5rem;
    }
    .hamburger-menu-btn.pos--bottom-right {
        bottom: 1.5rem;
        right: 1.5rem;
    }
}
/* --- End Fix --- */


/* UPDATED: Wait Time Container (styled by CLASS) */
.wait-time-container {
    /* position: absolute; */ /* Already set above */
    min-height: 150px; /* Give it space */
    display: flex;
    flex-direction: column; /* Child elements stack vertically */
    align-items: center;
    justify-content: center;
    /* NEW: Add perspective for child flip */
    perspective: 300px;
}

.display-style--standard .wait-time-sign-wrapper {
    display: flex; /* Hidden by default, shown by JS */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #1f2937; /* gray-800 */
    border-radius: 20px;
    padding: 1rem 2rem; /* Adjusted padding */
    width: auto; /* UPDATED: Let content define width */
    max-width: 90%; /* UPDATED: Max width relative to container */
    min-width: 180px; /* UPDATED: Min width */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    border: 4px solid #374151; /* gray-700 */
}

.display-style--standard .wait-time-number {
    font-size: clamp(5rem, 25vw, 20rem); /* Increased max back to 20rem */
    line-height: 1;
    font-weight: 800;
}

.display-style--standard .wait-time-label {
    font-size: clamp(1.5rem, 7vw, 3rem); /* Reduced max */
    font-weight: 600;
    color: #9ca3af; /* gray-400 */
    margin-top: -0.5rem;
    letter-spacing: 0.1em;
}

.display-style--standard .wait-time-status-display {
    display: none; /* Hidden by default, shown by JS */
    font-size: clamp(2.5rem, 12vw, 6rem); /* Reduced max */
    line-height: 1.1;
    font-weight: 700;
    text-transform: uppercase;
    color: #f59e0b; /* amber-500 */
}

/* FIXED: Corrected selector to target .ride-name-display WITHIN .display-style--standard */
/* NEW: Added .welcome-message-display */
.display-style--standard .ride-name-display,
.display-style--standard .welcome-message-display {
    font-size: clamp(1.5rem, 6vw, 4rem); /* Reduced max */
    line-height: 1.1;
    font-weight: 600;
    width: auto; /* Width is auto */
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
    background-color: transparent;
    border: none;
    padding: 0.5rem 1rem;
    text-transform: none;
    letter-spacing: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}



.park-icon-display,
.welcome-resort-icon-display {
    /* position: absolute; */ /* Already set above */
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}

/* NEW: Added .welcome-resort-icon-display img */
.park-icon-display img,
.welcome-resort-icon-display img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* UPDATED: Class selector */
.park-hours-display {
    /* position: absolute; */ /* Already set above */
    font-size: clamp(0.875rem, 2.5vw, 1.5rem); /* Responsive font size */
    font-weight: 500;
    color: #d1d5db; /* gray-300 */
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    white-space: nowrap; /* Prevent ugly wrapping */
}


/* --- Responsive Layout for Small Screens (PORTRAIT) --- */
@media (max-width: 500px) {

    .display-style--standard .ride-name-display,
    .display-style--standard .welcome-message-display {
        font-size: clamp(1.25rem, 5vw, 1.75rem); /* Adjusted for 500px */
        margin-bottom: 0.5rem; /* Tighter spacing */
    }
    .display-style--standard .wait-time-number {
        font-size: clamp(3rem, 18vw, 6rem); /* Adjusted for 500px */
    }
    .display-style--standard .wait-time-label {
        font-size: clamp(1rem, 4vw, 1.5rem); /* Adjusted for 500px */
    }
    .display-style--standard .wait-time-status-display {
        font-size: clamp(1.75rem, 10vw, 3rem); /* Adjusted for 500px */
    }
    .display-style--standard .wait-time-sign-wrapper {
        min-width: 150px;
        padding: 0.75rem 1rem;
    }

    .park-hours-display {
        font-size: 0.75rem; /* Smaller on mobile */
        margin-top: 0.5rem;
    }
}

@media (max-height: 500px) {

    .display-style--standard .ride-name-display,
    .display-style--standard .welcome-message-display {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    .display-style--standard .wait-time-number {
        font-size: 4rem;
    }
    .display-style--standard .wait-time-label {
        font-size: 1rem;
    }
    .display-style--standard .wait-time-status-display {
        font-size: 2.5rem;
    }
    .display-style--standard .wait-time-sign-wrapper {
        min-width: 150px;
        padding: 0.5rem 1rem;
    }

    /* Shrink fonts and padding for landscape phones (Traditional) */
    /* STYLES REMOVED */

    /* Universal short screen */
    .park-hours-display {
        font-size: 0.875rem; /* Smaller on landscape */
        margin-top: 0.5rem;
    }
}


/* 1. Fade */
@keyframes fade-out { 100% { opacity: 0; } }
@keyframes fade-in { 0% { opacity: 0; } }
.transition-out-fade { animation: fade-out 0.5s ease-out forwards; }
.transition-in-fade { animation: fade-in 0.5s ease-in forwards; }

/* 2. Slide Left */
@keyframes slide-out-left { 100% { transform: scale(var(--layout-scale)) translateX(calc(-100% + var(--layout-translate-x))); opacity: 0; } }
@keyframes slide-in-left { 0% { transform: scale(var(--layout-scale)) translateX(calc(100% + var(--layout-translate-x))); opacity: 0; } }
.transition-out-slide-left { animation: slide-out-left 0.5s ease-out forwards; }
.transition-in-slide-left { animation: slide-in-left 0.5s ease-in forwards; }

/* 3. Slide Right */
@keyframes slide-out-right { 100% { transform: scale(var(--layout-scale)) translateX(calc(100% + var(--layout-translate-x))); opacity: 0; } }
@keyframes slide-in-right { 0% { transform: scale(var(--layout-scale)) translateX(calc(-100% + var(--layout-translate-x))); opacity: 0; } }
.transition-out-slide-right { animation: slide-out-right 0.5s ease-out forwards; }
.transition-in-slide-right { animation: slide-in-right 0.5s ease-in forwards; }

/* 4. Slide Up */
@keyframes slide-out-up { 100% { transform: scale(var(--layout-scale)) translate(var(--layout-translate-x), -100%); opacity: 0; } }
@keyframes slide-in-up { 0% { transform: scale(var(--layout-scale)) translate(var(--layout-translate-x), 100%); opacity: 0; } }
.transition-out-slide-up { animation: slide-out-up 0.5s ease-out forwards; }
.transition-in-slide-up { animation: slide-in-up 0.5s ease-in forwards; }

/* 5. Slide Down */
@keyframes slide-out-down { 100% { transform: scale(var(--layout-scale)) translate(var(--layout-translate-x), 100%); opacity: 0; } }
@keyframes slide-in-down { 0% { transform: scale(var(--layout-scale)) translate(var(--layout-translate-x), -100%); opacity: 0; } }
.transition-out-slide-down { animation: slide-out-down 0.5s ease-out forwards; }
.transition-in-slide-down { animation: slide-in-down 0.5s ease-in forwards; }

/* 6. Zoom In */
@keyframes zoom-in-out { 100% { transform: scale(calc(var(--layout-scale) * 2)) translateX(var(--layout-translate-x)); opacity: 0; } }
@keyframes zoom-in-in { 0% { transform: scale(calc(var(--layout-scale) * 0.5)) translateX(var(--layout-translate-x)); opacity: 0; } }
.transition-out-zoom-in { animation: zoom-in-out 0.4s ease-out forwards; }
.transition-in-zoom-in { animation: zoom-in-in 0.4s ease-in forwards; }

/* 7. Zoom Out */
@keyframes zoom-out-out { 100% { transform: scale(calc(var(--layout-scale) * 0.5)) translateX(var(--layout-translate-x)); opacity: 0; } }
@keyframes zoom-out-in { 0% { transform: scale(calc(var(--layout-scale) * 2)) translateX(var(--layout-translate-x)); opacity: 0; } }
.transition-out-zoom-out { animation: zoom-out-out 0.4s ease-out forwards; }
.transition-in-zoom-out { animation: zoom-out-in 0.4s ease-in forwards; }

/* 8. Flip X */
@keyframes flip-x-out { 100% { transform: scale(var(--layout-scale)) translateX(var(--layout-translate-x)) rotateY(90deg); opacity: 0; } }
@keyframes flip-x-in { 0% { transform: scale(var(--layout-scale)) translateX(var(--layout-translate-x)) rotateY(-90deg); opacity: 0; } }
.transition-out-flip-x { animation: flip-x-out 0.4s ease-in forwards; }
.transition-in-flip-x { animation: flip-x-in 0.4s ease-out forwards; }

/* 9. Flip Y */
@keyframes flip-y-out { 100% { transform: scale(var(--layout-scale)) translateX(var(--layout-translate-x)) rotateX(90deg); opacity: 0; } }
@keyframes flip-y-in { 0% { transform: scale(var(--layout-scale)) translateX(var(--layout-translate-x)) rotateX(-90deg); opacity: 0; } }
.transition-out-flip-y { animation: flip-y-out 0.4s ease-in forwards; }
.transition-in-flip-y { animation: flip-y-in 0.4s ease-out forwards; }

/* 10. Rotate */
@keyframes rotate-out { 100% { transform: scale(0) translateX(var(--layout-translate-x)) rotate(360deg); opacity: 0; } }
@keyframes rotate-in { 0% { transform: scale(0) translateX(var(--layout-translate-x)) rotate(-360deg); opacity: 0; } }
.transition-out-rotate { animation: rotate-out 0.4s ease-in-out forwards; }
.transition-in-rotate { animation: rotate-in 0.4s ease-out forwards; }


.transition-out-fade #welcome-screen-container,
.transition-in-fade #welcome-screen-container {
    animation: none; /* The container doesn't fade, its children do */
}

.transition-out-slide-left #welcome-screen-container,
.transition-in-slide-left #welcome-screen-container,
.transition-out-slide-right #welcome-screen-container,
.transition-in-slide-right #welcome-screen-container,
.transition-out-slide-up #welcome-screen-container,
.transition-in-slide-up #welcome-screen-container,
.transition-out-slide-down #welcome-screen-container,
.transition-in-slide-down #welcome-screen-container,
.transition-out-zoom-in #welcome-screen-container,
.transition-in-zoom-in #welcome-screen-container,
.transition-out-zoom-out #welcome-screen-container,
.transition-in-zoom-out #welcome-screen-container,
.transition-out-flip-x #welcome-screen-container,
.transition-in-flip-x #welcome-screen-container,
.transition-out-flip-y #welcome-screen-container,
.transition-in-flip-y #welcome-screen-container,
.transition-out-rotate #welcome-screen-container,
.transition-in-rotate #welcome-screen-container {
    animation: none; /* Container doesn't animate, children do */
}


@keyframes flip-vertical-update-anim {
    0% { transform: rotateX(0deg); }
    50% { transform: rotateX(90deg); opacity: 0.5; }
    100% { transform: rotateX(0deg); }
}
.flip-vertical-update {
    /* Apply animation to the direct children (sign and wrapper) */
    & > .wait-time-sign-wrapper,
    & > .wait-time-status-display {
        animation: flip-vertical-update-anim 0.5s ease-in-out forwards;
    }
}

.countdown-timer,
.welcome-countdown-timer {
    /* position: absolute; */ /* Already set above */
    z-index: 5;
    /* UPDATED: Thinner/Wider design */
    padding: 0.25rem 1rem; /* Thinner padding */
    border-radius: 1.5rem; /* Rounded all corners */
    box-shadow: 0 6px 15px rgba(0,0,0,0.3);

    clip-path: none; /* REMOVED clip-path */


}

.countdown-timer.countdown-pos--top,
.welcome-countdown-timer.countdown-pos--top {
    border-radius: 1.5rem;
}
/* NEW: Added .welcome-countdown-timer */
.countdown-timer.countdown-pos--bottom,
.welcome-countdown-timer.countdown-pos--bottom {
    border-radius: 1.5rem;
}

.countdown-flex-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
}

.countdown-title {
    display: block;
    /* width: 100%; */ /* REMOVED: No longer full width */
    text-align: right; /* Align to the right */
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    flex-shrink: 0; /* Don't let title shrink */
}
.countdown-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    width: 100%; /* Grid takes remaining space */
    min-width: 200px; /* Give grid some minimum space */
}
.countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.countdown-number {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    line-height: 1;
}
.countdown-label {
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
    line-height: 1;
    margin-top: 0.1rem; /* Tighter margin */
}

.countdown-timer.display-style--standard,
.welcome-countdown-timer.display-style--standard {
    background-color: #1f2937; /* gray-800 */
    border: 2px solid #374151; /* gray-700 */
}
/* NEW: Added .welcome-countdown-timer */
.countdown-timer.display-style--standard.countdown-pos--top,
.welcome-countdown-timer.display-style--standard.countdown-pos--top {
    border-top: 2px solid #374151; /* Restore border */
    border-radius: 1.5rem;
}
/* NEW: Added .welcome-countdown-timer */
.countdown-timer.display-style--standard.countdown-pos--bottom,
.welcome-countdown-timer.display-style--standard.countdown-pos--bottom {
    border-bottom: 2px solid #374151; /* Restore border */
    border-radius: 1.5rem;
}
.display-style--standard .countdown-title {
    font-size: clamp(0.7rem, 1.5vw, 1rem); /* Shrunk */
    color: #9ca3af; /* gray-400 */
    letter-spacing: 0.05em;
    /* margin-bottom: 0.5rem; */ /* REMOVED */
}
.display-style--standard .countdown-number {
    font-size: clamp(1.5rem, 4vw, 2.5rem); /* Shrunk */
    color: white;
}
.display-style--standard .countdown-label {
    font-size: clamp(0.65rem, 1.25vw, 0.8rem); /* Shrunk */
    color: #9ca3af;
    text-transform: uppercase;
}

#music-panel-container {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    left: auto;
    width: 320px; /* Back to original width */
    height: 100%; /* Full height */
    z-index: 20;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    box-shadow: -5px 0 15px rgba(0,0,0,0.3);
}

#music-panel-container.is-open {
    transform: translateX(0);
}

#music-panel-handle {
    position: absolute;
    top: 50%;
    bottom: auto;
    left: -40px;
    transform: translateY(-50%);
    width: 40px;
    height: 80px;
    background-color: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-right: none;
    border-radius: 10px 0 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
}

#music-panel-handle:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

#music-panel-content {
    width: 100%;
    height: 100%;
    background-color: #111; /* Fallback */
}

#music-panel-iframe {
    width: 100%; /* Fit container */
    height: 100%; /* Fit container */
    border: none;
    transform: none; /* REMOVED scaling */
    transform-origin: 0 0;
}

#display-view.edit-mode-active .hamburger-menu-btn,
#display-view.edit-mode-active #music-panel-handle {
    display: none; /* Hide UI controls */
}

#display-view.edit-mode-active .countdown-timer.hidden,
#display-view.edit-mode-active .welcome-countdown-timer.hidden { /* NEW */
    display: block ; /* Force show countdown timer for editing */
    opacity: 0.7;
}

#edit-element-modal {
    color: #1f2937; /* text-gray-800 */
}
#edit-element-modal.dark {
    color: #f3f4f6; /* text-gray-100 */
}
#edit-element-modal #edit-element-close-btn {
    font-size: 2rem;
    line-height: 1;
    font-weight: bold;
    padding: 0 0.5rem;
}
/* FIXED: Add specific styles for slider value labels */
#edit-element-modal label {
    color: #374151; /* gray-700 for light mode label text */
}
#edit-element-modal.dark label {
    color: #d1d5db; /* gray-300 for dark mode label text */
}
#edit-element-modal label span {
    font-weight: bold;
    color: #3b82f6; /* blue-500 */
    padding-left: 0.5rem;
}
#edit-element-modal.dark label span {
    color: #60a5fa; /* blue-400 */
}


/* NEW: Slider styles */
.edit-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 10px;
    background: #4b5563; /* gray-600 */
    outline: none;
    opacity: 0.7;
    -webkit-transition: .2s;
    transition: opacity .2s;
    border-radius: 5px;
}
.edit-slider:hover {
    opacity: 1;
}
.edit-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #3b82f6; /* blue-500 */
    cursor: pointer;
    border-radius: 50%;
}
.edit-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #3b82f6; /* blue-500 */
    cursor: pointer;
    border-radius: 50%;
}

/* NEW: Edit Mode Bar Sliding */
#edit-mode-bar {
    transition: transform 0.3s ease-in-out;
}
#edit-mode-bar.is-hidden {
    transform: translateY(120%); /* Slide down just past 100% */
}
