@import url('https://fonts.googleapis.com/css2?family=Public+Sans:ital,wght@0,100..900;1,100..900&family=Sansation:ital,wght@0,300;0,400;0,700;1,300;1,400;1,700&display=swap');

:root {
    --cyan: #3a5a40;
    --green: #517751;
    --yellow: #a3b18a;
    --red: #ff4545;
    --orange: #ff8c00;
    --grad: linear-gradient(90deg, #3a5a40, #517751, #a3b18a);
    --grad-t: linear-gradient(100deg, #3a5a40 0%, #517751 50%, #a3b18a 100%);
    --dark: #f4f6f1;
    --dark2: #eaede5;
    --dark3: #dde2d8;
    --dark4: #d6dcd2;
    --border: rgba(26, 46, 31, .07);
    --bc: rgba(58, 90, 64, .2);
    --white: #1a2e1f;
    --muted: rgba(26, 46, 31, .9);
    --dim: rgba(26, 46, 31, .9);
    --nav-h: 64px;
    --tab-h: 68px;
}

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

html {
    font-size: 16px;
}

body {
    background: var(--dark);
    color: var(--white);
    font-family: 'Public Sans', sans-serif;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

img {
    display: block;
    max-width: 100%;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Noise */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 9999;
    opacity: .5;
}

/* ══ GRAD TEXT ══ */
.gt {
    background: var(--grad-t);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ══════════════════════════════════
   TOP NAV
══════════════════════════════════ */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-h);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(14px, 4vw, 28px);
    background: rgba(244, 246, 241, .92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(58, 90, 64, .12);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: 1.45rem;
    letter-spacing: 5px;
    text-transform: uppercase;
}
.nav-logo img {
    height: 44px;
    width: auto;
    display: block;
    flex-shrink: 0;
}

.nav-date {
    font-size: .6rem;
    letter-spacing: 2px;
    color: var(--muted);
    text-transform: uppercase;
}

/* ══════════════════════════════════
   SCROLLABLE CONTENT AREA
══════════════════════════════════ */
.app-body {
    position: fixed;
    top: var(--nav-h);
    bottom: var(--tab-h);
    left: 0;
    right: 0;
    overflow: hidden;
}

.page {
    display: none;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: clamp(16px, 3vw, 24px) clamp(12px, 3vw, 24px) 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(58, 90, 64, .2) transparent;
}

.page.active {
    display: block;
}

.page-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ══════════════════════════════════
   BOTTOM TAB BAR
══════════════════════════════════ */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--tab-h);
    z-index: 1000;
    display: flex;
    align-items: stretch;
    background: rgba(244, 246, 241, .95);
    backdrop-filter: blur(16px);
    border-top: 1px solid rgba(26, 46, 31, .06);
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    transition: color .2s;
    position: relative;
    padding-bottom: 4px;
}

.tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--grad);
    border-radius: 0 0 2px 2px;
    transform: scaleX(0);
    transition: transform .25s cubic-bezier(.22, 1, .36, 1);
}

.tab-btn.active::before {
    transform: scaleX(1);
}

.tab-btn.active {
    color: var(--white);
}

.tab-btn .tab-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.tab-btn .tab-label {
    font-size: .55rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ══════════════════════════════════
   SHARED COMPONENTS
══════════════════════════════════ */
.card {
    background: var(--dark2);
    border: 1px solid var(--border);
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: clamp(12px, 1.8vw, 16px) clamp(14px, 2vw, 20px);
    border-bottom: 1px solid rgba(26, 46, 31, .04);
}

.card-title {
    font-family: 'Public Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(.8rem, 1.5vw, .9rem);
    text-transform: uppercase;
    letter-spacing: 2.5px;
}

.card-badge {
    font-size: .58rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--muted);
}

.card-body {
    padding: clamp(14px, 2vw, 18px);
}

.section-label {
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--cyan);
    margin-bottom: 10px;
}

/* ══════════════════════════════════
   PAGE 1: HOME
══════════════════════════════════ */
.home-greeting {
    padding: clamp(20px, 3vw, 28px) clamp(16px, 2vw, 22px);
    background: linear-gradient(135deg, rgba(58, 90, 64, .07) 0%, rgba(81, 119, 81, .03) 100%);
    border: 1px solid rgba(58, 90, 64, .15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.greeting-text {}

.greeting-sup {
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--cyan);
    margin-bottom: 6px;
}

.greeting-title {
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: clamp(1.6rem, 5vw, 2.4rem);
    text-transform: uppercase;
    line-height: 1;
    letter-spacing: -1px;
}

.greeting-sub {
    font-size: .78rem;
    color: var(--dim);
    margin-top: 5px;
}

.greeting-time {
    text-align: right;
    flex-shrink: 0;
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: clamp(2rem, 6vw, 3rem);
    line-height: 1;
    letter-spacing: -1px;
}

/* Check-in result card */
.checkin-result {
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--border);
    background: var(--dark3);
}

.ci-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.ci-body {
    flex: 1;
}

.ci-level {
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 3px;
}

.ci-desc {
    font-size: .72rem;
    color: var(--dim);
    line-height: 1.4;
}

.ci-score {
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: 1.8rem;
    flex-shrink: 0;
    text-align: right;
}

.ci-score-label {
    font-size: .55rem;
    letter-spacing: 2px;
    color: var(--muted);
    text-transform: uppercase;
}

.ci-bar {
    height: 3px;
    background: rgba(255, 255, 255, .06);
    margin-top: 10px;
    overflow: hidden;
}

.ci-bar-fill {
    height: 100%;
    transition: width 1s cubic-bezier(.22, 1, .36, 1) .3s;
}

/* Quick stats */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: rgba(58, 90, 64, .05);
    border: 1px solid rgba(58, 90, 64, .08);
}

.qs-cell {
    background: var(--dark2);
    padding: clamp(14px, 2.5vw, 20px) 8px;
    text-align: center;
}

.qs-val {
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: clamp(1.5rem, 4vw, 2rem);
    line-height: 1;
}

.qs-label {
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 4px;
}

/* Start CTA */
.btn-start-cta {
    display: block;
    width: 100%;
    text-align: center;
    background: linear-gradient(90deg, #3a5a40, #517751, #a3b18a, #3a5a40);
    background-size: 250% 100%;
    color: #fff;
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: 1.1rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    padding: 18px;
    border-radius: 6px;
    transition: transform .2s, box-shadow .3s;
    animation: liquidShift 5s ease infinite;
    position: relative;
    overflow: hidden;
}

.btn-start-cta::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .2);
    border-radius: inherit;
    transform: translateY(100%);
    transition: transform .45s cubic-bezier(.23, 1, .32, 1);
}

.btn-start-cta:hover::before {
    transform: translateY(0);
}

.btn-start-cta:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 28px rgba(58, 90, 64, .4);
}


/* ══════════════════════════════════
   PAGE 4: MUSICA
══════════════════════════════════ */
.music-input-row {
    display: flex;
    gap: 8px;
}

.music-input {
    flex: 1;
    background: var(--dark4);
    border: 1px solid var(--border);
    color: var(--white);
    padding: 11px 14px;
    font-size: .85rem;
    outline: none;
}

.music-input:focus {
    border-color: var(--cyan);
}

.btn-ok {
    background: linear-gradient(90deg, #3a5a40, #517751, #a3b18a, #3a5a40);
    background-size: 250% 100%;
    color: #fff;
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: .85rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    padding: 0 18px;
    border-radius: 8px;
    transition: transform .2s, box-shadow .3s;
    animation: liquidShift 5s ease infinite;
    white-space: nowrap;
}

.btn-ok:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 18px rgba(58, 90, 64, .4);
}

.player-wrap {
    position: relative;
    padding-top: 56.25%;
    background: #000;
}

.player-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.music-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--dark3);
    border: 1px solid var(--border);
}

.music-meta-label {
    font-size: .65rem;
    letter-spacing: 2px;
    color: var(--muted);
    text-transform: uppercase;
}

.music-meta-val {
    font-size: .75rem;
    font-weight: 600;
    color: var(--green);
}

.btn-share-music {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    width: 100%;
    padding: 12px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--dark3);
    color: var(--white);
    transition: all .2s;
    border-radius: 8px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.btn-share-music:hover {
    border-color: var(--bc);
    background: rgba(58, 90, 64, .07);
    box-shadow: 0 0 18px rgba(58, 90, 64, .15);
}

/* ══════════════════════════════════
   PAGE 5: COMMUNITY
══════════════════════════════════ */
.comm-hero {
    padding: clamp(24px, 4vw, 36px) clamp(18px, 3vw, 28px);
    text-align: center;
    background: linear-gradient(135deg, rgba(58, 90, 64, .06), rgba(81, 119, 81, .03));
    border: 1px solid rgba(58, 90, 64, .12);
}

.comm-hero-title {
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: clamp(1.8rem, 6vw, 3rem);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.comm-hero-sub {
    font-size: .82rem;
    color: var(--dim);
    line-height: 1.6;
}

.social-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    cursor: pointer;
    background: var(--dark3);
    border: 1px solid var(--border);
    transition: all .25s ease;
    border-radius: 6px;
}

.social-btn:hover {
    background: rgba(58, 90, 64, .07);
    border-color: var(--bc);
    box-shadow: 0 4px 20px rgba(58, 90, 64, .12);
    transform: translateY(-2px);
}

.social-btn .sb-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
}

.social-btn .sb-body {
    flex: 1;
}

.social-btn .sb-title {
    font-weight: 700;
    font-size: .9rem;
    margin-bottom: 3px;
}

.social-btn .sb-desc {
    font-size: .7rem;
    color: var(--muted);
}

.social-btn .sb-arrow {
    font-size: 1.2rem;
    color: var(--muted);
}

.btn-challenge-big {
    display: block;
    width: 100%;
    text-align: center;
    background: linear-gradient(90deg, #3a5a40, #517751, #a3b18a, #3a5a40);
    background-size: 250% 100%;
    color: #fff;
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: 1rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    padding: 18px;
    border-radius: 6px;
    transition: transform .2s, box-shadow .3s;
    animation: liquidShift 5s ease infinite;
    position: relative;
    overflow: hidden;
}

.btn-challenge-big::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .2);
    border-radius: inherit;
    transform: translateY(100%);
    transition: transform .45s cubic-bezier(.23, 1, .32, 1);
}

.btn-challenge-big:hover::before {
    transform: translateY(0);
}

.btn-challenge-big:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 28px rgba(58, 90, 64, .4);
}

.badge-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.badge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    background: var(--dark3);
    border: 1px solid var(--border);
    text-align: center;
}

.badge-icon {
    font-size: 1.8rem;
    filter: grayscale(1);
    opacity: .3;
}

.badge-item.earned .badge-icon {
    filter: none;
    opacity: 1;
}

.badge-name {
    font-size: .5rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted);
    line-height: 1.3;
}

.badge-item.earned .badge-name {
    color: var(--dim);
}


/* ══ CALENDARIO ══ */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cal-header-cell {
    text-align: center;
    font-size: .46rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted);
    padding: 5px 2px;
}

.cal-day {
    min-height: 64px;
    background: var(--dark3);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 2px 4px;
    overflow: hidden;
    transition: background .2s;
    cursor: default;
    gap: 1px;
}

.cal-day.empty {
    background: transparent;
    border-color: transparent;
}

.cal-day.today {
    border-color: rgba(58, 90, 64, .5);
    background: rgba(58, 90, 64, .05);
}

.cal-day.has-workout {
    cursor: pointer;
    border-color: rgba(58, 90, 64, .18);
}

.cal-day.has-workout:hover {
    background: rgba(58, 90, 64, .08);
}

.cal-day.done-100 {
    background: rgba(58, 90, 64, .1);
    border-color: rgba(58, 90, 64, .4);
}

.cal-day-num {
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: .7rem;
    line-height: 1;
    color: var(--muted);
    align-self: flex-start;
    padding-left: 3px;
}

.cal-day.today .cal-day-num {
    color: var(--cyan);
}

.cal-day.has-workout .cal-day-num {
    color: var(--white);
}

.cal-sport {
    font-size: .82rem;
    line-height: 1;
}

.cal-sport-nm {
    font-size: .34rem;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: rgba(26, 46, 31, .45);
    text-align: center;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    padding: 0 2px;
}

.cal-pct-txt {
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: .58rem;
    text-align: center;
    line-height: 1;
}

/* Selezionata */
.cal-day.selected {
    outline: 2px solid var(--cyan);
    outline-offset: -1px;
}


/* Giorno passato nel calendario */
.cal-day.past-workout {
    opacity: .7;
}

/* ══ ACCORDION DIARIO ══ */
.diary-accord {
    background: var(--dark3);
    border: 1px solid var(--border);
    overflow: hidden;
}

.diary-accord-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    cursor: pointer;
    transition: background .2s;
    -webkit-tap-highlight-color: transparent;
}

.diary-accord-head:hover {
    background: rgba(58, 90, 64, .04);
}

.diary-accord-body {
    display: none;
    border-top: 1px solid rgba(26, 46, 31, .04);
}

.diary-accord-body.open {
    display: block;
    animation: fadeInDown .2s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-6px)
    }

    to {
        opacity: 1;
        transform: none
    }
}

.diary-accord-foot {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid rgba(26, 46, 31, .04);
    flex-wrap: wrap;
}

/* ══ PIANO LIMITE ══ */
.plan-full-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255, 140, 0, .07);
    border: 1px solid rgba(255, 140, 0, .25);
    font-size: .68rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--orange);
}

/* ══ BHI DETAIL ══ */
.bhi-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .04);
    font-size: .7rem;
}

.bhi-detail-row:last-child {
    border-bottom: none;
}

.bhi-detail-label {
    color: var(--muted);
}

.bhi-detail-val {
    font-weight: 700;
}

/* ══════════════════════════════════
   TOAST
══════════════════════════════════ */
.toast {
    position: fixed;
    bottom: calc(var(--tab-h) + 14px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    z-index: 4000;
    pointer-events: none;
    background: var(--dark3);
    border: 1px solid rgba(58, 90, 64, .25);
    padding: 10px 20px;
    white-space: nowrap;
    font-size: .72rem;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--cyan);
    opacity: 0;
    transition: all .3s;
    max-width: calc(100vw - 32px);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ══════════════════════════════════
   RESPONSIVE
══════════════════════════════════ */

/* ── 768px: Tablet ── */
@media (max-width: 768px) {
    .nav-logo img {
        height: 36px;
    }
    .nav-logo {
        font-size: 1.2rem;
        letter-spacing: 3px;
    }

    .greeting-title {
        font-size: clamp(1.3rem, 5vw, 2rem);
    }

    .greeting-time {
        font-size: clamp(1.4rem, 5vw, 2.2rem);
    }

    .cal-day {
        min-height: clamp(48px, 10vw, 64px);
    }

    .cal-sport-nm {
        font-size: clamp(.28rem, 1vw, .34rem);
    }

    .comm-hero-title {
        font-size: clamp(1.4rem, 6vw, 2.4rem);
    }

    .toast {
        white-space: normal;
    }

    .btn-start-cta,
    .btn-challenge-big,
    .btn-check-all,
    .btn-save-day {
        font-size: clamp(.82rem, 2vw, 1rem);
        letter-spacing: clamp(1px, .5vw, 3px);
        padding: clamp(12px, 2vw, 16px) clamp(16px, 3vw, 24px);
    }
}

/* ── 600px: Mobile ── */
@media (max-width: 600px) {
    .stats-strip,
    .quick-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .sum-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .badge-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .badge-icon {
        font-size: clamp(1.2rem, 4vw, 1.6rem);
    }

    .badge-name {
        font-size: clamp(.38rem, 1.2vw, .5rem);
    }

    .checkin-result {
        flex-wrap: wrap;
        gap: 10px;
    }

    .home-greeting {
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
    }

    .plan-date-block {
        width: clamp(32px, 8vw, 40px);
        height: clamp(32px, 8vw, 40px);
    }

    .ex-check-row {
        padding: 8px 12px;
    }

    .ex-checkbox {
        width: clamp(16px, 4vw, 20px);
        height: clamp(16px, 4vw, 20px);
    }

    .social-btn {
        gap: 8px;
        padding: 12px 14px;
    }

    .log-entry-pct {
        font-size: 1.1rem;
        min-width: 36px;
    }
}

/* ── 480px: Small phone ── */
@media (max-width: 480px) {
    .badge-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .quick-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .tab-bar {
        height: clamp(56px, 14vw, 68px);
    }

    .tab-btn .tab-icon {
        font-size: clamp(1rem, 3vw, 1.3rem);
    }

    .tab-btn .tab-label {
        font-size: clamp(.38rem, 1.2vw, .52rem);
    }

    .qs-val {
        font-size: clamp(1.2rem, 4vw, 1.6rem);
    }

    .ci-icon {
        font-size: clamp(1.4rem, 4vw, 1.8rem);
    }

    .ci-score {
        font-size: clamp(1.3rem, 4vw, 1.6rem);
    }

    .cal-day {
        min-height: clamp(40px, 9vw, 52px);
        padding: 3px 1px;
    }

    .cal-day-num {
        font-size: .6rem;
    }
}

/* ── 380px: XS phone ── */
@media (max-width: 380px) {
    .tab-btn .tab-label {
        font-size: .4rem;
    }

    .quick-stats {
        grid-template-columns: 1fr 1fr;
    }

    .badge-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .plan-card-head {
        gap: 8px;
    }

    .sum-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .nav-logo img {
        height: 30px;
    }
    .nav-logo {
        font-size: 1.05rem;
        letter-spacing: 2px;
    }
}

@keyframes liquidShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* ══ PIANO / DIARIO ══ */
.plan-card {
    background: var(--dark3);
    border: 1px solid var(--border);
    overflow: hidden;
}

.plan-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    cursor: pointer;
    transition: background .2s;
}

.plan-card-head:hover {
    background: rgba(58, 90, 64, .04);
}

.plan-date-block {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: rgba(58, 90, 64, .07);
    border: 1px solid rgba(58, 90, 64, .15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.pdb-day {
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--cyan);
}

.pdb-mon {
    font-size: .45rem;
    letter-spacing: 2px;
    color: var(--muted);
    text-transform: uppercase;
}

.plan-info {
    flex: 1;
}

.plan-sport {
    font-weight: 700;
    font-size: .88rem;
    margin-bottom: 2px;
}

.plan-meta {
    font-size: .65rem;
    color: var(--muted);
}

.plan-chevron {
    font-size: .8rem;
    color: var(--muted);
    transition: transform .25s;
}

.plan-chevron.open {
    transform: rotate(180deg);
}

.plan-detail {
    display: none;
    border-top: 1px solid rgba(26, 46, 31, .04);
}

.plan-detail.open {
    display: block;
}

.plan-phase-label {
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    padding: 8px 16px;
    border-left: 3px solid var(--cyan);
}

.plan-phase-label.warmup {
    border-color: var(--orange);
    color: var(--orange);
    background: rgba(255, 140, 0, .05);
}

.plan-phase-label.main {
    border-color: var(--cyan);
    color: var(--cyan);
    background: rgba(58, 90, 64, .04);
}

.plan-phase-label.cooldown {
    border-color: var(--green);
    color: var(--green);
    background: rgba(58, 90, 64, .03);
}

/* Checkbox esercizi */
.ex-check-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-top: 1px solid rgba(26, 46, 31, .03);
    cursor: pointer;
    transition: background .15s;
}

.ex-check-row:hover {
    background: rgba(255, 255, 255, .02);
}

.ex-check-row.done {
    opacity: .55;
}

.ex-check-row.locked {
    cursor: default;
    pointer-events: none;
}

.diary-accord.past-plan .diary-accord-head {
    cursor: pointer;
}

.diary-accord.past-plan .past-label {
    font-size: .52rem;
    letter-spacing: 2px;
    color: var(--muted);
    text-transform: uppercase;
}

.ex-checkbox {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border: 2px solid rgba(26, 46, 31, .2);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    font-size: .75rem;
}

.ex-check-row.done .ex-checkbox {
    background: var(--cyan);
    border-color: var(--cyan);
    color: #000;
}

.ex-check-body {
    flex: 1;
}

.ex-check-name {
    font-size: .82rem;
    font-weight: 600;
}

.ex-check-detail {
    font-size: .63rem;
    color: var(--muted);
    margin-top: 1px;
}

.ex-check-spec {
    font-size: .65rem;
    color: var(--cyan);
    font-weight: 700;
    flex-shrink: 0;
}

/* Bottoni diario */
.btn-check-all {
    display: block;
    width: calc(100% - 32px);
    text-align: center;
    background: rgba(58, 90, 64, .08);
    color: var(--cyan);
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: .9rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    border: 1px solid rgba(58, 90, 64, .25);
    cursor: pointer;
    padding: 13px;
    border-radius: 8px;
    transition: all .25s ease;
    margin: 8px 16px 0;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.btn-check-all:hover {
    background: rgba(58, 90, 64, .15);
    box-shadow: 0 0 18px rgba(58, 90, 64, .2);
}

.btn-save-day {
    display: block;
    width: calc(100% - 32px);
    text-align: center;
    background: linear-gradient(90deg, #3a5a40, #517751, #a3b18a, #3a5a40);
    background-size: 250% 100%;
    color: #fff;
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: .9rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    padding: 13px;
    border-radius: 8px;
    transition: transform .2s, box-shadow .3s;
    margin: 6px 16px 16px;
    animation: liquidShift 5s ease infinite;
    position: relative;
    overflow: hidden;
}

.btn-save-day::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .2);
    border-radius: inherit;
    transform: translateY(100%);
    transition: transform .4s cubic-bezier(.23, 1, .32, 1);
}

.btn-save-day:hover::before {
    transform: translateY(0);
}

.btn-save-day:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(58, 90, 64, .4);
}

.btn-del-plan {
    background: none;
    border: none;
    color: rgba(255, 69, 69, .5);
    font-size: .6rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    padding: 4px 8px;
    transition: color .2s;
}

.btn-del-plan:hover {
    color: var(--red);
}

/* Progress bar diario */
.diary-progress-bar {
    height: 3px;
    background: rgba(26, 46, 31, .05);
    margin: 0 16px;
}

.diary-progress-fill {
    height: 100%;
    background: var(--grad);
    transition: width .4s;
}

/* Log entry */
.log-entry {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--dark3);
    border: 1px solid var(--border);
}

.log-entry-pct {
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: 1.4rem;
    flex-shrink: 0;
    min-width: 48px;
    text-align: right;
}

/* ══════════════════════════════════════════
   MATCH TAB LINK
══════════════════════════════════════════ */

.match-header {
    padding: 4px 0 14px;
    text-align: center;
}
.match-title {
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: 1.8rem;
    line-height: 1.15;
    margin: 6px 0 6px;
}
.match-sub {
    font-size: .58rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(26,46,31,.4);
}

.match-arena {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 310px;
    margin: 0 0 14px;
}

.match-card {
    width: 100%;
    max-width: 360px;
    background: var(--dark2);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    padding: 0 0 22px;
    box-shadow: 0 8px 32px rgba(26,46,31,.1);
    will-change: transform;
    user-select: none;
}

.mc-avatar {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: 2.8rem;
    color: rgba(255,255,255,.9);
    letter-spacing: -1px;
    margin-bottom: 14px;
}

.mc-compat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(58,90,64,.1);
    border: 1px solid rgba(58,90,64,.2);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: .55rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #3a5a40;
    margin: 0 18px 10px;
}

.mc-name {
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: 1.35rem;
    letter-spacing: -.5px;
    color: var(--white);
    padding: 0 18px 4px;
}

.mc-meta {
    font-size: .58rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(26,46,31,.45);
    padding: 0 18px 12px;
}

.mc-goals {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 18px;
}

.mc-goal-chip {
    background: rgba(58,90,64,.08);
    border: 1px solid rgba(58,90,64,.15);
    border-radius: 20px;
    padding: 4px 11px;
    font-size: .52rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #3a5a40;
}

.match-done {
    text-align: center;
    padding: 40px 20px;
}
.match-done-icon { font-size: 3rem; margin-bottom: 10px; }
.match-done-title {
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: 1.1rem;
    color: var(--white);
    margin-bottom: 18px;
}
.match-reload-btn {
    background: #3a5a40;
    color: #fff;
    border: none;
    border-radius: 40px;
    padding: 12px 28px;
    font-family: 'Public Sans', sans-serif;
    font-weight: 800;
    font-size: .7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .2s;
}
.match-reload-btn:hover { background: #2d4a33; }

.match-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 0 0 18px;
}

.mab {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all .2s;
    -webkit-tap-highlight-color: transparent;
}
.mab-skip {
    width: 56px; height: 56px;
    background: var(--dark2);
    border: 2px solid rgba(26,46,31,.12);
    font-size: 1.3rem;
    color: rgba(26,46,31,.5);
    box-shadow: 0 3px 12px rgba(0,0,0,.08);
}
.mab-skip:hover  { border-color: var(--red); color: var(--red); transform: scale(1.06); }
.mab-skip:active { transform: scale(.92); }

.mab-super {
    width: 48px; height: 48px;
    background: var(--dark2);
    border: 2px solid rgba(26,46,31,.12);
    font-size: 1rem;
    color: #f59e0b;
    box-shadow: 0 3px 12px rgba(0,0,0,.08);
}
.mab-super:hover  { border-color: #f59e0b; transform: scale(1.06); }
.mab-super:active { transform: scale(.92); }

.mab-like {
    width: 64px; height: 64px;
    background: #3a5a40;
    font-size: 1.5rem;
    color: #fff;
    box-shadow: 0 6px 20px rgba(58,90,64,.4);
}
.mab-like:hover  { background: #2d4a33; transform: scale(1.06); }
.mab-like:active { transform: scale(.95); }

.match-section { padding: 0 0 80px; }

.match-empty-text {
    font-size: .58rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(26,46,31,.35);
    text-align: center;
    padding: 20px 0;
}

.matched-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--dark2);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 6px;
    border-left: 4px solid #3a5a40;
    transition: background .15s;
}
.matched-item:hover { background: var(--dark3); }

.mi-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: .8rem;
    color: rgba(255,255,255,.9);
    flex-shrink: 0;
}
.mi-body { flex: 1; min-width: 0; }
.mi-name {
    font-family: 'Public Sans', sans-serif;
    font-weight: 800;
    font-size: .88rem;
    color: var(--white);
}
.mi-meta {
    font-size: .52rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(26,46,31,.4);
    margin-top: 2px;
}
.mi-challenge {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(58,90,64,.1);
    border: 1px solid rgba(58,90,64,.2);
    border-radius: 20px;
    padding: 7px 13px;
    font-size: .56rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #3a5a40;
    cursor: pointer;
    transition: background .2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.mi-challenge:hover { background: rgba(58,90,64,.18); }

/* ══════════════════════════════════
   BODY MAP
══════════════════════════════════ */
.body-map-outer {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 16px 10px;
    gap: 12px;
}
.body-map-hint {
    font-size: .58rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(26,46,31,.4);
    text-align: center;
}
.body-map-wrap {
    position: relative;
    width: 155px;
    margin: 0 auto;
}
#bodySvg {
    width: 100%;
    height: auto;
    display: block;
}

/* zones — stroke-width in viewBox units (215 wide),
   scale ≈ 0.72 → sw 3 ≈ 2.2px on screen */
.bz {
    fill: rgba(58, 90, 64, 0.06);
    stroke: rgba(58, 90, 64, 0.30);
    stroke-width: 3;
    stroke-linejoin: round;
    stroke-linecap: round;
    cursor: pointer;
    transition: fill .2s, stroke .2s, filter .2s;
    -webkit-tap-highlight-color: transparent;
}
.bz:hover {
    fill: rgba(58, 90, 64, 0.14);
    stroke: rgba(58, 90, 64, 0.55);
}
.bz.pain-from-checkin {
    fill: rgba(255, 69, 69, 0.32);
    stroke: rgba(255, 69, 69, 0.75);
    stroke-width: 4;
    animation: painPulse 2.2s ease-in-out infinite;
}
.bz.pain-manual {
    fill: rgba(255, 140, 0, 0.28);
    stroke: rgba(255, 140, 0, 0.65);
    stroke-width: 3.5;
}
.bz.pain-from-checkin.pain-manual {
    fill: rgba(255, 69, 69, 0.42);
    stroke: rgba(255, 69, 69, 0.85);
    stroke-width: 4;
    animation: painPulse 2.2s ease-in-out infinite;
}

@keyframes painPulse {
    0%, 100% { filter: drop-shadow(0 0 3px rgba(255, 69, 69, 0.35)); }
    50%       { filter: drop-shadow(0 0 9px rgba(255, 69, 69, 0.75)); }
}

/* zone tooltip */
.bz-tooltip {
    position: absolute;
    background: var(--dark3);
    border: 1px solid var(--border);
    color: var(--white);
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 4px 9px;
    border-radius: 4px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
    white-space: nowrap;
    z-index: 20;
    transform: translate(-50%, -120%);
}
.bz-tooltip.show { opacity: 1; }

/* legend chips */
.body-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
    min-height: 20px;
    padding: 0 8px;
}
.pain-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: .58rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.pain-chip.from-checkin {
    background: rgba(255, 69, 69, 0.1);
    border: 1px solid rgba(255, 69, 69, 0.3);
    color: #ff4545;
}
.pain-chip.from-manual {
    background: rgba(255, 140, 0, 0.1);
    border: 1px solid rgba(255, 140, 0, 0.3);
    color: #ff8c00;
}
.body-map-reset {
    background: none;
    border: 1px solid rgba(26,46,31,.15);
    color: rgba(26,46,31,.4);
    font-size: .57rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 4px 12px;
    cursor: pointer;
    border-radius: 3px;
    transition: border-color .2s, color .2s;
}
.body-map-reset:hover {
    border-color: rgba(255,69,69,.4);
    color: #ff4545;
}

/* header layout */
.body-map-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 0;
    gap: 8px;
}
.body-map-head-title {
    font-family: 'Public Sans', sans-serif;
    font-weight: 900;
    font-size: .72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 7px;
}
.body-map-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.body-map-badge {
    font-size: .58rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    background: rgba(255,69,69,.1);
    border: 1px solid rgba(255,69,69,.25);
    color: #ff4545;
    padding: 3px 8px;
    border-radius: 3px;
    transition: opacity .3s;
}
.body-map-badge.zero {
    background: rgba(58,90,64,.07);
    border-color: rgba(58,90,64,.15);
    color: rgba(26,46,31,.4);
}