.lifecal-page {
    max-width: 900px;
    margin: 0 auto;
}

/* ── Intro ── */

.lifecal-intro {
    margin-bottom: 20px;
}

.lifecal-intro h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--text-primary);
}

.lifecal-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 20px;
    max-width: 520px;
}

.lifecal-form {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
}

.lifecal-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lifecal-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.lifecal-input {
    padding: 10px 16px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, .04);
    color: var(--text-primary);
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    outline: none;
    transition: border-color .2s;
    color-scheme: dark;
}

.lifecal-input:focus {
    border-color: var(--emerald);
}

.lifecal-go-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #34d399, #059669);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all .25s;
}

.lifecal-go-btn svg {
    width: 18px;
    height: 18px;
}

.lifecal-go-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(52, 211, 153, .25);
}

/* ── Stats cards ── */

.lifecal-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
    animation: lcFadeIn .5s ease both;
}

@keyframes lcFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.lifecal-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 18px 12px !important;
    text-align: center;
}

.lcs-icon-svg {
    width: 22px;
    height: 22px;
    stroke: var(--emerald-light);
    flex-shrink: 0;
}

.lcs-val {
    font-family: 'Space Mono', monospace;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.lcs-label {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Phases bar ── */

.lifecal-phases {
    margin-bottom: 20px;
    animation: lcFadeIn .5s ease .1s both;
}

.lifecal-phases h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 14px;
}

.lifecal-phases-bar {
    display: flex;
    height: 32px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}

.lifecal-phase-seg {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, .8);
    white-space: nowrap;
    overflow: hidden;
    transition: flex .3s;
}

.lifecal-phases-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
}

.lifecal-phase-leg {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.lifecal-phase-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* ── Week grid ── */

.lifecal-grid-wrap {
    margin-bottom: 20px;
    animation: lcFadeIn .5s ease .2s both;
}

.lifecal-grid-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.lifecal-grid-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.lifecal-grid-legend {
    display: flex;
    gap: 14px;
}

.lgl-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-muted);
}

.lgl-box {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.lgl-lived { background: #34d399; }
.lgl-now { background: #fbbf24; box-shadow: 0 0 6px rgba(251, 191, 36, .5); }
.lgl-future { background: rgba(255, 255, 255, .06); }

.lifecal-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5px;
    line-height: 0;
}

.lc-week {
    width: 7px;
    height: 7px;
    border-radius: 1.5px;
    background: rgba(255, 255, 255, .05);
    transition: transform .15s;
}

.lc-week.lived {
    background: #34d399;
}

.lc-week.now {
    background: #fbbf24;
    box-shadow: 0 0 4px rgba(251, 191, 36, .6);
    animation: lcPulse 2s ease-in-out infinite;
}

@keyframes lcPulse {
    0%, 100% { box-shadow: 0 0 4px rgba(251, 191, 36, .6); }
    50% { box-shadow: 0 0 10px rgba(251, 191, 36, .9); }
}

.lc-week:hover {
    transform: scale(2.2);
    z-index: 2;
    position: relative;
}

/* Year markers */
.lc-year-marker {
    width: 100%;
    flex-basis: 100%;
    height: 0;
}

.lifecal-grid-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Tooltip ── */

.lc-tooltip {
    position: fixed;
    padding: 5px 10px;
    background: rgba(0, 0, 0, .85);
    color: #fff;
    font-size: 11px;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .12s;
    z-index: 100;
    white-space: nowrap;
}

.lc-tooltip.visible {
    opacity: 1;
}

/* ── Responsive ── */

@media (max-width: 768px) {
    .lifecal-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .lcs-val {
        font-size: 18px;
    }

    .lc-week {
        width: 5px;
        height: 5px;
    }

    .lifecal-grid {
        gap: 1px;
    }
}

@media (max-width: 480px) {
    .lifecal-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .lc-week {
        width: 4px;
        height: 4px;
        border-radius: 1px;
    }

    .lifecal-grid {
        gap: 0.8px;
    }

    .lifecal-form {
        flex-direction: column;
        align-items: stretch;
    }

    .lifecal-go-btn {
        justify-content: center;
    }
}
