/* ========== Reset & Base ========== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #F7FCFC;
    --card-bg: #FFFFFF;
    --primary: #4DB6AC;
    --primary-light: #80CBC4;
    --primary-dark: #358C83;
    --accent: #FFD43B;
    --accent2: #E0F2F1;
    --accent-border: #D4EDEB;
    --text: #1A3636;
    --text-light: #4A6B6B;
    --text-muted: #90B0AE;
    --warning: #FF6B6B;
    --warning-bg: #FFF0F0;
    --shadow-sm: 0 4px 12px rgba(26, 54, 54, 0.04);
    --shadow-md: 0 8px 24px rgba(26, 54, 54, 0.08);
    --shadow-lg: 0 16px 48px rgba(26, 54, 54, 0.12);
    --radius: 20px;
    --radius-sm: 12px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.app {
    max-width: 480px;
    margin: 0 auto;
    padding-bottom: 40px;
    position: relative;
}

/* ========== Header ========== */
.header {
    position: relative;
    padding: 360px 24px 56px;
    text-align: center;
}

.header-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: -10px;
    background: url('ggyu_bg.png') center 35% / cover no-repeat;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    z-index: 0;
}

.header-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 65%, rgba(0, 0, 0, 0.85) 100%);
    z-index: 0;
}





.header-content {
    position: relative;
    z-index: 1;
}

.cat-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 12px;
    animation: catBounce 2s ease-in-out infinite;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
    border: 3px solid rgba(255, 255, 255, 0.6);
}

@keyframes catBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.header h1 {
    font-size: 1.7rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 0px;
    font-weight: 300;
}

/* ========== Greeting Card ========== */
.greeting-card {
    margin: -28px 40px 24px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.75);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.greeting-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.greeting-card p {
    font-size: 0.88rem;
    line-height: 1.7;
    color: #000;
    font-weight: 500;
    letter-spacing: -0.2px;
}

/* ========== Progress Bar ========== */
.progress-section {
    margin: 8px 20px 24px;
    padding: 16px 20px;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    border: none;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.progress-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
}

.progress-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: #000;
    letter-spacing: 1px;
}

.progress-bar {
    height: 8px;
    background: var(--accent2);
    border-radius: 100px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 100px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* ========== Task List ========== */
.task-list {
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ========== Task Card ========== */
.task-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
    border: none;
}

.task-card:active {
    transform: scale(0.99);
}

.task-card.open {
    box-shadow: var(--shadow-md);
}

.task-card.completed {
    opacity: 0.7;
}

.task-card.completed .task-title {
    text-decoration: line-through;
    color: #707070;
}

.task-card.completed .task-number {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 6px rgba(77, 182, 172, 0.3);
}

/* Task Header */
.task-header {
    display: flex;
    align-items: center;
    padding: 16px 18px;
    cursor: pointer;
    gap: 12px;
    user-select: none;
    -webkit-user-select: none;
}

.task-check {
    flex-shrink: 0;
    position: relative;
}

.task-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-label {
    display: flex;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    border: 2px solid var(--accent-border);
    cursor: pointer;
    transition: var(--transition);
    align-items: center;
    justify-content: center;
    background: #ffffff;
}

.checkbox-label::after {
    content: '';
    width: 10px;
    height: 6px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) scale(0);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: -2px;
}

.task-checkbox:checked+.checkbox-label {
    background: var(--primary);
    border-color: var(--primary);
    animation: checkPop 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.task-checkbox:checked+.checkbox-label::after {
    transform: rotate(-45deg) scale(1);
}

@keyframes checkPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.task-title-area {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.task-number {
    display: flex;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: #ffeaaa;
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 800;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition);
    box-shadow: 0 2px 6px rgba(255, 212, 59, 0.3);
}

.task-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    transition: color var(--transition), text-decoration var(--transition);
}

.task-toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.chevron {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    transition: transform var(--transition), color var(--transition);
}

.task-card.open .chevron {
    transform: rotate(180deg);
    color: var(--primary);
}

/* Task Body */
.task-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.task-content {
    padding: 0 18px 18px 64px;
}

.task-content ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-content li {
    font-size: 0.85rem;
    line-height: 1.65;
    color: var(--text-light);
    padding-left: 16px;
    position: relative;
}

.task-content li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary-light);
}

.task-content li strong {
    color: var(--text);
    font-weight: 600;
}

.task-content li.warning {
    background: var(--warning-bg);
    padding: 10px 12px 10px 16px;
    border-radius: 8px;
    border-left: 3px solid var(--warning);
}

.task-content li.warning::before {
    display: none;
}

.warning-text {
    font-size: 0.8rem;
    color: var(--warning);
    font-weight: 500;
}

.task-content li.muted {
    color: var(--text-muted);
    font-style: italic;
}

.task-content li.muted::before {
    background: var(--text-muted);
    opacity: 0.4;
}

/* ========== Footer ========== */
.footer {
    text-align: center;
    padding: 48px 24px 32px;
}

.footer-paw {
    font-size: 32px;
    margin-bottom: 12px;
    animation: pawWave 3s ease-in-out infinite;
}

@keyframes pawWave {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(10deg);
    }

    75% {
        transform: rotate(-10deg);
    }
}

.footer p {
    font-size: 0.95rem;
    font-weight: 600;
    color: #000;
}

.footer-sub {
    font-size: 0.8rem !important;
    font-weight: 400 !important;
    color: var(--text-muted) !important;
    margin-top: 6px;
}

/* ========== Completion Overlay ========== */
.completion-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.completion-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.completion-card {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 40px 36px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    transform: scale(0.85) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 300px;
    width: 90%;
}

.completion-overlay.show .completion-card {
    transform: scale(1) translateY(0);
}

.completion-emoji {
    font-size: 56px;
    margin-bottom: 16px;
    animation: celebrateBounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.3s both;
}

@keyframes celebrateBounce {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.completion-card h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.completion-card p {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 24px;
}

.completion-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border: none;
    padding: 12px 40px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(77, 182, 172, 0.3);
    font-family: inherit;
}

.completion-btn:active {
    transform: scale(0.95);
}

/* ========== Animations ========== */
.task-card {
    animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.task-card:nth-child(1) {
    animation-delay: 0.05s;
}

.task-card:nth-child(2) {
    animation-delay: 0.1s;
}

.task-card:nth-child(3) {
    animation-delay: 0.15s;
}

.task-card:nth-child(4) {
    animation-delay: 0.2s;
}

.task-card:nth-child(5) {
    animation-delay: 0.25s;
}

.task-card:nth-child(6) {
    animation-delay: 0.3s;
}

.task-card:nth-child(7) {
    animation-delay: 0.35s;
}

.task-card:nth-child(8) {
    animation-delay: 0.4s;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== Responsive ========== */
@media (max-width: 380px) {
    .header {
        padding: 320px 20px 48px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .task-content {
        padding-left: 52px;
    }
}

/* Safe area for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .app {
        padding-bottom: calc(40px + env(safe-area-inset-bottom));
    }

    .header {
        padding-top: calc(320px + env(safe-area-inset-top));
    }
}