:root {
    --bg-color: #f8fafc;
    --text-color: #0f172a;
    --primary-color: #6366f1;
    --grid-empty: #e2e8f0;
    --grid-filled: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --grid-gap: 2px;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background: white;
    padding: 2.5rem;
    border-radius: 1.5rem;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    max-width: 450px;
    width: 90%;
    text-align: center;
}

.secondary-btn {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    margin-top: 1rem;
    padding: 0.5rem 1rem;
}

.secondary-btn:hover {
    background-color: #f1f5f9;
}

.container {
    max-width: 1200px;
    width: 95%;
    height: 95vh;
    padding: 1rem;
    text-align: center;
    perspective: 2000px;
    display: flex;
    flex-direction: column;
}

header {
    flex-shrink: 0;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    margin-top: 0;
}

header p {
    color: #64748b;
    margin-bottom: 1rem;
}

.input-section {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

input, select {
    padding: 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.375rem;
    font-family: inherit;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    align-self: flex-end;
}

button:hover {
    background-color: #2563eb;
}

#result-info {
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    flex-shrink: 0;
}

.hidden {
    display: none;
}

.grid-layout {
    display: flex;
    gap: 0.5rem;
    flex-grow: 1;
    overflow: hidden;
    position: relative;
    justify-content: center;
    align-items: stretch;
    padding-bottom: 1rem;
}

.grid-layout:hover {
    /* Potential performance hit removed */
}

.year-labels {
    display: grid;
    grid-template-rows: repeat(80, 1fr);
    gap: var(--grid-gap);
    text-align: right;
    min-width: 15px;
    height: 100%;
}

.year-label {
    font-size: 8px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    line-height: 1;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(52, 1fr);
    grid-template-rows: repeat(80, 1fr);
    gap: var(--grid-gap);
    height: 100%;
    aspect-ratio: 52 / 80;
    perspective: 1000px;
}

.week-box {
    width: 100%;
    height: 100%;
    background-color: var(--grid-empty);
    border-radius: 1px;
    cursor: crosshair;
    /* Hardware acceleration */
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.week-box:hover {
    transform: scale(2.5) translateZ(20px);
    z-index: 10;
}

.week-box.lived {
    background: var(--grid-filled);
    animation: popIn 0.5s ease-out forwards;
    opacity: 0;
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive adjustment for the grid */
@media (max-width: 800px) {
    .grid-container {
        grid-template-columns: repeat(52, 1fr);
        grid-template-rows: repeat(80, 1fr);
    }
}

@media (max-width: 400px) {
    .grid-container {
        grid-template-columns: repeat(52, 1fr);
        grid-template-rows: repeat(80, 1fr);
    }
}
