:root {
  --bg: #F1F3F6;
  --surface: #FFFFFF;
  --ink: #1B2230;
  --muted: #5B6476;
  --line: #DCE1E9;
  --accent: #B4235A;
  --accent-ink: #FFFFFF;
  --accent-soft: #F7E2EB;
  --good: #2C7A4E;
  --good-soft: #E1F1E7;
  --warn-soft: #FFF3D6;
  --warn-ink: #6B4A00;
  --font-display: "Bricolage Grotesque", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151C; --surface: #1A2029; --ink: #E7EAF0; --muted: #9CA5B7; --line: #2B3341;
    --accent: #F07AA6; --accent-ink: #2A0A17; --accent-soft: #3A1F2C;
    --good: #6CCB92; --good-soft: #1B3326; --warn-soft: #3A2F12; --warn-ink: #F3D58A;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5; }
.wrap { max-width: 820px; margin: 0 auto; padding-block: max(24px, env(safe-area-inset-top, 0px)) 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; line-height: 1.15; }
h1 { font-size: 30px; }
h2 { font-size: 20px; }
button, input { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
.m0 { margin: 0; }
.grow { flex: 1; }

.top { margin-bottom: 22px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 24px; color: var(--ink); text-decoration: none; }
.brand svg { width: 28px; height: 28px; }
.g-box { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.g-lid { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.g-ribbon { stroke: var(--accent); stroke-width: 2.5; fill: none; }
.g-bow { fill: var(--accent); }

.notice { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between;
  background: var(--warn-soft); color: var(--warn-ink); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 18px; }
.notice button { background: none; border: 0; cursor: pointer; font-weight: 600; color: inherit; padding: 0; }

#app { display: flex; flex-direction: column; gap: 18px; }
.head { display: flex; flex-direction: column; gap: 6px; }
.head p { margin: 0; color: var(--muted); max-width: 62ch; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.head-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card.key { border-color: var(--accent); background: linear-gradient(var(--accent-soft), var(--accent-soft)) padding-box; }
.card.key p { margin: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.card-head > div { min-width: 0; }
.occasion { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.progress { font-size: 13px; font-weight: 600; color: var(--good); background: var(--good-soft); border-radius: 999px; padding: 3px 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.steps li { display: flex; gap: 10px; align-items: flex-start; }
.steps b { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.steps span { color: var(--muted); font-size: 14px; }

.linkbox { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.linkbox input { flex: 1 1 260px; min-width: 0; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 8px 10px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.linkbox-label { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }

.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.item { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; padding-top: 0; }
.item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item-name { font-weight: 600; overflow-wrap: anywhere; }
.item-name a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 3px; }
.item-name a:hover { color: var(--accent); }
.item-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); }
.item-meta .price { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 500; }
.item-note { font-size: 13.5px; color: var(--muted); overflow-wrap: anywhere; }
.item.bought .item-name, .item.bought .item-name a { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--muted); }
.item-actions { display: flex; gap: 4px; flex: none; }

.claim { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; margin-top: 1px;
  border: 2px solid var(--line); border-radius: 7px; background: var(--surface); cursor: pointer; padding: 0; }
.claim:hover:not(:disabled) { border-color: var(--good); }
.claim svg { width: 16px; height: 16px; opacity: 0; }
.claim svg path { fill: none; stroke: var(--surface); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.claim[aria-pressed="true"] { background: var(--good); border-color: var(--good); }
.claim[aria-pressed="true"] svg { opacity: 1; }
.claim:disabled { cursor: not-allowed; }
.claim:disabled[aria-pressed="true"] { opacity: .65; }
.claim-label { font-size: 13px; font-weight: 600; color: var(--good); }
.linkish { background: none; border: 0; padding: 0; color: var(--muted); font-weight: 500; text-decoration: underline; cursor: pointer; font-size: inherit; }

.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 12px; cursor: pointer; font-weight: 500; font-size: 14px; white-space: nowrap; text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); padding: 5px 8px; font-size: 13px; }
.btn.ghost:hover { color: var(--ink); background: var(--bg); }
.btn.danger { color: var(--accent); }
.btn:disabled { opacity: .5; cursor: progress; }

form.row { display: grid; grid-template-columns: 1.4fr 1.4fr .6fr 1.2fr auto; gap: 8px; align-items: end; }
form.row.two { grid-template-columns: 1.5fr 1fr auto; }
form.row.three { grid-template-columns: 1fr 1fr 1fr; }
form.row.three > .btn { grid-column: 1 / -1; justify-self: start; }
form.row.one { grid-template-columns: minmax(0, 1fr) auto; }
form.row.edit { grid-template-columns: 1fr 1fr; }
form.row.edit .acts { grid-column: 1 / -1; display: flex; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field span { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.field input { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.field input:focus { border-color: var(--accent); outline: none; background: var(--surface); }
.add-zone { border-top: 1px dashed var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.edit-zone { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.err { color: var(--accent); font-size: 13px; margin: 0; }
.err:empty { display: none; }
.empty { color: var(--muted); margin: 0; }
.foot { color: var(--muted); font-size: 13.5px; }

@media (max-width: 760px) {
  form.row { grid-template-columns: 1fr 1fr; }
  form.row > .btn { grid-column: 1 / -1; justify-self: start; }
  form.row.two, form.row.three { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  h1 { font-size: 25px; }
}
@media (max-width: 440px) {
  form.row, form.row.edit { grid-template-columns: 1fr; }
  .item-actions { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
