/* Mellow — mobile-first, kidsy but quiet. */
:root {
  --paper: #FFF9F0;
  --card: #FFFFFF;
  --ink: #2B2A33;
  --ink-2: #5C5968;
  --muted: #8F8B9B;
  --line: #EFE4D4;
  --boy: #7FB3E6;
  --girl: #F4A6B8;
  --butter: #FFD97A;
  --mint: #A8E0C2;
  --mint-ink: #2F7A55;
  --rose-ink: #B2415E;
  --amber-ink: #9A6B00;
  --plum: #3B3650;
  --radius: 20px;
  --tap: 48px;
  --font-display: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
h1, h2, h3, .brand-title, .cal-title, .score, .who-name, .q-num { font-family: var(--font-display); font-weight: 500; letter-spacing: .01em; }
h1 { font-size: 26px; margin: 6px 0 2px; line-height: 1.15; }
h2 { font-size: 18px; margin: 0 0 10px; }
p { margin: 4px 0; }
a { color: var(--ink); text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; display: block; }
.mt { margin-top: 18px; }
.link { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; font-weight: 600; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }

/* layout */
.page { max-width: 460px; margin: 0 auto; padding: 8px 16px calc(84px + env(safe-area-inset-bottom)); }
.page-bare { padding-top: 48px; padding-bottom: 40px; }
.topbar {
  max-width: 460px; margin: 0 auto; padding: calc(10px + env(safe-area-inset-top)) 16px 6px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 20px; font-weight: 500; }
.topbar-me { display: inline-flex; border-radius: 50%; }
.doodle { display: inline-block; vertical-align: middle; }
.doodle svg { width: 100%; height: 100%; display: block; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: rgba(255,249,240,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
  display: flex; justify-content: space-around;
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 72px; min-height: var(--tap); justify-content: center; font-size: 11px; font-weight: 700; color: var(--muted); border-radius: 14px; }
.tab-icon { font-size: 18px; line-height: 1; }
.tab.active { color: var(--ink); background: #fff; box-shadow: 0 1px 0 var(--line); }

/* hero */
.hero { text-align: center; padding: 28px 0 22px; }
.hero-sm { padding: 10px 0 14px; }
.brand-title { font-size: 44px; margin: 8px 0 0; }

/* cards & rows */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; margin: 12px 0; }
.card-title { font-size: 16px; }
.section { margin-top: 20px; }
.row { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; margin-bottom: 8px; min-height: 58px; }
.row:active { background: #FFF4E3; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 13px; color: var(--muted); }
.row-wait { border-style: dashed; border-color: #F2D48A; background: #FFFCF3; }
.empty { text-align: center; padding: 24px 12px; }
.empty .doodle { margin: 0 -4px; }

/* chips */
.chip { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.chip-wait { background: var(--butter); color: var(--amber-ink); }
.chip-good { background: var(--mint); color: var(--mint-ink); }
.chip-bad  { background: #FFD9DF; color: var(--rose-ink); }

/* score */
.score { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 600; }
.score-sm { width: 40px; height: 40px; font-size: 15px; }
.score-lg { width: 96px; height: 96px; font-size: 40px; margin: 4px auto 6px; }
.score-high { background: var(--mint); color: var(--mint-ink); }
.score-mid  { background: var(--butter); color: var(--amber-ink); }
.score-low  { background: #FFD9DF; color: var(--rose-ink); }

/* forms */
.stack { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 700; color: var(--ink-2); padding-left: 4px; }
.input {
  width: 100%; font: inherit; font-size: 17px; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: 16px;
  padding: 13px 16px; min-height: var(--tap); outline: none; -webkit-appearance: none; appearance: none;
}
.input:focus { border-color: var(--boy); box-shadow: 0 0 0 4px rgba(127,179,230,.22); }
.input-lg { font-size: 20px; letter-spacing: .1em; }
textarea.input { resize: none; line-height: 1.4; }
input[type="date"].input { min-height: var(--tap); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 700; font-size: 16px; min-height: 52px; padding: 12px 22px;
  border-radius: 999px; border: 1.5px solid transparent; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn-lg { min-height: 60px; font-size: 18px; }
.btn-primary { background: var(--plum); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn-danger { background: transparent; color: var(--rose-ink); border-color: #F6C9D2; }
form.mt { margin-top: 18px; }

/* toast */
.toast {
  position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 16px; right: 16px; z-index: 20;
  max-width: 428px; margin: 0 auto; padding: 12px 16px; border-radius: 14px; font-weight: 700; font-size: 14px;
  animation: toast-out 4.5s forwards; box-shadow: 0 6px 24px rgba(43,42,51,.12);
}
.toast.static { position: static; animation: none; box-shadow: none; }
.toast-ok  { background: var(--mint); color: var(--mint-ink); }
.toast-bad { background: #FFD9DF; color: var(--rose-ink); }
@keyframes toast-out { 0%, 80% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }

/* login */
.who-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
.who-form { margin: 0; }
.who-card {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: #fff; border: 1.5px solid var(--line); border-radius: 24px; padding: 22px 10px 16px;
  cursor: pointer; font: inherit; color: var(--ink);
}
.who-card:active { transform: scale(.98); }
.who-beck:active { border-color: var(--boy); }
.who-boo:active  { border-color: var(--girl); }
.who-name { font-size: 20px; }

/* calendar */
.cal { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 10px 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.cal-title { font-size: 20px; margin: 0; }
.cal-nav { width: var(--tap); height: var(--tap); display: inline-flex; align-items: center; justify-content: center; font-size: 28px; color: var(--ink-2); border-radius: 50%; }
.cal-nav:active { background: var(--paper); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0 6px; }
.cal-day { position: relative; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 12px; font-size: 15px; font-weight: 600; color: var(--ink); }
.cal-day.other { color: #CFC9D8; }
.cal-day.today .cal-num { text-decoration: underline; text-decoration-color: var(--boy); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.cal-day.has { background: var(--mint); color: var(--mint-ink); }
.cal-day.has.waiting { background: var(--butter); color: var(--amber-ink); }
.cal-day.has .cal-num { font-weight: 700; }
.cal-dot { position: absolute; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .7; }
a.cal-day:active { background: var(--paper); }
.legend { font-size: 12px; margin: 10px 4px 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: -1px; }
.dot-done { background: var(--mint); }
.dot-wait { background: var(--butter); }

.fab {
  position: fixed; right: 20px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 11;
  width: 58px; height: 58px; border-radius: 50%; background: var(--plum); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 300; line-height: 1;
  box-shadow: 0 8px 24px rgba(59,54,80,.28);
}
.fab:active { transform: scale(.96); }

/* outing detail */
.qrow { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.qrow:last-child { border-bottom: 0; }
.qrow-theme { font-weight: 700; font-size: 14px; }
.pips { display: inline-flex; gap: 5px; }
.pip { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.pip.on { background: var(--boy); }
.note { font-size: 15px; font-style: italic; color: var(--ink-2); margin: 0; }

/* survey */
.survey { gap: 14px; }
.q { border: 1px solid var(--line); background: #fff; border-radius: var(--radius); padding: 16px 14px 12px; margin: 0; min-width: 0; }
.q legend { padding: 0; display: flex; gap: 10px; align-items: flex-start; float: left; width: 100%; margin-bottom: 12px; }
.q-missing { border-color: var(--girl); box-shadow: 0 0 0 3px rgba(244,166,184,.25); }
.q-num { flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%; background: var(--butter); color: var(--amber-ink); display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.q-text { font-weight: 700; font-size: 16px; line-height: 1.35; }
.q-text em { font-weight: 400; color: var(--muted); font-style: normal; }
.q .input { clear: both; }
.scale { clear: both; display: flex; justify-content: space-between; gap: 4px; }
.scale-opt { flex: 1; display: flex; justify-content: center; position: relative; }
.scale-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.scale-face { display: flex; width: 100%; max-width: 60px; aspect-ratio: 1; align-items: center; justify-content: center; border-radius: 50%; border: 2px solid transparent; transition: transform .12s; }
.scale-face svg { width: 80%; height: 80%; }
.face-skin { fill: #F3EEE6; }
.face-ink { fill: #B9B3C2; }
.face-mouth { fill: none; stroke: #B9B3C2; stroke-width: 3; stroke-linecap: round; }
.face-mouth-open { fill: #B9B3C2; stroke: none; }
.scale-opt input:checked + .scale-face { border-color: var(--plum); transform: scale(1.08); background: #FFF7E0; }
.scale-opt input:checked + .scale-face .face-skin { fill: var(--butter); }
.scale-opt input:checked + .scale-face .face-ink { fill: var(--ink); }
.scale-opt input:checked + .scale-face .face-mouth { stroke: var(--ink); }
.scale-opt input:checked + .scale-face .face-mouth-open { fill: var(--ink); }
.scale-opt input:focus-visible + .scale-face { outline: 3px solid var(--boy); outline-offset: 2px; }
.scale-ends { display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; color: var(--muted); margin-top: 6px; padding: 0 4px; }

/* trends */
.chart { width: 100%; height: auto; display: block; margin-top: 4px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { font: 600 9px var(--font-body); fill: var(--muted); }
.chart .line { fill: none; stroke: var(--boy); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .marker { fill: var(--boy); stroke: #fff; stroke-width: 2; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 32px; align-items: center; gap: 10px; padding: 6px 0; }
.bar-label { font-size: 13px; font-weight: 700; }
.bar-track { height: 10px; background: var(--paper); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--boy); border-radius: 999px; }
.bar-val { font-size: 13px; font-weight: 700; text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.note-item { font-size: 14px; margin: 8px 0; color: var(--ink-2); }
.note-kind { display: inline-flex; width: 20px; height: 20px; border-radius: 50%; align-items: center; justify-content: center; font-size: 11px; margin-right: 4px; }
.note-kind.happy { background: #FFD9DF; color: var(--rose-ink); }
.note-kind.change { background: var(--mint); color: var(--mint-ink); }

/* closeness questions */
.q-closeness { background: #FFF6F8; border-color: #F9D6DE; }
.q-closeness .q-num { background: var(--girl); color: #fff; }
.scale-ends-3 span:nth-child(2) { text-align: center; }
.input-comment { margin-top: 10px; font-size: 15px; padding: 10px 14px; min-height: 44px; }
.qrow-commented { border-bottom: 0; padding-bottom: 2px; }
.qrow-comment { margin: 0 0 8px; padding: 0 0 8px; font-size: 14px; font-style: italic; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.note-kind.closeness { background: #FFD9DF; color: var(--rose-ink); }
