:root {
  --cream: #eef7fb;
  --peach: #cfe8f7;
  --coral: #6ec6e8;
  --orange: #3ba7e0;
  --brown: #2c4a5e;
  --brown-soft: #4a7086;
  --gold: #8ecae6;
  --white: #f8fbfd;
  --green: #4caf7d;
  --green-bg: #e5f6ee;
}

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

body {
  font-family: "Noto Sans TC", "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(160deg, #eaf6fc 0%, #dbeefa 45%, #cfe9f7 100%);
  color: var(--brown);
  min-height: 100vh;
  overflow-x: hidden;
}

.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
  z-index: 0;
  pointer-events: none;
}
.blob1 { width: 380px; height: 380px; background: var(--coral); top: -120px; left: -100px; }
.blob2 { width: 320px; height: 320px; background: var(--gold); bottom: -100px; right: -80px; }
.blob3 { width: 220px; height: 220px; background: #a8dced; top: 40%; right: 5%; opacity: 0.35; }

.container {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 24px 100px;
}

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

.site-nav { animation: fadeUp 0.6s ease both; }
.page-header { animation: fadeUp 0.6s ease 0.05s both; }
.card { animation: fadeUp 0.6s ease both; }
.card:nth-of-type(1) { animation-delay: 0.1s; }
.card:nth-of-type(2) { animation-delay: 0.18s; }
.card:nth-of-type(3) { animation-delay: 0.26s; }
.card:nth-of-type(4) { animation-delay: 0.34s; }

/* Nav */
.site-nav {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.site-nav a {
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--orange);
  background: var(--white);
  padding: 9px 22px;
  border-radius: 999px;
  box-shadow: 0 8px 20px -10px rgba(44, 74, 94, 0.3);
  border: 1px solid rgba(59, 167, 224, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.site-nav a:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -10px rgba(59, 167, 224, 0.4);
}

.site-nav a.active {
  color: #fff;
  background: linear-gradient(135deg, var(--orange), var(--coral));
  border-color: transparent;
}

.page-header {
  text-align: center;
  padding: 10px 20px 40px;
}

.page-header h1 {
  font-size: clamp(1.8rem, 4.5vw, 2.6rem);
  font-weight: 800;
  color: var(--brown);
  margin-bottom: 10px;
}

.page-header p {
  font-size: 1.05rem;
  color: var(--brown-soft);
  font-weight: 500;
}

/* Cards */
.card {
  background: var(--white);
  border-radius: 24px;
  padding: 32px 36px;
  margin-bottom: 28px;
  box-shadow: 0 15px 35px -15px rgba(44, 74, 94, 0.22);
  border: 1px solid rgba(160, 210, 240, 0.4);
}

.card {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 40px -18px rgba(44, 74, 94, 0.28);
}

.card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--orange);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card p.hint {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--brown-soft);
  margin-bottom: 16px;
}

@media (max-width: 600px) {
  .card { padding: 24px 20px; }
}

/* Forms */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  font-family: inherit;
  font-size: 1rem;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid rgba(140, 200, 235, 0.5);
  background: var(--cream);
  color: var(--brown);
  width: 100%;
}

textarea { resize: vertical; min-height: 60px; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(59, 167, 224, 0.2);
}

label.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--brown-soft);
  cursor: pointer;
}

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--orange);
  cursor: pointer;
  flex-shrink: 0;
}

.btn {
  display: inline-block;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--orange), var(--coral));
  border: none;
  padding: 11px 26px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  align-self: flex-start;
}

.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -8px rgba(59, 167, 224, 0.5); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-outline {
  background: var(--white);
  color: var(--orange);
  border: 1px solid rgba(59, 167, 224, 0.4);
}

.btn-small {
  font-size: 0.82rem;
  padding: 6px 14px;
}

.btn-danger {
  background: #f8fbfd;
  color: #d9534f;
  border: 1px solid rgba(217, 83, 79, 0.35);
}

/* Lists */
.item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #f0f9fd, #e0f2fa);
  border: 1px solid rgba(140, 200, 235, 0.4);
  border-left: 4px solid var(--coral);
  border-radius: 14px;
  padding: 12px 18px;
  margin-bottom: 10px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-left-color 0.2s ease;
}

.item-row:hover {
  transform: translateX(3px);
  box-shadow: 0 10px 22px -14px rgba(59, 167, 224, 0.5);
  border-left-color: var(--orange);
}

.item-row.todo-item.done { border-left-color: var(--green); }

.item-row .item-main { flex: 1; min-width: 0; }
.item-row .item-title { font-weight: 700; color: var(--brown); }
.item-row .item-sub { font-size: 0.85rem; color: var(--brown-soft); margin-top: 2px; }
.item-row .item-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Date badge for calendar events */
.date-badge {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--orange), var(--coral));
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
  box-shadow: 0 8px 16px -8px rgba(59, 167, 224, 0.6);
}
.date-badge .month { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; opacity: 0.9; }
.date-badge .day { font-size: 1.25rem; font-weight: 800; }
.date-badge.all-day { background: linear-gradient(135deg, var(--green), #6fcf9c); }

.empty-hint {
  text-align: center;
  color: var(--brown-soft);
  padding: 16px 0;
  opacity: 0.85;
}

/* Progress bars */
.progress-block { margin-bottom: 20px; }
.progress-block:last-child { margin-bottom: 0; }

.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--brown);
  margin-bottom: 6px;
  font-weight: 600;
}

.progress-label > span:first-child {
  flex-shrink: 0;
  white-space: nowrap;
}

.progress-label > span:last-child {
  text-align: right;
}

.progress-label .remaining { color: var(--orange); font-weight: 700; }
.progress-label .done { color: var(--green); }

.progress-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: var(--peach);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--orange), var(--coral));
  transition: width 0.4s ease;
}

.progress-fill.complete { background: linear-gradient(90deg, var(--green), #6fcf9c); }

.progress-pct {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brown-soft);
  opacity: 0.8;
  margin-left: 6px;
}

/* Overall stat ring */
.stat-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.stat-ring {
  flex-shrink: 0;
  position: relative;
  width: 120px;
  height: 120px;
}

.stat-ring svg { transform: rotate(-90deg); }

.stat-ring-track { fill: none; stroke: var(--peach); stroke-width: 10; }
.stat-ring-fill {
  fill: none;
  stroke: url(#stat-ring-gradient);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
}

.stat-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.stat-ring-label .pct { font-size: 1.5rem; font-weight: 800; color: var(--brown); }
.stat-ring-label .tag { font-size: 0.7rem; color: var(--brown-soft); font-weight: 600; }

.stat-hero-text { flex: 1; min-width: 180px; }
.stat-hero-text .headline { font-size: 1.1rem; font-weight: 700; color: var(--brown); margin-bottom: 4px; }
.stat-hero-text .detail { font-size: 0.92rem; color: var(--brown-soft); }
.stat-hero-text .detail .remaining { color: var(--orange); font-weight: 700; }
.stat-hero-text .detail .done { color: var(--green); font-weight: 700; }

/* Icon rendering */
.icon-emoji { display: inline-block; line-height: 1; }
.icon-img {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  border-radius: 6px;
  object-fit: cover;
  vertical-align: -0.2em;
}

.progress-icon.icon-img { width: 1em; height: 1em; }

/* Icon picker */
.icon-picker { position: relative; display: inline-block; }

.icon-picker-trigger {
  width: 40px;
  height: 40px;
  font-size: 1.3rem;
  border-radius: 12px;
  border: 1px solid rgba(140, 200, 235, 0.5);
  background: var(--cream);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.icon-picker-trigger:hover {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(59, 167, 224, 0.15);
}

.icon-picker-trigger .icon-img { width: 1.4em; height: 1.4em; border-radius: 8px; }

.icon-picker-panel {
  position: absolute;
  z-index: 10;
  top: calc(100% + 8px);
  left: 0;
  width: 260px;
  background: var(--white);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 20px 40px -12px rgba(44, 74, 94, 0.35);
  border: 1px solid rgba(160, 210, 240, 0.5);
}

.icon-picker-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.icon-picker-tabs button {
  flex: 1;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(140, 200, 235, 0.5);
  background: var(--cream);
  color: var(--brown-soft);
  cursor: pointer;
}

.icon-picker-tabs button.active {
  background: linear-gradient(135deg, var(--orange), var(--coral));
  color: #fff;
  border-color: transparent;
}

.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.icon-picker-grid[hidden],
.icon-picker-upload[hidden] {
  display: none;
}

.icon-picker-emoji-btn {
  font-size: 1.2rem;
  padding: 6px 0;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--cream);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.icon-picker-emoji-btn:hover {
  background: var(--peach);
  transform: scale(1.1);
}

.icon-picker-upload {
  text-align: center;
}

.icon-picker-upload input[type="file"] {
  font-size: 0.85rem;
  padding: 8px;
}

.icon-picker-hint {
  font-size: 0.78rem;
  color: var(--brown-soft);
  margin-top: 8px;
}

.icon-field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.icon-field-row .icon-field-label {
  font-size: 0.85rem;
  color: var(--brown-soft);
}

footer {
  text-align: center;
  margin-top: 40px;
  color: var(--brown-soft);
  font-size: 0.9rem;
  opacity: 0.8;
  position: relative;
  z-index: 1;
}
