:root {
    --main-green: #318C57;
    --main-orange: #F7931E;
    --main-brown: #7B2D2D;
    --main-bg: #f9f9f6;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html, body {
    height: calc(var(--vh, 1vh) * 100);
    font-family: "Segoe UI", sans-serif;
    background-color: var(--main-bg);
    overflow: hidden;
}

.activites-container {
    display: flex;
    gap: 8px;
    padding: 8px;
    margin-top: var(--header-height, 60px);
    height: calc((var(--vh, 1vh) * 100) - var(--header-height, 60px));
    position: relative;
}

.panel {
    flex: 1;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    transition: opacity 0.45s ease, flex 0.6s ease;
    display: block;
    cursor: pointer;
    overflow: hidden;
    border-radius: 12px;
    outline: none;
    position: relative;
}

.panel.hidden {
    opacity: 0;
    pointer-events: none;
}
.panel.visible {
    opacity: 1;
    pointer-events: auto;
}

.panel-inner {
    height: 100%;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    border-radius: inherit;
    padding: 0;
    box-sizing: border-box;
}

.label {
    font-size: 1.6rem;
    color: var(--main-brown);
    background: var(--main-bg);
    padding: 0.6rem 1rem;
    margin-bottom: 1.2rem;
    pointer-events: none;
    z-index: 1;
    text-align: center;
    border: 2px solid var(--main-brown);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    font-weight: 600;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);

    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.panel:hover .label,
.panel:focus .label,
.panel:focus-within .label {
    opacity: 1;
    transform: translateY(0);
}

.activites-container:not(.locked) .panel:hover { flex: 2.5; }

.activites-container.locked .panel {
    transition: opacity 0.5s ease, flex 0s !important;
    pointer-events: none;
}
.activites-container.locked .panel.active {
    flex: 2.5 !important;
}
.activites-container.locked .panel:not(.active) { flex: 1 !important; }

.fullscreen-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    z-index: 1000;
    border-radius: 12px;
    overflow: hidden;
    pointer-events: auto;
    transition:
        top 0.5s ease-in-out,
        left 0.5s ease-in-out,
        width 0.5s ease-in-out,
        height 0.5s ease-in-out;
    cursor: auto;
}

.fullscreen-panel.fullscreen {
    top: var(--header-height) !important;
    left: 0 !important;
    width: 100vw !important;
    height: calc((var(--vh, 1vh) * 100) - var(--header-height)) !important;
    border-radius: 0 !important;
}

.fullscreen-panel .close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1300;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 2px solid rgba(0,0,0,0.12);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);

    opacity: 0;
    transform: scale(.94);
    transition: opacity .25s ease, transform .25s ease, border-color .22s ease, box-shadow .22s ease;
    pointer-events: none;
}

.fullscreen-panel.fullscreen .close-btn {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.fullscreen-panel .close-btn:hover {
    transform: scale(1.03);
}

.fullscreen-panel .title-box {
    position: absolute;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    bottom: 2rem;
    top: auto;
    transition: top 0.45s ease, bottom 0.45s ease, transform 0.45s ease;
    z-index: 2;
    opacity: 1;
}

.fullscreen-panel.fullscreen .title-box {
    bottom: auto;
    transform: translateX(-50%) translateY(0);
}

.fullscreen-panel .info-wrap {
    position: absolute;
    left: 0;
    right: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 2;
    opacity: 0;
    transform: translateY(12px);
    transition: top 0.55s cubic-bezier(.2,.9,.2,1), opacity 0.35s ease, transform 0.35s ease;
}

.fullscreen-panel.fullscreen .info-wrap {
    top: calc(var(--header-height) + (var(--vh, 1vh) * 14));
    bottom: 0vh;
}

.fullscreen-panel.show-content .info-wrap {
    opacity: 1;
    transform: translateY(0);
}

.fullscreen-panel .info-box {
    width: calc(100% - 80px);
    max-width: 1000px;
    padding: 1rem 1.2rem;
    border-radius: 12px;
    border: 3px solid var(--main-green);
    background: rgba(255,255,255,0.96);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    color: #222;
    font-size: 1rem;
    line-height: 1.4;
    box-sizing: border-box;

    max-height: 100%;
    overflow-y: auto;
}

@media (max-width: 640px) and (orientation: portrait) {
    html, body { overflow: auto; }

    .activites-container {
        flex-direction: column;
        height: calc((var(--vh, 1vh) * 100) - var(--header-height, 60px));
        gap: 8px;
        padding: 8px;
        overflow-y: auto;
    }

    .panel {
        flex: none;
        height: calc(((var(--vh, 1vh) * 100) - var(--header-height, 60px) - 40px) / 4);
        transition: opacity 0.35s ease;
        border-radius: 10px;
    }

    .panel,
    .fullscreen-panel {
        background-attachment: scroll !important;
    }

    .fullscreen-panel {
        will-change: top, left, width, height;
        transition: top 0.5s ease-in-out,
                    left 0.5s ease-in-out,
                    width 0.5s ease-in-out,
                    height 0.5s ease-in-out,
                    border-radius 0.35s ease-in-out;
    }

    .activites-container:not(.locked) .panel:hover { flex: none; }

    .label {
        opacity: 1 !important;
        transform: none !important;
        pointer-events: none;
        font-size: 1rem !important;
        padding: 0.4rem 0.6rem !important;
        margin-bottom: 0.8rem !important;
        border-radius: 8px !important;
        border-width: 2px !important;
    }

    .fullscreen-panel .title-box {
        transform: translateX(-50%) !important;
    }

    .fullscreen-panel.fullscreen .info-wrap {
        top: calc(var(--header-height) + (var(--vh, 1vh) * 14));
        bottom: 0vh;
    }

    .fullscreen-panel .info-box {
        width: calc(100% - 32px);
        padding: 0.8rem;
        font-size: 0.95rem;
    }

    .panel-inner {
        align-items: flex-end;
    }

    .fullscreen-panel .close-btn {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    .activites-container.locked .panel.active {
        flex: 1 !important;
    }
}

@media (max-width: 640px) {
    .fullscreen-panel .info-box {
        width: calc(100% - 32px);
        padding: 0.8rem;
    }
    .label {
        font-size: 1.2rem;
        padding: 0.5rem 0.8rem;
    }
}

.panel:focus .label {
    opacity: 1;
    transform: translateY(0);
}
