:root {
  --ink: #1B365D;
  --accent: #487A7B;
  --accent-dark: #3a6566;
  --accent-light: rgba(72, 122, 123, 0.10);
  --muted: #5f6261;
  --line: #dfe3e2;
  --paper: #ffffff;
  --bg: #f6f5f1;
  --ok: #009681;
  --warn: #E87722;
  --err: #B83A4B;
  --hi: #F3D54E;
  --radius: 14px;
  --head: 'Nunito Sans', system-ui, sans-serif;
  --body: 'Source Sans 3', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
  font: 18px/1.5 var(--body);
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, .brand-name, .btn, .chip, .label, .eyebrow { font-family: var(--head); }
h1 { font-size: clamp(1.75rem, 5vw, 2.4rem); line-height: 1.15; margin: 0 0 .5rem; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-dark); margin: 1.6rem 0 .4rem; font-weight: 800; }
.lede { color: var(--muted); margin: 0 0 1.25rem; }
.fine { color: var(--muted); font-size: .9rem; }
.label { display: block; font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-dark); }

/* ── Header / footer ───────────────────────────────────────────── */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; max-width: 760px; width: 100%; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.brand-mark { color: var(--accent); display: inline-flex; }
.brand-name { font-weight: 800; font-size: 1.3rem; }
.foot { margin-top: auto; padding: 24px 16px 32px; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: center; color: var(--muted); font-size: .85rem; }
.foot img { height: 24px; width: auto; }

main { width: 100%; max-width: 760px; margin: 0 auto; padding: 8px 16px 24px; flex: 1; }
.view { animation: rise .25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Controls ──────────────────────────────────────────────────── */
textarea, input[type=text] {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper);
  border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  transition: border-color .15s;
}
textarea:focus, input[type=text]:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 96px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 20px; border-radius: 999px; cursor: pointer;
  font-size: 1rem; font-weight: 700; text-decoration: none;
  background: var(--paper); color: var(--ink); border: 2px solid var(--line);
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.ghost { background: transparent; }
.btn.big { width: 100%; min-height: 56px; font-size: 1.1rem; margin-top: 16px; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: wait; }
.btn:focus-visible, .chip:focus-visible, .link-btn:focus-visible { outline: 3px solid var(--hi); outline-offset: 2px; }

.link-btn { background: none; border: 0; padding: 8px 4px; font: 600 .95rem var(--head); color: var(--accent-dark); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn.inline { padding: 0; font-size: inherit; }
.mine-link { text-decoration: none; border: 2px solid var(--line); border-radius: 999px; padding: 6px 14px; background: var(--paper); }
.mine-link .count { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 7px; font-size: .8rem; margin-left: 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.chip {
  border: 2px solid var(--line); background: var(--paper); color: var(--ink);
  border-radius: 999px; padding: 8px 14px; font-size: .95rem; font-weight: 600; cursor: pointer;
  text-align: left; line-height: 1.3;
}
.chip:hover { border-color: var(--accent); background: var(--accent-light); }

/* ── SMART explainer (start view) ─────────────────────────────── */
.smart { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--line); }
.smart h2 { margin-top: 0; }
.smart > p { margin: 0 0 12px; }
.smart-list { margin: 0 0 16px; display: grid; gap: 10px; }
.smart-list div { display: grid; grid-template-columns: 148px 1fr; gap: 12px; align-items: baseline; }
.smart-list dt { font: 800 1rem var(--head); white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.smart-list dt b { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: .95rem; flex: none; }
.smart-list dd { margin: 0; color: var(--muted); }
.smart-example { background: var(--paper); border-radius: var(--radius); border: 2px solid var(--line); padding: 14px 16px; display: grid; gap: 10px; margin-bottom: 12px; }
.smart-example p { margin: 0; }
.smart-example p:last-child { font-weight: 600; }
@media (max-width: 380px) { .smart-list div { grid-template-columns: 1fr; gap: 2px; } }

/* ── Coach ─────────────────────────────────────────────────────── */
.draft-echo { margin: 0 0 14px; color: var(--muted); font-size: .95rem; }
.draft-echo .label { display: inline; margin-right: 6px; }
.meter { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 18px; }
.meter li {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font: 800 .95rem var(--head); color: var(--muted); background: var(--paper); border: 2px solid var(--line);
  transition: all .3s;
}
.meter li.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.bubble { background: var(--paper); border-radius: var(--radius); border: 2px solid var(--line); padding: 18px 20px; position: relative; }
.question { margin: 0; font: 700 1.3rem/1.35 var(--head); }
.answers .chip { font-size: 1rem; padding: 10px 16px; }
.answers .chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.answers .chip[aria-pressed="true"]::before { content: '✓ '; }
.pick-hint { margin: 14px 0 0; color: var(--muted); font-size: .9rem; }
.answer-row { display: flex; gap: 8px; margin-top: 10px; }
.answer-row input { flex: 1; min-width: 0; }
.coach-foot { display: flex; justify-content: space-between; margin-top: 10px; }
.coach-foot #skip-btn { margin-left: auto; }

/* ── Thinking / error ──────────────────────────────────────────── */
.thinking { display: flex; align-items: center; gap: 10px; justify-content: center; color: var(--muted); padding: 24px 0; font-family: var(--head); font-weight: 600; }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: bob 1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bob { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-6px); opacity: 1; } }
.error { background: #fbeef0; color: var(--err); border-radius: var(--radius); padding: 12px 16px; font-weight: 600; }

/* ── Goal card ─────────────────────────────────────────────────── */
.card { background: var(--paper); border-radius: 20px; padding: 24px 22px 26px; box-shadow: 0 1px 2px rgba(27,54,93,.06), 0 8px 28px rgba(27,54,93,.08); border-top: 6px solid var(--accent); }
.eyebrow { margin: 0 0 6px; font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-dark); }
.goal-text {
  font: 800 clamp(1.3rem, 4.2vw, 1.65rem)/1.3 var(--head); color: var(--ink);
  border: 2px dashed transparent; padding: 6px 8px; margin: 0 -8px; min-height: 0; resize: none; overflow: hidden;
}
.goal-text:hover { border-color: var(--line); }
.goal-text:focus { border-color: var(--accent); border-style: solid; }
.goal-print { display: none; }
.edit-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .95rem; color: var(--muted); margin-top: 6px; }
.suggestion { background: var(--accent-light); border-radius: 12px; padding: 12px 14px; margin-top: 12px; }
.suggestion p { margin: 4px 0 10px; font-weight: 600; }
.aim { margin: 10px 0 0; color: var(--muted); font-style: italic; }
.aim::before { content: 'Hoping for: '; font-style: normal; font-weight: 700; color: var(--accent-dark); }

.check { margin-top: 16px; border: 2px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.check summary { cursor: pointer; font: 700 .95rem var(--head); display: flex; align-items: center; gap: 10px; list-style: none; }
.check summary::-webkit-details-marker { display: none; }
.check summary::after { content: '▾'; margin-left: auto; color: var(--muted); }
.check[open] summary::after { content: '▴'; }
.checks { display: inline-flex; gap: 4px; }
.checks b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; color: #fff; background: var(--ok); }
.checks b.no { background: var(--warn); }
.check dl { margin: 12px 0 2px; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: .95rem; }
.check dt { font: 800 .85rem var(--head); color: var(--ink); white-space: nowrap; }
.check dt.no { color: var(--warn); }
.check dd { margin: 0; color: var(--muted); }

.steps { margin: 0; padding-left: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 6px 0 6px 40px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 5px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-light); color: var(--accent-dark); display: grid; place-items: center; font: 800 .9rem var(--head); }
.this-week { margin-top: 18px; background: #fdf8e3; border-left: 5px solid var(--hi); border-radius: 10px; padding: 12px 16px; }
.this-week p:last-child { margin: 4px 0 0; font-weight: 600; font-size: 1.05rem; }
.dates { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.dates strong { font: 800 1.05rem var(--head); }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.actions .primary { grid-column: 1 / -1; }
.saved-note { text-align: center; color: var(--muted); font-size: .9rem; margin: 14px 0 0; }

/* ── My goals ──────────────────────────────────────────────────── */
.mine { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 10px; }
.mine li { background: var(--paper); border-radius: var(--radius); border: 2px solid var(--line); padding: 14px 16px; display: flex; gap: 12px; align-items: center; }
.mine .open { flex: 1; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink); font: inherit; }
.mine .open strong { display: block; font: 800 1.05rem var(--head); }
.mine .open span { color: var(--muted); font-size: .9rem; }
.mine .del { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: .9rem; text-decoration: underline; padding: 8px; }
.empty { color: var(--muted); }

@media (min-width: 640px) {
  .card { padding: 32px 36px 34px; }
  .actions { grid-template-columns: repeat(4, auto); justify-content: start; }
  .actions .primary { grid-column: auto; }
}

/* ── Print: just the card ──────────────────────────────────────── */
@media print {
  body { background: #fff; font-size: 12pt; }
  .top, .actions, .saved-note, .btn, .edit-bar, .suggestion, #view-start, #view-coach, #view-mine, .thinking, .error { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ccc; border-top: 6px solid var(--accent); }
  .check { border: 0; padding: 0; }
  .check dl { display: grid !important; }
  .goal-text { display: none !important; }
  .goal-print { display: block; font: 800 16pt/1.3 var(--head); margin: 0; }
  .foot { padding-top: 12px; }
}
