/* Carte Aventure libre : styles visuels historiques. */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --world-color: #5b6eff;
}

body {
    font-family: 'Fredoka', system-ui, sans-serif;
    min-height: 100vh;
    color: white;
    overflow-x: hidden;
}

/* === FOND SIMPLIFIÉ POUR PERFORMANCE === */
.world-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3a 40%, #0f1629 100%);
    overflow: hidden;
}

/* Gradient coloré du monde - STATIQUE */
.world-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 10%, var(--world-color) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 90%, var(--world-color) 0%, transparent 45%);
    opacity: 0.2;
}

/* Étoiles statiques */
.stars-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 10% 10%, white, transparent),
        radial-gradient(2px 2px at 20% 25%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(1px 1px at 30% 15%, white, transparent),
        radial-gradient(2px 2px at 40% 35%, rgba(255, 255, 255, 0.9), transparent),
        radial-gradient(1px 1px at 50% 5%, white, transparent),
        radial-gradient(2px 2px at 60% 45%, rgba(255, 255, 255, 0.7), transparent),
        radial-gradient(1px 1px at 70% 20%, white, transparent),
        radial-gradient(2px 2px at 80% 55%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(1px 1px at 90% 30%, white, transparent);
    background-size: 100% 100%;
    opacity: 0.8;
}

/* Orbes statiques */
.floating-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
}

.orb-1 {
    width: 300px;
    height: 300px;
    background: var(--world-color);
    top: -100px;
    left: -50px;
    opacity: 0.25;
}

.orb-2 {
    width: 200px;
    height: 200px;
    background: #ff6b9d;
    bottom: 10%;
    right: -50px;
    opacity: 0.2;
}

/* Vignette */
.vignette-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.5) 100%);
    pointer-events: none;
}

/* Effet de brume en bas */
.mist-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30%;
    background: linear-gradient(to top, rgba(10, 10, 30, 0.8), transparent);
    pointer-events: none;
}

/* Header - Glassmorphism */
.header {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--world-color), transparent);
    opacity: 0.5;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.back-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateX(-3px);
    box-shadow: 0 0 20px rgba(var(--world-color), 0.3);
}

.world-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.world-title .icon {
    font-size: 1.5rem;
}

.world-title h1 {
    font-size: 1.25rem;
    font-weight: 700;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.header-stats {
    display: flex;
    gap: 0.75rem;
}

.stat-pill {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 2rem;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.stat-pill:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.stat-pill .value {
    color: #fcd34d;
    text-shadow: 0 0 10px rgba(252, 211, 77, 0.5);
}

/* Map container */
.map-container {
    padding: 100px 1.5rem 2rem;
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
}

/* World info - Glassmorphism Card */
.world-info {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 1.5rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.world-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--world-color), transparent);
    opacity: 0.8;
}

.world-info::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, var(--world-color) 0%, transparent 50%);
    opacity: 0.05;
}

.world-info h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

.world-info p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.world-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    position: relative;
    z-index: 1;
}

.world-stat {
    text-align: center;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
}

.world-stat:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.world-stat .value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fcd34d;
    text-shadow: 0 0 15px rgba(252, 211, 77, 0.5);
}

.world-stat .label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 0.25rem;
}

/* Islands path */
.islands-path {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    /* On borne la largeur du chemin (et on le centre) : sinon, sur grand écran, chaque
               rangée occupait toute la largeur et une carte de 220px poussée à un bord laissait
               ~50 % de vide à droite/gauche (grandes zones blanches signalées). Le zigzag reste
               lisible mais resserré autour de l'axe central. */
    max-width: 620px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Path line - Glowing */
.path-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(
        180deg,
        transparent 0%,
        var(--world-color) 10%,
        var(--world-color) 90%,
        transparent 100%
    );
    transform: translateX(-50%);
    z-index: 0;
    opacity: 0.4;
    box-shadow: 0 0 20px var(--world-color);
}

.path-line::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    opacity: 0.5;
}

/* Island row */
.island-row {
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.island-row:nth-child(odd) {
    justify-content: flex-start;
    padding-left: 10%;
}

.island-row:nth-child(even) {
    justify-content: flex-end;
    padding-right: 10%;
}

/* Island card */
.island-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 1.5rem;
    padding: 1.5rem 1.25rem;
    width: 220px;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
}

.island-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--world-color) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.island-card:hover::before {
    opacity: 0.1;
}

.island-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.island-card.locked {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(50%);
}

.island-card.locked:hover {
    transform: none;
    box-shadow: none;
}

.island-card.unlocked {
    border-color: rgba(59, 130, 246, 0.6);
    background: rgba(59, 130, 246, 0.12);
    box-shadow: 0 0 25px rgba(59, 130, 246, 0.25);
}

.island-card.unlocked:hover {
    border-color: #60a5fa;
    box-shadow:
        0 0 50px rgba(59, 130, 246, 0.5),
        0 20px 40px rgba(0, 0, 0, 0.3);
}

.island-card.completed {
    border-color: rgba(34, 197, 94, 0.6);
    background: rgba(34, 197, 94, 0.12);
    box-shadow: 0 0 25px rgba(34, 197, 94, 0.2);
}

.island-card.completed:hover {
    border-color: #4ade80;
    box-shadow:
        0 0 50px rgba(34, 197, 94, 0.4),
        0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Shimmer effect for completed cards - désactivé pour éviter les clignotements */
.island-card.completed::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(
        135deg,
        transparent 0%,
        rgba(34, 197, 94, 0.05) 50%,
        transparent 100%
    );
    pointer-events: none;
}

/* Staggered entrance animation */
.island-row {
    opacity: 1;
    animation: islandEnter 0.6s ease;
}

.island-row:nth-child(1) {
    animation-delay: 0.05s;
}
.island-row:nth-child(2) {
    animation-delay: 0.1s;
}
.island-row:nth-child(3) {
    animation-delay: 0.15s;
}
.island-row:nth-child(4) {
    animation-delay: 0.2s;
}
.island-row:nth-child(5) {
    animation-delay: 0.25s;
}
.island-row:nth-child(6) {
    animation-delay: 0.3s;
}
.island-row:nth-child(7) {
    animation-delay: 0.35s;
}
.island-row:nth-child(8) {
    animation-delay: 0.4s;
}
.island-row:nth-child(9) {
    animation-delay: 0.45s;
}
.island-row:nth-child(10) {
    animation-delay: 0.5s;
}

@keyframes islandEnter {
    from {
        opacity: 0.5;
        transform: translateY(15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* World info entrance animation */
.world-info {
    animation: worldInfoEnter 0.8s ease forwards;
}

@keyframes worldInfoEnter {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Lock overlay */
.island-lock {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: center;
    justify-content: center;
}

.island-lock i {
    font-size: 2rem;
    opacity: 0.7;
}

/* Condition de deblocage : le cadenas seul ne disait pas QUOI faire. */
.island-lock-hint {
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
    line-height: 1.2;
    padding: 0.15rem 0.5rem;
    border-radius: 0.75rem;
    background: rgba(0, 0, 0, 0.55);
}

.island-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.island-name {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.island-type {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.75rem;
}

/* Stars display */
.island-stars {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}

.island-stars .star {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.island-stars .star.filled {
    color: #fcd34d;
    text-shadow:
        0 0 15px rgba(252, 211, 77, 0.8),
        0 0 30px rgba(252, 211, 77, 0.4);
}

.island-score {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.island-rewards {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
}

.island-rewards .xp {
    color: #a5b4fc;
}
.island-rewards .coins {
    color: #fcd34d;
}

/* Difficulty indicator */
.difficulty-dots {
    display: flex;
    justify-content: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.difficulty-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
}

.difficulty-dots .dot.active {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.island-card:hover .difficulty-dots .dot.active {
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.8);
}

/* Badge niveau de difficulte debloque */
.difficulty-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 5;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.difficulty-badge.level-1 {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.4);
}

.difficulty-badge.level-2 {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.difficulty-badge.level-3 {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

.difficulty-badge.level-4 {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.island-card.locked .difficulty-badge {
    display: none;
}

/* Modal for starting island - Glassmorphism */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 1.5rem;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--world-color), #ff6b9d, var(--world-color));
}

.modal-content::after {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background: radial-gradient(circle at center, var(--world-color) 0%, transparent 40%);
    opacity: 0.08;
    pointer-events: none;
}

.modal-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
    animation: modalIconBounce 0.5s ease 0.2s;
}

@keyframes modalIconBounce {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.modal-desc {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
    text-transform: capitalize;
}

.modal-info {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.modal-info-item {
    text-align: center;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.modal-info-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.modal-info-item .value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fcd34d;
    text-shadow: 0 0 10px rgba(252, 211, 77, 0.5);
}

.modal-info-item .label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 0.25rem;
}

.modal-btns {
    display: flex;
    gap: 1rem;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.btn {
    padding: 0.875rem 1.75rem;
    border-radius: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    border: none;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(34, 197, 94, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-3px);
}

/* === TABLETTES (601px - 1024px) === */
@media screen and (min-width: 601px) and (max-width: 1024px) {
    .map-container {
        padding: 90px 1rem 1.5rem;
    }

    .world-info {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .world-info h2 {
        font-size: 1.5rem;
    }

    .world-stats {
        gap: 1.5rem;
        flex-wrap: wrap;
    }

    .world-stat {
        padding: 0.75rem 1rem;
    }

    .island-row:nth-child(odd),
    .island-row:nth-child(even) {
        padding-left: 5%;
        padding-right: 5%;
    }

    .island-card {
        width: 200px;
        padding: 1.25rem 1rem;
    }

    .island-icon {
        font-size: 2.5rem;
    }

    .island-name {
        font-size: 0.95rem;
    }

    .modal-content {
        max-width: 350px;
        padding: 1.5rem;
    }

    .modal-icon {
        font-size: 3rem;
    }

    .modal-info {
        gap: 0.75rem;
        flex-wrap: wrap;
    }
}

/* === PETITS ÉCRANS (< 600px) === */
@media screen and (max-width: 600px) {
    .island-row:nth-child(odd),
    .island-row:nth-child(even) {
        justify-content: center;
        padding: 0;
    }

    .path-line {
        display: none;
    }

    .island-card {
        width: 180px;
    }

    .header-stats {
        display: none;
    }
}
