/* ══════════════════════════════════════════════════════════
   Water Flow — Level Select 3D Gaming Stylesheet
   Matches exact reference design with innerpage background
   and custom 3D assets: unloack.png, currunt play.png, lock.png
   ══════════════════════════════════════════════════════════ */

.levels {
    background: transparent;
    position: relative;
    padding-top: var(--safe-top, 0px);
    padding-bottom: var(--safe-bottom, 0px);
    user-select: none;
    -webkit-user-select: none;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100%;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    overflow: hidden;
}

/* Background Video (innervideo.mp4) */
.levels-bg-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    pointer-events: none;
    z-index: 0;
}

.levels>*:not(.levels-bg-video) {
    position: relative;
    z-index: 2;
}

/* ────────────────────────────────────────
   1. Top Bar (Back Button + 3 Currency/Trophy Pills)
   ──────────────────────────────────────── */

.levels__top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 10px 14px 6px 14px;
    flex-shrink: 0;
    z-index: 10;
}

/* Cyan Round Bubble Back Button */
.levels__back-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(180deg, #38BDF8 0%, #0284C7 60%, #0369A1 100%);
    border: 2.5px solid #BAE6FD;
    box-shadow: 0 4px 0 #024E82,
        0 6px 14px rgba(0, 0, 0, 0.45),
        inset 0 2px 0 rgba(255, 255, 255, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.12s cubic-bezier(0.4, 0, 0.2, 1);
}

.levels__back-btn:active {
    transform: scale(0.92);
}

.levels__back-btn svg {
    width: 22px;
    height: 22px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

/* 3D Aquatic Header Pills */
.levels__header-pill {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 34px;
    padding: 2px 8px 2px 5px;
    background: linear-gradient(180deg, #0284C7 0%, #0369A1 100%);
    border: 2px solid #38BDF8;
    border-radius: 20px;
    box-shadow: 0 3px 0 #024E82,
        0 4px 10px rgba(0, 0, 0, 0.4),
        inset 0 1.5px 0 rgba(255, 255, 255, 0.45);
    position: relative;
    box-sizing: border-box;
    cursor: pointer;
    transition: transform 0.12s;
}

.levels__header-pill:active {
    transform: scale(0.94);
}

.header-pill__icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 1.5px 2px rgba(0, 0, 0, 0.5));
}

.header-pill__icon svg {
    width: 100%;
    height: 100%;
}

.header-pill__val {
    font-family: 'Fredoka', 'Outfit', var(--font-family, system-ui), sans-serif;
    font-size: 14px;
    font-weight: 900;
    color: #FFFFFF;
    text-shadow: 0 1.5px 0 #02365A, 0 2px 4px rgba(0, 0, 0, 0.6);
    line-height: 1;
}

.header-pill__add {
    width: 17px;
    height: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 2px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.header-pill__add svg {
    width: 100%;
    height: 100%;
}

/* Red "LIVE" Badge on Hearts Pill */
.header-pill__badge {
    position: absolute;
    top: -7px;
    left: 16px;
    background: #EF4444;
    border: 1.2px solid #FFFFFF;
    border-radius: 6px;
    font-size: 7.5px;
    font-weight: 900;
    color: #FFFFFF;
    padding: 0 3.5px;
    line-height: 1.2;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* Stars Trophy Pill */
.pill--stars .header-pill__stars-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1;
}

.header-pill__stars-val {
    font-family: 'Fredoka', 'Outfit', var(--font-family, system-ui), sans-serif;
    font-size: 12.5px;
    font-weight: 900;
    color: #FFFFFF;
    text-shadow: 0 1.5px 0 #02365A;
}

.header-pill__stars-label {
    font-family: 'Fredoka', 'Outfit', var(--font-family, system-ui), sans-serif;
    font-size: 8px;
    font-weight: 900;
    color: #FDE047;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    letter-spacing: 0.5px;
}

/* ────────────────────────────────────────
   2. 3D Difficulty Tabs
   ──────────────────────────────────────── */

.levels__tabs {
    display: flex;
    gap: 5px;
    padding: 6px 12px 0 12px;
    flex-shrink: 0;
}

.levels__tab {
    flex: 1;
    height: 40px;
    border: none;
    cursor: pointer;
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fredoka', 'Outfit', var(--font-family, system-ui), sans-serif;
    font-size: 13.5px;
    font-weight: 900;
    letter-spacing: 0.5px;
    transition: transform 0.12s, box-shadow 0.12s;
}

.levels__tab:active {
    transform: scale(0.96);
}

/* EASY Tab */
.levels__tab[data-difficulty="easy"] {
    background: linear-gradient(180deg, #38BDF8 0%, #0284C7 60%, #0369A1 100%);
    border: 2px solid #7DD3FC;
    border-bottom: none;
    color: #FFFFFF;
    text-shadow: 0 2px 0 #02365A, 0 2px 4px rgba(0, 0, 0, 0.6);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.65), 0 -2px 10px rgba(56, 189, 248, 0.4);
}

/* MEDIUM Tab (Wood Carved) */
.levels__tab[data-difficulty="medium"] {
    background: linear-gradient(180deg, #B45309 0%, #92400E 50%, #78350F 100%);
    border: 2px solid #D97706;
    border-bottom: none;
    color: #FEF08A;
    text-shadow: 0 2px 0 #451A03, 0 2px 4px rgba(0, 0, 0, 0.6);
    box-shadow: 0 4px 0 #451A03, inset 0 1.5px 0 rgba(255, 255, 255, 0.25);
}

/* HARD Tab (Dark Bezel Gold) */
.levels__tab[data-difficulty="hard"] {
    background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
    border: 2px solid #F59E0B;
    border-bottom: none;
    color: #FDE047;
    text-shadow: 0 2px 0 #78350F, 0 2px 4px rgba(0, 0, 0, 0.7);
    box-shadow: 0 4px 0 #090D16, inset 0 1.5px 0 rgba(255, 255, 255, 0.2);
}

/* INFINITE Tab (Cosmic Neon Purple 3D - 100K+ ∞) */
.levels__tab[data-difficulty="infinite"] {
    background: linear-gradient(180deg, #A855F7 0%, #7C3AED 50%, #5B21B6 100%);
    border: 2px solid #D8B4FE;
    border-bottom: none;
    color: #FAF5FF;
    text-shadow: 0 1.5px 0 #3B0764, 0 0 8px rgba(192, 132, 252, 0.6);
    box-shadow: 0 4px 0 #2E1065, inset 0 1.5px 0 rgba(255, 255, 255, 0.4);
}

/* ────────────────────────────────────────
   2.5 Jump To Level Bar (Quick 100K+ Level Search)
   ──────────────────────────────────────── */

.levels__jump-bar {
    padding: 6px 14px 4px 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
}

.jump-bar__badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: 'Fredoka', 'Outfit', var(--font-family, system-ui), sans-serif;
    font-size: 11px;
    font-weight: 800;
    color: #FEF08A;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
    background: rgba(3, 40, 75, 0.75);
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 10px;
    padding: 3px 8px;
    letter-spacing: 0.3px;
}

.jump-bar__form {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.jump-bar__input {
    flex: 1;
    height: 36px;
    background: rgba(3, 30, 60, 0.92);
    border: 1.5px solid #38BDF8;
    border-radius: 12px;
    padding: 0 12px;
    font-family: 'Fredoka', 'Outfit', var(--font-family, system-ui), sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #FFFFFF;
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.jump-bar__input::placeholder {
    color: rgba(186, 230, 253, 0.65);
    font-size: 11.5px;
}

.jump-bar__input:focus {
    border-color: #FDE047;
    box-shadow: 0 0 10px rgba(253, 224, 71, 0.45), inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.jump-bar__btn {
    height: 36px;
    padding: 0 14px;
    background: linear-gradient(180deg, #FDE047 0%, #F59E0B 100%);
    border: 1.5px solid #FEF08A;
    border-radius: 12px;
    box-shadow: 0 3px 0 #92400E, 0 4px 8px rgba(0, 0, 0, 0.4);
    font-family: 'Fredoka', 'Outfit', var(--font-family, system-ui), sans-serif;
    font-size: 13px;
    font-weight: 900;
    color: #451A03;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
    flex-shrink: 0;
}

.jump-bar__btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #92400E;
}

/* ────────────────────────────────────────
   3. Progress Banner Card
   ──────────────────────────────────────── */

.levels__progress {
    padding: 2px 14px 10px 14px;
    flex-shrink: 0;
}

.levels__progress-card {
    background: linear-gradient(180deg, #0284C7 0%, #0369A1 100%);
    border: 2.5px solid #38BDF8;
    border-radius: 0 18px 18px 18px;
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.45),
        inset 0 2px 0 rgba(255, 255, 255, 0.5);
    padding: 8px 16px 12px 16px;
    position: relative;
}

.progress-card__header {
    font-family: 'Fredoka', 'Outfit', var(--font-family, system-ui), sans-serif;
    font-size: 13.5px;
    font-weight: 900;
    letter-spacing: 0.5px;
    color: #FFFFFF;
    text-shadow: 0 1.5px 0 #02365A;
    text-align: center;
    margin-bottom: 6px;
}

.progress-card__track {
    height: 22px;
    background: rgba(3, 40, 75, 0.95);
    border: 2px solid #0284C7;
    border-radius: 14px;
    position: relative;
    overflow: hidden;
}

.progress-card__fill {
    height: 100%;
    background: linear-gradient(180deg, #7DD3FC 0%, #38BDF8 50%, #0284C7 100%);
    border-radius: 12px;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.9),
        inset 0 2px 0 rgba(255, 255, 255, 0.7);
    transition: width 0.35s ease;
}

.progress-card__pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fredoka', 'Outfit', var(--font-family, system-ui), sans-serif;
    font-size: 13px;
    font-weight: 900;
    color: #FFFFFF;
    text-shadow: 0 1.5px 0 #02365A, 0 2px 4px rgba(0, 0, 0, 0.85);
}

/* ────────────────────────────────────────
   4. 3D Level Grid & Custom Node Assets
   ──────────────────────────────────────── */

.levels__grid-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 14px 40px 14px;
    -webkit-overflow-scrolling: touch;
}

/* Scrollbar styling */
.levels__grid-wrapper::-webkit-scrollbar {
    width: 6px;
}

.levels__grid-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.levels__grid-wrapper::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.5);
    border-radius: 3px;
}

.levels__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px 10px;
    justify-items: center;
    align-items: center;
}

/* Base Level Card Button */
.level-card {
    width: 100%;
    max-width: 86px;
    aspect-ratio: 1;
    position: relative;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.12s ease;
}

.level-card:active {
    transform: scale(0.92);
}

.level-card__bg-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    display: block;
    filter: none;
}

/* ── Node State 1: Completed / Unlocked (unloack.png) ── */
.level-card--completed,
.level-card--unlocked {
    cursor: pointer;
}

.level-card__number--completed {
    position: absolute;
    left: 50%;
    top: 58%;
    transform: translate(-50%, -50%);
    font-family: 'Fredoka', 'Outfit', var(--font-family, system-ui), sans-serif;
    font-size: 24px;
    font-weight: 900;
    line-height: 1;
    color: #FFFFFF;
    -webkit-text-stroke: 1.5px #024E82;
    text-shadow: 0 2px 0 #02365A, 0 3px 5px rgba(0, 0, 0, 0.75);
    pointer-events: none;
}

/* ── Node State 2: Current Level (currunt play.png) ── */
.level-card--current {
    cursor: pointer;
}

.level-card--current .level-card__bg-img {
    animation: currentPulse 2.2s ease-in-out infinite;
    transform-origin: center center;
    will-change: transform;
}

@keyframes currentPulse {

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

    50% {
        transform: scale(1.07);
    }
}

.level-card__current-wrap {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0px;
    pointer-events: none;
}

.level-card__play-title {
    font-family: 'Fredoka', 'Outfit', var(--font-family, system-ui), sans-serif;
    font-size: 13.5px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.6px;
    color: #FEF08A;
    -webkit-text-stroke: 1px #78350F;
    text-shadow: 0 1.5px 0 #78350F, 0 2px 4px rgba(0, 0, 0, 0.8);
}

.level-card__play-num {
    font-family: 'Fredoka', 'Outfit', var(--font-family, system-ui), sans-serif;
    font-size: 21px;
    font-weight: 900;
    line-height: 1;
    color: #034A75;
    text-shadow: 0 1.5px 0 #BAE6FD, 0 2px 3px rgba(0, 0, 0, 0.35);
}

/* ── Node State 3: Locked Level (lock.png) ── */
.level-card--locked {
    cursor: pointer;
}

.level-card__lock-content {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    pointer-events: none;
    width: 100%;
}

.level-card__padlock-icon {
    width: 25px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6));
}

.level-card__padlock-icon svg {
    width: 100%;
    height: 100%;
}

.level-card__lock-num {
    font-family: 'Fredoka', 'Outfit', var(--font-family, system-ui), sans-serif;
    font-size: 16.5px;
    font-weight: 900;
    line-height: 1;
    color: #1E293B;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45), 0 -1px 0 rgba(0, 0, 0, 0.4);
}

/* Entrance Animations */
.level-card--animate-in {
    animation: nodeEnter 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes nodeEnter {
    0% {
        opacity: 0;
        transform: scale(0.6);
    }

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

/* ────────────────────────────────────────
   5. Unlock Level Modal
   ──────────────────────────────────────── */

.level-unlock-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 10, 18, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.level-unlock-overlay--visible {
    opacity: 1;
    pointer-events: auto;
}

.level-unlock-card {
    width: 90%;
    max-width: 320px;
    background: linear-gradient(180deg, #0284C7 0%, #0369A1 60%, #024E82 100%);
    border: 3px solid #38BDF8;
    border-radius: 24px;
    padding: 22px 18px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6),
        inset 0 2px 0 rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.level-unlock-icon-wrap {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(180deg, #FDE047 0%, #F59E0B 100%);
    border: 2px solid #FEF08A;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.level-unlock-title {
    font-family: 'Fredoka', 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 900;
    color: #FFFFFF;
    text-shadow: 0 2px 0 #02365A;
    margin-bottom: 6px;
}

.level-unlock-subtitle {
    font-size: 13px;
    color: #E0F2FE;
    margin-bottom: 16px;
    line-height: 1.3;
}

.level-unlock-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.level-unlock-btn {
    width: 100%;
    height: 48px;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Fredoka', 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 900;
    transition: transform 0.12s;
}

.level-unlock-btn:active {
    transform: scale(0.95);
}

.level-unlock-btn--coin {
    background: linear-gradient(180deg, #FDE047 0%, #F59E0B 100%);
    border: 2px solid #FEF08A;
    box-shadow: 0 4px 0 #92400E;
    color: #451A03;
}

.level-unlock-btn--ad {
    background: linear-gradient(180deg, #4ADE80 0%, #16A34A 100%);
    border: 2px solid #86EFAC;
    box-shadow: 0 4px 0 #14532D;
    color: #FFFFFF;
}

.level-unlock-cancel {
    margin-top: 10px;
    background: transparent;
    border: none;
    color: #BAE6FD;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
}

/* ────────────────────────────────────────
   5. Infinite Level Chunk Loader & Jump Highlight
   ──────────────────────────────────────── */

.levels__load-more-wrap {
    grid-column: 1 / -1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 0 28px 0;
}

.levels__load-more-btn {
    width: 100%;
    max-width: 320px;
    height: 48px;
    background: linear-gradient(180deg, #38BDF8 0%, #0284C7 60%, #0369A1 100%);
    border: 2.5px solid #BAE6FD;
    border-radius: 24px;
    box-shadow: 0 4px 0 #024E82, 0 6px 16px rgba(0, 0, 0, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.65);
    font-family: 'Fredoka', 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 900;
    color: #FFFFFF;
    text-shadow: 0 1.5px 0 #02365A;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.12s, box-shadow 0.12s;
}

.levels__load-more-btn:active {
    transform: scale(0.96);
    box-shadow: 0 2px 0 #024E82;
}

.levels__infinite-tag {
    font-family: 'Fredoka', 'Outfit', sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    color: #7DD3FC;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    letter-spacing: 0.4px;
}

/* Number scaling for 10K+ and 100K+ numbers in cards */
.level-card__number--large,
.level-card__play-num.level-card__number--large,
.level-card__lock-num.level-card__number--large {
    font-size: 16px !important;
}

.level-card__number--huge,
.level-card__play-num.level-card__number--huge,
.level-card__lock-num.level-card__number--huge {
    font-size: 13px !important;
    letter-spacing: -0.5px;
}

/* Highlight animation when jumping to level */
.level-card--jump-highlight {
    animation: jumpCardFlash 0.5s ease-in-out infinite alternate !important;
    z-index: 5;
}

@keyframes jumpCardFlash {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(1.18);
    }
}