/* CSS Reset & Variables */
:root {
  --primary-color: #7c3aed; /* Violet gradient primary */
  --primary-hover: #6d28d9;
  --success-color: #10b981; /* Emerald success */
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --glass-bg: rgba(255, 255, 255, 0.28);
  --glass-border: rgba(255, 255, 255, 0.4);
  --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.15);
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-header: 'Outfit', sans-serif;
}

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

body {
  font-family: var(--font-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  /* Background image configured dynamically. Fallback gradient included */
  background: linear-gradient(135deg, #1e1b4b 0%, #311042 100%);
  background-image: url('bg.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  padding: 20px;
  overflow-x: hidden;
}

/* App container overlay for background tint */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 10, 30, 0.4); /* Dark screen overlay to boost readability */
  z-index: -1;
}

/* Glass Card */
.app-container {
  width: 100%;
  max-width: 540px;
  z-index: 10;
}

.todo-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 26px;
  box-shadow: var(--shadow-main);
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
}

.todo-card:hover {
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Header Section */
.todo-header {
  display: flex;
  flex-direction: column;
  gap: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 20px;
}

.header-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px; /* 날짜와 시계 영역이 과도하게 달라붙는 현상 방지 최소 간격 확보 */
}

.date-info h1 {
  font-family: var(--font-header);
  font-size: 1.65rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.15);
  white-space: nowrap; /* 줄바꿈 방지 */
}

.date-info p {
  font-size: 1rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.time-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.time-header-row {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.countdown-toggle-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.countdown-toggle-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.countdown-toggle-btn:active {
  transform: scale(0.95);
}

.work-countdown {
  font-size: 0.7rem;
  font-weight: 700;
  color: #f43f5e; /* Vibrant rose for countdown label */
  background: rgba(255, 255, 255, 0.9); /* High contrast light background for readability */
  border: 1px solid rgba(255, 255, 255, 1);
  padding: 3px 10px;
  border-radius: 30px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  letter-spacing: -0.2px;
  
  /* 초가 바뀔 때 흔들림 방지 */
  font-variant-numeric: tabular-nums;
  min-width: 145px;
  text-align: center;

  /* 접고 펴는 부드러운 슬라이딩 전환 */
  max-height: 40px;
  opacity: 1;
  transform: translateY(0);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.work-countdown.hidden {
  max-height: 0;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-top-width: 0 !important;
  border-bottom-width: 0 !important;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  box-shadow: none;
}

.header-action-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  flex-shrink: 0;
}

.header-action-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(1.05);
}

.header-action-btn:active {
  transform: scale(0.95);
}

.time-info {
  background: rgba(255, 255, 255, 0.25);
  padding: 6px 12px; /* 시계 글자가 커진 밸런스에 맞춰 패딩을 살짝 줄여 안정화 */
  border-radius: 50px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  flex-shrink: 0; /* 비좁은 뷰포트에서도 영역 찌그러짐 방지 */
}

#current-time {
  font-family: var(--font-header);
  font-weight: 700; /* 굵게 강조 */
  font-size: 1.25rem; /* 글자 크기 증가로 날짜 크기와 비주얼 밸런스 매칭 */
  color: #ffffff;
  white-space: nowrap; /* 강제 줄바꿈 및 쪼개짐 방지 */
}

/* Progress bar */
.progress-bar-container {
  display: flex;
  flex-direction: column;
  gap: 12px; /* 텍스트 라벨과 바 캐릭터의 겹침 방지를 위해 간격 증가 */
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  position: relative; /* relative로 설정하여 아바타 포지셔닝 기준 마련 */
}

#progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #a78bfa 0%, #818cf8 100%);
  border-radius: 4px;
  transition: width 0.4s ease;
  position: relative; /* relative 추가 */
}

.progress-avatar {
  position: absolute;
  right: -12px; /* 바 끝에 절반 정도 걸치게 배치 */
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  background-size: cover;
  background-position: center;
  background-image: url('bg.png'); /* 기본 비니 얼굴 */
  transition: background-image 0.3s ease, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 5;
}

.progress-avatar:hover {
  transform: translateY(-50%) scale(1.25);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

/* Calendar Navigation */
.calendar-nav {
  display: flex;
  gap: 6px;
  justify-content: space-between;
  padding: 5px 0 15px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  overflow-x: auto;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.calendar-nav::-webkit-scrollbar {
  display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.calendar-nav {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

.nav-card {
  flex: 1;
  min-width: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.nav-card:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.35);
}

.nav-card.active {
  background: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.nav-card-day {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 4px;
  text-transform: uppercase;
  transition: color 0.2s;
}

.nav-card.active .nav-card-day {
  color: var(--primary-color);
}

.nav-card-date {
  font-family: var(--font-header);
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  transition: color 0.2s;
}

.nav-card.active .nav-card-date {
  color: var(--primary-color);
}

/* Today dot indicator */
.nav-card.is-today::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
}

.nav-card.is-today.active::after {
  background-color: var(--primary-color);
}

.nav-card.is-today:not(.active)::after {
  background-color: #ffffff;
}

/* Form Section */
#todo-form {
  margin-top: 5px;
}

.input-group {
  display: flex;
  gap: 10px;
}

#todo-input {
  flex-grow: 1;
  min-width: 0; /* 브라우저 엔진 기본 최소 너비 제한 해제 */
  padding: 14px 20px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s;
  backdrop-filter: blur(5px);
}

#todo-input::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

#todo-input:focus {
  background: rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

#add-btn {
  background: #ffffff;
  color: var(--primary-color);
  border: none;
  padding: 0 20px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#add-btn:hover {
  background: var(--primary-color);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(124, 58, 237, 0.3);
}

#add-btn:active {
  transform: translateY(0);
}

/* Filter tabs */
.filter-tabs {
  display: flex;
  gap: 8px;
}

.filter-btn {
  flex: 1;
  min-width: 0; /* 필터 버튼 내부 텍스트에 의한 가로 폭 최소 제한 해제 */
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px; /* 텍스트와 개수 뱃지 간격 */
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.filter-btn.active {
  background: #ffffff;
  color: var(--primary-color);
  font-weight: 600;
  border-color: #ffffff;
}

/* 필터 개수 뱃지 스타일 */
.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1px 5px;
  min-width: 16px;
  height: 16px;
  border-radius: 50px;
  transition: all 0.2s;
}

.filter-btn.active .filter-count {
  background: rgba(124, 58, 237, 0.12);
  border-color: rgba(124, 58, 237, 0.2);
  color: var(--primary-color);
}

/* Body / List Section */
.todo-body {
  min-height: 250px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 5px;
}

/* Custom Scrollbar for list container */
.todo-body::-webkit-scrollbar {
  width: 6px;
}

.todo-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.todo-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

.todo-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

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

.todo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  transition: all 0.25s ease;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.todo-item:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateX(4px);
}

.todo-item.completed {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.08);
}

.item-left-side {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-grow: 1;
}

/* Custom Checkbox */
.checkbox-container {
  display: block;
  position: relative;
  width: 22px;
  height: 22px;
  cursor: pointer;
  user-select: none;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 22px;
  width: 22px;
  background-color: rgba(255, 255, 255, 0.2);
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  border-radius: 6px;
  transition: all 0.2s;
}

.checkbox-container:hover input ~ .checkmark {
  background-color: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.9);
}

.checkbox-container input:checked ~ .checkmark {
  background-color: var(--success-color);
  border-color: var(--success-color);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
  display: block;
}

.checkbox-container .checkmark:after {
  left: 7px;
  top: 3px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.todo-text {
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
  transition: all 0.2s;
  word-break: break-all;
}

.todo-item.completed .todo-text {
  color: rgba(255, 255, 255, 0.45);
  text-decoration: line-through;
  text-shadow: none;
}

.delete-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s;
}

.delete-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  transform: scale(1.1);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  height: 240px;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
}

.empty-state-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background-image: url('media__1780989989928.png'); /* 주스 마시는 편안한 샷 */
  background-size: cover;
  background-position: center;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  margin-bottom: 5px;
  animation: bounce 3s infinite ease-in-out;
}

.empty-state p {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Footer Stats Section */
.todo-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding-top: 15px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

.clear-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
  padding: 4px 8px;
  border-radius: 6px;
}

.clear-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}

/* ==========================================
   Hasbulla Game Overlay & UI Styles
   ========================================== */
.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 10, 30, 0.88);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 25px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 1;
  transform: scale(1);
}

.game-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 12px;
}

.game-header h2 {
  font-family: var(--font-header);
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
}

.game-header .close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.7);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.game-header .close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

/* Stats panel */
.game-stats {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 15px;
}

.stat-box {
  flex: 1;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-box span:first-child {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 600;
  text-transform: uppercase;
}

.stat-box span:last-child {
  font-family: var(--font-header);
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}

/* Play area canvas */
.game-play-area {
  flex: 1;
  position: relative;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  margin-top: 15px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-start-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  color: #ffffff;
  text-align: center;
  padding: 20px;
  z-index: 5;
}

.hasbulla-preview-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background-image: url('bg.png');
  background-size: cover;
  background-position: center;
  border: 3px solid #ffffff;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
  animation: bounce 2s infinite ease-in-out;
}

.game-start-screen p {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.4;
}

.start-btn {
  background: var(--primary-color);
  color: #ffffff;
  border: none;
  padding: 10px 24px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.start-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(124, 58, 237, 0.5);
}

.start-btn:active {
  transform: translateY(0);
}

/* Bubbles & Pop Effects */
.hasbulla-bubble {
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-image: url('bg.png');
  background-size: cover;
  background-position: center;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transform: scale(0);
  animation: spawnBubble 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  user-select: none;
}

.punch-effect {
  position: absolute;
  color: #ff3b30;
  font-family: var(--font-header);
  font-weight: 800;
  font-size: 1.15rem;
  text-shadow: 0 0 6px rgba(255, 59, 48, 0.8);
  pointer-events: none;
  animation: floatUpAndFade 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
  transform: translate(-50%, -50%);
  z-index: 10;
  user-select: none;
}

/* Keyframe Animations */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes spawnBubble {
  to {
    transform: scale(1);
  }
}

@keyframes floatUpAndFade {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) translateY(0) scale(0.8);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) translateY(-20px) scale(1.2);
  }
}

/* ==========================================
   Side Polaroid Decoration Styles (PC 전용 데코레이션)
   ========================================== */
.side-deco {
  position: fixed;
  bottom: 80px;
  z-index: 5;
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: block;
}

.left-deco {
  left: 60px;
  transform: rotate(-10deg);
}

.left-deco-2 {
  left: 50px;
  bottom: 270px;
  transform: rotate(8deg);
}

.right-deco {
  right: 60px;
  transform: rotate(10deg);
}

.right-deco-2 {
  right: 50px;
  bottom: 270px;
  transform: rotate(-8deg);
}

.side-deco:hover {
  transform: scale(1.08) rotate(0deg);
  bottom: 95px;
  z-index: 20;
}

.left-deco-2:hover, .right-deco-2:hover {
  transform: scale(1.08) rotate(0deg);
  bottom: 285px;
  z-index: 20;
}

.polaroid {
  background: #ffffff;
  padding: 10px 10px 24px 10px;
  border-radius: 12px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.polaroid-img {
  width: 140px;
  height: 140px;
  background-size: cover;
  background-position: center;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.polaroid-caption {
  font-family: var(--font-header);
  font-size: 0.72rem;
  font-weight: 700;
  color: #374151;
  letter-spacing: 0.2px;
  text-shadow: none;
  margin-top: 4px;
}

/* 992px 이하 태블릿 및 모바일에서는 사이드 겹침 방지를 위해 가림 */
@media (max-width: 992px) {
  .side-deco {
    display: none;
  }
}

/* ==========================================
   Responsive Styles (반응형 모바일 대응)
   ========================================== */
/* 중간 크기 화면 (600px 이하) - 선제적 카드 패딩, 요일 카드, 입력창 및 리스트 글자 일괄 축소 */
@media (max-width: 600px) {
  .todo-card {
    padding: 20px; /* 카드 안쪽 여백을 20px로 선제 축소하여 가로 공간 확보 */
    gap: 15px;
  }

  .date-info h1 {
    font-size: 1.4rem !important;
  }

  .time-info {
    padding: 4px 10px !important;
  }

  #current-time, .time-info #current-time {
    font-size: 1.15rem !important; /* 600px 이하에서도 날짜 1.4rem과 밸런스 매칭 */
  }

  .work-countdown {
    font-size: 0.62rem;
    min-width: 120px;
    padding: 2px 6px;
  }

  .calendar-nav {
    padding: 5px 0 10px 0;
    gap: 4px;
  }

  .nav-card {
    min-width: 40px; /* 요일 카드 최소 너비 축소 */
    padding: 6px 0;
  }

  #todo-input {
    padding: 10px 14px;
    font-size: 0.85rem; /* 입력창 글자 크기 축소 */
  }

  /* 600px 이하에서 리스트 글자 크기 선제적 축소 */
  .todo-text {
    font-size: 0.85rem !important;
  }

  .todo-item {
    padding: 10px 14px;
    border-radius: 12px;
  }
}

/* 크롬 브라우저 창 드래그 최소 한계(약 500px)에 대응하여 레이아웃을 세로 세팅으로 한층 일찍 전환 */
@media (max-width: 500px) {
  body {
    padding: 8px;
  }

  .todo-card {
    padding: 12px;
    gap: 10px;
  }

  .todo-header {
    padding-bottom: 10px;
  }

  .progress-bar-container {
    gap: 10px !important;
  }

  /* 500px 이하에서 즉시 세로 정렬로 전환하여 브라우저 가로 폭이 더 이상 줄어들지 않아도 화면 겹침 완벽 제거 */
  .header-main {
    flex-direction: column !important;
    align-items: center !important;
    gap: 14px !important; /* 세로 정렬 시 날짜와 시간 간의 쾌적한 간격 확보 */
  }

  .date-info {
    text-align: center !important;
    width: 100% !important;
  }

  .date-info h1 {
    font-size: 1.25rem !important;
    text-align: center !important;
    white-space: nowrap;
  }

  .date-info p {
    font-size: 0.75rem;
    text-align: center;
  }

  .header-actions {
    width: 100% !important;
    justify-content: center !important;
    gap: 8px !important;
  }

  .time-container {
    align-items: center !important;
    width: 100% !important;
  }

  .time-header-row {
    justify-content: center !important;
    width: 100% !important;
    gap: 6px !important;
  }

  .time-info {
    padding: 3px 8px !important;
  }

  #current-time, .time-info #current-time {
    font-size: 1.05rem !important; /* 500px 이하에서도 넉넉히 시인성 확보 */
  }

  .work-countdown {
    font-size: 0.6rem;
    min-width: 0 !important;
    width: auto !important;
    padding: 2px 8px;
  }

  .header-action-btn {
    width: 26px;
    height: 26px;
    font-size: 0.7rem;
  }

  .calendar-nav {
    padding: 5px 0 8px 0;
    gap: 3px;
  }

  .nav-card {
    min-width: 0 !important;
    padding: 5px 0;
    border-radius: 8px;
  }

  .nav-card-day {
    font-size: 0.52rem;
    margin-bottom: 2px;
  }

  .nav-card-date {
    font-size: 0.78rem;
  }

  .nav-card.is-today::after {
    bottom: 2px;
    width: 3px;
    height: 3px;
  }

  #todo-input {
    padding: 8px 12px;
    font-size: 0.78rem;
    border-radius: 10px;
  }

  #add-btn {
    padding: 0 12px;
    font-size: 0.85rem;
    border-radius: 10px;
  }

  .filter-btn {
    font-size: 0.72rem;
    padding: 4px 6px;
    border-radius: 8px;
    gap: 4px;
  }

  .filter-count {
    font-size: 0.62rem;
    padding: 1px 4px;
    min-width: 14px;
    height: 14px;
  }

  .todo-item {
    padding: 8px 10px;
    border-radius: 10px;
    gap: 8px;
  }

  .item-left-side {
    gap: 8px;
  }

  .todo-text {
    font-size: 0.76rem !important;
  }

  .checkbox-container {
    width: 18px;
    height: 18px;
  }

  .checkmark {
    width: 18px;
    height: 18px;
    border-radius: 4px;
  }

  .checkbox-container .checkmark:after {
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border-width: 0 1.5px 1.5px 0;
  }

  .delete-btn {
    font-size: 0.75rem;
    padding: 2px;
  }

  .empty-state {
    height: 150px;
  }

  .empty-state-avatar {
    width: 55px;
    height: 55px;
  }

  .progress-avatar {
    width: 16px;
    height: 16px;
    right: -8px;
  }
  
  .todo-footer {
    font-size: 0.72rem;
    padding-top: 8px;
  }
  
  .clear-btn {
    font-size: 0.72rem;
    padding: 2px 4px;
  }
}

/* 초소형 모바일 기기 (380px 이하) - 극단적인 컴팩트 스케일 다운 */
@media (max-width: 380px) {
  body {
    padding: 4px;
  }

  .todo-card {
    padding: 8px;
    gap: 8px;
  }

  .todo-header {
    padding-bottom: 8px;
  }

  .date-info h1 {
    font-size: 1.05rem !important;
  }

  .time-info {
    padding: 3px 6px !important;
  }
  
  #current-time, .time-info #current-time {
    font-size: 0.9rem !important; /* 380px 이하에서도 글씨 크기 상향 */
  }

  .work-countdown {
    font-size: 0.52rem;
    padding: 2px 6px;
  }

  .header-action-btn {
    width: 22px;
    height: 22px;
    font-size: 0.65rem;
  }

  .calendar-nav {
    padding: 4px 0 6px 0;
    gap: 2px;
  }

  .nav-card {
    padding: 4px 1px;
    border-radius: 6px;
  }

  .nav-card-day {
    font-size: 0.48rem;
  }

  .nav-card-date {
    font-size: 0.7rem;
  }

  #todo-input {
    padding: 6px 10px;
    font-size: 0.72rem;
  }

  #add-btn {
    padding: 0 10px;
    font-size: 0.8rem;
  }

  .filter-tabs {
    gap: 2px;
  }

  .filter-btn {
    font-size: 0.65rem;
    padding: 4px 2px;
  }

  .filter-count {
    font-size: 0.58rem;
    padding: 1px 3px;
    min-width: 12px;
    height: 12px;
  }

  .todo-item {
    padding: 6px 8px;
    border-radius: 8px;
    gap: 4px;
  }

  .item-left-side {
    gap: 4px;
  }

  .todo-text {
    font-size: 0.72rem !important;
  }

  .checkbox-container {
    width: 14px;
    height: 14px;
  }

  .checkmark {
    width: 14px;
    height: 14px;
    border-radius: 3px;
  }

  .checkbox-container .checkmark:after {
    left: 4px;
    top: 1px;
    width: 3px;
    height: 6px;
  }

  .delete-btn {
    font-size: 0.68rem;
    padding: 1px;
  }

  .empty-state {
    height: 120px;
  }

  .empty-state-avatar {
    width: 45px;
    height: 45px;
  }

  .progress-avatar {
    width: 12px;
    height: 12px;
    right: -6px;
  }

  .todo-footer {
    font-size: 0.68rem;
    padding-top: 6px;
  }

  .clear-btn {
    font-size: 0.68rem;
    padding: 1px 2px;
  }
}

/* ==========================================
   Memo View Styles (메모 탭 스타일)
   ========================================== */
.memo-view-area {
  display: flex;
  flex-direction: column;
  height: 250px;
  min-height: 250px;
  max-height: 380px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 18px;
  padding: 15px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.memo-view-area.hidden {
  display: none !important;
}

.memo-view-area::before {
  content: '';
  position: absolute;
  right: 15px;
  bottom: 45px;
  width: 90px;
  height: 90px;
  background-image: url('media__1780991450712.png'); /* 집중하는 하스불라 */
  background-size: cover;
  background-position: center;
  opacity: 0.12;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.3s;
}

.memo-view-area:focus-within::before {
  opacity: 0.22;
}

#memo-textarea {
  flex-grow: 1;
  min-width: 0; /* 브라우저 엔진 기본 최소 너비 제한 해제 */
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: #ffffff;
  font-family: var(--font-main);
  font-size: 0.95rem;
  line-height: 1.6;
  padding: 0;
  z-index: 2;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

#memo-textarea::-webkit-scrollbar {
  width: 4px;
}

#memo-textarea::-webkit-scrollbar-track {
  background: transparent;
}

#memo-textarea::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

#memo-textarea::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.memo-footer-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  z-index: 2;
}

#memo-char-count {
  font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 20px;
}

#memo-save-status {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 모바일 및 극소형 모바일 반응형 조율 */
@media (max-width: 480px) {
  .memo-view-area {
    padding: 10px;
    height: 200px;
    min-height: 200px;
  }
  
  #memo-textarea {
    font-size: 0.82rem;
  }
  
  .memo-view-area::before {
    width: 60px;
    height: 60px;
    right: 10px;
    bottom: 35px;
  }
}

/* 극단적인 초소형 화면 (320px 이하) - 좁은 폭 스케일 한계 극복 */
@media (max-width: 320px) {
  body {
    padding: 2px;
  }

  .todo-card {
    padding: 6px;
    gap: 6px;
  }

  .date-info h1 {
    font-size: 0.72rem !important; /* 날짜 폰트를 극소화하여 100px 근처로 압축 */
  }

  .date-info p {
    font-size: 0.6rem;
  }

  .time-info {
    padding: 2px 4px !important;
  }
  
  #current-time, .time-info #current-time {
    font-size: 0.76rem !important; /* 320px 이하 극소형에서도 밸런스 상향 */
  }

  .work-countdown {
    font-size: 0.45rem;
    padding: 1px 4px;
  }

  .header-action-btn {
    width: 18px;
    height: 18px;
    font-size: 0.55rem;
  }

  .nav-card {
    padding: 3px 0.5px;
    border-radius: 4px;
  }

  .nav-card-day {
    font-size: 0.42rem;
  }

  .nav-card-date {
    font-size: 0.6rem;
  }

  #todo-input {
    padding: 5px 8px;
    font-size: 0.7rem;
  }

  #add-btn {
    padding: 0 8px;
    font-size: 0.75rem;
    border-radius: 8px;
  }

  .filter-btn {
    font-size: 0.58rem;
    padding: 3px 1px;
  }

  .filter-count {
    font-size: 0.52rem;
    padding: 0.5px 2px;
    min-width: 10px;
    height: 10px;
  }

  .todo-item {
    padding: 5px 6px;
    border-radius: 6px;
    gap: 3px;
  }

  .item-left-side {
    gap: 3px;
  }

  .todo-text {
    font-size: 0.68rem !important;
  }

  .checkbox-container {
    width: 12px;
    height: 12px;
  }

  .checkmark {
    width: 12px;
    height: 12px;
    border-radius: 2px;
  }

  .checkbox-container .checkmark:after {
    left: 3.5px;
    top: 0.5px;
    width: 2.5px;
    height: 5px;
  }

  .delete-btn {
    font-size: 0.62rem;
  }

  .progress-avatar {
    width: 10px;
    height: 10px;
    right: -5px;
  }

  .todo-footer {
    font-size: 0.62rem;
    padding-top: 4px;
  }

  .clear-btn {
    font-size: 0.62rem;
    padding: 0.5px 1.5px;
  }

  .memo-view-area {
    padding: 6px;
    height: 160px;
    min-height: 160px;
  }
  
  #memo-textarea {
    font-size: 0.72rem;
  }
  
  .memo-view-area::before {
    width: 45px;
    height: 45px;
    right: 6px;
    bottom: 25px;
  }
}

/* ==========================================
   Central Polaroid Popup Effect Styles (완료 축하 팝업)
   ========================================== */
.central-polaroid-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6) rotate(-8deg);
  opacity: 0;
  z-index: 100000;
  pointer-events: none;
  background: #ffffff;
  padding: 15px 15px 35px 15px; /* 폴라로이드 하단 캡션 특유 여백 */
  border-radius: 16px;
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.5);
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform, opacity;
}

.central-polaroid-popup.active {
  transform: translate(-50%, -50%) scale(1.08) rotate(3deg);
  opacity: 1;
}

.central-polaroid-popup.fade-out {
  transform: translate(-50%, -50%) scale(0.7) rotate(-12deg);
  opacity: 0;
  transition: all 0.25s ease-in;
}

.central-polaroid-img {
  width: 220px;
  height: 220px;
  background-size: cover;
  background-position: center;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.central-polaroid-caption {
  font-family: var(--font-header);
  font-size: 1.1rem;
  font-weight: 800;
  color: #1f2937;
  letter-spacing: 0.3px;
  text-shadow: none;
}

/* 모바일 반응형 압축 */
@media (max-width: 480px) {
  .central-polaroid-popup {
    padding: 10px 10px 24px 10px;
    gap: 8px;
  }
  
  .central-polaroid-img {
    width: 150px;
    height: 150px;
  }
  
  .central-polaroid-caption {
    font-size: 0.85rem;
  }
}

/* ==========================================
   App Initial Loader Styles
   ========================================== */
.app-loader-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #0f0a1e 0%, #1e052d 100%);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
              visibility 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-loader-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.05); /* Zoom in slightly when fading out */
}

.loader-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 350px;
  width: 100%;
}

.loader-avatar-frame {
  position: relative;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  padding: 4px;
  background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
  box-shadow: 0 10px 30px rgba(124, 58, 237, 0.4), 
              0 0 0 8px rgba(124, 58, 237, 0.1);
  animation: floatAvatar 3s ease-in-out infinite;
}

.loader-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  border: 3px solid #ffffff;
}

.loader-title {
  font-family: var(--font-header);
  font-size: 1.8rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  margin-top: 5px;
}

.loader-progressbar-wrapper {
  width: 80%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.loader-progressbar {
  width: 100%;
  height: 100%;
}

.loader-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #a78bfa 0%, #818cf8 100%);
  border-radius: 10px;
  animation: loadProgress 1.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.loader-status {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
  margin-top: -5px;
  animation: pulseStatus 1.5s ease-in-out infinite;
}

/* Animations */
@keyframes floatAvatar {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes loadProgress {
  0% {
    width: 0;
  }
  30% {
    width: 35%;
  }
  70% {
    width: 75%;
  }
  100% {
    width: 100%;
  }
}

@keyframes pulseStatus {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}
