@import url("https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600;700&display=swap");

:root {
  --cream: #FFF9F2;
  --peach: #FFD9C2;
  --blush: #FFC9D6;
  --lavender: #DCCBFF;
  --mint: #C5F0DD;
  --butter: #FFEFB8;
  --sky: #C7E6FF;
  --coral: #FF9374;
  --ink: #5B4B47;
  --ink-light: #8C7A75;
  --shadow-soft: 0 8px 24px -8px rgba(91, 75, 71, 0.18);
  --shadow-glow: 0 0 0 4px rgba(255, 147, 116, 0.15);
  --radius-lg: 1.75rem;
  --radius-xl: 2.25rem;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Quicksand", system-ui, sans-serif;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(255, 217, 194, 0.45) 0%, transparent 35%),
    radial-gradient(circle at 88% 4%, rgba(199, 230, 255, 0.45) 0%, transparent 35%),
    radial-gradient(circle at 92% 85%, rgba(220, 203, 255, 0.4) 0%, transparent 40%),
    radial-gradient(circle at 6% 90%, rgba(197, 240, 221, 0.4) 0%, transparent 40%);
  background-attachment: fixed;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(91, 75, 71, 0.18); border-radius: 999px; }

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
p { margin: 0; }
input, select, textarea, button { font-family: inherit; font-size: 1rem; }

/* ---------- Layout ---------- */
.app {
  display: flex;
  min-height: 100vh;
}

.main {
  flex: 1;
  padding: 1.25rem 1.25rem 6rem;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 860px) {
  .main { padding: 2rem 2.5rem; }
}

/* ---------- Nav ---------- */
.nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(255, 249, 242, 0.92);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(91, 75, 71, 0.08);
  padding: 0.5rem 0.25rem;
  z-index: 50;
}

.nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--ink-light);
  padding: 0.25rem 0.5rem;
  border-radius: 1rem;
  transition: all 0.15s ease;
}

.nav a.active, .nav a:hover {
  color: var(--ink);
  background: var(--peach);
}

.nav .nav-emoji { font-size: 1.25rem; }

@media (min-width: 860px) {
  .app { gap: 0; }
  .nav {
    position: sticky;
    top: 0;
    height: 100vh;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    width: 200px;
    border-top: none;
    border-right: 1px solid rgba(91, 75, 71, 0.08);
    padding: 1.5rem 1rem;
    gap: 0.4rem;
  }
  .nav .brand {
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0 0.5rem 1rem;
  }
  .nav a {
    flex-direction: row;
    justify-content: flex-start;
    font-size: 0.95rem;
    padding: 0.6rem 0.75rem;
    gap: 0.6rem;
  }
  .nav .nav-emoji { font-size: 1.1rem; }
  .main { padding: 2rem 2.5rem 2rem; }
}

/* ---------- Card ---------- */
.card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.card-peach { background: var(--peach); }
.card-blush { background: var(--blush); }
.card-lavender { background: var(--lavender); }
.card-mint { background: var(--mint); }
.card-butter { background: var(--butter); }
.card-sky { background: var(--sky); }

.card h2, .card h3 { margin-bottom: 0.5rem; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.card-sub { color: var(--ink-light); font-size: 0.85rem; }

/* ---------- Pills ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(91, 75, 71, 0.06);
  color: var(--ink);
  border: none;
  cursor: default;
}

.pill-click { cursor: pointer; transition: transform 0.1s ease; }
.pill-click:hover { transform: scale(1.04); }
.pill-active { box-shadow: var(--shadow-glow); }

.pill-amazon, .bg-peach { background: var(--peach); }
.pill-thrivegetter, .bg-sky { background: var(--sky); }
.pill-digital-products, .bg-lavender { background: var(--lavender); }
.pill-thealmosthealedclub, .bg-blush { background: var(--blush); }
.pill-other, .bg-mint { background: var(--mint); }
.bg-butter { background: var(--butter); }
.bg-ink5 { background: rgba(91,75,71,0.06); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  border-radius: 1rem;
  border: none;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
  font-size: 0.95rem;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--coral); color: #fff; box-shadow: var(--shadow-soft); }
.btn-secondary { background: var(--lavender); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-light); }
.btn-ghost:hover { color: var(--ink); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.82rem; border-radius: 0.8rem; }
.btn-block { width: 100%; }
.btn-danger { background: var(--blush); color: var(--ink); }

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.75rem; }
.field label { font-size: 0.8rem; font-weight: 700; color: var(--ink-light); }
.input, select.input, textarea.input {
  border: 1px solid rgba(91, 75, 71, 0.15);
  background: #fff;
  border-radius: 0.9rem;
  padding: 0.6rem 0.85rem;
  color: var(--ink);
  outline: none;
}
.input:focus { border-color: var(--coral); }

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--ink-light);
}
.empty .emoji { font-size: 2.5rem; display: block; margin-bottom: 0.5rem; }

/* ---------- Progress ring ---------- */
.ring-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}

/* ---------- Animations ---------- */
@keyframes pop {
  0% { transform: scale(0.85); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 147, 116, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(255, 147, 116, 0); }
}

.pop-in { animation: pop 0.35s ease-out; }
.float { animation: float 3s ease-in-out infinite; }

/* ---------- Celebration toast ---------- */
.celebration {
  position: fixed;
  top: 1rem; left: 50%;
  transform: translateX(-50%);
  background: var(--mint);
  color: var(--ink);
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
  z-index: 100;
  animation: pop 0.35s ease-out;
}

/* ---------- Focus timer ---------- */
.timer-card { display: flex; flex-direction: column; gap: 0.6rem; }
.timer-ring-wrap { display: flex; align-items: center; gap: 1rem; }
.timer-ring { flex-shrink: 0; }
.timer-ring circle { transition: stroke-dashoffset 1s linear, stroke 0.3s ease; }
.timer-time { font-size: 1.4rem; font-weight: 700; }
.timer-overtime .timer-time { color: var(--coral); }
.timer-overtime circle.timer-progress { stroke: var(--coral) !important; }
.timer-overtime { animation: pulse-glow 1.6s ease-in-out infinite; border-radius: var(--radius-lg); }
.timer-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- Habit / streak grid ---------- */
.streak-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.streak-table th, .streak-table td { padding: 0.4rem; text-align: center; }
.streak-table th { color: var(--ink-light); font-weight: 600; font-size: 0.75rem; }
.streak-cell {
  width: 1.6rem; height: 1.6rem; border-radius: 0.5rem;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(91,75,71,0.06); cursor: pointer; font-size: 0.9rem;
}
.streak-cell.done { background: var(--mint); }

/* ---------- Misc ---------- */
.row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--ink-light); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.section-title { font-size: 1.4rem; margin-bottom: 0.25rem; }
.icon-btn {
  background: rgba(91,75,71,0.06); border: none; border-radius: 0.7rem;
  width: 2.2rem; height: 2.2rem; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1.1rem;
}
.loading { text-align: center; padding: 3rem 1rem; color: var(--ink-light); }
.checkbox-row { display: flex; align-items: center; gap: 0.6rem; }
.checkbox-row input[type="checkbox"] { width: 1.3rem; height: 1.3rem; accent-color: var(--coral); }
