:root {
  /* Light, calm pregnancy-friendly palette */
  --bg: #faf4f8;
  --bg-grad-1: #f6eef7;
  --bg-grad-2: #eef4f0;
  --surface: #ffffff;
  --ink: #4a3f4d;
  --ink-soft: #8a7d8f;
  --blush: #f3c6d6;
  --blush-deep: #e89bb4;
  --lavender: #d9cdef;
  --lavender-deep: #b4a0e0;
  --sage: #bcd9c4;
  --sage-deep: #8cc09c;
  --accent: #e89bb4;
  --shadow: 0 8px 24px rgba(120, 90, 120, 0.12);
  --radius: 22px;
}

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

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg-grad-1), var(--bg-grad-2));
  min-height: 100vh;
  min-height: 100dvh;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 20px calc(env(safe-area-inset-bottom) + 20px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100dvh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
}
.topbar h1 { font-size: 1.25rem; font-weight: 700; margin: 0; letter-spacing: -0.3px; }

.icon-btn {
  border: none;
  background: var(--surface);
  width: 44px; height: 44px;
  border-radius: 14px;
  font-size: 1.1rem;
  box-shadow: var(--shadow);
  cursor: pointer;
}

/* Today */
.today {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  box-shadow: var(--shadow);
}
.today-num { font-size: 3rem; font-weight: 800; line-height: 1; color: var(--blush-deep); }
.today-label { color: var(--ink-soft); margin-top: 6px; font-size: 0.95rem; }

/* Chips */
.chips { display: flex; gap: 10px; justify-content: center; }
.chip {
  flex: 1;
  border: 2px solid transparent;
  background: var(--surface);
  color: var(--ink);
  padding: 12px 8px;
  border-radius: 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.08s ease, border-color 0.15s ease;
}
.chip:active { transform: scale(0.96); }
.chip.is-active { border-color: var(--lavender-deep); background: #f4effc; }

/* Big tap */
.tap-area { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.tap-btn {
  width: 220px; height: 220px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  color: #fff;
  background: radial-gradient(circle at 35% 30%, var(--blush), var(--blush-deep));
  box-shadow: 0 14px 34px rgba(232, 155, 180, 0.45);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  transition: transform 0.08s ease, box-shadow 0.15s ease;
}
.tap-btn:active { transform: scale(0.94); box-shadow: 0 6px 18px rgba(232, 155, 180, 0.5); }
.tap-btn.pulse { animation: pulse 0.4s ease; }
@keyframes pulse { 0% { transform: scale(0.94);} 50% { transform: scale(1.04);} 100% { transform: scale(1);} }
.tap-emoji { font-size: 3rem; }
.tap-text { font-size: 1.2rem; font-weight: 700; }

.undo-btn {
  border: none; background: transparent; color: var(--ink-soft);
  font-size: 0.95rem; cursor: pointer; padding: 6px 12px;
}
.undo-btn:disabled { opacity: 0.4; cursor: default; }

/* Count to 10 */
.count10 {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.ghost-btn {
  width: 100%;
  border: 2px solid var(--sage);
  background: #f1f8f3;
  color: var(--ink);
  padding: 12px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}
.ghost-btn.small { width: auto; padding: 8px 16px; font-size: 0.85rem; }
.count10-active { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.count10-row { display: flex; justify-content: space-between; width: 100%; font-size: 1.1rem; }
.count10-progress b { color: var(--sage-deep); font-size: 1.4rem; }
.count10-timer { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.count10-bar { width: 100%; height: 10px; background: #eee; border-radius: 6px; overflow: hidden; }
.count10-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--sage), var(--sage-deep)); transition: width 0.3s ease; }
.count10-done { text-align: center; padding: 8px; font-weight: 600; color: var(--sage-deep); }

/* Recent */
.recent h2, .sheet h3 { font-size: 1rem; margin: 4px 0; color: var(--ink-soft); font-weight: 700; }
.recent-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.recent-list li {
  background: var(--surface); border-radius: 12px; padding: 10px 14px;
  display: flex; justify-content: space-between; box-shadow: var(--shadow); font-size: 0.95rem;
}
.recent-list li.empty { color: var(--ink-soft); justify-content: center; box-shadow: none; background: transparent; }
.recent-time { color: var(--ink-soft); }

.disclaimer { font-size: 0.78rem; color: var(--ink-soft); text-align: center; line-height: 1.5; margin: 8px 0 0; }

/* Stats sheet */
.sheet {
  position: fixed; inset: 0; background: rgba(74, 63, 77, 0.4);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
.sheet-panel {
  background: var(--bg); width: 100%; max-width: 480px;
  max-height: 92dvh; overflow-y: auto;
  border-radius: 24px 24px 0 0; padding: 20px 20px calc(env(safe-area-inset-bottom) + 24px);
  display: flex; flex-direction: column; gap: 10px;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(100%);} to { transform: translateY(0);} }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; }

.filter { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-btn {
  border: none; background: var(--surface); padding: 8px 14px; border-radius: 12px;
  font-weight: 600; cursor: pointer; box-shadow: var(--shadow); font-size: 0.88rem;
}
.filter-btn.is-active { background: var(--lavender); }
.date-picker { padding: 8px; border-radius: 10px; border: 1px solid var(--lavender); }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card { background: var(--surface); border-radius: 16px; padding: 14px; box-shadow: var(--shadow); }
.card .num { font-size: 1.6rem; font-weight: 800; color: var(--blush-deep); }
.card .lbl { font-size: 0.8rem; color: var(--ink-soft); margin-top: 2px; }

.perday { display: flex; flex-direction: column; gap: 6px; }
.perday-row { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; }
.perday-day { width: 88px; color: var(--ink-soft); }
.perday-bar { flex: 1; height: 14px; background: #eee; border-radius: 7px; overflow: hidden; }
.perday-bar > div { height: 100%; background: linear-gradient(90deg, var(--lavender), var(--lavender-deep)); }
.perday-n { width: 28px; text-align: right; font-weight: 600; }

.session-list, .timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.session-list li, .timeline li {
  background: var(--surface); border-radius: 12px; padding: 10px 14px;
  display: flex; justify-content: space-between; box-shadow: var(--shadow); font-size: 0.88rem;
}
.muted { color: var(--ink-soft); }

.export { display: flex; gap: 10px; margin-top: 8px; }
.export a { text-align: center; text-decoration: none; flex: 1; }

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 20px;
  font-size: 0.9rem; z-index: 100; box-shadow: var(--shadow);
}

.hidden { display: none !important; }
