:root {
  --pink-1: #ff6fb1;
  --pink-2: #ff9fd0;
  --pink-3: #ffd6ea;
  --purple: #c17bff;
  --gold: #ffd166;
  --text: #6a2b4e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', sans-serif;
  color: #6a2b4e;
  background: radial-gradient(circle at 15% 10%, #ffe9f5 0%, transparent 45%),
              radial-gradient(circle at 85% 0%, #f3e6ff 0%, transparent 40%),
              linear-gradient(160deg, #fff0f7 0%, #ffe3f3 40%, #ffeede 100%);
  background-attachment: fixed;
  padding-bottom: 60px;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  position: relative;
  z-index: 1;
}

.bg-sparkles {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.bg-sparkle {
  position: absolute;
  bottom: -40px;
  opacity: 0;
  animation-name: float-up;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
  filter: drop-shadow(0 0 4px rgba(255, 159, 208, 0.5));
}

@keyframes float-up {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0;
  }
  12% {
    opacity: 0.85;
  }
  85% {
    opacity: 0.5;
  }
  100% {
    transform: translate(var(--drift, 24px), -115vh) rotate(360deg);
    opacity: 0;
  }
}

.burst-particle {
  position: fixed;
  pointer-events: none;
  z-index: 999;
  animation: burst-out 0.7s ease-out forwards;
}

@keyframes burst-out {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1);
    opacity: 0;
  }
}

.check-visual.celebrate {
  animation: pop-bounce 0.4s ease;
}

@keyframes pop-bounce {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.4);
  }
  100% {
    transform: scale(1);
  }
}

.category-list.fade-in {
  animation: fade-in-up 0.3s ease;
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-header {
  text-align: center;
  margin-bottom: 24px;
}

.app-header h1 {
  font-family: 'Mochiy Pop One', 'Zen Maru Gothic', sans-serif;
  font-size: clamp(28px, 7vw, 36px);
  margin: 0;
  background: linear-gradient(90deg, #ff6fb1, #c17bff 60%, #ff9fd0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 1px;
  text-shadow: 0 2px 12px rgba(255, 111, 177, 0.25);
}

.app-header .heart {
  -webkit-text-fill-color: #ff6fb1;
  color: #ff6fb1;
}

.subtitle {
  margin: 6px 0 0;
  font-size: 14px;
  color: #a8628a;
}

.tab-bar {
  display: flex;
  gap: 8px;
  background: #ffe9f5;
  border-radius: 999px;
  padding: 5px;
  margin-bottom: 18px;
}

.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: #b85a9a;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.tab-btn.active {
  background: linear-gradient(135deg, #ff6fb1, #c17bff);
  color: #fff;
  box-shadow: 0 4px 10px rgba(255, 111, 177, 0.35);
  animation: tab-glow 1.8s ease-in-out infinite;
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.category-card.view-done .add-task-form,
.category-card.view-done .category-actions {
  display: none;
}

.category-card {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(6px);
  border: 2px solid #ffd6ea;
  border-radius: 22px;
  padding: 14px 16px 16px;
  box-shadow: 0 6px 18px rgba(255, 143, 197, 0.18);
}

.category-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.collapse-btn {
  background: none;
  border: none;
  font-size: 16px;
  color: #ff6fb1;
  cursor: pointer;
  transition: transform 0.2s ease;
  padding: 4px;
  line-height: 1;
}

.category-card.collapsed .collapse-btn {
  transform: rotate(-90deg);
}

.category-name {
  flex: 1;
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #d1418f;
  word-break: break-all;
}

.category-actions {
  display: flex;
  gap: 4px;
}

.category-actions button {
  background: #fff3fa;
  border: none;
  border-radius: 999px;
  width: 30px;
  height: 30px;
  font-size: 13px;
  cursor: pointer;
  color: #b85a9a;
  transition: background 0.15s ease, transform 0.15s ease;
}

.category-actions button:hover {
  background: #ffd6ea;
  transform: scale(1.08);
}

.task-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.category-card.collapsed .task-list,
.category-card.collapsed .add-task-form {
  display: none;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border-radius: 14px;
  padding: 12px;
  border: 1px solid #ffe3f0;
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.task-item:hover {
  background: #fff7fb;
  border-color: #ffc2e0;
}

.task-item:active {
  transform: scale(0.99);
}

.task-item.done {
  background: linear-gradient(135deg, #fdf1fb, #f6ecff);
  border-color: #f0d9ef;
}

.check-visual {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #ff9fd0;
  display: inline-block;
  position: relative;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.task-item.done .check-visual {
  background: linear-gradient(135deg, #ff6fb1, #c17bff);
  border-color: transparent;
}

.task-item.done .check-visual::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: bold;
}

.task-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task-name {
  font-size: 15px;
  word-break: break-all;
  transition: color 0.15s ease;
}

.task-item.done .task-name {
  text-decoration: line-through;
  color: #cba0bc;
}

.due-badge {
  display: none;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ffe9f5;
  color: #b85a9a;
}

.due-badge.show {
  display: inline-block;
}

.due-badge.today {
  background: #fff1c9;
  color: #a3760a;
}

.due-badge.overdue {
  background: #ffdbe0;
  color: #d1364a;
}

.due-date-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  border: none;
}

.due-date-btn,
.edit-task-btn,
.delete-task-btn {
  background: none;
  border: none;
  color: #e0a8c4;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.due-date-btn:hover,
.edit-task-btn:hover,
.delete-task-btn:hover {
  background: #ffe3f0;
  color: #d1418f;
}

.category-card.view-done .due-date-btn,
.category-card.view-done .edit-task-btn {
  display: none;
}

.add-task-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.add-task-input {
  flex: 1;
  border: 2px solid #ffe3f0;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: #fffafd;
  color: #6a2b4e;
}

.add-task-input:focus {
  border-color: #ff9fd0;
}

.add-task-submit {
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #ff6fb1, #c17bff);
  cursor: pointer;
  white-space: nowrap;
}

.add-task-submit:active {
  transform: scale(0.96);
}

.empty-hint {
  text-align: center;
  font-size: 13px;
  color: #cba0bc;
  padding: 6px 0 2px;
}

.add-category-btn {
  display: block;
  width: 100%;
  margin-top: 20px;
  border: 2px dashed #ff9fd0;
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.5);
  color: #d1418f;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.add-category-btn:hover {
  background: #fff0f7;
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 4px 14px rgba(255, 159, 208, 0.35);
}

@keyframes tab-glow {
  0%, 100% {
    box-shadow: 0 4px 10px rgba(255, 111, 177, 0.35);
  }
  50% {
    box-shadow: 0 4px 16px rgba(193, 123, 255, 0.5);
  }
}

.category-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.category-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(255, 143, 197, 0.28);
}

.no-categories {
  text-align: center;
  color: #b85a9a;
  padding: 30px 10px;
  font-size: 14px;
}

@media (max-width: 380px) {
  .app-header h1 {
    font-size: 26px;
  }
}
