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

body {
    font-family: 'Space Grotesk', sans-serif;
    background: #fafafa;
    color: #1a1a1a;
    min-height: 100vh;
    overflow-x: hidden;
}

.back-link {
    position: fixed;
    top: 20px;
    left: 20px;
    text-decoration: none;
    color: #aaa;
    font-size: 14px;
    font-weight: 400;
    z-index: 100;
    transition: color 0.2s;
}

.back-link:hover {
    color: #555;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 60px 20px 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header {
    text-align: center;
    margin-bottom: 40px;
}

.title {
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 15px;
    color: #888;
    font-weight: 300;
}

/* Birthday input */
.input-section {
    text-align: center;
    margin-bottom: 36px;
    transition: opacity 0.4s ease;
}

.input-section.faded {
    opacity: 0.4;
}

.input-label {
    display: block;
    font-size: 14px;
    color: #999;
    margin-bottom: 10px;
    font-weight: 400;
}

.date-selects {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.date-select {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 15px;
    padding: 10px 12px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #1a1a1a;
    outline: none;
    transition: border-color 0.2s;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.date-select:focus {
    border-color: #999;
}

.go-btn {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 15px;
    font-weight: 500;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: #1a1a1a;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.go-btn:hover {
    background: #333;
}

.go-btn:active {
    transform: scale(0.97);
}

/* Event markers */
.week.has-event::after {
    content: '';
    position: absolute;
    top: -1px;
    right: -1px;
    width: 5px;
    height: 5px;
    background: #f43f5e;
    transform: rotate(45deg);
    z-index: 3;
    pointer-events: none;
}

.week.has-event {
    z-index: 3;
}

/* Grid */
.grid-wrapper {
    width: 100%;
    position: relative;
}

.column-label {
    text-align: right;
    font-size: 10px;
    color: #ccc;
    margin-bottom: 4px;
    padding-right: 2px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.grid-container {
    display: flex;
    gap: 0;
    width: 100%;
}

.age-labels {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    padding-right: 6px;
    width: 52px;
}

.age-label {
    font-size: 9px;
    color: #bbb;
    font-weight: 400;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    white-space: nowrap;
}

.age-label .milestone {
    color: #999;
    font-size: 8px;
    margin-right: 4px;
    font-weight: 400;
}

.grid {
    display: grid;
    grid-template-columns: repeat(52, 1fr);
    gap: 1.5px;
    flex: 1;
    min-width: 0;
}

.week {
    aspect-ratio: 1;
    border-radius: 1.5px;
    background: transparent;
    border: 1px solid #e5e5e5;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
    position: relative;
}

.week.lived {
    border-color: transparent;
    opacity: 0;
    transform: scale(0);
}

.week.lived.revealed {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.week.current {
    border-color: transparent;
    animation: pulse 2s ease-in-out infinite;
    z-index: 2;
    border-radius: 2px;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
        transform: scale(1.3);
    }
}

.week:hover {
    transform: scale(2.2);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.week.current:hover {
    animation: none;
}

/* Tooltip */
.tooltip {
    position: fixed;
    background: #1a1a1a;
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 1000;
    font-weight: 400;
    max-width: 320px;
    line-height: 1.4;
}

.tooltip.visible {
    opacity: 1;
}

/* Stats */
.stats {
    margin-top: 48px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.stats.visible {
    opacity: 1;
}

.stat-line {
    font-size: 15px;
    color: #666;
    margin-bottom: 6px;
    font-weight: 300;
}

.stat-line strong {
    color: #1a1a1a;
    font-weight: 600;
}

.stat-line.subtle {
    font-size: 13px;
    color: #aaa;
    margin-top: 16px;
}

/* Mobile */
@media (max-width: 600px) {
    .container {
        padding: 40px 12px 60px;
    }

    .title {
        font-size: 24px;
    }

    .subtitle {
        font-size: 13px;
    }

    .grid {
        gap: 1px;
    }

    .week {
        border-radius: 1px;
    }

    .age-labels {
        width: 40px;
        padding-right: 4px;
    }

    .age-label {
        font-size: 7px;
    }

    .age-label .milestone {
        font-size: 6px;
    }

    .column-label {
        font-size: 8px;
    }

    .back-link {
        top: 12px;
        left: 12px;
        font-size: 12px;
    }

    .stat-line {
        font-size: 13px;
    }

    .stat-line.subtle {
        font-size: 11px;
    }

    .date-select {
        font-size: 13px;
        padding: 8px 10px;
        padding-right: 24px;
    }

    .go-btn {
        font-size: 13px;
        padding: 8px 16px;
    }

    .week.has-event::after {
        width: 4px;
        height: 4px;
    }

    @keyframes pulse {
        0%, 100% {
            box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.4);
            transform: scale(1);
        }
        50% {
            box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.1);
            transform: scale(1.2);
        }
    }

    .week:hover {
        transform: scale(1.8);
    }
}
