:root{
    --mv-bg:#f6f8f9;
    --mv-card:#ffffff;
    --mv-text:#273137;
    --mv-muted:#6f7d84;
    --mv-line:#d7e0e4;
    --mv-accent:#7893a1;
    --mv-accent-soft:#e7eef1;
    --mv-warm:#b69a89;
    --mv-ok:#6f8f7a;
}

.mv-memory,
.mv-memory-list-wrap{
    box-sizing:border-box;
    width:100%;
    max-width:980px;
    margin:0 auto;
    color:var(--mv-text);
    font-family:Montserrat, Arial, sans-serif;
}

.mv-memory *{ box-sizing:border-box; }

.mv-memory{
    background:var(--mv-bg);
    padding:36px;
    border:1px solid #e2e8eb;
}

.mv-memory-head{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:24px;
    margin-bottom:26px;
}

.mv-memory-eyebrow{
    display:block;
    margin-bottom:8px;
    color:var(--mv-accent);
    font-size:11px;
    letter-spacing:2px;
    font-weight:500;
}

.mv-memory-title{
    margin:0 0 8px;
    font-family:"Cormorant Garamond", Georgia, serif;
    font-weight:400;
    font-size:42px;
    line-height:1.05;
    color:#263036;
}

.mv-memory-intro{
    margin:0;
    max-width:650px;
    color:var(--mv-muted);
    font-size:14px;
    line-height:1.7;
}

.mv-memory-restart-top,
.mv-memory-play-again{
    border:1px solid var(--mv-accent);
    background:transparent;
    color:var(--mv-accent);
    padding:12px 18px;
    font:500 11px/1 Montserrat, Arial, sans-serif;
    letter-spacing:1.1px;
    text-transform:uppercase;
    cursor:pointer;
    transition:.2s ease;
}

.mv-memory-restart-top:hover,
.mv-memory-play-again:hover{
    background:var(--mv-accent);
    color:white;
}

.mv-memory-stats{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:1px;
    background:var(--mv-line);
    border:1px solid var(--mv-line);
    margin-bottom:26px;
}

.mv-memory-stats > div{
    background:#fff;
    padding:14px 18px;
    text-align:center;
}

.mv-memory-stat-label{
    display:block;
    margin-bottom:4px;
    color:var(--mv-muted);
    font-size:9px;
    letter-spacing:1.5px;
}

.mv-memory-stats strong{
    font-size:16px;
    font-weight:500;
}

.mv-memory-grid{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:14px;
}

.mv-memory-card{
    position:relative;
    width:100%;
    aspect-ratio:1 / .74;
    min-height:120px;
    padding:0;
    border:0;
    background:transparent;
    perspective:900px;
    cursor:pointer;
}

.mv-memory-card:focus-visible{
    outline:3px solid rgba(120,147,161,.35);
    outline-offset:3px;
}

.mv-memory-card-inner{
    position:absolute;
    inset:0;
    transform-style:preserve-3d;
    transition:transform .42s cubic-bezier(.2,.75,.25,1);
}

.mv-memory-card.is-flipped .mv-memory-card-inner,
.mv-memory-card.is-matched .mv-memory-card-inner{
    transform:rotateY(180deg);
}

.mv-memory-card-face{
    position:absolute;
    inset:0;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:14px;
    backface-visibility:hidden;
    border:1px solid var(--mv-line);
}

.mv-memory-card-back{
    background:linear-gradient(145deg,#fff,#edf2f4);
}

.mv-memory-card-front{
    background:#fff;
    transform:rotateY(180deg);
    color:#2f393e;
    text-align:center;
    font-size:13px;
    line-height:1.35;
    font-weight:500;
}

.mv-memory-card.is-matched .mv-memory-card-front{
    border-color:#a7baad;
    background:#f5faf7;
}

.mv-memory-card.is-wrong .mv-memory-card-front{
    border-color:#c6a79b;
    background:#fff8f5;
}

.mv-memory-mark{
    width:42px;
    height:42px;
    border:1px solid var(--mv-accent);
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
    color:var(--mv-accent);
    font-family:"Cormorant Garamond", Georgia, serif;
    font-size:25px;
}

.mv-memory-feedback{
    margin-top:22px;
    padding:18px 20px;
    background:#fff;
    border-left:3px solid var(--mv-warm);
}

.mv-memory-feedback-title{
    display:block;
    font-family:"Cormorant Garamond", Georgia, serif;
    font-size:22px;
    font-weight:500;
    margin-bottom:3px;
}

.mv-memory-feedback-text{
    color:var(--mv-muted);
    font-size:13px;
    line-height:1.6;
}

.mv-memory-complete{
    margin-top:24px;
    padding:30px;
    text-align:center;
    background:#fff;
    border:1px solid var(--mv-line);
}

.mv-memory-complete-icon{
    display:inline-flex;
    width:46px;
    height:46px;
    border-radius:50%;
    align-items:center;
    justify-content:center;
    background:#edf5f0;
    color:var(--mv-ok);
    font-size:22px;
}

.mv-memory-complete h3{
    margin:12px 0 6px;
    font-family:"Cormorant Garamond", Georgia, serif;
    font-size:30px;
    font-weight:400;
}

.mv-memory-complete p{
    color:var(--mv-muted);
    margin:0 0 18px;
}

.mv-memory-notice{
    padding:16px 18px;
    background:#f7f8f8;
    border:1px solid #e0e5e8;
}

/* Lista / ricerca */
.mv-memory-search{
    position:relative;
    max-width:560px;
    margin-bottom:28px;
}
.mv-memory-search svg{
    position:absolute;
    left:17px;
    top:50%;
    width:18px;
    height:18px;
    transform:translateY(-50%);
    fill:none;
    stroke:var(--mv-accent);
    stroke-width:1.5;
}
.mv-memory-search-input{
    width:100%;
    padding:14px 16px 14px 48px;
    border:1px solid var(--mv-line);
    background:#fff;
    color:var(--mv-text);
    font:400 14px/1.4 Montserrat, Arial, sans-serif;
    outline:none;
}
.mv-memory-search-input:focus{
    border-color:var(--mv-accent);
    box-shadow:0 0 0 2px rgba(120,147,161,.10);
}
.mv-memory-list{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:18px;
}
.mv-memory-list-card{
    background:#fff;
    border:1px solid var(--mv-line);
    padding:24px;
}
.mv-memory-list-card[hidden]{ display:none!important; }
.mv-memory-list-icon{
    width:42px;
    height:42px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:1px solid var(--mv-accent);
    border-radius:50%;
    color:var(--mv-accent);
    font-family:"Cormorant Garamond", Georgia, serif;
    font-size:22px;
}
.mv-memory-list-card h3{
    margin:14px 0 8px;
    font:400 25px/1.08 "Cormorant Garamond", Georgia, serif;
}
.mv-memory-list-card p{
    margin:0 0 14px;
    color:var(--mv-muted);
    font-size:13px;
    line-height:1.6;
}
.mv-memory-list-meta{
    display:block;
    margin-bottom:10px;
    color:var(--mv-warm);
    font-size:10px;
    letter-spacing:1px;
    text-transform:uppercase;
}
.mv-memory-list-card code{
    display:block;
    padding:7px 8px;
    background:#f5f7f8;
    font-size:11px;
    word-break:break-all;
}
.mv-memory-list-empty{ color:var(--mv-muted); }

@media (max-width:780px){
    .mv-memory{ padding:24px; }
    .mv-memory-head{ flex-direction:column; }
    .mv-memory-title{ font-size:36px; }
    .mv-memory-grid{ grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
    .mv-memory-card{ min-height:110px; }
    .mv-memory-list{ grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media (max-width:520px){
    .mv-memory{ padding:20px 16px; }
    .mv-memory-title{ font-size:32px; }
    .mv-memory-stats > div{ padding:12px 8px; }
    .mv-memory-grid{ grid-template-columns:repeat(2,minmax(0,1fr)); }
    .mv-memory-card{ min-height:105px; }
    .mv-memory-card-front{ font-size:12px; padding:10px; }
    .mv-memory-list{ grid-template-columns:1fr; }
}
