/* ================================================
   AREA BACKGROUNDS + REVEAL UX
   Background-first: full image shown on enter
   Content slides up via trigger button
   ================================================ */

/* ═══ Background Stage ═══ 
   Full-size container showing the area illustration */
.area-bg-stage {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 70vh;
    border-radius: 16px;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 24px;
    overflow: hidden;
}

/* For full-page areas (school, tower) */
.school-container .area-bg-stage,
.tower-climb-container .area-bg-stage {
    aspect-ratio: auto;
    height: 70vh;
    max-height: 70vh;
    border-radius: 0;
}

/* ═══ Trigger Button ═══
   Bouncing pill button that reveals content */
.area-trigger-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    border: none;
    border-radius: 50px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    z-index: 5;
    position: relative;

    /* Glass effect */
    background: rgba(255, 255, 255, 0.92);
    color: #2d3436;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.2),
        0 0 0 2px rgba(255, 255, 255, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    /* Bounce animation */
    animation: areaTriggerBounce 2s ease-in-out infinite;
    transition: all 0.3s ease;
}

.area-trigger-btn:hover {
    transform: scale(1.08);
    box-shadow:
        0 6px 28px rgba(0, 0, 0, 0.3),
        0 0 0 3px rgba(108, 92, 231, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    animation: none;
}

.area-trigger--dark {
    background: rgba(30, 20, 60, 0.85);
    color: #fff;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.4),
        0 0 0 2px rgba(255, 255, 255, 0.15),
        0 0 30px rgba(200, 150, 255, 0.2);
}

.area-trigger--dark:hover {
    box-shadow:
        0 6px 28px rgba(0, 0, 0, 0.5),
        0 0 0 3px rgba(200, 150, 255, 0.3),
        0 0 40px rgba(200, 150, 255, 0.3);
}

.area-trigger-emoji {
    font-size: 1.4rem;
}

.area-trigger-label {
    letter-spacing: 0.5px;
}

.area-trigger--hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

@keyframes areaTriggerBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-12px);
    }

    50% {
        transform: translateY(-4px);
    }

    70% {
        transform: translateY(-8px);
    }
}

/* Glow ring pulse around trigger */
.area-trigger-btn::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 54px;
    background: transparent;
    border: 2px solid rgba(108, 92, 231, 0.3);
    animation: areaTriggerPulse 2s ease-in-out infinite;
}

.area-trigger--dark::before {
    border-color: rgba(200, 150, 255, 0.3);
}

@keyframes areaTriggerPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.6;
    }

    50% {
        transform: scale(1.15);
        opacity: 0;
    }
}

/* ═══ Content Panel ═══
   Slides up, semi-transparent to show background through */
.area-content-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.3s ease;
    opacity: 0;
    z-index: 10;
    border-radius: 16px 16px 0 0;
}

.area-content-panel.area-panel--visible {
    max-height: 96%;
    opacity: 1;
    overflow-y: auto;
}

/* Light theme panel — semi-transparent so bg shows through */
.area-panel--light {
    background: rgba(255, 255, 255, 0);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

/* Dark theme panel (pond) — semi-transparent */
.area-panel--dark {
    background: rgba(15, 12, 41, 0.15);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    color: #fff;
}

/* Compact padding inside panels */
.area-content-panel>div[style*="padding"] {
    padding: 8px !important;
}

/* Content items that need text readability: frosted glass */
.area-panel--light .tabs,
.area-panel--light .school-tabs,
.area-panel--light .attendance-card,
.area-panel--light .school-quest-card,
.area-panel--light .shop-card,
.area-panel--light .reward-tiers-box,
.area-panel--light .leaderboard-list {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Tower layout: nearly transparent to show bg */
.area-panel--light .tower-climb-layout {
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 12px;
    border: none;
    box-shadow: none;
}

/* Dark panel content items: solid readable */
.area-panel--dark .pond-balance,
.area-panel--dark .pond-actions,
.area-panel--dark .pond-rates {
    background: rgba(15, 12, 41, 0.75) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Panel handle bar (visual hint to drag/close) */
.area-content-panel::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    margin: 10px auto 6px;
}

.area-panel--dark::before {
    background: rgba(255, 255, 255, 0.2);
}

/* Close button inside panel */
.area-panel-close {
    position: sticky;
    top: 0;
    text-align: right;
    padding: 4px 12px;
    z-index: 11;
}

.area-panel-close button {
    background: rgba(0, 0, 0, 0.06);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1rem;
    cursor: pointer;
    color: #636e72;
    transition: all 0.2s;
}

.area-panel-close button:hover {
    background: rgba(0, 0, 0, 0.12);
    transform: scale(1.1);
}

/* ═══ Modal body: position relative for panel ═══ */
#shop-modal .modal-body,
#hall-modal .modal-body,
#pond-modal .modal-body,
#wheel-modal .modal-body {
    position: relative;
    padding: 0 !important;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

/* Tall modals for full image backgrounds — 95vh */
#shop-modal .modal-content,
#hall-modal .modal-content,
#wheel-modal .modal-content {
    max-width: 900px !important;
    height: 95vh !important;
    max-height: 95vh !important;
}

/* Pond already has fullpage styles from dragon-pond.css,
   but ensure it also gets 95vh */
#pond-modal .modal-content {
    height: 95vh !important;
    max-height: 95vh !important;
}

/* bg-stage fills entire modal body for these */
#shop-modal .area-bg-stage,
#hall-modal .area-bg-stage,
#pond-modal .area-bg-stage,
#wheel-modal .area-bg-stage {
    aspect-ratio: auto;
    height: 100%;
    max-height: none;
    border-radius: 0;
}

/* Full page areas: position setup */
.school-container,
.tower-climb-container {
    position: relative;
    min-height: 100vh;
}