:root {
  --bg: #FBF6EE;
  --surface: #FFFFFF;
  --surface-2: #F4EDE1;
  --ink: #1D2A23;
  --muted: #6A776F;
  --line: #E9E0D2;
  --pine: #0E4434;
  --pine-2: #15634B;
  --berry: #D2373C;
  --berry-ink: #B42A30;
  --gold: #E9B44C;
  --gold-soft: #FBEFD3;
  --snow: #FFFFFF;
  --pill: #FFFFFF;
  --toast-accent: #E9B44C;
  --shadow: 0 1px 2px rgba(29, 42, 35, .06), 0 6px 18px rgba(29, 42, 35, .06);
  --shadow-lift: 0 2px 4px rgba(29, 42, 35, .08), 0 14px 34px rgba(29, 42, 35, .14);
  --radius: 18px;
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);

  --kid-berry: #D2373C;
  --kid-pine: #1F9A63;
  --kid-gold: #D99A1E;
  --kid-sky: #3584D6;
  --kid-plum: #8E55D6;
  --kid-coral: #EE6C43;
  --kid-pink: #D6438A;

  --font-ui: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1A15;
    --surface: #13261F;
    --surface-2: #1A3129;
    --ink: #F3EEE4;
    --muted: #9AAEA4;
    --line: #23392F;
    --pine: #0A3428;
    --pine-2: #0F4A39;
    --berry: #E5484D;
    --berry-ink: #FF7A7E;
    --gold-soft: #3A3020;
    --pill: #2A4A3F;
    --toast-accent: #B42A30;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .35), 0 14px 34px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 500 16px/1.4 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
[hidden] { display: none !important; }
svg { display: block; }
body.sheet-open { overflow: hidden; }

/* ---------- Snow ---------- */
.snow { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* ---------- Buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 14px;
  font-weight: 700; font-size: 16px; letter-spacing: -.01em;
  transition: transform .15s var(--ease-out), background .2s, box-shadow .2s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--berry); color: #fff; box-shadow: 0 6px 16px rgba(210, 55, 60, .3); }
.btn-secondary { background: var(--surface-2); color: var(--ink); }
.btn-ghost { color: var(--muted); }
.btn-danger { color: var(--berry-ink); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

.field { display: block; }
.field + .field, .field + .field-row, .field-row + .field, .field-row + .field-row { margin-top: 16px; }
.field-label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 0 6px 2px; letter-spacing: .01em; }
.field input, .field textarea {
  width: 100%; min-height: 50px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface);
  font-size: 17px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 76px; resize: none; line-height: 1.4; }
.field input:focus, .field textarea:focus { border-color: var(--pine-2); box-shadow: 0 0 0 4px rgba(21, 99, 75, .14); }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: .7; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row .field + .field { margin-top: 0; }
.money { position: relative; }
.money::before { content: '$'; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; pointer-events: none; }
.money input { padding-left: 28px; font-variant-numeric: tabular-nums; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- Lock screen ---------- */
.lock {
  position: fixed; inset: 0; z-index: 30; overflow: auto;
  display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(120% 80% at 50% 0%, var(--pine-2), var(--pine) 55%, #072A20);
}
.lock-card {
  position: relative; width: 100%; max-width: 380px;
  padding: 28px 22px 22px; border-radius: 26px;
  background: var(--bg); box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
  animation: rise .7s var(--ease-out) both;
}
.lock-ornament { width: 76px; margin: -70px auto 6px; transform-origin: 50% 0; animation: swing 3.2s ease-in-out infinite; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .25)); }
.lock-title { margin: 0; text-align: center; font: 700 30px/1.1 var(--font-display); letter-spacing: -.01em; }
.lock-sub { margin: 6px 0 22px; text-align: center; color: var(--muted); }
.field .pin-input { text-align: center; font-size: 24px; letter-spacing: .4em; font-variant-numeric: tabular-nums; }
.field .pin-input::placeholder { letter-spacing: .4em; }
.lock-error { min-height: 22px; margin: 10px 2px 6px; color: var(--berry-ink); font-size: 14px; font-weight: 600; }
@keyframes swing { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.98); } }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; color: #fff;
  padding: calc(env(safe-area-inset-top) + 34px) 20px 22px;
  background:
    radial-gradient(90% 70% at 85% 0%, rgba(233, 180, 76, .22), transparent 60%),
    linear-gradient(170deg, var(--pine-2), var(--pine) 70%);
  border-radius: 0 0 28px 28px;
}
.lights { position: absolute; left: 0; right: 0; top: calc(env(safe-area-inset-top) - 6px); height: 36px; pointer-events: none; }
.lights svg { width: 100%; height: 100%; overflow: visible; }
.bulb { transform-box: fill-box; transform-origin: 50% 0; animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: 1; filter: drop-shadow(0 0 5px currentColor); } 50% { opacity: .45; filter: none; } }

.hero-top { position: relative; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .8); }
.brand-mark { width: 16px; height: 16px; color: var(--gold); animation: spin 12s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hero-actions { display: flex; gap: 6px; }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: rgba(255, 255, 255, .12); color: #fff; transition: background .2s, transform .15s;
}
.icon-btn:active { transform: scale(.92); background: rgba(255, 255, 255, .22); }
.icon-btn svg { width: 20px; height: 20px; }

.countdown { position: relative; margin: 18px 0 16px; }
.countdown-num { font: 700 56px/0.95 var(--font-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.countdown-day { font-size: 40px; }
.countdown-num em { font-style: normal; color: var(--gold); }
.countdown-text { margin-top: 4px; font-size: 15px; color: rgba(255, 255, 255, .78); }

.stats { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .1); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.stat-value { display: block; font-size: 19px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-label { display: block; font-size: 12px; color: rgba(255, 255, 255, .72); font-weight: 600; }
.stat-over .stat-value { color: #FFB3B5; }

.progress { position: relative; height: 8px; margin-top: 16px; border-radius: 99px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.progress-fill {
  position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit;
  background: repeating-linear-gradient(-45deg, #fff 0 8px, var(--berry) 8px 16px);
  background-size: 22.6px 22.6px; animation: candy 1.2s linear infinite;
  transition: width .8s var(--ease-out);
}
.progress-fill.over { background: repeating-linear-gradient(-45deg, #FFD3D4 0 8px, #FF6B70 8px 16px); }
@keyframes candy { to { background-position: 22.6px 0; } }
.progress-label { position: relative; margin: 8px 0 0; font-size: 13px; color: rgba(255, 255, 255, .78); font-weight: 600; }

/* ---------- Toolbar ---------- */
.statusbar { position: fixed; z-index: 5; top: 0; left: 0; right: 0; height: env(safe-area-inset-top); background: var(--bg); opacity: 0; transition: opacity .2s; pointer-events: none; }
body.stuck .statusbar { opacity: 1; }
.toolbar {
  position: sticky; top: env(safe-area-inset-top); z-index: 5;
  padding: 10px 0;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  transition: box-shadow .2s;
}
body.stuck .toolbar { box-shadow: 0 1px 0 var(--line); }
.chips { display: flex; gap: 8px; padding: 2px 16px 10px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 6px;
  border-radius: 99px; background: var(--surface); box-shadow: var(--shadow);
  font-weight: 700; font-size: 15px; scroll-snap-align: start;
  transition: background .2s, color .2s, transform .15s var(--ease-out);
}
.chip:active { transform: scale(.95); }
.chip-all { padding-left: 14px; }
.chip-avatar {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--kid); color: #fff; font-size: 13px; font-weight: 800;
}
.chip-count { font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.chip[aria-selected="true"] .chip-count { color: inherit; opacity: .7; }
.chip-add { padding: 0 14px; color: var(--muted); background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.chip-add svg { width: 16px; height: 16px; }

.segments {
  position: relative; display: grid; grid-template-columns: repeat(3, 1fr);
  margin: 0 16px; padding: 4px; border-radius: 14px; background: var(--surface-2);
}
.segments button { position: relative; z-index: 1; height: 36px; border-radius: 10px; font-size: 14px; font-weight: 700; color: var(--muted); transition: color .2s; }
.segments button b { font-weight: 700; opacity: .6; margin-left: 2px; font-variant-numeric: tabular-nums; }
.segments button[aria-selected="true"] { color: var(--ink); }
.segments-pill {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 3);
  border-radius: 10px; background: var(--pill); box-shadow: var(--shadow);
  transition: transform .35s var(--ease-spring);
}

/* ---------- List ---------- */
.list { padding: 6px 16px 0; max-width: 640px; margin: 0 auto; }
.list-spacer { height: calc(110px + env(safe-area-inset-bottom)); }

.section {
  display: flex; align-items: center; gap: 12px; padding: 18px 2px 10px;
}
.section-avatar {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  background: var(--kid-fill, var(--kid)); color: #fff; font: 700 17px/1 var(--font-display);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--kid) 40%, transparent);
}
.section-main { flex: 1; min-width: 0; }
.section-name { font: 700 20px/1.15 var(--font-display); letter-spacing: -.01em; }
.section-sub { font-size: 13px; color: var(--muted); font-weight: 600; }
.section-bar { height: 5px; margin-top: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.section-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--kid-fill, var(--kid)); transition: width .8s var(--ease-out); }
.section-bar span.over { background: var(--berry); }
.section-edit { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--muted); }
.section-edit svg { width: 18px; height: 18px; }

.gift {
  position: relative; display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px; padding: 14px 14px 14px 12px;
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
  transition: transform .2s var(--ease-out), box-shadow .2s, opacity .3s, background .3s;
}
.gift::before {
  content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--kid-fill, var(--kid));
}
.gift:active { transform: scale(.985); }
.gift.enter { animation: card-in .5s var(--ease-out) both; animation-delay: var(--delay, 0ms); }
.gift.leave { animation: card-out .35s var(--ease-out) forwards; pointer-events: none; }
.gift.flash { animation: flash .9s var(--ease-out); }
@keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes card-out { to { opacity: 0; transform: translateX(40px); } }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--gold), var(--shadow); } 100% { box-shadow: var(--shadow); } }

.check {
  flex: none; position: relative; display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  box-shadow: inset 0 0 0 2.5px var(--line); color: transparent;
  transition: background .25s, box-shadow .25s, color .2s, transform .15s;
}
.check::after { content: ''; position: absolute; inset: -8px; } /* bigger tap target */
.check:active { transform: scale(.88); }
.check svg { width: 20px; height: 20px; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .35s .05s var(--ease-out); }
.gift.is-bought .check { background: var(--pine-2); box-shadow: none; color: #fff; }
.gift.is-bought .check svg { stroke-dashoffset: 0; }
.gift.is-bought .check.pop { animation: pop .45s var(--ease-spring); }
@keyframes pop { 0% { transform: scale(.6); } 100% { transform: scale(1); } }

.gift-body { flex: 1; min-width: 0; text-align: left; }
.gift-title { font-size: 16px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.gift.is-bought .gift-title { color: var(--muted); }
.gift-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 5px; font-size: 13px; color: var(--muted); font-weight: 600; }
.gift-meta:empty { display: none; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 99px; background: var(--surface-2); font-size: 12px; font-weight: 700; color: var(--ink); }
.tag-santa { background: color-mix(in srgb, var(--berry) 14%, transparent); color: var(--berry-ink); }
.tag-stocking { background: color-mix(in srgb, var(--kid-sky) 16%, transparent); color: var(--kid-sky); }
.tag-wrapped { background: var(--gold-soft); color: #9A6A0A; }
@media (prefers-color-scheme: dark) { .tag-wrapped { color: var(--gold); } }
.meta-link { display: inline-flex; align-items: center; gap: 3px; color: var(--pine-2); text-decoration: none; max-width: 150px; }
@media (prefers-color-scheme: dark) { .meta-link { color: #6FD3A6; } }
.meta-link svg { flex: none; width: 13px; height: 13px; }
.meta-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

.gift-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.price { font-size: 16px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.price-none { color: var(--muted); font-weight: 600; font-size: 13px; }
.gift.is-bought .price { color: var(--muted); }
.wrap-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border-radius: 99px;
  font-size: 12px; font-weight: 800; color: #9A6A0A; background: var(--gold-soft);
  transition: transform .15s;
}
@media (prefers-color-scheme: dark) { .wrap-btn { color: var(--gold); } }
.wrap-btn:active { transform: scale(.92); }
.wrap-btn svg { width: 14px; height: 14px; }
.wrap-btn.is-wrapped { background: var(--gold); color: #3B2A06; }
.wrap-btn.wiggle svg { animation: wiggle .6s var(--ease-spring); }
@keyframes wiggle { 0% { transform: scale(.4) rotate(-30deg); } 60% { transform: scale(1.3) rotate(10deg); } 100% { transform: none; } }

/* ---------- Empty ---------- */
.empty { padding: 34px 28px 10px; text-align: center; max-width: 420px; margin: 0 auto; animation: card-in .5s var(--ease-out); }
.empty-art { width: 96px; margin: 0 auto 14px; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px); } }
.empty h2 { margin: 0 0 6px; font: 700 23px/1.2 var(--font-display); }
.empty p { margin: 0 0 18px; color: var(--muted); }

/* ---------- FAB ---------- */
.fab {
  position: fixed; z-index: 6; right: 18px; bottom: calc(env(safe-area-inset-bottom) + 18px);
  display: grid; place-items: center; width: 62px; height: 62px; border-radius: 20px;
  background: var(--berry); color: #fff;
  box-shadow: 0 10px 24px rgba(210, 55, 60, .4), inset 0 -3px 0 rgba(0, 0, 0, .12);
  transition: transform .2s var(--ease-spring);
  animation: fab-in .6s .3s var(--ease-spring) both;
}
.fab svg { width: 28px; height: 28px; transition: transform .3s var(--ease-spring); }
.fab:active { transform: scale(.9); }
.fab:active svg { transform: rotate(90deg); }
@keyframes fab-in { from { transform: scale(0) rotate(-90deg); } }

.sync {
  position: fixed; z-index: 6; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 30px); transform: translateX(-50%);
  padding: 8px 14px; border-radius: 99px; background: var(--ink); color: var(--bg); font-size: 13px; font-weight: 700;
  box-shadow: var(--shadow-lift);
}

/* ---------- Sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(8, 20, 15, .45); opacity: 0; transition: opacity .3s; }
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed; z-index: 21; left: 0; right: 0; bottom: 0;
  max-height: calc(100dvh - env(safe-area-inset-top) - 24px);
  display: flex; flex-direction: column;
  background: var(--bg); border-radius: 26px 26px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .2);
  transform: translateY(105%); transition: transform .45s var(--ease-out);
  max-width: 640px; margin: 0 auto;
}
.sheet.open { transform: translateY(var(--drag, 0px)); }
.sheet.dragging { transition: none; }
.sheet-handle { flex: none; display: grid; place-items: center; height: 26px; touch-action: none; cursor: grab; }
.sheet-handle span { width: 40px; height: 5px; border-radius: 99px; background: var(--line); }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 20px calc(env(safe-area-inset-bottom) + 20px); }
.sheet-title { display: flex; align-items: center; gap: 10px; margin: 2px 0 18px; font: 700 24px/1.15 var(--font-display); letter-spacing: -.01em; }
.sheet-title .sheet-emoji { font-size: 24px; animation: wiggle .7s var(--ease-spring); }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.sheet-actions .btn-primary:only-child { grid-column: 1 / -1; }
.sheet-delete { display: block; margin: 14px auto 0; padding: 8px 12px; font-weight: 700; }
.form-error { min-height: 0; margin: 10px 2px 0; color: var(--berry-ink); font-size: 14px; font-weight: 600; }
.form-error:empty { display: none; }

.pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pick button {
  display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 14px 0 8px; border-radius: 99px;
  background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 700; font-size: 15px;
  transition: box-shadow .15s, background .15s, color .15s, transform .15s var(--ease-out);
}
.pick button:active { transform: scale(.95); }
.pick button.plain { padding: 0 14px; }
.pick button[aria-checked="true"] { background: var(--ink); color: var(--bg); box-shadow: none; }
.pick .chip-avatar { width: 26px; height: 26px; }

.seg { display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; gap: 6px; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.seg button { min-height: 42px; border-radius: 10px; font-size: 14px; font-weight: 700; color: var(--muted); transition: background .2s, color .2s, box-shadow .2s; }
.seg button[aria-checked="true"] { background: var(--pill); color: var(--ink); box-shadow: var(--shadow); }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches button { width: 40px; height: 40px; border-radius: 50%; background: var(--kid); transition: transform .2s var(--ease-spring), box-shadow .2s; }
.swatches button[aria-checked="true"] { transform: scale(1.1); box-shadow: 0 0 0 3px var(--bg), 0 0 0 5.5px var(--kid); }

.settings-group { margin-bottom: 24px; }
.settings-group h3 { margin: 0 0 10px 2px; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.kid-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; margin-bottom: 8px;
  border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); text-align: left;
}
.kid-row .chip-avatar { width: 34px; height: 34px; font-size: 15px; }
.kid-row-main { flex: 1; min-width: 0; }
.kid-row-name { font-weight: 700; }
.kid-row-sub { font-size: 13px; color: var(--muted); font-weight: 600; }
.kid-row-chev { color: var(--muted); font-size: 20px; }
.field-hint { font-weight: 600; opacity: .8; }
.settings-note { font-size: 13px; color: var(--muted); margin: 8px 2px 0; }

/* ---------- Shield ---------- */
.shield {
  position: fixed; inset: 0; z-index: 40; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(100% 70% at 50% 30%, var(--pine-2), #06231A);
  color: #fff; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  animation: fade-in .25s ease-out;
}
@keyframes fade-in { from { opacity: 0; } }
.globe { width: min(62vw, 260px); animation: bob 4s ease-in-out infinite; position: relative; }
.shield-title { position: relative; margin: 0; font: 700 34px/1.1 var(--font-display); }
.shield-hold { position: absolute; bottom: calc(env(safe-area-inset-bottom) + 28px); right: 22px; width: 52px; height: 52px; display: grid; place-items: center; color: var(--gold); opacity: .55; }
.shield-hold > svg:first-child { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, .15); stroke-width: 3; }
.ring { fill: none; stroke: var(--gold); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 120; stroke-dashoffset: 120; }
.shield-hold.holding { opacity: 1; }
.shield-hold.holding .ring { stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear; }
.shield-star { width: 20px; height: 20px; }

/* ---------- Toasts & confetti ---------- */
.toasts { position: fixed; z-index: 50; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 92px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 14px; max-width: 420px; padding: 12px 12px 12px 16px;
  border-radius: 16px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lift);
  font-size: 15px; font-weight: 600; pointer-events: auto;
  animation: toast-in .45s var(--ease-spring) both;
}
.toast.out { animation: toast-out .25s ease-in forwards; }
.toast button { padding: 6px 10px; border-radius: 10px; color: var(--toast-accent); font-weight: 800; }
body.sheet-open .toasts { bottom: auto; top: calc(env(safe-area-inset-top) + 12px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(.97); } }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 60; pointer-events: none; }

/* ---------- Larger screens ---------- */
@media (min-width: 700px) {
  .hero { max-width: 640px; margin: 0 auto; border-radius: 0 0 32px 32px; }
  .toolbar > * { max-width: 640px; margin-left: auto; margin-right: auto; }
  .segments { max-width: 608px; }
  .fab { right: max(18px, calc(50% - 320px + 18px)); }
}

/* ---------- Comments (gift sheet + card badge) ---------- */
.tag-comments { gap: 3px; color: var(--muted); background: var(--surface-2); }
.tag-comments svg { width: 13px; height: 13px; }
.tag-comments.unread { background: var(--berry); color: #fff; }
.thread { margin: 0 0 22px; }
.thread-title { margin: 0 2px 8px; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .01em; }
.thread-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.thread-empty { margin: 0 2px; font-size: 14px; color: var(--muted); }
.bubble { align-self: flex-start; max-width: 82%; }
.bubble-text { padding: 9px 13px; border-radius: 18px 18px 18px 6px; background: var(--surface-2); line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble-meta { margin: 3px 8px 0; font-size: 12px; font-weight: 600; color: var(--muted); }
.bubble.mine { align-self: flex-end; }
.bubble.mine .bubble-text { border-radius: 18px 18px 6px 18px; background: var(--pine-2); color: #fff; }
.bubble.mine .bubble-meta { text-align: right; }
.thread-form { display: flex; gap: 8px; }
.thread-form input {
  flex: 1; min-width: 0; min-height: 46px; padding: 10px 16px; border: 1.5px solid var(--line); border-radius: 99px;
  background: var(--surface); font-size: 17px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.thread-form input:focus { border-color: var(--pine-2); box-shadow: 0 0 0 4px rgba(21, 99, 75, .14); }
.thread-send { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--pine-2); color: #fff; }
.thread-send svg { width: 20px; height: 20px; }
.thread-send:active { transform: scale(.92); }

/* ---------- Link preview (gift sheet) ---------- */
.preview { margin: -4px 0 20px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.preview-media { display: block; height: 180px; background: #fff; }
.preview-media img { display: block; width: 100%; height: 100%; padding: 12px; box-sizing: border-box; object-fit: contain; }
.preview-media.is-loading { background: linear-gradient(90deg, var(--surface-2) 30%, var(--surface) 50%, var(--surface-2) 70%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }
.preview-media.is-loading img { opacity: 0; }
@keyframes shimmer { to { background-position: -150% 0; } }
.preview-body { padding: 12px 14px 0; }
.preview-site { display: block; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-title { display: -webkit-box; margin-top: 2px; overflow: hidden; font-weight: 700; line-height: 1.3; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.preview-title:empty { display: none; }
.preview-open { display: flex; margin: 12px 14px 14px; text-decoration: none; }
.preview-open svg { width: 16px; height: 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
