/* Customer or product? Light and dark, mobile first. No external resources. */

:root {
  --paper: #ffffff;
  --card: #ffffff;
  --band: #f5f5f5;              /* the receipt sits on this, so the white paper stands out */
  --ink: #222222;
  --muted: #666666;
  --line: #e5e5e5;
  --hover: #f5f5f5;
  --wallet: #1b7a47;
  --wallet-soft: #e8f3ec;
  --myself: #b8391f;
  --myself-soft: #fbece7;
  --kagi: #ffb319;              /* Kagi yellow: only the selected Yes/No marker */
  --focus: #1a5fd0;
  --btn-bg: #222222;
  --btn-ink: #ffffff;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --out: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161616;
    --card: #1c1c1c;
    --band: #0f0f0f;
    --ink: #e8e8e8;
    --muted: #a3a3a3;
    --line: #333333;
    --hover: #242424;
    --wallet: #4fbf86;
    --wallet-soft: #13261c;
    --myself: #f08a6c;
    --myself-soft: #2e1a14;
    --focus: #8ab4ff;
    --btn-bg: #e8e8e8;
    --btn-ink: #161616;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
}

h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 0.5rem; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-underline-offset: 3px; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
h2:focus { outline: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

.section { padding-top: 64px; }
.narrow > * { max-width: 42rem; }
.fine { color: var(--muted); font-size: 0.875rem; margin: 0.5rem 0 0; }
.helper { color: var(--muted); margin: 0 0 2rem; max-width: 40rem; }

/* buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink);
  font: 600 0.9375rem/1 var(--sans); cursor: pointer;
  transition: background-color 150ms var(--out);
}
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--btn-bg); color: var(--btn-ink); border-color: var(--btn-bg); }
.btn-primary:hover { background: var(--btn-bg); opacity: 0.88; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-small { padding: 0 14px; font-size: 0.875rem; }

/* hero */

.hero { padding: 96px 0 16px; }
.hero h1 { font-size: clamp(2.25rem, 6vw, 3.5rem); font-weight: 600; letter-spacing: -0.025em; line-height: 1.05; margin-bottom: 1rem; }
.lead { font-size: clamp(1.0625rem, 2vw, 1.25rem); max-width: 36rem; margin: 0 0 0.75rem; }
.hero .fine { margin-bottom: 1.75rem; }

/* step 1: chips */

.categories { display: grid; gap: 20px; }
.cat-label { font-size: 0.875rem; font-weight: 500; color: var(--muted); margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
/* Desktop: label column on the left, chips on the right, ruled rows, like Kagi's knowledge panel. */
@media (min-width: 720px) {
  .categories { gap: 0; border-bottom: 1px solid var(--line); }
  .cat { display: grid; grid-template-columns: 160px 1fr; gap: 0 24px; padding: 12px 0; border-top: 1px solid var(--line); }
  .cat-label { margin: 0; line-height: 36px; }
}

.chip {
  display: inline-flex; align-items: center; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--card);
  transition: background-color 150ms var(--out), border-color 150ms var(--out);
}
.chip-name {
  position: relative; display: inline-flex; align-items: center;
  min-height: 36px; padding: 0 14px;
  border: 0; border-radius: 999px; background: transparent; color: var(--ink);
  font: 400 0.9375rem/1 var(--sans); cursor: pointer;
}
.chip-name:hover { background: var(--hover); }
.chip-name::after { content: ""; position: absolute; inset: -4px 0; }   /* 44px hit area; the 8px row gap keeps neighbors from overlapping */
/* Selected: red = takes something, green = nothing taken found, plain outline = not checked yet.
   The 1px box-shadow thickens the border without moving neighbors. */
.chip.is-picked { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.chip.is-picked .chip-name { font-weight: 600; }
.chip.is-takes { border-color: var(--myself); box-shadow: 0 0 0 1px var(--myself); background: var(--myself-soft); }
.chip.is-clean { border-color: var(--wallet); box-shadow: 0 0 0 1px var(--wallet); background: var(--wallet-soft); }
.chip.is-picked .chip-name:hover { background: transparent; }
.chip.is-open { border-color: var(--ink); }

.chip-choice { display: inline-flex; gap: 4px; padding: 0 4px 0 0; }
.chip-opt {
  position: relative;
  min-height: 28px; margin: 3px 0; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper); color: var(--ink);
  font: 600 0.8125rem/1 var(--sans); cursor: pointer;
}
.chip-opt:hover { border-color: var(--ink); }
.chip-opt::after { content: ""; position: absolute; inset: -8px 0; }   /* 44px hit area */

/* boxes: neutral in step 1, wallet and data accents after the reveal */

.boxes { display: grid; gap: 16px; margin-top: 40px; }
@media (min-width: 768px) { .boxes { grid-template-columns: 1fr 1fr; align-items: start; } }

.box {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 20px 20px 16px;
}
.box-title { font-size: 1.125rem; font-weight: 600; color: var(--ink); margin: 0 0 12px; transition: color 250ms var(--out); }
.is-revealed .box-left .box-title { color: var(--wallet); }
.is-revealed .box-right .box-title { color: var(--myself); }
.box-sub { margin: -10px 0 12px; color: var(--muted); font-size: 0.9375rem; }
.box-count { font-size: 0.875rem; color: var(--muted); margin: 12px 0 0; }
.empty { margin: 0; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 0.9375rem; }

.apps { display: grid; }
.app { padding: 10px 0; border-bottom: 1px solid var(--line); }
.app:first-child { border-top: 1px solid var(--line); }
.app-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.app-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.app-name { font-weight: 600; }
.app-take { display: flex; flex-direction: column; }
.app-takes { color: var(--myself); font-size: 0.875rem; font-weight: 500; }
.off-note { color: var(--muted); font-size: 0.8125rem; line-height: 1.4; }
.app-includes { color: var(--muted); font-size: 0.8125rem; }

.pay-too { padding: 1px 7px; border-radius: 4px; background: var(--hover); border: 1px solid var(--line); color: var(--ink); font: 500 0.75rem/1.5 var(--sans); }
.app.is-new { animation: arrive 200ms var(--out); }
@keyframes arrive { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* step 2: reveal */

.gift-line { margin: 16px 0 0; }
.legend { margin: 16px 0 0; display: grid; gap: 4px; max-width: 44rem; }
.legend li { color: var(--muted); }
.legend strong { color: var(--myself); font-weight: 600; }

.score { margin-top: 40px; }
.mix-line { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; margin: 0; }
.mix-note { margin: 0.5rem 0 0; }
.split { margin: 16px 0 4px; max-width: 40rem; }
.split-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line); }
.split-bar > span { box-shadow: inset -1px 0 0 var(--paper); }   /* hairline between app segments */
.split-c { background: var(--wallet); }
.split-p { background: var(--myself); }

.split-labels { display: flex; justify-content: space-between; margin-top: 6px; font-size: 0.875rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.split-labels :first-child { color: var(--wallet); }
.split-labels :last-child { color: var(--myself); }

/* step 4: time */

.time-row { display: grid; gap: 16px 32px; align-items: start; }
/* Question on top, control underneath, in both columns, so they line up. */
.time-row .field-row { flex-direction: column; align-items: flex-start; gap: 8px; }
@media (min-width: 768px) { .time-row { grid-template-columns: 1fr 1fr; } }
.field-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.field-row input {
  width: 5rem; min-height: 44px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink); font: 500 1rem/1 var(--sans); font-variant-numeric: tabular-nums;
}
.field-row input:hover { border-color: var(--muted); }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; text-align: right; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.time-out { margin: 16px 0 0; font-size: 1.0625rem; }
#sort { padding-top: 40px; }
.computer-q { margin: 0 0 48px; font-weight: 500; }
.toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.toggle-opt {
  min-height: 44px; min-width: 56px; padding: 0 14px; border: 0; border-right: 1px solid var(--line);
  background: var(--card); color: var(--muted); font: 500 0.9375rem/1 var(--sans); cursor: pointer;
}
.toggle-opt:last-child { border-right: 0; }
.toggle-opt:hover { background: var(--hover); }
.toggle-opt[aria-pressed="true"] { background: var(--hover); color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--kagi); }
.time-out + .time-out { margin-top: 8px; }
#time .time-row { margin-top: 16px; }

/* step 5: tonight */

/* Markers outside, so wrapped lines hang under the text, not under the number. */
.steps, .site-foot details ul { list-style-position: outside; padding-left: 1.5rem; margin: 0; }
.steps { list-style-type: decimal; margin-top: 16px; }
.steps li + li { margin-top: 12px; }
.steps li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
.step-sub { display: block; margin-top: 4px; color: var(--muted); font-size: 0.9375rem; }
.steps a { font-weight: 600; white-space: nowrap; padding: 12px 4px; margin: -12px 0; }   /* 44px tap area, no layout shift */
.consider { margin: 20px 0 0; }
.link-btn {
  padding: 12px 2px; margin: -12px 0; border: 0; background: none; color: inherit;
  font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.dating-line a { padding: 12px 0; margin: -12px 0; }   /* 44px tap area, no layout shift */
.after-steps { margin: 20px 0 0; color: var(--muted); }
.after-steps + .after-steps { margin-top: 0; }
.after-steps a { padding: 12px 0; margin: -12px 0; }   /* 44px tap area that still wraps like text */

/* receipt: the one loud thing on the page, on a full-width band */

.receipt-wrap {
  display: grid; justify-items: center; gap: 20px;
  margin-top: 56px; padding-top: 48px; padding-bottom: 32px;
  background: var(--band);
  box-shadow: 0 0 0 100vmax var(--band); clip-path: inset(0 -100vmax);   /* band runs edge to edge */
}
.shared-note {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 16px;
  width: 100%; max-width: 560px; padding: 8px 8px 8px 16px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
}
.shared-note p { margin: 0; font-weight: 600; }

.receipt {
  position: relative; width: min(360px, 100%); margin: 6px 0;
  padding: 24px 0 22px; background: #ffffff; color: #1a1a1a;
  font: 13px/20px var(--mono);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.08)) drop-shadow(0 8px 18px rgba(0, 0, 0, 0.1));
}
@media (min-width: 480px) { .receipt { font-size: 14px; } }
.receipt::before, .receipt::after {
  content: ""; position: absolute; left: 0; right: 0; height: 6px;
  background-size: 12px 12px; background-repeat: repeat-x;
}
.receipt::before {
  top: -6px;
  background-image: linear-gradient(135deg, transparent 50%, #ffffff 50%), linear-gradient(225deg, transparent 50%, #ffffff 50%);
  background-position: left top;
}
.receipt::after {
  bottom: -6px;
  background-image: linear-gradient(45deg, transparent 50%, #ffffff 50%), linear-gradient(315deg, transparent 50%, #ffffff 50%);
  background-position: left bottom;
}
/* Sized by the real glyphs, not the ch unit: some browsers report ch narrower than ui-monospace renders. */
.r-inner { width: max-content; max-width: calc(100% - 24px); margin: 0 auto; }
.r-line { white-space: pre; }
.r-bold { font-weight: 700; }
.r-sep { height: 0; border: 0; border-top: 1px dashed #8a857c; margin-top: 7px; margin-bottom: 6px; }

.receipt-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.action-status { margin: 0; min-height: 1.5em; color: var(--muted); font-size: 0.875rem; text-align: center; overflow-wrap: anywhere; }

/* collapsed: alternatives, how we decide */

.more-info { padding-top: 64px; display: grid; gap: 0; }
.more-info details { border-top: 1px solid var(--line); padding: 4px 0; }
.more-info details:last-child { border-bottom: 1px solid var(--line); }
.more-info summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.more-info details p, .more-info details li { color: var(--muted); font-size: 0.9375rem; }
.more-info details ul { list-style: disc outside; padding-left: 1.5rem; margin: 0.5rem 0; }

/* Tables in the style of Kagi Assistant: ruled cells, a tinted header row. */
.alts { width: 100%; border-collapse: collapse; font-size: 0.9375rem; margin: 8px 0 16px; border: 1px solid var(--line); }
.alts th, .alts td { text-align: left; vertical-align: top; padding: 10px 12px; border: 1px solid var(--line); }
.alts thead th { background: var(--hover); font-weight: 600; color: var(--ink); }
.alts tbody th { font-weight: 600; white-space: nowrap; }
.alts td:last-child { color: var(--muted); }

@media (max-width: 719px) {
  .alts { border: 0; }
  .alts thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .alts tr { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .alts th, .alts td { display: block; padding: 2px 0; border: 0; }
  .alts tbody th { font-size: 1rem; margin-bottom: 4px; }
  .alts td::before { content: attr(data-label); display: block; font-size: 0.8125rem; font-weight: 500; color: var(--muted); }
}

/* footer */

.site-foot { padding-top: 32px; padding-bottom: 48px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .chip, .box-title { transition: none; }
  .app.is-new { animation: none; }
}
