:root {
    --bg-gradient-light: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
    --bg-gradient-dark: linear-gradient(135deg, #0f2027 0%, #203a43 60%, #2c5364 100%);
    --card-bg-light: #fff;
    --card-bg-dark: #1a2a44;
    --text-light: #1a3a6b;
    --text-dark: #c0e8ff;
    --border-light: #89b4fa;
    --border-dark: #4a90e2;
    --primary: #4a90e2;
    --primary-dark: #00d4ff;
    --success: #00d2d3;
    --warning: #feca57;
    --danger: #ff6b6b;
    --input-bg-light: #f0f8ff;
    --input-bg-dark: #162d47;
    --shadow-light: 0 12px 35px rgba(74, 144, 226, .25);
    --shadow-dark: 0 12px 35px rgba(0, 0, 0, .4);
    --hover-light: rgba(74, 144, 226, .15);
    --hover-dark: rgba(0, 212, 255, .2);
    --accent-glow: 0 0 20px rgba(74, 144, 226, .6);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg-gradient-light);
    min-height: 100vh;
    padding: 20px;
    transition: background .6s ease;
    position: relative;
    overflow-x: hidden;
    color: var(--text-light);
    font-family: 'Poppins', sans-serif;
}

body.dark {
    background: var(--bg-gradient-dark);
    color: var(--text-dark);
}

.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.bg-particle {
    position: absolute;
    background: radial-gradient(circle, rgba(74, 144, 226, .2)0%, transparent 70%);
    border-radius: 50%;
    animation: float 20s infinite linear;
    filter: blur(2px);
    box-shadow: var(--accent-glow);
}

body.dark .bg-particle {
    background: radial-gradient(circle, rgba(0, 212, 255, .25)0%, transparent 70%);
    box-shadow: 0 0 25px rgba(0, 212, 255, .5);
}

@keyframes float {
    0% {
        transform: translateY(100vh) rotate(0deg) scale(.5);
        opacity: 0;
    }

    15% {
        opacity: .8;
    }

    85% {
        opacity: .8;
    }

    100% {
        transform: translateY(-150px) rotate(360deg) scale(1.2);
        opacity: 0;
    }
}

.container {
    max-width: 820px;
    margin: 0 auto;
    background: var(--card-bg-light);
    border-radius: 28px;
    box-shadow: var(--shadow-light);
    overflow: hidden;
    transition: all .5s ease;
    position: relative;
    z-index: 1;
    border: 2px solid var(--border-light);
}

body.dark .container {
    background: var(--card-bg-dark);
    box-shadow: var(--shadow-dark);
    border-color: var(--border-dark);
}

header {
    background: linear-gradient(135deg, var(--primary)0%, #5dade2 100%);
    color: #fff;
    padding: 30px 25px;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(74, 144, 226, .3);
}

body.dark header {
    background: linear-gradient(135deg, var(--primary-dark)0%, #00a8cc 100%);
    box-shadow: 0 8px 25px rgba(0, 212, 255, .3);
}

header::before {
    content: '';
    position: absolute;
    top: -60%;
    left: -60%;
    width: 220%;
    height: 220%;
    background: radial-gradient(circle, rgba(255, 255, 255, .2)0%, transparent 65%);
    animation: rotate 30s linear infinite;
    pointer-events: none;
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

h1 {
    font-family: 'Bangers', cursive;
    font-size: 3.2rem;
    margin-bottom: 6px;
    text-shadow: 3px 3px 0 rgba(0, 0, 0, .2);
    letter-spacing: 2px;
    background: linear-gradient(90deg, #fff, #a0e7ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-family: 'Fredoka One', cursive;
    font-size: 1.15rem;
    opacity: .95;
    letter-spacing: 1px;
}

.header-controls {
    position: absolute;
    top: 22px;
    right: 22px;
    display: flex;
    gap: 14px;
    z-index: 2;
}

.control-btn {
    background: rgba(255, 255, 255, .25);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, .4);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .4s cubic-bezier(.175, .885, .32, 1.275);
    backdrop-filter: blur(8px);
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .2);
}

.control-btn:hover {
    background: rgba(255, 255, 255, .4);
    transform: translateY(-4px) rotate(15deg) scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, .3), var(--accent-glow);
}

.main-content {
    padding: 38px;
}

.stats {
    display: flex;
    justify-content: space-around;
    padding: 22px;
    background: linear-gradient(135deg, rgba(74, 144, 226, .1)0%, rgba(194, 233, 251, .1)100%);
    border-radius: 20px;
    margin-bottom: 28px;
    font-size: .95rem;
    border: 2px dashed var(--border-light);
    backdrop-filter: blur(5px);
}

body.dark .stats {
    background: linear-gradient(135deg, rgba(0, 212, 255, .15)0%, rgba(0, 168, 204, .15)100%);
    border-color: var(--border-dark);
}

.stat-item:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, .2);
}

body.dark .stat-item:hover {
    background: rgba(0, 212, 255, .1);
}

.stat-number {
    font-family: 'Righteous', cursive;
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
    text-shadow: 2px 2px 0 rgba(0, 0, 0, .1);
}

body.dark .stat-number {
    color: var(--primary-dark);
    text-shadow: 0 0 10px rgba(0, 212, 255, .5);
}

.stat-label {
    font-family: 'Comic Neue', cursive;
    font-weight: 700;
    color: #2e86de;
    margin-top: 4px;
    font-size: 1rem;
}

body.dark .stat-label {
    color: #7ed6ff;
}

.input-section {
    display: flex;
    margin-bottom: 30px;
    gap: 14px;
}

#taskInput {
    flex: 1;
    padding: 18px 24px;
    border: 3px solid var(--border-light);
    border-radius: 20px;
    font-size: 1.15rem;
    transition: all .4s ease;
    background: var(--input-bg-light);
    color: var(--text-light);
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, .05);
}

body.dark #taskInput {
    background: var(--input-bg-dark);
    color: var(--text-dark);
    border-color: var(--border-dark);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, .3);
}

#taskInput:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 5px var(--hover-light), var(--accent-glow);
    transform: scale(1.02);
}

body.dark #taskInput:focus {
    box-shadow: 0 0 0 5px var(--hover-dark), 0 0 25px rgba(0, 212, 255, .4);
}

#addBtn {
    background: linear-gradient(135deg, var(--primary)0%, #5dade2 100%);
    color: #fff;
    border: none;
    padding: 0 32px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1.1rem;
    font-family: 'Fredoka One', cursive;
    transition: all .4s cubic-bezier(.175, .885, .32, 1.275);
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 6px 20px rgba(74, 144, 226, .4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

body.dark #addBtn {
    background: linear-gradient(135deg, var(--primary-dark)0%, #00a8cc 100%);
    box-shadow: 0 6px 20px rgba(0, 212, 255, .4);
}

#addBtn:hover {
    transform: translateY(-5px) scale(1.05) rotate(2deg);
    box-shadow: 0 12px 30px rgba(74, 144, 226, .5), var(--accent-glow);
}

body.dark #addBtn:hover {
    box-shadow: 0 12px 30px rgba(0, 212, 255, .5), 0 0 30px rgba(0, 212, 255, .6);
}

.filters {
    display: flex;
    gap: 14px;
    margin-bottom: 28px;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-btn {
    padding: 12px 24px;
    border: 3px solid var(--border-light);
    background: var(--card-bg-light);
    color: var(--text-light);
    border-radius: 30px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Comic Neue', cursive;
    transition: all .4s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
}

body.dark .filter-btn {
    background: var(--card-bg-dark);
    color: var(--text-dark);
    border-color: var(--border-dark);
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .3), transparent);
    transition: .6s;
}

.filter-btn:hover::before {
    left: 100%;
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(74, 144, 226, .4);
}

body.dark .filter-btn.active {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 8px 20px rgba(0, 212, 255, .4);
}

.task-list {
    list-style: none;
    max-height: 62vh;
    overflow-y: auto;
    padding-right: 6px;
}

.task-list::-webkit-scrollbar {
    width: 10px;
}

.task-list::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 10px;
}

.task-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
    box-shadow: inset 0 0 6px rgba(0, 0, 0, .3);
}

body.dark .task-list::-webkit-scrollbar-thumb {
    background: var(--primary-dark);
}

.task-item {
    background: linear-gradient(135deg, #f0f8ff 0%, #e3f2fd 100%);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    transition: all .4s ease;
    border-left: 6px solid var(--primary);
    position: relative;
    overflow: hidden;
    animation: slideIn .5s ease forwards;
    opacity: 0;
    transform: translateX(-40px);
    border: 2px solid var(--border-light);
    box-shadow: 0 6px 20px rgba(74, 144, 226, .15);
}

body.dark .task-item {
    background: linear-gradient(135deg, #1e3a5f 0%, #162d47 100%);
    border-color: var(--border-dark);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.task-item:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 12px 35px rgba(74, 144, 226, .3), var(--accent-glow);
}

body.dark .task-item:hover {
    box-shadow: 0 12px 35px rgba(0, 212, 255, .3), 0 0 30px rgba(0, 212, 255, .4);
}

.task-item.completed {
    opacity: .7;
    border-left-color: var(--success);
    filter: grayscale(20%);
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: #74b9ff;
    font-style: italic;
}

body.dark .task-item.completed .task-text {
    color: #81ecec;
}

.task-checkbox {
    margin-right: 18px;
    width: 26px;
    height: 26px;
    cursor: pointer;
    accent-color: var(--primary);
    transition: all .3s ease;
    border-radius: 50%;
    border: 3px solid var(--primary);
}

body.dark .task-checkbox {
    accent-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.task-checkbox:checked {
    transform: scale(1.2) rotate(10deg);
    box-shadow: var(--accent-glow);
}

.task-content {
    flex: 1;
    min-width: 0;
}

.task-text {
    font-size: 1.2rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    color: var(--text-light);
}

body.dark .task-text {
    color: var(--text-dark);
}

.task-actions {
    display: flex;
    gap: 12px;
    opacity: 0;
    transition: opacity .4s ease;
}

.task-item:hover .task-actions {
    opacity: 1;
}

.edit-btn,
.delete-btn {
    background: rgba(255, 255, 255, .3);
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all .4s cubic-bezier(.175, .885, .32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.edit-btn {
    color: var(--warning);
}

.edit-btn:hover {
    background: var(--warning);
    color: #fff;
    transform: scale(1.2) rotate(15deg);
    box-shadow: 0 0 20px rgba(254, 202, 87, .6);
}

.delete-btn {
    color: var(--danger);
}

.delete-btn:hover {
    background: var(--danger);
    color: #fff;
    transform: scale(1.2) rotate(-15deg);
    box-shadow: 0 0 20px rgba(255, 107, 107, .6);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #74b9ff;
    display: none;
    font-family: 'Fredoka One', cursive;
}

body.dark .empty-state {
    color: #81ecec;
}

.empty-state i {
    font-size: 5rem;
    margin-bottom: 24px;
    opacity: .4;
    animation: pulse 2.5s infinite;
    text-shadow: 0 0 20px rgba(74, 144, 226, .5);
}

body.dark .empty-state i {
    text-shadow: 0 0 20px rgba(0, 212, 255, .5);
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

.clear-all {
    text-align: center;
    margin-top: 25px;
}

.clear-btn {
    background: transparent;
    color: var(--danger);
    border: 3px dashed var(--danger);
    padding: 10px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-family: 'Comic Neue', cursive;
    font-weight: 700;
    transition: all .4s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.clear-btn:hover {
    background: var(--danger);
    color: #fff;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 0 25px rgba(255, 107, 107, .5);
}

@media(max-width:600px) {
    .input-section {
        flex-direction: column;
    }

    #addBtn {
        padding: 18px;
        justify-content: center;
        font-size: 1.1rem;
    }

    .task-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 18px;
    }

    .task-actions {
        margin-top: 14px;
        align-self: flex-end;
        opacity: 1;
    }

    .stats {
        flex-direction: column;
        gap: 14px;
        padding: 18px;
    }

    .header-controls {
        top: 16px;
        right: 16px;
        gap: 10px;
    }

    .control-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    h1 {
        font-size: 2.5rem;
    }
}