/* Together — couples workbook. System fonts only: no CDN, no third-party. */
:root{
  --paper:#f5f1ea; --card:#fffdf9; --ink:#1f2a28; --dim:#5d6b67; --line:#ded5c7;
  --accent:#2f6f62; --accent-ink:#ffffff; --warm:#c9714a; --alarm:#8e2f2f;
  --priv:#4a4a8c; --radius:14px; --sh:31,42,40;
  --shadow:0 1px 2px rgba(var(--sh),.06), 0 4px 14px rgba(var(--sh),.06);
  --tap:48px;
  --sans:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  --serif:ui-serif,Georgia,"Iowan Old Style","Times New Roman",serif;
}
html[data-theme="dark"]{
  --paper:#141a19; --card:#1d2523; --ink:#e9e5dc; --dim:#9aa6a2; --line:#2f3937;
  --accent:#6fbfae; --accent-ink:#0f1615; --warm:#e0916c; --alarm:#e28a8a;
  --priv:#9d9dde; --sh:0,0,0;
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:var(--paper); color:var(--ink); font-family:var(--sans);
  font-size:17px; line-height:1.5; -webkit-text-size-adjust:100%;
  padding-bottom:calc(74px + env(safe-area-inset-bottom));
  overflow-x:hidden;
}
a{color:var(--accent)}
h1,h2,h3{line-height:1.2; margin:0 0 .4em}
h1{font-family:var(--serif); font-size:1.65rem; font-weight:600; letter-spacing:-.01em}
h2{font-size:1.15rem; font-weight:650}
h3{font-size:1rem; font-weight:650}
p{margin:0 0 .8em}
.skip{position:absolute;left:-9999px}
.skip:focus{left:8px;top:8px;background:var(--accent);color:var(--accent-ink);padding:8px 12px;border-radius:8px;z-index:99}

.topbar{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:calc(10px + env(safe-area-inset-top)) 16px 10px;
  position:sticky;top:0;background:var(--paper);z-index:20;border-bottom:1px solid var(--line);
}
.brand{display:flex;align-items:center;gap:8px;color:var(--ink);text-decoration:none;font-family:var(--serif);font-size:1.1rem;font-weight:600}
.mark{width:26px;height:26px;color:var(--accent);flex:none}

main{padding:16px;max-width:640px;margin:0 auto}
main:focus{outline:none}

/* ---- the whole bar is the tap target -----------------------------------
   Cade, 2026-09-04: "The tap targets seem small on the menu. There is dead
   space between items. The tap spaces should take up the whole bar."

   The dead space was not BETWEEN the items — measured at 390px the four
   anchors already tile the bar edge to edge, 98px each. It was BELOW them, and
   it is invisible on a desktop browser because that is where env(safe-area-
   inset-bottom) is 0. The inset was padding on .tabs, so on an iPhone the bar
   grew ~34px taller for the home indicator while the anchors stayed their
   original height at the TOP of it — leaving a third of the bar, along the
   bottom edge where a thumb actually lands, doing nothing.

   So the inset moves onto the anchors' own padding-bottom. The bar is exactly
   as tall as before; every pixel of it now belongs to a link. Height goes
   48 -> 56 at the same time, because 48 was the floor for a target you hit
   deliberately, not one you hit at a glance while walking. */
.tabs{
  position:fixed;left:0;right:0;bottom:0;display:flex;background:var(--card);
  border-top:1px solid var(--line);z-index:30;
}
.tabs a{
  flex:1 1 0;min-width:0;display:flex;flex-direction:column;align-items:center;gap:2px;
  padding:10px 2px calc(10px + env(safe-area-inset-bottom));
  font-size:.7rem;color:var(--dim);text-decoration:none;justify-content:center;
  min-height:calc(56px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color:transparent;
}
.tabs a[aria-current="page"]{color:var(--accent);font-weight:650}
/* Set by pinTabs() when the on-screen keyboard is up. The bar is fixed to the
   bottom of a viewport the keyboard is now covering, so it is hidden rather
   than parked on top of it — see the comment on keyboardUp(). */
.tabs.kb{display:none}
.ti{font-size:1.05rem;line-height:1}

.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:16px;margin:0 0 14px;box-shadow:var(--shadow)}
.card.tight{padding:13px 14px}
.lede{color:var(--dim);font-size:.95rem}
.muted{color:var(--dim)}
.small{font-size:.85rem}
.tiny{font-size:.76rem}
.center{text-align:center}
.stack>*+*{margin-top:10px}

.btn{
  -webkit-appearance:none;appearance:none;touch-action:manipulation;
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  min-height:var(--tap);padding:12px 18px;border-radius:12px;border:1px solid var(--line);
  background:var(--card);color:var(--ink);font:inherit;font-weight:600;font-size:.95rem;
  cursor:pointer;text-decoration:none;text-align:center;
}
.btn:active{transform:translateY(1px)}
.btn-primary{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
.btn-warm{background:var(--warm);border-color:var(--warm);color:#fff}
.btn-danger{color:var(--alarm);border-color:var(--alarm)}
.btn-block{display:flex;width:100%}
.btn-row{display:flex;gap:10px;flex-wrap:wrap}
.btn-row>.btn{flex:1 1 46%}
.btn:disabled{opacity:.45}

textarea,input[type=text]{
  width:100%;font:inherit;font-size:16px;color:var(--ink);background:var(--paper);
  border:1px solid var(--line);border-radius:10px;padding:11px 12px;min-height:var(--tap);
}
textarea{min-height:110px;resize:vertical;line-height:1.45}
label{display:block;font-weight:600;font-size:.9rem;margin-bottom:6px}

.scale{display:flex;gap:6px}
.scale button{-webkit-appearance:none;appearance:none;touch-action:manipulation;flex:1;min-height:var(--tap);border:1px solid var(--line);background:var(--card);border-radius:10px;font:inherit;font-weight:650;color:var(--ink);cursor:pointer}
.scale button[aria-pressed="true"]::after{content:'';display:block}
.scale button[aria-pressed="true"]{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
.scale-ends{display:flex;justify-content:space-between;font-size:.75rem;color:var(--dim);margin-top:6px}
.answered{font-weight:650;color:var(--accent)}
.arow{display:flex;justify-content:space-between;align-items:baseline;gap:8px;margin-bottom:6px}

.progress{display:flex;gap:4px;margin-bottom:14px}
.progress i{flex:1;height:4px;border-radius:2px;background:var(--line)}
.progress i.on{background:var(--accent)}

.list{list-style:none;margin:0;padding:0}
.rowlink{
  display:flex;align-items:center;gap:12px;width:100%;text-align:left;
  background:var(--card);border:1px solid var(--line);border-radius:var(--radius);
  padding:14px;margin-bottom:10px;color:var(--ink);text-decoration:none;font:inherit;
  min-height:var(--tap);cursor:pointer;box-shadow:var(--shadow);
}
.rowlink .body{flex:1;min-width:0}
.rowlink .title{font-weight:650;font-size:.98rem}
.rowlink .sub{color:var(--dim);font-size:.83rem;margin-top:2px}
.rowlink .chev{color:var(--dim);flex:none}

.check{display:flex;gap:12px;align-items:flex-start;padding:13px 14px;border:1px solid var(--line);border-radius:12px;background:var(--card);margin-bottom:8px;cursor:pointer;min-height:var(--tap)}
.check input{margin:2px 0 0;width:22px;height:22px;flex:none;accent-color:var(--accent);touch-action:manipulation}
.check.on{border-color:var(--accent);background:color-mix(in srgb, var(--accent) 8%, var(--card))}
.check span{flex:1;font-size:.95rem}

.pill{display:inline-block;font-size:.7rem;font-weight:700;letter-spacing:.04em;text-transform:uppercase;padding:3px 8px;border-radius:999px;border:1px solid currentColor}
.pill.couples{color:var(--accent)}
.pill.individual{color:var(--priv)}
.pill.both{color:var(--warm)}
.pill.safety{color:var(--alarm)}

.deckcard{
  background:var(--card);border:1px solid var(--line);border-radius:var(--radius);
  padding:30px 22px;min-height:210px;display:flex;align-items:center;justify-content:center;
  text-align:center;font-family:var(--serif);font-size:1.3rem;line-height:1.35;box-shadow:var(--shadow);
}
.bars{display:flex;align-items:flex-end;gap:5px;height:56px;margin:8px 0}
.bars i{flex:1;background:var(--accent);border-radius:3px 3px 0 0;min-height:3px;opacity:.85}
.meter{height:8px;border-radius:4px;background:var(--line);overflow:hidden;margin-top:6px}
.meter i{display:block;height:100%;background:var(--accent)}

.alert{border-left:4px solid var(--alarm);background:color-mix(in srgb, var(--alarm) 8%, var(--card));border-radius:0 12px 12px 0;padding:14px 16px;margin:0 0 14px}
.alert h2{color:var(--alarm)}
.privnote{display:flex;gap:8px;align-items:flex-start;font-size:.82rem;color:var(--priv);background:color-mix(in srgb, var(--priv) 8%, var(--card));border-radius:10px;padding:10px 12px;margin:0 0 14px}

.share-box{word-break:break-all;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.72rem;background:var(--paper);border:1px dashed var(--line);border-radius:10px;padding:10px;max-height:120px;overflow:auto;color:var(--dim)}
.entry{border-left:3px solid var(--line);padding:2px 0 2px 12px;margin-bottom:14px}
.entry .when{font-size:.75rem;color:var(--dim);text-transform:uppercase;letter-spacing:.04em}
.entry .q{font-size:.8rem;color:var(--dim);margin-top:6px}
.entry .a{font-size:.95rem}
.entry.mine{border-left-color:var(--accent)}
.entry.theirs{border-left-color:var(--warm)}

/* --- "Us, side by side" --------------------------------------------
 * Two narrow columns on a 390px phone, so the answers stay comparable
 * at a glance. Mine keeps the accent colour, theirs the warm one, the
 * same language History already uses for who wrote what. */
.cmp{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:0 0 14px}
.cmp .side{min-width:0;border-left:3px solid var(--line);padding-left:10px}
.cmp .side.mine{border-left-color:var(--accent)}
.cmp .side.theirs{border-left-color:var(--warm)}
.cmp .who{font-size:.7rem;color:var(--dim);text-transform:uppercase;letter-spacing:.04em;margin-bottom:3px;overflow-wrap:anywhere}
.cmp .a{font-size:.95rem;overflow-wrap:anywhere}
.cmpq{font-size:.8rem;color:var(--dim);margin:0 0 6px}
.cmprow{border-top:1px solid var(--line);padding:12px 0 4px}
.cmprow .btn{margin-top:10px}
.mtr{display:flex;align-items:center;gap:8px;margin-top:8px}
.mtr .who{flex:0 0 34%;font-size:.75rem;color:var(--dim);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mtr .meter{flex:1 1 auto;margin-top:0}
.mtr .num{flex:0 0 auto;font-size:.8rem;color:var(--dim);font-variant-numeric:tabular-nums}
.mtr.theirs .meter i{background:var(--warm)}

.toast{position:fixed;left:50%;bottom:calc(84px + env(safe-area-inset-bottom));transform:translateX(-50%);background:var(--ink);color:var(--paper);padding:10px 16px;border-radius:999px;font-size:.85rem;z-index:60;box-shadow:var(--shadow);max-width:88vw;text-align:center}
.timer{font-family:var(--serif);font-size:3.4rem;text-align:center;font-variant-numeric:tabular-nums;margin:10px 0}
hr.rule{border:0;border-top:1px solid var(--line);margin:20px 0}
.footnote{font-size:.78rem;color:var(--dim);text-align:center;padding:6px 0 20px}
.footnote a{color:var(--dim)}
:focus-visible{outline:3px solid var(--accent);outline-offset:2px;border-radius:6px}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}

/* A card that is warning about something, not just showing it. Used since the
   first release; it had no rule until the pairing work needed it. */
.card.warn{border-left:4px solid var(--alarm);background:color-mix(in srgb, var(--alarm) 6%, var(--card))}
.card.warn .title{color:var(--alarm)}
/* A recovery code has to be read aloud, retyped and compared character by
   character, so it gets a monospace face and generous letter spacing. */
/* Cade, 2026-09-04: "I still have to scroll to see the done button on a small
   mobile screen in browser. I think reducing the text size for the actual key
   could save a line." It did — 1.15rem/.09em wrapped the 45-character key to
   four lines at 390px; .95rem/.04em fits it in three. Still monospace and
   still user-select:all, because the two things this element has to do are be
   read aloud accurately and be selected in one tap. */
.code-block{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.95rem;letter-spacing:.04em;
  text-align:center;word-break:break-all;padding:14px 10px;margin:0 0 12px;border:1px solid var(--line);
  border-radius:12px;background:var(--bg);user-select:all;-webkit-user-select:all}

/* ---- home: the three cards ---- */
.q-big { font-family: var(--serif); font-size: 1.15rem; line-height: 1.35; margin: .2em 0 .8em; }
.plan { margin: 12px 0; }
.plan-h { font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; opacity: .65; margin-bottom: 2px; }
/* Marks are a self-report, so they are deliberately equal in weight — no
 * "good" colour on the thumbs-up. The point is honesty, not a score. */
.marks { margin-top: 6px; }
.marks .btn { font-size: 1.05rem; padding: 6px 0; min-width: 0; flex: 1; }
.marks .btn[disabled] { opacity: .45; }
.hi { margin: 4px 0 14px; }

/* Numbered instructions in the invitation preview. Kept close to the list
   defaults on purpose — this is a set of steps someone reads once, not a
   design element. */
.steps { margin: 0 0 10px; padding-left: 22px; }
.steps li { margin: 0 0 8px; line-height: 1.45; }
.steps li:last-child { margin-bottom: 0; }
/* The weekly-connection rotation. Bulleted, not numbered — Cade, 2026-09-04:
   "Remove the numbers and just do bullets." The .tiny/.muted classes are set
   on the <li> itself, so the marker inherits the row's colour and the current
   week's bullet is the only dark one. */
.bullets { margin: 0; padding-left: 20px; list-style: disc; }
.bullets li { margin: .3em 0; line-height: 1.45; }

/* The invite code is ~90 characters, not 16 like the sign-in key. At the
   code-block's display size it wraps to five ragged centred lines that read
   as noise; this is the same box tuned for something you copy rather than
   something you read aloud. */
.code-block.code-long{font-size:.85rem;letter-spacing:.02em;text-align:left;line-height:1.5}

/* ---- the sharing page's status line -------------------------------------
 * Cade, 2026-09-03: "give me a clear status at the top of the sharing page.
 * Unlinked, waiting for partner, linked."
 *
 * The state was previously only inferable from WHICH CARDS appeared, which is
 * exactly how a wrong one goes unnoticed for a day — he read "It already
 * travels on its own" as a status because nothing else on the page was one.
 * So: one line, at the top, that says the state in words.
 *
 * Colour is never the only signal — each state has its own WORDS, and the dot
 * is decorative (aria-hidden). A red/green dot alone fails for the ~8% of men
 * with red-green colour blindness, and this app has exactly two users, one of
 * whom is a man. */
.status{display:flex;align-items:center;gap:10px;padding:11px 14px;margin:0 0 14px;
  border:1px solid var(--line);border-radius:var(--radius);background:var(--card);
  box-shadow:var(--shadow);font-weight:650;line-height:1.35}
.status .dot{width:11px;height:11px;border-radius:50%;flex:none;background:var(--dim)}
.status .sub{display:block;font-weight:400;color:var(--dim);font-size:14px;margin-top:2px}
.status.on{border-color:var(--accent)}
.status.on .dot{background:var(--accent)}
.status.wait{border-color:var(--warm)}
.status.wait .dot{background:var(--warm)}
.status.off .dot{background:var(--dim)}
.status.bad{border-color:var(--alarm)}
.status.bad .dot{background:var(--alarm)}

/* ---- the first-open welcome sheet (see onbShow in app.js) ----------------
 * A bottom sheet on a phone, because that is where a thumb is, and this app
 * is used one-handed. Centred on anything wide enough for it not to matter. */
.onb{position:fixed;inset:0;z-index:80;display:flex;align-items:flex-end;justify-content:center;
  background:color-mix(in srgb, var(--ink) 55%, transparent);
  -webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}
.onb[hidden]{display:none}
.onb-box{width:100%;max-width:520px;box-sizing:border-box;background:var(--card);color:var(--ink);
  border:1px solid var(--line);border-bottom:0;border-radius:18px 18px 0 0;
  padding:20px 18px calc(18px + env(safe-area-inset-bottom));
  max-height:88vh;overflow-y:auto;-webkit-overflow-scrolling:touch;
  box-shadow:0 -10px 34px rgba(0,0,0,.24)}
.onb-box h2{font-family:var(--serif);font-size:1.3rem;font-weight:600;letter-spacing:-.01em}
.onb-box .progress{margin-bottom:14px}
.onb-step{font-size:.72rem;letter-spacing:.06em;text-transform:uppercase;color:var(--dim);
  font-weight:700;margin:0 0 4px}
.onb-inset{background:var(--paper);border:1px solid var(--line);border-radius:12px;padding:12px 14px;margin:0 0 14px}
.onb-inset ol{margin:0}
.onb-box .steps li{margin-bottom:10px}
.onb-skip{margin-top:8px;border-color:transparent;color:var(--dim);box-shadow:none;background:transparent}
body.onb-on{overflow:hidden}
@media (min-width:560px){
  .onb{align-items:center;padding:16px}
  .onb-box{border-radius:18px;border-bottom:1px solid var(--line);padding-bottom:20px;max-height:86vh}
}

/* ---- the deposits/withdrawals ledger (see ledgerCard in app.js) ----------
 * Behind is WARM, never alarm. This card is read after a bad night, and a red
 * panel telling someone they are failing their partner is worse than nothing. */
.ratio{font-family:var(--serif);font-size:1.05rem;font-weight:650;white-space:nowrap;
  padding:2px 10px;border-radius:999px;border:1px solid var(--line);color:var(--dim)}
.ratio.ahead{color:var(--accent);border-color:var(--accent);background:color-mix(in srgb, var(--accent) 8%, var(--card))}
.ratio.behind{color:var(--warm);border-color:var(--warm);background:color-mix(in srgb, var(--warm) 10%, var(--card))}
.ldg{display:flex;gap:4px;flex-wrap:wrap;margin:12px 0 10px}
.ldg i{width:10px;height:10px;border-radius:50%;background:var(--accent);opacity:.9;flex:none}
.ldg i.wd{background:var(--warm)}
.lrow{display:flex;align-items:center;gap:8px;padding:9px 0;border-bottom:1px solid var(--line)}
.lrow>span{flex:1;min-width:0;font-size:.95rem;overflow-wrap:anywhere}
.lrow .btn{min-height:38px;padding:6px 10px;font-size:.85rem;flex:none}
.btn.lx{min-width:38px;padding:6px 8px;color:var(--dim);border-color:transparent;background:transparent;box-shadow:none}
.entry .when .btn.lx{min-height:24px;padding:0 6px;font-size:.8rem;vertical-align:baseline}

/* ---- the two number boxes (see ledgerNum in app.js) ---------------------
 * Type it or tap it. The taps are big because this is used one-handed, and
 * the field is centred and serif because the number IS the content. */
.nums{margin:14px 0 0}
.numrow{display:flex;align-items:center;gap:8px;padding:7px 0}
.numlab{flex:1 1 auto;min-width:0;font-weight:650;font-size:.95rem}
.btn.numb{flex:none;min-width:52px;min-height:var(--tap);padding:0;font-size:1.4rem;line-height:1;font-weight:600}
input.num{flex:0 0 74px;width:74px;box-sizing:border-box;text-align:center;
  font-family:var(--serif);font-size:1.35rem;font-weight:650;min-height:var(--tap);
  padding:6px 4px;border:1px solid var(--line);border-radius:12px;
  background:var(--paper);color:var(--ink);-moz-appearance:textfield;appearance:textfield}
input.num::-webkit-outer-spin-button,input.num::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.ldgplan{margin-top:16px;padding-top:14px;border-top:1px solid var(--line)}
.ldgplan h3{margin-bottom:.25em}
.ldgplan input[type=text]{margin-top:8px}
.btn.lbtn{min-height:38px;padding:6px 12px;font-size:.9rem;flex:none}
