/* ==========================================================================
   CalorieEon page layouts
   ========================================================================== */

/* --------------------------------------------------------------------------
   Shared page pieces
   -------------------------------------------------------------------------- */

.skip-link {
    position: fixed;
    top: 10px;
    left: 50%;
    z-index: 200;
    padding: 10px 16px;
    border-radius: 12px;
    background: var(--ink);
    color: var(--surface);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transform: translate(-50%, -160%);
    transition: transform var(--dur-2) var(--ease);
}

.skip-link:focus {
    transform: translate(-50%, 0);
}

.flash-stack {
    display: grid;
    gap: 7px;
    margin-bottom: 12px;
}

.flash {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--glass);
    color: var(--ink);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.55;
}

.flash .ui-icon {
    width: 16px;
    height: 16px;
    margin-top: 1px;
    --icon-fill: transparent;
}

.flash--success {
    border-color: rgba(111, 158, 127, 0.32);
    background: rgba(221, 235, 225, 0.72);
}

.flash--error,
.flash--warning {
    border-color: rgba(201, 95, 85, 0.3);
    background: rgba(201, 95, 85, 0.08);
    color: #a3463d;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0 10px;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.back-link:hover {
    color: var(--coral-strong);
}

.back-link .ui-icon {
    width: 17px;
    height: 17px;
    --icon-fill: transparent;
}

.form-page {
    display: grid;
    align-content: start;
}

.form-card {
    display: grid;
    gap: 16px;
    margin-top: 4px;
    padding: 16px;
    border-radius: 26px;
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.form-actions .btn {
    flex: 1;
}

/* --------------------------------------------------------------------------
   Home
   -------------------------------------------------------------------------- */

.greeting {
    display: grid;
    gap: 7px;
    padding: 8px 2px 16px;
}

.greeting__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.date-chip {
    padding: 4px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 253, 248, 0.6);
    color: var(--muted);
    font-size: 9.5px;
    font-weight: 700;
    white-space: nowrap;
}

.greeting h1 {
    font-size: clamp(26px, 7.4vw, 31px);
}

.greeting p {
    max-width: 100%;
}

.calorie-card {
    position: relative;
    display: grid;
    gap: 10px;
    overflow: hidden;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 28px;
    background:
        radial-gradient(120% 90% at 92% 0%, rgba(241, 111, 86, 0.09), rgba(241, 111, 86, 0) 55%),
        linear-gradient(165deg, rgba(255, 253, 248, 0.98), rgba(247, 242, 230, 0.92));
    box-shadow: var(--shadow-xs), var(--shadow-md);
}

.calorie-card__leaf {
    position: absolute;
    top: -20px;
    right: -16px;
    width: 116px;
    height: 150px;
    background: url("../img/artwork/decor/decor-leaf-branch.png") center / contain no-repeat;
    opacity: 0.26;
    transform: rotate(12deg);
    pointer-events: none;
}

.calorie-card__head {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.calorie-card__head h2 {
    color: var(--ink);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.calorie-card__head p {
    margin-top: 2px;
    color: var(--muted);
    font-size: 10.5px;
}

.gauge-block {
    position: relative;
    display: grid;
    width: min(236px, 100%);
    margin: 0 auto;
    place-items: center;
}

.gauge {
    width: 100%;
    height: auto;
    overflow: visible;
    transform-origin: center bottom;
    animation: gauge-breathe 5.6s ease-in-out infinite;
}

.gauge-block::before {
    position: absolute;
    top: 20%;
    left: 50%;
    width: 66%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(241, 111, 86, 0.12), transparent 70%);
    content: "";
    opacity: 0.72;
    pointer-events: none;
    transform: translateX(-50%);
    transition: opacity 500ms ease, transform 500ms var(--ease);
}

.gauge-hit {
    position: absolute;
    inset: 5% 3% 1%;
    z-index: 3;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.gauge-hit:focus-visible {
    outline: 2px solid var(--coral);
    outline-offset: 4px;
}

.gauge-reading {
    z-index: 2;
    pointer-events: none;
}

.gauge-tap-hint {
    margin: -6px 0 2px;
    color: var(--muted);
    font-size: 8.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: center;
    animation: hint-float 4.8s ease-in-out infinite;
}

.gauge-detail {
    display: none;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin: 2px 0 1px;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 253, 248, 0.7);
}

.gauge-detail.is-open {
    display: grid;
    animation: detail-in 260ms var(--ease) both;
}

.gauge-detail > div {
    display: grid;
    justify-items: center;
    gap: 1px;
    padding: 5px 3px;
    border-radius: 11px;
    background: rgba(221, 235, 225, 0.34);
}

.gauge-detail span {
    color: var(--muted);
    font-size: 8px;
}

.gauge-detail strong {
    color: var(--ink);
    font-size: 15px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.gauge-detail small {
    color: var(--muted);
    font-size: 7.5px;
}

.calorie-card.is-pulsing .gauge {
    animation: gauge-pulse 760ms var(--ease) both;
}

.calorie-card.is-pulsing .gauge-block::before {
    opacity: 1;
    transform: translateX(-50%) scale(1.08);
}

.calorie-card.is-tapped .gauge {
    animation: gauge-tap 420ms var(--ease) both;
}

.calorie-card.is-complete .gauge-block::before {
    background: radial-gradient(circle, rgba(241, 111, 86, 0.22), transparent 70%);
}

.calorie-card.is-expanded .gauge-block::before {
    opacity: 1;
}

@keyframes gauge-breathe {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-2px) scale(1.006); }
}

@keyframes gauge-pulse {
    0% { transform: scale(1); }
    38% { transform: scale(1.035); }
    100% { transform: scale(1); }
}

@keyframes gauge-tap {
    0% { transform: scale(1); }
    30% { transform: scale(0.985); }
    68% { transform: scale(1.018); }
    100% { transform: scale(1); }
}

@keyframes hint-float {
    0%, 100% { opacity: 0.58; transform: translateY(0); }
    50% { opacity: 0.95; transform: translateY(1px); }
}

@keyframes detail-in {
    from { opacity: 0; transform: translateY(-5px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.gauge {
    width: 100%;
    height: auto;
    overflow: visible;
}

.gauge-track {
    fill: none;
    stroke: rgba(23, 58, 50, 0.075);
    stroke-width: 12;
}

.gauge-ticks {
    fill: none;
    stroke: rgba(23, 58, 50, 0.2);
    stroke-width: 1.5;
    stroke-dasharray: 0.7 4.3;
    stroke-linecap: round;
    opacity: 0.55;
    transform-box: fill-box;
    transform-origin: center;
    animation: ring-ticks 80s linear infinite;
}

.gauge-progress {
    fill: none;
    stroke: url(#calorieRingGradient);
    stroke-width: 12;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    filter: drop-shadow(0 0 5px rgba(241, 111, 86, 0.38));
    transition: stroke-dashoffset 1150ms var(--spring), opacity 220ms ease;
}

.gauge-ring-core {
    fill: rgba(255, 253, 248, 0.3);
    stroke: rgba(255, 255, 255, 0.55);
    stroke-width: 1;
}

.calorie-card.is-complete .gauge-progress {
    stroke: url(#calorieRingGold);
    filter: drop-shadow(0 0 7px rgba(224, 179, 106, 0.5));
}

.gauge--ring {
    transform-origin: center;
}

.gauge-block {
    width: min(248px, 100%);
}

.gauge-block::before {
    top: 10%;
    width: 78%;
}

.gauge-hit {
    inset: 2% 1% 1%;
}

@keyframes ring-ticks {
    to { transform: rotate(360deg); }
}

.gauge-reading {
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    justify-items: center;
    transform: translate(-50%, -48%);
    text-align: center;
}

.gauge-reading strong {
    color: var(--ink);
    font-size: clamp(30px, 9vw, 36px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.05em;
    font-variant-numeric: tabular-nums;
}

.gauge-reading span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
}

.calorie-note {
    color: var(--muted);
    font-size: 10.5px;
    text-align: center;
}

.calorie-note strong {
    color: var(--coral-strong);
    font-size: 12px;
    font-weight: 800;
}

.meal-plan-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.meal-plan-chips .chip {
    min-height: 26px;
    padding: 0 9px;
    font-size: 10px;
}

.meal-list {
    display: flex;
    flex-direction: column;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 26px;
    background: linear-gradient(165deg, rgba(255, 253, 248, 0.97), rgba(250, 246, 236, 0.92));
    box-shadow: var(--shadow-xs), var(--shadow-md);
}

.meal-row {
    display: grid;
    grid-template-columns: 26px 50px minmax(0, 1fr) auto;
    gap: 9px;
    align-items: center;
    padding: 10px 8px;
    border-radius: 20px;
    transition: background-color var(--dur-2) ease;
}

.meal-row:hover {
    background: rgba(221, 235, 225, 0.26);
}

.meal-row + .meal-row {
    border-top: 1px solid rgba(23, 58, 50, 0.07);
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

#breakfast-row,
#lunch-row,
#dinner-row {
    scroll-margin-top: 14px;
}

.task-checkbox {
    display: grid;
    width: 26px;
    height: 26px;
    flex: none;
    padding: 0;
    place-items: center;
    border: 1.5px solid rgba(23, 58, 50, 0.24);
    border-radius: 50%;
    background: rgba(255, 253, 248, 0.65);
    color: var(--surface);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    transition: background-color var(--dur-2) ease, border-color var(--dur-2) ease,
        transform var(--dur-1) var(--ease);
}

.task-checkbox:hover {
    border-color: var(--coral);
}

.task-checkbox.checked {
    border-color: var(--coral);
    background: var(--coral);
    animation: check-pop 360ms var(--ease);
}

.task-checkbox--lg {
    width: 30px;
    height: 30px;
}

.meal-thumb {
    display: grid;
    width: 50px;
    height: 50px;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(23, 58, 50, 0.1);
    border-radius: 16px;
    background: linear-gradient(160deg, #eef4eb, #dceade);
    color: var(--ink-soft);
    background-size: cover;
    background-position: center;
}

.meal-thumb .ui-icon {
    width: 25px;
    height: 25px;
}

.meal-thumb.has-image .ui-icon {
    display: none;
}

.meal-main {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.meal-main__top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
}

.meal-main .task-title {
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.meal-calories-wrap {
    color: var(--muted);
    font-size: 9.5px;
    white-space: nowrap;
}

.meal-calories-wrap .meal-calories {
    color: var(--coral-strong);
    font-size: 12px;
    font-weight: 800;
}

.meal-main .task-desc {
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.meal-dropdown {
    position: relative;
    display: inline-block;
    margin-top: 3px;
}

.meal-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    min-height: 24px;
    padding: 0 7px;
    border: 1px solid rgba(23, 58, 50, 0.1);
    border-radius: 999px;
    background: rgba(221, 235, 225, 0.45);
    color: var(--ink-soft);
    font-size: 9px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: background-color var(--dur-2) ease, color var(--dur-2) ease;
}

.meal-dropdown-toggle:hover,
.meal-dropdown.open .meal-dropdown-toggle {
    background: var(--coral-soft);
    color: var(--coral-strong);
}

.dropdown-label {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.dropdown-label .ui-icon {
    width: 12px;
    height: 12px;
    --icon-fill: transparent;
}

.meal-dropdown-arrow {
    font-size: 9px;
    line-height: 1;
    transition: transform var(--dur-2) var(--ease);
}

.meal-dropdown.open .meal-dropdown-arrow {
    transform: rotate(180deg);
}

.meal-dropdown-content {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 30;
    display: none;
    width: min(240px, calc(100vw - 120px));
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--glass-strong);
    box-shadow: var(--shadow-lg);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    backdrop-filter: blur(20px) saturate(1.2);
}

.meal-dropdown.open .meal-dropdown-content {
    display: block;
    animation: pop-in 240ms var(--ease) both;
}

.meal-dropdown-image {
    width: 100%;
    max-height: 150px;
    border-radius: 12px;
    object-fit: cover;
    cursor: zoom-in;
}

.meal-dropdown-info {
    margin-top: 6px;
    color: var(--muted);
    font-size: 9.5px;
    text-align: center;
}

.meal-dropdown-empty {
    padding: 16px 10px;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.55;
    text-align: center;
}

.meal-analysis-card {
    display: grid;
    gap: 5px;
    margin-top: 8px;
    padding: 10px;
    border: 1px solid rgba(23, 58, 50, 0.1);
    border-radius: 14px;
    background: rgba(221, 235, 225, 0.45);
}

.meal-analysis-title {
    color: var(--ink);
    font-size: 10.5px;
    font-weight: 800;
}

.meal-analysis-range {
    color: var(--coral-strong);
    font-size: 10.5px;
    font-weight: 700;
}

.meal-analysis-foods,
.meal-analysis-note {
    color: var(--muted);
    font-size: 9.5px;
    line-height: 1.55;
}

.meal-analysis-needs_review,
.meal-analysis-failed {
    border-color: rgba(241, 111, 86, 0.28);
    background: rgba(241, 111, 86, 0.07);
}

.meal-analysis-editor {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 6px;
}

.meal-analysis-editor label {
    display: grid;
    gap: 3px;
    color: var(--muted);
    font-size: 9px;
}

.meal-analysis-editor input[type="number"] {
    min-height: 34px;
    padding: 6px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.meal-analysis-confirm {
    min-height: 34px;
    padding: 0 11px;
    border: 0;
    border-radius: 999px;
    background: var(--coral);
    color: var(--surface);
    font-size: 10.5px;
    font-weight: 700;
}

.photo-btn {
    display: inline-flex;
    min-width: 62px;
    min-height: 48px;
    flex: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: 5px 6px;
    border: 1px solid rgba(241, 111, 86, 0.24);
    border-radius: 14px;
    background: rgba(241, 111, 86, 0.09);
    color: var(--coral-strong);
    font-size: 8.5px;
    font-weight: 700;
    line-height: 1.2;
    transition: transform var(--dur-1) var(--ease), background-color var(--dur-2) ease;
}

.photo-btn .ui-icon {
    width: 21px;
    height: 21px;
    --icon-fill: rgba(255, 253, 248, 0.6);
}

.photo-btn:hover {
    background: rgba(241, 111, 86, 0.16);
    transform: translateY(-1px);
}

.photo-btn:active {
    transform: scale(0.95);
}

/* Exercise */
.exercise-panel {
    display: grid;
    gap: 12px;
    margin-top: 16px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 28px;
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(241, 111, 86, 0.1), rgba(241, 111, 86, 0) 50%),
        linear-gradient(160deg, rgba(239, 245, 236, 0.97), rgba(220, 235, 223, 0.8));
    box-shadow: var(--shadow-xs), var(--shadow-md);
}

.exercise-panel__head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.exercise-panel__title {
    flex: 1;
    min-width: 0;
}

.exercise-panel__title h2 {
    color: var(--ink);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.exercise-panel__title p {
    margin-top: 1px;
    color: var(--muted);
    font-size: 10px;
}

.exercise-progress {
    display: grid;
    gap: 6px;
    padding: 11px;
    border: 1px solid rgba(23, 58, 50, 0.08);
    border-radius: 18px;
    background: rgba(255, 253, 248, 0.66);
}

.progress-text {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--ink-soft);
    font-size: 11px;
}

.progress-text strong {
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
}

.progress-text .chip {
    min-height: 22px;
    padding: 0 7px;
    font-size: 9px;
}

.exercise-breakdown {
    color: var(--muted);
    font-size: 9.5px;
}

.exercise-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.exercise-actions .btn {
    min-height: 44px;
    font-size: 12px;
}

.exercise-records {
    display: grid;
    gap: 6px;
}

.exercise-records-title {
    color: var(--muted);
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.exercise-record-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 7px;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid rgba(23, 58, 50, 0.06);
    border-radius: 13px;
    background: rgba(255, 253, 248, 0.7);
    color: var(--ink-soft);
    font-size: 10px;
}

.exercise-type-badge {
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--coral-soft);
    color: var(--coral-strong);
    font-size: 9px;
    font-weight: 800;
}

.exercise-type-badge.type-squat {
    background: var(--sage);
    color: #4f7d5f;
}

.exercise-record-count {
    color: var(--ink);
    font-size: 11px;
    font-weight: 800;
}

.exercise-record-time {
    color: var(--muted);
    font-size: 9px;
}

.exercise-record-empty {
    padding: 13px;
    border-radius: 14px;
    background: rgba(255, 253, 248, 0.55);
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.55;
    text-align: center;
}

/* Coach nudge */
.coach-nudge {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding: 12px;
    border: 1px solid rgba(241, 111, 86, 0.18);
    border-radius: 24px;
    background: rgba(255, 253, 248, 0.72);
    box-shadow: var(--shadow-xs), var(--shadow-sm);
}

.coach-nudge__avatar {
    width: 46px;
    height: 46px;
    flex: none;
    border: 1.5px solid rgba(23, 58, 50, 0.22);
    border-radius: 50%;
    background: #f4dfd2;
    object-fit: cover;
    box-shadow: 0 5px 11px -9px rgba(23, 58, 50, 0.38);
}

.coach-nudge__body {
    flex: 1;
    min-width: 0;
}

.coach-nudge__label {
    color: var(--coral-strong);
    font-size: 8.5px;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.coach-nudge__body p {
    margin-top: 1px;
    color: var(--ink-soft);
    font-size: 10px;
    line-height: 1.55;
}

.coach-nudge .icon-btn {
    width: 36px;
    height: 36px;
    flex: none;
}

/* Camera overlay */
#jj-wrap {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #0c1713;
    color: var(--surface);
}

#jj-video {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    object-fit: contain;
}

#pose-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.camera-layer__top {
    position: absolute;
    top: calc(20px + env(safe-area-inset-top));
    left: 50%;
    display: grid;
    width: min(92%, 420px);
    gap: 8px;
    justify-items: center;
    text-align: center;
    transform: translateX(-50%);
}

.camera-pill {
    padding: 5px 11px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(255, 253, 248, 0.14);
    color: var(--surface);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.handsup-tip {
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    background: rgba(12, 23, 19, 0.55);
    color: var(--surface);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

#jj-count {
    position: absolute;
    top: 34%;
    left: 50%;
    color: var(--surface);
    font-size: clamp(56px, 18vw, 84px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    text-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
    transform: translate(-50%, -50%);
}

.camera-layer__actions {
    position: absolute;
    bottom: calc(28px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    width: min(86%, 360px);
}

.camera-layer__actions .btn {
    width: 100%;
}

.camera-layer__actions .btn-secondary {
    border-color: rgba(255, 255, 255, 0.24);
    background: rgba(255, 253, 248, 0.12);
    color: var(--surface);
    box-shadow: none;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

/* Meal image preview */
.meal-image-modal {
    position: fixed;
    inset: 0;
    z-index: 160;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(12, 23, 19, 0.72);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.meal-image-modal.is-open {
    display: flex;
}

.meal-image-dialog {
    position: relative;
    max-width: min(92vw, 520px);
    max-height: 88dvh;
    animation: pop-in 260ms var(--ease) both;
}

.meal-image-modal-content {
    max-width: 100%;
    max-height: 88dvh;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    object-fit: contain;
    box-shadow: var(--shadow-lg);
}

.meal-image-close {
    position: absolute;
    top: -12px;
    right: -12px;
}

/* --------------------------------------------------------------------------
   AI coach
   -------------------------------------------------------------------------- */

.coach-heading,
.profile-heading {
    display: grid;
    gap: 7px;
    padding: 6px 2px 14px;
}

.coach-heading h1,
.profile-heading h1 {
    color: var(--ink);
    font-size: clamp(25px, 7vw, 30px);
    font-weight: 800;
    letter-spacing: -0.04em;
}

.coach-context {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(95, 133, 105, 0.22);
    border-radius: 17px;
    background: rgba(221, 235, 225, 0.4);
}

.coach-context__icon {
    display: grid;
    width: 32px;
    height: 32px;
    flex: none;
    place-items: center;
    border-radius: 11px;
    background: rgba(255, 253, 248, 0.75);
    color: var(--sage-strong);
}

.coach-context__icon .ui-icon {
    width: 16px;
    height: 16px;
    --icon-fill: transparent;
}

.coach-context__copy {
    display: grid;
    flex: 1;
    gap: 2px;
    min-width: 0;
}

.coach-context__copy strong {
    color: var(--ink);
    font-size: 10.5px;
    font-weight: 800;
}

.coach-context__copy p {
    color: var(--muted);
    font-size: 8.5px;
    line-height: 1.5;
}

.coach-context .btn {
    flex: none;
    min-height: 30px;
    padding: 0 9px;
    font-size: 9px;
}

.style-switch {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
    padding: 14px;
    border-radius: 24px;
}

.style-switch__copy {
    display: grid;
    gap: 1px;
}

.style-switch__label {
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
}

.style-switch__copy p {
    color: var(--muted);
    font-size: 10px;
}

.agent-switcher {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    padding: 4px;
    border: 1px solid rgba(23, 58, 50, 0.08);
    border-radius: 16px;
    background: rgba(221, 235, 225, 0.5);
}

.agent-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 42px;
    border-radius: 12px;
    color: var(--ink-soft);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: background-color var(--dur-2) ease, color var(--dur-2) ease,
        box-shadow var(--dur-2) ease, transform var(--dur-1) var(--ease);
}

.agent-option .ui-icon {
    width: 19px;
    height: 19px;
    --icon-fill: transparent;
}

.agent-option:hover {
    color: var(--ink);
}

.agent-option:active {
    transform: scale(0.98);
}

.agent-option.active {
    background: linear-gradient(180deg, #f4785f, #ec6349);
    color: var(--surface);
    box-shadow: 0 8px 16px -10px rgba(217, 87, 63, 0.85);
}

.agent-option.active .ui-icon {
    --icon-fill: rgba(255, 255, 255, 0.24);
    --icon-accent: #fffdf8;
}

.coach-chat {
    display: grid;
    padding: 14px;
    border-radius: 28px;
}

.ai-coach-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 11px;
    border-bottom: 1px dashed rgba(23, 58, 50, 0.13);
}

.ai-avatar {
    display: grid;
    width: 54px;
    height: 54px;
    flex: none;
    place-items: center;
    border: 1.5px solid rgba(23, 58, 50, 0.14);
    border-radius: 50%;
    background: linear-gradient(160deg, #eef4eb, #d7e8db);
    color: var(--ink);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.6);
}

.ai-avatar .ui-icon {
    width: 27px;
    height: 27px;
}

.ai-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.ai-info {
    flex: 1;
    min-width: 0;
}

.ai-name {
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 800;
}

.ai-title {
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-online {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: none;
    color: #4f7d5f;
    font-size: 9px;
    font-weight: 700;
}

.ai-online__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6f9e7f;
    box-shadow: 0 0 0 3px rgba(111, 158, 127, 0.16);
}

.chat-container {
    display: flex;
    flex-direction: column;
    gap: 9px;
    min-height: 132px;
    max-height: 40vh;
    padding: 13px 2px 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(23, 58, 50, 0.2) transparent;
}

.chat-container::-webkit-scrollbar {
    width: 4px;
}

.chat-container::-webkit-scrollbar-thumb {
    border-radius: 99px;
    background: rgba(23, 58, 50, 0.18);
}

.message {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 17px;
    font-size: 12px;
    line-height: 1.65;
    animation: rise-in 300ms var(--ease) both;
    overflow-wrap: anywhere;
}

.message.ai {
    align-self: flex-start;
    border: 1px solid rgba(23, 58, 50, 0.08);
    border-bottom-left-radius: 6px;
    background: rgba(221, 235, 225, 0.62);
    color: var(--ink);
}

.message.user {
    align-self: flex-end;
    border-bottom-right-radius: 6px;
    background: linear-gradient(160deg, #f4785f, #ec6349);
    color: var(--surface);
    box-shadow: 0 8px 16px -12px rgba(217, 87, 63, 0.85);
}

.message-time {
    margin-top: 4px;
    font-size: 8.5px;
    opacity: 0.6;
    text-align: right;
}

.message.ai .message-time {
    text-align: left;
}

.typing-indicator {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 3px 1px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--coral);
    animation: typing-bounce 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

.quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 2px 0 8px;
}

.quick-question {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 34px;
    padding: 0 11px;
    border: 1.5px solid var(--line-strong);
    border-radius: 999px;
    background: rgba(255, 253, 248, 0.82);
    color: var(--ink);
    font-size: 10.5px;
    font-weight: 700;
    transition: transform var(--dur-1) var(--ease), background-color var(--dur-2) ease,
        border-color var(--dur-2) ease;
}

.quick-question .ui-icon {
    width: 15px;
    height: 15px;
    color: var(--coral-strong);
    --icon-fill: transparent;
}

.quick-question:hover {
    border-color: rgba(241, 111, 86, 0.4);
    background: var(--coral-soft);
    transform: translateY(-1px);
}

.quick-question:active {
    transform: scale(0.97);
}

.coach-scene {
    display: grid;
    margin: -2px -2px 8px;
    overflow: hidden;
    place-items: center;
    pointer-events: none;
}

.coach-scene img {
    width: auto;
    max-width: 100%;
    max-height: 140px;
    height: auto;
}

.chat-input-container {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 5px 5px 12px;
    border: 1.5px solid var(--line-strong);
    border-radius: 999px;
    background: rgba(255, 253, 248, 0.88);
    transition: border-color var(--dur-2) ease, box-shadow var(--dur-2) ease;
}

.chat-input-container:focus-within {
    border-color: var(--coral);
    box-shadow: 0 0 0 4px rgba(241, 111, 86, 0.12);
}

.chat-input-wrap {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.chat-input-wrap > .ui-icon {
    width: 18px;
    height: 18px;
    flex: none;
    color: var(--coral-strong);
    --icon-fill: transparent;
}

.chat-input-wrap .chat-input[type="text"] {
    width: 100%;
    min-height: 38px;
    padding: 7px 0;
    border: 0;
    border-radius: 0;
    outline: 0;
    background: transparent;
    box-shadow: none;
    color: var(--ink);
    font-size: 12.5px;
}

.chat-input-wrap .chat-input[type="text"]:focus {
    border: 0;
    background: transparent;
    box-shadow: none;
}

.send-btn {
    display: grid;
    width: 42px;
    height: 42px;
    flex: none;
    padding: 0;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 50%;
    background: linear-gradient(180deg, #f4785f, #ec6349);
    color: var(--surface);
    box-shadow: 0 10px 18px -10px rgba(217, 87, 63, 0.85);
    transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-2) ease;
}

.send-btn .ui-icon {
    width: 19px;
    height: 19px;
    --icon-fill: rgba(255, 255, 255, 0.16);
    --icon-accent: #fffdf8;
}

.send-btn:hover {
    transform: translateY(-1px);
}

.send-btn:active {
    transform: scale(0.94);
}

/* Keep the chat composer reachable on short phones. */
@media (max-height: 880px) {
    .coach-scene {
        display: none;
    }

    .style-switch {
        margin-bottom: 10px;
        padding: 12px;
    }

    .chat-container {
        min-height: 116px;
    }
}

/* --------------------------------------------------------------------------
   Groups
   -------------------------------------------------------------------------- */

.challenge-card {
    position: relative;
    display: grid;
    gap: 11px;
    overflow: hidden;
    padding: 16px;
    border: 1px solid rgba(241, 111, 86, 0.2);
    border-radius: 28px;
    background:
        radial-gradient(110% 90% at 100% 0%, rgba(241, 111, 86, 0.14), rgba(241, 111, 86, 0) 55%),
        linear-gradient(160deg, #fff8f3, #fbe7de);
    box-shadow: var(--shadow-xs), var(--shadow-md);
}

.challenge-card__leaf {
    position: absolute;
    top: -22px;
    right: -18px;
    width: 128px;
    height: 164px;
    background: url("../img/artwork/decor/decor-leaf-branch.png") center / contain no-repeat;
    opacity: 0.22;
    transform: rotate(10deg);
    pointer-events: none;
}

.challenge-card__top {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.challenge-card__copy {
    flex: 1;
    min-width: 0;
}

.challenge-card__kicker {
    color: var(--coral-strong);
    font-size: 8.5px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.challenge-card__copy h2 {
    margin-top: 1px;
    color: var(--ink);
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.challenge-card__copy p {
    margin-top: 2px;
    color: var(--ink-soft);
    font-size: 10.5px;
    line-height: 1.55;
}

.challenge-card__meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    color: var(--ink-soft);
    font-size: 10.5px;
}

.challenge-card__meta strong {
    color: var(--coral-strong);
    font-size: 14px;
    font-weight: 800;
}

.challenge-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 1px;
}

.challenge-card__foot .chip {
    min-height: 26px;
    font-size: 9.5px;
}

.challenge-card--empty {
    justify-items: start;
    text-align: left;
}

.challenge-card--empty h2 {
    color: var(--ink);
    font-size: 17px;
}

.challenge-card--empty p {
    color: var(--ink-soft);
    font-size: 11px;
    line-height: 1.6;
}

.group-list {
    display: grid;
    gap: 11px;
}

.group-card {
    display: grid;
    gap: 12px;
    padding: 15px;
    border-radius: 26px;
}

.group-card__head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.group-avatar {
    display: grid;
    width: 50px;
    height: 50px;
    flex: none;
    place-items: center;
    border: 1px solid rgba(23, 58, 50, 0.14);
    border-radius: 17px;
    background: linear-gradient(160deg, #eef4eb, #d3e6da);
    color: var(--ink);
    font-size: 18px;
    font-weight: 800;
}

.group-info {
    display: grid;
    flex: 1;
    gap: 2px;
    min-width: 0;
}

.group-name {
    color: var(--ink);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.group-desc {
    display: -webkit-box;
    overflow: hidden;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.creator-badge {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    min-height: 20px;
    margin-top: 2px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--coral-soft);
    color: var(--coral-strong);
    font-size: 8.5px;
    font-weight: 800;
}

.group-card .chip {
    flex: none;
    min-height: 24px;
    font-size: 9px;
}

.group-progress {
    display: grid;
    gap: 5px;
    padding: 10px 11px;
    border-radius: 15px;
    background: rgba(221, 235, 225, 0.42);
}

.group-progress__text {
    display: flex;
    justify-content: space-between;
    color: var(--ink-soft);
    font-size: 10px;
}

.group-progress__text strong {
    color: var(--coral-strong);
    font-size: 11px;
    font-weight: 800;
}

.members-checkin h4 {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.checkin-list {
    display: grid;
    gap: 5px;
}

.checkin-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 13px;
    background: rgba(255, 253, 248, 0.56);
}

.member-avatar {
    display: grid;
    width: 30px;
    height: 30px;
    flex: none;
    place-items: center;
    border-radius: 50%;
    background: var(--sage);
    color: var(--ink);
    font-size: 11px;
    font-weight: 800;
}

.member-info {
    display: grid;
    gap: 0;
    min-width: 0;
}

.member-name {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--ink);
    font-size: 10.5px;
    font-weight: 700;
}

.member-name .creator-badge {
    margin-top: 0;
    min-height: 17px;
    font-size: 7.5px;
}

.checkin-item {
    align-items: flex-start;
}

.member-info {
    flex: 1;
    gap: 3px;
}

.member-name {
    flex-wrap: wrap;
}

.member-state {
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 7.5px;
    font-weight: 800;
    line-height: 1.3;
}

.member-state--complete {
    background: rgba(95, 133, 105, 0.14);
    color: #4f7d5f;
}

.member-state--partial {
    background: rgba(241, 111, 86, 0.12);
    color: var(--coral-strong);
}

.member-state--empty {
    background: rgba(23, 58, 50, 0.07);
    color: var(--muted);
}

.checkin-details {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.meal-status {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 3px;
}

.meal-chip,
.exercise-chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-height: 19px;
    padding: 2px 5px;
    border-radius: 7px;
    font-size: 8px;
    font-weight: 700;
    line-height: 1.2;
}

.meal-chip .ui-icon,
.exercise-chip .ui-icon {
    width: 10px;
    height: 10px;
    --icon-fill: transparent;
}

.meal-chip.is-done {
    background: rgba(95, 133, 105, 0.13);
    color: #4f7d5f;
}

.meal-chip.is-missing {
    background: rgba(23, 58, 50, 0.06);
    color: var(--muted-soft);
}

.exercise-chip {
    background: rgba(221, 235, 225, 0.5);
    color: var(--ink-soft);
}

.exercise-chip.is-done {
    background: rgba(95, 133, 105, 0.13);
    color: #4f7d5f;
}

.exercise-chip.is-partial {
    background: rgba(241, 111, 86, 0.1);
    color: var(--coral-strong);
}

.exercise-chip.is-missing {
    background: rgba(23, 58, 50, 0.06);
    color: var(--muted);
}

.checkin-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 1px;
}

.checkin-hint {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    border-radius: 7px;
    font-size: 8px;
    font-weight: 700;
    line-height: 1.3;
}

.checkin-hint .ui-icon {
    width: 10px;
    height: 10px;
    --icon-fill: transparent;
}

.checkin-hint.is-warning {
    background: rgba(241, 111, 86, 0.09);
    color: var(--coral-strong);
}

.checkin-hint.is-complete {
    background: rgba(95, 133, 105, 0.12);
    color: #4f7d5f;
}

.checkin-status {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--muted);
    font-size: 9px;
}

.checkin-status .ui-icon {
    width: 12px;
    height: 12px;
    --icon-fill: transparent;
}

.checkin-status.checked {
    color: #4f7d5f;
}

.checkin-status small {
    color: var(--muted);
    font-size: 8.5px;
}

.discover-list {
    display: grid;
    gap: 8px;
}

.discover-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 253, 248, 0.76);
    color: var(--ink);
    text-decoration: none;
    box-shadow: var(--shadow-xs);
    transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) ease;
}

.discover-row:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.discover-row__copy {
    display: grid;
    flex: 1;
    gap: 1px;
    min-width: 0;
}

.discover-row__copy strong {
    font-size: 12.5px;
    font-weight: 800;
}

.discover-row__copy small {
    color: var(--muted);
    font-size: 9.5px;
    line-height: 1.45;
}

.discover-row__arrow {
    width: 17px;
    height: 17px;
    flex: none;
    color: var(--muted);
    --icon-fill: transparent;
}

/* --------------------------------------------------------------------------
   Community
   -------------------------------------------------------------------------- */

.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 5px 5px 13px;
    border: 1.5px solid var(--line-strong);
    border-radius: 999px;
    background: rgba(255, 253, 248, 0.86);
    box-shadow: var(--shadow-xs);
    transition: border-color var(--dur-2) ease, box-shadow var(--dur-2) ease;
}

.search-bar:focus-within {
    border-color: var(--coral);
    box-shadow: 0 0 0 4px rgba(241, 111, 86, 0.12);
}

.search-bar > .ui-icon {
    width: 18px;
    height: 18px;
    flex: none;
    color: var(--muted);
    --icon-fill: transparent;
}

.search-bar input[type="search"] {
    flex: 1;
    min-width: 0;
    min-height: 36px;
    padding: 8px 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 12px;
    box-shadow: none;
}

.search-bar input[type="search"]:focus {
    border: 0;
    background: transparent;
    box-shadow: none;
}

.search-bar button {
    display: grid;
    width: 36px;
    height: 36px;
    flex: none;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--coral);
    color: var(--surface);
    transition: transform var(--dur-1) var(--ease);
}

.search-bar button .ui-icon {
    width: 17px;
    height: 17px;
    --icon-fill: transparent;
}

.search-bar button:active {
    transform: scale(0.94);
}

.feed-tabs {
    position: relative;
    display: flex;
    gap: 2px;
    margin: 14px 0 12px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 253, 248, 0.62);
}

.tab-indicator {
    position: absolute;
    top: 4px;
    left: 0;
    z-index: 0;
    height: calc(100% - 8px);
    border-radius: 999px;
    background: #f47a60;
    box-shadow: 0 8px 16px -12px rgba(217, 87, 63, 0.9);
    transition: transform 320ms var(--ease), width 320ms var(--ease);
}

.feed-tabs .tab {
    position: relative;
    z-index: 1;
    flex: 1;
    min-height: 36px;
    border: 0;
    background: transparent;
    color: var(--ink-soft);
    font-size: 11.5px;
    font-weight: 700;
    transition: color var(--dur-2) ease;
}

.feed-tabs .tab.active {
    color: var(--ink);
    font-weight: 800;
}

.feed-list {
    display: grid;
    gap: 11px;
    padding-bottom: 62px;
}

.post-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: linear-gradient(165deg, rgba(255, 253, 248, 0.97), rgba(250, 246, 236, 0.92));
    box-shadow: var(--shadow-xs), var(--shadow-md);
    cursor: pointer;
    transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) ease;
    animation: rise-in 420ms var(--ease) both;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm), var(--shadow-md);
}

.post-card:focus-visible {
    outline-offset: 3px;
}

.post-card__head {
    display: flex;
    align-items: center;
    gap: 9px;
}

.post-avatar {
    display: grid;
    width: 38px;
    height: 38px;
    flex: none;
    place-items: center;
    border: 1px solid rgba(23, 58, 50, 0.08);
    border-radius: 50%;
    background: linear-gradient(160deg, #f7d9c7, #eeb99f);
    color: #4a3a30;
    font-size: 14px;
    font-weight: 800;
}

.post-card__meta {
    display: grid;
    flex: 1;
    gap: 0;
    min-width: 0;
}

.post-author {
    overflow: hidden;
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-time {
    color: var(--muted);
    font-size: 9px;
}

.post-more {
    display: grid;
    width: 30px;
    height: 30px;
    flex: none;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
}

.post-more:hover {
    background: rgba(23, 58, 50, 0.06);
    color: var(--ink);
}

.post-more .ui-icon {
    width: 18px;
    height: 18px;
    --icon-fill: transparent;
}

.post-card .post-title {
    margin: 9px 0 4px;
    color: var(--ink);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: -0.02em;
}

.post-excerpt {
    display: -webkit-box;
    overflow: hidden;
    color: var(--ink-soft);
    font-size: 11px;
    line-height: 1.65;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.post-media {
    margin-top: 9px;
    overflow: hidden;
    border: 1px solid rgba(23, 58, 50, 0.08);
    border-radius: 16px;
    background: var(--sage);
}

.post-media img {
    width: 100%;
    max-height: 190px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px dashed rgba(23, 58, 50, 0.1);
    color: var(--muted);
    font-size: 9.5px;
}

.post-meta__item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.post-meta__item .ui-icon {
    width: 14px;
    height: 14px;
    --icon-fill: transparent;
}

.post-meta__spacer {
    flex: 1;
}

.post-meta__item--accent {
    color: var(--coral-strong);
    font-weight: 800;
}

/* Text + image gallery (WeChat Moments style) */
.post-gallery {
    display: grid;
    gap: 5px;
    margin-top: 10px;
}

.post-gallery--1 {
    max-width: 240px;
    grid-template-columns: minmax(0, 1fr);
}

.post-gallery--2 {
    max-width: 250px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.post-gallery__item {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    border: 1px solid rgba(23, 58, 50, 0.08);
    border-radius: 12px;
    background: var(--sage);
}

.post-gallery--1 .post-gallery__item {
    aspect-ratio: 16 / 10;
}

.post-gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--dur-2) var(--ease);
}

.post-gallery__item:hover img {
    transform: scale(1.03);
}

.post-gallery__more {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(23, 58, 50, 0.48);
    color: var(--surface);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.post-gallery--detail {
    gap: 7px;
    margin-top: 14px;
}

.post-gallery--detail.post-gallery--1 {
    max-width: 100%;
}

.post-gallery--detail .post-gallery__item {
    border-radius: 16px;
}

.post-gallery--detail.post-gallery--1 .post-gallery__item {
    max-height: 360px;
    aspect-ratio: 16 / 10;
}

/* Simple multi-image editor */
.post-image-field {
    display: grid;
    gap: 8px;
}

.post-image-field__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.post-image-field__head .chip {
    min-height: 23px;
    font-size: 9px;
}

.image-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 13px;
    border: 1.5px dashed var(--line-strong);
    border-radius: 16px;
    background: rgba(255, 253, 248, 0.55);
    color: var(--ink-soft);
    cursor: pointer;
    transition: background-color var(--dur-2) ease, border-color var(--dur-2) ease,
        color var(--dur-2) ease;
}

.image-picker:hover {
    border-color: var(--coral);
    background: var(--coral-soft);
    color: var(--coral-strong);
}

.image-picker .ui-icon {
    width: 19px;
    height: 19px;
    --icon-fill: transparent;
}

.image-picker > span {
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
}

.image-picker:hover > span {
    color: var(--coral-strong);
}

.image-picker small {
    margin-left: auto;
    color: var(--muted);
    font-size: 9px;
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.image-preview-grid:empty {
    display: none;
}

.image-preview {
    position: relative;
    aspect-ratio: 1 / 1;
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--sage);
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview__remove {
    position: absolute;
    top: 4px;
    right: 4px;
    display: grid;
    width: 24px;
    height: 24px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(23, 58, 50, 0.62);
    color: var(--surface);
    cursor: pointer;
}

.image-preview__remove .ui-icon {
    width: 12px;
    height: 12px;
    --icon-fill: transparent;
}

.post-create textarea {
    min-height: 168px;
}

.compose-fab {
    position: fixed;
    right: 18px;
    bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom));
    z-index: 70;
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: linear-gradient(180deg, #f4785f, #ec6349);
    color: var(--surface);
    box-shadow: 0 14px 28px -12px rgba(217, 87, 63, 0.85);
    transition: transform var(--dur-1) var(--ease);
}

.compose-fab .ui-icon {
    width: 22px;
    height: 22px;
    --icon-fill: transparent;
}

.compose-fab:hover {
    transform: translateY(-2px);
}

.compose-fab:active {
    transform: scale(0.94);
}

/* Detail */
.detail-page {
    display: grid;
    gap: 11px;
}

.detail-card {
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 26px;
    background: linear-gradient(165deg, rgba(255, 253, 248, 0.97), rgba(250, 246, 236, 0.92));
    box-shadow: var(--shadow-xs), var(--shadow-md);
}

.post-kicker {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 13px 0 5px;
    color: var(--coral-strong);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.post-kicker .ui-icon {
    width: 13px;
    height: 13px;
    --icon-fill: transparent;
}

.detail-card .post-title {
    margin: 3px 0 10px;
    color: var(--ink);
    font-size: clamp(22px, 6vw, 26px);
    font-weight: 800;
    line-height: 1.28;
    letter-spacing: -0.035em;
}

.post-content {
    overflow-wrap: anywhere;
    color: var(--ink-soft);
    font-size: 12.5px;
    line-height: 1.8;
}

.post-content p {
    margin: 0 0 8px;
}

.post-content img {
    width: auto;
    max-width: 100%;
    max-height: 340px;
    height: auto;
    margin: 9px auto;
    border-radius: 16px;
}

.post-content h1,
.post-content h2,
.post-content h3 {
    margin: 14px 0 6px;
    color: var(--ink);
    font-size: 15px;
}

.post-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 14px;
    padding-top: 11px;
    border-top: 1px dashed rgba(23, 58, 50, 0.12);
}

.action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 37px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 253, 248, 0.7);
    color: var(--ink-soft);
    font-size: 10.5px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--dur-2) ease, border-color var(--dur-2) ease,
        transform var(--dur-1) var(--ease);
}

.action .ui-icon {
    width: 15px;
    height: 15px;
    --icon-fill: transparent;
}

.action:hover {
    background: var(--surface);
    border-color: var(--line-strong);
}

.action:active {
    transform: scale(0.97);
}

.action.is-liked {
    border-color: rgba(241, 111, 86, 0.3);
    background: var(--coral-soft);
    color: var(--coral-strong);
}

.comments-card,
.comment-post-card {
    display: grid;
    gap: 9px;
    padding: 15px;
    border-radius: 24px;
}

.comments-head {
    display: flex;
    align-items: center;
    gap: 7px;
}

.comments-head h2,
.comment-post-card h2 {
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
}

.comments-head .chip {
    min-height: 21px;
    padding: 0 7px;
    font-size: 9px;
}

.comment {
    display: flex;
    gap: 8px;
    padding: 10px 0;
    border-top: 1px solid rgba(23, 58, 50, 0.07);
}

.comment:first-of-type {
    border-top: 0;
}

.comment-avatar {
    display: grid;
    width: 34px;
    height: 34px;
    flex: none;
    place-items: center;
    border-radius: 50%;
    background: var(--sage);
    color: var(--ink);
    font-size: 11px;
    font-weight: 800;
}

.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-author {
    color: var(--ink);
    font-size: 10.5px;
    font-weight: 800;
}

.comment-time {
    margin-left: 5px;
    color: var(--muted);
    font-size: 8.5px;
    font-weight: 500;
}

.comment-content {
    margin-top: 2px;
    overflow-wrap: anywhere;
    color: var(--ink-soft);
    font-size: 11px;
    line-height: 1.65;
}

.empty-comments {
    display: grid;
    justify-items: center;
    gap: 5px;
    padding: 16px;
    color: var(--muted);
    font-size: 10.5px;
    text-align: center;
}

.empty-comments .ui-icon {
    width: 24px;
    height: 24px;
    opacity: 0.6;
    --icon-fill: transparent;
}

.comment-post-card textarea {
    min-height: 96px;
    font-size: 12.5px;
}

.comment-post-card .btn {
    margin-top: 2px;
}

.login-tip {
    padding: 18px;
    color: var(--muted);
    font-size: 11.5px;
    text-align: center;
}

/* Community editor */
#editor-container {
    min-height: 260px;
    overflow: hidden;
    border: 1.5px solid var(--line-strong);
    border-radius: 16px;
    background: var(--surface);
}

#editor-container iframe {
    max-width: 100%;
}

#editor-container .tox-tinymce {
    border: 0 !important;
    border-radius: 16px !important;
}

.loading {
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: var(--surface);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.success-message {
    position: fixed;
    top: 18px;
    left: 50%;
    z-index: 120;
    display: none;
    padding: 10px 16px;
    border: 1px solid rgba(111, 158, 127, 0.32);
    border-radius: 14px;
    background: var(--glass-strong);
    color: var(--ink);
    font-size: 11px;
    font-weight: 700;
    box-shadow: var(--shadow-md);
    transform: translateX(-50%);
}

.success-message.show {
    display: block;
    animation: rise-in 260ms var(--ease) both;
}

/* --------------------------------------------------------------------------
   Profile
   -------------------------------------------------------------------------- */

.profile-hero {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px;
    border-radius: 26px;
    background: linear-gradient(160deg, rgba(255, 253, 248, 0.97), rgba(243, 238, 225, 0.92));
}

.profile-hero__avatar {
    width: 64px;
    height: 64px;
    flex: none;
    border: 2px solid var(--surface);
    border-radius: 50%;
    background: var(--sage);
    box-shadow: 0 6px 14px -8px rgba(23, 58, 50, 0.4);
}

.profile-hero__body {
    display: grid;
    flex: 1;
    gap: 3px;
    min-width: 0;
}

.profile-hero__name-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.profile-hero__name-row h2 {
    color: var(--ink);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.profile-hero__name-row .chip {
    min-height: 24px;
    font-size: 9px;
}

.profile-hero__body p {
    overflow: hidden;
    color: var(--muted);
    font-size: 9.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-hero .icon-btn {
    width: 34px;
    height: 34px;
    flex: none;
}

.chart-card {
    display: grid;
    gap: 10px;
    margin-top: 11px;
    padding: 15px;
    border-radius: 26px;
}

.chart-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.chart-card__head h2 {
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
}

.chart-card__head p {
    margin-top: 1px;
    color: var(--muted);
    font-size: 9px;
}

.chart-card__head .chip {
    min-height: 24px;
    font-size: 8.5px;
}

.chart {
    display: grid;
    gap: 4px;
}

.chart__plot {
    position: relative;
    height: 138px;
    padding-top: 14px;
}

.chart__goal {
    position: absolute;
    right: 0;
    left: 0;
    z-index: 0;
    border-top: 1.5px dashed rgba(241, 111, 86, 0.42);
    pointer-events: none;
}

.chart__goal span {
    position: absolute;
    top: -9px;
    right: 0;
    padding: 0 3px;
    background: #fbf7ee;
    color: var(--coral-strong);
    font-size: 7.5px;
    font-weight: 700;
}

.chart__bars {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    height: 100%;
    align-items: end;
}

.bar-col {
    position: relative;
    display: flex;
    height: 100%;
    align-items: flex-end;
}

.bar-fill {
    width: 100%;
    min-height: 3px;
    border-radius: 8px 8px 4px 4px;
    background: linear-gradient(180deg, #f68f6f, #ef6a4d);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.bar-col:nth-child(even) .bar-fill {
    opacity: 0.86;
}

.bar-col.is-today .bar-fill {
    background: linear-gradient(180deg, #f16f56, #d9573f);
    box-shadow: 0 6px 12px -6px rgba(217, 87, 63, 0.65);
}

.bar-col.is-empty .bar-fill {
    background: rgba(23, 58, 50, 0.08);
    box-shadow: none;
}

.bar-value {
    position: absolute;
    left: 50%;
    color: var(--ink-soft);
    font-size: 7.5px;
    font-weight: 800;
    white-space: nowrap;
    transform: translateX(-50%);
}

.chart__empty {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    display: grid;
    gap: 2px;
    justify-items: center;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(255, 253, 248, 0.9);
    color: var(--muted);
    font-size: 9px;
    text-align: center;
    transform: translate(-50%, -50%);
}

.chart__empty strong {
    color: var(--ink);
    font-size: 10px;
    font-weight: 800;
}

.chart__empty a {
    color: var(--coral-strong);
    font-size: 9px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.chart__labels {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    color: var(--muted);
    font-size: 8.5px;
    text-align: center;
}

.chart__labels .is-today {
    color: var(--coral-strong);
    font-weight: 800;
}

.chart-card__foot {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px dashed rgba(23, 58, 50, 0.1);
    color: var(--muted);
    font-size: 9px;
}

.chart-card__foot strong {
    color: var(--ink);
    font-size: 10.5px;
    font-weight: 800;
}

.stat-chips {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 10px;
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: rgba(255, 253, 248, 0.78);
    box-shadow: var(--shadow-xs);
}

.stat-chip .icon-tile {
    width: 30px;
    height: 30px;
    border-radius: 10px;
}

.stat-chip .icon-tile .ui-icon {
    width: 16px;
    height: 16px;
}

.stat-chip > span:last-child {
    display: grid;
    gap: 0;
    min-width: 0;
}

.stat-chip strong {
    color: var(--ink);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.stat-chip small {
    color: var(--muted);
    font-size: 8px;
    white-space: nowrap;
}

.history-list {
    display: grid;
    gap: 2px;
    padding: 5px;
    border-radius: 23px;
}

.history-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 17px;
    color: var(--ink);
    text-decoration: none;
    transition: background-color var(--dur-2) ease;
}

.history-row:hover {
    background: rgba(221, 235, 225, 0.35);
}

.history-thumb {
    display: grid;
    width: 42px;
    height: 42px;
    flex: none;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(23, 58, 50, 0.08);
    border-radius: 12px;
    background: var(--sage);
    color: var(--ink-soft);
}

.history-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-thumb .ui-icon {
    width: 21px;
    height: 21px;
}

.history-main {
    display: grid;
    flex: 1;
    gap: 1px;
    min-width: 0;
}

.history-main strong {
    overflow: hidden;
    font-size: 11px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-main small {
    color: var(--muted);
    font-size: 8.5px;
}

.history-row .chip {
    min-height: 22px;
    padding: 0 7px;
    font-size: 8px;
}

.history-chevron {
    width: 14px;
    height: 14px;
    flex: none;
    color: var(--muted);
    --icon-fill: transparent;
}

.section-head__link {
    color: var(--coral-strong);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.01em;
}

/* Past meal history */
.meal-history {
    display: grid;
    gap: 10px;
}

.history-day {
    display: grid;
    gap: 3px;
    padding: 12px;
    border-radius: 22px;
}

.history-day__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 1px 2px 6px;
    border-bottom: 1px dashed var(--line);
}

.history-day__head div {
    display: flex;
    align-items: baseline;
    gap: 7px;
}

.history-day__head strong {
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
}

.history-day__head span {
    color: var(--muted);
    font-size: 8.5px;
}

.history-day__head .chip {
    min-height: 22px;
    padding: 0 7px;
    font-size: 8px;
}

.history-meal {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 2px;
}

.history-meal + .history-meal {
    border-top: 1px solid rgba(23, 58, 50, 0.06);
}

.history-meal__main {
    display: grid;
    flex: 1;
    gap: 1px;
    min-width: 0;
}

.history-meal__main strong {
    color: var(--ink);
    font-size: 11px;
    font-weight: 800;
}

.history-meal__main small {
    overflow: hidden;
    color: var(--muted);
    font-size: 8.5px;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-meal__calories {
    display: grid;
    justify-items: end;
    flex: none;
    color: var(--ink);
    font-size: 11px;
    font-weight: 800;
}

.history-meal__calories small {
    color: var(--muted);
    font-size: 7.5px;
    font-weight: 600;
}

.history-meal__status {
    flex: none;
    min-height: 21px;
    padding: 0 6px;
    font-size: 7.5px;
}

@media (max-width: 370px) {
    .history-meal__status {
        display: none;
    }
}

.content-card {
    display: grid;
    gap: 9px;
    margin-top: 12px;
    padding: 15px;
    border-radius: 26px;
}

.content-card__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.content-card__head h2 {
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
}

.content-tabs {
    position: relative;
    display: flex;
    padding: 4px;
    border: 1px solid rgba(23, 58, 50, 0.08);
    border-radius: 999px;
    background: rgba(221, 235, 225, 0.45);
}

.content-tab {
    position: relative;
    z-index: 1;
    flex: 1;
    min-height: 34px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 700;
    transition: color var(--dur-2) ease;
}

.content-tab.active {
    color: var(--ink);
    font-weight: 800;
}

.posts-list {
    display: grid;
}

.post-item {
    display: grid;
    gap: 2px;
    padding: 10px 2px;
    border-bottom: 1px dashed rgba(23, 58, 50, 0.1);
    color: var(--ink);
    text-decoration: none;
}

.post-item:last-child {
    border-bottom: 0;
}

.post-item:hover .post-title {
    color: var(--coral-strong);
}

.post-item .post-title {
    margin: 0;
    font-size: 12.5px;
    font-weight: 800;
    line-height: 1.4;
}

.post-item .post-content {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.6;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.post-item__meta {
    display: flex;
    align-items: center;
    gap: 2px;
    color: var(--muted);
    font-size: 8.5px;
}

.post-item__meta .ui-icon {
    width: 12px;
    height: 12px;
    --icon-fill: transparent;
}

/* --------------------------------------------------------------------------
   Basic health profile and AI advice
   -------------------------------------------------------------------------- */
.form-row,
.field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.basic-info-block {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(221, 235, 225, 0.26);
}

.basic-info-block__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 3px 8px;
}

.basic-info-block__head small {
    color: var(--muted);
    font-size: 8.5px;
    line-height: 1.4;
}

.field-stack {
    display: grid;
    gap: 4px;
}

.field-label {
    padding-left: 3px;
    color: var(--ink-soft);
    font-size: 10px;
    font-weight: 800;
}

.field-label .req {
    color: var(--coral-strong);
}

.field .field-label {
    flex: none;
}

.field select {
    flex: 1;
    min-width: 0;
    padding: 15px 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 15px;
}

.field.error {
    border-color: var(--coral);
}

.field-error {
    padding-left: 4px;
    color: var(--coral-strong);
    font-size: 9px;
    line-height: 1.45;
}

.field-error--standalone {
    display: block;
    margin-top: -5px;
    padding-left: 4px;
}

.form-success {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1px solid rgba(95, 133, 105, 0.3);
    border-radius: 14px;
    background: rgba(221, 235, 225, 0.6);
    color: var(--ink-soft);
    font-size: 10px;
    font-weight: 700;
}

.form-success .ui-icon {
    width: 15px;
    height: 15px;
    color: var(--sage-strong);
    --icon-fill: transparent;
}

.profile-info {
    display: grid;
    gap: 11px;
    margin-top: 10px;
    padding: 14px;
    border-radius: 22px;
}

.profile-info__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.profile-info__head h2 {
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
}

.profile-info__head p {
    margin-top: 2px;
    color: var(--muted);
    font-size: 9px;
}

.profile-info__head .btn {
    flex: none;
    min-height: 30px;
    padding: 0 9px;
    font-size: 9px;
}

.profile-info__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}

.profile-info__grid span {
    display: grid;
    gap: 2px;
    padding: 8px;
    border-radius: 12px;
    background: rgba(255, 253, 248, 0.7);
}

.profile-info__grid small {
    color: var(--muted);
    font-size: 8px;
}

.profile-info__grid strong {
    overflow: hidden;
    color: var(--ink);
    font-size: 11px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-info__empty {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.profile-info__empty p {
    flex: 1 1 190px;
    color: var(--ink-soft);
    font-size: 10px;
    line-height: 1.55;
}

.section-head .ai-refresh {
    border: 0;
    background: transparent;
    color: var(--coral-strong);
    cursor: pointer;
}

.section-head .ai-refresh:disabled {
    opacity: 0.45;
    cursor: wait;
}

.ai-calorie-target {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 9px;
    padding: 13px 15px;
    border: 1px solid rgba(241, 111, 86, 0.24);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(255, 240, 232, 0.9), rgba(255, 253, 248, 0.72));
}

.ai-calorie-target[hidden] {
    display: none;
}

.ai-calorie-target__value {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.ai-calorie-target__value span {
    color: var(--ink-soft);
    font-size: 9.5px;
    font-weight: 700;
}

.ai-calorie-target__value strong {
    color: var(--coral-strong);
    font-size: 25px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
}

.ai-calorie-target__value small {
    color: var(--muted);
    font-size: 9px;
    font-weight: 600;
}

.ai-calorie-target p {
    max-width: 125px;
    color: var(--muted);
    font-size: 8.5px;
    line-height: 1.45;
    text-align: right;
}

.ai-calorie-target.is-fresh {
    animation: target-pop 460ms var(--ease) both;
}

@keyframes target-pop {
    0% { opacity: 0.5; transform: scale(0.985); }
    55% { transform: scale(1.01); }
    100% { opacity: 1; transform: scale(1); }
}

.ai-advice {
    display: grid;
    gap: 9px;
}

.ai-advice-grid {
    gap: 10px;
}

.ai-advice-card {
    gap: 9px;
}

.ai-advice-card .plan-card__head p {
    line-height: 1.55;
}

.ai-tips {
    display: grid;
    gap: 5px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ai-tips li {
    position: relative;
    padding-left: 13px;
    color: var(--ink-soft);
    font-size: 9.5px;
    line-height: 1.55;
}

.ai-tips li::before {
    position: absolute;
    top: 0.6em;
    left: 0;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--coral);
    content: "";
}

.ai-advice-loading,
.ai-advice-empty {
    display: grid;
    justify-items: start;
    gap: 7px;
    padding: 18px;
    border-radius: 22px;
}

.ai-advice-loading {
    grid-template-columns: auto 1fr;
    align-items: center;
    justify-items: start;
}

.ai-advice-loading .loading {
    width: 15px;
    height: 15px;
    border-color: rgba(23, 58, 50, 0.18);
    border-top-color: var(--coral);
}

.ai-advice-loading p,
.ai-advice-empty p {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.55;
}

.ai-advice-empty strong {
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
}

.ai-advice-empty .empty-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
}

.ai-advice-empty .empty-icon .ui-icon {
    width: 17px;
    height: 17px;
    --icon-fill: transparent;
}

.ai-advice-empty .btn {
    margin-top: 2px;
}

.ai-advice-notice {
    padding: 8px 10px;
    border: 1px solid rgba(217, 165, 80, 0.25);
    border-radius: 12px;
    background: rgba(246, 228, 190, 0.3);
    color: var(--ink-soft);
    font-size: 9px;
    line-height: 1.5;
}

.ai-advice-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 5px 10px;
    color: var(--muted);
    font-size: 8.5px;
}

.ai-advice-foot .text-link {
    color: var(--coral-strong);
    font-size: 9px;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.plan-grid {
    display: grid;
    gap: 10px;
}

.plan-card {
    display: grid;
    gap: 8px;
    padding: 14px;
    border-radius: 24px;
}

.plan-card__head {
    display: flex;
    align-items: center;
    gap: 9px;
}

.plan-card__head h3 {
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
}

.plan-card__head p {
    color: var(--muted);
    font-size: 9.5px;
}

.plan-card__note {
    color: var(--ink-soft);
    font-size: 10px;
    line-height: 1.6;
}

.plan-meals {
    display: grid;
    gap: 4px;
}

.plan-meal {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 8px;
    border-radius: 12px;
    background: rgba(221, 235, 225, 0.35);
}

.plan-meal__dot {
    width: 5px;
    height: 5px;
    flex: none;
    border-radius: 50%;
    background: var(--coral);
}

.plan-meal div {
    display: grid;
    flex: 1;
    gap: 0;
    min-width: 0;
}

.plan-meal strong {
    color: var(--ink);
    font-size: 10px;
    font-weight: 800;
}

.plan-meal small {
    overflow: hidden;
    color: var(--muted);
    font-size: 8.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plan-meal .chip {
    min-height: 21px;
    padding: 0 6px;
    font-size: 8px;
}

.plan-card .btn {
    justify-self: start;
    margin-top: 2px;
}

.settings-card {
    margin-top: 14px;
    padding: 5px;
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px;
    border-radius: 17px;
    color: var(--ink);
    text-decoration: none;
    transition: background-color var(--dur-2) ease;
}

.settings-row:hover {
    background: rgba(221, 235, 225, 0.35);
}

.settings-row__copy {
    display: grid;
    flex: 1;
    gap: 0;
    min-width: 0;
}

.settings-row__copy strong {
    font-size: 11.5px;
    font-weight: 700;
}

.settings-row__copy small {
    color: var(--muted);
    font-size: 8.5px;
}

.settings-row > .ui-icon {
    width: 15px;
    height: 15px;
    color: var(--muted);
    --icon-fill: transparent;
}

/* --------------------------------------------------------------------------
   Auth
   -------------------------------------------------------------------------- */

.auth-page {
    background:
        radial-gradient(900px 600px at 20% 0%, rgba(255, 253, 248, 0.9), rgba(255, 253, 248, 0) 60%),
        radial-gradient(700px 600px at 100% 100%, rgba(241, 111, 86, 0.1), rgba(241, 111, 86, 0) 60%),
        var(--canvas-deep);
}

.auth-page .app-main {
    padding: 0 18px 26px;
}

.auth-shell {
    position: relative;
    display: grid;
    width: 100%;
    justify-items: center;
    align-content: start;
    padding-top: 24px;
    min-height: calc(100dvh - 56px);
}

.auth-leaf {
    position: absolute;
    top: -4px;
    left: -24px;
    width: 96px;
    height: 124px;
    opacity: 0.5;
    transform: rotate(-9deg);
    pointer-events: none;
}

.auth-brand {
    position: relative;
    display: grid;
    justify-items: center;
    padding-top: 24px;
}

.auth-brand__sun {
    position: absolute;
    top: 6px;
    left: 50%;
    width: 50px;
    height: 28px;
    color: var(--coral);
    transform: translateX(20px);
}

.auth-brand__word {
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 34px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.045em;
}

.auth-brand__tagline {
    margin-top: 7px;
    color: var(--ink-soft);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.17em;
}

.auth-heading {
    display: grid;
    justify-items: center;
    gap: 8px;
    margin-top: 30px;
    text-align: center;
}

.auth-heading h1 {
    color: var(--ink);
    font-size: clamp(25px, 7.4vw, 30px);
    font-weight: 800;
    letter-spacing: 0.01em;
    line-height: 1.25;
}

.auth-rule {
    width: 34px;
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--coral), #f49a74);
    box-shadow: 0 4px 10px -4px rgba(241, 111, 86, 0.6);
}

.auth-heading p {
    max-width: 100%;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.55;
}

.auth-card {
    display: grid;
    width: 100%;
    gap: 10px;
    margin-top: 18px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 26px;
    background: rgba(255, 253, 248, 0.74);
    box-shadow: var(--shadow-md);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    backdrop-filter: blur(18px) saturate(1.2);
}

.auth-card .btn {
    margin-top: 3px;
}

.auth-links {
    display: flex;
    justify-content: center;
}

.auth-links .text-link {
    color: var(--coral-strong);
    font-size: 10px;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.auth-switch {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 16px;
    color: var(--muted);
    font-size: 10.5px;
}

.auth-switch a {
    color: var(--coral-strong);
    font-weight: 800;
    text-decoration: none;
}

.auth-switch__back {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--ink-soft) !important;
    font-weight: 600 !important;
}

.auth-switch__back .ui-icon {
    width: 13px;
    height: 13px;
    --icon-fill: transparent;
}

.auth-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--muted);
    font-size: 9px;
    text-align: center;
}

.auth-note .ui-icon {
    width: 13px;
    height: 13px;
    --icon-fill: transparent;
}

.auth-illustration {
    width: min(300px, 88%);
    margin-top: 10px;
    opacity: 0.92;
    pointer-events: none;
}

.auth-back {
    width: 100%;
}

.auth-shell--register .auth-heading h1 {
    font-size: clamp(22px, 6.4vw, 26px);
}

.auth-shell--register .auth-heading {
    margin-top: 22px;
}

.auth-shell--register .auth-brand {
    padding-top: 16px;
}

/* --------------------------------------------------------------------------
   Keyframes
   -------------------------------------------------------------------------- */

@keyframes seg-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes check-pop {
    0% {
        transform: scale(0.82);
    }
    55% {
        transform: scale(1.12);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes typing-bounce {
    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.55;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --------------------------------------------------------------------------
   Wide screens
   -------------------------------------------------------------------------- */

@media (min-width: 640px) {
    .compose-fab {
        right: calc(50% - 204px);
    }

    .auth-shell {
        min-height: calc(100dvh - 110px);
    }
}

@media (max-width: 380px) {
    .app-main {
        padding-right: 14px;
        padding-left: 14px;
    }

    .app-header {
        padding-right: 14px;
        padding-left: 14px;
    }

    .meal-row {
        grid-template-columns: 24px 44px minmax(0, 1fr) auto;
        gap: 7px;
        padding: 9px 5px;
    }

    .meal-thumb {
        width: 44px;
        height: 44px;
        border-radius: 13px;
    }

    .photo-btn {
        min-width: 55px;
        font-size: 8px;
    }

    .stat-chip {
        gap: 4px;
        padding: 6px;
    }

    .stat-chip .icon-tile {
        width: 26px;
        height: 26px;
    }

    .stat-chip strong {
        font-size: 10px;
    }

    .chart__bars,
    .chart__labels {
        gap: 5px;
    }
}

/* --------------------------------------------------------------------------
   Motion & interaction layer
   -------------------------------------------------------------------------- */
.btn,
.photo-btn,
.image-picker {
    position: relative;
    overflow: hidden;
}

.btn > *,
.photo-btn > *,
.image-picker > * {
    position: relative;
    z-index: 1;
}

.btn.is-pressed,
.photo-btn.is-pressed,
.image-picker.is-pressed {
    transform: scale(0.975);
}

.icon-btn.is-pressed,
.nav-item.is-pressed,
.content-tab.is-pressed,
.post-more.is-pressed {
    transform: scale(0.96);
}

.task-item.is-pressing,
.post-card.is-pressing,
.history-row.is-pressing,
.plan-card.is-pressing,
.stat-chip.is-pressing,
.chart-card.is-pressing {
    transform: scale(0.995);
    filter: brightness(0.985);
}

.btn,
.icon-btn,
.nav-item,
.content-tab,
.post-more,
.task-item,
.post-card,
.history-row,
.plan-card,
.stat-chip,
.chart-card {
    transition: transform 180ms var(--ease), filter 180ms ease,
        box-shadow 240ms ease, background-color 220ms ease;
}

.task-checkbox.checked {
    animation: check-pop 320ms var(--ease);
}

.bar-fill {
    transform-origin: bottom center;
    animation: bar-grow 720ms var(--ease) both;
}

.bar-col:nth-child(1) .bar-fill { animation-delay: 40ms; }
.bar-col:nth-child(2) .bar-fill { animation-delay: 90ms; }
.bar-col:nth-child(3) .bar-fill { animation-delay: 140ms; }
.bar-col:nth-child(4) .bar-fill { animation-delay: 190ms; }
.bar-col:nth-child(5) .bar-fill { animation-delay: 240ms; }
.bar-col:nth-child(6) .bar-fill { animation-delay: 290ms; }
.bar-col:nth-child(7) .bar-fill { animation-delay: 340ms; }

.chart__goal {
    animation: goal-pulse 4.8s ease-in-out infinite;
}

.app-main .card:not(.rise) {
    animation: card-in 480ms var(--ease) both;
}

.ai-advice-grid .ai-advice-card:nth-child(1) {
    animation-delay: 35ms;
}

.ai-advice-grid .ai-advice-card:nth-child(2) {
    animation-delay: 110ms;
}

.ai-tips li {
    animation: tip-in 420ms var(--ease) both;
}

.ai-tips li:nth-child(1) { animation-delay: 90ms; }
.ai-tips li:nth-child(2) { animation-delay: 150ms; }
.ai-tips li:nth-child(3) { animation-delay: 210ms; }
.ai-tips li:nth-child(4) { animation-delay: 270ms; }

.history-day {
    animation: card-in 480ms var(--ease) both;
}

.history-day:nth-child(2) { animation-delay: 50ms; }
.history-day:nth-child(3) { animation-delay: 95ms; }
.history-day:nth-child(4) { animation-delay: 140ms; }
.history-day:nth-child(5) { animation-delay: 185ms; }
.history-day:nth-child(6) { animation-delay: 230ms; }

.nav-item .ui-icon,
.icon-btn .ui-icon {
    transition: transform 200ms var(--ease), color 200ms ease;
}

@media (hover: hover) and (pointer: fine) {
    .card:hover {
        transform: translateY(-2px);
        box-shadow: 0 18px 36px -26px rgba(23, 58, 50, 0.4), var(--shadow-md);
    }

    .task-item:hover,
    .history-row:hover {
        background: rgba(221, 235, 225, 0.42);
    }

    .post-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 20px 36px -28px rgba(23, 58, 50, 0.42);
    }

    .stat-chip:hover,
    .plan-card:hover {
        transform: translateY(-1px);
    }

    .nav-item:hover .ui-icon {
        transform: translateY(-1px) rotate(-2deg);
    }

    .icon-btn:hover .ui-icon {
        transform: rotate(-6deg) scale(1.05);
    }

    .photo-btn:hover .ui-icon {
        animation: camera-wiggle 480ms var(--ease);
    }

    .post-more:hover .ui-icon {
        transform: translateY(-1px);
    }
}

@keyframes bar-grow {
    from {
        opacity: 0.2;
        transform: scaleY(0.12);
    }
    to {
        opacity: 1;
        transform: scaleY(1);
    }
}

@keyframes card-in {
    from {
        opacity: 0;
        transform: translateY(9px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes tip-in {
    from {
        opacity: 0;
        transform: translateX(-4px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes goal-pulse {
    0%, 100% { opacity: 0.72; }
    50% { opacity: 1; }
}

@keyframes camera-wiggle {
    0%, 100% { transform: rotate(0); }
    30% { transform: rotate(-5deg); }
    65% { transform: rotate(3deg); }
}

@media (prefers-reduced-motion: reduce) {
    .card:hover,
    .post-card:hover,
    .stat-chip:hover,
    .plan-card:hover,
    .task-item.is-pressing,
    .post-card.is-pressing,
    .history-row.is-pressing,
    .plan-card.is-pressing,
    .stat-chip.is-pressing,
    .chart-card.is-pressing {
        transform: none;
    }

    .gauge {
        animation: none;
    }
}

/* ==========================================================================
   Apple-inspired glass layer + stronger motion
   ========================================================================== */
:root {
    --glass-border-soft: rgba(255, 255, 255, 0.66);
    --glass-surface: linear-gradient(155deg, rgba(255, 253, 248, 0.78), rgba(250, 246, 236, 0.56));
    --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.86);
    --glass-depth: 0 24px 58px -34px rgba(23, 58, 50, 0.42),
        inset 0 -1px 0 rgba(23, 58, 50, 0.04);
    --spring: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Shell aurora: gives the glass something colorful to refract. */
.app-shell {
    isolation: isolate;
    background:
        radial-gradient(90% 55% at 8% 0%, rgba(255, 255, 255, 0.62), transparent 60%),
        radial-gradient(70% 45% at 100% 32%, rgba(229, 179, 153, 0.2), transparent 68%),
        radial-gradient(70% 50% at 0% 78%, rgba(158, 197, 173, 0.24), transparent 70%),
        var(--canvas);
}

.app-shell::after {
    position: absolute;
    inset: -18% -22%;
    z-index: 0;
    background:
        radial-gradient(34% 28% at 24% 28%, rgba(241, 111, 86, 0.2), transparent 72%),
        radial-gradient(34% 30% at 82% 54%, rgba(158, 197, 173, 0.46), transparent 72%),
        radial-gradient(28% 24% at 50% 90%, rgba(224, 179, 106, 0.16), transparent 72%);
    content: "";
    filter: blur(26px);
    pointer-events: none;
    animation: shell-aurora 19s ease-in-out infinite alternate;
}

.app-main {
    scroll-behavior: smooth;
}

.ambient-blob--sage {
    animation: blob-drift-sage 22s ease-in-out infinite alternate;
}

.ambient-blob--coral {
    animation: blob-drift-coral 26s ease-in-out infinite alternate;
}

/* Header / floating glass navigation */
.app-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    background: linear-gradient(180deg, rgba(250, 247, 239, 0.78), rgba(250, 247, 239, 0.5));
    box-shadow: 0 14px 34px -30px rgba(23, 58, 50, 0.44),
        inset 0 -1px 0 rgba(255, 255, 255, 0.4);
    -webkit-backdrop-filter: blur(28px) saturate(1.65);
    backdrop-filter: blur(28px) saturate(1.65);
}

.app-header.is-stuck {
    background: linear-gradient(180deg, rgba(250, 247, 239, 0.9), rgba(250, 247, 239, 0.68));
    box-shadow: 0 18px 42px -28px rgba(23, 58, 50, 0.5),
        inset 0 -1px 0 rgba(255, 255, 255, 0.52);
}

.bottom-nav {
    width: calc(100% - 20px);
    max-width: 460px;
    margin: 0 auto calc(8px + env(safe-area-inset-bottom));
    padding: 7px 8px;
    border: 1px solid var(--glass-border-soft);
    border-radius: 26px;
    background: linear-gradient(180deg, rgba(255, 253, 248, 0.7), rgba(246, 242, 233, 0.56));
    box-shadow: 0 22px 52px -24px rgba(23, 58, 50, 0.48),
        var(--glass-highlight);
    -webkit-backdrop-filter: blur(30px) saturate(1.75);
    backdrop-filter: blur(30px) saturate(1.75);
}

.nav-item {
    border-radius: 19px;
}

.nav-item.active {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(251, 228, 221, 0.62));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 9px 20px -15px rgba(241, 111, 86, 0.8);
}

.nav-item.active .ui-icon {
    animation: nav-icon-pop 620ms var(--spring) both;
}

/* Glass cards */
.card {
    border: 1px solid var(--glass-border-soft);
    background: var(--glass-surface);
    box-shadow: var(--glass-depth);
    -webkit-backdrop-filter: blur(26px) saturate(1.55);
    backdrop-filter: blur(26px) saturate(1.55);
}

.card--sage {
    border-color: rgba(255, 255, 255, 0.62);
    background: linear-gradient(155deg, rgba(242, 249, 243, 0.72), rgba(221, 235, 225, 0.48));
}

.card--coral {
    border-color: rgba(255, 255, 255, 0.6);
    background: linear-gradient(155deg, rgba(255, 249, 245, 0.76), rgba(251, 228, 221, 0.48));
}

.calorie-card {
    background:
        radial-gradient(70% 55% at 100% 0%, rgba(241, 111, 86, 0.13), transparent 65%),
        linear-gradient(155deg, rgba(255, 253, 248, 0.8), rgba(255, 245, 238, 0.55));
    -webkit-backdrop-filter: blur(26px) saturate(1.5);
    backdrop-filter: blur(26px) saturate(1.5);
}

.challenge-card {
    border-color: rgba(255, 255, 255, 0.62);
    background:
        radial-gradient(110% 90% at 100% 0%, rgba(241, 111, 86, 0.18), transparent 58%),
        linear-gradient(155deg, rgba(255, 249, 244, 0.8), rgba(251, 231, 222, 0.55));
    box-shadow: var(--glass-depth);
    -webkit-backdrop-filter: blur(28px) saturate(1.55);
    backdrop-filter: blur(28px) saturate(1.55);
}

.exercise-panel,
.task-card {
    border-color: rgba(255, 255, 255, 0.58);
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(241, 111, 86, 0.1), transparent 50%),
        linear-gradient(155deg, rgba(245, 250, 243, 0.78), rgba(224, 238, 228, 0.52));
    box-shadow: var(--glass-depth);
    -webkit-backdrop-filter: blur(26px) saturate(1.5);
    backdrop-filter: blur(26px) saturate(1.5);
}

.profile-hero,
.coach-chat,
.style-switch,
.ai-advice-card,
.profile-info {
    border-color: var(--glass-border-soft);
    -webkit-backdrop-filter: blur(24px) saturate(1.5);
    backdrop-filter: blur(24px) saturate(1.5);
}

/* Glass fields, chips, buttons and overlays */
.field,
.chip,
.icon-btn {
    border-color: rgba(255, 255, 255, 0.64);
    background: rgba(255, 253, 248, 0.56);
    box-shadow: var(--glass-highlight);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    backdrop-filter: blur(18px) saturate(1.4);
}

.field {
    background:
        linear-gradient(155deg, rgba(255, 253, 248, 0.64), rgba(255, 253, 248, 0.44));
}

.field:focus-within {
    background: rgba(255, 253, 248, 0.85);
    box-shadow: 0 0 0 4px rgba(241, 111, 86, 0.13),
        0 14px 30px -24px rgba(241, 111, 86, 0.8),
        var(--glass-highlight);
}

.btn-secondary {
    border-color: rgba(255, 255, 255, 0.68);
    background: linear-gradient(155deg, rgba(255, 253, 248, 0.76), rgba(250, 246, 236, 0.52));
    box-shadow: var(--glass-highlight), var(--shadow-xs);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    backdrop-filter: blur(18px) saturate(1.4);
}

.btn-primary {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #f57b62 0%, #ec6248 100%);
    box-shadow: 0 14px 28px -12px rgba(217, 87, 63, 0.72),
        inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.btn-primary::after {
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.38) 46%, transparent 64%);
    content: "";
    pointer-events: none;
    transform: translateX(-140%);
    transition: transform 620ms var(--ease);
}

.btn-primary:hover::after {
    transform: translateX(140%);
}

.toast,
.modal-content,
.meal-dropdown-content,
.meal-image-dialog {
    border-color: var(--glass-border-soft);
    background: linear-gradient(155deg, rgba(255, 253, 248, 0.82), rgba(250, 246, 236, 0.68));
    box-shadow: 0 26px 60px -28px rgba(23, 58, 50, 0.46),
        var(--glass-highlight);
    -webkit-backdrop-filter: blur(32px) saturate(1.7);
    backdrop-filter: blur(32px) saturate(1.7);
}

.chip {
    background: rgba(255, 253, 248, 0.52);
}

.chip--sage {
    background: rgba(221, 235, 225, 0.68);
}

.chip--coral {
    background: rgba(251, 228, 221, 0.72);
}

/* Scroll-reveal for content that starts below the fold. */
.scroll-reveal {
    opacity: 0;
}

.scroll-reveal.is-revealed {
    opacity: 1;
    animation: card-spring 560ms var(--spring) backwards;
    animation-delay: var(--reveal-delay, 0ms);
}

/* Glass auth surfaces and flash messages. */
.auth-card,
.flash {
    border: 1px solid var(--glass-border-soft);
    background: linear-gradient(155deg, rgba(255, 253, 248, 0.78), rgba(250, 246, 236, 0.55));
    box-shadow: var(--glass-depth);
    -webkit-backdrop-filter: blur(26px) saturate(1.55);
    backdrop-filter: blur(26px) saturate(1.55);
}

/* Stronger entrance: spring with a small overshoot. */
.rise {
    animation: rise-spring 560ms var(--spring) backwards;
}

.rise--1 { animation-delay: 60ms; }
.rise--2 { animation-delay: 120ms; }
.rise--3 { animation-delay: 180ms; }
.rise--4 { animation-delay: 240ms; }

.app-main .card:not(.rise) {
    animation: card-spring 560ms var(--spring) backwards;
}

.history-day {
    animation: card-spring 560ms var(--spring) backwards;
}

.ai-advice-card {
    animation: card-spring 540ms var(--spring) backwards;
}

/* Rows and small cards get a subtle stagger. */
.checkin-item {
    animation: row-in 420ms var(--spring) backwards;
}

.checkin-item:nth-child(2) { animation-delay: 45ms; }
.checkin-item:nth-child(3) { animation-delay: 90ms; }
.checkin-item:nth-child(4) { animation-delay: 135ms; }
.checkin-item:nth-child(5) { animation-delay: 180ms; }

.stat-chip {
    animation: card-spring 500ms var(--spring) backwards;
}

.stat-chip:nth-child(2) { animation-delay: 55ms; }
.stat-chip:nth-child(3) { animation-delay: 110ms; }

/* Desktop pointer tilt + specular glare. */
@media (hover: hover) and (pointer: fine) {
    .card:hover {
        transform: translateY(-4px) scale(1.006);
        box-shadow: 0 32px 64px -34px rgba(23, 58, 50, 0.46),
            var(--glass-highlight);
    }

    .tilt-card {
        position: relative;
        transform-style: preserve-3d;
        will-change: transform;
    }

    .tilt-card::after {
        position: absolute;
        inset: 0;
        z-index: 2;
        border-radius: inherit;
        background: radial-gradient(300px circle at var(--glow-x, 50%) var(--glow-y, 50%),
                rgba(255, 255, 255, 0.34), transparent 58%);
        content: "";
        opacity: 0;
        pointer-events: none;
        transition: opacity 220ms ease;
    }

    .tilt-card:hover {
        transform: perspective(1000px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg))
            translateY(-4px) scale(1.006);
    }

    .tilt-card:hover::after {
        opacity: 1;
    }

    .btn:hover {
        transform: translateY(-2px) scale(1.01);
    }

    .nav-item:hover {
        transform: translateY(-1px);
    }
}

@keyframes rise-spring {
    0% {
        opacity: 0;
        transform: translateY(22px) scale(0.975);
    }
    65% {
        opacity: 1;
        transform: translateY(-3px) scale(1.006);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes card-spring {
    0% {
        opacity: 0;
        transform: translateY(18px) scale(0.985);
    }
    70% {
        opacity: 1;
        transform: translateY(-2px) scale(1.004);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes row-in {
    from {
        opacity: 0;
        transform: translateX(-7px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes nav-icon-pop {
    0% { transform: translateY(2px) scale(0.86); }
    55% { transform: translateY(-3px) scale(1.12); }
    100% { transform: translateY(-1px) scale(1.04); }
}

@keyframes shell-aurora {
    0% { transform: translate3d(-1.5%, -1%, 0) scale(1); }
    50% { transform: translate3d(1.5%, 1.2%, 0) scale(1.035); }
    100% { transform: translate3d(-1%, 1.5%, 0) scale(1.01); }
}

@keyframes blob-drift-sage {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(3vw, 4vh, 0) scale(1.08); }
}

@keyframes blob-drift-coral {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(-3vw, -3vh, 0) scale(1.06); }
}

@keyframes page-in {
    from { opacity: 0; transform: scale(0.985); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes page-out {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(1.006); }
}

/* Native cross-document page transitions where supported (Chrome). */
@view-transition {
    navigation: auto;
}

::view-transition-old(root) {
    animation: page-out 160ms ease both;
}

::view-transition-new(root) {
    animation: page-in 360ms var(--spring) both;
}

/* Readability fallback when the browser cannot blur. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .card,
    .app-header,
    .bottom-nav,
    .toast,
    .modal-content,
    .meal-dropdown-content,
    .field,
    .chip,
    .icon-btn {
        background: var(--surface);
    }
}

@media (prefers-reduced-transparency: reduce) {
    .card,
    .app-header,
    .bottom-nav,
    .toast,
    .modal-content,
    .meal-dropdown-content,
    .field,
    .chip,
    .icon-btn,
    .btn-secondary {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        background: var(--surface);
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-shell::after,
    .ambient-blob,
    .gauge,
    .checkin-item,
    .stat-chip,
    .rise,
    .app-main .card,
    .history-day,
    .ai-advice-card {
        animation: none !important;
    }

    .tilt-card,
    .tilt-card:hover,
    .card:hover,
    .btn:hover {
        transform: none !important;
    }

    .tilt-card::after {
        display: none;
    }
}

@media (min-width: 640px) {
    .bottom-nav {
        width: calc(100% - 24px);
        max-width: 456px;
        margin-bottom: 10px;
    }
}

/* ==========================================================================
   Interaction polish: dock indicator, reading progress, chart tooltips, feedback
   ========================================================================== */
.bottom-nav {
    position: relative;
    isolation: isolate;
}

.nav-active-pill {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 19px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(251, 228, 221, 0.62));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92),
        0 9px 20px -15px rgba(241, 111, 86, 0.8);
    opacity: 0;
    pointer-events: none;
    transition: transform 320ms var(--spring), width 320ms var(--spring),
        height 320ms var(--spring), opacity 180ms ease;
}

.nav-active-pill.is-ready {
    opacity: 1;
}

.bottom-nav .nav-item {
    position: relative;
    z-index: 1;
}

.bottom-nav .nav-item.active {
    background: transparent;
    box-shadow: none;
}

.nav-item.active .ui-icon {
    animation: nav-icon-pop 620ms var(--spring) both;
}

@media (hover: hover) and (pointer: fine) {
    .bottom-nav .nav-item:hover .ui-icon {
        transform: translateY(-4px) scale(1.1);
    }

    .bottom-nav:has(.nav-item:hover) .nav-item:not(:hover) .ui-icon {
        opacity: 0.68;
        transform: translateY(1px) scale(0.93);
    }
}

/* Reading progress under the header, driven by the internal scroll container. */
.scroll-progress {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    z-index: 5;
    height: 2px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
}

.scroll-progress.is-visible {
    opacity: 1;
}

.scroll-progress span {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--coral), #f5a57d);
    box-shadow: 0 0 10px rgba(241, 111, 86, 0.4);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 100ms linear;
}

/* Weekly chart: glass tooltip on hover or keyboard focus. */
.bar-col {
    position: relative;
}

.bar-tooltip {
    position: absolute;
    left: 50%;
    z-index: 8;
    padding: 5px 7px;
    border: 1px solid var(--glass-border-soft);
    border-radius: 9px;
    background: rgba(255, 253, 248, 0.8);
    box-shadow: 0 8px 18px -12px rgba(23, 58, 50, 0.45);
    color: var(--ink-soft);
    font-size: 7.5px;
    font-weight: 700;
    line-height: 1.2;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 4px) scale(0.96);
    transition: opacity 180ms ease, transform 220ms var(--spring);
    white-space: nowrap;
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    backdrop-filter: blur(14px) saturate(1.4);
}

.bar-col:hover .bar-tooltip,
.bar-col:focus-visible .bar-tooltip {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
}

.bar-col:focus-visible {
    outline: none;
}

.bar-col:focus-visible .bar-fill {
    box-shadow: 0 0 0 2px rgba(241, 111, 86, 0.72),
        0 10px 18px -12px rgba(241, 111, 86, 0.65);
}

.bar-value {
    transition: opacity 160ms ease;
}

.bar-col:hover .bar-value,
.bar-col:focus-visible .bar-value {
    opacity: 0;
}

/* Submit feedback and validation shake. */
.btn.is-submitting {
    pointer-events: none;
    opacity: 0.82;
}

.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    flex: none;
    border: 1.8px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 720ms linear infinite;
}

.is-shaking {
    animation: error-shake 360ms ease both;
}

@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* AI advice loading gets a subtle skeleton shimmer. */
.ai-advice-loading {
    position: relative;
    overflow: hidden;
}

.ai-advice-loading::after {
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 28%, rgba(255, 255, 255, 0.42) 48%, transparent 68%);
    content: "";
    pointer-events: none;
    transform: translateX(-120%);
    animation: skeleton-shimmer 1.55s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
    to { transform: translateX(120%); }
}

@media (prefers-reduced-motion: reduce) {
    .nav-active-pill,
    .scroll-progress span,
    .bar-tooltip,
    .btn-spinner,
    .ai-advice-loading::after,
    .nav-item.active .ui-icon {
        animation: none !important;
        transition: none !important;
    }

    .is-shaking {
        animation: none !important;
    }
}

/* Keep press scale above hover transforms; no expanding circle/ripple. */
.btn.btn.is-pressed,
.photo-btn.photo-btn.is-pressed,
.image-picker.image-picker.is-pressed,
.icon-btn.icon-btn.is-pressed,
.nav-item.nav-item.is-pressed,
.content-tab.content-tab.is-pressed,
.post-more.post-more.is-pressed {
    transform: scale(0.96);
    transition-duration: 100ms;
}

/* Random transparent celebration stickers for completed group members. */
.member-celebration {
    width: 58px;
    height: 58px;
    flex: none;
    align-self: center;
    object-fit: contain;
    filter: drop-shadow(0 8px 12px rgba(23, 58, 50, 0.18));
    pointer-events: none;
    animation: celebration-in 560ms var(--spring) both,
        celebration-float 4.2s ease-in-out 620ms infinite;
}

@keyframes celebration-in {
    0% { opacity: 0; transform: scale(0.55) translateY(8px); }
    70% { opacity: 1; transform: scale(1.06) translateY(-2px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

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

@media (hover: hover) and (pointer: fine) {
    .checkin-item:hover .member-celebration {
        filter: drop-shadow(0 10px 16px rgba(241, 111, 86, 0.24));
    }
}

@media (max-width: 370px) {
    .member-celebration {
        width: 48px;
        height: 48px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .member-celebration {
        animation: none;
    }
}

/* ==========================================================================
   Reference art direction: paper, ink outlines, hand-drawn illustrations
   ========================================================================== */
.app-header {
    overflow: visible;
}

.header-leaf {
    position: absolute;
    top: -12px;
    left: -20px;
    z-index: 0;
    width: 104px;
    height: 118px;
    background: url("../img/artwork/decor/decor-leaf-branch.png") left top / contain no-repeat;
    opacity: 0.42;
    pointer-events: none;
    transform: rotate(-4deg);
}

.brand {
    z-index: 1;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.brand-tagline {
    display: block;
    margin-top: 1px;
    color: var(--muted);
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.1em;
    line-height: 1.3;
}

.app-header--stacked .brand-tagline {
    margin-top: 6px;
    font-size: 10px;
    letter-spacing: 0.13em;
}

.header-actions {
    position: relative;
    z-index: 1;
}

/* Hand-drawn page illustrations */
.page-heading {
    position: relative;
}

.page-heading--illu {
    padding-right: 88px;
}

.page-illu {
    position: absolute;
    top: -3px;
    right: -8px;
    width: 102px;
    height: auto;
    opacity: 0.94;
    pointer-events: none;
}

.page-illu--eggs {
    width: 96px;
}

.page-illu--book {
    width: 108px;
}

.calorie-card {
    overflow: hidden;
}

.calorie-illu {
    position: absolute;
    top: 58px;
    right: 6px;
    z-index: 0;
    width: 128px;
    height: auto;
    opacity: 0.78;
    pointer-events: none;
}

.calorie-card__head,
.gauge-block,
.gauge-tap-hint,
.gauge-detail,
.calorie-note,
.meal-plan-chips {
    position: relative;
    z-index: 2;
}

/* Ink borders with the existing glass surfaces. */
.card,
.task-card,
.calorie-card,
.challenge-card,
.exercise-panel,
.coach-context,
.auth-card,
.bottom-nav {
    border-color: rgba(23, 58, 50, 0.2);
    border-width: 1.2px;
}

.card,
.task-card,
.calorie-card,
.challenge-card,
.exercise-panel {
    box-shadow: 0 2px 0 rgba(23, 58, 50, 0.035),
        var(--glass-depth);
}

.chip {
    border-color: rgba(23, 58, 50, 0.16);
}

.btn-secondary {
    border-color: rgba(23, 58, 50, 0.24);
}

.btn-primary {
    border-width: 1.2px;
    border-color: rgba(23, 58, 50, 0.14);
}

/* Reference portrait for the AI coach. */
.ai-avatar {
    position: relative;
    width: 60px;
    height: 60px;
    overflow: visible;
    border: 1.5px solid rgba(23, 58, 50, 0.22);
    background: #f4dfd2;
    box-shadow: 0 8px 16px -12px rgba(23, 58, 50, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.ai-avatar::before {
    position: absolute;
    top: -8px;
    left: 50%;
    width: 29px;
    height: 11px;
    border: 2px dashed var(--coral);
    border-bottom: 0;
    border-radius: 50% 50% 0 0;
    content: "";
    pointer-events: none;
    transform: translateX(-50%) rotate(-3deg);
}

.ai-avatar img {
    position: relative;
    z-index: 1;
    background: #f4dfd2;
}

@media (max-width: 380px) {
    .page-heading--illu {
        padding-right: 76px;
    }

    .page-illu {
        width: 88px;
    }

    .page-illu--eggs {
        width: 84px;
    }

    .page-illu--book {
        width: 94px;
    }

    .calorie-illu {
        width: 114px;
        right: 2px;
    }

    .header-leaf {
        width: 88px;
        height: 102px;
        left: -24px;
    }

    .ai-avatar {
        width: 54px;
        height: 54px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .header-leaf,
    .page-illu,
    .calorie-illu {
        transition: none;
    }
}

/* ==========================================================================
   High-fidelity paper edition: warmer, darker, layered, less glass glare
   ========================================================================== */
:root {
    --canvas: #eadbc3;
    --canvas-deep: #e1cfb2;
    --surface: #fcf4e2;
    --surface-soft: #f7ecd7;
    --surface-tint: #f2e2c7;
    --ink: #173a32;
    --ink-soft: #3d574c;
    --muted: #626d62;
    --muted-soft: #7b8276;
    --coral: #e96e54;
    --coral-strong: #bd4b36;
    --coral-soft: #f8ddd1;
    --sage: #d5e3d3;
    --sage-soft: #e8f0e3;
    --sage-deep: #c0d6c2;
    --line: rgba(23, 58, 50, 0.22);
    --line-strong: rgba(23, 58, 50, 0.35);
    --glass: rgba(252, 244, 227, 0.82);
    --glass-strong: rgba(252, 244, 227, 0.95);
}

body {
    background:
        radial-gradient(900px 620px at 8% -8%, rgba(247, 233, 208, 0.9), transparent 60%),
        radial-gradient(760px 620px at 104% 20%, rgba(213, 227, 211, 0.5), transparent 66%),
        radial-gradient(800px 700px at 48% 108%, rgba(213, 227, 211, 0.44), transparent 64%),
        var(--canvas-deep);
}

.app-shell {
    background:
        radial-gradient(70% 45% at 10% 4%, rgba(255, 248, 234, 0.62), transparent 62%),
        radial-gradient(55% 40% at 96% 34%, rgba(233, 110, 84, 0.09), transparent 66%),
        radial-gradient(62% 42% at 0% 88%, rgba(158, 190, 164, 0.16), transparent 70%),
        var(--canvas);
    box-shadow: inset 0 0 0 1.2px rgba(23, 58, 50, 0.3),
        inset 0 0 24px rgba(23, 58, 50, 0.03);
}

.app-shell::after {
    background:
        radial-gradient(32% 25% at 18% 24%, rgba(233, 110, 84, 0.12), transparent 72%),
        radial-gradient(34% 28% at 88% 54%, rgba(147, 181, 154, 0.26), transparent 72%),
        radial-gradient(26% 22% at 52% 92%, rgba(217, 168, 97, 0.13), transparent 72%);
    filter: blur(24px);
}

.app-shell::before {
    opacity: 0.8;
}

.app-header {
    border-bottom: 1px solid rgba(23, 58, 50, 0.17);
    background: linear-gradient(180deg, rgba(247, 235, 216, 0.94), rgba(242, 228, 207, 0.82));
    box-shadow: 0 10px 26px -24px rgba(23, 58, 50, 0.45),
        inset 0 -1px 0 rgba(255, 255, 255, 0.36);
    -webkit-backdrop-filter: blur(22px) saturate(1.3);
    backdrop-filter: blur(22px) saturate(1.3);
}

.app-header.is-stuck {
    background: rgba(247, 235, 216, 0.97);
}

.brand-tagline {
    color: #496054;
    font-weight: 700;
}

.header-leaf {
    opacity: 0.54;
}

.bottom-nav {
    border-color: rgba(23, 58, 50, 0.24);
    background: linear-gradient(180deg, rgba(252, 244, 227, 0.9), rgba(244, 230, 209, 0.82));
    box-shadow: 0 20px 44px -24px rgba(23, 58, 50, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.nav-active-pill {
    border-color: rgba(255, 255, 255, 0.65);
    background: linear-gradient(180deg, rgba(255, 247, 233, 0.92), rgba(248, 221, 209, 0.82));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 7px 16px -12px rgba(189, 75, 54, 0.7);
}

.nav-item.active {
    color: var(--coral-strong);
}

.nav-item.active .ui-icon {
    --icon-fill: #f5c8b7;
    --icon-accent: #c14e38;
}

.card,
.task-card,
.calorie-card,
.challenge-card,
.exercise-panel,
.coach-chat,
.style-switch,
.coach-context,
.auth-card,
.post-card,
.group-card,
.history-day,
.settings-card,
.profile-hero,
.profile-info,
.chart-card,
.ai-advice-card,
.plan-card {
    border-color: rgba(23, 58, 50, 0.24);
    background: linear-gradient(160deg, rgba(253, 246, 232, 0.98), rgba(247, 234, 214, 0.96));
    box-shadow: 0 2px 0 rgba(23, 58, 50, 0.05),
        0 22px 44px -34px rgba(23, 58, 50, 0.44),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
    -webkit-backdrop-filter: blur(16px) saturate(1.18);
    backdrop-filter: blur(16px) saturate(1.18);
}

.calorie-card {
    background:
        radial-gradient(75% 66% at 100% 4%, rgba(233, 110, 84, 0.13), transparent 65%),
        linear-gradient(155deg, rgba(253, 245, 229, 0.99), rgba(249, 235, 215, 0.96));
}

.challenge-card {
    background:
        radial-gradient(100% 90% at 100% 0%, rgba(233, 110, 84, 0.14), transparent 58%),
        linear-gradient(158deg, rgba(252, 238, 222, 0.99), rgba(247, 222, 209, 0.96));
}

.exercise-panel,
.task-card {
    background:
        radial-gradient(100% 80% at 100% 0%, rgba(233, 110, 84, 0.08), transparent 52%),
        linear-gradient(155deg, rgba(241, 247, 235, 0.98), rgba(222, 235, 221, 0.94));
}

.card--sage,
.coach-context {
    background: linear-gradient(155deg, rgba(229, 239, 224, 0.96), rgba(208, 226, 211, 0.9));
}

.card--coral {
    background: linear-gradient(155deg, rgba(253, 238, 226, 0.98), rgba(246, 218, 204, 0.92));
}

.post-card {
    background: linear-gradient(160deg, rgba(253, 246, 232, 0.99), rgba(247, 234, 214, 0.97));
}

.chip {
    border-color: rgba(23, 58, 50, 0.2);
    background: rgba(255, 249, 236, 0.78);
}

.chip--sage {
    border-color: rgba(23, 58, 50, 0.1);
    background: #d7e5d3;
}

.chip--coral {
    border-color: rgba(189, 75, 54, 0.14);
    background: #f8ddd1;
}

.btn-primary {
    border-color: rgba(120, 46, 31, 0.3);
    background: linear-gradient(180deg, #eb795d 0%, #d95b42 100%);
    box-shadow: 0 10px 18px -12px rgba(176, 73, 51, 0.7),
        inset 0 1px 0 rgba(255, 255, 255, 0.26);
}

.btn-secondary {
    border-color: rgba(23, 58, 50, 0.26);
    background: rgba(253, 246, 232, 0.86);
}

.field {
    border-color: rgba(23, 58, 50, 0.24);
    background: rgba(253, 246, 232, 0.82);
}

.meal-thumb {
    /* Use background-color only: the shorthand was resetting background-size
       to auto and breaking uploaded meal photos in 50px thumbnails. */
    background-color: #f0e0c5;
    background-size: cover;
    background-position: center;
}

.meal-thumb.has-image {
    background-size: cover;
    background-position: center;
}

.meal-thumb__art {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.meal-thumb.has-image .meal-thumb__art {
    display: none;
}

.page-illu,
.calorie-illu {
    opacity: 0.98;
}

.calorie-illu {
    opacity: 0.9;
}

.ai-avatar {
    border-color: rgba(23, 58, 50, 0.32);
    box-shadow: 0 7px 14px -12px rgba(23, 58, 50, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.ai-online {
    color: #4b7458;
}

/* Keep a little native-grain texture over the warmer paper. */
body::before {
    opacity: 0.74;
}

@media (prefers-reduced-transparency: reduce) {
    .card,
    .task-card,
    .calorie-card,
    .challenge-card,
    .exercise-panel,
    .coach-chat,
    .style-switch,
    .coach-context,
    .auth-card,
    .post-card,
    .group-card,
    .history-day,
    .settings-card,
    .profile-hero,
    .profile-info,
    .chart-card,
    .ai-advice-card,
    .plan-card {
        background: var(--surface);
    }
}

/* Slightly bolder ink line so the paper cards read like the reference boards. */
.card,
.task-card,
.calorie-card,
.challenge-card,
.exercise-panel,
.coach-chat,
.style-switch,
.coach-context,
.auth-card,
.post-card,
.group-card,
.history-day,
.settings-card,
.profile-hero,
.profile-info,
.chart-card,
.ai-advice-card,
.plan-card {
    border-width: 1.4px;
    border-color: rgba(23, 58, 50, 0.28);
    box-shadow: 3px 4px 0 rgba(23, 58, 50, 0.045),
        0 22px 44px -34px rgba(23, 58, 50, 0.44),
        inset 0 1px 0 rgba(255, 255, 255, 0.66);
}

.app-shell {
    box-shadow: inset 0 0 0 1.5px rgba(23, 58, 50, 0.5),
        inset 0 0 24px rgba(23, 58, 50, 0.03);
}

.bottom-nav {
    border-color: rgba(23, 58, 50, 0.3);
}

/* ==========================================================================
   Group check-in board — reference sticker-card layout
   ========================================================================== */
.group-page {
    display: grid;
    gap: 14px;
}

.group-success-stack {
    display: grid;
    gap: 7px;
}

.group-success-flash {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    margin: 0;
    padding: 9px 12px;
    border: 1px solid rgba(60, 112, 73, 0.22);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(225, 239, 218, 0.92), rgba(208, 228, 203, 0.8));
    color: #315c40;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 0 rgba(23, 58, 50, 0.035);
}

.group-success-icon {
    display: grid;
    width: 21px;
    height: 21px;
    flex: none;
    place-items: center;
    border-radius: 50%;
    background: #5f8a67;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}

.group-heading {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    padding: 2px 0 12px;
}

.group-heading__copy {
    min-width: 0;
}

.group-heading .eyebrow {
    margin-bottom: 5px;
}

.group-heading h1 {
    margin: 0;
    color: var(--ink);
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.05em;
    line-height: 1.12;
}

.group-heading p {
    margin-top: 5px;
    color: var(--ink-soft);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.group-heading__art {
    width: 138px;
    height: auto;
    flex: none;
    margin: -92px -10px 0 0;
    opacity: 0.94;
    pointer-events: none;
}

.group-board {
    position: relative;
    display: grid;
    gap: 13px;
    padding: 17px 16px 15px;
    overflow: hidden;
    border: 1.4px solid rgba(23, 58, 50, 0.26);
    border-radius: 28px;
    background:
        radial-gradient(100% 62% at 100% 0%, rgba(233, 110, 84, 0.1), transparent 60%),
        linear-gradient(160deg, rgba(253, 246, 232, 0.99), rgba(247, 234, 214, 0.97));
    box-shadow: 3px 4px 0 rgba(23, 58, 50, 0.045),
        0 22px 44px -34px rgba(23, 58, 50, 0.44),
        inset 0 1px 0 rgba(255, 255, 255, 0.66);
}

.group-board__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.group-board__title {
    min-width: 0;
}

.group-board__name-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.group-board__name-line h2 {
    color: var(--ink);
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.2;
}

.group-board__title p {
    max-width: 280px;
    margin-top: 4px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.55;
}

.group-badge {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 1px 7px;
    border: 1px solid rgba(23, 58, 50, 0.14);
    border-radius: 999px;
    background: rgba(255, 248, 235, 0.78);
    color: var(--ink-soft);
    font-size: 8px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.group-badge--creator {
    border-color: rgba(213, 107, 83, 0.2);
    background: #f8ded2;
    color: #a84c39;
}

.group-badge--small {
    min-height: 17px;
    padding: 0 6px;
    font-size: 7.5px;
}

.group-board__hills {
    width: 84px;
    height: auto;
    flex: none;
    margin: -4px -4px 0 0;
    opacity: 0.9;
    pointer-events: none;
}

.group-progress-block {
    display: grid;
    gap: 7px;
}

.group-progress-copy {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--ink-soft);
    font-size: 10px;
    font-weight: 600;
}

.group-progress-copy strong {
    color: var(--coral-strong);
    font-size: 11.5px;
    font-weight: 800;
}

.group-progress-rate {
    color: var(--muted);
    font-size: 9.5px;
    white-space: nowrap;
}

.group-progress-rate strong {
    font-size: 10.5px;
}

.group-progress-bar {
    position: relative;
    height: 11px;
    overflow: hidden;
    border: 1px solid rgba(23, 58, 50, 0.12);
    border-radius: 999px;
    background: #eadcc4;
}

.group-progress-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #eb7b5e, #e25e43);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
    transition: width 800ms var(--spring);
}

.group-all-ribbon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 32px;
    padding: 5px 12px;
    border: 1px solid rgba(88, 128, 93, 0.24);
    border-radius: 12px;
    background: linear-gradient(100deg, #dfeccc, #cddfb9);
    color: #365d3e;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.group-all-ribbon__spark {
    color: #e2a755;
    font-size: 12px;
}

.group-members {
    display: grid;
    gap: 2px;
}

.group-member {
    display: grid;
    grid-template-columns: 43px minmax(0, 1fr) 62px;
    align-items: center;
    gap: 9px;
    min-width: 0;
    padding: 10px 8px;
    border-radius: 17px;
}

.group-member + .group-member {
    border-top: 1px dashed rgba(23, 58, 50, 0.12);
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.group-member.is-complete {
    background: rgba(228, 239, 219, 0.46);
}

.group-member__avatar {
    width: 43px;
    height: 43px;
    flex: none;
    border: 2px solid rgba(255, 250, 238, 0.94);
    border-radius: 50%;
    background: #f2e4d0;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(23, 58, 50, 0.09);
}

.group-member__main {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.group-member__name-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.group-member__name-line strong {
    overflow: hidden;
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.group-member__checks {
    display: flex;
    flex-wrap: wrap;
    gap: 3px 7px;
    align-items: center;
}

.member-check {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: var(--muted-soft);
    font-size: 8.5px;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
}

.member-check__mark {
    display: inline-grid;
    width: 11px;
    height: 11px;
    place-items: center;
    border-radius: 50%;
    background: rgba(23, 58, 50, 0.08);
    color: var(--muted-soft);
    font-size: 7px;
    line-height: 1;
}

.member-check.is-done {
    color: #4b7655;
}

.member-check.is-done .member-check__mark {
    background: #d4e4ce;
    color: #4b7655;
    font-size: 8px;
}

.member-check--exercise {
    padding-left: 1px;
}

.group-member__hints {
    overflow: hidden;
    color: #ac6958;
    font-size: 8px;
    font-weight: 600;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.group-member__reward {
    display: grid;
    justify-items: center;
    gap: 2px;
    min-width: 0;
}

.group-member__reward-label {
    color: var(--muted-soft);
    font-size: 7.5px;
    font-weight: 600;
    line-height: 1.2;
}

.group-member__expression {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fbf3e2;
    object-fit: cover;
    filter: drop-shadow(0 7px 9px rgba(23, 58, 50, 0.12));
    pointer-events: none;
    animation: group-expression-pop 400ms var(--spring) both;
}

.group-member__done {
    color: #4b7655;
    font-size: 8px;
    font-weight: 700;
    line-height: 1.2;
}

.group-member__empty-expression {
    width: 48px;
    height: 48px;
    color: rgba(23, 58, 50, 0.28);
}

.group-member__waiting {
    color: var(--muted-soft);
    font-size: 8px;
    font-weight: 600;
    line-height: 1.2;
}

.group-note {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 1px;
    padding: 9px 11px;
    border: 1px solid rgba(83, 125, 88, 0.13);
    border-radius: 15px;
    background: rgba(221, 235, 214, 0.56);
}

.group-note > img {
    width: 46px;
    height: 40px;
    flex: none;
    object-fit: contain;
}

.group-note > div {
    display: grid;
    min-width: 0;
    gap: 1px;
}

.group-note strong {
    color: #3f6a47;
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1.35;
}

.group-note small {
    color: var(--muted);
    font-size: 8.5px;
    line-height: 1.45;
}

.group-note--done {
    border-color: rgba(204, 155, 74, 0.18);
    background: linear-gradient(100deg, #f8edce, #e8f0d8);
}

.group-note--done > img {
    width: 43px;
    height: 43px;
    border: 2px solid rgba(255, 250, 238, 0.8);
    border-radius: 50%;
    object-fit: cover;
}

.group-note--done strong {
    color: #7d622d;
}

.group-note__spark {
    margin-left: auto;
    color: #d8a454;
    font-size: 17px;
}

.group-note--waiting {
    background: rgba(238, 241, 218, 0.6);
}

.group-empty {
    display: grid;
    justify-items: start;
    gap: 7px;
}

.group-empty__art {
    width: 150px;
    height: auto;
    margin-bottom: -2px;
}

.group-empty h2 {
    color: var(--ink);
    font-size: 19px;
    font-weight: 800;
}

.group-empty p {
    max-width: 330px;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.65;
}

.group-page .discover-list {
    margin-top: 0;
}

@keyframes group-expression-pop {
    0% { opacity: 0; transform: scale(0.7) translateY(4px); }
    70% { opacity: 1; transform: scale(1.04) translateY(-1px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@media (hover: hover) and (pointer: fine) {
    .group-member.is-complete:hover .group-member__expression {
        filter: drop-shadow(0 9px 12px rgba(207, 123, 80, 0.22));
        transform: translateY(-1px);
    }
}

@media (max-width: 380px) {
    .group-heading h1 {
        font-size: 27px;
    }

    .group-heading__art {
        width: 112px;
        margin-right: -12px;
    }

    .group-board {
        padding: 15px 13px 13px;
        border-radius: 25px;
    }

    .group-board__name-line h2 {
        font-size: 17.5px;
    }

    .group-board__hills {
        width: 66px;
    }

    .group-member {
        grid-template-columns: 39px minmax(0, 1fr) 57px;
        gap: 7px;
        padding: 9px 6px;
    }

    .group-member__avatar {
        width: 39px;
        height: 39px;
    }

    .group-member__expression {
        width: 52px;
        height: 52px;
    }

    .group-member__empty-expression {
        width: 44px;
        height: 44px;
    }

    .member-check {
        font-size: 8px;
    }

    .group-member__hints {
        font-size: 7.5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .group-member__expression {
        animation: none;
    }

    .group-progress-bar span {
        transition: none;
    }
}

/* Feather the illustration edges into the paper instead of showing a hard art box. */
.group-heading__art,
.group-board__hills,
.group-empty__art {
    -webkit-mask-image: radial-gradient(ellipse 74% 68% at 50% 54%, #000 58%, transparent 100%);
    mask-image: radial-gradient(ellipse 74% 68% at 50% 54%, #000 58%, transparent 100%);
}

/* Blend the watercolor group scenery into the warm paper. */
.group-heading__art,
.group-board__hills,
.group-empty__art {
    mix-blend-mode: multiply;
}

/* ==========================================================================
   Group management
   ========================================================================== */
.group-manage-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    min-height: 21px;
    padding: 1px 7px 1px 5px;
    border: 1px solid rgba(23, 58, 50, 0.18);
    border-radius: 999px;
    background: rgba(255, 249, 236, 0.72);
    color: var(--ink-soft);
    font-size: 8px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.group-manage-link .ui-icon {
    width: 11px;
    height: 11px;
    --icon-fill: transparent;
}

.group-manage-link:hover {
    border-color: var(--coral);
    color: var(--coral-strong);
}

.group-manage-page {
    display: grid;
    gap: 13px;
}

.manage-heading {
    padding: 0 2px 3px;
}

.manage-heading .eyebrow {
    margin-bottom: 5px;
}

.manage-heading h1 {
    color: var(--ink);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.045em;
}

.manage-heading p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
}

.manage-flash-stack {
    gap: 6px;
}

.manage-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    border-radius: 24px;
}

.manage-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.manage-card__head h2 {
    color: var(--ink);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.manage-card__head p {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9.5px;
    line-height: 1.55;
}

.manage-form {
    display: grid;
    gap: 12px;
}

.manage-form .form-group {
    margin: 0;
}

.manage-form .btn {
    justify-self: start;
}

.manage-credentials {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.manage-credentials > div {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid rgba(23, 58, 50, 0.11);
    border-radius: 13px;
    background: rgba(255, 249, 236, 0.62);
}

.manage-credential__label {
    color: var(--muted-soft);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.manage-credentials strong {
    overflow: hidden;
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.manage-invite__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.manage-invite__actions form {
    display: contents;
}

.manage-member-list {
    display: grid;
    gap: 2px;
}

.manage-member {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    padding: 9px 5px;
}

.manage-member + .manage-member {
    border-top: 1px dashed rgba(23, 58, 50, 0.11);
}

.manage-member__avatar {
    width: 38px;
    height: 38px;
    flex: none;
    border: 2px solid rgba(255, 250, 238, 0.9);
    border-radius: 50%;
    background: #f2e4d0;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(23, 58, 50, 0.08);
}

.manage-member__info {
    display: grid;
    flex: 1;
    gap: 2px;
    min-width: 0;
}

.manage-member__name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.manage-member__name strong {
    overflow: hidden;
    color: var(--ink);
    font-size: 11.5px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.manage-member__info small {
    color: var(--muted-soft);
    font-size: 8.5px;
}

.manage-member__owner {
    flex: none;
    color: var(--coral-strong);
    font-size: 8.5px;
    font-weight: 800;
}

.manage-remove-btn {
    min-height: 26px;
    padding: 0 9px;
    border: 1px solid rgba(201, 95, 85, 0.2);
    border-radius: 999px;
    background: rgba(248, 221, 209, 0.52);
    color: #a84c39;
    font: inherit;
    font-size: 8.5px;
    font-weight: 800;
    cursor: pointer;
}

.manage-remove-btn:hover {
    background: #f6d4c6;
}

.manage-empty {
    color: var(--muted);
    font-size: 10px;
}

.manage-danger {
    border-color: rgba(201, 95, 85, 0.28);
    background: linear-gradient(155deg, rgba(253, 241, 232, 0.96), rgba(248, 225, 213, 0.8));
}

.manage-danger .manage-card__head h2 {
    color: var(--coral-strong);
}

.manage-danger-form {
    display: grid;
    gap: 10px;
}

.manage-danger-form .form-group {
    margin: 0;
}

.manage-delete-btn {
    justify-self: start;
    border: 1px solid rgba(201, 95, 85, 0.32);
    background: #fff8f2;
    color: #a84c39;
    box-shadow: none;
}

.manage-delete-btn:hover {
    background: #f8ddd1;
}

/* Profile hero is itself a link to basic information. */
a.profile-hero {
    color: inherit;
    text-decoration: none;
}

a.profile-hero:focus-visible {
    outline: 2px solid var(--coral);
    outline-offset: 2px;
}

@media (max-width: 380px) {
    .manage-card {
        padding: 13px;
    }

    .manage-credentials {
        grid-template-columns: 1fr;
    }

    .manage-heading h1 {
        font-size: 25px;
    }
}


/* Anchor destination for the profile summary card. */
#profileInfo {
    scroll-margin-top: 84px;
}

/* ==========================================================================
   Tone experiment — mist blue paper, cool cream cards, apricot accents
   ========================================================================== */
:root {
    --canvas: #dbe5e3;
    --canvas-deep: #ccdad8;
    --surface: #f8f4e8;
    --surface-soft: #f1ecdf;
    --surface-tint: #e8e3d6;
    --ink: #1f3a35;
    --ink-soft: #3f5a51;
    --muted: #60706b;
    --muted-soft: #7b8580;
    --coral: #d47a50;
    --coral-strong: #a94b2f;
    --coral-deep: #99432a;
    --coral-soft: #f2dccd;
    --sage: #cbd9c6;
    --sage-soft: #e4ecdf;
    --sage-deep: #b2c6b2;
    --gold: #d4a45e;
    --line: rgba(31, 58, 53, 0.22);
    --line-strong: rgba(31, 58, 53, 0.34);
    --glass: rgba(248, 244, 232, 0.82);
    --glass-strong: rgba(248, 244, 232, 0.95);
}

body {
    background:
        radial-gradient(900px 620px at 7% -8%, rgba(250, 247, 238, 0.9), transparent 60%),
        radial-gradient(760px 620px at 104% 18%, rgba(196, 216, 214, 0.64), transparent 66%),
        radial-gradient(820px 720px at 47% 108%, rgba(202, 217, 198, 0.54), transparent 64%),
        var(--canvas-deep);
}

.app-shell {
    background:
        radial-gradient(70% 45% at 9% 3%, rgba(249, 246, 237, 0.62), transparent 62%),
        radial-gradient(55% 40% at 97% 34%, rgba(212, 122, 80, 0.08), transparent 66%),
        radial-gradient(62% 42% at 0% 88%, rgba(155, 181, 176, 0.18), transparent 70%),
        var(--canvas);
}

.app-shell::after {
    background:
        radial-gradient(32% 25% at 18% 22%, rgba(212, 122, 80, 0.08), transparent 72%),
        radial-gradient(34% 28% at 88% 52%, rgba(135, 166, 164, 0.28), transparent 72%),
        radial-gradient(26% 22% at 52% 92%, rgba(203, 217, 198, 0.26), transparent 72%);
}

.app-header {
    border-bottom-color: rgba(31, 58, 53, 0.17);
    background: linear-gradient(180deg, rgba(239, 243, 235, 0.95), rgba(230, 237, 231, 0.84));
    box-shadow: 0 10px 26px -24px rgba(31, 58, 53, 0.45),
        inset 0 -1px 0 rgba(255, 255, 255, 0.34);
}

.app-header.is-stuck {
    background: rgba(239, 243, 235, 0.98);
}

.brand-tagline {
    color: #47615a;
}

.bottom-nav {
    border-color: rgba(31, 58, 53, 0.26);
    background: linear-gradient(180deg, rgba(247, 243, 232, 0.92), rgba(232, 238, 231, 0.86));
    box-shadow: 0 20px 44px -24px rgba(31, 58, 53, 0.44),
        inset 0 1px 0 rgba(255, 255, 255, 0.66);
}

.nav-active-pill {
    background: linear-gradient(180deg, rgba(250, 242, 231, 0.96), rgba(242, 220, 205, 0.86));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 7px 16px -12px rgba(157, 82, 53, 0.62);
}

.nav-item.active {
    color: var(--coral-strong);
}

.nav-item.active .ui-icon {
    --icon-fill: #edc9b3;
    --icon-accent: #a94b2f;
}

.card,
.task-card,
.calorie-card,
.challenge-card,
.exercise-panel,
.coach-chat,
.style-switch,
.coach-context,
.auth-card,
.post-card,
.group-card,
.history-day,
.settings-card,
.profile-hero,
.profile-info,
.chart-card,
.ai-advice-card,
.plan-card {
    border-color: rgba(31, 58, 53, 0.26);
    background: linear-gradient(160deg, rgba(250, 247, 238, 0.98), rgba(240, 236, 225, 0.96));
    box-shadow: 3px 4px 0 rgba(31, 58, 53, 0.045),
        0 22px 44px -34px rgba(31, 58, 53, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.66);
}

.calorie-card {
    background:
        radial-gradient(75% 66% at 100% 4%, rgba(212, 122, 80, 0.11), transparent 65%),
        linear-gradient(155deg, rgba(250, 246, 236, 0.99), rgba(239, 235, 223, 0.96));
}

.challenge-card {
    background:
        radial-gradient(100% 90% at 100% 0%, rgba(212, 122, 80, 0.12), transparent 58%),
        linear-gradient(158deg, rgba(249, 240, 229, 0.99), rgba(238, 231, 220, 0.96));
}

.exercise-panel,
.task-card {
    background:
        radial-gradient(100% 80% at 100% 0%, rgba(212, 122, 80, 0.07), transparent 52%),
        linear-gradient(155deg, rgba(239, 245, 235, 0.98), rgba(219, 231, 218, 0.94));
}

.card--sage,
.coach-context {
    background: linear-gradient(155deg, rgba(229, 238, 225, 0.96), rgba(207, 222, 210, 0.9));
}

.card--coral {
    background: linear-gradient(155deg, rgba(250, 238, 228, 0.98), rgba(241, 220, 205, 0.92));
}

.post-card {
    background: linear-gradient(160deg, rgba(250, 247, 238, 0.99), rgba(240, 236, 225, 0.97));
}

.chip {
    border-color: rgba(31, 58, 53, 0.2);
    background: rgba(251, 248, 238, 0.8);
}

.chip--sage {
    border-color: rgba(31, 58, 53, 0.1);
    background: #d5e3d0;
}

.chip--coral {
    border-color: rgba(169, 75, 47, 0.14);
    background: #f2dccd;
}

.btn-primary {
    border-color: rgba(115, 52, 30, 0.3);
    background: linear-gradient(180deg, #da8358 0%, #c56740 100%);
    box-shadow: 0 10px 18px -12px rgba(154, 71, 42, 0.66),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-secondary {
    border-color: rgba(31, 58, 53, 0.26);
    background: rgba(250, 247, 238, 0.88);
}

.field {
    border-color: rgba(31, 58, 53, 0.24);
    background: rgba(250, 247, 238, 0.84);
}

.meal-thumb {
    background-color: #e9e4d5;
}

.date-chip {
    background: rgba(248, 244, 232, 0.65);
}

.coach-nudge {
    border-color: rgba(31, 58, 53, 0.16);
    background: rgba(250, 247, 238, 0.82);
}

.group-board {
    border-color: rgba(31, 58, 53, 0.27);
    background:
        radial-gradient(100% 62% at 100% 0%, rgba(212, 122, 80, 0.09), transparent 60%),
        linear-gradient(160deg, rgba(250, 247, 238, 0.99), rgba(239, 235, 224, 0.97));
    box-shadow: 3px 4px 0 rgba(31, 58, 53, 0.045),
        0 22px 44px -34px rgba(31, 58, 53, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.group-progress-bar {
    border-color: rgba(31, 58, 53, 0.12);
    background: #dde2d8;
}

.group-member.is-complete {
    background: rgba(220, 235, 217, 0.46);
}

.group-note {
    border-color: rgba(93, 126, 102, 0.15);
    background: rgba(218, 232, 214, 0.6);
}

.group-note--done {
    border-color: rgba(164, 122, 56, 0.18);
    background: linear-gradient(100deg, #f2e9cd, #e1ecd7);
}

.manage-danger {
    background: linear-gradient(155deg, rgba(250, 238, 230, 0.96), rgba(240, 219, 207, 0.8));
}

.ambient-blob--sage {
    background: rgba(151, 181, 174, 0.24);
}

.ambient-blob--coral {
    background: rgba(212, 122, 80, 0.1);
}

/* Keep the experiment warm enough to preserve the food illustrations. */
.page-illu,
.calorie-illu,
.group-heading__art {
    mix-blend-mode: multiply;
}

/* ==========================================================================
   Artwork pack integration
   ========================================================================== */
.header-leaf {
    background-image: url("../img/artwork/decor/decor-leaf-branch.png");
}

.calorie-card__leaf {
    background-image: url("../img/artwork/decor/decor-leaf-branch.png");
}

.auth-leaf {
    object-fit: contain;
}

.auth-illustration img {
    object-fit: contain;
}

.page-illu--notebook {
    width: 122px;
}

.group-heading__art,
.group-board__hills,
.group-empty__art {
    -webkit-mask-image: none;
    mask-image: none;
    mix-blend-mode: normal;
}

.group-heading__art {
    width: 142px;
    margin-top: -66px;
}

.group-board__hills {
    width: 92px;
    margin-top: -2px;
}

.group-note > img {
    width: 50px;
    height: 44px;
    border-radius: 0;
    object-fit: contain;
}

.group-member__avatar,
.manage-member__avatar,
.profile-hero__avatar {
    object-fit: cover;
}

.post-avatar--image,
.comment-avatar--image {
    object-fit: cover;
    background: #f2e0cf;
}

.post-avatar--image {
    border: 1px solid rgba(23, 58, 50, 0.1);
}

.comment-avatar--image {
    border: 1px solid rgba(23, 58, 50, 0.08);
}

.empty-art {
    display: block;
    width: 170px;
    max-width: 76%;
    height: auto;
    margin: 0 auto 8px;
    object-fit: contain;
}

.empty-art--small {
    width: 130px;
    margin-bottom: 4px;
}

.exercise-start-art {
    width: 27px;
    height: 27px;
    flex: none;
    object-fit: contain;
    margin-right: 1px;
}

.ai-avatar::before {
    display: none;
}

.ai-avatar {
    background: #f2dfce;
    border-color: rgba(23, 58, 50, 0.26);
}

.ai-avatar img {
    background: transparent;
}

/* Keep the creator manage action compact so long group names do not wrap. */
.group-manage-link {
    width: 22px;
    height: 22px;
    min-height: 22px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
}

.group-manage-link .ui-icon {
    width: 12px;
    height: 12px;
}

.group-board__name-line {
    flex-wrap: wrap;
}

.group-board__name-line h2 {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Community feed tabs: keep the control transparent, no colored pill/background. */
.feed-tabs {
    gap: 4px;
    padding: 0;
    border: 0;
    background: transparent;
}

.feed-tabs .tab-indicator {
    display: none;
}

.feed-tabs .tab {
    min-height: 38px;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
}

.feed-tabs .tab.active {
    color: var(--ink);
    font-weight: 800;
}

/* Profile edit: avatar and nickname */
.profile-edit-avatar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border: 1px solid rgba(31, 58, 53, 0.12);
    border-radius: 20px;
    background: rgba(255, 249, 238, 0.58);
}

.profile-edit-avatar__preview {
    width: 84px;
    height: 84px;
    flex: none;
    border: 2px solid rgba(255, 250, 240, 0.92);
    border-radius: 50%;
    background: var(--sage-soft);
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(31, 58, 53, 0.1), 0 8px 16px -14px rgba(31, 58, 53, 0.4);
}

.profile-edit-avatar__copy {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.profile-edit-avatar__copy strong {
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
}

.profile-edit-avatar__copy p {
    color: var(--muted);
    font-size: 9px;
    line-height: 1.5;
}

.profile-avatar-input {
    display: none;
}

.profile-avatar-picker {
    justify-self: start;
    margin-top: 3px;
    cursor: pointer;
}

.profile-avatar-picker .ui-icon {
    width: 14px;
    height: 14px;
}

.profile-avatar-remove {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 1px;
    color: var(--muted);
    font-size: 8.5px;
    cursor: pointer;
}

.profile-avatar-remove input {
    accent-color: var(--coral);
}

@media (max-width: 380px) {
    .profile-edit-avatar {
        gap: 10px;
        padding: 10px;
    }

    .profile-edit-avatar__preview {
        width: 70px;
        height: 70px;
    }
}

/* Home: one-sentence AI nudge under the calorie card. */
.ai-calorie-tip {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: -2px;
    padding: 11px 13px;
    border: 1px solid rgba(31, 58, 53, 0.16);
    border-radius: 17px;
    background: linear-gradient(145deg, rgba(238, 244, 230, 0.78), rgba(247, 239, 225, 0.7));
    box-shadow: 0 2px 0 rgba(31, 58, 53, 0.035);
}

.ai-calorie-tip__icon {
    display: grid;
    width: 28px;
    height: 28px;
    flex: none;
    place-items: center;
    border-radius: 50%;
    background: #dce8d2;
    color: var(--coral-strong);
}

.ai-calorie-tip__icon .ui-icon {
    width: 15px;
    height: 15px;
    --icon-fill: transparent;
}

.ai-calorie-tip__copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.ai-calorie-tip__label {
    color: var(--coral-strong);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.ai-calorie-tip__copy p {
    color: var(--ink-soft);
    font-size: 10.5px;
    line-height: 1.55;
}

/* Both exercise actions use the same sage color scheme (no yellow/orange). */
.exercise-actions .start-btn,
.exercise-actions .start-btn.btn-primary,
.exercise-actions .start-btn.btn-secondary {
    border: 1px solid rgba(31, 58, 53, 0.24);
    background: linear-gradient(160deg, #6f8c72, #55745c);
    color: #fffdf4;
    box-shadow: 0 8px 16px -12px rgba(31, 58, 53, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.exercise-actions .start-btn:hover,
.exercise-actions .start-btn.btn-primary:hover,
.exercise-actions .start-btn.btn-secondary:hover {
    border-color: rgba(31, 58, 53, 0.34);
    background: linear-gradient(160deg, #7b987d, #5f8066);
    color: #fffdf4;
}

/* Management pages: avoid long programmatic smooth scrolling when jumping to controls. */
.app-main {
    scroll-behavior: auto;
}

.manage-remove-btn {
    min-height: 30px;
    padding: 0 11px;
    font-size: 9px;
    white-space: nowrap;
}

#manageMembersTitle {
    scroll-margin-top: 84px;
}

/* Community feed tabs: transparent frosted-glass capsules, still no colored fill. */
.feed-tabs {
    gap: 7px;
    padding: 0;
    border: 0;
    background: transparent;
}

.feed-tabs .tab-indicator {
    display: none;
}

.feed-tabs .tab {
    min-height: 40px;
    border: 1px solid rgba(31, 58, 53, 0.13);
    border-radius: 999px;
    background: rgba(255, 252, 244, 0.2);
    color: var(--muted);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38),
        0 10px 24px -22px rgba(31, 58, 53, 0.42);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    backdrop-filter: blur(20px) saturate(1.3);
}

.feed-tabs .tab:hover {
    border-color: rgba(31, 58, 53, 0.2);
    background: rgba(255, 252, 244, 0.3);
}

.feed-tabs .tab.active {
    border-color: rgba(31, 58, 53, 0.2);
    background: rgba(255, 252, 244, 0.4);
    color: var(--ink);
    font-weight: 800;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58),
        0 12px 22px -20px rgba(31, 58, 53, 0.5);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .feed-tabs .tab {
        background: rgba(255, 252, 244, 0.78);
    }
}

@media (prefers-reduced-transparency: reduce) {
    .feed-tabs .tab {
        background: var(--surface-soft);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}

/* Artwork-pack app icons: coach styles and the exercise panel. */
.agent-option__icon {
    width: 27px;
    height: 27px;
    flex: none;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 3px 7px -5px rgba(31, 58, 53, 0.55);
    pointer-events: none;
}

.agent-option.active .agent-option__icon {
    border-color: rgba(255, 255, 255, 0.68);
    box-shadow: 0 4px 9px -5px rgba(91, 36, 22, 0.5);
}

.exercise-panel__icon {
    width: 46px;
    height: 46px;
    flex: none;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 5px 12px -10px rgba(31, 58, 53, 0.55);
}

@media (max-width: 380px) {
    .agent-option__icon {
        width: 24px;
        height: 24px;
        border-radius: 7px;
    }

    .exercise-panel__icon {
        width: 42px;
        height: 42px;
        border-radius: 13px;
    }
}
