/* Layout: one phone-width column; cards with a screen-print offset shadow; parent screens widen to two columns on desktop. */
:root {
  --paper: #f3f4f1;
  --surface: #ffffff;
  --ink: #15171a;
  --muted: #5d646d;
  --line: #d8dbd5;
  --red: #d7263d;
  --red-soft: #fbe3e6;
  --pine: #1b7f5a;
  --pine-soft: #dcf0e6;
  --gold: #f2b705;
  --gold-soft: #fdf1c9;
  --shadow: #15171a;
  --display: "Bricolage Grotesque", "Arial Black", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121417; --surface: #1b1e22; --ink: #eef0ec; --muted: #9ba3ac; --line: #2d3238;
    --red: #ff5d71; --red-soft: #3a1b21; --pine: #4fc28f; --pine-soft: #17332a;
    --gold: #ffcb3d; --gold-soft: #3a3117; --shadow: #000000;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; min-height: 100dvh;
}
img { max-width: 100%; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.wrap {
  max-width: 640px; margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: flex; flex-direction: column; gap: 20px;
}
.wrap.wide { max-width: 980px; }
.boot { text-align: center; color: var(--muted); padding: 40vh 0 0; }

/* ---------- Type ---------- */
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.05; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 7vw, 2.8rem); font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 800; }
h3 { font-size: 1.05rem; font-weight: 600; }
.eyebrow { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--muted); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Top bar ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top .back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 700; padding: 8px 0; }
.who { display: flex; align-items: center; gap: 8px; }
.dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-family: var(--display); font-weight: 800; font-size: .95rem; flex: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); }
.linkbtn { background: none; border: 0; padding: 8px 4px; color: var(--muted); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px;
  border: 2px solid var(--ink); border-radius: 12px; background: var(--surface); font-weight: 700; cursor: pointer;
  box-shadow: 3px 3px 0 var(--shadow); text-decoration: none; transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow); }
.btn.primary { background: var(--red); border-color: var(--ink); color: #fff; }
.btn.green { background: var(--pine); color: #fff; }
.btn.ghost { box-shadow: none; border-color: var(--line); }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: .9rem; border-radius: 10px; }
.btn[disabled] { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 2px solid var(--ink); border-radius: 16px; box-shadow: 4px 4px 0 var(--shadow); padding: 16px; }
.plain { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }

/* ---------- Login ---------- */
.hello { padding-top: 6vh; display: flex; flex-direction: column; gap: 6px; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.person {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 10px; cursor: pointer;
  background: var(--surface); border: 2px solid var(--ink); border-radius: 16px; box-shadow: 4px 4px 0 var(--shadow);
  font-weight: 700; text-align: center;
}
.person:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--shadow); }
.person .dot { width: 56px; height: 56px; font-size: 1.4rem; }
.person small { color: var(--muted); font-weight: 400; }

.pin { display: flex; flex-direction: column; align-items: center; gap: 18px; padding-top: 4vh; }
.pin-dots { display: flex; gap: 14px; min-height: 22px; }
.pin-dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink); }
.pin-dots i.on { background: var(--ink); }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px; }
.pad button {
  height: 76px; border-radius: 50%; border: 2px solid var(--ink); background: var(--surface); font-family: var(--display);
  font-size: 1.7rem; font-weight: 600; cursor: pointer; box-shadow: 3px 3px 0 var(--shadow);
}
.pad button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow); }
.pad button.plainkey { border-color: transparent; box-shadow: none; background: none; font-size: 1rem; font-family: var(--body); font-weight: 700; }
.err { color: var(--red); font-weight: 700; min-height: 1.4em; text-align: center; }

/* ---------- Home tiles ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 18px; min-height: 130px;
  padding: 16px; border-radius: 16px; border: 2px solid var(--ink); background: var(--surface); text-decoration: none;
  box-shadow: 4px 4px 0 var(--shadow);
}
.tile.hero { grid-column: 1 / -1; background: var(--red); color: #fff; min-height: 170px; overflow: hidden; }
.tile.hero .eyebrow { color: rgba(255,255,255,.85); }
.tile.hero h2 { font-size: 1.9rem; }
.tile.soon { border-style: dashed; box-shadow: none; color: var(--muted); }
.tile .tag { align-self: flex-start; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); }
.tile.hero .stamp { position: absolute; right: -18px; bottom: -26px; font-family: var(--display); font-weight: 800; font-size: 6.5rem; opacity: .16; line-height: 1; }

/* ---------- Christmas: kid ---------- */
.countdown { display: inline-flex; align-items: baseline; gap: 6px; background: var(--gold); color: #15171a; padding: 4px 12px; border-radius: 999px; font-weight: 700; border: 2px solid var(--ink); }
.countdown b { font-family: var(--display); font-size: 1.3rem; }
.add { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
input[type=text], input[type=url], input[type=number], input[type=tel], input[type=password], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--paper);
}
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; }
textarea { min-height: 70px; resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--red); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.preview-strip { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; background: var(--paper); border: 1px dashed var(--line); }
.preview-strip img { width: 56px; height: 56px; object-fit: contain; border-radius: 8px; background: #fff; }

.items { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.item .thumb { width: 54px; height: 54px; flex: none; border-radius: 10px; background: var(--paper); display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); font-family: var(--display); font-weight: 800; color: var(--muted); }
.item .thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.item .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item .name { font-weight: 700; overflow-wrap: anywhere; }
.item .meta { font-size: .85rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.item .meta a { font-weight: 700; }
.item.got .name { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--muted); }
.item.removed { opacity: .65; border-style: dashed; }
.star { flex: none; width: 44px; height: 44px; border: 0; background: none; font-size: 1.5rem; cursor: pointer; color: var(--line); line-height: 1; }
.star.on { color: var(--gold); text-shadow: 1px 1px 0 var(--ink); }
.golink {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; min-height: 36px; max-width: 100%;
  padding: 6px 12px; border: 2px solid var(--ink); border-radius: 10px; background: var(--surface); color: var(--ink);
  font-weight: 700; font-size: .85rem; text-decoration: none; box-shadow: 2px 2px 0 var(--shadow);
}
.golink:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--shadow); }
.golink svg { flex: none; }
.golink .site { font-weight: 400; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iconbtn { flex: none; width: 44px; height: 44px; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 1.2rem; border-radius: 10px; }
.empty { text-align: center; padding: 30px 16px; color: var(--muted); border: 2px dashed var(--line); border-radius: 16px; }

/* ---------- Christmas: parent ---------- */
.kids { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.kid { display: flex; flex-direction: column; gap: 12px; text-decoration: none; }
.kid .head { display: flex; align-items: center; gap: 10px; }
.bar { height: 10px; border-radius: 99px; background: var(--paper); border: 1px solid var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--pine); }
.bar.over i { background: var(--red); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { display: flex; flex-direction: column; }
.stats b { font-family: var(--display); font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.stats span { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.newbadge { margin-left: auto; font-size: .75rem; font-weight: 700; background: var(--gold); color: #15171a; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--ink); }

.summary { display: flex; flex-direction: column; gap: 12px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.chip { flex: none; border: 2px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; font-weight: 700; cursor: pointer; font-size: .9rem; }
.chip[aria-pressed=true] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.cat { display: flex; flex-direction: column; gap: 8px; }
.cat h3 { display: flex; justify-content: space-between; font-family: var(--body); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }

.status { flex: none; min-width: 82px; min-height: 36px; border-radius: 10px; border: 2px solid currentColor; font-weight: 700; font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; cursor: pointer; background: transparent; }
.status.wish { color: var(--red); background: var(--red-soft); }
.status.bought { color: var(--gold); background: var(--gold-soft); }
.status.wrapped { color: var(--pine); background: var(--pine-soft); }
@media (prefers-color-scheme: light) { .status.bought { color: #8a6500; } }
.pill { font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line); background: var(--paper); color: var(--muted); }
.pill.secret { border-color: var(--ink); color: var(--ink); }

/* ---------- Family ---------- */
.members { display: flex; flex-direction: column; gap: 10px; }
.member { display: flex; align-items: center; gap: 12px; padding: 12px; }
.member .body { flex: 1; min-width: 0; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.swatches button[aria-pressed=true] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--surface) inset; }

/* ---------- Sheet & toast ---------- */
dialog#sheet {
  border: 2px solid var(--ink); border-radius: 20px 20px 0 0; padding: 0; width: 100%; max-width: 640px; margin: auto auto 0;
  background: var(--surface); color: var(--ink); max-height: 92dvh; box-shadow: 0 -6px 0 var(--shadow);
}
@media (min-width: 700px) { dialog#sheet { border-radius: 20px; margin: auto; box-shadow: 6px 6px 0 var(--shadow); } }
dialog#sheet::backdrop { background: rgba(10, 12, 14, .45); }
.sheet-body { padding: 20px max(18px, env(safe-area-inset-left)) calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
#toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px; font-weight: 700; max-width: calc(100% - 32px);
}

@media (min-width: 760px) {
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .tile.hero { grid-column: 1 / 3; grid-row: span 2; }
}
@media (max-width: 380px) {
  .pad { grid-template-columns: repeat(3, 68px); }
  .pad button { height: 68px; }
  .grid2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
