:root {
  --bg: #f6efe9; --card: #fffaf6; --ink: #2d2623; --muted: #7a6c65; --line: #e6d9cf;
  --accent: #c4573f; --accent-ink: #fff; --me: #c4573f; --partner: #3f7f8c;
  --ok: #4c8a5b;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1e1917; --card: #2a2321; --ink: #f2e9e3; --muted: #a8998f; --line: #3d332f;
          --accent: #e0775f; --accent-ink: #1e1917; --me: #e0775f; --partner: #6bb3c0; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: env(safe-area-inset-top) 16px calc(96px + env(safe-area-inset-bottom));
}
main { max-width: 560px; margin: 0 auto; padding: 20px 0; }
h1 { font-size: 26px; margin: 8px 0 4px; }
h2 { font-size: 18px; margin: 28px 0 10px; }
p { margin: 8px 0; }
.muted { color: var(--muted); font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 12px 0; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
button, .btn {
  font: inherit; font-weight: 600; border: 0; border-radius: 12px; padding: 12px 18px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); min-height: 44px;
}
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.small { padding: 6px 12px; min-height: 34px; font-size: 14px; }
button.link { background: none; color: var(--muted); padding: 4px 0; min-height: 0; font-weight: 500; text-decoration: underline; }
button:disabled { opacity: .5; }
input[type=text], input[type=password], textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px;
}
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-weight: 600; margin: 14px 0 6px; }
.err { color: #c0392b; margin: 8px 0; }
.banner { background: var(--accent); color: var(--accent-ink); border-radius: 16px; padding: 14px 16px; margin: 12px 0; }
.banner button { background: var(--accent-ink); color: var(--accent); margin-top: 8px; }

/* scale picker */
.scale { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.scale button {
  padding: 0; min-height: 44px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); font-weight: 600;
}
.scale button[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }

/* choice cards */
.choice { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 8px 0; cursor: pointer; }
.choice input { margin-top: 5px; accent-color: var(--accent); }
.choice b { display: block; }
.choice:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }

/* progress dots */
.dots { display: flex; gap: 6px; }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); }
.dot.on { background: var(--ok); border-color: var(--ok); }

/* history */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; color: #fff; }
.pill.me { background: var(--me); } .pill.partner { background: var(--partner); }
.bars { margin-top: 8px; }
.bar { display: grid; grid-template-columns: 78px 1fr 24px; gap: 8px; align-items: center; font-size: 14px; margin: 4px 0; }
.bar i { display: block; height: 8px; border-radius: 99px; background: var(--line); position: relative; overflow: hidden; }
.bar i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--v) * 10%); background: var(--c); border-radius: 99px; }
.note { margin-top: 8px; white-space: pre-wrap; }
.need { margin-top: 8px; font-style: italic; }
.chart { width: 100%; height: auto; }

/* show-in-person full screen */
.show { text-align: center; }
.show .big { font-size: 56px; font-weight: 700; line-height: 1; }
.show .bars .bar { grid-template-columns: 100px 1fr 32px; font-size: 18px; }
.show .bars .bar i { height: 14px; }


/* bottom navigation */
nav.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center;
  background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
nav.bottom button {
  flex: 1; max-width: 110px; background: none; color: var(--muted); padding: 4px 0; min-height: 50px; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; position: relative;
}
nav.bottom svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav.bottom button[aria-current=page] { color: var(--accent); }
nav.bottom em { position: absolute; top: 0; right: 24%; background: var(--accent); color: var(--accent-ink); font-style: normal; font-size: 10px; min-width: 16px; height: 16px; line-height: 16px; border-radius: 8px; }

.wrap { flex-wrap: wrap; }
.back { margin-top: 4px; }
.banner.calm { background: var(--partner); color: #fff; }
.banner.soft { background: color-mix(in srgb, var(--accent) 15%, var(--card)); color: var(--ink); border: 1px solid var(--accent); }
.banner.soft button { background: var(--accent); color: var(--accent-ink); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.tile { text-align: left; background: var(--card); color: var(--ink); border: 1px solid var(--line); display: block; padding: 14px; }
.tile b { display: block; } .tile span { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.tile.wide { width: 100%; margin: 8px 0; }
.bar.sub { opacity: .75; }
details.card summary { cursor: pointer; list-style-position: inside; }
details.learn p { margin: 10px 0; }
.src { font-size: 13px; } .src a { color: var(--partner); }
.try { background: color-mix(in srgb, var(--ok) 12%, transparent); border-radius: 10px; padding: 8px 10px; }
.scale.seven { grid-template-columns: repeat(7, 1fr); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chip { background: var(--bg); color: var(--ink); border: 1px solid var(--line); padding: 6px 12px; min-height: 34px; font-size: 14px; border-radius: 99px; }
.chip[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.deck { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 36px 22px; margin: 14px 0; text-align: center; font-size: 22px; line-height: 1.35; min-height: 160px; display: flex; align-items: center; justify-content: center; }
.clock { font-size: 56px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; margin: 6px 0 10px; }
.quote { font-style: italic; }
.struck { text-decoration: line-through; color: var(--muted); }
.reply { border-left: 3px solid var(--partner); padding-left: 10px; }
.moment.goodnews { border-left: 4px solid var(--ok); } .moment.thanks { border-left: 4px solid var(--accent); }
.tip p { margin: 4px 0 0; }
table.wk { width: 100%; border-collapse: collapse; margin-top: 8px; }
table.wk th, table.wk td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.wk small { color: var(--muted); }
select, input[type=time] { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
