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

:root {
    --bg-grad-1: #111827;
    --bg-grad-2: #1f2937;
    --bg-glow-1: rgba(59, 130, 246, 0.35);
    --bg-glow-2: rgba(139, 92, 246, 0.25);
    --card-bg: rgba(255, 255, 255, 0.9);
    --card-border: rgba(255, 255, 255, 0.6);
    --text-main: #111827;
    --text-sub: #6b7280;
    --primary: #4f46e5;
    --primary-2: #7c3aed;
    --danger: #ef4444;
    --success: #10b981;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    color: var(--text-main);
    background:
        radial-gradient(circle at 20% 20%, var(--bg-glow-1), transparent 40%),
        radial-gradient(circle at 80% 0%, var(--bg-glow-2), transparent 35%),
        linear-gradient(135deg, var(--bg-grad-1), var(--bg-grad-2));
    padding: 24px;
}

.app-shell {
    min-height: calc(100vh - 48px);
    display: grid;
    place-items: center;
}

.todo-card {
    width: 100%;
    max-width: 680px;
    background: var(--card-bg);
    backdrop-filter: blur(14px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(17, 24, 39, 0.35);
    padding: 28px;
    animation: cardIn 420ms ease-out;
}

@keyframes cardIn {
    from {
        transform: translateY(16px) scale(0.98);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.app-header {
    margin-bottom: 20px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #eef2ff, #f5f3ff);
    color: #4338ca;
    border: 1px solid #e0e7ff;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
}

h1 {
    font-size: clamp(1.6rem, 4vw, 2rem);
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.02em;
}

.subtitle {
    margin-top: 8px;
    color: var(--text-sub);
    font-size: 0.95rem;
}

.input-container {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-bottom: 18px;
}

.input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1.5px solid #d1d5db;
    border-radius: 14px;
    padding: 0 14px;
    transition: border-color 250ms ease, box-shadow 250ms ease, transform 250ms ease;
}

.input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.18);
    transform: translateY(-1px);
}

.input-wrap i {
    color: #9ca3af;
}

#todoInput {
    border: 0;
    outline: none;
    width: 100%;
    padding: 14px 0;
    font-size: 15px;
    background: transparent;
}

#addBtn {
    border: 0;
    border-radius: 14px;
    padding: 0 18px;
    min-height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: white;
    font-weight: 700;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.25);
    transition: transform 200ms ease, box-shadow 200ms ease, filter 200ms ease;
}

#addBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(79, 70, 229, 0.3);
    filter: brightness(1.05);
}

#addBtn:active {
    transform: translateY(0);
}

#todoList {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.todo-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    background: white;
    border: 1px solid #eef2f7;
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
    transform: translateY(0);
    opacity: 1;
    transition: transform 250ms ease, box-shadow 250ms ease, background 250ms ease, opacity 250ms ease;
}

.todo-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.1);
}

.todo-item.removing {
    opacity: 0;
    transform: translateX(12px) scale(0.98);
}

.todo-checkbox {
    position: relative;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    appearance: none;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 200ms ease;
}

.todo-checkbox:checked {
    background: var(--success);
    border-color: var(--success);
}

.todo-checkbox:checked::after {
    content: '✓';
    color: white;
    font-size: 13px;
    font-weight: 700;
}

.todo-text {
    position: relative;
    font-size: 15px;
    color: #1f2937;
    word-break: break-word;
}

.todo-text::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 2px;
    background: #94a3b8;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 300ms ease;
}

.todo-item.completed {
    background: #f8fafc;
}

.todo-item.completed .todo-text {
    color: #94a3b8;
}

.todo-item.completed .todo-text::after {
    transform: scaleX(1);
}

.delete-btn {
    border: 0;
    border-radius: 10px;
    padding: 9px 12px;
    background: #fef2f2;
    color: var(--danger);
    cursor: pointer;
    transition: background 200ms ease, transform 200ms ease;
}

.delete-btn:hover {
    background: #fee2e2;
    transform: translateY(-1px);
}

.empty-state {
    margin-top: 10px;
    text-align: center;
    border: 1px dashed #d1d5db;
    border-radius: 14px;
    padding: 24px 16px;
    background: #ffffff;
}

.empty-icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.empty-title {
    font-weight: 700;
    margin-bottom: 4px;
}

.empty-desc {
    color: var(--text-sub);
    font-size: 0.92rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (max-width: 640px) {
    body {
        padding: 14px;
    }

    .app-shell {
        min-height: calc(100vh - 28px);
    }

    .todo-card {
        padding: 18px;
        border-radius: 18px;
    }

    .input-container {
        grid-template-columns: 1fr;
    }

    #addBtn {
        width: 100%;
        justify-content: center;
    }

    .todo-item {
        grid-template-columns: auto 1fr;
        grid-template-areas:
            'check text'
            '. delete';
    }

    .todo-checkbox {
        grid-area: check;
    }

    .todo-text {
        grid-area: text;
    }

    .delete-btn {
        grid-area: delete;
        justify-self: end;
    }
}
