/* =====================================================================
   RememberTheGifts — "embossed paper" theme
   Letterpress card stock, soft emboss/deboss, restrained ink + gold foil.
   ===================================================================== */
:root {
  --give-chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%234e3a12' stroke-width='2'/%3E%3C/svg%3E");
  /* card stock */
  --paper: #fbfaf7;                /* bright cotton stock */
  --paper-deep: #f0ede7;           /* debossed wells */
  --paper-hi: #ffffff;
  --shadow-dark: rgba(110, 96, 74, .24);
  --shadow-light: rgba(255, 255, 255, 1);
  --edge-dark: rgba(96, 80, 56, .34);
  --edge-light: rgba(255, 255, 255, .95);
  /* page (the table the cards sit on): a shade deeper than the cards, with
     paper grain + faint laid lines, so smooth raised cards stand out */
  --page: #f1eee8;
  --page-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .36 0 0 0 0 .29 0 0 0 0 .2 0 0 0 .34 -.09'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --laid: rgba(96, 78, 52, .045);
  /* ink */
  --ink: #2b261f;
  --muted: #5f5648;                /* 6.2:1 on paper */
  --line: #e3ddd2;                 /* decorative rules only */
  --line-strong: #8a7d68;          /* control boundaries, 3.5:1 */
  --green: #1f4d3a;                /* evergreen ink */
  --green-btn: #1f4d3a;
  --ox: #8c1d2c;                   /* oxblood ink */
  --ox-btn: #8c1d2c;
  --on-btn: #fffaf0;
  --gold-ink: #765611;              /* gold that passes as text, 5.8:1 */
  --gold-1: #7d5a12; --gold-2: #d9b45a; --gold-3: #fff0b5; --gold-4: #c3922c; --gold-5: #6e4e0e;
  --warn: #8a4b00;
  --focus: #1f4d3a;
  --tag: #f6eedc;                  /* pale kraft tag stock */
  --tag-ink: #4e3a12;
  --kraft: #e9d9b9;                /* gift-bag kraft paper */

  --radius: 14px;
  /* Crisp letterpress edges: a hard 1px bevel (light top-left, dark bottom-right)
     plus a short, tight shadow, instead of a wide soft blur. */
  --raise:
    inset 1px 1px 0 var(--edge-light), inset -1px -1px 0 var(--edge-dark),
    1px 1px 0 var(--edge-dark), 4px 5px 7px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
  --raise-sm:
    inset 1px 1px 0 var(--edge-light), inset -1px -1px 0 var(--edge-dark),
    1px 1px 0 var(--edge-dark), 2px 2px 3px var(--shadow-dark), -1px -1px 2px var(--shadow-light);
  --press:
    inset 1px 1px 0 var(--edge-dark), inset 2px 2px 3px var(--shadow-dark),
    inset -1px -1px 0 var(--edge-light), 1px 1px 0 var(--edge-light);
  --press-deep:
    inset 1px 1px 0 var(--edge-dark), inset 3px 3px 5px var(--shadow-dark),
    inset -1px -1px 0 var(--edge-light), 1px 1px 0 var(--edge-light);
  --serif: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media screen and (prefers-color-scheme: dark) { /* print always uses the light-paper palette */
  :root {
    /* dark walnut/espresso card stock, gold foil accents */
    --paper: #2a1f18;
    --paper-deep: #211812;
    --paper-hi: #33261d;
    --shadow-dark: rgba(10, 5, 2, .62);
    --shadow-light: rgba(255, 214, 170, .07);
    --edge-dark: rgba(0, 0, 0, .6);
    --edge-light: rgba(255, 222, 186, .14);
    --page: #1e1611;
    --page-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .95 0 0 0 0 .82 0 0 0 0 .66 0 0 0 .26 -.07'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    --laid: rgba(255, 222, 186, .03);
    --ink: #f3e9d8;
    --muted: #c4b49e;
    --line: #47372b;
    --line-strong: #8f7c69;
    --green: #8fd0b0;
    --green-btn: #2c6a51;
    --ox: #f29aa4;
    --ox-btn: #a83443;
    --on-btn: #ffffff;
    --gold-ink: #e3c47e;
    --warn: #f0b45a;
    --focus: #e3c47e;
    --tag: #3d2d22;
    --tag-ink: #f1dfae;
    --kraft: #45331f;
    --give-chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%23f1dfae' stroke-width='2'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink);
  background-color: var(--page);
  background-image:
    var(--page-grain),
    repeating-linear-gradient(0deg, var(--laid) 0 1px, transparent 1px 4px),      /* laid lines */
    repeating-linear-gradient(90deg, var(--laid) 0 1px, transparent 1px 34px);   /* chain lines */
  font: 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
body { min-height: 100vh; }
/* Raised surfaces stay smooth (no grain) so they lift off the textured page. */
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

a { color: var(--green); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.12; letter-spacing: .005em; }
h2 { font-size: 1.6rem; margin: 0 0 .6rem; }
h3 { font-size: 1.35rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

main, .topbar, .footer { max-width: 752px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }

/* ----- Top bar ----- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 18px; padding-bottom: 10px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; font-family: var(--serif); font-weight: 700; font-size: 1.55rem; text-decoration: none; color: var(--ink); letter-spacing: .01em; }
.brand span { color: var(--ox); font-style: italic; padding: 0 2px 0 1px; }
.brand-mark { width: 26px; height: 26px; margin-right: 8px; color: var(--ox); }
.topbar nav { display: flex; gap: 12px; align-items: center; }

/* ----- Buttons: embossed, press in when active ----- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  min-height: 44px; padding: 9px 18px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(145deg, var(--paper-hi), var(--paper));
  color: var(--ink); font: inherit; font-size: .95rem; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  box-shadow: var(--raise-sm);
  transition: box-shadow .15s ease, transform .1s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.03); }
.btn:active, .btn[aria-expanded="true"] { box-shadow: var(--press); transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary, .btn-step {
  color: var(--on-btn); border-color: transparent; letter-spacing: .01em;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, .25);
}
.btn-primary {
  background: linear-gradient(160deg, color-mix(in srgb, var(--ox-btn) 82%, #fff) 0%, var(--ox-btn) 45%, color-mix(in srgb, var(--ox-btn) 80%, #000) 100%);
  box-shadow: var(--raise-sm), inset 0 1px 0 rgba(255, 255, 255, .28), inset 0 -2px 0 rgba(0, 0, 0, .18);
}
.btn-primary:active { box-shadow: inset 2px 3px 6px rgba(0, 0, 0, .45), inset -1px -1px 2px rgba(255, 255, 255, .12); }
.btn-lg { min-height: 54px; padding: 14px 30px; font-size: 1.1rem; }
.btn-sm { min-height: 38px; padding: 6px 14px; font-size: .875rem; }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--muted); }

.card {
  background: var(--paper); border-radius: var(--radius); padding: 22px; margin: 22px 0;
  box-shadow: var(--raise);
}
.card.quiet { box-shadow: var(--raise-sm); }

/* ----- Inputs: debossed into the paper ----- */
input {
  font: inherit; font-size: 16px; color: var(--ink); background: transparent;
  border: 1px solid transparent; border-radius: 10px; padding: 8px 10px; min-width: 0; width: 100%;
  transition: box-shadow .15s ease, background-color .15s ease;
}
input:hover { box-shadow: var(--press); }
input:focus { outline: 3px solid var(--focus); outline-offset: 1px; background: var(--paper-deep); box-shadow: var(--press); }
input::placeholder { color: var(--muted); opacity: 1; }
.field {
  min-height: 48px; background: var(--paper-deep); border-color: var(--line-strong);
  box-shadow: var(--press-deep); padding: 11px 14px;
}
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--green); margin: 0; cursor: pointer; box-shadow: none; }

/* =====================================================================
   Landing (first page = the app's empty state)
   ===================================================================== */
.hero {
  position: relative; text-align: center;
  margin: 46px 0 28px; padding: 54px 28px 30px;
  background: linear-gradient(170deg, var(--paper-hi), var(--paper) 60%);
  border-radius: 6px; box-shadow: var(--raise);
}
/* blind-embossed double rule, like a letterpress invitation border */
.hero::before {
  content: ""; position: absolute; inset: 12px; border-radius: 3px; pointer-events: none;
  border: 1px solid var(--line); outline: 1px solid var(--line); outline-offset: 3px;
  box-shadow: inset 1px 1px 0 var(--shadow-light), 1px 1px 0 var(--shadow-light);
}
.seal {
  position: absolute; top: -32px; left: 50%; width: 64px; height: 64px; margin-left: -32px;
  filter: drop-shadow(1px 3px 3px rgba(60, 10, 18, .35));
}
.eyebrow { margin: 0 0 6px; font-size: .8rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-ink); }
.hero h1 { font-size: clamp(2.3rem, 7vw, 3.4rem); margin: 0 0 10px; color: var(--ink); }
.lead { position: relative; font-size: 1.1rem; max-width: 520px; margin: 0 auto 24px; color: var(--muted); }
.hero-form { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 560px; margin: 0 auto; text-align: left; }
.hero-q { grid-column: 1 / -1; font-family: var(--serif); font-weight: 700; font-size: 1.6rem; color: var(--green); text-align: center; margin-bottom: 2px; }
.hero-form .btn { grid-column: 1 / -1; justify-self: center; min-width: 260px; margin-top: 6px; }
.hero-actions { position: relative; display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.hero-note { position: relative; max-width: 460px; margin: 18px auto 0; }

.about { margin-top: 44px; }
.rule-heading { display: flex; align-items: center; gap: 14px; font-size: 1.35rem; color: var(--muted); margin: 0 0 18px; }
.rule-heading::before, .rule-heading::after { content: ""; flex: 1; height: 2px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--shadow-light); }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0 0 8px; }
.feature { padding: 4px 6px; text-align: center; }
.feature h3 { margin: 8px 0 4px; font-size: 1.3rem; }
.feature p { margin: 0; color: var(--muted); font-size: .95rem; }
.icon { width: 46px; height: 46px; padding: 11px; border-radius: 50%; fill: none; stroke: var(--green); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; box-shadow: var(--press); }
.faq { margin: 30px 0 10px; }
.faq details { border-bottom: 1px solid var(--line); padding: 4px 4px; }
.faq summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.faq details p { margin: 0 0 12px; color: var(--muted); }
.recent-list { list-style: none; padding: 0; margin: 0; }
.recent-list li { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); gap: 8px; }
.recent-list li:first-child { border-top: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; min-height: 38px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink);
  text-decoration: none; font-size: .9rem; box-shadow: var(--raise-sm);
}
.chip:hover { color: var(--green); }
.chip:active { box-shadow: var(--press); }

/* =====================================================================
   App
   ===================================================================== */
#app { max-width: 752px; }

/* save-link strip as a gift tag */
.save-strip {
  position: relative; isolation: isolate; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  color: var(--tag-ink); padding: 10px 14px 10px 46px; margin: 6px 0 10px; font-size: .95rem; font-weight: 600;
  filter: drop-shadow(2px 3px 3px var(--shadow-dark));
}
.save-strip::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--tag);
  background-image: linear-gradient(90deg, transparent 0 40px, rgba(0,0,0,.04) 40px 41px, transparent 41px);
  clip-path: polygon(22px 0, 100% 0, 100% 100%, 22px 100%, 0 50%);
  border-radius: 4px;
}
.save-strip::after { /* punched eyelet */
  content: ""; position: absolute; left: 16px; top: 50%; width: 11px; height: 11px; margin-top: -5.5px; border-radius: 50%;
  background: var(--paper); box-shadow: inset 1px 1px 2px var(--shadow-dark), 0 0 0 2px color-mix(in srgb, var(--gold-4) 70%, transparent);
}

.title-input { font-family: var(--serif); font-size: 2.4rem; font-weight: 700; line-height: 1.15; padding: 4px 10px; margin-top: 6px; }

/* ----- Next up: ornate gilded frame ----- */
.next-up {
  position: relative; margin: 14px 0 6px; padding: 30px 46px 26px; text-align: center;
  border: 7px solid transparent; border-radius: 6px;
  background:
    linear-gradient(var(--paper-hi), var(--paper)) padding-box,
    linear-gradient(120deg, var(--gold-5) 0%, var(--gold-2) 18%, var(--gold-3) 26%, var(--gold-4) 36%, var(--gold-1) 50%, var(--gold-2) 66%, var(--gold-3) 74%, var(--gold-4) 84%, var(--gold-5) 100%) border-box;
  background-size: 100% 100%, 260% 260%;
  animation: foil 9s ease-in-out infinite alternate;
  box-shadow:
    inset 0 0 0 1px var(--gold-1), inset 0 0 0 5px var(--paper-hi), inset 0 0 0 6px color-mix(in srgb, var(--gold-4) 75%, transparent),
    0 1px 0 1px rgba(80, 56, 8, .35), 6px 10px 22px var(--shadow-dark), -4px -4px 12px var(--shadow-light);
}
@keyframes foil { from { background-position: 0 0, 0% 50%; } to { background-position: 0 0, 100% 50%; } }
.corner { position: absolute; width: 76px; height: 76px; pointer-events: none; filter: drop-shadow(0 1px .5px rgba(60, 40, 5, .5)); }
.corner.tl { top: -8px; left: -8px; }
.corner.tr { top: -8px; right: -8px; transform: scaleX(-1); }
.corner.bl { bottom: -8px; left: -8px; transform: scaleY(-1); }
.corner.br { bottom: -8px; right: -8px; transform: scale(-1, -1); }
.next-body { position: relative; }
.next-label { display: inline-block; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .2em; color: var(--gold-ink); }
.next-label::before, .next-label::after { content: "❦"; margin: 0 .6em; letter-spacing: 0; font-size: .95rem; }
.next-label::before { display: inline-block; transform: scaleX(-1); }
.next-text { font-family: var(--serif); font-weight: 600; font-size: 1.75rem; line-height: 1.2; margin: 6px 0 16px; color: var(--ink); }
.next-text b { color: var(--ox); font-weight: 700; }
.next-actions { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; }
.next-actions:empty { display: none; }
.next-up.done .next-text { margin-bottom: 4px; }
.link-amazon { font-size: .95rem; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }

.summary { color: var(--muted); margin: 10px 10px 0; min-height: 1.5em; text-align: center; font-size: .95rem; letter-spacing: .02em; }
.summary .over { color: var(--warn); font-weight: 700; }

.add-gift { display: flex; flex-direction: column; gap: 10px; padding: 16px; margin-top: 14px; }
.add-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px auto; gap: 10px; }
.add-row .btn { min-height: 48px; }
.people-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.people-chips:empty { display: none; }
.person-chip {
  font: inherit; font-size: .9rem; font-weight: 600; min-height: 36px; padding: 4px 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink); cursor: pointer; box-shadow: var(--raise-sm);
}
.person-chip.active { box-shadow: var(--press); background: var(--paper-deep); color: var(--green); border-color: var(--green); }
.person-chip.new-person { border-style: dashed; border-color: var(--green); color: var(--green); background: transparent; box-shadow: none; }

/* ----- Person groups: calm raised cards ----- */
.group { background: var(--paper); border-radius: var(--radius); padding: 14px 18px 8px; margin: 0 0 18px; box-shadow: var(--raise); }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 var(--shadow-light); }
.group-name { font-family: var(--serif); font-weight: 700; font-size: 1.6rem; line-height: 1.15; width: auto; flex: 1 1 160px; padding: 2px 8px; color: var(--green); }
.subtotal { white-space: nowrap; }

.row { padding: 12px 0; border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 var(--shadow-light); }
.group > .row:last-of-type, details .row:last-child { border-bottom: 0; box-shadow: none; }
.line1 { display: flex; align-items: center; gap: 8px; }
.idea { font-weight: 600; font-size: 1.08rem; flex: 1; }
.price { display: flex; align-items: center; color: var(--muted); }
.price input { width: 84px; text-align: right; }
.note-text { margin: 0 10px; color: var(--muted); font-size: .92rem; white-space: pre-wrap; }
.line2 { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding-left: 4px; }
.spacer { flex: 1; }
.btn-step {
  padding: 9px 20px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--green-btn) 78%, #fff) 0%, var(--green-btn) 45%, color-mix(in srgb, var(--green-btn) 78%, #000) 100%);
  box-shadow: var(--raise-sm), inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 -2px 0 rgba(0, 0, 0, .2);
}
.btn-step:active { box-shadow: inset 2px 3px 6px rgba(0, 0, 0, .45); }
.btn-amazon { border-color: transparent; background: transparent; box-shadow: none; color: var(--green); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; padding: 6px 8px; min-height: 44px; }
.btn-amazon:active { box-shadow: none; }
.more { min-width: 44px; min-height: 44px; padding: 0; font-size: 1.2rem; line-height: 1; border-color: var(--line-strong); }

/* gold-foil "Done" stamp */
.done-badge {
  display: inline-flex; align-items: center; min-height: 34px; padding: 3px 14px; border-radius: 999px;
  font-family: var(--serif); font-weight: 700; font-size: 1.05rem; letter-spacing: .06em; color: var(--gold-ink);
  border: 2px solid transparent; transform: rotate(-2deg);
  background: linear-gradient(var(--paper-deep), var(--paper-deep)) padding-box,
              linear-gradient(120deg, var(--gold-1), var(--gold-3) 40%, var(--gold-4) 60%, var(--gold-5)) border-box;
  box-shadow: var(--press);
}
.done-badge > span { margin-right: .3em; }
.is-done .idea { color: var(--muted); }

/* ⋯ drawer: a debossed well */
.drawer { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; padding: 14px; background: var(--paper-deep); border-radius: 12px; box-shadow: var(--press-deep); }
.drawer input:not([type=checkbox]) { background: var(--paper); border-color: var(--line-strong); min-height: 44px; }
.fix { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.fix label { display: flex; align-items: center; gap: 6px; cursor: pointer; min-height: 40px; }
.link-danger { align-self: flex-start; background: none; border: 0; color: var(--ox); font: inherit; font-size: .92rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 8px 2px; min-height: 40px; }

details.wrapped { margin-top: 4px; }
details.wrapped > summary { cursor: pointer; color: var(--gold-ink); font-weight: 700; padding: 10px 4px; min-height: 44px; letter-spacing: .02em; }

.empty { text-align: left; }
.empty p { margin-top: 0; font-size: 1.05rem; }

.limit summary { cursor: pointer; color: var(--muted); font-weight: 600; min-height: 32px; }
.cap { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--muted); }
.cap input { width: 140px; }

/* ads: clearly labelled, set apart from controls */
.ad-wrap { margin: 40px 0; padding-top: 10px; border-top: 1px solid var(--line); }
.ad-wrap:has(.ad-slot:empty) { display: none; }
.ad-label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 6px; }

.footer { color: var(--muted); font-size: .875rem; text-align: center; padding-top: 22px; padding-bottom: 44px; margin-top: 24px; border-top: 1px solid var(--line); }

/* toast as a small embossed card */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 50;
  display: flex; align-items: center; gap: 14px; width: max-content; max-width: calc(100% - 32px);
  background: var(--paper-hi); color: var(--ink); padding: 10px 10px 10px 18px; border-radius: 12px;
  border: 1px solid var(--line-strong); border-left: 4px solid var(--green); font-size: .95rem;
  box-shadow: 0 10px 28px rgba(20, 14, 4, .28), 0 2px 4px rgba(20, 14, 4, .18);
  animation: toast-in .2s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
.toast-undo {
  min-height: 40px; background: transparent; color: var(--green); border: 1.5px solid var(--green); border-radius: 999px;
  padding: 4px 16px; font: inherit; font-weight: 700; cursor: pointer;
}
.toast-undo:active { box-shadow: var(--press); }

/* privacy page */
article.card h1 { font-size: 2.4rem; margin-top: 0; }
article.card h2 { margin-top: 1.4rem; }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .topbar { flex-wrap: nowrap; gap: 8px; }
  .brand { font-size: 1.3rem; }
  .brand-mark { width: 22px; height: 22px; margin-right: 6px; }
  .topbar nav { gap: 8px; }
  #save-status { display: none; }
  .hero { padding: 48px 20px 24px; margin-top: 40px; }
  .hero::before { inset: 8px; }
  .hero-form { grid-template-columns: 1fr; }
  .hero-form .btn { width: 100%; min-width: 0; }
  .hero-q { font-size: 1.45rem; }
  .features { grid-template-columns: 1fr; gap: 22px; }
  .add-row { grid-template-columns: minmax(0, 1fr) 120px; }
  .add-row #new-idea { grid-column: 1 / -1; }
  .title-input { font-size: 2rem; }
  .next-up { padding: 34px 22px 26px; }
  .next-text { font-size: 1.5rem; }
  .group { padding: 12px 14px 6px; }
  .line2 { flex-wrap: wrap; row-gap: 6px; }
  .card { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .btn:active, .btn[aria-expanded="true"] { transform: none; }
}

h1, h2, .lead { text-wrap: balance; }

/* ----- Persona-feedback round: save link, budget-first, quieter Amazon ----- */
.save-strip { font-weight: 500; }
.save-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.budget-bar { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 12px 0 4px; }
.budget-bar .summary { margin: 0; font-size: 1.05rem; color: var(--ink); }
.budget-bar .summary b { font-weight: 700; }
.budget-bar .cap { margin-top: 0; }
.link-btn { background: none; border: 0; padding: 6px 4px; min-height: 36px; font: inherit; font-size: .92rem; font-weight: 600;
  color: var(--green); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.over, .over b { color: var(--warn); }

.person-budget { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); white-space: nowrap; }
.person-budget input { width: 72px; min-height: 36px; padding: 4px 6px; text-align: right; }
.group-head .subtotal { flex-basis: 100%; color: var(--muted); padding-left: 8px; white-space: normal; }
.group-head .subtotal b { color: var(--ink); }

.link-amazon.small { font-size: .85rem; font-weight: 500; color: var(--muted); min-height: 44px; }
.link-amazon.small:hover { color: var(--green); }

.row.no-idea .idea::placeholder { color: var(--green); opacity: 1; font-style: italic; }
.row.no-idea .line2 { margin-top: 0; }
.hide-spot { display: block; width: calc(100% - 16px); margin: 6px 8px 0; font-size: .95rem; min-height: 40px; }

/* ----- Gift link: "Buy it" replaces "Find on Amazon"; never both ----- */
.shop { display: contents; }
.link-hint { margin: -2px 4px 0; }
.next-actions .link-buy { font-size: .95rem; }
.drawer-amazon:empty { display: none; }

/* ----- Gift bag: unassigned gifts on kraft paper, above the people ----- */
.bag {
  position: relative; isolation: isolate; margin: 26px 0 22px; padding: 22px 18px 10px;
  color: var(--tag-ink); filter: drop-shadow(2px 4px 4px var(--shadow-dark));
}
.bag::before { /* kraft paper with a pinked (zigzag) folded top edge */
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 0 0 var(--radius) var(--radius);
  background:
    linear-gradient(180deg, transparent 0 26px, rgba(0, 0, 0, .07) 26px 27px, transparent 27px 100%),
    linear-gradient(var(--kraft), var(--kraft));
  -webkit-mask: linear-gradient(#000, #000) 0 10px / 100% 100% no-repeat, conic-gradient(from 135deg at top, #000 90deg, #0000 0) 0 0 / 20px 10px repeat-x;
  mask: linear-gradient(#000, #000) 0 10px / 100% 100% no-repeat, conic-gradient(from 135deg at top, #000 90deg, #0000 0) 0 0 / 20px 10px repeat-x;
}
.bag-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 6px 4px 8px; border-bottom: 1px dashed color-mix(in srgb, var(--tag-ink) 35%, transparent); }
.bag-title { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 1.6rem; color: var(--tag-ink); }
.bag-title::before {
  content: ""; width: 22px; height: 22px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M5 8h14l-1 13H6zM9 8V6a3 3 0 0 1 6 0v2'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M5 8h14l-1 13H6zM9 8V6a3 3 0 0 1 6 0v2'/%3E%3C/svg%3E") center / contain no-repeat;
}
.bag-sub { font-weight: 600; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.bag .row { border-bottom-color: color-mix(in srgb, var(--tag-ink) 18%, transparent); box-shadow: none; }
.bag .row:last-child { border-bottom: 0; }
.bag .idea, .bag .price { color: var(--tag-ink); }
.assign { display: flex; align-items: center; gap: 8px; }
.assign-new { flex: 1 1 200px; min-height: 44px; padding: 6px 12px; }

/* ----- Everybody: people show as one summary line each; tapping one selects them ----- */
.group-summary {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 24px; align-items: center; gap: 4px 14px;
  width: 100%; min-height: 56px; padding: 10px 16px 10px 18px; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.sum-name { font-family: var(--serif); font-weight: 700; font-size: 1.4rem; line-height: 1.15; color: var(--green); overflow-wrap: anywhere; }
.sum-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0 10px; color: var(--muted); text-align: right; }
.sum-meta .subtotal { white-space: normal; text-wrap: pretty; }
.sum-meta .subtotal:empty { display: none; }
.sum-meta .subtotal b { color: var(--ink); font-weight: 600; }
.chev { justify-self: center; width: 10px; height: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); }
.next-actions .show-me { color: var(--muted); }
@keyframes flash { from { box-shadow: 0 0 0 3px var(--gold-2); } to { box-shadow: 0 0 0 3px transparent; } }
.row.flash { animation: flash 1.6s ease-out; border-radius: 8px; }

/* Expanded header: name shrinks so the budget stays on one line on phones */
.group-head .group-name { flex: 1 1 0; min-width: 0; }

/* =====================================================================
   Filter chips: ✓ Everybody · Mom · Dad · … · ＋ New person (a radio group)
   ===================================================================== */
.filter-chips .person-chip { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; flex: none; }
.filter-chips .person-chip[aria-checked="true"] { box-shadow: var(--press); background: var(--paper-deep); color: var(--green); border-color: var(--green); border-style: solid; }
.filter-chips .chk { font-weight: 700; }
.filter-chips .everybody { font-family: var(--serif); font-size: 1.08rem; font-weight: 700; }
.filter-chips:focus-within .person-chip:focus-visible { outline-offset: 2px; }
.add-gift { margin-top: 10px; }

/* A person selected: their section, then the gift bag as a short "give one to them?" list */
.bag-shelf { padding-bottom: 8px; }
.bag-shelf .bag-title { font-size: 1.3rem; }
.bag-shelf .bag-head { padding-bottom: 4px; }
.bag-mini { display: flex; align-items: center; gap: 10px; padding: 8px 4px; }
.bag-mini .bag-idea { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.bag-mini .assign { margin: 0; padding: 0; flex: 0 1 auto; min-width: 0; max-width: 55%; }
.bag-mini .give-btn { white-space: normal; text-align: center; overflow-wrap: anywhere; max-width: 100%; }
.give-btn { color: var(--tag-ink); border-color: color-mix(in srgb, var(--tag-ink) 60%, transparent); background: transparent; }

@media (max-width: 600px) {
  /* Many people: one row that scrolls sideways, with a fade at whichever edge has more */
  .filter-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
  .filter-chips::-webkit-scrollbar { display: none; }
}

@media print {
  .topbar nav, .save-strip, .next-up, .budget-bar .link-btn, .filter-chips, .add-gift, #empty, .ad-wrap, .tools-link, .footer,
  .more, .btn-step, .assign, .drawer, .hide-spot, .toast { display: none !important; }
  body { background: #fff; }
  .group, .group.collapsed, .bag { box-shadow: none; filter: none; break-inside: avoid; }
}

/* =====================================================================
   Lighter gift bag: one "Give to…" per gift, money only when opened
   ===================================================================== */
.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; }

/* A native select dressed as a paper chip, sitting on the gift's action line */
.bag .line2 { flex-wrap: wrap; row-gap: 8px; }
.bag .line2 .assign { flex: 0 1 auto; min-width: 0; }
.bag .line2 .assign:has(.assign-new:not([hidden])) { flex: 1 1 100%; order: 5; }
.give-select {
  appearance: none; -webkit-appearance: none; max-width: 100%;
  font: inherit; font-size: .9rem; font-weight: 600; min-height: 44px; padding: 6px 34px 6px 16px; border-radius: 999px; cursor: pointer;
  color: var(--tag-ink); border: 1px solid color-mix(in srgb, var(--tag-ink) 70%, transparent);
  background: var(--give-chev) no-repeat right 13px center / 12px, linear-gradient(145deg, color-mix(in srgb, var(--paper-hi) 55%, var(--kraft)), color-mix(in srgb, var(--paper) 40%, var(--kraft)));
  box-shadow: var(--raise-sm);
  width: 8.4em; text-overflow: ellipsis; /* it only ever shows "Give to…": don't size to the longest name */
}
.give-select:hover { filter: brightness(1.03); }
.give-select:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.give-select option { color: var(--ink); background: var(--paper); }

/* With a total budget set, the totals line is the edit control */
.summary-edit {
  font: inherit; color: inherit; letter-spacing: inherit; text-align: center; background: none; border: 0; cursor: pointer;
  min-height: 44px; padding: 6px 10px; border-radius: 10px;
}
.summary-edit:hover { box-shadow: var(--press); }
.summary-edit .edit-hint { color: var(--green); font-weight: 700; }

@media (max-width: 600px) {
  /* Collapsed people: name and "2 of 3 bought" on one line; money shows once you open them */
  .group-summary .subtotal { display: none; }
}
@media (max-width: 600px) {
  .bag .line2 { column-gap: 8px; }
  .bag .line2 .btn-step { padding: 9px 14px; }
  .give-select { width: 7.4em; padding: 6px 26px 6px 12px; background-position: right 10px center; }
}

/* =====================================================================
   Santa's list: everything below the totals line is one continuous strip
   of paper, rolled at the top and curling under past the last person.
   Smooth stock (no grain) so it lifts off the laid-paper page.
   ===================================================================== */
:root {
  --strip: #fffefb;                         /* white cotton paper */
  --strip-hi: #ffffff;
  --strip-shade: #ddd5c6;                   /* the inside of the roll */
  --strip-side: rgba(110, 96, 74, .07);     /* paper curving away at the edges */
  --rule: #ebe4d6;                          /* ruled line between entries (decorative) */
  --margin-rule: rgba(140, 29, 44, .26);    /* oxblood margin line, desktop only */
  --gut: 58px;                              /* left margin of the sheet; ✓ sits in it */
  --pad-r: 22px;
}
@media screen and (prefers-color-scheme: dark) {
  :root {
    --strip: #34271d;                       /* warm tobacco parchment, not bright on walnut */
    --strip-hi: #46362a;
    --strip-shade: #1a120c;
    --strip-side: rgba(0, 0, 0, .16);
    --rule: #4a392c;
    --margin-rule: rgba(242, 154, 164, .22);
  }
}
/* keep focused things clear of the sticky chip row (--chips-h is its height, set by app.js; 0 when it doesn't stick) */
html { scroll-padding-top: calc(var(--chips-h, 64px) + 12px); }

.strip {
  --strip-bg:
    linear-gradient(90deg, transparent calc(var(--gut) - 15px), var(--margin-rule) 0 calc(var(--gut) - 14px), transparent 0),
    linear-gradient(90deg, var(--strip-side), transparent 22px, transparent calc(100% - 22px), var(--strip-side)),
    var(--strip);
  position: relative; margin: 46px 0 64px; padding: 0 0 38px;
  background: linear-gradient(180deg, transparent calc(100% - 26px), color-mix(in srgb, var(--strip-shade) 45%, transparent)), var(--strip-bg);
  box-shadow:
    1px 0 0 var(--edge-dark), -1px 0 0 color-mix(in srgb, var(--edge-dark) 60%, transparent),
    5px 8px 12px -6px var(--shadow-dark), -4px 8px 12px -6px var(--shadow-dark);
}
/* The paper roll at the top (its ends show the spiral), and the curl it rolls back into at the bottom */
.strip::before, .strip::after {
  content: ""; position: absolute; z-index: 3; pointer-events: none;
  background:
    var(--spiral) left / var(--roll) 100% no-repeat,
    var(--spiral) right / var(--roll) 100% no-repeat,
    linear-gradient(180deg, var(--strip-shade) 0%, var(--strip) 30%, var(--strip-hi) 46%, var(--strip) 64%, var(--strip-shade) 100%);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--edge-dark) 55%, transparent), 0 4px 6px -2px var(--shadow-dark);
  /* the rolled-up paper seen end-on: a few rings, nothing outside the circle */
  --spiral: radial-gradient(circle closest-side, var(--strip-shade) 0 12%, var(--strip-hi) 16% 32%, var(--strip-shade) 35% 39%,
    var(--strip) 43% 60%, var(--strip-shade) 63% 67%, var(--strip-hi) 71% 86%, var(--strip-shade) 89% 98%, transparent 100%);
}
.strip::before { --roll: 30px; left: -12px; right: -12px; top: -26px; height: 30px; }
.strip::after { --roll: 24px; left: -7px; right: -7px; bottom: -16px; height: 24px; }

/* Chip row: the head of the sheet, sticky while you scroll a long list */
.strip .filter-chips {
  position: sticky; top: 0; z-index: 2; margin: 0; padding: 16px var(--pad-r) 12px var(--gut);
  background: var(--strip-bg); border-bottom: 1px solid var(--rule);
}
.strip .filter-chips.too-tall { position: relative; } /* lots of people on a short screen: a header that big would hide the list */
.strip .add-gift {
  background: none; box-shadow: none; border-radius: 0; margin: 0; gap: 8px;
  padding: 14px var(--pad-r) 16px var(--gut); border-bottom: 1px solid var(--rule);
}
.strip .empty { background: none; box-shadow: none; border-radius: 0; margin: 0; padding: 16px var(--pad-r) 4px var(--gut); }

/* People are entries on the list, not cards; ruled lines only between entries */
.strip .group, .strip .group.collapsed { background: none; box-shadow: none; border-radius: 0; margin: 0; padding: 0; border-bottom: 1px solid var(--rule); }
.strip #groups > .group:last-child { border-bottom: 0; }
.strip .group:not(.collapsed) { padding: 14px var(--pad-r) 8px var(--gut); }
.strip .group-head, .strip .row { border-bottom-color: var(--rule); box-shadow: none; }
.strip .group-summary {
  position: relative; grid-template-columns: minmax(0, 1fr) auto 18px; gap: 0 12px;
  min-height: 52px; padding: 8px var(--pad-r) 8px var(--gut); border-radius: 0;
}
.strip .group-summary:hover, .strip .group-summary:active { background: none; box-shadow: none; }
.strip .group-summary:hover .sum-name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.strip .group-summary:focus-visible { outline-offset: -3px; border-radius: 6px; }
/* name ······· 2 of 3 bought */
.strip .sum-name { display: flex; align-items: baseline; gap: 10px; font-size: 1.35rem; }
.strip .sum-name::after { content: ""; flex: 1 1 14px; min-width: 14px; border-bottom: 2px dotted color-mix(in srgb, var(--muted) 50%, transparent); transform: translateY(-.28em); }
.strip .sum-meta { flex-wrap: nowrap; white-space: nowrap; }
.strip .chev { width: 8px; height: 8px; }
/* A gold ✓ in the margin, only once everything for that person is wrapped (no empty boxes) */
.strip .all-wrapped .group-summary::before {
  content: "✓"; content: "✓" / ""; position: absolute; left: 0; width: calc(var(--gut) - 15px); text-align: center;
  font-size: 1.25rem; font-weight: 700; line-height: 1; color: var(--gold-ink);
}

/* The gift bag is pinned onto the strip, a little crooked. Only the kraft backing tilts, and with a skew,
   not a rotation, so its width never grows with the bag's height (no sideways scrolling on phones). */
.strip .bag { margin: 24px var(--pad-r) 22px calc(var(--gut) - 6px); }
.strip .bag::before { transform: skewY(-.8deg); }
.strip .bag::after { /* gold pin */
  content: ""; position: absolute; top: 4px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, var(--gold-3), var(--gold-2) 32%, var(--gold-4) 58%, var(--gold-5));
  box-shadow: 1px 2px 2px rgba(30, 20, 4, .4), inset -1px -1px 1px rgba(60, 40, 5, .35);
}
.strip .bag-shelf::before { transform: skewY(.6deg); }
@media (prefers-reduced-motion: reduce) { .strip .bag::before { transform: none; } }

@media (max-width: 600px) {
  :root { --gut: 26px; --pad-r: 14px; }
  .strip { margin: 40px 0 52px; --strip-bg: linear-gradient(90deg, var(--strip-side), transparent 14px, transparent calc(100% - 14px), var(--strip-side)), var(--strip); }
  /* Sideways chip row: fade the edges with sticky overlays, not a mask, so the sticky paper stays opaque */
  .strip .filter-chips { padding: 12px var(--pad-r) 12px var(--gut); scroll-padding: 0 var(--pad-r) 0 var(--gut); }
  .strip .filter-chips::before, .strip .filter-chips::after {
    content: ""; position: sticky; z-index: 1; flex: none; align-self: stretch; width: 40px; pointer-events: none; opacity: 0; transition: opacity .2s;
  }
  /* each overlay is 40px wide with -48px margin: with the 8px gap it takes no room */
  .strip .filter-chips::before { left: 0; margin: -12px -48px -12px 0; background: linear-gradient(90deg, var(--strip) 20%, transparent); }
  .strip .filter-chips::after { right: 0; margin: -12px 0 -12px -48px; background: linear-gradient(270deg, var(--strip) 20%, transparent); }
  .strip .filter-chips.fade-start::before, .strip .filter-chips.fade-end::after { opacity: 1; }
  .strip .sum-name { font-size: 1.25rem; }
  .strip .all-wrapped .group-summary::before { width: var(--gut); font-size: 1.05rem; }
  .strip .bag { margin: 22px 10px 20px 12px; padding-left: 12px; padding-right: 12px; }
}

@media print {
  .strip, .strip .filter-chips { background: none !important; box-shadow: none !important; margin: 0; padding: 0; }
  .strip::before, .strip::after, .strip .bag::after, .strip .sum-name::after { display: none !important; }
  .strip .bag { margin: 12px 0; }
  .strip .group, .strip .group:not(.collapsed) { padding: 8px 0; border-bottom: 1px solid #ccc; }
  .bag::before { transform: none !important; background: none !important; border: 1px solid #999; -webkit-mask: none !important; mask: none !important; }
  .bag { color: #000; }
  .edit-hint, .chev, .summary-edit .sr-only { display: none !important; }
  .strip .bag .row, .strip .group .row { break-inside: avoid; }
}
