/* Workspace styles. Glass for the chrome, paper for the things you can hold. */
#app {
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --script: 'Snell Roundhand', 'Segoe Script', 'Dancing Script', cursive;
  --night: #081712;
  --cream: #fdf6e3;
  --snow: #eef5f0;
  --muted: #a8bdb1;
  --gold: #e6c27c;
  --berry: #c8373d;
  --berry-deep: #8c1c25;
  --ink: #1d3a2e;
  --ink-soft: #5f7468;
  --paper: #fffaf0;
  --glass: rgba(255, 255, 255, .07);
  --line: rgba(255, 255, 255, .14);
  display: flex;
  min-height: 100dvh;
  color: var(--snow);
  background:
    radial-gradient(90% 55% at 50% -10%, rgba(66, 138, 112, .5), transparent 70%),
    radial-gradient(60% 45% at 0% 100%, rgba(200, 55, 61, .2), transparent 70%),
    radial-gradient(50% 40% at 100% 85%, rgba(230, 194, 124, .12), transparent 70%),
    linear-gradient(180deg, #0f2f26 0%, var(--night) 100%);
  background-attachment: fixed;
}
#app button { cursor: pointer; }
#app button:disabled { opacity: .6; cursor: wait; }
#app :focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
#app .main:focus { outline: none; }

.snow {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Shared pieces */
.eyebrow, .page-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.4px;
  color: var(--gold);
}
.eyebrow { color: #a8782f; margin: 0; }
.error { color: #ffb0a6; font-size: 13px; min-height: 13px; }
dialog .error { color: #b3302f; }
.muted { font-weight: 400; color: #8b978c; }

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 13px 22px;
  color: #fff;
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
  background: linear-gradient(180deg, #d9484d, var(--berry) 55%, #a9272f);
  box-shadow: 0 8px 20px rgba(140, 28, 37, .45), inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 0 0 1px rgba(255, 220, 170, .25);
  transition: transform .15s, box-shadow .15s;
}
.primary:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(140, 28, 37, .55), inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 0 0 1px rgba(255, 220, 170, .25); }
.primary:active { transform: translateY(1px); }
.secondary {
  border: 1px solid #dccfb2;
  background: #fffdf7;
  color: var(--ink);
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 14px;
}
.secondary:hover { background: #f8f0dc; }

.seal {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fff3d9;
  font-size: 22px;
  background: radial-gradient(circle at 35% 30%, #e2565b, var(--berry) 55%, var(--berry-deep));
  box-shadow: 0 0 0 3px var(--berry-deep), 0 0 0 4px rgba(230, 194, 124, .65), 0 6px 14px rgba(0, 0, 0, .4);
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  z-index: 2;
  flex: none;
  display: flex;
  flex-direction: column;
  width: 256px;
  height: 100dvh;
  padding: 28px 16px 22px;
  background: rgba(5, 18, 14, .55);
  border-right: 1px solid var(--line);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.brand { display: flex; gap: 14px; align-items: center; padding: 0 10px 44px; }
.brand small { display: block; letter-spacing: 2.4px; font-size: 10px; color: var(--gold); }
.brand strong { font: 30px/1.05 var(--serif); color: var(--cream); }
.side-label { font-size: 10px; letter-spacing: 2.2px; color: var(--muted); padding: 0 14px 12px; }
.nav {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 4px;
  padding: 12px 13px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: #d5e3da;
  font-size: 14px;
  text-align: left;
  transition: background .15s, color .15s;
}
.nav-icon { width: 22px; text-align: center; font-size: 17px; }
.nav:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(230, 194, 124, .22), rgba(255, 255, 255, .05));
  box-shadow: inset 3px 0 0 var(--gold);
}
.soon {
  margin-left: auto;
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--gold);
  border: 1px solid rgba(230, 194, 124, .4);
}
.sidebar-bottom { margin-top: auto; }
.motto { font: 15px var(--script); white-space: nowrap; text-align: center; color: var(--gold); margin-bottom: 18px; }
.lock {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--snow);
  font-size: 14px;
}
.lock:hover { background: rgba(255, 255, 255, .12); }

/* Top bar with a string of lights */
.main { position: relative; z-index: 1; flex: 1; min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 68px;
  padding: 0 42px;
  background: rgba(8, 26, 20, .6);
  border-bottom: 1px solid rgba(230, 194, 124, .35);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.top-home {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--cream);
  text-align: left;
}
.top-home .seal { display: none; width: 34px; height: 34px; font-size: 17px; }
.top-name { font-size: 11px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; white-space: nowrap; }
.top-season {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  white-space: nowrap;
  color: var(--gold);
  border: 1px solid rgba(230, 194, 124, .4);
}
.top-lock {
  flex: none;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--snow);
  font-size: 13px;
}
.top-lock:hover { background: rgba(255, 255, 255, .12); }
.lights { position: absolute; left: 0; right: 0; top: 100%; height: 18px; pointer-events: none; overflow: hidden; }
.lights::before, .lights::after {
  content: '';
  position: absolute;
  inset: 0;
  background-repeat: repeat-x;
  background-size: 112px 18px;
  filter: drop-shadow(0 0 5px rgba(255, 214, 150, .9));
  animation: twinkle 2.6s ease-in-out infinite alternate;
}
.lights::before {
  background-image:
    radial-gradient(circle at 14px 6px, #ff7a70 3.5px, transparent 4.5px),
    radial-gradient(circle at 70px 6px, #ffd670 3.5px, transparent 4.5px);
}
.lights::after {
  background-image:
    radial-gradient(circle at 42px 8px, #7fe0b6 3.5px, transparent 4.5px),
    radial-gradient(circle at 98px 8px, #8fd0ff 3.5px, transparent 4.5px);
  animation-direction: alternate-reverse;
}
@keyframes twinkle {
  from { opacity: .35; }
  to { opacity: 1; }
}

/* Page */
.content { max-width: 1160px; margin: auto; padding: 44px 42px 90px; }
#view { animation: arrive .45s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes arrive {
  from { opacity: 0; transform: translateY(12px); }
}
.heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.heading h1 {
  font: normal clamp(32px, 5vw, 46px)/1.1 var(--serif);
  letter-spacing: -1px;
  margin: 10px 0;
  color: var(--cream);
}
.heading p { color: var(--muted); font-size: 15px; margin: 0; }

.hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 34px;
  margin: 30px 0 24px;
  padding: 30px 36px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(230, 194, 124, .3);
  background:
    radial-gradient(60% 120% at 100% 0%, rgba(230, 194, 124, .2), transparent 70%),
    linear-gradient(135deg, rgba(200, 55, 61, .34), rgba(255, 255, 255, .05) 60%);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .16);
}
.hero-copy small { letter-spacing: 2.4px; color: var(--gold); font-size: 11px; font-weight: 800; }
.hero h2 { font: normal clamp(24px, 3.6vw, 34px)/1.15 var(--serif); margin: 10px 0 8px; color: var(--cream); }
.hero p { color: #d6e2da; font-size: 15px; margin: 0; }
.bauble {
  position: relative;
  flex: none;
  display: grid;
  place-content: center;
  width: 128px;
  height: 128px;
  margin-top: 14px;
  border-radius: 50%;
  text-align: center;
  color: #fff7e6;
  background: radial-gradient(circle at 32% 28%, #f0777a, var(--berry) 48%, #7d1620 100%);
  box-shadow: 0 16px 30px rgba(0, 0, 0, .4), inset -8px -10px 22px rgba(60, 5, 12, .5), inset 0 0 0 1px rgba(255, 255, 255, .12);
  transform-origin: 50% -22px;
  animation: sway 5s ease-in-out infinite alternate;
}
.bauble::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -13px;
  width: 26px;
  height: 16px;
  margin-left: -13px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(90deg, #a8843f, #f3dc9f 45%, #a8843f);
}
.bauble::after {
  content: '';
  position: absolute;
  left: 50%;
  top: -26px;
  width: 12px;
  height: 12px;
  margin-left: -8px;
  border: 2px solid #d8b86f;
  border-radius: 50%;
}
.bauble-number { font: 52px/1 var(--serif); text-shadow: 0 2px 6px rgba(60, 5, 12, .6); }
.bauble-label { font-size: 11px; font-weight: 800; letter-spacing: 2.4px; text-transform: uppercase; opacity: .9; }
@keyframes sway {
  from { transform: rotate(-3.5deg); }
  to { transform: rotate(3.5deg); }
}

/* Summary: one panel, three figures, one progress bar. */
.summary {
  margin: 24px 0;
  padding: 22px 26px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--glass);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
}
.figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 18px; }
.figure { padding: 0 20px; border-left: 1px solid var(--line); }
.figure:first-child { padding-left: 0; border-left: 0; }
.figure strong {
  display: block;
  font: normal 34px/1.1 var(--serif);
  color: var(--gold);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.figure strong small { font-size: .55em; color: var(--muted); }
.figure span {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--muted);
}
.summary-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 13px; color: var(--muted); }

.section-title { display: flex; align-items: center; gap: 16px; margin: 34px 0 16px; }
.section-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(230, 194, 124, .45), transparent); }
.section-title h2 { font: normal 26px var(--serif); margin: 0; color: var(--cream); }

/* Children */
.kids { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.kid {
  --accent: #7fd1b0;
  position: relative;
  padding: 24px;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid var(--line);
  color: inherit;
  text-align: left;
  background: linear-gradient(150deg, rgba(255, 255, 255, .11), rgba(255, 255, 255, .04));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.kid-1 { --accent: #f4a3b4; }
.kid::after {
  content: '';
  position: absolute;
  right: -46px;
  top: 18px;
  width: 150px;
  height: 18px;
  transform: rotate(40deg);
  /* Candy-cane sash with thin gold edges, matching the progress bar stripes. */
  background:
    linear-gradient(var(--gold), var(--gold)) top / 100% 2px no-repeat,
    linear-gradient(var(--gold), var(--gold)) bottom / 100% 2px no-repeat,
    repeating-linear-gradient(-45deg, var(--berry) 0 7px, #fffaf0 7px 14px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.kid:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 18px 36px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .14); }
.kid-top { display: flex; align-items: center; gap: 14px; }
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 58px;
  height: 58px;
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: 30px;
  background: rgba(255, 255, 255, .1);
  box-shadow: 0 0 0 2px var(--accent);
}
.avatar img, .nav-icon img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.nav-icon img { width: 24px; height: 24px; margin: -3px auto; box-shadow: 0 0 0 1.5px var(--gold); }
.profile { display: flex; align-items: center; gap: 18px; min-width: 0; }
.avatar-large {
  --accent: var(--gold);
  position: relative;
  flex: none;
  width: 92px;
  height: 92px;
  padding: 0;
  border: 0;
  font-size: 46px;
  color: inherit;
  transition: transform .15s;
}
.avatar-large:hover { transform: scale(1.04); }
.avatar-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 15px;
  background: var(--cream);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .4);
}
.profile-actions { margin: 0; color: var(--muted); font-size: 14px; }
.link { padding: 4px 0; border: 0; background: none; color: var(--gold); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.kid h3 { font: normal 27px var(--serif); margin: 0; color: var(--cream); }
.kid p { font-size: 13px; color: var(--muted); margin: 3px 0 0; }
.kid strong { display: block; font: normal 32px var(--serif); color: var(--gold); margin: 20px 0 10px; }
.kid-foot { display: flex; justify-content: space-between; margin-top: 12px; color: var(--muted); font-size: 13px; }
.kid-foot span:last-child { color: var(--accent); }
.progress {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 10px;
  border: 0;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255, 255, 255, .12);
}
.progress::-webkit-progress-bar { background: rgba(255, 255, 255, .12); }
.progress::-webkit-progress-value { background: repeating-linear-gradient(-45deg, #fff 0 6px, #dc4a50 6px 12px); border-radius: 20px; }
.progress::-moz-progress-bar { background: repeating-linear-gradient(-45deg, #fff 0 6px, #dc4a50 6px 12px); border-radius: 20px; }

/* Gifts are paper cards; wrapped ones become presents with a ribbon and bow. */
.gift-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.gift-row { position: relative; border-radius: 16px; transition: opacity .28s, transform .28s; }
.gift-row.removing { opacity: 0; transform: translateX(-30%) scale(.96); }
.gift-swipe {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 22px;
  border-radius: 16px;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .5px;
  background: linear-gradient(90deg, #7a1820, var(--berry));
  opacity: 0;
  transition: opacity .15s;
}
.gift-swipe span { transition: transform .15s; }
.gift-row.swiping .gift-swipe { opacity: 1; }
.gift-row.armed .gift-swipe span { transform: scale(1.15); }
.gift {
  --cream-ink: #fdf3dc;
  --photo: 116px;
  --ribbon-x: var(--photo);
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 22px;
  /* A fixed height keeps every card the same size; photos are centred and cropped to fit. */
  height: 108px;
  padding: 0 16px 0 0;
  border-radius: 16px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--paper), #f5ead2);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .28), inset 0 0 0 1px rgba(255, 255, 255, .7);
  cursor: pointer;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .2s;
}
.gift:hover { box-shadow: 0 12px 28px rgba(0, 0, 0, .34), inset 0 0 0 1px rgba(255, 255, 255, .7); }
.gift > :not(.gift-paper, .gift-ribbon, .gift-bow, .gift-tape, .gift-glass) { position: relative; z-index: 2; }
.gift-image {
  flex: none;
  display: grid;
  place-items: center;
  align-self: stretch;
  width: var(--photo);
  height: 100%;
  min-height: 0;
  border-radius: 16px 0 0 16px;
  object-fit: cover;
  object-position: center;
  font-size: 44px;
  background: linear-gradient(160deg, #f3e7cc, #e6d5b0);
  box-shadow: inset -1px 0 0 rgba(60, 40, 10, .12);
  -webkit-user-drag: none;
}
.gift-info { flex: 1; min-width: 0; max-height: 100%; padding: 12px 0; overflow: hidden; }
.gift-info strong { display: block; font: 700 18px var(--serif); color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gift-info small { display: block; color: var(--ink-soft); font-size: 12px; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gift-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; padding: 12px 0; }
.gift-cost { font-weight: 800; color: inherit; font-size: 15px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tag {
  padding: 3px 7px;
  border: 1.5px solid currentColor;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  white-space: nowrap;
  color: #9a6b1f;
  transform: rotate(-4deg);
}
.tag.Purchased { color: #2f6690; }
.tag.Wrapped { color: #b0282f; }
/* Each state has its own look now, so the status stamps stay hidden (screen readers get it from the card label). */
.gift .tag { display: none; }
.buy-button {
  padding: 5px 12px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  color: var(--ink);
  background: rgba(255, 255, 255, .55);
  transition: transform .15s, opacity .2s, background .15s;
}
.buy-button:hover { transform: translateY(-1px) scale(1.04); background: #fff; }
.buy-button:active { transform: scale(.96); }
.wrap-button {
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  color: #fff;
  background: linear-gradient(180deg, #d9484d, #a9272f);
  box-shadow: 0 3px 8px rgba(140, 28, 37, .35), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform .15s, opacity .2s;
}
.wrap-button:hover { transform: translateY(-1px) scale(1.04); }
.wrap-button:active { transform: scale(.96); }

/* Planned: just an idea — a flat paper cut-out with a dashed line and a faded photo. */
.gift::before, .gift::after { content: ''; position: absolute; pointer-events: none; border-radius: inherit; }
.gift::after { z-index: 3; inset: 6px; border: 1.5px dashed rgba(70, 50, 20, .32); border-radius: 11px; opacity: 0; }
.gift:is(.planned, .planning) { background: linear-gradient(180deg, #fffdf7, #f6efdf); box-shadow: 0 3px 8px rgba(0, 0, 0, .2); }
.gift.planned:hover { box-shadow: 0 6px 14px rgba(0, 0, 0, .26); }
.gift.planned::after { opacity: 1; }
.gift:is(.planned, .planning) .gift-image { filter: saturate(.5) opacity(.8); transition: filter .5s .3s; }

/* Idea: not on the list yet — a frosted pane over the night, a gold dashed
   outline, a ghosted photo and a sparkle in the corner. */
.gift-glass {
  position: absolute;
  z-index: 1;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(120% 90% at 0 0, rgba(255, 255, 255, .14), transparent 60%),
    linear-gradient(160deg, #35594a, #1f3e32);
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .28), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.gift-spark { position: absolute; top: 8px; left: 8px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  color: var(--gold); background: rgba(12, 30, 23, .55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .25); }
.gift-spark .glyph { width: 16px; height: 16px; }
.gift:is(.thought, .planning) .gift-glass { opacity: 1; }
.gift.thought:not(.planning) { --ink-soft: rgba(238, 245, 240, .62); color: var(--snow); background: transparent; box-shadow: 0 6px 18px rgba(0, 0, 0, .28); }
.gift.thought:hover { box-shadow: 0 10px 24px rgba(0, 0, 0, .34); }
.gift.thought:not(.planning)::after { opacity: 1; border-color: rgba(230, 194, 124, .55); }
.gift.thought:not(.planning) .gift-image { filter: grayscale(.7) opacity(.55); }
.gift.thought:not(.planning) div.gift-image { background: rgba(255, 255, 255, .05); box-shadow: inset -.5px 0 0 rgba(255, 255, 255, .16); }
.gift.thought:not(.planning) .gift-spark { animation: idea-twinkle 2.6s ease-in-out infinite alternate; }
@keyframes idea-twinkle { from { transform: scale(.92) rotate(-6deg); } to { transform: scale(1.06) rotate(8deg); } }
.plan-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px 5px 9px;
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  color: var(--ink);
  background: var(--gold);
  box-shadow: 0 3px 10px rgba(230, 194, 124, .3), inset 0 1px 0 rgba(255, 255, 255, .45);
  transition: transform .2s cubic-bezier(.32, 1.5, .55, 1), opacity .2s;
}
.plan-button .glyph { width: 14px; height: 14px; stroke-width: 2.6; }
.plan-button:hover { transform: translateY(-1px) scale(1.04); }
.plan-button:active { transform: scale(.94); }

/* Planning it: the glass parts from the button outward to show the paper,
   the sparkle flies off, the dashed line settles in ink and the card lands. */
@property --plan-r { syntax: '<length-percentage>'; inherits: false; initial-value: 0%; }
.gift.planning { animation: plan-ink .3s .3s both, plan-land .45s .45s ease-out; }
.gift.planning .gift-glass {
  -webkit-mask-image: radial-gradient(circle at calc(100% - 52px) 70%, transparent var(--plan-r), #000 calc(var(--plan-r) + 1px));
  mask-image: radial-gradient(circle at calc(100% - 52px) 70%, transparent var(--plan-r), #000 calc(var(--plan-r) + 1px));
  animation: plan-part .6s cubic-bezier(.55, 0, .3, 1) forwards;
}
.gift.planning .gift-spark { animation: plan-spark .6s cubic-bezier(.3, 0, .4, 1) forwards; }
.gift.planning::after { border-color: rgba(70, 50, 20, .32); animation: fade-in .3s .45s both; }
.gift.planning .plan-button { opacity: 0; transform: scale(.6); }
@keyframes plan-part { to { --plan-r: 140%; } }
@keyframes plan-spark {
  30% { transform: scale(1.5) rotate(40deg); }
  100% { opacity: 0; transform: translate(10px, -26px) scale(.4) rotate(160deg); }
}
@keyframes plan-ink { from { color: var(--snow); --ink-soft: rgba(238, 245, 240, .62); } to { color: var(--ink); } }
@keyframes plan-land { 0%, 100% { transform: none; } 40% { transform: scale(.975); } 70% { transform: scale(1.008); } }

/* Bought: in the closet — a kraft-paper box with a strip of tape over the photo corner. */
.gift::before {
  z-index: 0;
  inset: 0;
  opacity: 0;
  background:
    repeating-linear-gradient(97deg, rgba(120, 80, 30, .07) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(8deg, rgba(255, 240, 210, .08) 0 2px, transparent 2px 11px),
    linear-gradient(170deg, #dcbd8c, #c59d66);
  box-shadow: inset 0 0 0 1px rgba(255, 235, 200, .35), inset 0 -10px 20px rgba(90, 55, 15, .15);
}
.gift-tape {
  position: absolute;
  z-index: 3;
  top: 9px;
  left: -7px;
  width: 50px;
  height: 15px;
  pointer-events: none;
  opacity: 0;
  background: repeating-linear-gradient(90deg, rgba(250, 240, 215, .72) 0 3px, rgba(238, 224, 192, .64) 3px 6px);
  box-shadow: 0 1px 2px rgba(60, 35, 10, .25);
  transform: rotate(-38deg);
}
.gift:is(.bought, .buying) { --ink-soft: #6e5232; color: #3b2814; }
.gift.bought, .gift.buying { box-shadow: 0 8px 22px rgba(0, 0, 0, .3), inset 0 0 0 1px rgba(255, 235, 200, .3); }
.gift:is(.bought, .buying)::before, .gift:is(.bought, .buying) .gift-tape { opacity: 1; }
.gift:is(.bought, .buying) div.gift-image { background: linear-gradient(160deg, #e6cfa4, #cdab76); }
.gift.bought .buy-button { display: none; }

/* Getting it: the dashed line lifts, kraft fills in, the card thunks down and the tape slaps on. */
.gift.buying { animation: buy-thunk .4s .3s ease-out; }
.gift.buying::before { animation: fade-in .35s both; }
.gift.buying::after { animation: fade-out .25s both; }
.gift.buying .gift-image { filter: none; }
.gift.buying .gift-tape { animation: buy-tape .3s .35s cubic-bezier(.3, 1.5, .5, 1) both; }
.gift.buying .buy-button { opacity: 0; }
.gift.wrapping .gift-tape { animation: fade-out .15s both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes buy-thunk { 0% { transform: scale(1); } 40% { transform: scale(.97); } 100% { transform: scale(1); } }
@keyframes buy-tape { from { opacity: 0; transform: rotate(-38deg) scale(1.7); } to { opacity: 1; transform: rotate(-38deg); } }

/* Wrapping paper, ribbon and bow stay hidden until the gift is wrapped. */
.gift-paper, .gift-ribbon, .gift-bow { position: absolute; pointer-events: none; opacity: 0; }
.gift-paper {
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 25% 25%, rgba(255, 233, 180, .5) 0 2px, transparent 2.5px) 0 0 / 22px 22px,
    radial-gradient(circle at 75% 75%, rgba(255, 233, 180, .35) 0 1.5px, transparent 2px) 0 0 / 22px 22px,
    repeating-linear-gradient(135deg, rgba(255, 255, 255, .05) 0 10px, transparent 10px 20px),
    linear-gradient(160deg, #c8373d, #8c1c25);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18), inset 0 -12px 24px rgba(0, 0, 0, .18);
}
.gift-ribbon {
  z-index: 3;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(90deg, transparent calc(var(--ribbon-x) - 7px), #f2cf7f calc(var(--ribbon-x) - 7px), #e6b95c var(--ribbon-x), #f2cf7f calc(var(--ribbon-x) + 7px), transparent calc(var(--ribbon-x) + 7px));
}
.gift-bow {
  z-index: 4;
  top: -16px;
  left: calc(var(--ribbon-x) - 26px);
  width: 52px;
  height: 33px;
  filter: drop-shadow(0 3px 3px rgba(60, 20, 10, .35));
}
.gift:is(.wrapped, .wrapping) :is(.gift-paper, .gift-ribbon, .gift-bow) { opacity: 1; }
.gift:is(.wrapped, .wrapping) .gift-info small { color: color-mix(in srgb, currentColor 78%, transparent); }
.gift:is(.wrapped, .wrapping) .gift-info .gift-desc { color: color-mix(in srgb, currentColor 88%, transparent); }
.gift:is(.wrapped, .wrapping) .tag { color: #f2cf7f; }
.gift.wrapped { color: var(--cream-ink); box-shadow: 0 10px 26px rgba(0, 0, 0, .38); }

/* The wrap: paper sweeps across, the ribbon drops, the bow pops, the card wiggles. */
.gift.wrapping { animation: wrap-ink .2s .4s forwards, wrap-bounce .5s 1.05s ease-out; }
.gift.wrapping .gift-paper { animation: wrap-paper .6s cubic-bezier(.65, 0, .35, 1) both; }
.gift.wrapping .gift-ribbon { animation: wrap-ribbon .45s .6s cubic-bezier(.2, .8, .2, 1) both; }
.gift.wrapping .gift-bow { animation: wrap-bow .55s 1s cubic-bezier(.3, 1.6, .5, 1) both; }
.gift.wrapping .wrap-button { opacity: 0; }
.gift.wrapping .tag { animation: wrap-stamp .35s 1.1s both; }
@keyframes wrap-ink { to { color: var(--cream-ink); } }
@keyframes wrap-paper {
  0% { clip-path: polygon(0 0, 0 0, 0 100%, 0 100%); }
  60% { clip-path: polygon(0 0, 70% 0, 55% 100%, 0 100%); }
  100% { clip-path: polygon(0 0, 115% 0, 100% 100%, 0 100%); }
}
@keyframes wrap-ribbon { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes wrap-bow { from { transform: scale(0) rotate(-40deg); } to { transform: none; } }
@keyframes wrap-stamp { from { opacity: 0; transform: rotate(-4deg) scale(1.8); } to { opacity: 1; transform: rotate(-4deg); } }
@keyframes wrap-bounce {
  0%, 100% { transform: none; }
  30% { transform: scale(1.025) rotate(-.6deg); }
  60% { transform: scale(.995) rotate(.4deg); }
}
.delete-name { margin: -10px 0 20px; color: var(--ink-soft); font-size: 15px; }

.empty {
  padding: 48px 20px;
  border: 1px dashed rgba(230, 194, 124, .45);
  border-radius: 20px;
  text-align: center;
  color: var(--muted);
  background: var(--glass);
}
.empty .emoji { font-size: 46px; }
.empty h3 { color: var(--cream); font: normal 24px var(--serif); margin: 10px 0 6px; }
.empty p { margin: 0 0 20px; font-size: 14px; }
.assistant-card {
  margin: 26px 0 0;
  padding: 34px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}
.assistant-card .emoji { display: block; font-size: 44px; margin-bottom: 8px; }

/* Dialogs: a soft paper card; on phones the gift editor is a bottom sheet. */
dialog {
  width: min(560px, calc(100% - 24px));
  max-height: 90dvh;
  padding: 0;
  border: 0;
  border-radius: 28px;
  overflow: hidden;
  color: #1d3a2e;
  background: #fffaf0;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .5);
}
dialog[open] { animation: unwrap .3s cubic-bezier(.2, .8, .2, 1); }
@keyframes unwrap {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
}
dialog::backdrop {
  background: rgba(4, 16, 12, .5);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  backdrop-filter: blur(12px) saturate(1.3);
}
.sheet-grabber { display: none; }
#gift-dialog {
  --editor-surface: #f5f6f4;
  --editor-focus: #edf4ef;
  --editor-focus-ring: #61866f;
  background: var(--editor-surface);
}
#gift-form { padding: 0 20px; overflow: auto; overscroll-behavior: contain; max-height: 90dvh; }
.delete-form { padding: 24px 26px 26px; }
.delete-form h2 { font: normal 28px var(--serif); margin: 4px 0 20px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h2 { font: normal 24px var(--serif); margin: 0; }
.modal-head h2:focus { outline: none; }
#gift-form .modal-head {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: 0 -20px 6px;
  padding: 18px 20px 10px;
  background: color-mix(in srgb, var(--editor-surface) 94%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
}
#gift-form .modal-head h2 { font-size: 26px; letter-spacing: -.01em; }
#modal-title:focus-visible { outline: none; }
#crop-dialog .modal-head { align-items: start; margin-bottom: 0; }
#crop-dialog .modal-head h2 { font-size: 28px; margin: 4px 0 20px; }
.icon-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(29, 58, 46, .08);
  font-size: 15px;
  color: var(--ink-soft);
}
.icon-button .glyph { width: 17px; height: 17px; stroke-width: 2.4; }
.icon-button:focus:not(:focus-visible) { outline: none; }
.icon-button:focus-visible { outline: 2px solid var(--berry); outline-offset: 2px; }
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 18px; }
#gift-form .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  margin: 16px -20px 0;
  padding: 10px 20px 16px;
  background: color-mix(in srgb, var(--editor-surface) 94%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: 0 -.5px 0 rgba(29, 58, 46, .14);
}
#gift-form .modal-actions .primary { flex: 1; min-height: 52px; font-size: 17px; font-weight: 700; letter-spacing: -.01em; box-shadow: 0 6px 16px rgba(140, 28, 37, .3), inset 0 1px 0 rgba(255, 255, 255, .3); }
.cancel-link { color: var(--ink-soft); font-weight: 650; text-decoration: none; padding: 10px 6px; }
.cancel-link:hover { color: var(--ink); }
.cancel-link[hidden] { display: none; }

/* Line icons. */
.glyph {
  display: block;
  flex: none;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.glyph .fill { fill: currentColor; stroke: none; }

/* Photo stage. Empty: a note from the elf above big buttons. With a photo: the
   photo, a glass toolbar over it, and the elf's note underneath. */
.stage {
  display: grid;
  grid-template-areas: "elf" "actions" "error";
  gap: 14px;
  padding: 16px;
  border-radius: 22px;
  background: #f5eee0;
  transition: box-shadow .15s;
}
.stage.has-photo, .stage.camera-on {
  grid-template-areas: "media" "elf" "error";
  gap: 12px;
  padding: 0;
  background: none;
}
.stage.dragging { box-shadow: inset 0 0 0 2px var(--berry), 0 0 0 4px rgba(200, 55, 61, .15); }
.stage-media { grid-area: media; position: relative; display: none; border-radius: 22px; overflow: hidden; background: #e9dfc9; }
.stage.has-photo .stage-media, .stage.camera-on .stage-media { display: block; }
.stage-media img, .stage-media video { display: block; width: 100%; height: min(64vw, 280px); object-fit: cover; }
.stage-media video { height: 320px; object-fit: contain; background: #16221d; }
.stage-actions { grid-area: actions; display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 8px; }
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 74px;
  padding: 10px 4px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(29, 58, 46, .06), 0 0 0 .5px rgba(29, 58, 46, .08);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 650;
  transition: transform .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.tile-icon { display: grid; place-items: center; color: var(--ink); }
.tile-icon .glyph { width: 26px; height: 26px; }
.tile:active:not(:disabled) { transform: scale(.95); }
.tile:disabled { opacity: .45; }
.tile[hidden] { display: none; }
/* With a photo or the camera, the same buttons become one glass toolbar over the image. */
.stage.has-photo .stage-actions, .stage.camera-on .stage-actions {
  grid-area: media;
  align-self: start;
  justify-self: end;
  z-index: 1;
  display: flex;
  gap: 2px;
  margin: 10px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(16, 24, 20, .38);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  backdrop-filter: blur(20px) saturate(1.8);
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .28), 0 4px 14px rgba(0, 0, 0, .18);
}
.stage.has-photo .tile, .stage.camera-on .tile {
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  background: none;
  box-shadow: none;
}
.stage.has-photo .tile:active, .stage.camera-on .tile:active { background: rgba(255, 255, 255, .2); transform: none; }
.stage.has-photo .tile-label, .stage.camera-on .tile-label { display: none; }
.stage.has-photo .tile-icon, .stage.camera-on .tile-icon { color: #fff; }
.stage.has-photo .tile-icon .glyph, .stage.camera-on .tile-icon .glyph { width: 19px; height: 19px; }
.stage.camera-on .tile:not(#stop-camera) { display: none; }
.shutter {
  position: absolute;
  left: 50%;
  bottom: 14px;
  width: 64px;
  height: 64px;
  transform: translateX(-50%);
  border: 4px solid #fff;
  border-radius: 50%;
  background: rgba(255, 255, 255, .85);
  box-shadow: inset 0 0 0 3px rgba(16, 24, 20, .6), 0 6px 18px rgba(0, 0, 0, .35);
}
.shutter[hidden] { display: none; }
.shutter:disabled { opacity: .5; }
.ask {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 15px 0 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  backdrop-filter: blur(20px) saturate(1.8);
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .6), 0 6px 18px rgba(0, 0, 0, .2);
}
.ask .glyph { width: 18px; height: 18px; color: var(--berry); }
.ask[hidden] { display: none; }
.ask:disabled { opacity: .7; }
.elf { grid-area: elf; display: flex; align-items: center; gap: 10px; min-width: 0; }
.stage.has-photo .elf, .stage.camera-on .elf { padding: 0 4px; }
.elf-face {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #e6c27c, #c8373d);
}
.elf-face .glyph { width: 16px; height: 16px; }
.elf p { flex: 1; min-width: 0; margin: 0; color: var(--ink-soft); font-size: 14px; font-weight: 600; line-height: 1.35; }
.elf p:empty { display: none; }
.elf:has(p:empty) { display: none; }
.elf p.error { color: #b3302f; min-height: 0; }
.elf.busy .elf-face { animation: elf-think 1s ease-in-out infinite alternate; }
.stage .error { grid-area: error; margin: 0; min-height: 0; font-size: 13px; }
.stage.has-photo .error, .stage.camera-on .error { padding: 0 4px; }
.stage .error[hidden] { display: none; }
.link-row input { flex: 1; min-width: 0; }
.link-open {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(29, 58, 46, .07);
  color: var(--ink);
}
.link-open .glyph { width: 16px; height: 16px; stroke-width: 2.2; }
.link-open[hidden] { display: none; }

/* Name and description read as the card's title. */
.title-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin: 16px 0 12px; padding: 8px; }
#gift-form textarea, #gift-form input, #gift-form select { font-family: inherit; color: var(--ink); }
#gift-form .autogrow { display: block; width: 100%; padding: 4px 8px; border: 0; border-radius: 10px; background: transparent; resize: none; overflow: hidden; }
#gift-form .field-name { font: normal 26px/1.2 var(--serif); letter-spacing: -.01em; }
#gift-form .field-desc { font-size: 16px; line-height: 1.4; color: var(--ink-soft); }
#gift-form :is(input, textarea)::placeholder { color: var(--ink-soft); opacity: 1; }
.site-pill {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  margin: 4px 0 2px 8px;
  padding: 0 11px 0 13px;
  border-radius: 999px;
  background: rgba(29, 58, 46, .07);
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .25s cubic-bezier(.3, 1.4, .5, 1), background .2s;
}
.site-pill .glyph { width: 15px; height: 15px; stroke-width: 2.2; color: var(--ink-soft); }
.site-pill:active { transform: scale(.94); background: rgba(29, 58, 46, .12); }
.site-pill:focus-visible { outline: 2px solid var(--berry); outline-offset: 2px; }
.site-pill[hidden] { display: none; }

/* Details: one grouped list, label on the left and the control on the right. */
.sheet { border-radius: 18px; background: #fff; box-shadow: 0 0 0 .5px rgba(29, 58, 46, .12), 0 1px 2px rgba(29, 58, 46, .04); overflow: hidden; }
.row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  min-height: 52px;
  padding: 7px 14px;
}
.row + .row::before { content: ''; position: absolute; top: 0; left: 14px; right: 0; border-top: .5px solid rgba(29, 58, 46, .14); }
.row-label { flex: none; width: 66px; color: var(--ink-soft); font-size: 15px; font-weight: 600; }
#gift-form .row > input, #gift-form .row > select, #gift-form .row > textarea {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  border: 0;
  background: transparent;
  font-size: 16px;
  font-weight: 600;
  text-align: right;
}
#gift-form .row > select { text-align-last: right; cursor: pointer; }
#gift-form .link-row > input { text-align: left; }
#gift-form .notes-row > textarea { text-align: left; font-weight: 500; }
#gift-form :is(.title-fields > textarea, .row input:not([type=radio]), .row select, .row textarea):focus { outline: none; }
#gift-form .title-fields > textarea:focus,
#gift-form .row:has(:is(input:not([type=radio]), select, textarea):focus) {
  background: var(--editor-focus);
  box-shadow: inset 0 0 0 2px var(--editor-focus-ring);
}
.seg {
  flex: 1;
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  max-width: 260px;
  margin-left: auto;
  padding: 2px;
  border-radius: 10px;
  background: rgba(118, 118, 128, .12);
}
.seg label { position: relative; min-width: 0; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: block;
  padding: 7px 4px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .2s, box-shadow .2s;
}
.seg input:checked + span { background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }
.seg input:focus-visible + span { box-shadow: 0 0 0 2px var(--berry); }
.cost { flex: 1; display: flex; align-items: baseline; justify-content: flex-end; gap: 2px; min-width: 0; }
.cost span { font: 20px var(--serif); color: var(--ink-soft); }
#gift-form .cost input { width: 4.2em; min-width: 0; max-width: 100%; padding: 4px 0; border: 0; appearance: textfield; background: transparent; font: 24px var(--serif); font-variant-numeric: tabular-nums; text-align: right; }
#gift-form .cost input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.price-line { flex-basis: 100%; display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin: -2px 0 3px; }
.price-line:has(.price-note:empty) { display: none; }
.price-note { color: #8a8a74; font-size: 13px; }
.price-note:empty { display: none; }
.price-note.error { color: #b3302f; min-height: 0; }
@keyframes elf-think { from { opacity: .45; transform: scale(.9); } to { opacity: 1; transform: scale(1.06); } }
.gift-info .gift-desc { display: block; color: var(--ink-soft); font-size: 13px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .elf.busy .elf-face { animation: none; } }

/* Profile photo cropper: the image pans and zooms under a fixed round mask. */
#crop-dialog { width: min(440px, calc(100% - 24px)); }
.crop-frame {
  position: relative;
  width: min(100%, 58dvh);
  aspect-ratio: 1;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 18px;
  background: #0d1f18;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
.crop-frame:active { cursor: grabbing; }
.crop-frame img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  transform-origin: 0 0;
  pointer-events: none;
  -webkit-user-drag: none;
}
.crop-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, .85);
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(4, 16, 12, .58);
  pointer-events: none;
}
.crop-zoom { display: flex; align-items: center; gap: 12px; margin-top: 18px; color: var(--ink); font-size: 13px; font-weight: 700; }
.crop-zoom input { flex: 1; min-height: 32px; accent-color: var(--berry); }
.crop-hint { margin: 8px 0 0; color: #6c7b6f; font-size: 12px; }
.mobile-add { display: none; }

/* Tablets and phones: the sidebar becomes a floating tab bar. */
@media (max-width: 850px) {
  .sidebar {
    position: fixed;
    top: auto;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 20;
    width: auto;
    height: auto;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(8, 26, 20, .72);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .14);
  }
  .brand, .side-label, .sidebar-bottom, .nav-more, .soon { display: none; }
  .sidebar nav { display: flex; flex: 1; gap: 4px; }
  .nav {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    margin: 0;
    padding: 8px 4px;
    border-radius: 18px;
    font-size: 11px;
    text-align: center;
  }
  .nav-text { text-transform: capitalize; }
  .nav-icon { width: auto; font-size: 20px; }
  .nav-icon img { width: 26px; height: 26px; margin: 0 auto; }
  .nav.active { background: rgba(230, 194, 124, .2); box-shadow: inset 0 0 0 1px rgba(230, 194, 124, .45); }
  .topbar { padding: 0 20px; }
  .top-home .seal { display: grid; }
  .content { padding: 34px 20px 130px; }
}

@media (max-width: 600px) {
  .topbar { height: 60px; padding: 0 16px; }
  .top-name { font: 18px var(--serif); letter-spacing: 0; text-transform: none; }
  .top-season, .top-lock-text { display: none; }
  .top-lock { padding: 9px 12px; }
  .content { padding: 30px 16px 176px; }
  .heading h1 { font-size: 30px; }
  .heading > .primary { display: none; }
  .hero { gap: 20px; padding: 26px 20px 22px; margin: 24px 0 18px; }
  .bauble { width: 96px; height: 96px; }
  .bauble-number { font-size: 38px; }
  .bauble-label { font-size: 9px; letter-spacing: 2px; }
  .summary { margin: 18px 0; padding: 18px 16px 14px; }
  .figure { padding: 0 12px; }
  .figure strong { font-size: 24px; }
  .figure span { font-size: 10px; letter-spacing: 1.2px; }
  .profile { gap: 14px; }
  .avatar-large { width: 72px; height: 72px; font-size: 36px; }
  .avatar-badge { width: 28px; height: 28px; font-size: 13px; }
  .kids { grid-template-columns: 1fr; }
  .gift { --photo: 96px; gap: 18px; height: 112px; padding-right: 12px; }
  .gift-image { font-size: 38px; }
  .gift-bow { width: 48px; height: 30px; top: -14px; left: calc(var(--ribbon-x) - 24px); }
  .gift-info strong {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    font-size: 16px;
    line-height: 1.2;
    white-space: normal;
  }
  .gift-side { gap: 6px; }
  .gift-cost { font-size: 14px; }
  .mobile-add {
    display: block;
    position: fixed;
    right: 18px;
    bottom: calc(92px + env(safe-area-inset-bottom));
    z-index: 20;
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    font-size: 30px;
    background: linear-gradient(180deg, #d9484d, #a9272f);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .35), 0 0 0 3px rgba(230, 194, 124, .5);
  }
  .delete-form { padding: 20px 18px 22px; }
  #gift-form { padding: 0 14px; }
  #gift-form .modal-head { margin: 0 -14px 4px; padding: 16px 14px 10px; }
  #gift-form .modal-actions { margin: 14px -14px 0; padding: 10px 14px 14px; }
  .row { padding: 6px 12px; gap: 4px 8px; }
  .row-label { width: 58px; }
}

@media (prefers-reduced-motion: reduce) {
  .lights::before, .lights::after, .bauble, #view, dialog[open] { animation: none; }
  .gift.wrapping, .gift.wrapping * { animation: none !important; }
  .gift.wrapping { color: var(--cream-ink); }
  .gift.buying, .gift.buying::before, .gift.buying::after, .gift.buying * { animation: none !important; }
  .gift.buying::after { opacity: 0; }
  .gift.thought .gift-spark, .gift.planning, .gift.planning * , .gift.planning::after { animation: none !important; }
  .gift.planning .gift-glass { opacity: 0; }
  .gift-row { transition: none; }
}

/* Santa's assistant: the idea form, the elf library, and idea cards. */
.kid-form { display: grid; gap: 14px; padding: 18px 20px 20px; overflow: auto; max-height: calc(90dvh - 8px); }
.kid-form .modal-head { align-items: start; margin-bottom: 0; }
.kid-form .modal-head h2 { margin-top: 4px; }
.kid-form .modal-actions { margin-top: 4px; }
.kid-form .error { margin: 0; }
.kid-form .error:empty { display: none; }
/* Add from a link: just the address, then the editor opens filled in. On
   phones it sits high so the keyboard never covers it. */
#link-dialog { width: min(460px, calc(100% - 24px)); }
.link-form { display: grid; gap: 12px; padding: 20px 20px 18px; }
.link-form .modal-head { margin-bottom: 2px; }
.link-form .modal-actions { margin-top: 2px; }
.link-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 6px 0 14px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 0 0 .5px rgba(29, 58, 46, .18), 0 1px 2px rgba(29, 58, 46, .06);
  transition: box-shadow .15s;
}
.link-field:focus-within { box-shadow: 0 0 0 2px var(--berry); }
.link-field-icon { flex: none; display: grid; color: var(--ink-soft); }
.link-field-icon .glyph { width: 20px; height: 20px; }
#link-input {
  flex: 1;
  min-width: 0;
  height: 50px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}
#link-input:focus { outline: none; }
#link-input:read-only { color: var(--ink-soft); }
.link-paste {
  flex: none;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(29, 58, 46, .08);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}
.link-paste:active { transform: scale(.96); }
.link-paste[hidden], .link-field:has(#link-input:not(:placeholder-shown)) .link-paste { display: none; }
.link-status { margin: 0 2px; min-height: 1.45em; color: var(--ink-soft); font-size: 13px; line-height: 1.45; }
.link-status:empty { display: none; }
.link-form.busy .link-field-icon { animation: elf-think 1s ease-in-out infinite alternate; }
@media (max-width: 600px) {
  #link-dialog { margin-top: max(10dvh, calc(env(safe-area-inset-top) + 16px)); }
  .link-form { padding: 18px 16px 16px; }
}
@media (max-width: 600px) { .kid-form { padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); } }
.kid-hint { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.45; }
.kid-field { display: grid; gap: 6px; color: var(--ink); font-size: 13px; font-weight: 750; }
.kid-field input, .kid-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dccfb2;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 400;
  resize: vertical;
}

.idea-form {
  display: grid;
  gap: 18px;
  margin: 24px 0 0;
  padding: 22px 24px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--glass);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
}
.idea-field { display: grid; gap: 8px; min-width: 0; }
.idea-label { color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; }
.idea-label small { color: var(--muted); font-weight: 600; letter-spacing: 0; text-transform: none; }
.idea-form .seg { margin-left: 0; max-width: 320px; }
.idea-form > .idea-field > input, .budget input {
  padding: 10px 12px;
  border: 1px solid #dccfb2;
  border-radius: 12px;
  background: #fffaf0;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}
.budget { display: flex; align-items: center; gap: 8px; color: var(--snow); font-weight: 700; }
.budget input { width: 96px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .06);
  color: var(--snow);
  font-size: 13px;
  font-weight: 650;
}
.chip.on { background: var(--gold); border-color: var(--gold); color: #2a2110; }
.idea-profile { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.idea-go { justify-self: start; min-height: 48px; }
.elf-spin { display: inline-block; animation: elf-bob .8s ease-in-out infinite alternate; }
@keyframes elf-bob { from { transform: translateY(2px) rotate(-8deg); } to { transform: translateY(-3px) rotate(8deg); } }

/* Elf report: fairness and what's left, above the idea form. */
.report { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 24px 0 0; }
.report-card {
  min-width: 0;
  padding: 20px 22px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
}
.report-title { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 14px; color: var(--gold); }
.report-title .glyph { width: 20px; height: 20px; }
.report-title h2 { margin: 0; font: normal 22px var(--serif); color: var(--cream); }
.report-sub { flex-basis: 100%; padding-left: 30px; color: var(--muted); font-size: 13px; }
.report-quiet { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.report-quiet .glyph { flex: none; width: 17px; height: 17px; margin-top: 1px; color: var(--gold); }
.fair-sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.fair-name { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; }
.fair-side strong { display: block; margin: 4px 0 8px; font: normal 28px/1.1 var(--serif); color: var(--gold); font-variant-numeric: tabular-nums; }
.fair-side small { color: var(--muted); font-size: 12.5px; }
.fair-bar { display: block; width: 100%; height: 6px; margin-bottom: 8px; border: 0; border-radius: 3px; background: rgba(255, 255, 255, .08); overflow: hidden; -webkit-appearance: none; appearance: none; }
.fair-bar::-webkit-progress-bar { background: rgba(255, 255, 255, .08); }
.fair-bar::-webkit-progress-value { background: var(--gold); border-radius: 3px; }
.fair-bar::-moz-progress-bar { background: var(--gold); border-radius: 3px; }
.fair-gaps { display: grid; gap: 10px; margin: 16px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line); list-style: none; }
.fair-gaps li { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; line-height: 1.4; }
.fair-ask {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(230, 194, 124, .45);
  border-radius: 999px;
  background: rgba(230, 194, 124, .12);
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  transition: transform .2s cubic-bezier(.3, 1.4, .5, 1);
}
.fair-ask .glyph { width: 14px; height: 14px; }
.fair-ask:active { transform: scale(.94); }
.todo-group + .todo-group { margin-top: 14px; }
.todo-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; }
.todo-head .glyph { width: 16px; height: 16px; }
.todo-head em { margin-left: auto; font-style: normal; color: var(--muted); letter-spacing: 0; }
.todo-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--snow);
  font: inherit;
  font-size: 14.5px;
  text-align: left;
}
.todo-item:hover, .todo-item:active { background: rgba(255, 255, 255, .06); }
.todo-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-item small { flex: none; color: var(--muted); font-size: 12.5px; }
.todo-more { margin: 6px 0 0 10px; color: var(--muted); font-size: 13px; }
@media (max-width: 760px) {
  .report { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .report-card { padding: 18px 16px; }
  .fair-gaps li { flex-direction: column; align-items: flex-start; }
}

.idea-run {
  margin: 0 0 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .14);
}
/* Batch header: avatar, two quiet lines, a delete. */
.idea-run summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  cursor: pointer;
  list-style: none;
}
.idea-run summary::-webkit-details-marker { display: none; }
.idea-run-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 22px;
  background: rgba(255, 255, 255, .08);
  box-shadow: inset 0 0 0 1.5px rgba(230, 194, 124, .45);
}
.idea-run-text { display: grid; gap: 2px; min-width: 0; }
.idea-run-title { color: var(--cream); font: 19px/1.2 var(--serif); }
.idea-run-title em { font-style: normal; color: var(--gold); font-size: 16px; margin-left: 4px; }
.idea-run-meta, .idea-run-extra { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idea-run-extra { opacity: .8; }
.idea-run-delete {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}
.idea-run-delete:hover { background: rgba(255, 255, 255, .08); color: var(--snow); }
.idea-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; padding: 0 14px 14px; }
.idea-empty { margin: 0; color: var(--muted); font-size: 14px; }

/* Each idea is a gift tag: the same paper as the gift list, with a perforated stub for actions. */
.idea {
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--paper), #f5ead2);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .28), inset 0 0 0 1px rgba(255, 255, 255, .7);
  transition: opacity .2s;
}
.idea.added .idea-stub { background: rgba(47, 122, 74, .08); border-radius: 0 0 16px 16px; }
.idea.added .idea-name { color: var(--ink-soft); }
.idea-body { display: grid; gap: 10px; padding: 16px 18px 14px; }
.idea-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.idea-name { margin: 0; font: 700 19px/1.22 var(--serif); letter-spacing: -.1px; }
.idea-price { font: 700 19px var(--serif); white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--berry-deep); }
.idea-meta {
  margin: -4px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: #a8782f;
}
.idea-source { color: var(--ink-soft); }
.idea-source::before { content: '·'; margin: 0 8px; color: #a8782f; }
.idea-source.live { color: #2f7a4a; }
.idea-desc, .idea-note, .idea-pair { margin: 0; font-size: 14px; line-height: 1.45; color: var(--ink-soft); }
.idea-why {
  margin: 2px 0 0;
  padding-left: 12px;
  border-left: 2px solid var(--gold);
  font: italic 15px/1.45 var(--serif);
  color: var(--ink);
}
.idea-pair { font-size: 13px; }
.idea-note { font-size: 13px; color: #8a5a12; }
.idea-stub {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  padding: 10px 10px 10px 12px;
  border-top: 1.5px dashed rgba(70, 50, 20, .25);
}
.idea-add {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  background: linear-gradient(180deg, #d9484d, var(--berry) 55%, #a9272f);
  box-shadow: 0 4px 10px rgba(140, 28, 37, .3), inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: transform .15s;
}
.idea-add:active { transform: scale(.96); }
.idea-link {
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.idea-link:hover { background: rgba(29, 58, 46, .07); }
.idea-x {
  flex: none;
  width: 34px;
  height: 34px;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
}
.idea-x:hover { background: rgba(29, 58, 46, .07); }
.idea-added { padding: 0 6px; color: #2f7a4a; font-weight: 800; font-size: 13px; white-space: nowrap; }
@media (max-width: 600px) {
  .idea-form { padding: 18px 16px; }
  .idea-grid { grid-template-columns: 1fr; padding: 0 8px 8px; }
  .idea-run summary { padding: 12px 8px 12px 12px; }
  .idea-body { padding: 15px 16px 13px; }
}
@media (prefers-reduced-motion: reduce) { .elf-spin { animation: none; } }

/* Add menu: a stack of glass pills that springs out of the add button over a
   blurred backdrop. */
.add-scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(4, 14, 10, .42);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  backdrop-filter: blur(18px) saturate(1.5);
  animation: add-fade .22s ease-out;
}
.add-scrim[hidden], .add-menu[hidden] { display: none; }
.add-menu {
  position: fixed;
  z-index: 31;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
.add-menu.above { flex-direction: column-reverse; }
.add-menu.start { align-items: flex-start; }
.add-menu button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  color: inherit;
  font: inherit;
  background: none;
  -webkit-tap-highlight-color: transparent;
  animation: add-pop .42s cubic-bezier(.32, 1.5, .55, 1) backwards;
  animation-delay: calc(var(--i) * 28ms);
  transform-origin: calc(100% - 26px) 50%;
}
.add-menu.start button { flex-direction: row-reverse; transform-origin: 26px 50%; }
.add-menu button[hidden] { display: none; }
.add-label {
  padding: 9px 15px;
  border-radius: 999px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  white-space: nowrap;
  background: rgba(255, 255, 255, .12);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  backdrop-filter: blur(24px) saturate(1.8);
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .28), 0 8px 24px rgba(0, 0, 0, .22);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.add-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(255, 255, 255, .97), rgba(240, 236, 226, .9));
  box-shadow: inset 0 1px 0 #fff, inset 0 0 0 .5px rgba(255, 255, 255, .6), 0 10px 26px rgba(0, 0, 0, .3);
  transition: transform .16s ease;
}
.add-glyph, .plus-glyph {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.add-menu button:active .add-icon { transform: scale(.9); }
.add-menu button:hover .add-icon, .add-menu button:focus-visible .add-icon { box-shadow: inset 0 1px 0 #fff, 0 0 0 3px rgba(230, 194, 124, .7), 0 10px 26px rgba(0, 0, 0, .3); }
.add-menu button:focus-visible { outline: none; }
.add-menu.leaving button { animation: add-out .18s ease-in forwards; animation-delay: 0s; }
.add-scrim.leaving { animation: add-fade .2s ease-in reverse forwards; }
.mobile-add .plus-glyph { display: block; width: 28px; height: 28px; margin: auto; stroke-width: 2.4; transition: transform .3s cubic-bezier(.32, 1.5, .55, 1); }
.mobile-add.open { z-index: 32; }
.mobile-add.open .plus-glyph { transform: rotate(135deg); }
[data-add].open:not(.mobile-add) { position: relative; z-index: 32; }
@keyframes add-pop { from { opacity: 0; transform: translateY(18px) scale(.4); } }
@keyframes add-out { to { opacity: 0; transform: translateY(10px) scale(.6); } }
@keyframes add-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .add-scrim, .add-menu button, .add-menu.leaving button, .add-scrim.leaving { animation: none; }
  .mobile-add .plus-glyph { transition: none; }
}
.primary .plus-glyph { width: 18px; height: 18px; margin: -3px 2px 0 0; vertical-align: middle; stroke-width: 2.4; transition: transform .3s cubic-bezier(.32, 1.5, .55, 1); }
.primary.open .plus-glyph { transform: rotate(135deg); }

/* Phones: the gift editor is a bottom sheet that rises from the bottom edge. */
@media (max-width: 640px) {
  #gift-dialog {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - env(safe-area-inset-top) - 10px);
    margin: auto 0 0;
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, .35);
  }
  #gift-dialog[open] { animation: sheet-up .42s cubic-bezier(.2, .9, .25, 1); }
  #gift-form { max-height: calc(100dvh - env(safe-area-inset-top) - 10px); }
  #gift-form .modal-head { padding-top: 22px; }
  #gift-form .modal-actions { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .sheet-grabber {
    display: block;
    position: absolute;
    top: 7px;
    left: 50%;
    z-index: 4;
    width: 36px;
    height: 5px;
    margin-left: -18px;
    border-radius: 3px;
    background: rgba(29, 58, 46, .2);
  }
}
@keyframes sheet-up { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { #gift-dialog[open] { animation: none; } }

/* Kid page header: the elves' notes live behind a small glass chip. */
.eyebrow-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: -6px; }
.elf-chip {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--gold);
  background: rgba(255, 255, 255, .1);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .26), 0 6px 18px rgba(0, 0, 0, .2);
  -webkit-tap-highlight-color: transparent;
  transition: transform .2s cubic-bezier(.32, 1.5, .55, 1);
}
.elf-chip .glyph { width: 20px; height: 20px; }
.elf-chip:active { transform: scale(.88); }

/* List filters: glass icon buttons at the end of the list title, and a menu
   that springs out of the one tapped. Totals behind update live under a light dim. */
.section-title .filter-icons { order: 2; display: flex; gap: 8px; flex: none; }
/* Icon-only filter buttons: glass circles that turn gold with a count when narrowing the list. */
.filter-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--snow);
  background: rgba(255, 255, 255, .1);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .26);
  -webkit-tap-highlight-color: transparent;
  transition: transform .2s cubic-bezier(.32, 1.5, .55, 1), background-color .2s, color .2s;
}
.filter-icon .glyph { width: 19px; height: 19px; stroke-width: 1.9; }
.filter-icon:active { transform: scale(.9); }
.filter-icon:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.filter-icon.active { color: var(--ink); background: var(--gold); box-shadow: 0 4px 14px rgba(230, 194, 124, .25); }
.filter-icon.open { z-index: 32; background: rgba(255, 255, 255, .2); }
.filter-icon.active.open { background: #f0d496; }
.filter-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  background: var(--berry);
  box-shadow: 0 0 0 2px var(--night);
}

.filter-scrim { position: fixed; inset: 0; z-index: 30; background: rgba(4, 14, 10, .28); animation: add-fade .2s ease-out; }
.filter-scrim[hidden], .filter-menu[hidden] { display: none; }
.filter-scrim.leaving { animation: add-fade .18s ease-in reverse forwards; }
.filter-menu {
  position: fixed;
  z-index: 31;
  width: min(264px, calc(100vw - 24px));
  padding: 6px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 22px;
  color: #fff;
  background: rgba(24, 48, 39, .72);
  -webkit-backdrop-filter: blur(34px) saturate(1.8);
  backdrop-filter: blur(34px) saturate(1.8);
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .22), 0 18px 48px rgba(0, 0, 0, .4);
  transform-origin: calc(100% - 24px) 0;
  animation: filter-pop .38s cubic-bezier(.32, 1.35, .55, 1);
}
.filter-menu.above { transform-origin: calc(100% - 24px) 100%; }
.filter-menu.start { transform-origin: 24px 0; }
.filter-menu.start.above { transform-origin: 24px 100%; }
.filter-menu.settled { animation: none; }
.filter-menu.leaving { animation: filter-out .16s ease-in forwards; }
.filter-head { padding: 8px 16px 6px; color: rgba(255, 255, 255, .55); font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.filter-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 0 16px 0 12px;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  background: none;
  -webkit-tap-highlight-color: transparent;
}
.filter-menu button:active, .filter-menu button:focus-visible { outline: none; background: rgba(255, 255, 255, .1); }
.filter-check { display: grid; place-items: center; flex: none; width: 22px; height: 22px; color: var(--gold); }
.filter-check .glyph { width: 18px; height: 18px; stroke-width: 2.4; }
.filter-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; letter-spacing: -.01em; }
.filter-amount { flex: none; color: rgba(255, 255, 255, .55); font-size: 14px; font-variant-numeric: tabular-nums; }
.filter-menu button[aria-checked="true"] .filter-name { font-weight: 600; }
.filter-sep { height: .5px; margin: 6px 0; background: rgba(255, 255, 255, .16); }
.filter-glyph { display: grid; place-items: center; flex: none; width: 22px; height: 22px; margin-right: -2px; color: rgba(255, 255, 255, .8); }
.filter-glyph .glyph { width: 20px; height: 20px; stroke-width: 1.7; }
.status-dot { flex: none; width: 10px; height: 10px; margin-right: -2px; border-radius: 50%; }
.status-dot.Idea { border: 1.5px dashed var(--gold); }
.status-dot.Planned { background: #f6efdf; }
.status-dot.Purchased { background: #c59d66; }
.status-dot.Wrapped { background: var(--berry); box-shadow: inset 0 0 0 2px rgba(242, 207, 127, .8); }
@keyframes filter-pop { from { opacity: 0; transform: scale(.3); } }
@keyframes filter-out { to { opacity: 0; transform: scale(.7); } }
@media (prefers-reduced-motion: reduce) {
  .filter-menu, .filter-menu.leaving, .filter-scrim, .filter-scrim.leaving { animation: none; }
  .filter-icon, .elf-chip { transition: none; }
}
@media (max-width: 600px) {
  .section-title { margin: 28px 0 14px; gap: 12px; }
  .section-title .filter-icons { gap: 6px; }
}

/* Ideas in the editor: a lighter form, planned into a gift with one tap. */
#gift-form .row[hidden] { display: none; }
.plan-idea, .back-to-idea {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 0;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.plan-idea {
  min-height: 50px;
  margin-top: 14px;
  border-radius: 14px;
  color: #7d5814;
  font-size: 16px;
  font-weight: 650;
  background: rgba(217, 168, 69, .16);
  box-shadow: inset 0 0 0 .5px rgba(217, 168, 69, .45);
  transition: transform .16s ease, background .2s;
}
.plan-idea:active { transform: scale(.98); background: rgba(217, 168, 69, .26); }
.back-to-idea {
  margin-top: 10px;
  padding: 10px;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 600;
  background: none;
}
.back-to-idea:active { opacity: .6; }
.plan-idea .glyph, .back-to-idea .glyph { width: 18px; height: 18px; stroke-width: 2; }
.plan-idea[hidden], .back-to-idea[hidden] { display: none; }
.plan-idea:focus-visible, .back-to-idea:focus-visible { outline: 2px solid var(--berry); outline-offset: 2px; }

/* Gift | Idea in the add menu, at the far end of the stack from the button. */
.add-kind {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  backdrop-filter: blur(24px) saturate(1.8);
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .28), 0 8px 24px rgba(0, 0, 0, .22);
  animation: add-pop .42s cubic-bezier(.32, 1.5, .55, 1) backwards;
  animation-delay: calc(var(--i) * 28ms);
  transform-origin: calc(100% - 26px) 50%;
}
.add-menu.start .add-kind { transform-origin: 26px 50%; }
.add-menu .add-kind button {
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  color: rgba(255, 255, 255, .85);
  font-size: 15px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  animation: none;
  transition: background .25s, color .25s;
}
.add-menu .add-kind button[aria-checked="true"] { color: var(--ink); text-shadow: none; background: rgba(255, 255, 255, .95); box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
.add-menu .add-kind button[data-kind="idea"][aria-checked="true"] { color: #7d5814; }
.add-kind .glyph { width: 18px; height: 18px; stroke-width: 1.9; }
.add-menu .add-kind button:focus-visible { outline: 2px solid rgba(230, 194, 124, .9); outline-offset: 1px; }
.add-menu.leaving .add-kind { animation: add-out .18s ease-in forwards; animation-delay: 0s; }
@media (prefers-reduced-motion: reduce) {
  .add-kind, .add-menu.leaving .add-kind, .plan-idea, .add-menu .add-kind button { animation: none; transition: none; }
}

/* The editor's From picker: the saved people, or a new name typed in place. */
#gift-form .giver-new > input {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  border: 0;
  background: transparent;
  font-size: 16px;
  font-weight: 600;
}
#gift-form .giver-new > input:focus { outline: none; }
.giver-new[hidden] { display: none; }
.giver-add {
  flex: none;
  min-height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  background: var(--berry);
}
.giver-add:active { transform: scale(.94); }
