/* Samsas. Structured first: neutral surfaces, one primary colour, thin lines,
   a fixed type scale. The playfulness is rationed — the mascot, the emoji for
   feelings and kinds, a tilt on what you pick, confetti when something is
   worth celebrating — so it reads as a wink rather than as the whole voice. */

:root {
  --ink: #1c2733;
  --muted: #66707a;
  --paper: #f4f5f1;
  --card: #ffffff;
  --line: #dcdfd6;

  --primary: #1f5c4d;           /* actions, selection, "done" */
  --primary-tint: #e3efe9;
  --accent: #f0a23b;            /* highlights: today, celebrations */
  --accent-tint: #fdf0d9;

  --coral: #e2674a;
  --teal: #2a9d8f;
  --m0: var(--coral);           /* the two people, everywhere they appear */
  --m1: var(--teal);

  /* tinted card backgrounds; the names are from the first design */
  --sun: var(--accent-tint);
  --mint: var(--primary-tint);
  --blush: #fbeae5;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 39, 51, .05), 0 4px 14px rgba(28, 39, 51, .05);
  --rounded: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  min-height: 100dvh;
}

main {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom));
}

/* headings keep the rounded face: the one typographic nod to the mascot */
h1, h2 { font-family: var(--rounded); }
h1 { font-size: 26px; font-weight: 700; margin: 0; letter-spacing: -.3px; }
h2 { font-size: 17px; font-weight: 700; margin: 0 0 10px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); font-size: 14px; }
.center { text-align: center; }

/* --- cards & buttons --- */

.card {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 0 0 14px;
}
.card.sun { background: var(--sun); border-color: #f3d9a6; }
.card.mint { background: var(--mint); border-color: #c5ddd2; }
.card.blush { background: var(--blush); border-color: #f1cfc5; }
button.card { font: inherit; }

button, input, textarea { font: inherit; color: inherit; }
/* no double-tap zoom, so a tap is a click straight away */
button, a, input, label { touch-action: manipulation; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 8px 18px;
  font-weight: 650;
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  border-radius: 12px;
  cursor: pointer;
  transition: filter .08s;
}
/* Pressed look without moving the button: a button that slides out from
   under the finger on press can lose the click when tapped near its edge. */
.btn:active { filter: brightness(.9); }
.btn:disabled { opacity: .45; cursor: default; }
/* quieter than the primary, for the second-most-likely action */
.btn.teal { background: var(--primary-tint); color: var(--primary); border-color: #c5ddd2; }
.btn.sun { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.btn.plain { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.small { min-height: 38px; padding: 4px 14px; font-size: 14px; }
.btn.wide { width: 100%; }
a.btn { text-decoration: none; }

.link {
  background: none;
  border: 0;
  padding: 6px 2px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }

label, .caption { display: block; font-weight: 600; font-size: 14px; }

input[type=text], input[type=date], input[type=time], textarea {
  display: block;
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
textarea { resize: vertical; min-height: 84px; }
input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
input[type=checkbox] { accent-color: var(--primary); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip {
  padding: 7px 13px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.chip.on { background: var(--primary-tint); border-color: var(--primary); color: var(--primary); }

/* --- people --- */

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  font-size: 22px;
  background: var(--accent-tint);
  border-radius: 50%;
}
.avatar.m0 { background: var(--m0); }
.avatar.m1 { background: var(--m1); }
.avatar.small { width: 28px; height: 28px; font-size: 15px; }
.avatar.none { background: var(--card); border: 1px dashed var(--muted); color: var(--muted); font-weight: 700; }

/* --- header & mascot --- */

.top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.top .date { display: inline-block; color: var(--muted); font-size: 14px; font-weight: 600; }
.top .date::first-letter, .day-head b::first-letter { text-transform: uppercase; }

.mascot-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.mascot { width: 76px; flex: none; animation: bob 4s ease-in-out infinite; }
.mascot.big { width: 132px; display: block; margin: 0 auto 6px; }
@keyframes bob { 50% { transform: translateY(-3px); } }

.bubble {
  position: relative;
  padding: 11px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-weight: 600;
}
.bubble::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 50%;
  width: 10px;
  height: 10px;
  background: var(--card);
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transform: translateY(-50%) rotate(45deg);
}

/* --- mood --- */

.moods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mood {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 2px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .1s;
}
.mood span { font-size: 28px; line-height: 1.15; }
/* the tilt is the playful bit: what you picked leans in */
.mood.on { background: var(--accent-tint); border-color: var(--accent); transform: rotate(-2deg) scale(1.03); }

.feeling { display: flex; gap: 12px; align-items: flex-start; }
.feeling + .feeling { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.feeling .big { font-size: 32px; line-height: 1; }
.feeling .what { font-weight: 650; }
.feeling .note { font-style: italic; }
.tag {
  display: inline-block;
  padding: 2px 10px;
  background: var(--primary-tint);
  color: var(--primary);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.history { display: grid; grid-template-columns: 34px repeat(7, 1fr); gap: 6px 2px; align-items: center; text-align: center; }
.history .dayname { font-size: 12px; font-weight: 600; color: var(--muted); }
.history .cell { font-size: 19px; }
.history .cell.empty { color: var(--line); }

/* --- week --- */

.weeknav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.weeknav .round { width: 44px; padding: 0; font-size: 20px; }

/* a week is seven of these: kept tight so the whole week fits without much scrolling */
.day { padding: 8px 12px; margin-bottom: 8px; }
.day.today { background: var(--accent-tint); border-color: var(--accent); }
.day.past { opacity: .6; }
.day-head { display: flex; align-items: center; justify-content: space-between; }
.day-head b { display: inline-block; font-size: 16px; font-weight: 650; }
.add {
  width: 30px;
  height: 30px;
  background: var(--primary-tint);
  color: var(--primary);
  border: 0;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.event {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--muted);
  border-radius: 10px;
  cursor: pointer;
}
.event.m0 { border-left-color: var(--m0); }
.event.m1 { border-left-color: var(--m1); }
.event.none { border-style: dashed; border-left-style: solid; }
.event .time { font-weight: 650; font-size: 14px; min-width: 44px; font-variant-numeric: tabular-nums; }
.event .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event .swap { font-size: 13px; color: var(--muted); }

/* --- jar --- */

.jar { display: block; width: 170px; margin: 0 auto 6px; }
.jar.shake { animation: shake .5s; }
@keyframes shake {
  20% { transform: rotate(-7deg); }
  40% { transform: rotate(6deg); }
  60% { transform: rotate(-4deg); }
  80% { transform: rotate(3deg); }
}

.slip {
  padding: 12px 14px;
  margin-top: 10px;
  background: var(--accent-tint);
  border: 1px solid #f3d9a6;
  border-radius: 4px 12px 6px 12px;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.slip:nth-child(3n+1) { background: var(--blush); border-color: #f1cfc5; transform: rotate(-.6deg); }
.slip:nth-child(3n+2) { background: var(--mint); border-color: #c5ddd2; transform: rotate(.5deg); }
.slip .from { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.slip.pop { animation: pop .45s backwards; }
@keyframes pop { from { opacity: 0; transform: translateY(24px) scale(.8) rotate(-6deg); } }

/* --- lists, menu, cycle --- */

.todo { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.todo + .todo { border-top: 1px solid var(--line); }
.check {
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  background: var(--card);
  color: #fff;
  border: 1.5px solid #b9bfb3;
  border-radius: 8px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}
.todo.done .check { background: var(--primary); border-color: var(--primary); }
.todo-text { padding: 7px 0; background: none; border: 0; text-align: left; font-weight: 500; overflow-wrap: anywhere; cursor: pointer; }
.todo.done .todo-text { text-decoration: line-through; color: var(--muted); }
.todo .mark { font-size: 14px; }
.add-row { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.add-row input { margin-top: 0; }
.add-row .btn { flex: none; }

.menu-day { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 12px 14px; margin-bottom: 10px; text-align: left; cursor: pointer; }
.menu-day .muted { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.menu-day b { font-size: 16px; font-weight: 650; }
.menu-day .desc { font-size: 14px; color: var(--muted); }

.phase { font-family: var(--rounded); font-size: 20px; font-weight: 700; }
.steps { margin: 0; padding-left: 22px; }
.steps li + li { margin-top: 4px; }

/* --- us --- */

.code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 2px;
}
.kid { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-weight: 600; }
.emoji-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.emoji-pick button {
  width: 42px;
  height: 42px;
  font-size: 22px;
  background: var(--card);
  border: 1px solid transparent;
  border-radius: 50%;
  cursor: pointer;
}
.emoji-pick button.on { border-color: var(--primary); background: var(--primary-tint); }

/* --- tabs, sheet, toast, confetti --- */

nav#tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  padding: 6px max(8px, calc(50% - 260px)) calc(6px + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--line);
}
nav#tabs[hidden] { display: none; }
nav#tabs button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0 4px;
  background: none;
  color: var(--muted);
  border: 0;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
nav#tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav#tabs button.on { color: var(--primary); background: var(--primary-tint); }

dialog#sheet {
  width: min(520px, 100%);
  max-width: 100%;
  max-height: 88dvh;
  margin: auto auto 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  color: var(--ink);
  background: var(--card);
  border: 0;
  border-radius: 18px 18px 0 0;
  overflow-y: auto;
}
dialog#sheet[open] { animation: rise .2s ease-out; }
dialog#sheet::backdrop { background: rgba(28, 39, 51, .45); }
@keyframes rise { from { transform: translateY(40%); opacity: 0; } }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  z-index: 20;
}

.confetti {
  position: fixed;
  top: -16px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 30;
  animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

@media (prefers-reduced-motion: reduce) {
  .mascot, .jar.shake, .slip.pop, dialog#sheet[open] { animation: none; }
  .confetti { display: none; }
}

/* --- kids' view (ui/kids.html): the same system, turned up a notch --- */

body.kids { font-size: 19px; }
body.kids main { max-width: 640px; padding-bottom: 40px; }
body.kids h1 { font-size: 30px; }
body.kids h2 { font-size: 19px; margin-top: 16px; }
.big { font-size: 34px; line-height: 1; }
.kid-card.k0 { background: var(--mint); border-color: #c5ddd2; }
.kid-card.k1 { background: var(--blush); border-color: #f1cfc5; }
.kid-card.k2 { background: var(--accent-tint); border-color: #f3d9a6; }
.kid-event { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-top: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.kid-event .time { font-weight: 700; font-variant-numeric: tabular-nums; }
.cap { margin-top: 12px; }
.cap::first-letter { text-transform: uppercase; }
.chore { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 8px; padding: 10px 12px; text-align: left; font-weight: 650; background: var(--card); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.chore .check { display: grid; place-items: center; width: 34px; height: 34px; font-size: 18px; }
.chore.done { background: var(--accent-tint); border-color: var(--accent); }
.chore.done .check { background: var(--primary); border-color: var(--primary); }
