:root {
    --header-height: 140px;
}

body {
    background-color: #050505;
    overflow-x: hidden;
}

.ambient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center top;
    opacity: 0.15;
    filter: blur(80px) saturate(1.5);
    z-index: -2;
    transition: background-image 1s ease;
}

.bg-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at top, transparent 0%, #050505 80%);
    z-index: -1;
}

.schedule-container {
    padding: calc(var(--nav-height) + 2rem) 3rem 2rem 3rem;
    max-width: 1800px;
    margin: 0 auto;
    min-height: 100vh;
}

.schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-wrap: wrap;
    gap: 1.5rem;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 900;
    margin: 0 0 0.5rem 0;
    letter-spacing: -1px;
}

.header-left {
    display: flex;
    flex-direction: column;
}

.month-navigator {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.current-date-label {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-primary);
    min-width: 180px;
    text-align: center;
}

.nav-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 1.2rem;
    line-height: 0;
}

.nav-btn:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.divider-vertical {
    width: 1px;
    height: 30px;
    background: rgba(255,255,255,0.1);
}

.toggle-group {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 4px;
    border-radius: 99px;
    display: flex;
    gap: 4px;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    padding: 6px 16px;
    border-radius: 99px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn:hover { color: white; }
.toggle-btn.active {
    background: var(--color-bg-elevated);
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.view-switcher {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--color-text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.view-btn:hover { border-color: white; color: white; }
.view-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    overflow: hidden;
}

.weekday-header {
    background: var(--color-bg-card);
    padding: 1rem;
    text-align: center;
    font-weight: 700;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.day-cell {
    background: var(--color-bg-base);
    min-height: 160px;
    max-height: 160px;
    padding: 0.8rem;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;

    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.day-cell::-webkit-scrollbar { display: none; }
.day-cell.empty { background: rgba(0,0,0,0.2); }
.day-cell.today { background: rgba(139, 92, 246, 0.05); box-shadow: inset 0 0 0 1px var(--color-primary); }

.day-number {
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
    display: block;
}
.today .day-number { color: var(--color-primary); }

.anime-item-month {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    text-decoration: none;
    transition: 0.2s;
    border-left: 2px solid transparent;
}

.anime-item-month:hover {
    background: rgba(255,255,255,0.08);
    transform: translateX(2px);
}
.anime-item-month.is-mine {
    border-left-color: var(--color-success);
    background: rgba(34, 197, 94, 0.05);
}

.item-time { font-size: 0.75rem; color: var(--color-text-muted); font-family: monospace; }
.item-title { font-size: 0.8rem; color: #ddd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }

.week-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.week-nav {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    scrollbar-width: none;
    mask-image: linear-gradient(to right, black 90%, transparent 100%);
}
.week-nav::-webkit-scrollbar { display: none; }

.day-btn {
    flex: 1;
    min-width: 120px;

    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--color-text-secondary);

    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.day-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

.day-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    box-shadow: 0 8px 20px var(--color-primary-glow);
}

.day-btn span.name {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

.day-btn span.date {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
}

.week-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    animation: fadeInUp 0.4s ease;
}

.card-ep-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.8);
    color: var(--color-primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 800;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.card.mine .card-img-wrap {
    box-shadow: 0 0 0 2px var(--color-success);
}
.card.mine::after {
    content: "IN LIST";
    position: absolute;
    top: 8px; left: 8px;
    background: var(--color-success);
    color: black;
    font-size: 0.65rem;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 4px;
}

.loader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.loader-overlay.active { opacity: 1; pointer-events: auto; }

@media (max-width: 1024px) {
    .schedule-container {
        padding: 5rem 1.5rem 2rem 1.5rem;
    }
}

@media (max-width: 768px) {

    .schedule-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
    }

    .header-left {
        align-items: center;
        width: 100%;
    }

    .header-controls {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        gap: 1rem;
    }

    .page-title {
        font-size: 2rem;
        text-align: center;
    }

    .calendar-grid {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        background: transparent;
        border: none;
    }

    .weekday-header, .day-cell.empty { display: none; }

    .day-cell {
        min-height: auto;
        max-height: none;
        overflow: visible;
        border: 1px solid rgba(255,255,255,0.08);
        border-radius: 12px;
        background: var(--color-bg-elevated);
    }

    .week-nav {
        margin: 0 -1.5rem;
        padding: 0 1.5rem 1rem 1.5rem;
    }

    .day-btn {
        min-width: 90px;
        padding: 0.8rem;
    }
    .day-btn span.name { font-size: 0.75rem; }
    .day-btn span.date { font-size: 1.5rem; }

    .week-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .week-grid .card {
        min-width: 0 !important;
        width: 100% !important;
        flex: none !important;
    }

    .card-content h3 { font-size: 0.8rem; }
    .card-ep-badge { font-size: 0.65rem; padding: 2px 4px; }
}

@media (max-width: 380px) {
    .header-controls {
        gap: 0.5rem;
    }
    .toggle-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    .nav-btn {
        width: 28px;
        height: 28px;
    }
    .current-date-label {
        font-size: 1rem;
        min-width: 140px;
    }
}