/* ===========================
   ISLAND MAP SCREEN
   =========================== */
.map-container {
    flex: 1;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 16px;
    background: linear-gradient(180deg, #81D4FA 0%, #B3E5FC 30%, #E1F5FE 60%, #FFF8E1 85%, #FFECB3 100%);
}

/* Per-island map backgrounds (applied to the .map-container) */
.map-container.map-bg-ocean {
    background: linear-gradient(180deg, #81D4FA 0%, #B3E5FC 30%, #E1F5FE 60%, #FFF8E1 85%, #FFECB3 100%);
}
.map-container.map-bg-park {
    background: linear-gradient(180deg, #C8E6C9 0%, #A5D6A7 40%, #81C784 70%, #FFF8E1 95%, #FCE4EC 100%);
}
.map-container.map-bg-bubble {
    background: linear-gradient(180deg, #E1BEE7 0%, #CE93D8 40%, #9C27B0 75%, #4527A0 100%);
}
.map-container.map-bg-crystal {
    background: linear-gradient(180deg, #FFF176 0%, #FF8A65 35%, #EC407A 70%, #7B1FA2 100%);
}
/* Ella-only: warm volcano dusk — deep ember-orange melting into charcoal sky */
.map-container.map-bg-volcano {
    background:
        radial-gradient(ellipse at 50% 105%, rgba(255, 167, 38, 0.45) 0%, transparent 55%),
        radial-gradient(ellipse at 20% 90%, rgba(255, 87, 34, 0.30) 0%, transparent 50%),
        linear-gradient(180deg, #1A1626 0%, #3E2723 25%, #6D2D1A 55%, #BF360C 80%, #FF8A50 100%);
}
/* Ella-only: lush jungle canopy — dappled emerald-to-deep-green */
.map-container.map-bg-jungle {
    background:
        radial-gradient(ellipse at 80% 12%, rgba(255, 241, 118, 0.18) 0%, transparent 45%),
        radial-gradient(ellipse at 20% 90%, rgba(27, 94, 32, 0.40) 0%, transparent 60%),
        linear-gradient(180deg, #C8E6C9 0%, #81C784 22%, #43A047 50%, #2E7D32 78%, #1B5E20 100%);
}

/* Per-island map headers */
.map-header {
    text-align: center;
    padding: 8px 16px 16px;
    background: linear-gradient(180deg, #0D47A1, #1565C0 40%, #2196F3);
    color: var(--text-white);
    position: relative;
}
.map-header.map-header-park {
    background: linear-gradient(180deg, #2E7D32, #388E3C 40%, #66BB6A);
}
.map-header.map-header-bubble {
    background: linear-gradient(180deg, #4A148C, #6A1B9A 40%, #AB47BC);
}
.map-header.map-header-crystal {
    background: linear-gradient(180deg, #B71C1C, #D500F9 40%, #FF5252);
}
.map-header.map-header-volcano {
    background: linear-gradient(180deg, #3E2723 0%, #BF360C 60%, #FF6E40 100%);
    box-shadow: 0 4px 16px rgba(191, 54, 12, 0.35);
}
.map-header.map-header-jungle {
    background: linear-gradient(180deg, #1B5E20 0%, #2E7D32 50%, #66BB6A 100%);
    box-shadow: 0 4px 16px rgba(27, 94, 32, 0.35);
}

.map-header h2 {
    font-size: 1.3rem;
}

.map-star-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 1rem;
    opacity: 0.9;
}

/* ===========================
   AMBIENT DECORATIONS CONTAINER
   =========================== */
.map-ambient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* ===========================
   PROGRESS BAR (island completion)
   =========================== */
.progress-bar {
    width: 90%;
    max-width: 400px;
    height: 14px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 999px;
    margin: 12px auto;
    position: relative;
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.1),
        inset 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

/* ===========================
   ISLAND PATH AREA
   =========================== */
.island-path {
    position: relative;
    width: 100%;
    min-height: 1180px;
    padding: 20px 0;
    z-index: 1;
}

.island-path svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.path-line {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
}

.path-line-complete {
    stroke: var(--success);
    filter: drop-shadow(0 0 4px rgba(102, 187, 106, 0.4));
}

.path-line-locked {
    stroke: #B0BEC5;
    stroke-dasharray: 8 8;
    opacity: 0.5;
}

.path-line-available {
    stroke: var(--primary-light);
    stroke-dasharray: 8 8;
}

/* ===========================
   MAP NODES (bigger, 64px, playful)
   =========================== */
.map-node {
    position: absolute;
    width: 72px;
    height: 72px;
    border-radius: var(--radius-round);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.55rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    transform: translate(-50%, -50%);
    z-index: 2;
    border: none;
    touch-action: manipulation;
}

.map-node:active {
    transform: translate(-50%, -50%) scale(0.88);
}

.map-node-completed {
    background: linear-gradient(145deg, #66BB6A 0%, #43A047 50%, #2E7D32 100%);
    color: var(--text-white);
    box-shadow:
        0 4px 0 #1B5E20,
        0 6px 14px rgba(27, 94, 32, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    position: relative;
}

/* Sparkle effect on completed nodes */
.map-node-completed::after {
    content: '';
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    background: radial-gradient(circle, #FFD700 0%, rgba(255, 215, 0, 0) 70%);
    border-radius: var(--radius-round);
    animation: sparkle 2s ease-in-out infinite;
    pointer-events: none;
}

.map-node-completed:nth-child(even)::after {
    animation-delay: 0.6s;
    top: auto;
    bottom: -6px;
    right: auto;
    left: -4px;
}

.map-node-available {
    background: var(--profile-gradient-v);
    color: var(--text-white);
    box-shadow:
        0 4px 0 var(--profile-color-dark),
        0 6px 14px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation: glow-pulse 2s ease-in-out infinite;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Distinctive dashed ring makes "available" readable even when profile
   color matches completed-green (Ella). */
.map-node-available::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 3px dashed rgba(255, 255, 255, 0.9);
    animation: spin-ring 6s linear infinite;
    pointer-events: none;
}

@keyframes spin-ring {
    to { transform: rotate(360deg); }
}

.map-node-locked {
    background: linear-gradient(145deg, #CFD8DC 0%, #B0BEC5 50%, #90A4AE 100%);
    color: #78909C;
    box-shadow: 0 3px 0 #78909C, 0 4px 8px var(--shadow);
    cursor: default;
    pointer-events: none;
}

.map-node-stars {
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 0.7rem;
    background: linear-gradient(135deg, #FFF9C4 0%, #FFF176 100%);
    color: #B7791F;
    border-radius: 999px;
    padding: 2px 6px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.4);
}

/* Boss node (last challenge of each island) — oversized, ribboned, glowing */
.map-node-boss {
    width: 96px;
    height: 96px;
    font-size: 2rem;
}
.map-node-boss.map-node-available {
    background: linear-gradient(145deg, #FFD54F 0%, #FFA000 50%, #E65100 100%);
    box-shadow:
        0 4px 0 #BF360C,
        0 8px 18px rgba(230, 81, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    animation: boss-throb 1.6s ease-in-out infinite;
}
.map-node-boss.map-node-completed {
    background: linear-gradient(145deg, #FFD700 0%, #FFB300 50%, #FF8F00 100%);
    box-shadow:
        0 4px 0 #E65100,
        0 8px 18px rgba(255, 143, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.map-node-boss.map-node-locked {
    background: linear-gradient(145deg, #B39DDB 0%, #9575CD 50%, #7E57C2 100%);
    color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 3px 0 #5E35B1, 0 4px 8px var(--shadow);
}
.map-node-boss-ribbon {
    position: absolute;
    left: 50%;
    top: -18px;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #E53935 0%, #B71C1C 100%);
    color: #FFF;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 3px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid #FFF;
    pointer-events: none;
    white-space: nowrap;
}
.map-node-boss-ribbon::before,
.map-node-boss-ribbon::after {
    content: '';
    position: absolute;
    top: 100%;
    width: 0;
    height: 0;
    border: 4px solid transparent;
    border-top-color: #B71C1C;
}
.map-node-boss-ribbon::before { left: 4px; }
.map-node-boss-ribbon::after { right: 4px; }

@keyframes boss-throb {
    0%, 100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 4px 0 #BF360C, 0 8px 18px rgba(230, 81, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
    50%      { transform: translate(-50%, -50%) scale(1.06); box-shadow: 0 4px 0 #BF360C, 0 12px 28px rgba(255, 160, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
}

/* ===========================
   DECORATIVE ELEMENTS
   =========================== */
.map-deco {
    position: absolute;
    font-size: 1.5rem;
    opacity: 0.6;
    pointer-events: none;
    z-index: 1;
}

/* ===========================
   MAP BOTTOM BAR
   =========================== */
.map-bottom {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.95) 100%);
    box-shadow: 0 -2px 12px var(--shadow);
    backdrop-filter: blur(8px);
}

.map-bottom .btn {
    flex: 1;
}

/* ===========================
   PLAYER TOKEN (kid character on map)
   =========================== */
.player-token {
    position: absolute;
    z-index: 3;
    pointer-events: none;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.28));
    animation: token-bob 2.2s ease-in-out infinite;
}

.player-token::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translate(-50%, -2px);
    width: 22px;
    height: 6px;
    background: radial-gradient(ellipse, rgba(0, 0, 0, 0.32), transparent 70%);
    border-radius: 50%;
}

@keyframes token-bob {
    0%, 100% { transform: translate(-50%, -130%); }
    50%      { transform: translate(-50%, -142%); }
}
