:root {
    --bg-color: #0d0d0d;
    --text-color: #e0e0e0;
    --accent-color: #ffd700;
    /* Gold/Yellow */
    --surface-color: #1a1a1a;
    --surface-hover: #252525;
    --border-color: #333;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);

    /* Mood Colors */
    --mood-yellow: #fcd34d;
    /* Happy */
    --mood-blue: #60a5fa;
    /* Sad */
    --mood-red: #ef4444;
    /* Angry */
    --mood-green: #4ade80;
    /* Calm */
    --mood-purple: #a78bfa;
    /* Anxious */
    --mood-grey: #6b7280;
    /* Neutral */

    --font-main: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow-x: hidden;
}

h1,
h2,
h3 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.brand h1 {
    font-size: 1.5rem;
    background: linear-gradient(90deg, #fff, #888);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.user-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-main);
    font-size: 0.9rem;
}

.btn:hover {
    background: var(--surface-hover);
    border-color: var(--text-color);
}

.btn-primary {
    background: var(--text-color);
    color: var(--bg-color);
    border: none;
    font-weight: 600;
}

.btn-primary:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

/* Main Layout */
.main-content {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
aside {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    backdrop-filter: blur(10px);
}

.goals-list h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 1rem;
}

.goal-item {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--text-color);
    text-decoration: none;
    margin-bottom: 0.5rem;
    transition: background 0.2s;
    border: 1px solid transparent;
}

.goal-item:hover {
    background: var(--surface-hover);
}

.goal-item.active {
    background: var(--surface-color);
    border-color: var(--border-color);
    font-weight: 500;
}

/* Calendar Area */
.calendar-wrapper {
    overflow-y: auto;
    padding-right: 1rem;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.legend {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* Voronoi Container */
#voronoi-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    /* Responsive Grid */
    gap: 1.5rem;
    padding-bottom: 3rem;
    width: 100%;
}

.month-block {
    /* Removed background and border for gap clarity */
    border-radius: 12px;
    padding: 1rem;
    position: relative;
    aspect-ratio: 1 / 1;
    /* Square blocks as per image */
}

.month-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    font-weight: 800;
    opacity: 0.9;
    color: rgba(255, 255, 255, 0.15);
    /* Subtle but visible */
    pointer-events: none;
    z-index: 0;
    text-transform: uppercase;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.05em;
}

.voronoi-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
    z-index: 1;
    position: relative;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.modal {
    background: #1a1a1a;
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mood-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.mood-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s;
}

.mood-btn:hover {
    background: var(--surface-hover);
    transform: scale(1.05);
}

.color-preview {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

/* Animations included in logic, but CSS assists */

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-container {
        padding: 0.5rem;
    }

    header {
        flex-direction: row;
        /* Keep row but with wrap if needed */
        flex-wrap: wrap;
        align-items: center;
        gap: 1rem;
        position: relative;
    }

    .brand {
        width: 100%;
        justify-content: flex-start;
        /* Align left */
    }

    .brand h1 {
        font-size: 1.2rem;
    }

    .user-controls {
        width: 100%;
        justify-content: space-between;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid var(--border-color);
    }

    #mobile-menu-btn {
        display: flex !important;
        background: transparent;
        border: none;
        color: var(--text-color);
        margin-right: 0.5rem;
    }

    .main-content {
        display: block;
        /* Stack sidebar and content */
        position: relative;
    }

    /* Sidebar / Mobile Drawer */
    aside {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 100%;
        /* Full screen */
        max-width: none;
        z-index: 50;
        transform: translateX(-105%);
        /* Hidden by default */
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-radius: 0;
        /* Full height */
        border-right: none;
        background: #000;
        /* Solid background for legibility */
        margin: 0;
        overflow-y: auto;
        padding-top: 4rem;
        /* Space for close button and breathing room */
    }

    aside.active {
        transform: translateX(0);
        /* Visible */
    }

    .btn-close-sidebar {
        display: block !important;
        /* Show close button on mobile */
        z-index: 51;
    }

    aside h3,
    aside .goal-item {
        font-size: 1.1rem;
        /* Larger touch targets */
    }

    .section-header {
        margin-bottom: 2.5rem !important;
        /* Increased spacing */
    }

    aside .goal-item {
        padding: 1rem;
    }

    /* Voronoi Grid - Single Column */
    #voronoi-container {
        grid-template-columns: 1fr !important;
        /* One month per row force */
        gap: 2rem;
        padding: 0 0.5rem;
    }

    .month-block {
        max-width: 100%;
        /* Full width */
        aspect-ratio: auto;
        padding: 0;
    }

    .voronoi-canvas {
        aspect-ratio: 1/1;
        /* Ensure square aspect ratio for the canvas itself */
        width: 100%;
        max-width: 100%;
    }

    .month-label {
        font-size: 2rem;
        /* Slightly smaller label */
    }

    /* Hide legend on mobile to save space, maybe add it to bottom of sidebar? */
    .legend-box {
        margin-top: 2rem;
    }

    /* Fix Scrolling on Mobile */
    body {
        overflow-y: auto;
    }

    .app-container {
        height: auto;
        min-height: 100vh;
        overflow-y: visible;
    }

    .main-content {
        height: auto;
        overflow: visible;
        padding-bottom: 2rem;
    }

    .calendar-wrapper {
        overflow: visible;
        height: auto;
        padding-right: 0;
    }
}