:root {
  --bg: #F0F9FF;
  --card: #FFFFFF;
  --text: #2D3748;
  --sub: #718096;
  --done-bg: #F0FFF4;
  --shadow: 0 4px 16px rgba(79,195,247,0.13);
  --radius: 18px;
}

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

body {
  font-family: 'Hiragino Rounded Gothic Pro', 'Yu Gothic', 'Meiryo', sans-serif;
  background: var(--bg);
  min-height: 100vh;
  padding: 0 0 60px;
  color: var(--text);
}

/* Tab bar */
.tab-bar {
  display: flex;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  position: sticky;
  top: 0;
  z-index: 100;
}
.tab-btn {
  flex: 1;
  padding: 14px 8px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--sub);
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.tab-btn .tab-icon { font-size: 1.4rem; }
.tab-btn.active-morning { color: #F5A623; border-bottom-color: #F5A623; }
.tab-btn.active-night   { color: #9B89D4; border-bottom-color: #9B89D4; }

/* Header */
.header {
  padding: 24px 20px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.header-morning { background: linear-gradient(135deg, #4FC3F7 0%, #81D4FA 50%, #FFD54F 100%); }
.header-night   { background: linear-gradient(135deg, #9B89D4 0%, #B39DDB 50%, #CE93D8 100%); }
.header::before {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 24px;
  background: var(--bg);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}
.header-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.15);
  letter-spacing: 0.04em;
}
.header-date {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.9);
  margin-top: 4px;
  font-weight: 700;
}
.header-icon { font-size: 2.2rem; display: block; margin-bottom: 6px; }
.spin  { animation: spin-slow 10s linear infinite; }
.float { animation: float 4s ease-in-out infinite; }
@keyframes spin-slow { 0%{transform:rotate(0deg)} 100%{transform:rotate(360deg)} }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }

/* Progress */
.progress-wrap { padding: 20px 20px 10px; }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--sub);
  margin-bottom: 8px;
}
.progress-count-morning { color: #F5A623; font-size: 1rem; }
.progress-count-night   { color: #9B89D4; font-size: 1rem; }
.progress-bar-bg { background: #E2E8F0; border-radius: 99px; height: 14px; overflow: hidden; }
.progress-bar-morning {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #4FC3F7, #FFD54F);
  transition: width 0.5s cubic-bezier(.4,0,.2,1); min-width: 0;
}
.progress-bar-night {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #9B89D4, #CE93D8);
  transition: width 0.5s cubic-bezier(.4,0,.2,1); min-width: 0;
}

/* Fireworks */
#fireworks-canvas {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none; z-index: 999; display: none;
}

/* Celebration */
.complete-banner { display: none !important; }
.celebration-overlay {
  display: none; margin: 0 20px 16px; border-radius: 24px;
  padding: 28px 20px 24px; text-align: center;
  animation: pop-in 0.5s cubic-bezier(.4,0,.2,1);
}
.celebration-overlay.show { display: block; }
@keyframes pop-in { 0%{transform:scale(0.85);opacity:0} 100%{transform:scale(1);opacity:1} }
.celebration-morning { background: linear-gradient(135deg, #A8EDCA 0%, #81D4FA 100%); }
.celebration-night   { background: linear-gradient(135deg, #9B89D4 0%, #CE93D8 100%); }
.cel-icon { font-size: 3rem; display: block; margin-bottom: 12px; animation: bounce 0.8s ease infinite alternate; }
@keyframes bounce { 0%{transform:translateY(0)} 100%{transform:translateY(-10px)} }
.cel-text { font-size: 1.5rem; font-weight: 900; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.15); line-height: 1.4; letter-spacing: 0.03em; }
.cel-sub  { font-size: 0.9rem; color: rgba(255,255,255,0.9); margin-top: 8px; font-weight: 700; }

/* Section */
.section { padding: 10px 20px 0; }
.section-title {
  font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em;
  color: var(--sub); margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: #E2E8F0; }

/* Task card */
.task-card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer; transition: transform 0.15s, box-shadow 0.15s, background 0.3s;
  user-select: none; -webkit-tap-highlight-color: transparent;
  border: 2px solid transparent;
}
.task-card:active { transform: scale(0.97); }
.task-card.done { background: var(--done-bg); border-color: #A5D6A7; box-shadow: 0 2px 8px rgba(165,214,167,0.2); }
.night-mode.task-card.done { background: #F3E5F5; border-color: #CE93D8; }
.task-icon {
  font-size: 1.9rem; width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px; flex-shrink: 0; transition: transform 0.3s;
}
.task-card.done .task-icon { transform: scale(1.1) rotate(-5deg); }
.task-body { flex: 1; }
.task-name { font-size: 1rem; font-weight: 800; color: var(--text); transition: color 0.3s; }
.task-card.done .task-name { color: #68D391; text-decoration: line-through; text-decoration-color: #68D391; }
.task-sub  { font-size: 0.78rem; color: var(--sub); margin-top: 2px; font-weight: 600; }
.check-circle {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2.5px solid #CBD5E0; display: flex;
  align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.3s; font-size: 1.1rem;
}
.task-card.done .check-circle { background: #68D391; border-color: #68D391; color: #fff; }

/* Reset */
.reset-btn {
  display: block; margin: 22px auto 0;
  background: none; border: 2px solid #CBD5E0;
  border-radius: 99px; padding: 10px 28px;
  font-size: 0.88rem; font-weight: 800; color: var(--sub);
  cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.reset-btn:active { background: #EDF2F7; transform: scale(0.97); }

.page { display: none; }
.page.active { display: block; }
