/* ——— Elle's Christmas Village ——— */

:root {
  --pine: #0d3527;
  --pine-deep: #082419;
  --pine-light: #17553f;
  --cranberry: #c22f3c;
  --cranberry-deep: #9e2430;
  --gold: #e9b949;
  --gold-soft: #f6d98a;
  --cream: #fdf6e9;
  --cream-dim: #f3e8d2;
  --ink: #2b2118;
  --ink-soft: #6b5d4d;
  --snow: #ffffff;
  --shadow: 0 10px 24px rgba(4, 20, 13, 0.35);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: 'Quicksand', 'Segoe UI', system-ui, sans-serif;
  background:
    radial-gradient(1200px 500px at 50% -100px, #1b5c44 0%, transparent 60%),
    linear-gradient(180deg, var(--pine) 0%, var(--pine-deep) 100%);
  background-attachment: fixed;
  color: var(--cream);
  min-height: 100vh;
}

/* ——— Snowfall ——— */
#snow { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
.flake {
  position: absolute; top: -5vh; color: #fff; opacity: 0.8;
  animation: fall linear infinite;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
}
@keyframes fall {
  0%   { transform: translateY(-5vh) translateX(0)    rotate(0deg); }
  50%  { transform: translateY(50vh) translateX(2.5vw) rotate(180deg); }
  100% { transform: translateY(108vh) translateX(-1vw) rotate(360deg); }
}

/* ——— String lights ——— */
.lights { display: flex; justify-content: center; gap: 26px; padding: 14px 0 2px; position: relative; }
.lights::before {
  content: ''; position: absolute; top: 12px; left: 5%; right: 5%; height: 14px;
  border: 0; border-top: 2px solid rgba(255, 255, 255, 0.25); border-radius: 50%;
}
.bulb {
  width: 12px; height: 16px; border-radius: 45% 45% 50% 50%;
  animation: twinkle 1.6s ease-in-out infinite; position: relative; top: 6px;
}
.bulb::before {
  content: ''; position: absolute; top: -4px; left: 3.5px; width: 5px; height: 5px;
  background: #3d5245; border-radius: 2px;
}
.bulb.red    { background: #ff5a5a; box-shadow: 0 0 12px #ff5a5a; }
.bulb.gold   { background: var(--gold); box-shadow: 0 0 12px var(--gold); animation-delay: .4s; }
.bulb.green  { background: #5ad17e; box-shadow: 0 0 12px #5ad17e; animation-delay: .8s; }
.bulb.blue   { background: #6ab2ff; box-shadow: 0 0 12px #6ab2ff; animation-delay: 1.2s; }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* ——— Header ——— */
header { text-align: center; padding: 0 16px 8px; position: relative; z-index: 2; }
h1 {
  font-family: 'Mountains of Christmas', 'Comic Sans MS', cursive;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  margin: 6px 0 0;
  color: var(--cream);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.25), 0 0 30px rgba(233, 185, 73, 0.35);
}
h1 .holly { font-size: 0.8em; }
.tagline { margin: 4px 0 14px; color: var(--gold-soft); font-style: italic; opacity: 0.9; }

.stats { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.stat {
  background: rgba(255, 255, 255, 0.09); border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: 0.9rem;
  backdrop-filter: blur(4px);
}

/* ——— Toolbar ——— */
main { max-width: 1180px; margin: 0 auto; padding: 18px 20px 80px; position: relative; z-index: 2; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 20px;
  backdrop-filter: blur(6px);
}

.tabs { display: flex; gap: 4px; background: rgba(0, 0, 0, 0.25); border-radius: 999px; padding: 4px; }
.tab {
  border: 0; background: transparent; color: var(--cream); font: inherit; font-weight: 700;
  padding: 7px 16px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.tab.active { background: var(--cranberry); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }

.toolbar input[type="search"], .toolbar select {
  font: inherit; font-weight: 600; color: var(--ink);
  background: var(--cream); border: 0; border-radius: 10px; padding: 8px 12px;
  max-width: 170px;
}
.toolbar input[type="search"] { flex: 1 1 150px; min-width: 130px; }

.btn {
  font: inherit; font-weight: 700; cursor: pointer; border: 0; border-radius: 12px;
  padding: 9px 16px; transition: transform 0.1s ease, filter 0.15s ease; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--cranberry); color: #fff; box-shadow: 0 3px 10px rgba(194, 47, 60, 0.4); }
.btn-gold { background: var(--gold); color: var(--ink); box-shadow: 0 3px 10px rgba(233, 185, 73, 0.35); }
.btn-ghost { background: rgba(255, 255, 255, 0.12); color: var(--cream); }
.btn-small { padding: 5px 10px; border-radius: 9px; font-size: 0.82rem; }
.btn-danger { background: transparent; color: var(--cranberry); border: 1.5px solid var(--cranberry); }
.btn-link { background: none; color: var(--ink-soft); text-decoration: underline; padding: 4px; }

/* ——— Buckets ——— */
.bucket { margin-bottom: 28px; }
.bucket[hidden] { display: none; }
.bucket-title {
  font-family: 'Mountains of Christmas', cursive;
  font-size: clamp(1.5rem, 4vw, 1.95rem); font-weight: 700; color: var(--cream);
  margin: 0 0 12px; display: flex; align-items: baseline; gap: 10px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}
.bucket-count {
  font-family: 'Quicksand', sans-serif; font-size: 0.8rem; font-weight: 700;
  color: var(--ink); background: var(--gold-soft);
  padding: 2px 10px; border-radius: 999px;
}

/* ——— Cards ——— */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
}

.card {
  background: var(--cream); color: var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column;
  position: relative; transition: transform 0.15s ease;
}
.card:hover { transform: translateY(-3px); }

.card-img { position: relative; aspect-ratio: 4 / 3; background: var(--cream-dim); overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ribbon {
  position: absolute; top: 12px; left: -34px; transform: rotate(-45deg);
  width: 130px; text-align: center; font-size: 0.72rem; font-weight: 800;
  padding: 4px 0; letter-spacing: 0.04em; color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.ribbon.wish { background: var(--gold); color: var(--ink); }
.ribbon.claimed { background: var(--cranberry); }

.badge-lit {
  position: absolute; bottom: 8px; right: 8px; font-size: 0.72rem; font-weight: 800;
  background: rgba(43, 33, 24, 0.75); color: var(--gold-soft);
  padding: 4px 9px; border-radius: 999px; backdrop-filter: blur(3px);
}
.badge-lit .dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 8px 2px var(--gold);
  animation: twinkle 1.8s ease-in-out infinite; margin-right: 4px; vertical-align: 1px;
}

.card-body { padding: 12px 14px 8px; flex: 1; }
.card-body h3 {
  margin: 0 0 4px; font-size: 1.05rem; line-height: 1.25;
  font-family: 'Quicksand', sans-serif; font-weight: 700;
}
.card-body h3 a { color: inherit; text-decoration: none; }
.card-body h3 a:hover { color: var(--cranberry); text-decoration: underline; }
.meta { font-size: 0.82rem; color: var(--ink-soft); margin-bottom: 8px; }
.meta .set { font-style: italic; }

.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  font-size: 0.72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: #e7f0e6; color: var(--pine-light); border: 1px solid #cfe0cd;
}
.chip.brand { background: #fbeaea; color: var(--cranberry-deep); border-color: #f0cfcf; }
.chip.village { background: #eae8f7; color: #4c4290; border-color: #d5d1ee; }

.claim-note {
  margin: 8px 0 0; font-size: 0.8rem; font-weight: 700; color: var(--cranberry-deep);
  background: #fbeaea; border-radius: 9px; padding: 6px 9px;
}

.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px 12px; gap: 8px;
}
.price { font-weight: 800; color: var(--pine-light); font-size: 0.95rem; }
.card-actions { display: flex; gap: 5px; }
.icon-btn {
  border: 0; background: var(--cream-dim); border-radius: 9px; cursor: pointer;
  font-size: 0.95rem; padding: 5px 8px; transition: background 0.15s;
}
.icon-btn:hover { background: #e8d9bd; }

/* ——— Empty state ——— */
.empty {
  text-align: center; padding: 60px 20px; color: var(--gold-soft);
}
.empty .big { font-size: 3rem; margin-bottom: 10px; }

/* ——— Dialogs ——— */
dialog {
  border: 0; border-radius: var(--radius); padding: 0;
  background: var(--cream); color: var(--ink);
  width: min(560px, 92vw); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
dialog::backdrop { background: rgba(5, 22, 15, 0.65); backdrop-filter: blur(3px); }
.dialog-inner { padding: 22px 24px; }
dialog h2 {
  font-family: 'Mountains of Christmas', cursive; margin: 0 0 14px;
  color: var(--cranberry-deep); font-size: 1.7rem;
}

.fetch-row { display: flex; gap: 8px; margin-bottom: 6px; }
.fetch-row input { flex: 1; }
.hint { font-size: 0.78rem; color: var(--ink-soft); margin: 0 0 14px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.form-grid .full { grid-column: 1 / -1; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; font-weight: 700; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  font: inherit; padding: 8px 10px; border: 1.5px solid #ddd0b8; border-radius: 10px;
  background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--gold); border-color: var(--gold);
}
.field textarea { resize: vertical; min-height: 56px; }

.status-row { display: flex; gap: 8px; align-items: center; }
.status-pill { flex: 1; }
.status-pill input { display: none; }
.status-pill span {
  display: block; text-align: center; padding: 8px; border-radius: 10px; font-weight: 700;
  border: 1.5px solid #ddd0b8; cursor: pointer; font-size: 0.88rem;
}
.status-pill input:checked + span { background: var(--pine-light); color: #fff; border-color: var(--pine-light); }
.status-pill.wish input:checked + span { background: var(--gold); color: var(--ink); border-color: var(--gold); }

.check-row { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.9rem; padding-top: 18px; }
.check-row input { width: 18px; height: 18px; accent-color: var(--cranberry); }

.dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 18px; }
.dialog-actions .right { display: flex; gap: 8px; margin-left: auto; }

.share-url {
  display: flex; gap: 8px; margin: 10px 0;
}
.share-url input { flex: 1; font: inherit; padding: 9px 12px; border: 1.5px solid #ddd0b8; border-radius: 10px; background: #fff; }
.share-tip { font-size: 0.82rem; color: var(--ink-soft); line-height: 1.5; }

/* ——— Toast ——— */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(120px);
  background: var(--ink); color: var(--cream); font-weight: 700;
  padding: 12px 22px; border-radius: 999px; box-shadow: var(--shadow);
  transition: transform 0.3s cubic-bezier(0.2, 1.4, 0.4, 1); z-index: 50; max-width: 90vw;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ——— Share page extras ——— */
.share-hero { max-width: 640px; margin: 0 auto 8px; }
.claim-btn { width: 100%; }
.claimed-by-you { background: #e7f0e6; color: var(--pine-light); border-radius: 9px; padding: 6px 9px; font-size: 0.8rem; font-weight: 700; margin-top: 8px; }

footer { text-align: center; padding: 20px; color: rgba(253, 246, 233, 0.5); font-size: 0.82rem; position: relative; z-index: 2; }

@media (prefers-reduced-motion: reduce) {
  .flake, .bulb, .badge-lit .dot { animation: none; }
  .card, .btn { transition: none; }
}

@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .toolbar { padding: 10px; }
}
