/* ============================================================
   GAMESETMOI / game.css — v2
   Carte-monde en arbre + avatar + version mobile.
   Fichier : public_html/game/styles/game.css
   (remplace la v1 entièrement)
   ============================================================ */

:root {
    --ocean-deep:   #0b2e4f;
    --ocean:        #14508a;
    --ocean-light:  #2e7fc2;
    --foam:         #d8ecf7;
    --sand:         #e8d5a3;
    --sand-dark:    #c9b076;
    --palm:         #2e8b57;
    --coral:        #ff7f66;
    --gold:         #f5c542;
    --ink:          #10222f;
}

* { box-sizing: border-box; }

body.game-page {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: linear-gradient(180deg, var(--ocean-deep) 0%, var(--ocean) 60%, var(--ocean-light) 100%);
    color: var(--foam);
    min-height: 100vh;
}

/* ---------- Header ---------- */
#game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(11, 46, 79, 0.85);
    backdrop-filter: blur(4px);
    position: sticky;
    top: 0;
    z-index: 100;
}
#game-header h1 { font-size: 1.25em; margin: 0; letter-spacing: 0.04em; }

#gh-player { display: flex; align-items: center; gap: 14px; font-size: 0.9em; }
#gh-player .gh-stat {
    display: flex; align-items: center; gap: 5px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 20px; padding: 4px 12px; white-space: nowrap;
}
#gh-player .gh-grade { color: var(--gold); font-weight: 600; }

#gh-bar {
    width: 120px; height: 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px; overflow: hidden;
}
#gh-bar-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--coral), var(--gold));
    transition: width 0.6s ease-out;
}

#gh-links a {
    color: var(--foam); text-decoration: none;
    font-size: 0.85em; opacity: 0.85; margin-left: 14px;
}
#gh-links a:hover { opacity: 1; text-decoration: underline; }

/* ---------- Onglets d'îles ---------- */
#island-tabs { display: flex; gap: 8px; padding: 12px 20px 0; flex-wrap: wrap; }
#island-tabs button {
    background: rgba(255, 255, 255, 0.1);
    color: var(--foam);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px; padding: 6px 16px;
    cursor: pointer; font-size: 0.9em; transition: all 0.15s;
}
#island-tabs button:hover { background: rgba(255, 255, 255, 0.2); }
#island-tabs button.active {
    background: var(--sand); color: var(--ink);
    border-color: var(--sand); font-weight: 600;
}

/* ---------- Carte SVG (desktop) ---------- */
#game-map-wrap { position: relative; padding: 6px 16px 24px; }
#game-map { width: 100%; max-width: 1150px; margin: 0 auto; display: block; }

.wave-line {
    stroke: rgba(216, 236, 247, 0.14); stroke-width: 2; fill: none;
    animation: swell 7s ease-in-out infinite alternate;
}
.wave-line.w2 { animation-delay: -2.5s; stroke: rgba(216, 236, 247, 0.09); }
.wave-line.w3 { animation-delay: -5s;   stroke: rgba(216, 236, 247, 0.06); }
@keyframes swell { from { transform: translateX(0); } to { transform: translateX(-38px); } }
@media (prefers-reduced-motion: reduce) {
    .wave-line { animation: none; }
    #player-avatar { transition: none; }
}

.island-body {
    fill: var(--sand); stroke: var(--sand-dark); stroke-width: 3;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.35));
}
.island-lagoon { fill: rgba(46, 127, 194, 0.35); }
.island-name {
    fill: var(--foam); font-size: 26px; font-weight: 700;
    text-anchor: middle; letter-spacing: 0.08em;
}

/* Chemins (sentiers de l'île) */
.trail {
    fill: none;
    stroke: rgba(16, 34, 47, 0.35);
    stroke-width: 3;
    stroke-dasharray: 1 8;
    stroke-linecap: round;
}

/* Hubs de thèmes */
.hub-node { cursor: pointer; }
.hub-node circle {
    fill: var(--palm);
    stroke: var(--ink); stroke-width: 2;
    transition: r 0.15s;
}
.hub-node:hover circle { stroke-width: 3; }
.region-label {
    fill: rgba(16, 34, 47, 0.75);
    font-size: 12.5px; font-weight: 700; text-anchor: middle;
    text-transform: uppercase; letter-spacing: 0.07em;
    pointer-events: none;
}

/* Zones (chapitres) */
.zone-node { cursor: pointer; }
.zone-node circle.zn-halo { fill: transparent; transition: fill 0.15s; }
.zone-node:hover circle.zn-halo { fill: rgba(255, 255, 255, 0.28); }
.zone-node circle.zn-dot { stroke: var(--ink); stroke-width: 1.6; }
.zone-node:hover circle.zn-dot { stroke-width: 2.4; }

.zn-none     { fill: #f2e9cf; }
.zn-progress { fill: var(--ocean-light); }
.zn-mastered { fill: var(--gold); }

.zone-label {
    fill: var(--ink); font-size: 11.5px;
    text-anchor: middle; pointer-events: none; font-weight: 700;
}
.zone-pct {
    fill: rgba(16, 34, 47, 0.55); font-size: 9.5px;
    text-anchor: middle; pointer-events: none;
}

/* Items dépliés */
.item-node { cursor: pointer; }
.item-node circle {
    fill: var(--coral);
    stroke: var(--ink); stroke-width: 1.4;
}
.item-node:hover circle { stroke-width: 2.4; }
.item-label {
    fill: var(--ink); font-size: 9.5px;
    text-anchor: middle; pointer-events: none; font-weight: 600;
}

/* Avatar */
#player-avatar { pointer-events: none; }
.avatar-halo {
    fill: rgba(255, 255, 255, 0.85);
    stroke: var(--coral); stroke-width: 2.5;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.4));
}

/* ---------- Arborescence mobile ---------- */
#mobile-tree { display: none; padding: 10px 14px 30px; }
.mt-theme { margin-bottom: 10px; }
.mt-theme-btn {
    width: 100%; text-align: left;
    background: var(--sand); color: var(--ink);
    border: none; border-radius: 10px;
    padding: 13px 16px;
    font-size: 1em; font-weight: 700;
    cursor: pointer;
}
.mt-chapters { padding: 6px 0 0 12px; }
.mt-chapters.hidden { display: none; }
.mt-chap-btn {
    display: flex; justify-content: space-between; align-items: center;
    width: 100%; text-align: left;
    background: rgba(255, 255, 255, 0.1);
    color: var(--foam);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 11px 14px; margin-top: 6px;
    font-size: 0.9em; cursor: pointer;
}
.mt-chap-btn .mt-pct { opacity: 0.8; font-size: 0.85em; }
.mt-chap-btn.mt-mastered { border-color: var(--gold); }
.mt-chap-btn.mt-mastered .mt-pct { color: var(--gold); }
.mt-chap-btn.mt-progress { border-color: var(--ocean-light); }

/* ---------- Panneau latéral ---------- */
#zone-panel {
    position: fixed; top: 0; right: -400px;
    width: 380px; max-width: 94vw; height: 100vh;
    background: #fdfaf2; color: var(--ink);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.35);
    transition: right 0.25s ease-out;
    z-index: 200;
    display: flex; flex-direction: column;
}
#zone-panel.open { right: 0; }

#zp-head {
    position: relative;
    padding: 18px 46px 12px 20px;
    background: var(--sand);
    border-bottom: 2px solid var(--sand-dark);
}
#zp-head h2 { margin: 0 0 4px; font-size: 1.1em; }
#zp-head .zp-theme { font-size: 0.78em; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.05em; }
#zp-close {
    position: absolute; top: 10px; right: 12px;
    background: none; border: none;
    font-size: 1.4em; cursor: pointer;
    color: var(--ink); opacity: 0.6;
}
#zp-close:hover { opacity: 1; }

#zp-mastery { padding: 12px 20px; border-bottom: 1px solid #eee3c8; }
#zp-mastery .zp-bar {
    height: 10px; background: #eee3c8;
    border-radius: 5px; overflow: hidden; margin-top: 6px;
}
#zp-mastery .zp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--ocean-light), var(--gold));
    transition: width 0.5s;
}

#zp-items { flex: 1; overflow-y: auto; padding: 12px 20px 20px; }

.zp-subtitle {
    font-size: 0.82em; text-transform: uppercase;
    letter-spacing: 0.06em; opacity: 0.65;
    margin: 16px 0 8px;
}
.zp-subtitle:first-child { margin-top: 0; }

.zp-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 4px;
    border-bottom: 1px solid #f2ecd9;
    font-size: 0.9em;
}
.zp-item .zp-status { font-size: 1.05em; width: 22px; text-align: center; }
.zp-item-btn {
    width: 100%; text-align: left;
    background: none; border: none;
    border-bottom: 1px solid #f2ecd9;
    cursor: pointer; font-size: 0.9em;
    font-family: inherit; color: inherit;
}
.zp-item-btn:hover { background: #f8f2e0; }

/* Boutons de jeux */
.zp-games { margin-bottom: 6px; }
.zp-game-btn {
    display: flex; align-items: center; gap: 12px;
    width: 100%;
    background: var(--ocean); color: #fff;
    border: none; border-radius: 10px;
    padding: 12px 14px; margin-bottom: 8px;
    text-decoration: none;
    font-size: 0.92em; cursor: pointer;
    font-family: inherit; text-align: left;
    transition: background 0.15s;
}
.zp-game-btn:hover { background: var(--ocean-light); }
.zp-game-btn small { opacity: 0.8; }
.zp-game-icon { font-size: 1.5em; }
.zp-game-random { background: var(--palm); }
.zp-game-random:hover { background: #37a468; }

.zp-empty { opacity: 0.65; font-size: 0.88em; font-style: italic; }

.zp-back {
    background: none;
    border: 1px solid var(--sand-dark);
    border-radius: 8px;
    padding: 9px 14px; margin-top: 10px;
    cursor: pointer; font-size: 0.88em;
    color: var(--ink); font-family: inherit;
}
.zp-back:hover { background: #f8f2e0; }

/* ---------- Légende ---------- */
#map-legend {
    display: flex; justify-content: center;
    gap: 24px; flex-wrap: wrap;
    padding: 4px 20px 24px;
    font-size: 0.82em; opacity: 0.9;
}
#map-legend span { display: flex; align-items: center; gap: 6px; }
#map-legend i {
    display: inline-block; width: 13px; height: 13px;
    border-radius: 50%; border: 1.5px solid var(--ink);
}
#map-legend .lg-none     { background: #f2e9cf; }
#map-legend .lg-progress { background: var(--ocean-light); }
#map-legend .lg-mastered { background: var(--gold); }
#map-legend .lg-item     { background: var(--coral); }

/* ---------- Message non connecté ---------- */
#map-message {
    max-width: 560px; margin: 60px auto;
    text-align: center;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 36px 28px;
}
#map-message a { color: var(--gold); }

/* ---------- Profil ---------- */
.profil-wrap { max-width: 760px; margin: 0 auto; padding: 24px 20px 50px; }
.profil-card {
    background: rgba(255, 255, 255, 0.09);
    border-radius: 14px;
    padding: 22px 24px; margin-bottom: 18px;
}
.profil-card h2 { margin: 0 0 14px; font-size: 1.05em; color: var(--gold); }

#pf-identity { display: flex; align-items: center; gap: 18px; }
#pf-avatar {
    width: 64px; height: 64px; border-radius: 50%;
    background: var(--sand);
    display: flex; align-items: center; justify-content: center;
    font-size: 2em;
}
#pf-grade { font-size: 1.25em; font-weight: 700; color: var(--gold); }
#pf-level { opacity: 0.85; font-size: 0.9em; }

.pf-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
}
.pf-stat {
    background: rgba(255, 255, 255, 0.07);
    border-radius: 10px; padding: 14px; text-align: center;
}
.pf-stat .pf-num { font-size: 1.5em; font-weight: 700; color: var(--foam); }
.pf-stat .pf-lbl { font-size: 0.78em; opacity: 0.75; margin-top: 2px; }

.pf-zone-row {
    display: flex; align-items: center; gap: 12px;
    padding: 7px 0; font-size: 0.9em;
}
.pf-zone-row .pfz-id { width: 52px; font-weight: 600; color: var(--gold); }
.pf-zone-row .pfz-bar {
    flex: 1; height: 8px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px; overflow: hidden;
}
.pf-zone-row .pfz-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--ocean-light), var(--gold));
}
.pf-zone-row .pfz-pct { width: 44px; text-align: right; font-size: 0.85em; opacity: 0.85; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    #game-header h1 { font-size: 1.05em; }
    #gh-bar { width: 80px; }
}

/* ---------- Bouton retour circulaire (v3.1) ---------- */
.back-node { cursor: pointer; }
.back-node circle {
    fill: rgba(255, 255, 255, 0.92);
    stroke: var(--sand-dark);
    stroke-width: 2;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.3));
    transition: fill 0.15s;
}
.back-node:hover circle { fill: #fff; }
.back-arrow {
    fill: none;
    stroke: var(--ink);
    stroke-width: 3.5;
    stroke-linecap: round;
}
.back-arrow-head { fill: var(--ink); }

/* ---------- Bannière visiteur (v3.1) ---------- */
#guest-banner {
    display: none;
    background: rgba(245, 197, 66, 0.15);
    border: 1px solid var(--gold);
    color: var(--foam);
    border-radius: 10px;
    margin: 10px 20px 0;
    padding: 10px 16px;
    font-size: 0.88em;
    text-align: center;
}
#guest-banner a { color: var(--gold); font-weight: 600; }

/* ---------- Statut des items (Lot 3 / v3.2) ---------- */
.item-dot { stroke: var(--ink); stroke-width: 1.4; transition: fill 0.4s; }
.item-dot.in-none     { fill: #f2e9cf; }
.item-dot.in-progress { fill: var(--ocean-light); }
.item-dot.in-mastered { fill: var(--gold); }
.item-node:hover .item-dot { stroke-width: 2.4; }

