:root {
    --primary: #2563eb;
    --primary-light: #dbeafe;
    --bg: #f8fafc;
    --card: #ffffff;
    --text-main: #1e293b;
    --text-sub: #64748b;
    --danger: #ef4444;
    --border: #e2e8f0;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; outline: none; }
body { margin: 0; background: #e2e8f0; font-family: 'Pretendard', -apple-system, sans-serif; color: var(--text-main); line-height: 1.5; }

.app { max-width: 480px; margin: 0 auto; background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; position: relative; box-shadow: 0 0 20px rgba(0,0,0,0.1); }

.top-sticky-container { position: sticky; top: 0; z-index: 100; background: #fff; border-bottom: 1px solid var(--border); }

.header { padding: 16px 20px 8px; }
.header-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.header h1 { font-size: 18px; font-weight: 800; margin: 0; color: var(--primary); display: flex; align-items: center; gap: 8px; }

/* 선택창 스타일 추가 */
.header-select {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary);
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0 2px;
    border-bottom: 2px solid var(--primary-light);
    font-family: inherit;
}

.stats { font-size: 12px; font-weight: 700; color: var(--primary); background: var(--primary-light); padding: 2px 10px; border-radius: 20px; }
.progress-container { height: 4px; background: #f1f5f9; border-radius: 10px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); width: 0%; transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1); }

.date-nav { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; min-height: 54px; }
.nav-btn { border: none; background: #f1f5f9; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; color: var(--text-sub); display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.nav-btn:hover { background: var(--primary-light); color: var(--primary); }

.date-display { display: flex; align-items: center; gap: 6px; cursor: pointer; padding: 4px 12px; border-radius: 10px; }
.date-display h2 { font-size: 15px; font-weight: 700; margin: 0; white-space: nowrap; }
#calendarIcon { font-size: 14px; color: var(--text-sub); }
.date-display.active { background: var(--primary-light); color: var(--primary); }

.calendar-wrapper { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-in-out; background: #fff; }
.calendar-wrapper.show { max-height: 380px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.calendar-header { text-align: center; font-size: 14px; font-weight: 700; padding: 8px 0; color: var(--text-main); }
.calendar-grid-head, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; padding: 0 12px; }
.calendar-grid-head span { font-size: 11px; color: var(--text-sub); padding: 6px 0; font-weight: 600; }
.calendar-grid-head .sun { color: var(--danger); }
.calendar-grid-head .sat { color: var(--primary); }

.cal-day { aspect-ratio: 1/1; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 13px; cursor: pointer; border-radius: 50%; position: relative; margin: 2px; }
.cal-day:hover:not(.other-month) { background: #f1f5f9; }
.cal-day.today { font-weight: 800; color: var(--primary); text-decoration: underline; }
.cal-day.selected { background: var(--primary) !important; color: #fff !important; font-weight: 700; }
.cal-day.other-month { visibility: hidden; }
.task-count { font-size: 8px; width: 14px; height: 14px; background: var(--danger); color: #fff; border-radius: 50%; position: absolute; top: 2px; right: 2px; border: 1.5px solid #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }

/* ... 기존 스타일 유지 ... */

.cal-day.has-data {
    background-color: #f0f9ff; /* 연한 파란색 계통 */
    border-radius: 50%;
}

/* 오늘이면서 데이터가 있는 경우 가독성을 위해 배경색 살짝 조정 */
.cal-day.today.has-data {
    background-color: #bae6fd;
}

/* 선택된 날짜는 파란색 배경에 흰 글씨가 우선순위를 가짐 */
.cal-day.selected {
    background-color: var(--primary) !important;
    color: #fff !important;
}

/* ... 나머지 스타일 유지 ... */

.todo-body { flex: 1; padding: 16px 16px 100px; }
.todo-section { margin-bottom: 24px; }
.section-title { font-size: 12px; font-weight: 700; color: var(--text-sub); margin: 0 4px 10px; display: flex; align-items: center; gap: 6px; text-transform: uppercase; }

.todo-item { background: var(--card); border-radius: 12px; padding: 12px; display: flex; align-items: center; gap: 10px; margin-bottom: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.03); border: 1px solid transparent; }
.todo-text { flex: 1; font-size: 14px; font-weight: 500; word-break: break-all; }
.done .todo-text { text-decoration: line-through; color: #94a3b8; }
.check-btn { width: 22px; height: 22px; border: 2px solid #cbd5e1; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: transparent; transition: 0.2s; }
.done .check-btn { background: var(--primary); border-color: var(--primary); color: white; }

.action-btns { display: flex; gap: 2px; }
.icon-btn { border: none; background: transparent; width: 32px; height: 32px; cursor: pointer; font-size: 14px; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.btn-edit { color: var(--text-sub); }
.btn-edit:hover { background: #f1f5f9; color: var(--primary); }
.btn-del { color: #cbd5e1; }
.btn-del:hover { background: #fee2e2; color: var(--danger) !important; }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: none; align-items: flex-end; z-index: 1000; backdrop-filter: blur(2px); }
.overlay.show { display: flex; }
.bottom-sheet { background: white; width: 100%; border-radius: 20px 20px 0 0; padding: 20px; transform: translateY(100%); transition: 0.3s ease-out; position: relative; }
.overlay.show .bottom-sheet { transform: translateY(0); }
.sheet-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.sheet-header h3 { font-size: 16px; font-weight: 700; margin: 0; }
#closeSheet { border: none; background: #f1f5f9; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-sub); }

#todoInput { width: 100%; padding: 14px; border-radius: 10px; border: 1.5px solid var(--border); background: #f8fafc; font-size: 15px; margin-bottom: 10px; }
#todoInput:focus { border-color: var(--primary); background: #fff; }
.btn-submit { width: 100%; padding: 14px; border-radius: 10px; border: none; background: var(--primary); color: white; font-weight: 700; font-size: 15px; cursor: pointer; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2); }

.fab { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); width: 56px; height: 56px; border-radius: 16px; background: var(--primary); color: white; border: none; font-size: 20px; box-shadow: 0 8px 16px rgba(37, 99, 235, 0.3); z-index: 99; cursor: pointer; }

@media (max-width: 480px) {
    .app { width: 100%; }
}