/* Gift List. Cream paper, pine green, cranberry. Phone first. */
:root {
  --bg: #f8f3ea;
  --card: #fffdf9;
  --ink: #1c2622;
  --muted: #66736c;
  --line: #e6dccb;
  --pine: #1f5c45;
  --pine-dk: #174634;
  --berry: #b8323a;
  --berry-soft: #f6e2df;
  --gold: #b88a2e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(40, 30, 10, .05), 0 4px 14px rgba(40, 30, 10, .05);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, ui-serif, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 var(--sans);
  color: var(--ink);
  background: var(--bg);
  background-image: radial-gradient(rgba(31, 92, 69, .05) 1px, transparent 1px);
  background-size: 22px 22px;
  min-height: 100vh;
}
a { color: var(--pine); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); letter-spacing: -.01em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.12rem; }
p { margin: .4em 0; }
.boot, .loading { color: var(--muted); text-align: center; padding: 3rem 1rem; }

/* ---------- top bar */
.top { background: var(--pine); color: #fff; position: sticky; top: 0; z-index: 5; box-shadow: 0 1px 0 rgba(0,0,0,.08); }
.top-in { max-width: 720px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: .65rem 1rem; padding-top: max(.65rem, env(safe-area-inset-top)); }
.brand { display: flex; align-items: center; gap: .5rem; color: #fff; text-decoration: none; font-family: var(--serif); font-weight: 600; font-size: 1.2rem; }
.brand img { background: #fffdf9; border-radius: 7px; padding: 2px; }
.top nav { display: flex; align-items: center; gap: .9rem; font-size: .95rem; }
.top .who { color: #fff; text-decoration: none; font-weight: 600; max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .link { color: #e3efe9; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: #e3efe9; text-decoration: underline; cursor: pointer; }

.wrap { max-width: 720px; margin: 0 auto; padding: 1.25rem 1rem 5rem; }

/* ---------- buttons and forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: 600 .95rem/1 var(--sans); padding: .72rem 1.05rem; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: #cdbfa6; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--berry); border-color: var(--berry); color: #fff; }
.btn.primary:hover { background: #a02a32; border-color: #a02a32; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); border-color: var(--line); }
.btn.danger { border-color: var(--berry); color: var(--berry); }
.btn.small { padding: .5rem .85rem; font-size: .88rem; }
.btn.wide { width: 100%; padding: .9rem; font-size: 1rem; }

label { display: block; font-weight: 600; font-size: .92rem; margin: .8rem 0 0; }
.opt { font-weight: 400; color: var(--muted); font-size: .85rem; margin-left: .25rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: .3rem; font: 16px/1.35 var(--sans); color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: .7rem .8rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pine); box-shadow: 0 0 0 3px rgba(31, 92, 69, .15); }
textarea { resize: vertical; }
.row { display: flex; gap: .75rem; align-items: flex-end; }
.row .grow { flex: 1; }
.row.end { justify-content: flex-end; margin-top: 1rem; }
.err { color: var(--berry); font-weight: 600; font-size: .92rem; }
.fine { color: var(--muted); font-size: .9rem; }
.small { font-size: .9rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.15rem 1.25rem; box-shadow: var(--shadow); }

/* ---------- welcome */
.welcome .hero { padding: 1.2rem 0 1.4rem; }
.welcome h1 em { color: var(--berry); font-style: italic; }
.lede { font-size: 1.08rem; color: #3c4a44; max-width: 34rem; margin-top: .8rem; }
.how { list-style: none; counter-reset: how; padding: 0; margin: 1.2rem 0 0; display: grid; gap: .55rem; }
.how li { counter-increment: how; position: relative; padding-left: 2.3rem; color: #3c4a44; }
.how li::before {
  content: counter(how); position: absolute; left: 0; top: .05rem; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: var(--pine); color: #fff; font: 700 .85rem/1.6rem var(--sans); text-align: center;
}
.how b { color: var(--ink); }
.auth { max-width: 26rem; }
.auth h2 { margin-bottom: .2rem; }
.auth .btn.wide { margin-top: 1.1rem; }
.switch { text-align: center; margin-top: .9rem; font-size: .92rem; }

/* ---------- tabs */
.tabs { display: flex; gap: .3rem; background: #efe6d6; padding: .3rem; border-radius: 999px; margin-bottom: 1.2rem; }
.tabs a { flex: 1; text-align: center; padding: .6rem .5rem; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .95rem; }
.tabs a.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- share card */
.share { border-top: 4px solid var(--pine); }
.share p { color: #3c4a44; }
.linkrow { display: flex; gap: .5rem; margin: .8rem 0 .6rem; }
.linkrow input { margin: 0; font-size: .92rem; background: #f6f1e7; color: var(--pine-dk); font-weight: 600; }

.listhead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.8rem 0 .9rem; }
.count { font: 600 .85rem/1 var(--sans); background: #efe6d6; color: var(--muted); padding: .25rem .55rem; border-radius: 999px; vertical-align: middle; margin-left: .3rem; }
#editor:not(:empty) { margin-bottom: 1rem; }

/* ---------- items */
.items { display: grid; gap: .75rem; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.item h3 { margin: .45rem 0 .1rem; word-break: break-word; }
.item h3 a { color: var(--ink); text-decoration: none; }
.item h3 a:hover { text-decoration: underline; }
.item-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.price { font-weight: 700; font-size: 1.05rem; color: var(--pine-dk); white-space: nowrap; }
.notes { color: #4d5a54; font-size: .94rem; white-space: pre-line; }
.site { display: inline-block; margin-top: .35rem; font-size: .88rem; color: var(--muted); text-decoration: none; border-bottom: 1px dashed #c9bda8; }
.site:hover { color: var(--pine); border-color: var(--pine); }
.item-actions { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }
.item .card.editor { box-shadow: none; border: 0; padding: 0; background: transparent; }

.want { display: inline-flex; align-items: center; gap: .45rem; font-size: .8rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: #e2d8c6; }
.dots i.on { background: var(--muted); }
.want-5 { color: var(--berry); }
.want-5 .dots i.on { background: var(--berry); }
.want-4 { color: #9c4a3a; }
.want-4 .dots i.on { background: #c0645a; }
.want-3 { color: var(--pine); }
.want-3 .dots i.on { background: var(--pine); }

.item.mine { border-color: #b9d3c6; background: #f7fbf8; }
.item.is-bought h3 { text-decoration: line-through; text-decoration-color: rgba(31, 92, 69, .5); }
.item.taken { opacity: .72; }
.item.removed { background: #fbf3f2; border-color: #ecc9c5; }
.flag { margin: 0 0 .3rem; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.flag.you { color: var(--pine); }
.item.removed .flag { color: var(--berry); }
.check { display: inline-flex; align-items: center; gap: .45rem; margin: 0 auto 0 0; font-weight: 600; cursor: pointer; }
.check input { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--pine); }

.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; border: 1.5px dashed var(--line); border-radius: var(--radius); }
.empty b { color: var(--ink); }

/* ---------- editor */
.editor h3 { margin-bottom: .2rem; }
.wantpick { border: 0; padding: 0; margin: .9rem 0 0; }
.wantpick legend { font-weight: 600; font-size: .92rem; padding: 0; }
.wantpick label { display: inline-block; margin: .4rem .3rem 0 0; font-weight: 500; }
.wantpick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.wantpick span { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .75rem; border: 1.5px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; font-size: .9rem; }
.wantpick input:checked + span { border-color: var(--pine); background: #eaf3ee; color: var(--pine-dk); font-weight: 700; }
.wantpick input:checked + span .dots i.on { background: var(--pine); }
.wantpick input:focus-visible + span { box-shadow: 0 0 0 3px rgba(31, 92, 69, .2); }

/* ---------- someone's list */
.listtitle { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: .4rem 0 1rem; }
.sub { color: var(--muted); margin-top: .35rem; }
.sort { display: inline-flex; background: #efe6d6; border-radius: 999px; padding: .2rem; }
.sort button { border: 0; background: none; font: 600 .82rem/1 var(--sans); color: var(--muted); padding: .5rem .75rem; border-radius: 999px; cursor: pointer; }
.sort button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.hint { font-size: .9rem; color: var(--muted); margin: -.3rem 0 1rem; }
.banner { background: #eaf3ee; border: 1px solid #b9d3c6; color: var(--pine-dk); padding: .8rem 1rem; border-radius: 12px; margin-bottom: 1.2rem; font-size: .95rem; }

details.claimed { margin-top: 1.6rem; }
details.claimed > summary, details.account > summary {
  cursor: pointer; list-style: none; font-weight: 700; color: var(--muted); padding: .85rem 1rem;
  border: 1.5px dashed var(--line); border-radius: var(--radius); text-align: center; user-select: none;
}
details > summary::-webkit-details-marker { display: none; }
details.claimed > summary::after, details.account > summary::after { content: " ▾"; }
details[open].claimed > summary::after, details[open].account > summary::after { content: " ▴"; }
details.claimed[open] > summary { margin-bottom: .75rem; }

.cta { text-align: center; margin-top: 2.5rem; padding: 1.5rem 1rem; border-top: 1px solid var(--line); }
.cta p { color: var(--muted); margin-bottom: 1rem; }

/* ---------- gifts I'm getting */
.summary { border-top: 4px solid var(--berry); margin-bottom: 1.4rem; }
.group { margin-bottom: 1.6rem; }
.grouphead { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; margin-bottom: .7rem; }
.grouphead h2 { margin-right: auto; }
.grouphead .sum { font-weight: 700; color: var(--pine-dk); }
.people h2 { margin-bottom: .6rem; }
.people ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.people li { display: flex; justify-content: space-between; gap: 1rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .7rem 1rem; }
.people li a { font-weight: 700; text-decoration: none; }
.people li span { color: var(--muted); font-size: .9rem; }

/* ---------- account */
details.account { margin-top: 3rem; }
details.account[open] > summary { margin-bottom: .5rem; }
.mini { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-top: .75rem; }
.mini .btn { margin-top: .9rem; }

/* ---------- toast and modal */
#toast {
  position: fixed; left: 50%; bottom: max(1.2rem, env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(92vw, 30rem); background: var(--ink); color: #fff; border-radius: 12px; padding: .8rem 1rem;
  display: flex; align-items: center; gap: 1rem; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); z-index: 30; font-size: .95rem;
}
#toast[hidden] { display: none; }
#toast span { flex: 1; }
#toast button { background: none; border: 1.5px solid rgba(255,255,255,.4); color: #fff; border-radius: 999px; padding: .4rem .8rem; font: 600 .88rem var(--sans); cursor: pointer; }

.modal { position: fixed; inset: 0; background: rgba(20, 28, 24, .45); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 20; }
.modal-in { position: relative; width: min(100%, 26rem); max-height: 92vh; overflow: auto; }
.modal-in .auth { max-width: none; }
.modal-x { position: absolute; top: .55rem; right: .7rem; border: 0; background: none; font-size: 1.6rem; line-height: 1; color: var(--muted); cursor: pointer; z-index: 1; }

@media (max-width: 480px) {
  .linkrow { flex-wrap: wrap; }
  .linkrow input { flex-basis: 100%; }
  .listhead h2 { font-size: 1.15rem; }
}
