@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;600;700;800&display=swap');

:root {
    --mp-bg:      #0f1535;
    --mp-surface: #1a2555;
    --mp-card:    #212e6a;
    --mp-yellow:  #FFD93D;
    --mp-teal:    #4ECDC4;
    --mp-red:     #ef4444;
    --mp-green:   #2ECC71;
    --mp-blue:    #3b82f6;
    --mp-text:    #F0F4FF;
    --mp-muted:   #a8b4d8;
    --mp-radius:  18px;
    --mp-shadow:  0 8px 32px rgba(0,0,0,.45);
    --mp-font-h:  'Fredoka One', cursive;
    --mp-font-b:  'Nunito', sans-serif;
}

/* ── WRAPPER ─────────────────────────────────────────────── */
.lypmp-wrapper {
    font-family: var(--mp-font-b);
    background:  var(--mp-bg);
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    min-height: 540px;
    max-width: 680px;
    margin: 0 auto;
    box-shadow: var(--mp-shadow);
    color: var(--mp-text);
}
.lypmp-wrapper::before {
    content:''; position:absolute; inset:0; pointer-events:none; z-index:0;
    width:2px; height:2px; border-radius:50%; background:white;
    box-shadow:40px 30px 0 white,120px 80px 0 white,220px 40px 0 white,
               320px 120px 0 white,80px 180px 0 white,400px 60px 0 white,
               500px 150px 0 white,60px 260px 0 white,180px 300px 0 white,
               280px 240px 0 white,450px 280px 0 white,350px 340px 0 white,
               150px 380px 0 white,520px 380px 0 white,240px 440px 0 white;
    opacity:.4;
}
.lypmp-wrapper-bg { display:none; }
.lypmp-screen { display:none; padding:24px 20px 28px; animation:mp-fadeIn .3s ease; position:relative; z-index:1; min-height:540px; }
.lypmp-screen.active { display:block; }
@keyframes mp-fadeIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }

.lypmp-back-btn {
    background:rgba(255,255,255,.1); border:1px solid rgba(255,255,255,.15);
    color:var(--mp-text); font-family:var(--mp-font-b); font-weight:700; font-size:14px;
    padding:7px 14px; border-radius:30px; cursor:pointer; margin-bottom:16px;
    display:inline-block; transition:background .2s;
}
.lypmp-back-btn:hover { background:rgba(255,255,255,.2); }

/* ── HOME ────────────────────────────────────────────────── */
.lypmp-home-content { text-align:center; }
.lypmp-logo { display:flex; align-items:center; gap:14px; justify-content:center; margin-bottom:8px; }
.lypmp-logo-icon { font-size:52px; animation:mp-bounce 2s infinite ease-in-out; }
@keyframes mp-bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
.lypmp-title { font-family:var(--mp-font-h); font-size:38px; margin:0; line-height:1.1; color:#fff !important; }
.lypmp-title span { color:var(--mp-yellow); }
.lypmp-subtitle { color:var(--mp-muted); font-size:15px; margin:0 0 22px; text-align:center; }

/* Griglia livelli */
.lypmp-levels-grid { display:flex; flex-direction:column; gap:10px; margin-bottom:20px; }
.lypmp-level-card {
    background: var(--mp-card);
    border: 2px solid rgba(255,255,255,.08);
    border-left: 4px solid var(--lc, #4ECDC4);
    border-radius: var(--mp-radius);
    padding: 16px 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: background .2s, transform .15s;
    text-align: left;
    position: relative;
}
.lypmp-level-card:hover:not(.lypmp-locked) { background:#2a3880; transform:translateY(-2px); }
.lypmp-level-card.lypmp-locked { cursor:not-allowed; opacity:.6; }
.lypmp-level-icon  { font-size:30px; flex-shrink:0; }
.lypmp-level-info  { flex:1; }
.lypmp-level-name  { font-weight:800; font-size:16px; display:block; }
.lypmp-level-intro { font-size:12px; color:var(--mp-muted); display:block; margin-top:2px; }
.lypmp-level-stars { font-size:12px; color:var(--mp-yellow); margin-top:4px; display:block; letter-spacing:-1px; }
.lypmp-level-badge {
    font-size:11px; font-weight:700; padding:3px 10px; border-radius:20px;
    background:var(--mp-yellow); color:#1a1a2e; flex-shrink:0;
}
.lypmp-level-badge.lypmp-badge-locked {
    background:rgba(255,255,255,.1); color:var(--mp-muted);
}
.lypmp-level-lock-info {
    font-size:11px; color:var(--mp-muted); margin-top:4px; display:block;
}

.lypmp-level-actions { display:flex; gap:8px; flex-shrink:0; }
.lypmp-level-btn {
    background:rgba(255,255,255,.1); border:1px solid rgba(255,255,255,.2);
    color:var(--mp-text); font-family:var(--mp-font-b); font-weight:700;
    font-size:12px; padding:7px 14px; border-radius:20px; cursor:pointer;
    transition:background .15s; white-space:nowrap;
}
.lypmp-level-btn:hover { background:rgba(255,255,255,.22); }
.lypmp-level-btn-play {
    background:linear-gradient(135deg,var(--lc,#4ECDC4),rgba(0,0,0,.1));
    border-color:var(--lc,#4ECDC4); color:#fff;
}

@media (max-width: 520px) {
    .lypmp-level-card {
        flex-wrap: wrap;
        padding: 14px;
        gap: 10px;
    }
    .lypmp-level-icon {
        font-size: 26px;
    }
    .lypmp-level-info {
        flex: 1 1 0;
        min-width: 0;
    }
    .lypmp-level-name  { font-size: 15px; }
    .lypmp-level-intro { font-size: 11px; }
    .lypmp-level-actions {
        width: 100%;
        gap: 8px;
    }
    .lypmp-level-btn {
        flex: 1;
        text-align: center;
        justify-content: center;
        padding: 9px 8px;
        font-size: 13px;
        border-radius: 10px;
    }
}

.lypmp-score-bar {
    display:flex; align-items:center; justify-content:space-between;
    background:var(--mp-surface); border-radius:12px; padding:10px 16px;
    font-size:14px; font-weight:700;
}
.lypmp-btn-small {
    background:rgba(255,255,255,.1); border:1px solid rgba(255,255,255,.2);
    color:var(--mp-text); font-family:var(--mp-font-b); font-size:12px;
    padding:5px 12px; border-radius:20px; cursor:pointer; font-weight:700;
}

/* ── IMPARA ──────────────────────────────────────────────── */
.lypmp-learn-title { font-family:var(--mp-font-h); font-size:24px; margin:0 0 4px; color:#fff !important; }
.lypmp-learn-intro { color:var(--mp-muted); font-size:14px; margin:0 0 14px; }

.lypmp-learn-tabs { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:14px; }
.lypmp-learn-tab {
    padding:5px 12px; border-radius:20px; border:1px solid rgba(255,255,255,.15);
    background:transparent; color:var(--mp-muted); font-family:var(--mp-font-b);
    font-size:12px; font-weight:700; cursor:pointer; transition:all .2s;
}
.lypmp-learn-tab.active { background:var(--mp-card); color:var(--mp-text); border-color:rgba(255,255,255,.3); }

/* Layout impara: mappa a sinistra, lista a destra — affiancati su desktop */
.lypmp-learn-body {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

/* Mappa nella sezione impara */
.lypmp-learn-map-wrap {
    position: relative;
    flex: 0 0 52%;
    min-width: 0;
}
#lypmp-learn-svg-container svg { width:100%; height:auto; display:block; }
#lypmp-learn-svg-container path, #lypmp-learn-svg-container polygon {
    fill: var(--mp-card);
    stroke: rgba(255,255,255,.25);
    stroke-width: 1.5;
    cursor: pointer;
    transition: fill .2s;
}
#lypmp-learn-svg-container path:hover, #lypmp-learn-svg-container polygon:hover { fill: rgba(255,255,255,.15); }
#lypmp-learn-svg-container path.lypmp-region-active, #lypmp-learn-svg-container polygon.lypmp-region-active {
    fill: #2ECC71 !important;
    stroke: #27ae60 !important;
    stroke-width: 2.5 !important;
    filter: drop-shadow(0 0 6px rgba(46,204,113,.7));
}
#lypmp-learn-svg-container path.lypmp-region-nord, #lypmp-learn-svg-container polygon.lypmp-region-nord { fill: rgba(59,130,246,.4); }
#lypmp-learn-svg-container path.lypmp-region-centro, #lypmp-learn-svg-container polygon.lypmp-region-centro { fill: rgba(255,211,61,.3); }
#lypmp-learn-svg-container path.lypmp-region-sud, #lypmp-learn-svg-container polygon.lypmp-region-sud { fill: rgba(255,107,53,.3); }
#lypmp-learn-svg-container path.lypmp-region-isole, #lypmp-learn-svg-container polygon.lypmp-region-isole { fill: rgba(168,85,247,.35); }
#lypmp-learn-svg-container path.lypmp-region-hidden, #lypmp-learn-svg-container polygon.lypmp-region-hidden { opacity: .15; pointer-events:none; }

.lypmp-learn-tooltip {
    position:absolute; top:10px; right:10px;
    background:rgba(15,21,53,.95); border:1px solid rgba(255,255,255,.2);
    border-radius:12px; padding:10px 14px; font-size:13px; pointer-events:none;
    max-width:160px; z-index:10;
}
.lypmp-learn-tooltip strong { display:block; font-size:14px; color:#fff; margin-bottom:3px; }
.lypmp-learn-tooltip span   { display:block; font-size:12px; color:var(--mp-muted); }

/* Lista regioni nella sezione impara — 3 colonne, no scroll */
.lypmp-learn-list-wrap {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.lypmp-learn-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    overflow: visible;
    max-height: none;
}
.lypmp-learn-item {
    background:var(--mp-card); border-radius:8px; padding:5px 7px;
    display:flex; flex-direction:column; align-items:flex-start; gap:1px;
    cursor:pointer; transition:background .15s;
    border:1px solid rgba(255,255,255,.06);
}
.lypmp-learn-item:hover { background:#2a3880; }
.lypmp-learn-item.lypmp-learn-selected { background:var(--mp-teal); color:#0f1535; }
.lypmp-learn-item.lypmp-learn-selected .lypmp-learn-sublabel { opacity:.7; }
.lypmp-learn-emoji  { font-size:14px; line-height:1; }
.lypmp-learn-label  { font-weight:700; font-size:11px; line-height:1.2; }
.lypmp-learn-sublabel { font-size:10px; opacity:.65; line-height:1.2; }

/* Su mobile: mappa sopra (intera larghezza), lista 3 colonne sotto */
@media (max-width: 600px) {
    .lypmp-learn-body {
        flex-direction: column;
    }
    .lypmp-learn-map-wrap {
        flex: none;
        width: 100%;
        max-height: none;
    }
    .lypmp-learn-list-wrap {
        width: 100%;
    }
    .lypmp-learn-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ── GIOCO ───────────────────────────────────────────────── */
.lypmp-game-header {
    display:flex; justify-content:space-between; align-items:center;
    margin-bottom:10px; gap:6px;
}
.lypmp-info-chip {
    background:var(--mp-card); border-radius:10px; padding:7px 12px;
    text-align:center; flex:1;
}
.lypmp-info-chip strong { display:block; font-size:16px; color:var(--mp-yellow); }
.lypmp-info-label { font-size:10px; color:var(--mp-muted); font-weight:700; text-transform:uppercase; }
.lypmp-info-center { flex:1.3; }

.lypmp-instruction {
    text-align:center; font-size:13px; color:var(--mp-muted);
    margin-bottom:10px; font-weight:600; min-height:20px;
}

/* Layout gioco: mappa + etichette */
.lypmp-play-area {
    display:flex; flex-direction:column; gap:14px;
}
.lypmp-map-wrap {
    position:relative; background:var(--mp-surface); border-radius:16px;
    overflow:hidden; border:1px solid rgba(255,255,255,.08);
}
#lypmp-svg-container svg { width:100%; height:auto; display:block; }

/* Regioni nella mappa di gioco */
#lypmp-svg-container path, #lypmp-svg-container polygon {
    fill: var(--mp-card);
    stroke: rgba(255,255,255,.2);
    stroke-width: 1.5;
    cursor: pointer;
    transition: fill .25s, stroke .25s;
}
#lypmp-svg-container path.lypmp-target-hover, #lypmp-svg-container polygon.lypmp-target-hover { fill: rgba(255,255,255,.15); stroke:rgba(255,255,255,.5); }
#lypmp-svg-container path.lypmp-correct, #lypmp-svg-container polygon.lypmp-correct { fill: rgba(46,204,113,.55); stroke:#2ECC71; cursor:default; }
#lypmp-svg-container path.lypmp-wrong-flash, #lypmp-svg-container polygon.lypmp-wrong-flash { fill: rgba(239,68,68,.55); stroke:#ef4444; }
#lypmp-svg-container path.lypmp-placed, #lypmp-svg-container polygon.lypmp-placed { fill: rgba(46,204,113,.35); stroke:rgba(46,204,113,.6); cursor:default; }

/* Label sulla mappa (nome posizionato) */
.lypmp-placed-label {
    position:absolute; pointer-events:none; z-index:5;
    background:rgba(46,204,113,.9); color:#0f1535;
    font-family:var(--mp-font-b); font-weight:800; font-size:9px;
    padding:2px 5px; border-radius:6px; white-space:nowrap;
    transform:translate(-50%,-50%);
    box-shadow:0 2px 6px rgba(0,0,0,.4);
}

/* Feedback overlay (✅ ❌ animazione) */
.lypmp-feedback-overlay {
    position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
    pointer-events:none; z-index:10; font-size:72px;
    opacity:0; transition:opacity .15s;
}
.lypmp-feedback-overlay.show { opacity:1; }

/* Griglia etichette */
.lypmp-labels-grid {
    display:flex; flex-wrap:wrap; gap:7px; justify-content:center;
    background:var(--mp-surface); border-radius:14px; padding:12px;
    min-height:60px;
}
.lypmp-label-chip {
    background: var(--mp-card);
    border: 2px solid rgba(255,255,255,.12);
    border-radius: 20px;
    padding: 7px 14px;
    font-family: var(--mp-font-b);
    font-weight: 700;
    font-size: 13px;
    color: var(--mp-text);
    cursor: pointer;
    user-select: none;
    transition: background .15s, border-color .15s, transform .1s;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    gap: 5px;
}
.lypmp-label-chip:hover  { background:#2a3880; transform:scale(1.05); }
.lypmp-label-chip.selected {
    background: var(--mp-teal);
    border-color: var(--mp-teal);
    color: #0f1535;
    transform: scale(1.08);
    box-shadow: 0 4px 14px rgba(78,205,196,.5);
}
.lypmp-label-chip.placed  { opacity:0; pointer-events:none; }
.lypmp-label-chip.wrong-shake { animation:mp-shake .35s ease; }
@keyframes mp-shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }
@keyframes mp-pop   { 0%{transform:scale(1)} 50%{transform:scale(1.15)} 100%{transform:scale(1)} }
.lypmp-region-pop { animation:mp-pop .4s ease; }

/* ── RISULTATO ───────────────────────────────────────────── */
.lypmp-result-content { text-align:center; padding-top:20px; }
.lypmp-result-trophy  { font-size:72px; margin-bottom:8px; }
.lypmp-result-title   { font-family:var(--mp-font-h); font-size:32px; margin:0 0 8px; color:#fff; }
.lypmp-result-stars   { font-size:22px; letter-spacing:1px; margin-bottom:10px; }
.lypmp-result-msg     { color:var(--mp-muted); font-size:15px; margin:0 0 10px; }
.lypmp-result-badge   { display:inline-block; background:var(--mp-yellow); color:#1a1a2e; font-weight:800; font-size:14px; padding:6px 20px; border-radius:30px; margin-bottom:10px; }
.lypmp-unlocked-banner { display:inline-block; background:rgba(46,204,113,.2); border:1px solid #2ECC71; color:#69f0ae; font-weight:700; font-size:14px; padding:8px 18px; border-radius:30px; margin-bottom:14px; }
.lypmp-result-buttons { display:flex; gap:10px; justify-content:center; flex-wrap:wrap; }

/* ── PULSANTI ────────────────────────────────────────────── */
.lypmp-btn-primary {
    background:linear-gradient(135deg,var(--mp-teal),#26a69a);
    color:#0f1535; border:none; border-radius:30px;
    font-family:var(--mp-font-b); font-weight:800; font-size:15px;
    padding:13px 26px; cursor:pointer;
    transition:transform .15s, box-shadow .15s;
    box-shadow:0 4px 15px rgba(78,205,196,.4);
}
.lypmp-btn-primary:hover { transform:translateY(-2px); box-shadow:0 6px 20px rgba(78,205,196,.5); }
.lypmp-btn-secondary {
    background:rgba(255,255,255,.1); border:1px solid rgba(255,255,255,.2);
    color:var(--mp-text); font-family:var(--mp-font-b); font-weight:700;
    font-size:14px; padding:12px 22px; border-radius:30px; cursor:pointer;
    transition:background .2s;
}
.lypmp-btn-secondary:hover { background:rgba(255,255,255,.2); }

/* ── CONFETTI ────────────────────────────────────────────── */
.lypmp-confetti { position:relative; height:60px; overflow:hidden; margin-top:10px; }
.lypmp-confetti-piece {
    position:absolute; top:-10px; border-radius:3px;
    animation:mp-confetti-fall 1.8s ease-in forwards;
}
@keyframes mp-confetti-fall { to { transform:translateY(80px) rotate(720deg); opacity:0; } }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width:600px) {
    .lypmp-screen { padding:16px 12px 20px; }
    .lypmp-logo-icon { font-size:38px; }
    .lypmp-title { font-size:28px; }
    .lypmp-label-chip { font-size:12px; padding:6px 11px; }
    .lypmp-play-area { gap:10px; }
}

/* ── PULSANTE MUTO ─────────────────────────────────────────── */
/* lyp-mute-btn moved to platform */
