/* Wishkit — playful, bright, easy on older eyes.
   Display: Bricolage Grotesque. Body: Atkinson Hyperlegible (designed for low-vision readers). */
:root {
  --page: #EEF1FF;
  --card: #FFFFFF;
  --ink: #1D1650;
  --ink-soft: #565080;
  --line: #D9DCF5;
  --ribbon: #FF3D5A;
  --ribbon-dark: #D81E3E;
  --tinsel: #FFC93C;
  --pine: #00A88F;
  --berry: #3D5AFE;
  --plum: #8A3FFC;
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;
  --shadow: 0 2px 0 var(--line), 0 6px 18px rgba(29, 22, 80, .07);
  --display: 'Bricolage Grotesque', 'Atkinson Hyperlegible', system-ui, sans-serif;
  --body: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --tabbar: 78px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 18px/1.5 var(--body); min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--berry); }
:focus-visible { outline: 3px solid var(--berry); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- layout ---------- */
#app { max-width: 640px; margin: 0 auto; padding: calc(16px + var(--safe-t)) 16px calc(var(--tabbar) + 32px + var(--safe-b)); }
.no-tabs #app { padding-bottom: 40px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 34px; font-weight: 800; }
h2 { font-size: 24px; font-weight: 800; margin: 28px 0 12px; }
h3 { font-size: 20px; font-weight: 700; }
p { margin: 0 0 12px; }
.muted { color: var(--ink-soft); }
.small { font-size: 15px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }

.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; min-height: 48px; }
.topbar h1 { flex: 1; min-width: 0; font-size: 28px; overflow-wrap: anywhere; }
.back { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--card); box-shadow: var(--shadow); font-size: 24px; cursor: pointer; flex: none; }

/* ---------- brand mark ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 22px; }
.brand-mark { width: 40px; height: 40px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 0 22px; border-radius: 999px; border: 0; cursor: pointer;
  font-weight: 700; font-size: 18px; text-decoration: none; transition: transform .08s;
  background: var(--ink); color: #fff;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--ribbon); box-shadow: 0 4px 0 var(--ribbon-dark); }
.btn.go { background: var(--pine); box-shadow: 0 4px 0 #007E6B; }
.btn.blue { background: var(--berry); box-shadow: 0 4px 0 #2338C9; }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn.quiet { background: transparent; color: var(--ink-soft); min-height: 44px; padding: 0 12px; }
.btn.danger { background: transparent; color: var(--ribbon-dark); box-shadow: inset 0 0 0 2px #FFC2CC; }
.btn.small { min-height: 44px; font-size: 16px; padding: 0 16px; }
.btn.block { display: flex; width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.link-btn { background: none; border: 0; padding: 8px 0; color: var(--berry); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.tap { cursor: pointer; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow); cursor: pointer; border: 0; width: 100%; text-align: left; }
.list-row + .list-row { margin-top: 10px; }
.list-row .chev { font-size: 26px; color: var(--ink-soft); }

/* ---------- avatars ---------- */
.avatar { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; flex: none; background: var(--c, var(--berry)); box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.avatar.photo { overflow: hidden; background: var(--c); }
.avatar.photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar.sm { width: 34px; height: 34px; font-size: 18px; }
.avatar.lg { width: 72px; height: 72px; font-size: 40px; }
.avatars { display: flex; }
.avatars .avatar { margin-left: -10px; border: 3px solid var(--card); }
.avatars .avatar:first-child { margin-left: 0; }

/* ---------- the gift tag (occasion card) — the signature element ---------- */
.tag {
  position: relative; display: block; width: 100%; text-align: left; border: 0; cursor: pointer;
  padding: 20px 22px 20px 64px; color: #fff; border-radius: 12px var(--r-lg) var(--r-lg) 12px;
  background: var(--tc, var(--ribbon));
  clip-path: polygon(30px 0, 100% 0, 100% 100%, 30px 100%, 0 calc(100% - 30px), 0 30px);
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.14);
}
.tag::before { /* punched hole */
  content: ''; position: absolute; left: 22px; top: 50%; width: 18px; height: 18px; margin-top: -9px;
  border-radius: 50%; background: var(--page); box-shadow: inset 0 2px 0 rgba(0,0,0,.18);
}
.tag::after { /* string */
  content: ''; position: absolute; left: -6px; top: 50%; width: 36px; height: 3px; margin-top: -1px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.9) 0 5px, transparent 5px 8px);
  transform: rotate(-18deg); transform-origin: right center; opacity: .8;
}
.tag + .tag { margin-top: 14px; }
.tag .t-name { font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1.1; padding-right: 70px; }
.tag .t-meta { padding-right: 70px; }
.tag .t-meta { font-size: 16px; opacity: .95; margin-top: 4px; }
.tag .t-count { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); text-align: center; font-family: var(--display); }
.tag .t-count b { display: block; font-size: 36px; line-height: 1; font-weight: 800; }
.tag .t-count span { font-size: 14px; }
.tag.past { --tc: #8E89B5; }
.tag.big { padding-top: 28px; padding-bottom: 28px; cursor: default; }
.tag.big .t-name { font-size: 32px; padding-right: 80px; }
.tag.past .t-name, .tag.past .t-meta { padding-right: 0; }

/* ---------- items ---------- */
.item { position: relative; display: flex; gap: 14px; background: var(--card); border-radius: var(--r-lg); padding: 14px; box-shadow: var(--shadow); overflow: hidden; }
.item + .item { margin-top: 12px; }
.item .thumb { width: 96px; height: 96px; border-radius: var(--r-md); flex: none; object-fit: contain; background: #F6F7FF; }
.item .thumb.ph { display: grid; place-items: center; font-size: 42px; background: var(--phc, #FFE7A8); }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 700; font-size: 19px; line-height: 1.25; overflow-wrap: anywhere; }
.item .meta { color: var(--ink-soft); font-size: 15px; margin-top: 2px; }
.item .notes { font-size: 15px; margin-top: 6px; background: #F6F7FF; border-radius: var(--r-sm); padding: 6px 10px; white-space: pre-wrap; }
.item .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.item.done { opacity: .62; }
.item.mine-claim { box-shadow: 0 0 0 3px var(--pine), var(--shadow); }

.sticker { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; margin: 0 6px 4px 0; transform: rotate(-2deg); }
.sticker.p1 { background: var(--ribbon); color: #fff; }
.sticker.p2 { background: var(--tinsel); color: var(--ink); }
.sticker.p3 { background: #E3E6FF; color: var(--ink); }
.sticker.any { background: #D2F5EE; color: #00614F; }
.sticker.chip { background: #EBDDFF; color: #4D1C9E; }

/* Ribbon wrapped across the corner when an item is taken */
.ribbon { position: absolute; top: 18px; right: -44px; width: 170px; transform: rotate(35deg); text-align: center;
  background: var(--ribbon); color: #fff; font-weight: 700; font-size: 13px; padding: 4px 0; box-shadow: 0 2px 0 var(--ribbon-dark); pointer-events: none; }
.ribbon.green { background: var(--pine); box-shadow: 0 2px 0 #007E6B; }
.ribbon.purple { background: var(--plum); box-shadow: 0 2px 0 #5F1FC4; }
.ribbon.grey { background: #8E89B5; box-shadow: none; }
.has-ribbon .body { padding-right: 46px; }

.claim-line { display: flex; align-items: center; gap: 8px; font-size: 15px; margin-top: 8px; flex-wrap: wrap; }

/* ---------- forms ---------- */
label.field { display: block; margin-bottom: 16px; }
label.field > span { display: block; font-weight: 700; margin-bottom: 6px; }
.input, textarea.input, select.input {
  width: 100%; min-height: 56px; padding: 12px 16px; border-radius: var(--r-md);
  border: 2px solid var(--line); background: #fff; font-size: 18px;
}
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { outline: none; border-color: var(--berry); box-shadow: 0 0 0 4px rgba(61, 90, 254, .15); }
.seg { display: flex; gap: 8px; }
.seg button { flex: 1; min-height: 56px; border-radius: var(--r-md); border: 2px solid var(--line); background: #fff; cursor: pointer; font-weight: 700; font-size: 16px; padding: 4px; }
.seg button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.toggle { display: flex; align-items: center; gap: 12px; min-height: 56px; cursor: pointer; }
.toggle input { width: 28px; height: 28px; accent-color: var(--pine); flex: none; }
.emoji-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.emoji-pick button { width: 52px; height: 52px; font-size: 28px; border-radius: 14px; border: 2px solid var(--line); background: #fff; cursor: pointer; }
.emoji-pick button[aria-pressed="true"] { border-color: var(--ink); background: #FFF3C9; }
.color-pick { display: flex; flex-wrap: wrap; gap: 10px; }
.color-pick button { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); cursor: pointer; }
.color-pick button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); }

.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 320px; margin: 16px auto; }
.pinpad button { min-height: 68px; border-radius: 18px; border: 0; background: var(--card); box-shadow: var(--shadow); font-size: 28px; font-weight: 700; cursor: pointer; font-family: var(--display); }
.pindots { display: flex; justify-content: center; gap: 16px; margin: 12px 0; }
.pindots i { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--ink); }
.pindots i.on { background: var(--ink); }

/* ---------- people grid (who are you?) ---------- */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.people-grid button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; background: var(--card); border: 0; border-radius: var(--r-lg); box-shadow: var(--shadow); cursor: pointer; font-weight: 700; font-size: 17px; }

/* ---------- bottom tabs ---------- */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card); border-top: 2px solid var(--line);
  display: flex; justify-content: center; padding-bottom: var(--safe-b); }
.tabs-inner { display: flex; width: 100%; max-width: 640px; }
.tabs button { flex: 1; height: var(--tabbar); border: 0; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 14px; font-weight: 700; color: var(--ink-soft); position: relative; }
.tabs button .ic { font-size: 26px; line-height: 1; filter: grayscale(1); opacity: .7; }
.tabs button[aria-current="page"] { color: var(--ink); }
.tabs button[aria-current="page"] .ic { filter: none; opacity: 1; }
.tabs button[aria-current="page"]::before { content: ''; position: absolute; top: -2px; left: 25%; right: 25%; height: 5px; border-radius: 0 0 6px 6px; background: var(--ribbon); }
.tabs .badge { position: absolute; top: 10px; left: calc(50% + 8px); background: var(--ribbon); color: #fff; font-size: 12px; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 5px; }

/* ---------- sheet / dialog ---------- */
.scrim { position: fixed; inset: 0; background: rgba(29, 22, 80, .45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--page); width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; border-radius: 26px 26px 0 0; padding: 22px 18px calc(24px + var(--safe-b)); animation: up .2s cubic-bezier(.2,.9,.3,1.2); }
.sheet-top { position: relative; height: 34px; margin: -8px 0 6px; }
.sheet .grab { width: 48px; height: 5px; border-radius: 3px; background: var(--line); position: absolute; left: 50%; top: 4px; margin-left: -24px; }
.sheet-x { position: absolute; right: -4px; top: -6px; min-height: 44px; padding: 0 12px; border: 0; background: none; color: var(--berry); font-weight: 700; font-size: 17px; cursor: pointer; }
.sheet h2 { margin-top: 0; }
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { border-radius: 26px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + 20px + var(--safe-b)); transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: #fff; padding: 14px 22px; border-radius: 999px; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.2); width: max-content; max-width: calc(100% - 32px); text-align: center; animation: up .2s; }
.toast.err { background: var(--ribbon-dark); }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 28px 16px; background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.empty .big { font-size: 52px; }
.banner { background: var(--tinsel); border-radius: var(--r-lg); padding: 16px; display: flex; gap: 14px; align-items: center; }
.banner.blue { background: #DDE3FF; }
.linkbox { display: flex; gap: 8px; align-items: stretch; }
.linkbox code { flex: 1; min-width: 0; background: #fff; border: 2px dashed var(--line); border-radius: var(--r-md); padding: 12px; font-size: 15px; overflow-wrap: anywhere; font-family: var(--body); }
.pill { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 15px; font-weight: 700; }
.pill.on { border-color: var(--pine); background: #D2F5EE; }
.divider { height: 2px; background: var(--line); margin: 20px 0; border: 0; }
.welcome-hero { text-align: center; padding: 40px 8px 20px; }
.welcome-hero h1 { font-size: 46px; margin: 16px 0 10px; }
.welcome-hero .brand-mark { width: 120px; height: 120px; margin: 0 auto; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--ribbon); animation: spin .8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.demo-flag { position: fixed; top: 0; right: 0; z-index: 70; background: var(--plum); color: #fff; font-size: 13px; font-weight: 700; padding: 4px 12px; border-radius: 0 0 0 12px; }
.demo-flag button { background: none; border: 0; color: #fff; text-decoration: underline; cursor: pointer; font-size: 13px; padding: 0 0 0 6px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
