:root {
    --cell-size: 7px;
    --cell-gap: 1px;
    --cell-border-radius: 1px;
}

body {
    margin: 1em;
    font-family: system-ui, -apple-system, sans-serif;
    background: #f7f7f7;
}

.life-calculator {
    width: 500px;
    margin: auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 20px;
    text-align: center;
}

.input-container {
    width: 420px;
    margin: 2em auto;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    font-size: 12px;
}

.input-group {
    display: flex;
    gap: 4px;
    flex-direction: row;
    align-items: center;
}

.input-group input {
    padding: 0 4px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.life-weeks {
    display: flex;
    flex-direction: column;
    margin: 18px 0;
    gap: var(--cell-gap);
    justify-content: center;
}

.life-row {
    display: flex;
    align-items: center;
    height: var(--cell-size);
    justify-content: center;
    line-height: 8px;
}

.week-cell {
    width: var(--cell-size);
    height: var(--cell-size);
    border-radius: var(--cell-border-radius);
    box-shadow: 0 0 0 var(--cell-size) inset;
}

.week-cell.past {
    color: #666;
}

.week-cell.current {
    color: #ff9800;
}

.week-cell.future {
    color: #4caf50;
}

.week-cell.elderly {
    color: #bdbdbd;
}

.milestone-cell {
    color: #e53935 !important;
}

.milestone-cell-right {
    color: #1976d2 !important;
}

.weeks-row {
    display: grid;
    grid-template-columns: repeat(52, var(--cell-size));
    gap: var(--cell-gap);
    height: var(--cell-size);
}

.timeline-label,
.timeline-empty {
    width: 50px;
    height: var(--cell-size);
    margin-right: 8px;
}

.timeline-label {
    color: #e53935;
    font-weight: bold;
    font-size: 12px;
    text-align: right;
}

.timeline-label-right,
.timeline-empty-right {
    width: 50px;
    height: var(--cell-size);
    margin-left: 8px;
    font-size: 12px;
    color: #1976d2;
}

.timeline-label-right {
    font-weight: bold;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 12px;
    margin: 10px 0;
}

.legend span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.legend .box {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    box-shadow: 0 0 0 12px inset;
}

.legend .past {
    color: #666;
}

.legend .current {
    color: #ff9800;
}

.legend .future {
    color: #4caf50;
}

.legend .elderly {
    color: #bdbdbd;
}

.tip {
    color: #888;
    font-size: 13px;
    text-align: center;
}

button {
    display: inline-block;
    margin: 0 1rem;
    padding: 4px 8px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

button:hover {
    background: #388e3c;
}

@keyframes blink {
    0% {
        filter: brightness(1.2)
    }

    50% {
        filter: brightness(.5)
    }

    100% {
        filter: brightness(1.2)
    }
}

.blink {
    animation: blink 0.5s ease-in-out infinite;
}

@media print {
    @page {
        size: A4;
        margin: 0;
    }

    body {
        background: white;
        margin: 0;
        padding: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
        overflow: hidden;
    }

    .life-calculator {
        max-width: none;
        box-shadow: none;
        padding: 0;
        margin: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
    }

    .print-button,
    .shareBtn,
    .share-modal-content,
    .input-container,
    .legend,
    .tip,
    h2 {
        display: none !important;
    }

    .blink {
        animation: none;
    }
}