/* ---------- base tokens: the plain look, Jan 1 – Oct 31 ---------- */
:root {
  --bg: #faf7f2; --card: #ffffff; --ink: #1f1d1a; --muted: #6f6a62; --line: #e8e2d8;
  --accent: #b23a48; --accent-ink: #fff; --soft: #f3ede4; --field: #faf7f2;
  --on-bg: var(--ink); --on-bg-muted: var(--muted);
  --head: 'Merriweather', Georgia, serif; --head-weight: 700; --head-scale: 1;
  --body: 'Inter', system-ui, sans-serif;
  --radius: 14px; --field-radius: 9px; --btn-radius: 9px;
  --bar-border: 3px solid var(--accent);
  --birthday: #d63384; --christmas: #1f7a4d; --other: #b0702a;
}

/* ---------- Christmas: snowy pine night, candy-cane trim ---------- */
[data-theme="christmas"] {
  --bg: #123d2c; --card: #fffaf0; --ink: #2a1a12; --muted: #7a6656; --line: #eadcc2;
  --accent: #c8102e; --soft: #f5ead5; --field: #fffdf7;
  --on-bg: #fffaf0; --on-bg-muted: #cfe3d6;
  --head: 'Merriweather', Georgia, serif; --head-scale: 1;
  --body: 'Lora', Georgia, serif;
  --field-radius: 8px; --btn-radius: 99px;
  --bar-border: 8px solid transparent;
}
body[data-theme="christmas"] {
  background-image:
    radial-gradient(rgba(255,255,255,.55) 1.6px, transparent 2.2px),
    radial-gradient(rgba(255,255,255,.28) 1px, transparent 1.6px);
  background-size: 70px 70px, 37px 37px;
  background-position: 0 0, 19px 25px;
}
[data-theme="christmas"] .topbar { border-image: repeating-linear-gradient(45deg, #c8102e 0 10px, #fff 10px 20px) 8; }
[data-theme="christmas"] .card { box-shadow: 0 6px 24px rgba(0,0,0,.25); border: 2px solid #d4af37; }

/* ---------- dark mode for the plain look only (the Christmas palette is fixed) ---------- */
@media (prefers-color-scheme: dark) {
  [data-theme="plain"] {
    --bg: #17161a; --card: #211f25; --ink: #f1ede7; --muted: #a59f97; --line: #34313a;
    --accent: #e0606f; --soft: #2a2830; --field: #1b1a1e;
  }
}

/* ---------- layout ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background-color: var(--bg); color: var(--ink); font: 15px/1.55 var(--body); transition: background-color .3s; }
h1, h2, h3, .brand { font-family: var(--head); font-weight: var(--head-weight); line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: calc(2rem * var(--head-scale)); }
h2 { font-size: calc(1.35rem * var(--head-scale)); }
h3 { font-size: calc(1.1rem * var(--head-scale)); }
a { color: var(--accent); text-decoration: none; }
/* small inline links inside sentences: bold accent text, no underline */
.text-link { font-weight: 700; color: var(--accent); }
.text-link:hover { opacity: .8; }
.gift-link { color: var(--ink); }
.gift-link:hover { color: var(--accent); }
.gift-link .ext { width: .62em; height: .62em; margin-left: .3em; vertical-align: .12em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .45; }
.gift-link:hover .ext { opacity: 1; }
/* pill buttons for nav + back links (replaces the underlined link look) */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 99px; border: 0; cursor: pointer;
  background: var(--soft); color: var(--ink); font: 700 .85rem var(--body); text-decoration: none; transition: background .15s, color .15s; }
.pill:hover { background: var(--accent); color: var(--accent-ink); filter: none; }
.ghost-pill { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
main > a.pill { color: var(--ink); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: var(--bar-border); background: var(--card); }
.brand { font-family: 'Dancing Script', cursive; font-weight: 700; font-size: 1.85rem; line-height: 1; color: var(--ink); text-decoration: none; margin: 0; }
#nav { display: flex; gap: 12px; align-items: center; color: var(--muted); }
main { max-width: 880px; margin: 0 auto; padding: 28px 16px 80px; }

/* text sitting directly on the page background (not in a card) */
main > h1, main > p, main > a, .hero h1, .hero .countdown, main > .muted { color: var(--on-bg); }
main > p.muted, .hero .countdown, main > p.muted a { color: var(--on-bg-muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 140px; }

/* ---------- form controls: all follow the theme ---------- */
label { display: block; font: 700 .78rem var(--body); letter-spacing: .02em; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 2px solid var(--line); border-radius: var(--field-radius);
  background-color: var(--field); color: var(--ink); font: 500 .95rem var(--body);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 38px; font-weight: 600;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%),
    linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
select:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
option { background: var(--card); color: var(--ink); font-family: var(--body); }
input[type="checkbox"] { accent-color: var(--accent); width: auto; }
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .6; }

button, .btn {
  cursor: pointer; border: 0; border-radius: var(--btn-radius); padding: 10px 18px;
  font: 700 .9rem var(--body); background: var(--accent); color: var(--accent-ink); white-space: nowrap;
  transition: filter .15s, transform .1s;
}
button:hover, .btn:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }
button.ghost { background: var(--soft); color: var(--ink); }
button.link { background: none; color: var(--muted); padding: 4px 6px; font-weight: 600; }
button.link:hover { color: var(--accent); }
button.small { padding: 6px 10px; font-size: .8rem; }
.auth { max-width: 420px; margin: 40px auto; padding: 32px 28px; text-align: center; }
.signin-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-top: 18px; }
.signin-btn .g { width: 18px; height: 18px; padding: 4px; box-sizing: content-box; background: #fff; border-radius: 50%; }
.error { color: var(--accent); font-size: .9rem; min-height: 1.2em; }

.badge { display: inline-block; padding: 3px 11px; border-radius: 99px; font: 700 .75rem var(--body); text-transform: capitalize; color: #fff; background: var(--other); }
.badge.birthday { background: var(--birthday); } .badge.christmas { background: var(--christmas); }
.badge.hanukkah { background: #1f4fa3; } .badge.valentines { background: #d6284f; }
.badge.easter { background: #8a5cd6; } .badge.graduation { background: #1b2a4a; }

.lists { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.list-card { display: block; text-decoration: none; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--other); border-radius: var(--radius); padding: 16px; transition: transform .1s; }
.list-card:hover { transform: translateY(-2px); }
.list-card.birthday { border-left-color: var(--birthday); } .list-card.christmas { border-left-color: var(--christmas); }
.list-card.hanukkah { border-left-color: #1f4fa3; } .list-card.valentines { border-left-color: #d6284f; }
.list-card.easter { border-left-color: #8a5cd6; } .list-card.graduation { border-left-color: #1b2a4a; }
.list-card .meta { display: flex; justify-content: space-between; margin-top: 10px; color: var(--muted); font-size: .85rem; }

.list-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.total { text-align: right; }
.total .amount { font-family: var(--head); font-weight: var(--head-weight); font-size: calc(2.2rem * var(--head-scale)); color: var(--accent); }
.share { display: flex; gap: 8px; margin-top: 12px; }
.share input { font-size: .85rem; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: .9rem; margin-top: 8px; color: var(--muted); font-weight: 500; letter-spacing: 0; }

.category { margin-bottom: 22px; }
.cat-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-bottom: 2px dashed var(--line); padding-bottom: 6px; margin-bottom: 8px; }
.cat-head .sub { color: var(--muted); font-size: .9rem; }
.gift { display: flex; gap: 10px; align-items: flex-start; padding: 12px 4px; border-bottom: 1px solid var(--line); background: var(--card); }
.gift-list > .gift:last-of-type { border-bottom: 0; }
.gift .gmain { flex: 1; min-width: 0; }
.gift .name { font-weight: 700; font-size: 1.1rem; line-height: 1.35; overflow-wrap: anywhere; }
.gift .gside { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; }
.gift .price { font-weight: 700; font-size: 1.05rem; }
.gift .badges .prio, .gift .badges .rank-badge, .gift .badges .drop-badge { font-size: .68rem; }
.gift .notes { color: var(--muted); font-size: .88rem; margin-top: 2px; }
.gift .actions { display: flex; gap: 4px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; align-items: center; }
.badges .prio { margin-left: 0; }
.prio { font-size: .72rem; font-weight: 700; margin-left: 6px; padding: 1px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); }
.prio.p2 { background: var(--accent); color: #fff; }                 /* Would love: solid red */
.prio.p3 { background: transparent; color: var(--christmas); box-shadow: inset 0 0 0 1.5px var(--christmas); } /* Nice to have: green outline */
.empty { color: var(--muted); font-style: italic; padding: 8px 4px; }
.countdown { font-size: .9rem; color: var(--muted); }
.hero { text-align: center; margin-bottom: 26px; }
.hero h1 { font-size: calc(2.4rem * var(--head-scale)); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--card); padding: 10px 18px; border-radius: 99px; font: 600 .9rem var(--body); }
@media (max-width: 560px) { .total { text-align: left; } h1 { font-size: calc(1.6rem * var(--head-scale)); } }

/* ---------- welcome page ---------- */
.welcome { max-width: 620px; margin: 30px auto; padding: 36px 32px; text-align: center; animation: pop .35s ease-out; }
.welcome-kicker { display: inline-block; margin: 0 0 10px; padding: 4px 14px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font: 700 .78rem var(--body); letter-spacing: .06em; text-transform: uppercase; }
.welcome h1 { color: var(--ink); }
.steps { text-align: left; margin: 20px auto; padding: 0; max-width: 460px; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 10px 0 10px 46px; border-bottom: 1px dashed var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 8px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); color: var(--accent); font: 700 1rem var(--head); }
.welcome-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; align-items: center; margin-top: 22px; }
.welcome-skip { font-weight: 600; padding: 0 8px; }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- themed dropdowns (custom menu over a hidden native select) ---------- */
.dd { position: relative; }
.dd select { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.dd-btn {
  width: 100%; text-align: left; padding: 10px 38px 10px 12px; border: 2px solid var(--line); border-radius: var(--field-radius);
  background-color: var(--field); color: var(--ink); font: 600 .95rem var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
}
.dd-btn:hover { filter: none; border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.dd-btn:active { transform: none; }
.dd.open .dd-btn, .dd-btn:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.dd.open .dd-btn { background-image: linear-gradient(135deg, transparent 50%, var(--accent) 50%), linear-gradient(45deg, var(--accent) 50%, transparent 50%); background-position: calc(100% - 20px) 45%, calc(100% - 14px) 45%; }
.dd-menu {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 100%; max-height: 260px; overflow: auto;
  margin: 0; padding: 6px; list-style: none; background: var(--card); color: var(--ink);
  border: 2px solid var(--line); border-radius: var(--field-radius); box-shadow: 0 12px 30px rgba(0,0,0,.18);
  animation: ddIn .12s ease-out;
}
.dd-menu li { padding: 8px 12px 8px 30px; border-radius: calc(var(--field-radius) - 2px); cursor: pointer; font: 500 .95rem var(--body); position: relative; white-space: nowrap; }
.dd-menu li.active { background: var(--soft); }
.dd-menu li[aria-selected="true"] { color: var(--accent); font-weight: 700; }
.dd-menu li[aria-selected="true"]::before { content: ""; position: absolute; left: 11px; top: 50%; width: 5px; height: 9px; margin-top: -6px;
  border: solid var(--accent); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
body[data-theme="christmas"] .dd-menu { border-color: #d4af37; }
@keyframes ddIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- delete account ---------- */
.small-del { margin: -6px 0 14px; padding: 3px 10px; font-size: .7rem; background: #e3f3e8; color: #2f6b47; box-shadow: none; }
.small-del:hover { background: #a80d26; color: #fff; }
.danger-zone { border: 2px solid color-mix(in srgb, #c8102e 35%, var(--line)); }
.danger-zone h3 { color: #c8102e; }
button.danger { background: #a80d26; color: #fff; }

/* ---------- list / grid switch ---------- */
.gifts-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.gifts-head h2 { margin: 0; }
.gifts-head-share { justify-content: flex-end; }
.view-toggle { display: inline-flex; gap: 2px; padding: 3px; background: var(--soft); border-radius: 99px; }
.view-toggle button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; font-size: .8rem; background: transparent; color: var(--muted); border-radius: 99px; }
.view-toggle button:hover { filter: none; color: var(--ink); }
.view-toggle button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.view-toggle svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.view-toggle button.on svg { stroke: var(--accent); }

/* ---------- grid cards ---------- */
.gift-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 14px; padding: 4px 0 6px; }
@media (max-width: 560px) { .gift-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .gbody { padding: 8px 10px; } .gtop { flex-direction: column; gap: 2px; } .claim-btn { padding: 7px 8px; } }
.gcard { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .12s, box-shadow .12s; }
.gcard:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.12); }
.gcard > a { display: block; }
.thumb { position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: #fff; }
.thumb .art { position: absolute; inset: 0; display: grid; place-items: center;
  background-image: radial-gradient(rgba(255,255,255,.7) 1.2px, transparent 1.7px); background-size: 22px 22px; }
.thumb .art svg { width: 70%; height: 70%; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 10px; }
.gbody { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 10px; flex: 1; }
.gtop { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.gtop .name { font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.gtop .price { font-weight: 700; white-space: nowrap; }
.gbody .notes { color: var(--muted); font-size: .84rem; }
.gfoot { display: flex; align-items: center; margin-top: auto; padding-top: 8px; }
.gfoot .prio { margin-left: 0; padding: 3px 10px; white-space: nowrap; flex-shrink: 0; }
/* Edit / Delete: an even two-button row along the bottom of the card */
.gactions { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.gactions button { padding: 9px 0; border-radius: 0; text-align: center; font-size: .8rem; }
.gactions button + button { border-left: 1px solid var(--line); }
.gactions button:hover { background: var(--soft); }


/* =====================================================================
   New features
   ===================================================================== */
.ico { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.14em; flex-shrink: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.hero-card { text-align: center; }

/* ---------- snow ---------- */
.snow-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 800; }

/* ---------- badges on gifts ---------- */
.rank-badge { font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: #d4af37; color: #2a1a12; white-space: nowrap; }
.drop-badge { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: #e6f4ea; color: #1f6b3c; white-space: nowrap; }
.drop-badge s, .drop-price s { opacity: .6; font-weight: 500; }

/* ---------- drag to reorder ---------- */
.drag-handle, .cat-handle { display: grid; place-items: center; width: 22px; min-height: 28px; cursor: grab; color: var(--muted); opacity: .55; touch-action: none; border-radius: 6px; flex-shrink: 0; }
.drag-handle:hover, .cat-handle:hover { opacity: 1; background: var(--soft); }
.drag-handle svg, .cat-handle svg { width: 10px; height: 16px; fill: currentColor; }
.cat-head h3 { flex: 1; margin: 0; font-family: var(--body); font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); }
.cat-tools { display: flex; align-items: center; gap: 4px; }
.dragging { box-shadow: 0 16px 40px rgba(0,0,0,.28); transform: rotate(1.5deg); opacity: .95; cursor: grabbing; }
.drag-placeholder { border: 2px dashed var(--accent) !important; border-radius: var(--field-radius); background: color-mix(in srgb, var(--accent) 6%, transparent) !important; }
body.is-dragging { user-select: none; cursor: grabbing; }
.gift-box { min-height: 44px; }
.gift-box > .empty { display: none; }
.gift-box:not(:has(> .gift, > .gcard, > .drag-placeholder)) > .empty { display: block; }
.gift-grid > .empty { grid-column: 1 / -1; }
.gcard-pic { position: relative; }
.gcard-lead { position: absolute; top: 8px; left: 8px; background: rgba(255,255,255,.92); border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.gcard-lead .drag-handle { opacity: .8; min-height: 30px; width: 26px; }
.gcard-lead .pick { padding: 6px 7px; display: grid; }

/* ---------- carry forward ---------- */
.pick { display: grid; place-items: center; padding-top: 2px; cursor: pointer; }
.pick input { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; }
.gift.picked, .gcard.picked { background: color-mix(in srgb, var(--accent) 7%, var(--card)); }
.gcard.picked { border-color: var(--accent); }
.select-hint { background: var(--soft); border-radius: var(--field-radius); padding: 8px 12px; font-weight: 600; margin: 0 0 12px; }
.select-bar { position: sticky; bottom: 16px; z-index: 50; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; margin-top: 12px;
  background: var(--card); border: 2px solid var(--accent); border-radius: var(--radius); box-shadow: 0 12px 30px rgba(0,0,0,.25); }
.select-bar #selCount { font-weight: 700; margin-right: auto; }
.select-bar .dd { min-width: 220px; flex: 1 1 220px; }

/* ---------- list page tools ---------- */
.gifts-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.gifts-head { flex-wrap: wrap; }
.pill[disabled] { opacity: .45; cursor: not-allowed; }
.mail-row { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.mail-btn { background: #c8102e; color: #fff; }
.mail-btn[disabled] { opacity: .5; cursor: not-allowed; }
.sent-stamp { display: inline-block; font: 700 .75rem var(--body); letter-spacing: .06em; text-transform: uppercase; color: #c8102e;
  border: 2px solid #c8102e; border-radius: 6px; padding: 3px 10px; transform: rotate(-2deg); }
.sent-stamp.light { color: #fff; border-color: rgba(255,255,255,.8); margin-top: 12px; }
body[data-theme="plain"] .sent-stamp.light { color: #c8102e; border-color: #c8102e; }
.sent-mini { display: inline-block; margin-left: 6px; font: 700 .68rem var(--body); text-transform: uppercase; letter-spacing: .05em; color: #c8102e; }

/* ---------- share card (owner) ---------- */
.link-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* ---------- paste-a-link autofill ---------- */
.autofill { display: flex; gap: 12px; align-items: center; margin-top: 8px; padding: 10px 12px; background: var(--soft); border-radius: var(--field-radius); font-size: .9rem; }
.autofill img { width: 54px; height: 54px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; flex-shrink: 0; }
.spinner { width: 16px; height: 16px; border: 2.5px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- family view ---------- */
.preview-banner { display: flex; gap: 12px; align-items: flex-start; background: #fff4d6; color: #5c4400; border: 2px solid #e8c766; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; }
.preview-banner .ico { width: 20px; height: 20px; margin-top: 2px; }
.secret-banner { display: flex; gap: 14px; align-items: flex-start; background: #eef6f0; color: #173d29; border: 2px solid #9fd0b2; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; }
.secret-banner strong { font-size: 1.05rem; }
.secret-banner p { margin: 4px 0 0; }
.secret-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #1f7a4d; color: #fff; flex-shrink: 0; }
.secret-icon .ico { width: 20px; height: 20px; }
.top-wishes ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.top-wishes li { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.rank-num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #d4af37; color: #2a1a12; font: 700 .85rem var(--body); flex-shrink: 0; }
.share-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.share-tools-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.budget { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 12px; font-size: .8rem; border-radius: 99px; background: var(--soft); color: var(--ink); }
.chip.on { background: var(--accent); color: var(--accent-ink); }
.chip:hover { filter: none; box-shadow: inset 0 0 0 2px var(--accent); }
.claim-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; font-size: .82rem; background: #1f7a4d; color: #fff; }
.claimed { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 99px; background: var(--soft); color: var(--muted); font-weight: 700; font-size: .8rem; white-space: nowrap; }
.claimed.mine { background: #e6f4ea; color: #1f6b3c; }
.is-claimed .gmain, .is-claimed .price, .is-claimed .thumb, .is-claimed .gtop, .is-claimed .notes { opacity: .5; }
.gclaim { margin-top: 8px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.gclaim .claim-btn { width: 100%; justify-content: center; }

/* ---------- price drops card ---------- */
.drops-card h3 { display: flex; align-items: center; gap: 8px; }
.drop-row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); color: var(--ink); }
.drop-row:hover strong { color: var(--accent); }
.drop-price { font-weight: 700; color: #1f6b3c; }

/* ---------- advent calendar ---------- */
.advent-head { display: flex; justify-content: space-between; align-items: baseline; }
.advent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 8px; margin-top: 10px; perspective: 800px; }
/* Each tile is a card with a front (the number) and a back; opening flips it over */
.door { position: relative; aspect-ratio: 1 / 1; padding: 0; background: none; border-radius: 10px; perspective: 600px; color: #fff; font: 700 1.05rem var(--head); }
.door:hover { filter: none; }
.door-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.3,.7,.3,1); border-radius: 10px; }
.door.open .door-inner { transform: rotateY(180deg); }
.door-front, .door-back { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 10px; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.door-front { background: #c8102e; box-shadow: inset 0 0 0 3px rgba(255,255,255,.25); }
.door:nth-child(3n) .door-front { background: #1f7a4d; } .door:nth-child(4n) .door-front { background: #b08d2c; }
.door-back { transform: rotateY(180deg); overflow: hidden; box-shadow: inset 0 0 0 2px var(--line); }
.door .ico { position: absolute; right: 5px; bottom: 5px; width: 10px; height: 10px; opacity: .7; }
.door.locked { opacity: .5; cursor: not-allowed; filter: saturate(.6); }
.door.today .door-front { box-shadow: inset 0 0 0 3px #fff; }
.door.today { box-shadow: 0 0 0 3px #d4af37; animation: doorGlow 1.8s ease-in-out infinite; }
@keyframes doorGlow { 50% { box-shadow: 0 0 14px 4px #d4af37; } }
.advent-reveal { margin-top: 14px; padding: 14px 16px; background: var(--soft); border-radius: var(--field-radius); }
.advent-reveal h4 { margin: 2px 0 6px; font-family: var(--head); font-size: 1.05rem; }
.advent-reveal p { margin: 6px 0 0; }
.reveal-day { font: 700 .72rem var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.reveal-gift .thumb { width: 120px; border-radius: 10px; margin-top: 10px; }
.punchline { font-weight: 700; }
@media (max-width: 560px) { .advent-grid { grid-template-columns: repeat(5, 1fr); } }

/* ---------- ranking game (the letter animations live in fun.css) ---------- */
.rank-box { position: relative; width: min(640px, 100%); background: var(--card); color: var(--ink); border-radius: var(--radius); padding: 26px 24px 20px; box-shadow: 0 20px 50px rgba(0,0,0,.4); }
.rank-x { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; padding: 0; border-radius: 50%; background: var(--soft); color: var(--ink); font-size: 1.3rem; line-height: 1; }
.rank-kicker { margin: 0; font: 700 .75rem var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.rank-box h2 { margin: 4px 0 12px; }
.rank-progress { height: 6px; background: var(--soft); border-radius: 99px; overflow: hidden; margin-bottom: 18px; }
.rank-progress span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.rank-choices { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.rank-or { font: 700 .9rem var(--head); color: var(--muted); }
.rank-choice { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; border: 3px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); transition: transform .12s, border-color .12s; }
.rank-choice:hover, .rank-choice:focus-visible { border-color: var(--accent); transform: translateY(-3px); }
.rank-choice .thumb { aspect-ratio: 4 / 3; }
.rank-name { padding: 10px 12px; font: 700 .95rem var(--body); text-align: center; }
.rank-foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.rank-foot [disabled] { opacity: .4; cursor: default; }
.rank-results { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; max-height: 50vh; overflow: auto; }
.rank-results li { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.small-note { font-size: .85rem; margin: 10px 0 0; }
@media (max-width: 560px) { .rank-choices { grid-template-columns: 1fr 1fr; } .rank-or { display: none; } }

/* ---------- single family link ---------- */
.share-card .link-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.share-card .link-top h3 { margin: 0; }
#delList.small-del { margin: 4px 0 0; }
.error:empty { min-height: 0; margin: 0; }
button.claimed.mine { cursor: pointer; border: 0; }
button.claimed.mine:hover { filter: none; box-shadow: inset 0 0 0 2px #1f6b3c; }

/* ---------- page transitions ---------- */
#app { transition: opacity .16s ease, transform .16s ease; }
#app.leaving { opacity: 0; transform: translateY(6px); pointer-events: none; }

/* ---------- styled popups (replace the browser's plain confirm/prompt boxes) ---------- */
.popup-back { position: fixed; inset: 0; z-index: 960; display: grid; place-items: center; padding: 16px; background: rgba(10, 25, 18, .55); backdrop-filter: blur(2px); }
.popup { width: min(400px, 100%); background: var(--card); color: var(--ink); border: 2px solid var(--line); border-radius: var(--radius); padding: 22px 22px 18px; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
body[data-theme="christmas"] .popup { border-color: #d4af37; }
.popup h3 { margin: 0 0 8px; font-size: 1.2rem; }
.popup p { margin: 0 0 16px; color: var(--muted); }
.popup-input { margin: 4px 0 16px; }
.popup-actions { display: flex; justify-content: flex-end; gap: 8px; }

.popup-check { display: flex; gap: 10px; align-items: flex-start; margin: -4px 0 16px; padding: 10px 12px; background: var(--soft); border-radius: var(--field-radius);
  font: 500 .9rem/1.4 var(--body); color: var(--ink); letter-spacing: 0; cursor: pointer; }
.popup-check input { width: 18px; height: 18px; margin-top: 1px; flex-shrink: 0; accent-color: var(--accent); }

/* gifts someone's already getting: just faded, never crossed out */
.gcard.is-claimed .gfoot { opacity: .5; }
/* "Already being wrapped" fills the card's width and wraps neatly instead of getting cut off */
.gclaim .claimed { width: 100%; justify-content: center; text-align: center; white-space: normal; line-height: 1.25; padding: 8px 10px; }
.gclaim button.claimed.mine { width: 100%; justify-content: center; }

.sale-flag { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 4px; padding: 3px 10px; border-radius: 99px; background: #e6f4ea; color: #1f6b3c; font-weight: 700; font-size: .85rem; }
.sale-flag s { opacity: .6; font-weight: 500; }
