/* Base styles, mobile-first. Festive polish comes in feature/festive-styling. */

:root {
  --red: #b3122e;
  --red-dark: #8a0d23;
  --red-deep: #6e0a1c;
  --green: #1f7a3d;
  --green-dark: #155a2c;
  --gold: #f4c542;
  --gold-soft: #f8e3a3;
  --cream: #fbf6ee;
  --ink: #2b2220;
  --muted: #6b5f5a;
  --card: #ffffff;
  --line: #eadfd2;
  --radius: 14px;
  --gutter: 16px;
  --accent: var(--red);
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --shadow: 0 1px 2px rgba(60, 30, 20, 0.06), 0 4px 14px rgba(60, 30, 20, 0.06);
}

* { box-sizing: border-box; }

/* The hidden attribute always hides, even on elements with their own
   display style (flex rows, grid fields and so on). */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* A faint scatter of snowflakes on the page background. */
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cg fill='none' stroke='%23b3122e' stroke-opacity='.06' stroke-width='1.4' stroke-linecap='round'%3E%3Cpath d='M30 18v24M18 30h24M21.5 21.5l17 17M38.5 21.5l-17 17'/%3E%3Cpath d='M120 98v20M110 108h20M113 101l14 14M127 101l-14 14'/%3E%3C/g%3E%3Ccircle cx='96' cy='34' r='2' fill='%231f7a3d' fill-opacity='.08'/%3E%3Ccircle cx='46' cy='122' r='2.5' fill='%23f4c542' fill-opacity='.18'/%3E%3C/svg%3E"),
    var(--cream);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1, h2, h3, .dialog h2 { font-family: var(--font-display); letter-spacing: -0.01em; }

.site-header {
  position: relative;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cg fill='none' stroke='%23fff' stroke-opacity='.13' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M24 10v28M10 24h28M14 14l20 20M34 14L14 34'/%3E%3Cpath d='M92 74v20M82 84h20M85 77l14 14M99 77L85 91'/%3E%3C/g%3E%3Ccircle cx='80' cy='22' r='2' fill='%23fff' fill-opacity='.25'/%3E%3Ccircle cx='30' cy='96' r='1.5' fill='%23fff' fill-opacity='.3'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 50% -20%, #d0213f 0%, var(--red) 45%, var(--red-deep) 100%);
  color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 22px) var(--gutter) 22px;
  text-align: center;
}

.site-header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.15;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.tagline {
  margin: 6px 0 0;
  font-size: 0.95rem;
  opacity: 0.9;
}

/* Tabs */

.tabs {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  gap: 4px;
  padding: 8px var(--gutter) 0;
  /* A little bauble garland along the top of the tabs. */
  background:
    radial-gradient(circle at 12px 0, var(--gold) 3px, transparent 3.5px) 0 0 / 48px 6px repeat-x,
    radial-gradient(circle at 36px 0, #e8f3ec 3px, transparent 3.5px) 0 0 / 48px 6px repeat-x,
    var(--red-dark);
  overflow-x: auto;
}

.tab {
  flex: 1 1 0;
  min-width: 0;
  padding: 12px 8px;
  border: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.tab:hover { background: rgba(255, 255, 255, 0.12); }

.tab[aria-selected="true"] {
  background: var(--cream);
  box-shadow: inset 0 3px 0 var(--accent);
  color: var(--accent);
}

.tab:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: -3px;
}

/* Panels */

main {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 20px var(--gutter);
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 1.4rem;
  color: var(--ink);
}

.panel h2::after {
  content: "";
  display: block;
  width: 48px;
  height: 3px;
  margin-top: 4px;
  border-radius: 2px;
  background: var(--accent);
}

.placeholder {
  padding: 32px 24px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  text-align: center;
}

.placeholder::before {
  content: "\1F384";
  display: block;
  margin-bottom: 6px;
  font-size: 2rem;
}

.site-footer {
  padding: 24px var(--gutter) calc(env(safe-area-inset-bottom, 0px) + 20px);
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

.site-footer p { margin: 0; }

@media (min-width: 640px) {
  .site-header h1 { font-size: 2.4rem; }
  .tabs { justify-content: center; }
  .tab { flex: 0 0 auto; padding: 12px 28px; }
}

/* Lists and status messages */

.status {
  margin: 0;
  padding: 16px 0;
  color: var(--muted);
  text-align: center;
}

.status-error { color: var(--red-dark); font-weight: 600; }

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 12px;
}

.panel-head h2 { margin: 0; }

/* Item cards */

.items {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.item {
  display: flex;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(234, 223, 210, 0.7);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.item:focus-visible { outline: 3px solid var(--gold); }

.item-photo {
  flex: 0 0 auto;
  width: 84px;
  height: 84px;
  border-radius: 8px;
  background: #f1ebe3;
  object-fit: cover;
}

.item-body { flex: 1; min-width: 0; }

.item-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px 10px;
}

.item-name {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.item-name a { color: var(--ink); }
.item-name a:hover { color: var(--red); }

.item-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 600;
}

.item-details {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
}

.item-details li {
  padding: 2px 8px;
  border-radius: 6px;
  background: #f4efe8;
}

.item-notes {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.item-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.badge {
  flex: 0 0 auto;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-really-want { background: #fde3e7; color: var(--red-dark); }
.badge-would-like { background: #e8f3ec; color: var(--green); }
.badge-nice-to-have { background: #f1ede6; color: var(--muted); }

@media (min-width: 640px) {
  .item-photo { width: 110px; height: 110px; }
}

/* Account bar */

.account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 10px;
  max-width: 720px;
  margin: 14px auto 0;
  font-size: 0.95rem;
}

/* Signed-out options and the guest form keep their own stacked layout. */
.account > .account-prompt,
.account > .account-notice,
.account > .guest-form { flex-basis: 100%; }

.account .guest-form { max-width: 480px; margin: 0 auto; }

.link-button {
  padding: 4px 6px;
  border: 0;
  background: none;
  color: #fff;
  font: inherit;
  font-size: 0.875rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.85;
  cursor: pointer;
}

.link-button:hover { opacity: 1; }
.link-button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

.account p { margin: 0 0 8px; }

.account-options,
.guest-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.account-who { margin: 0 4px 0 0 !important; }

.account-notice,
.account-error {
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--red-dark);
  font-weight: 600;
}

.account-error { margin: 8px 0 0 !important; }

.google-button { min-height: 40px; }

.guest-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.guest-form input {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  font: inherit;
}

.guest-form input:focus-visible { outline: 3px solid var(--gold); }

.guest-actions { justify-content: flex-start; }

/* Buttons */

.btn {
  padding: 9px 18px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn:disabled { opacity: 0.7; cursor: default; }

.btn:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.btn-light {
  background: rgba(255, 255, 255, 0.95);
  color: var(--red-dark);
}

.btn-gold {
  background: var(--gold);
  color: var(--ink);
}

.site-footer a { color: inherit; }

.btn-red { background: var(--red); color: #fff; }
.btn-red:hover:not(:disabled) { background: var(--red-dark); }

.btn-outline {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--red);
  color: var(--red);
}

.btn-plain {
  background: transparent;
  color: var(--muted);
}

.btn-plain:hover { color: var(--ink); }

.btn-small { padding: 5px 14px; font-size: 0.875rem; }

/* Dialogs */

.dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.dialog-small { width: min(400px, calc(100vw - 24px)); }

.dialog::backdrop { background: rgba(43, 34, 32, 0.55); }

.dialog form { padding: 20px; }

.dialog h2 { margin: 0 0 16px; font-size: 1.25rem; }

.dialog-actions {
  position: sticky;
  bottom: -20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin: 16px -20px -20px;
  padding: 12px 20px;
  background: var(--cream);
  border-top: 1px solid #eadfd2;
}

.item-form { display: grid; gap: 14px; }

.field {
  display: grid;
  gap: 4px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field > span,
.field > legend {
  padding: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.req {
  color: var(--red);
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 400;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #d9cbbb;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.field textarea { resize: vertical; }

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible,
.choices input:focus-visible,
.check input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 1px;
}

.field input:disabled { background: #f1ebe3; color: var(--muted); }

.row {
  display: grid;
  gap: 14px;
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 2px;
}

.choices label,
.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.choices input,
.check input { width: 18px; height: 18px; accent-color: var(--red); }

.row-quantity { align-items: end; }
.check { min-height: 42px; }

.form-error {
  flex: 1 0 100%;
  margin: 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: #fde3e7;
  color: var(--red-dark);
  font-weight: 600;
}

@media (min-width: 520px) {
  .row { grid-template-columns: 1fr 1fr; }
}

/* Currency preference */

.price-pref {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2px 12px;
  max-width: 960px;
  margin: 0 auto;
  padding: 10px var(--gutter) 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.price-pref .check { min-height: 0; }
.price-pref .check input { width: 16px; height: 16px; }

/* Link auto-fill */

.field > label { font-size: 0.9rem; font-weight: 600; }

.hint {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
}

.link-row {
  display: flex;
  gap: 8px;
}

.link-row input { flex: 1; min-width: 0; }
.link-row .btn { flex: 0 0 auto; }

.fetch-status {
  margin: 4px 0 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: #e8f3ec;
  color: var(--green);
  font-size: 0.875rem;
}

.fetch-status.fetch-error { background: #fde3e7; color: var(--red-dark); }

.photo-preview {
  width: 120px;
  height: 120px;
  margin-top: -4px;
  border-radius: 8px;
  background: #f1ebe3;
  object-fit: cover;
}

/* Helper items */

.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.badge-secret { background: #fff3cd; color: #7a5300; }

.secret-option {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff8e1;
}

.secret-option .hint { margin: 2px 0 0 26px; }

/* In-store items */



.segmented { flex-wrap: wrap; border-radius: 18px; }

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: #efe6db;
}

.segmented label { position: relative; cursor: pointer; }

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: block;
  padding: 7px 16px;
  border-radius: 999px;
  font-weight: 600;
}

.segmented input:checked + span {
  background: var(--red);
  color: #fff;
}

.segmented input:focus-visible + span { outline: 3px solid var(--gold); }

.field-label { font-size: 0.9rem; font-weight: 600; }

.photo-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.photo-status {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.photo-status.fetch-error {
  padding: 6px 10px;
  border-radius: 8px;
  background: #fde3e7;
  color: var(--red-dark);
}

/* Sizes card */

.sizes-card {
  margin-bottom: 14px;
  padding: 0 14px;
  border: 1px solid #eadfd2;
  border-radius: var(--radius);
  background: #fffdf9;
}

.sizes-card summary {
  padding: 12px 0;
  font-weight: 700;
  cursor: pointer;
}

.sizes-card summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.sizes-card dl {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px 16px;
  margin: 0 0 12px;
}

.sizes-card dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sizes-card dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.sizes-important {
  padding: 6px 8px;
  border-radius: 8px;
  background: #fde3e7;
}

.sizes-important dt { color: var(--red-dark); }

.sizes-empty { margin: 0 0 12px; color: var(--muted); }

.sizes-card > .btn { margin-bottom: 12px; }

/* Claiming */

/* Claimed items are toned down with solid colours (not transparency) so
   their text still meets contrast guidelines. */
.item-claimed { background: #f3efe9; box-shadow: none; }
.item-claimed .item-photo { filter: grayscale(0.85); opacity: 0.7; }
.item-claimed .item-name,
.item-claimed .item-name a { color: #5c524d; }
.item-claimed .item-meta,
.item-claimed .item-notes { color: #6b5f5a; }
.item-claimed .item-details li { background: #ebe5dd; color: #5c524d; }

.badge-claimed { background: #5f5650; color: #fff; }

.claim-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 10px;
}

.claim-status {
  color: var(--green);
  font-size: 0.875rem;
  font-weight: 600;
}


.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  z-index: 10;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transform: translateX(-50%);
}

.toast-error { background: var(--red-dark); }

.dialog-body { padding: 20px; }
.dialog-body .hint { margin: -8px 0 12px; }

.my-claims {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.my-claims li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--card);
}

.my-claims-removed {
  margin: 4px 0 0;
  color: var(--red-dark);
  font-size: 0.85rem;
}

/* Helper page */

.helper-person + .helper-person { margin-top: 18px; }
.helper-person h3 { margin: 0 0 8px; font-size: 1.05rem; }

.helper-items {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.helper-items li {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--card);
}

.helper-item-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 10px;
}

.helper-who { margin: 4px 0 0; color: var(--green); font-weight: 600; }
.helper-flags { justify-content: flex-start; margin-top: 6px; }

.badge-shop { background: #e3eefc; color: #1d4f91; }
.badge-removed { background: #eee; color: var(--muted); }

/* Price filter & gift kinds */

.price-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 960px;
  margin: 0 auto;
  padding: 12px var(--gutter) 0;
}

.price-filter-label { color: var(--muted); font-size: 0.875rem; font-weight: 600; }

.chip {
  padding: 5px 12px;
  border: 1px solid #d9cbbb;
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.chip[aria-pressed="true"] { border-color: var(--red); background: var(--red); color: #fff; }
.chip:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.badge-kind { background: #ece6f7; color: #4b2f86; }

#kind-hint { margin: 6px 0 0; }

/* Festive states: loading, error, placeholders, reduced motion */

.field input::placeholder,
.field textarea::placeholder { color: #776c67; }

.skeleton-list { display: grid; gap: 12px; }

.skeleton {
  display: flex;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.skeleton-photo,
.skeleton-line {
  border-radius: 8px;
  background: linear-gradient(90deg, #f1ebe3 0%, #f8f3ec 50%, #f1ebe3 100%) 0 0 / 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-photo { flex: 0 0 84px; height: 84px; }
.skeleton-lines { display: grid; flex: 1; gap: 10px; align-content: start; padding-top: 4px; }
.skeleton-line { height: 14px; }
.skeleton-line:nth-child(1) { width: 60%; height: 18px; }
.skeleton-line:nth-child(2) { width: 35%; }
.skeleton-line:nth-child(3) { width: 80%; }

@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

.error-card {
  padding: 24px;
  border: 1px solid #f3c4cc;
  border-radius: var(--radius);
  background: #fff6f7;
  color: var(--red-dark);
  text-align: center;
}

.error-card p { margin: 0 0 12px; font-weight: 600; }

.add-item { background: var(--accent); }
.add-item:hover:not(:disabled) { background: var(--accent); filter: brightness(0.9); }

.site-footer p::before { content: "\2744\FE0F  "; }

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

.size-suggest { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.chip-small { padding: 2px 10px; font-size: 0.8rem; }

/* ---------------------------------------------------------------------
   Animated header scenes (js/scenes.js). Characters cross a strip at the
   bottom of the header, below the title and account bar, and never take
   taps. Transform/opacity animations only.
   --------------------------------------------------------------------- */

.site-header { padding-bottom: 82px; overflow: hidden; }
.site-header > *:not(.scene) { position: relative; z-index: 1; }

.scene {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 76px;
  pointer-events: none;
  overflow: hidden;
}

/* A soft snowy ground for the characters to walk on. */
.scene::after {
  content: "";
  position: absolute;
  left: -5%;
  right: -5%;
  bottom: -14px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}

/* Each walker spans the strip; translating it by 100% moves its character
   from just off the left edge to just off the right. */
.walker {
  position: absolute;
  inset: 0;
  animation: cross 16s linear infinite;
}

.walker > svg { position: absolute; bottom: 4px; left: -120px; }

@keyframes cross {
  from { transform: translateX(0); }
  to { transform: translateX(calc(100% + 130px)); }
}

/* Pig elves: three waddling in a row. Negative delays start every scene
   part-way through, so a character is on screen as soon as a tab opens. */
.walker-pig > svg { width: 56px; height: 62px; }
.walker-pig.walker-0 { animation-delay: -2.5s; }
.walker-pig.walker-1 { animation-delay: -5.3s; }
.walker-pig.walker-2 { animation-delay: -10.6s; }
.walker-pig.walker-1 > svg { bottom: 7px; }

.pig { transform-origin: 50% 100%; animation: waddle 0.55s ease-in-out infinite alternate; }
.pig .leg { transform-box: fill-box; transform-origin: 50% 0; animation: step 0.55s ease-in-out infinite alternate; }
.pig .leg-front { animation-direction: alternate-reverse; }

@keyframes waddle {
  from { transform: rotate(-5deg) translateY(0); }
  to { transform: rotate(5deg) translateY(-2px); }
}

@keyframes step {
  from { transform: rotate(-18deg); }
  to { transform: rotate(18deg); }
}

/* The alien drifts slowly across, bobbing, lifting its present. */
.walker-alien { animation-duration: 26s; animation-delay: -9s; }
.walker-alien > svg { width: 92px; height: 80px; bottom: 0; animation: bob 2.4s ease-in-out infinite alternate; }
.alien .hover-glow { transform-box: fill-box; transform-origin: center; animation: glow 1.2s ease-in-out infinite alternate; }
.alien .force-present { animation: levitate 1.6s ease-in-out infinite alternate; }
.alien .force-lines { animation: twinkle 0.8s ease-in-out infinite alternate; }

@keyframes bob {
  from { transform: translateY(0); }
  to { transform: translateY(-6px); }
}

@keyframes glow {
  from { transform: scaleX(0.8); opacity: 0.35; }
  to { transform: scaleX(1.1); opacity: 0.7; }
}

@keyframes levitate {
  from { transform: translateY(2px) rotate(-4deg); }
  to { transform: translateY(-5px) rotate(4deg); }
}

@keyframes twinkle {
  from { opacity: 0.2; }
  to { opacity: 1; }
}

/* E-bikes zoom across; the second pops a wheelie with a present. */
.walker-bike { animation-duration: 7s; animation-delay: -1.2s; }
.walker-bike.walker-1 { animation-delay: -3.6s; }
.walker-bike > svg { width: 88px; height: 52px; }
.bike .spokes { animation: spin 0.45s linear infinite; }
.bike-wheelie .bike-body { transform-box: view-box; transform-origin: 28px 67px; animation: wheelie 1.4s ease-in-out infinite alternate; }

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes wheelie {
  from { transform: rotate(-6deg); }
  to { transform: rotate(-20deg); }
}

@media (min-width: 640px) {
  .site-header { padding-bottom: 96px; }
  .scene { height: 92px; }
  .walker-pig > svg { width: 68px; height: 75px; }
  .walker-alien > svg { width: 112px; height: 97px; }
  .walker-bike > svg { width: 108px; height: 63px; }
  .walker { animation-duration: 22s; }
  .walker-pig.walker-0 { animation-delay: -3.5s; }
  .walker-pig.walker-1 { animation-delay: -10.8s; }
  .walker-pig.walker-2 { animation-delay: -18.1s; }
  .walker-alien { animation-duration: 34s; animation-delay: -12s; }
  .walker-bike { animation-duration: 9s; animation-delay: -1.5s; }
  .walker-bike.walker-1 { animation-delay: -6s; }
}

/* ---- Claim celebrations ---- */

.celebration {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  pointer-events: none;
  overflow: hidden;
}

.celebrate-star svg { width: 170px; height: auto; display: block; }

.celebration-pigs .celebrate-star { animation: pop-wiggle 2.3s ease-in-out forwards; }

@keyframes pop-wiggle {
  0% { transform: scale(0) rotate(0); opacity: 0; }
  12% { transform: scale(1.15) rotate(-12deg); opacity: 1; }
  24% { transform: scale(1) rotate(12deg); }
  36% { transform: rotate(-12deg); }
  48% { transform: rotate(12deg); }
  60% { transform: rotate(-8deg); }
  72% { transform: rotate(0); opacity: 1; }
  100% { transform: translateY(-30px) scale(0.9); opacity: 0; }
}

.confetti {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  opacity: 0;
  animation: burst 2.1s cubic-bezier(0.15, 0.7, 0.4, 1) forwards;
}

@keyframes burst {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(var(--dx), calc(var(--dy) + 160px)) rotate(var(--spin)); opacity: 0; }
}

.celebration-alien .celebrate-star { animation: rise-in 2.3s ease-out forwards; }
.celebrate-lift { position: absolute; left: 50%; top: 50%; width: 70px; margin-left: -35px; animation: force-lift 2.3s ease-in-out forwards; }
.celebrate-lift svg { width: 70px; height: 70px; display: block; filter: drop-shadow(0 0 12px rgba(244, 197, 66, 0.9)); }

.sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f4c542;
  box-shadow: 0 0 8px #f4c542;
  animation: twinkle 0.4s ease-in-out infinite alternate;
}
.sparkle:nth-child(1) { left: -10px; top: 10px; }
.sparkle:nth-child(2) { left: 74px; top: 6px; animation-delay: 0.1s; }
.sparkle:nth-child(3) { left: 30px; top: -12px; animation-delay: 0.2s; }
.sparkle:nth-child(4) { left: -4px; top: 56px; animation-delay: 0.15s; }
.sparkle:nth-child(5) { left: 70px; top: 58px; animation-delay: 0.05s; }
.sparkle:nth-child(6) { left: 34px; top: 78px; animation-delay: 0.25s; }

@keyframes rise-in {
  0% { transform: translateY(40vh); opacity: 0; }
  25% { transform: translateY(12vh); opacity: 1; }
  80% { transform: translateY(12vh); opacity: 1; }
  100% { transform: translateY(16vh); opacity: 0; }
}

@keyframes force-lift {
  0%, 25% { transform: translateY(0) scale(0.6); opacity: 0; }
  35% { opacity: 1; }
  85% { transform: translateY(-28vh) scale(1.2) rotate(8deg); opacity: 1; }
  100% { transform: translateY(-34vh) scale(1.2) rotate(-6deg); opacity: 0; }
}

.celebration-bikes .celebrate-star { animation: zoom-skid 2.3s cubic-bezier(0.3, 0.6, 0.4, 1) forwards; }
.celebration-bikes .celebrate-star svg { width: 210px; }

@keyframes zoom-skid {
  0% { transform: translateX(-70vw) rotate(0); opacity: 1; }
  30% { transform: translateX(-6vw) rotate(-22deg); }
  45% { transform: translateX(4vw) rotate(-22deg); }
  58% { transform: translateX(10vw) rotate(6deg); }
  66% { transform: translateX(8vw) rotate(0); }
  85% { transform: translateX(8vw) rotate(0); opacity: 1; }
  100% { transform: translateX(80vw) rotate(0); opacity: 0; }
}

.puff {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  margin-top: 40px;
  border-radius: 50%;
  background: rgba(220, 214, 208, 0.9);
  opacity: 0;
  animation: puff 2.3s ease-out forwards;
}
.puff:nth-of-type(1) { margin-left: -40px; animation-delay: 0.05s; }
.puff:nth-of-type(2) { margin-left: -10px; animation-delay: 0.12s; }
.puff:nth-of-type(3) { margin-left: 20px; animation-delay: 0.2s; }
.puff:nth-of-type(4) { margin-left: -60px; animation-delay: 0.28s; }

@keyframes puff {
  0%, 50% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(2.2) translateY(-20px); opacity: 0; }
}

/* Reduced motion: still scenes, characters spread across the strip. */
@media (prefers-reduced-motion: reduce) {
  .scene *, .scene *::before, .scene *::after { animation: none !important; }
  .walker { transform: none; }
  .walker > svg { left: auto; }
  .walker-pig.walker-0 > svg { left: 10%; }
  .walker-pig.walker-1 > svg { left: 44%; }
  .walker-pig.walker-2 > svg { left: 76%; }
  .walker-alien > svg { left: 62%; }
  .walker-bike.walker-0 > svg { left: 14%; }
  .walker-bike.walker-1 > svg { left: 64%; }
}
