/* ==========================================================================
   Variables & Reset
   ========================================================================== */
:root {
    --bg-color: #f4f4f4;
    --text-color: #111;
    --accent-color: #333;
    --zone-color: rgba(0, 0, 0, 0.05);
    --panel-bg: rgba(255, 255, 255, 0.85);
    --font-main: 'Space Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Layout & Base
   ========================================================================== */
body,
html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* Canvas handles scrolling visuals */
    background-color: var(--bg-color);
    font-family: var(--font-main);
    color: var(--text-color);
}

/* ==========================================================================
   UI Layer (Overlays)
   ========================================================================== */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass through to canvas */
    z-index: 10;
    overflow: hidden;
    /* Prevent off-screen children from expanding viewport */
}

/* Enable pointer events only on interactive UI elements */
#info-panel {
    pointer-events: auto;
}

#drop-zone,
#title {
    pointer-events: none;
}

#title {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 0.9rem;
    /* Harmonized font size */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 10px 0;
    /* Align baseline roughly with buttons if needed */
    display: flex;
    align-items: center;
    gap: 8px;
    /* Space between text and button */
}

#year-counter {
    color: #666;
    margin-left: 0.5em;
    /* Fallback spacing */
}

#replay-btn {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: #ffffff;
    color: #000;
    border: 1px solid #ddd;
    outline: none;
    padding: 10px 20px;
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    pointer-events: auto;
    z-index: 30;
    text-transform: uppercase;
    transition: all 0.2s ease;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#replay-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    background: #ffffff;
    opacity: 1;
}

/* ==========================================================================
   Drop Zone
   ========================================================================== */
#drop-zone {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 120px;
    height: 120px;
    border: 1px solid #000;
    /* Solid border to match others */
    border-radius: 0;
    /* Square/hard edges for harmony */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.9rem;
    /* Harmonized font size */
    font-weight: 700;
    /* Bold */
    color: #000;
    transition: all 0.3s ease;
    background: transparent;
    text-transform: uppercase;
}

#drop-zone.active {
    border-color: #000;
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.05);
    color: #000;
}

/* Panel Open State - Hide Drop Zone */
#ui-layer.panel-open #drop-zone {
    opacity: 0;
    pointer-events: none;
}



/* ==========================================================================
   Info Panel (Slide-out)
   ========================================================================== */
#info-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 400px;
    max-width: 90%;
    /* Mobile friendly */
    background: var(--panel-bg);
    border-left: 1px solid #ddd;
    padding: 40px;
    transform: translateX(100%);
    /* Visibility transition ensures it hides AFTER sliding out */
    visibility: hidden;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0.4s;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.05);
    z-index: 20;
    overflow-y: auto;
    font-size: 0.75rem;
    font-weight: 400;
}

#info-panel.visible {
    transform: translateX(0);
    /* Show immediately when becoming visible */
    visibility: visible;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0s;
}

#close-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
}

#close-panel:hover {
    color: #000;
}

#panel-year {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 20px;
    border-bottom: 1px solid #000;
    padding-bottom: 10px;
    letter-spacing: -0.05em;
}

.image-container {
    width: 100%;
    margin: 20px 0;
    display: flex;
    justify-content: center;
}

#panel-image {
    max-width: 75%;
    max-height: 300px;
    /* Limit height to keep panel usable */
    height: auto;
    display: block;
    object-fit: contain;
    margin: 0 auto;
}

#panel-label {
    font-size: 0.85rem;
    font-weight: 400;
    text-transform: uppercase;
    margin-bottom: 3rem;
    /* Reduced spacing */
    line-height: 1.4;
    color: #111;
    word-break: break-word;
}

.divider {
    display: none;
}

/* h4 removed */

#panel-wardrobe {
    list-style: none;
    font-size: 0.75rem;
    line-height: 1.6;
    margin-top: -1rem;
    /* Pull up closer to label */
}

#panel-wardrobe li {
    margin-bottom: 0.5rem;
    /* Tighter list spacing */
    padding-left: 0;
    border-left: none;
    /* Remove border for cleaner look */
}

/* ==========================================================================
   Canvas
   ========================================================================== */
#world {
    width: 100%;
    height: 100%;
    background: #f4f4f4;
}

/* ==========================================================================
   Mobile Responsive
   ========================================================================== */
@media (max-width: 600px) {
    #info-panel {
        width: 100%;
        border-left: none;
    }

    #drop-zone {
        width: 80px;
        height: 80px;
        font-size: 0.6rem;
    }
}

/* ==========================================================================
   Info Popover & Button
   ========================================================================== */
#info-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: #ffffff;
    color: #000;
    border: 1px solid #ddd;
    padding: 10px 20px;
    font-family: var(--font-main);
    font-size: 0.9rem;
    /* Harmonized font size */
    font-weight: 700;
    cursor: pointer;
    pointer-events: auto;
    z-index: 30;
    text-transform: uppercase;
    transition: all 0.2s ease;
    border-radius: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#info-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    background: #ffffff;
    color: #000;
}

#info-popover {
    position: absolute;
    bottom: 70px;
    right: 20px;
    width: 320px;
    background: rgba(255, 255, 255, 0.95);
    /* Higher opacity */
    border: 1px solid #000;
    min-height: 500px;
    /* Fixed height to prevent jumping */
    padding: 25px;
    /* Restore standard padding */
    box-shadow: -5px -5px 0px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    pointer-events: auto;
    font-size: 0.75rem;
    line-height: 1.5;
    /* Transition */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease-out;
}

#info-popover.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#info-popover p {
    margin-bottom: 10px;
}

#info-popover ol {
    padding-left: 20px;
    margin-bottom: 10px;
}

#info-popover li {
    margin-bottom: 5px;
}

/* Tabs Navigation - Minimal Underline */
.popover-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
    margin-top: -10px;
    gap: 20px;
    /* Space between tabs */
    padding-bottom: 0;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 10px 0;
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 0.8rem;
    font-weight: 400;
    /* Regular by default */
    color: #999;
    text-transform: uppercase;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    /* Reserve space for underline */
    margin-bottom: -1px;
    /* Sit on the line */
}

.tab-btn:hover {
    color: #666;
}

.tab-btn.active {
    background: transparent;
    color: #000;
    font-weight: 700;
    border-bottom: 2px solid #000;
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
    /* No extra padding needed here as container handles it */
}

.tab-content.active {
    display: block;
}

/* Close Popover Button */
#close-popover {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    z-index: 10002;
    padding: 5px;
    line-height: 1;
}

#close-popover:hover {
    color: #000;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Video Placeholder (1:1 Aspect Ratio) */
.video-placeholder {
    width: 100%;
    /* Removed max-width to align with text */
    margin: 15px 0;
    background: #eee;
    border: 1px solid #ddd;
    position: relative;
    /* Aspect Ratio Hack */
}

.video-aspect-box {
    width: 100%;
    padding-top: 100%;
    /* 1:1 Aspect Ratio */
    position: relative;
}

.video-aspect-box span,
.video-aspect-box video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #999;
    font-size: 0.75rem;
    object-fit: cover;
}

#info-arrow {
    position: absolute;
    bottom: 100%;
    right: 0;
    width: 150px;
    height: auto;
    pointer-events: none;
    z-index: 10001;
    opacity: 0.9;
    transform: rotate(10deg) translate(20px, 20px);
}