:root {
    --ink: #29315d;
    --muted: #66709d;
    --cream: #f7fbff;
    --cloud-blue: #d8eaff;
    --periwinkle: #7f92e8;
    --lilac: #ded8ff;
    --lavender: #9293ee;
    --mint: #c8f0ff;
    --sky: #c8e4ff;
    --gold: #d4c8ff;
    --card: rgba(255, 255, 255, 0.78);
    --shadow: 0 24px 80px rgba(82, 49, 117, 0.18);
    --border: rgba(255, 255, 255, 0.82);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Avenir Next", system-ui, sans-serif;
    background:
        radial-gradient(circle at 10% 20%, rgba(216, 234, 255, 0.95), transparent 32%),
        radial-gradient(circle at 90% 5%, rgba(189, 231, 255, 0.85), transparent 28%),
        radial-gradient(circle at 80% 88%, rgba(202, 239, 255, 0.8), transparent 34%),
        linear-gradient(135deg, #f7fbff 0%, #eef0ff 45%, #eaf7ff 100%);
    overflow-x: hidden;
}

body::before {
    content: "✦   ☾   ✧   ☁️   ✦   🫧   ✧";
    position: fixed;
    inset: auto auto 4% 5%;
    width: 90%;
    color: rgba(127, 146, 232, 0.22);
    font-size: clamp(2rem, 7vw, 6rem);
    letter-spacing: 0.8rem;
    pointer-events: none;
    z-index: 0;
}

a { color: inherit; }

.login-page {
    display: grid;
    place-items: center;
    padding: 2rem;
}

.login-shell, .home-shell, .topbar, .site-footer { position: relative; z-index: 1; }

.sparkle-card {
    border: 1px solid var(--border);
    background: var(--card);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.login-card {
    width: min(100%, 560px);
    padding: clamp(2rem, 5vw, 3.4rem);
    border-radius: 36px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-card::after, .hero::after, .wide-panel::after {
    content: "";
    position: absolute;
    width: 180px;
    height: 180px;
    right: -70px;
    top: -70px;
    background: radial-gradient(circle, rgba(255, 211, 106, 0.46), transparent 68%);
    pointer-events: none;
}

.moon-badge {
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
    margin: 0 auto 1.2rem;
    border-radius: 30px;
    background: linear-gradient(145deg, #fff, #eef5ff);
    box-shadow: inset 0 -10px 24px rgba(127, 146, 232, 0.18), 0 16px 36px rgba(159, 145, 255, 0.2);
    font-size: 2.5rem;
}

.tiny-kicker {
    margin: 0 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.76rem;
    font-weight: 900;
    color: var(--periwinkle);
}

h1, h2 { margin: 0; line-height: 1.05; }

h1 { font-size: clamp(2.2rem, 7vw, 4.8rem); }

h2 { font-size: clamp(1.45rem, 4vw, 2.3rem); }

.soft-copy, .hero p, .wide-panel p, .stat-card p, .quest-card span {
    color: var(--muted);
    line-height: 1.65;
}

.login-form { margin-top: 1.7rem; text-align: left; }

.login-form label {
    display: block;
    margin: 0 0 0.55rem 0.2rem;
    font-weight: 900;
    color: var(--ink);
}

.password-row {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

input[type="password"] {
    width: 100%;
    min-height: 54px;
    border: 2px solid rgba(159, 145, 255, 0.24);
    border-radius: 18px;
    padding: 0.85rem 1rem;
    font: inherit;
    color: var(--ink);
    background: rgba(255,255,255,0.86);
    outline: none;
}

input[type="password"]:focus {
    border-color: rgba(127, 146, 232, 0.8);
    box-shadow: 0 0 0 5px rgba(127, 146, 232, 0.14);
}

button, .primary-button, .secondary-button {
    border: 0;
    border-radius: 18px;
    padding: 0.85rem 1.1rem;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

button, .primary-button {
    color: white;
    background: linear-gradient(135deg, var(--periwinkle), var(--lavender));
    box-shadow: 0 12px 26px rgba(127, 146, 232, 0.28);
}

.secondary-button {
    color: var(--ink);
    background: rgba(255,255,255,0.82);
    border: 1px solid rgba(255,255,255,0.9);
}

.error-bubble {
    margin-top: 1.25rem;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    color: #4c5fa7;
    background: rgba(216, 234, 255, 0.78);
    font-weight: 800;
}

.login-footer {
    margin-top: 1.4rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.topbar {
    width: min(1180px, calc(100% - 2rem));
    margin: 1rem auto 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 1rem;
    border-radius: 26px;
    background: rgba(255,255,255,0.62);
    border: 1px solid rgba(255,255,255,0.85);
    backdrop-filter: blur(15px);
    box-shadow: 0 12px 42px rgba(82,49,117,0.1);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    font-weight: 1000;
}

.brand-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 15px;
    background: #fff;
}

.topbar nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.topbar nav a {
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 850;
    padding: 0.65rem 0.8rem;
    border-radius: 999px;
    color: var(--muted);
}

.topbar nav a:hover { background: rgba(255,255,255,0.82); color: var(--ink); }

.logout-link { color: #5b67ad !important; }

.home-shell {
    width: min(1180px, calc(100% - 2rem));
    margin: 1.2rem auto 2rem;
}

.hero {
    min-height: 430px;
    padding: clamp(1.5rem, 5vw, 4rem);
    border-radius: 42px;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
    gap: 2rem;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero p { max-width: 620px; font-size: 1.1rem; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.4rem; }

.hero-art {
    min-height: 270px;
    display: grid;
    place-items: center;
    position: relative;
}

.planet {
    width: 210px;
    height: 210px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 25%, #fff 0%, #eff2ff 22%, #c9d1ff 55%, #c9d6ff 100%);
    box-shadow: 0 28px 80px rgba(127, 146, 232, 0.28);
    font-size: 5.5rem;
    animation: float 5s ease-in-out infinite;
}

.ribbon, .stars {
    position: absolute;
    font-size: 3rem;
    filter: drop-shadow(0 10px 20px rgba(82,49,117,0.16));
}

.ribbon { right: 10%; bottom: 13%; transform: rotate(12deg); }
.stars { left: 5%; top: 7%; color: var(--lavender); }

.dashboard-grid, .quest-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat-card, .quest-card {
    padding: 1.25rem;
    border-radius: 28px;
    background: rgba(255,255,255,0.68);
    border: 1px solid rgba(255,255,255,0.86);
    box-shadow: 0 16px 48px rgba(82,49,117,0.10);
}

.stat-emoji { font-size: 2rem; }
.stat-label { margin: 0.8rem 0 0.2rem; font-weight: 900; color: var(--periwinkle) !important; }
.stat-card h2 { font-size: 1.35rem; }
.stat-card p:last-child { margin-bottom: 0; }

.panel-row { margin-top: 1rem; }

.wide-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.45fr);
    gap: 1rem;
    padding: clamp(1.3rem, 4vw, 2.2rem);
    border-radius: 34px;
    position: relative;
    overflow: hidden;
}

.cute-list {
    align-self: center;
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.7rem;
}

.cute-list li {
    padding: 0.75rem 1rem;
    border-radius: 18px;
    background: rgba(255,255,255,0.7);
    font-weight: 850;
}

.adventure-board { margin-top: 2rem; }

.section-heading { margin-bottom: 1rem; }

.quest-card {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    font-size: 2rem;
}

.quest-card strong { display: block; font-size: 1.1rem; }
.quest-card span { font-size: 0.96rem; }

.site-footer {
    text-align: center;
    padding: 0 1rem 2rem;
    color: var(--muted);
    font-weight: 850;
}

.ambient-bg .orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(2px);
    opacity: 0.4;
    z-index: 0;
    animation: drift 8s ease-in-out infinite;
}

.orb-one { width: 180px; height: 180px; background: var(--cloud-blue); left: 4%; top: 18%; }
.orb-two { width: 140px; height: 140px; background: var(--sky); right: 7%; top: 30%; animation-delay: -2s !important; }
.orb-three { width: 120px; height: 120px; background: var(--mint); left: 14%; bottom: 10%; animation-delay: -4s !important; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(-4deg); }
    50% { transform: translateY(-14px) rotate(4deg); }
}

@keyframes drift {
    0%, 100% { transform: translate3d(0,0,0); }
    50% { transform: translate3d(18px,-22px,0); }
}

@media (max-width: 880px) {
    .topbar { align-items: flex-start; flex-direction: column; }
    .hero, .wide-panel { grid-template-columns: 1fr; }
    .dashboard-grid, .quest-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero-art { min-height: 220px; }
    .planet { width: 170px; height: 170px; font-size: 4.4rem; }
}

@media (max-width: 560px) {
    .password-row { flex-direction: column; }
    .dashboard-grid, .quest-grid { grid-template-columns: 1fr; }
    .topbar nav a { font-size: 0.88rem; padding: 0.55rem 0.65rem; }
}

.mini-card-link {
    display: inline-flex;
    margin-top: 0.5rem;
    font-weight: 950;
    color: var(--periwinkle);
    text-decoration: none;
}

.cute-list a {
    color: inherit;
    text-decoration: none;
}

.setup-shell {
    min-height: 80vh;
    display: grid;
    place-items: center;
}

.setup-card {
    width: min(100%, 720px);
    padding: clamp(1.5rem, 5vw, 3rem);
    border-radius: 36px;
}

.success-bubble {
    margin: 1.25rem 0;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    color: #24624b;
    background: rgba(202, 239, 255, 0.78);
    font-weight: 900;
}

.walks-hero {
    min-height: 330px;
}

.walk-planet {
    background: radial-gradient(circle at 35% 25%, #fff 0%, #eafff6 24%, #caefff 55%, #c9d6ff 100%);
}

.walks-stats {
    margin-bottom: 1rem;
}

.tracker-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(330px, 0.9fr);
    gap: 1rem;
    margin-top: 1rem;
    align-items: start;
}

.tracker-form-card,
.recent-card {
    padding: clamp(1.25rem, 4vw, 2rem);
    border-radius: 34px;
}

.tracker-form {
    display: grid;
    gap: 1rem;
    margin-top: 1.2rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.tracker-form label {
    display: grid;
    gap: 0.45rem;
    font-weight: 950;
    color: var(--ink);
}

.tracker-form input,
.tracker-form select,
.tracker-form textarea {
    width: 100%;
    border: 2px solid rgba(159, 145, 255, 0.2);
    border-radius: 18px;
    padding: 0.85rem 1rem;
    font: inherit;
    color: var(--ink);
    background: rgba(255,255,255,0.82);
    outline: none;
}

.tracker-form textarea {
    resize: vertical;
}

.tracker-form input:focus,
.tracker-form select:focus,
.tracker-form textarea:focus {
    border-color: rgba(127, 146, 232, 0.76);
    box-shadow: 0 0 0 5px rgba(127, 146, 232, 0.12);
}

.tracker-form .range-input {
    padding: 0;
    accent-color: var(--periwinkle);
    border: 0;
    background: transparent;
}

.range-value {
    color: var(--muted);
    font-weight: 850;
    font-size: 0.92rem;
}

.walk-list {
    display: grid;
    gap: 0.85rem;
    margin-top: 1rem;
}

.walk-entry {
    padding: 1rem;
    border-radius: 24px;
    background: rgba(255,255,255,0.66);
    border: 1px solid rgba(255,255,255,0.88);
}

.walk-entry-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
}

.walk-entry p {
    color: var(--muted);
    line-height: 1.55;
    margin: 0.45rem 0 0;
}

.walk-notes {
    padding: 0.75rem;
    border-radius: 18px;
    background: rgba(255, 248, 244, 0.72);
}

@media (max-width: 900px) {
    .tracker-layout { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
    .form-grid { grid-template-columns: 1fr; }
}


/* Walks tracker sturdy layout patch */
.walks-page .tracker-layout {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: 1.25rem;
    align-items: start;
}

.walks-page .tracker-form-card,
.walks-page .recent-card {
    overflow: hidden;
}

.walks-page .tracker-form {
    display: grid !important;
    gap: 1rem;
}

.walks-page .tracker-form .form-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 1rem;
}

.walks-page .tracker-form label {
    display: grid !important;
    gap: 0.45rem;
    min-width: 0;
}

.walks-page .tracker-form input,
.walks-page .tracker-form select,
.walks-page .tracker-form textarea {
    min-width: 0;
    max-width: 100%;
}

.walks-page .tracker-form textarea {
    width: 100%;
}

@media (max-width: 900px) {
    .walks-page .tracker-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .walks-page .tracker-form .form-grid {
        grid-template-columns: 1fr;
    }
}

/* Walk delete button patch */
.walk-entry-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.delete-walk-form {
    margin: 0;
}

.delete-walk-button {
    border: 0;
    border-radius: 999px;
    padding: 0.45rem 0.7rem;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #5666b4;
    background: rgba(220, 234, 255, 0.88);
    box-shadow: none;
    cursor: pointer;
}

.delete-walk-button:hover,
.delete-walk-button:focus-visible {
    background: rgba(200, 218, 255, 0.95);
    transform: translateY(-1px);
}

@media (max-width: 620px) {
    .walk-entry-head {
        align-items: flex-start;
    }

    .walk-entry-actions {
        justify-content: flex-start;
    }
}

/* Recent-first walk diary patch */
.walk-status-strip {
    margin: 1rem 0;
}

.walks-page .tracker-layout-recent-first {
    grid-template-columns: minmax(420px, 1.25fr) minmax(300px, 0.75fr);
}

.walks-page .recent-card {
    order: 1;
}

.walks-page .compact-add-card {
    order: 2;
    padding: 1.2rem;
}

.add-walk-details {
    display: block;
}

.add-walk-details > summary {
    list-style: none;
    cursor: pointer;
    border-radius: 26px;
    padding: 1rem 1.1rem;
    background: linear-gradient(135deg, rgba(127, 146, 232, 0.24), rgba(159, 145, 255, 0.22));
    border: 1px solid rgba(255,255,255,0.88);
    box-shadow: 0 16px 38px rgba(82,49,117,0.10);
    display: grid;
    gap: 0.25rem;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.add-walk-details > summary::-webkit-details-marker {
    display: none;
}

.add-walk-details > summary:hover,
.add-walk-details > summary:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 20px 48px rgba(82,49,117,0.14);
    outline: none;
}

.add-walk-summary-main {
    color: var(--periwinkle);
    font-size: 1.1rem;
    font-weight: 950;
}

.add-walk-summary-sub {
    color: var(--muted);
    font-weight: 800;
    font-size: 0.9rem;
}

.add-walk-form-wrap {
    margin-top: 1.2rem;
}

.add-walk-details:not([open]) .add-walk-form-wrap {
    display: none;
}

.recent-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

@media (max-width: 900px) {
    .walks-page .tracker-layout-recent-first {
        grid-template-columns: 1fr;
    }

    .walks-page .recent-card,
    .walks-page .compact-add-card {
        order: initial;
    }
}

/* Moon Ribbon home dashboard patch */
.dashboard-page .dashboard-topbar {
    align-items: center;
}

.tracker-nav {
    justify-content: flex-end;
}

.dashboard-shell {
    display: grid;
    gap: 1rem;
}

.dashboard-hero {
    min-height: 360px;
    padding: clamp(1.5rem, 5vw, 3.4rem);
    border-radius: 42px;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.72fr);
    gap: 2rem;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.dashboard-hero::after,
.avatar-card::after,
.body-stats-card::after {
    content: "";
    position: absolute;
    width: 190px;
    height: 190px;
    right: -70px;
    top: -80px;
    background: radial-gradient(circle, rgba(255, 211, 106, 0.42), transparent 68%);
    pointer-events: none;
}

.avatar-card {
    position: relative;
    border-radius: 34px;
    padding: 1rem;
    background: linear-gradient(145deg, rgba(255,255,255,0.8), rgba(238, 245, 255, 0.78));
    border: 1px solid rgba(255,255,255,0.9);
    box-shadow: inset 0 -12px 32px rgba(127, 146, 232, 0.12), 0 18px 50px rgba(82,49,117,0.12);
    overflow: hidden;
}

.avatar-sky {
    min-height: 250px;
    border-radius: 28px;
    display: grid;
    place-items: center;
    position: relative;
    background:
        radial-gradient(circle at 25% 20%, rgba(255,255,255,0.9), transparent 18%),
        radial-gradient(circle at 85% 15%, rgba(189, 231, 255, 0.9), transparent 26%),
        linear-gradient(145deg, rgba(217,209,255,0.55), rgba(191,243,223,0.42));
}

.avatar-sky p {
    position: absolute;
    bottom: 0.85rem;
    margin: 0;
    color: var(--muted);
    font-weight: 900;
}

.avatar-moon,
.avatar-sparkle {
    position: absolute;
    font-size: 2rem;
    filter: drop-shadow(0 10px 18px rgba(82,49,117,0.16));
}

.avatar-moon { left: 1rem; top: 1rem; }
.avatar-sparkle { right: 1.2rem; top: 1.35rem; color: var(--periwinkle); }

.moon-avatar {
    width: 150px;
    height: 170px;
    display: grid;
    place-items: center;
    position: relative;
    border-radius: 48% 48% 42% 42%;
    background:
        radial-gradient(circle at 40% 24%, #fff 0 18%, transparent 19%),
        linear-gradient(160deg, #f4f7ff, #d8eaff 58%, #d9d1ff 100%);
    box-shadow: inset 0 -18px 30px rgba(159,145,255,0.18), 0 24px 50px rgba(127,146,232,0.22);
    animation: float 5s ease-in-out infinite;
}

.avatar-face {
    margin-top: -0.2rem;
    color: #704a83;
    font-size: 1.55rem;
    font-weight: 1000;
}

.avatar-bow {
    position: absolute;
    top: -0.75rem;
    right: 0.7rem;
    transform: rotate(14deg);
    font-size: 2.15rem;
}

.mission-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) repeat(2, minmax(240px, 0.75fr));
    gap: 1rem;
}

.mission-card,
.body-stats-card,
.profile-card {
    padding: clamp(1.25rem, 4vw, 2rem);
    border-radius: 34px;
    position: relative;
    overflow: hidden;
}

.mission-card h2 {
    margin-top: 0.3rem;
}

.mission-card p,
.mission-card small,
.mini-note {
    color: var(--muted);
    line-height: 1.6;
}

.mission-card small {
    display: block;
    margin-top: 0.65rem;
    font-weight: 850;
}

.featured-mission {
    background: linear-gradient(145deg, rgba(255,255,255,0.8), rgba(255, 248, 244, 0.78));
}

.mission-meter {
    height: 14px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255,255,255,0.72);
    border: 1px solid rgba(255,255,255,0.9);
    margin-top: 1rem;
}

.mission-meter span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--periwinkle), var(--lavender));
    box-shadow: 0 8px 18px rgba(127,146,232,0.22);
}

.body-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
    gap: 1rem;
}

.body-stat-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
    margin-top: 1rem;
}

.body-stat-list div {
    min-height: 108px;
    display: grid;
    align-content: center;
    gap: 0.28rem;
    padding: 1rem;
    border-radius: 24px;
    background: rgba(255,255,255,0.66);
    border: 1px solid rgba(255,255,255,0.9);
}

.body-stat-list span {
    color: var(--periwinkle);
    font-weight: 950;
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.body-stat-list strong {
    font-size: clamp(1.25rem, 3vw, 1.8rem);
    line-height: 1.05;
}

.body-stat-list small {
    color: var(--muted);
    font-weight: 850;
}

.profile-card details > summary {
    list-style: none;
    cursor: pointer;
    border-radius: 26px;
    padding: 1rem 1.1rem;
    background: linear-gradient(135deg, rgba(127, 146, 232, 0.24), rgba(159, 145, 255, 0.22));
    border: 1px solid rgba(255,255,255,0.88);
    box-shadow: 0 16px 38px rgba(82,49,117,0.10);
    display: grid;
    gap: 0.25rem;
}

.profile-card details > summary::-webkit-details-marker {
    display: none;
}

.profile-form {
    margin-top: 1.1rem;
}

.profile-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
}

.compact-tracker-grid {
    margin-top: 0;
}

@media (max-width: 980px) {
    .dashboard-hero,
    .mission-grid,
    .body-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .tracker-nav {
        justify-content: flex-start;
    }
}

@media (max-width: 620px) {
    .body-stat-list,
    .profile-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-hero {
        min-height: auto;
    }

    .avatar-sky {
        min-height: 220px;
    }
}


/* Moon Blue Force Patch: remove remaining pink/ribbon visual energy and cache-bust older styling. */
:root {
    --ink: #29315d !important;
    --muted: #66709d !important;
    --cream: #f7fbff !important;
    --cloud-blue: #d8eaff !important;
    --periwinkle: #7f92e8 !important;
    --lilac: #ded8ff !important;
    --lavender: #9293ee !important;
    --mint: #c8f0ff !important;
    --sky: #c8e4ff !important;
    --gold: #d4c8ff !important;
    --shadow: 0 24px 80px rgba(82, 49, 117, 0.18) !important;
}

body {
    background:
        radial-gradient(circle at 10% 20%, rgba(216, 234, 255, 0.95), transparent 32%),
        radial-gradient(circle at 90% 5%, rgba(222, 216, 255, 0.85), transparent 28%),
        radial-gradient(circle at 80% 88%, rgba(200, 240, 255, 0.8), transparent 34%),
        linear-gradient(135deg, #f7fbff 0%, #eef0ff 45%, #eaf7ff 100%) !important;
}

button,
.primary-button,
.secondary-button,
.nav-links a,
.add-walk-toggle,
.delete-walk-button,
.login-button {
    border-color: rgba(127, 146, 232, 0.38) !important;
}

button,
.primary-button,
.login-button,
.add-walk-toggle {
    background: linear-gradient(135deg, #7f92e8, #9293ee) !important;
    color: #ffffff !important;
    box-shadow: 0 14px 32px rgba(127, 146, 232, 0.28) !important;
}

.secondary-button,
.nav-links a {
    background: rgba(255, 255, 255, 0.66) !important;
    color: #29315d !important;
}

.moon-badge,
.stat-icon,
.ribbon,
.avatar-bow,
.quest-icon,
.brand-mark {
    background: radial-gradient(circle at 35% 25%, #ffffff 0%, #eef5ff 24%, #c8e4ff 58%, #ded8ff 100%) !important;
    color: #576bd7 !important;
    border-color: rgba(127, 146, 232, 0.28) !important;
}

.login-card::after,
.hero::after,
.wide-panel::after,
.sparkle-card::after {
    background: radial-gradient(circle, rgba(200, 228, 255, 0.52), transparent 68%) !important;
}

input:focus,
textarea:focus,
select:focus {
    border-color: #7f92e8 !important;
    box-shadow: 0 0 0 4px rgba(127, 146, 232, 0.18) !important;
}

/* Clean home body dashboard overhaul */
.clean-home-shell {
    display: block;
    margin-top: 1.2rem;
}

.clean-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(310px, 0.78fr) minmax(0, 1.22fr);
    gap: 1rem;
    align-items: stretch;
}

.body-profile-panel,
.weight-log-panel {
    padding: clamp(1.25rem, 4vw, 2rem);
    border-radius: 34px;
    position: relative;
    overflow: hidden;
}

.body-profile-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.body-profile-main h1 {
    font-size: clamp(2rem, 5vw, 3.35rem);
    max-width: 480px;
}

.compact-avatar-card {
    padding: 0.6rem;
    border-radius: 28px;
}

.compact-avatar-sky {
    min-height: 150px;
    border-radius: 23px;
}

.compact-moon-avatar {
    width: 94px;
    height: 108px;
    border-radius: 48% 48% 42% 42%;
}

.compact-moon-avatar .avatar-face {
    font-size: 1rem;
}

.compact-moon-avatar .avatar-bow {
    font-size: 1.45rem;
    top: -0.5rem;
}

.clinical-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.clinical-stat-grid div {
    min-height: 106px;
    display: grid;
    align-content: center;
    gap: 0.32rem;
    padding: 1rem;
    border-radius: 24px;
    background: rgba(255,255,255,0.68);
    border: 1px solid rgba(255,255,255,0.92);
}

.clinical-stat-grid .wide-stat {
    grid-column: 1 / -1;
    min-height: 92px;
}

.clinical-stat-grid span {
    color: var(--periwinkle);
    font-weight: 950;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
}

.clinical-stat-grid strong {
    color: var(--ink);
    font-size: clamp(1.12rem, 2.4vw, 1.68rem);
    line-height: 1.08;
}

.profile-details-mini {
    margin-top: 1rem;
}

.profile-details-mini > summary,
.log-weight-details > summary {
    list-style: none;
    cursor: pointer;
    border-radius: 22px;
    padding: 0.85rem 1rem;
    background: linear-gradient(135deg, rgba(216, 234, 255, 0.75), rgba(222, 216, 255, 0.72));
    border: 1px solid rgba(255,255,255,0.9);
    box-shadow: 0 12px 30px rgba(82,49,117,0.08);
    font-weight: 950;
    color: var(--periwinkle);
}

.profile-details-mini > summary::-webkit-details-marker,
.log-weight-details > summary::-webkit-details-marker {
    display: none;
}

.compact-profile-form,
.compact-weight-form {
    margin-top: 1rem;
}

.weight-heading-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.log-weight-details {
    position: relative;
    min-width: min(100%, 240px);
}

.log-weight-details > summary {
    text-align: center;
    color: white;
    background: linear-gradient(135deg, var(--periwinkle), var(--lavender));
    box-shadow: 0 12px 26px rgba(127,146,232,0.24);
}

.log-weight-details[open] > summary {
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.compact-weight-form {
    position: absolute;
    right: 0;
    z-index: 5;
    width: min(340px, calc(100vw - 3rem));
    padding: 1rem;
    border-radius: 22px;
    background: rgba(255,255,255,0.96);
    border: 1px solid rgba(255,255,255,0.95);
    box-shadow: 0 22px 65px rgba(82,49,117,0.18);
}

.optional-label {
    color: var(--muted);
    font-weight: 800;
    font-size: 0.86rem;
}

.weight-chart-wrap {
    margin-top: 0.75rem;
    border-radius: 28px;
    padding: 1rem;
    background: linear-gradient(145deg, rgba(255,255,255,0.62), rgba(238,245,255,0.62));
    border: 1px solid rgba(255,255,255,0.9);
    overflow-x: auto;
}

.weight-chart-svg {
    display: block;
    width: 100%;
    min-width: 520px;
    height: auto;
}

.chart-grid {
    stroke: rgba(127,146,232,0.18);
    stroke-width: 2;
}

.chart-label {
    fill: var(--muted);
    font-size: 14px;
    font-weight: 850;
}

.chart-date-end {
    text-anchor: end;
}

.weight-line {
    fill: none;
    stroke: var(--periwinkle);
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 6px 8px rgba(127,146,232,0.22));
}

.weight-dot {
    fill: #ffffff;
    stroke: var(--lavender);
    stroke-width: 4;
}

.weight-chart-meta {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-top: 0.85rem;
    color: var(--muted);
    font-weight: 900;
}

.empty-weight-chart {
    min-height: 300px;
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
    border-radius: 28px;
    background: linear-gradient(145deg, rgba(255,255,255,0.62), rgba(238,245,255,0.62));
    border: 1px solid rgba(255,255,255,0.9);
}

.empty-weight-chart span {
    font-size: 3rem;
}

.empty-weight-chart p {
    margin-top: 0;
    color: var(--muted);
    font-weight: 850;
}

.clean-home-page .site-footer {
    padding-top: 1rem;
}

@media (max-width: 980px) {
    .clean-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .weight-heading-row {
        align-items: stretch;
        flex-direction: column;
    }

    .log-weight-details {
        min-width: 0;
    }

    .compact-weight-form {
        position: static;
        width: 100%;
    }
}

@media (max-width: 620px) {
    .body-profile-main,
    .clinical-stat-grid {
        grid-template-columns: 1fr;
    }

    .compact-avatar-card {
        width: 160px;
    }
}

/* Food log */
.food-shell {
    gap: 1.5rem;
}

.food-header-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.4rem;
    padding: 1.5rem;
}

.food-header-card h1 {
    margin: 0.1rem 0 0.35rem;
}

.food-total-orb {
    width: 168px;
    min-height: 168px;
    border-radius: 44px;
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.96), rgba(218,229,255,0.92) 45%, rgba(198,209,249,0.88));
    border: 1px solid rgba(255,255,255,0.92);
    box-shadow: 0 22px 46px rgba(99, 119, 204, 0.18);
}

.food-total-orb span {
    font-size: clamp(2.1rem, 5vw, 3.4rem);
    line-height: 1;
    font-weight: 950;
    color: var(--ink);
}

.food-total-orb small {
    margin-top: 0.35rem;
    color: var(--muted);
    font-weight: 900;
    text-transform: lowercase;
}

.food-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
    gap: 1.25rem;
    align-items: start;
}

.food-heading-row,
.food-date-form {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.food-date-form {
    justify-content: flex-end;
}

.food-date-form label {
    font-weight: 900;
    color: var(--muted);
    font-size: 0.86rem;
}

.food-date-form input {
    display: block;
    margin-top: 0.35rem;
    width: 165px;
}

.small-soft-button {
    width: auto;
    padding: 0.75rem 1rem;
    min-height: 0;
}

.food-day-total {
    display: flex;
    align-items: baseline;
    gap: 0.65rem;
    margin: 1rem 0;
    padding: 0.95rem 1rem;
    border-radius: 22px;
    background: rgba(235, 242, 255, 0.72);
    border: 1px solid rgba(255,255,255,0.9);
}

.food-day-total span {
    font-size: 2rem;
    font-weight: 950;
    color: var(--periwinkle-deep, var(--ink));
}

.food-day-total p {
    margin: 0;
    color: var(--muted);
    font-weight: 900;
}

.food-list {
    display: grid;
    gap: 0.8rem;
}

.food-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(255,255,255,0.78), rgba(232,240,255,0.72));
    border: 1px solid rgba(255,255,255,0.92);
    box-shadow: 0 12px 28px rgba(100, 118, 196, 0.10);
}

.food-entry-main {
    display: grid;
    gap: 0.2rem;
}

.food-entry-main strong {
    font-size: 1.02rem;
    color: var(--ink);
}

.food-entry-main span,
.food-entry-main p {
    margin: 0;
    color: var(--muted);
    font-weight: 850;
}

.food-add-card {
    position: sticky;
    top: 1rem;
}

.food-form {
    margin-top: 1rem;
}

.food-empty-state {
    min-height: 220px;
}

@media (max-width: 900px) {
    .food-grid,
    .food-header-card {
        grid-template-columns: 1fr;
    }

    .food-grid {
        display: grid;
        grid-template-columns: 1fr;
    }

    .food-header-card {
        align-items: stretch;
    }

    .food-total-orb {
        width: 100%;
        min-height: 125px;
        border-radius: 30px;
    }

    .food-add-card {
        position: static;
    }
}

@media (max-width: 620px) {
    .food-entry,
    .food-heading-row,
    .food-date-form {
        align-items: stretch;
        flex-direction: column;
    }

    .food-date-form input,
    .small-soft-button {
        width: 100%;
    }
}

/* Clean home daily recommendation strip */
.daily-recommendation-strip {
    display: grid;
    grid-template-columns: 1.25fr 1fr 1fr;
    gap: 1rem;
    margin: 0 0 1.15rem;
}

.daily-mini-card {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    padding: 1rem 1.05rem;
    border: 1px solid rgba(147, 163, 235, 0.28);
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(255,255,255,0.94), rgba(235,241,255,0.86));
    box-shadow: 0 18px 40px rgba(74, 96, 169, 0.12);
}

.daily-mini-card strong {
    display: block;
    color: #39406f;
    font-size: 0.98rem;
    line-height: 1.35;
}

.daily-mini-card small {
    display: block;
    margin-top: 0.35rem;
    color: #7078a5;
    line-height: 1.35;
}

.mini-card-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 2.55rem;
    height: 2.55rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #dce9ff, #eee5ff);
    color: #5967b4;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.75), 0 10px 22px rgba(93, 111, 190, 0.18);
}

.encouragement-card {
    background: linear-gradient(135deg, rgba(245,249,255,0.98), rgba(233,229,255,0.9));
}

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

@media (max-width: 900px) {
    .daily-recommendation-strip {
        grid-template-columns: 1fr;
    }

    .profile-grid {
        grid-template-columns: 1fr;
    }
}


/* Daily guidance card fix */
.clean-home-page .daily-overview-card {
    width: 100%;
    margin: 0 0 1.35rem;
    padding: clamp(1rem, 2vw, 1.35rem);
    border: 1px solid rgba(139, 156, 228, 0.34);
    border-radius: 34px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(235, 243, 255, 0.9) 48%, rgba(239, 232, 255, 0.88));
    box-shadow: 0 22px 55px rgba(84, 101, 178, 0.13);
}

.clean-home-page .daily-overview-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 0.95rem;
}

.clean-home-page .daily-overview-heading h2 {
    margin: 0;
    font-size: clamp(1.6rem, 3vw, 2.35rem);
    color: var(--ink);
}

.clean-home-page .daily-overview-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1.28fr) minmax(0, 0.92fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
}

.clean-home-page .daily-mini-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start;
    gap: 0.9rem;
    min-width: 0;
    padding: 1rem 1.05rem;
    border: 1px solid rgba(139, 156, 228, 0.25);
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.65), 0 12px 28px rgba(85, 101, 172, 0.08);
}

.clean-home-page .daily-mini-card strong {
    display: block;
    color: #2d356d;
    font-size: clamp(0.98rem, 1.35vw, 1.15rem);
    line-height: 1.32;
}

.clean-home-page .daily-mini-card small {
    display: block;
    margin-top: 0.32rem;
    color: #6f78a4;
    line-height: 1.35;
    font-size: 0.9rem;
    font-weight: 800;
}

.clean-home-page .mini-card-icon {
    display: inline-grid !important;
    place-items: center;
    flex: 0 0 2.65rem;
    width: 2.65rem;
    height: 2.65rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #dceaff, #eee6ff);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.75), 0 10px 22px rgba(93, 111, 190, 0.16);
}

@media (max-width: 980px) {
    .clean-home-page .daily-overview-grid {
        grid-template-columns: 1fr;
    }

    .clean-home-page .daily-overview-heading {
        display: block;
    }
}

/* Water log */
.water-header-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(226,241,255,0.9) 50%, rgba(235,232,255,0.86));
}

.water-total-orb {
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.96), rgba(218,239,255,0.92) 45%, rgba(190,220,255,0.88));
}

.water-goal-card {
    display: grid;
    gap: 1rem;
    padding: 1.25rem 1.4rem;
    border-radius: 32px;
    background: linear-gradient(135deg, rgba(255,255,255,0.86), rgba(230,242,255,0.76));
}

.water-goal-card h2 {
    margin: 0.15rem 0 0.25rem;
}

.water-progress-shell {
    height: 18px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(139, 156, 228, 0.2);
    box-shadow: inset 0 2px 8px rgba(80, 100, 160, 0.08);
}

.water-progress-bar {
    height: 100%;
    min-width: 8px;
    border-radius: inherit;
    background: linear-gradient(90deg, #bfe6ff, #8ea3f4, #dcd8ff);
    transition: width 0.25s ease;
}

.water-day-total span,
.water-entry strong {
    color: #4d66b3;
}

/* Food page recommended calorie card */
.food-header-copy {
    min-width: 0;
}

.food-header-stats {
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.food-recommend-card {
    width: min(360px, 100%);
    min-height: 168px;
    padding: 1.15rem 1.2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 34px;
    border: 1px solid rgba(139, 156, 228, 0.26);
    background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(230,240,255,0.86) 48%, rgba(237,232,255,0.82));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.66), 0 18px 38px rgba(84, 101, 178, 0.12);
}

.food-recommend-card strong {
    display: block;
    margin: 0.15rem 0 0.35rem;
    font-size: clamp(1.25rem, 2.4vw, 1.8rem);
    line-height: 1.15;
    color: #2d356d;
}

.food-recommend-card small,
.food-recommend-card em {
    display: block;
    color: #6f78a4;
    font-size: 0.9rem;
    line-height: 1.35;
    font-weight: 800;
}

.food-recommend-card em {
    margin-top: 0.7rem;
    font-style: normal;
    color: #5263ad;
}

@media (max-width: 900px) {
    .food-header-stats {
        width: 100%;
        justify-content: flex-start;
    }

    .food-recommend-card,
    .food-total-orb {
        width: 100%;
    }
}

/* Food page calorie summary tidy cards */
.food-page .food-header-card {
    align-items: stretch;
}

.food-page .food-header-copy {
    flex: 1 1 280px;
}

.food-page .calorie-summary-grid {
    flex: 1 1 520px;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    gap: 0.85rem;
    align-items: stretch;
    justify-content: stretch;
}

.food-page .calorie-summary-card {
    min-width: 0;
    padding: 1rem;
    border-radius: 28px;
    border: 1px solid rgba(139, 156, 228, 0.26);
    background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(229,240,255,0.86) 55%, rgba(237,232,255,0.82));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.68), 0 16px 34px rgba(84, 101, 178, 0.11);
}

.food-page .calorie-summary-card strong {
    display: block;
    margin: 0.18rem 0 0.35rem;
    color: var(--ink);
    font-size: clamp(1.55rem, 3vw, 2.35rem);
    line-height: 1;
    letter-spacing: -0.04em;
}

.food-page .calorie-summary-card small {
    display: block;
    color: var(--muted);
    font-weight: 850;
    line-height: 1.25;
}

.food-page .logged-card strong {
    font-size: clamp(2rem, 5vw, 3.4rem);
}

.food-page .remaining-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.94), rgba(224,246,255,0.84) 52%, rgba(232,235,255,0.84));
}

@media (max-width: 1120px) {
    .food-page .calorie-summary-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .food-page .food-header-card {
        display: grid;
        grid-template-columns: 1fr;
    }

    .food-page .calorie-summary-grid {
        width: 100%;
    }
}


/* Swim log */
.swim-header-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.94), rgba(220,240,255,0.9) 45%, rgba(231,232,255,0.86));
}

.swim-summary-grid {
    flex: 1 1 520px;
    display: grid;
    grid-template-columns: repeat(3, minmax(140px, 1fr));
    gap: 0.85rem;
}

.swim-summary-card {
    min-width: 0;
}

.swim-summary-card strong {
    display: block;
    margin: 0.18rem 0 0.35rem;
    color: var(--ink);
    font-size: clamp(1.75rem, 4vw, 3rem);
    line-height: 1;
    letter-spacing: -0.04em;
}

.swim-day-total span,
.swim-entry strong {
    color: #4f64b7;
}

.swim-entry {
    align-items: flex-start;
}

.swim-stars {
    display: inline-block;
    margin-top: 0.2rem;
    color: #6679d5;
    letter-spacing: 0.08em;
}

.swim-form .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.swim-page .food-empty-state span {
    filter: drop-shadow(0 14px 24px rgba(79, 129, 190, 0.18));
}

@media (max-width: 900px) {
    .swim-summary-grid,
    .swim-form .form-grid {
        grid-template-columns: 1fr;
    }
}
