:root {
  --red: #b10f1f;
  --red-deep: #8a0c17;
  --green: #0e6a3d;
  --green-deep: #094a2b;
  --gold: #d9a61f;
  --cream: #fffaf2;
  --ink: #1c2733;
  --muted: #66717d;
  --card: #ffffff;
  --line: #e7e1d9;
  --shadow: 0 16px 36px rgba(31, 23, 15, 0.14);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "DM Sans", system-ui, sans-serif;
  background: #edf2f5;
  color: var(--ink);
}
button, input { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(100%, 520px);
  min-height: 100svh;
  margin: 0 auto;
  background: var(--cream);
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 40px rgba(0,0,0,.08);
}

.view { display: none; min-height: 100svh; }
.view.active { display: block; }

#treeView {
  background:
    linear-gradient(to bottom, rgba(7, 43, 68, .1), rgba(7, 43, 68, .32)),
    radial-gradient(circle at 50% 20%, rgba(255,255,255,.9), transparent 36%),
    linear-gradient(#7fb2d1, #d8edf4 48%, #f6fbfd 73%, #eef5f7);
  color: white;
  padding: 24px 18px 18px;
  position: relative;
}

.hero-copy { text-align: center; position: relative; z-index: 2; }
.hero-copy .eyebrow { color: #f8f6f0; opacity: .95; }
.hero-copy h1 { margin: 4px 0 4px; font-size: clamp(1.9rem, 7vw, 2.6rem); }
.hero-copy p:last-child { margin-top: 6px; font-size: 1rem; opacity: .92; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 700; margin: 0; }

.tree-stage {
  position: relative;
  width: min(100%, 430px);
  aspect-ratio: 5 / 7;
  margin: 2px auto 0;
}
.tree-art { width: 100%; height: 100%; display: block; filter: drop-shadow(0 18px 24px rgba(0,0,0,.24)); pointer-events: none; position: relative; z-index: 1; }
.light-layer { position: absolute; inset: 0; z-index: 10; pointer-events: auto; }

.category-light {
  position: absolute;
  width: 104px;
  min-height: 62px;
  transform: translate(-50%, -50%);
  border: 0;
  background: transparent;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px;
  text-align: center;
  z-index: 11;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.category-light .bulb {
  width: 24px;
  height: 31px;
  border-radius: 50% 50% 46% 46%;
  position: relative;
  display: block;
  border: 2px solid rgba(255,255,255,.82);
  box-shadow: 0 0 8px rgba(255,255,255,.75), 0 0 18px currentColor;
}
.category-light .bulb::before {
  content: "";
  position: absolute;
  width: 12px;
  height: 7px;
  left: 4px;
  top: -7px;
  border-radius: 3px 3px 1px 1px;
  background: #8b9298;
  border: 1px solid #d9dde0;
}
.category-light .label {
  background: #fffaf2;
  color: #1c2733;
  border: 1px solid rgba(255,255,255,.85);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: .69rem;
  line-height: 1.15;
  font-weight: 800;
  box-shadow: 0 3px 9px rgba(0,0,0,.2);
  white-space: nowrap;
}
.category-light .count {
  display: block;
  font-size: .59rem;
  font-weight: 700;
  margin-top: 1px;
  color: #54616d;
}
.category-light.red { color: #ff3349; }
.category-light.red .bulb { background: #df1028; }
.category-light.green { color: #31d279; }
.category-light.green .bulb { background: #0f9d58; }
.category-light.gold { color: #ffd24d; }
.category-light.gold .bulb { background: #e2aa18; }
.category-light.off { color: #6f7980; }
.category-light.off .bulb {
  background: #566068;
  border-color: #98a0a5;
  box-shadow: none;
  opacity: .78;
}
.category-light.off .label { color: #6c7379; background: #f1f0ec; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.category-light:focus-visible { outline: 3px solid white; outline-offset: 2px; border-radius: 12px; }
.category-light:disabled { cursor: default; }

.snow-glow { position: absolute; border-radius: 50%; background: rgba(255,255,255,.7); filter: blur(1px); }
.snow-glow-one { width: 8px; height: 8px; left: 10%; top: 20%; }
.snow-glow-two { width: 5px; height: 5px; right: 8%; top: 30%; }

.tree-footer { position: relative; z-index: 3; margin-top: -12px; }
.progress-card {
  background: #fffaf2;
  color: var(--ink);
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
}
.progress-card .label { display: block; font-size: .75rem; color: var(--muted); }
.progress-card strong { display: block; font-size: 1.1rem; margin-top: 2px; }
.text-button { border: 0; background: transparent; color: var(--red); font-weight: 700; }

.list-header {
  background: linear-gradient(160deg, var(--red), var(--red-deep));
  color: white;
  padding: 18px 18px 20px;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: start;
}
.list-header.compact { padding-bottom: 16px; }
.list-header h1 { margin: 2px 0 2px; font-size: 1.8rem; }
.list-header p { margin: 0; }
.icon-button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35); background: #a51220; color: white; font-size: 2rem; line-height: 1; }

.gift-list { padding: 16px; display: grid; gap: 14px; }
.gift-card, .selected-gift-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 9px 22px rgba(46, 36, 28, .08);
}
.gift-card .family { font-size: .8rem; font-weight: 700; color: var(--red); text-transform: uppercase; letter-spacing: .06em; }
.gift-card h2 { margin: 5px 0 4px; font-size: 1.18rem; }
.gift-card p { margin: 0; color: var(--muted); }
.card-footer { display: flex; justify-content: flex-end; margin-top: 14px; }
.select-button { border: 0; border-radius: 999px; background: var(--green); color: white; font-weight: 700; padding: 11px 17px; min-height: 44px; }
.empty-state { text-align: center; padding: 56px 24px; color: var(--muted); }

.reserve-body { padding: 16px; }
.selected-gift-card { margin-bottom: 18px; }
.selected-gift-card .family { color: var(--red); font-weight: 700; }
.selected-gift-card h2 { margin: 6px 0 2px; }
.selected-gift-card p { margin: 0; color: var(--muted); }
.reservation-form { display: grid; gap: 14px; }
.section-copy h2 { margin-bottom: 4px; }
.section-copy p { margin: 0; color: var(--muted); }
.reservation-form label { display: grid; gap: 7px; font-size: .87rem; font-weight: 700; }
.reservation-form input { width: 100%; min-height: 50px; border: 1px solid #cfc8bf; border-radius: 13px; padding: 12px 14px; background: white; color: var(--ink); }
.reservation-form input:focus { outline: 3px solid rgba(14, 106, 61, .18); border-color: var(--green); }
.privacy-note { margin: 0; font-size: .8rem; color: var(--muted); line-height: 1.45; }
.primary-button { width: 100%; min-height: 52px; border: 0; border-radius: 14px; background: linear-gradient(160deg, var(--red), var(--red-deep)); color: white; font-weight: 800; font-size: 1rem; box-shadow: 0 8px 18px rgba(177,15,31,.2); }

.confirmation { text-align: center; padding: 70px 22px 28px; background: radial-gradient(circle at 50% 6%, #f8dfb0, transparent 28%), var(--cream); }
.confirmation.active { display: flex; flex-direction: column; align-items: center; }
.confirmation-icon { width: 84px; height: 84px; border-radius: 50%; background: var(--green); color: white; display: grid; place-items: center; font-size: 2.7rem; font-weight: 700; margin-bottom: 18px; box-shadow: 0 12px 28px rgba(14,106,61,.24); }
.confirmation h1 { font-family: "Great Vibes", cursive; color: var(--red); font-size: 3.2rem; font-weight: 400; margin: 6px 0 10px; }
.confirmation-copy { max-width: 340px; margin: 0 auto; color: var(--muted); line-height: 1.55; }
.code-card { margin: 26px 0 10px; width: min(100%, 330px); background: white; border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.code-card span { display: block; color: var(--muted); font-size: .8rem; }
.code-card strong { display: block; font-size: 1.7rem; letter-spacing: .12em; margin-top: 4px; }
.tag-instruction { color: var(--muted); font-size: .88rem; margin: 0 0 24px; }

@media (min-width: 700px) {
  body { padding: 22px; }
  .app-shell { min-height: calc(100svh - 44px); border-radius: 26px; }
  .view { min-height: calc(100svh - 44px); }
}

@media (max-width: 360px) {
  .category-light { width: 88px; }
  .category-light .label { font-size: .62rem; padding: 3px 6px; }
  .category-light .bulb { width: 21px; height: 27px; }
  .hero-copy h1 { font-size: 1.75rem; }
}

.cart-button {
  position: fixed;
  z-index: 50;
  top: 14px;
  right: max(14px, calc((100vw - 520px) / 2 + 14px));
  border: 0;
  border-radius: 999px;
  background: #fffaf2;
  color: var(--ink);
  padding: 9px 12px;
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.cart-button span {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  margin-left: 5px;
  border-radius: 999px;
  background: var(--red);
  color: white;
  font-size: .78rem;
}
.cart-body { padding: 0 0 18px; }
.cart-actions { display: grid; gap: 10px; padding: 0 16px; }
.secondary-button {
  width: 100%; min-height: 50px; border-radius: 14px; border: 1px solid #c9c3bb;
  background: white; color: var(--ink); font-weight: 800;
}
.remove-button {
  border: 1px solid #d5cfc7; border-radius: 999px; background: white; color: var(--red);
  font-weight: 700; padding: 10px 15px; min-height: 42px;
}
.checkout-summary { margin-bottom: 18px; }
.summary-card {
  background: white; border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px;
  box-shadow: 0 9px 22px rgba(46,36,28,.07);
}
.summary-line { display: grid; gap: 2px; padding-top: 10px; margin-top: 10px; border-top: 1px solid #eee8df; }
.summary-line span { font-weight: 700; }
.summary-line small { color: var(--muted); }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(17, 24, 30, .48);
  display: grid; place-items: end center; padding: 18px;
}
.modal-backdrop[hidden] { display: none; }
.modal-card {
  width: min(100%, 480px); background: var(--cream); border-radius: 22px; padding: 22px;
  box-shadow: 0 24px 70px rgba(0,0,0,.28);
}
.modal-card h2 { margin: 0 0 6px; }
.modal-card p { margin: 0 0 18px; color: var(--muted); }
.modal-actions { display: grid; gap: 10px; }
.primary-button:disabled, .secondary-button:disabled { opacity: .55; cursor: not-allowed; }

/* QR scan and retailer experience */
.retailer-button, .inline-retailer {
  display: inline-flex; align-items: center; justify-content: center; margin-top: 14px;
  min-height: 44px; padding: 10px 15px; border: 1px solid #c9c3bb; border-radius: 999px;
  background: white; color: var(--green); font-weight: 800; text-decoration: none;
}
.inline-retailer { font-size: .86rem; }
.scan-notes { margin-top: 8px !important; }

/* Printable ornament labels */
.labels-view { background: #f6f4ef; }
.label-controls { padding: 16px; display: grid; gap: 12px; background: white; border-bottom: 1px solid var(--line); }
.label-controls label { display: grid; gap: 6px; font-weight: 700; font-size: .86rem; }
.label-controls input[type="url"], .label-controls select { min-height: 46px; border: 1px solid #cfc8bf; border-radius: 12px; padding: 10px 12px; background: white; }
.check-row { grid-template-columns: auto 1fr !important; align-items: center; }
.check-row input { width: 18px; height: 18px; }
.label-status { padding: 12px 16px; color: var(--muted); font-size: .9rem; }
.label-sheet { padding: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ornament-label { background: white; border: 1.5px dashed #bbb3a8; min-height: 250px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px; text-align: center; break-inside: avoid; }
.label-category { font-size: 1rem; line-height: 1.1; text-transform: uppercase; letter-spacing: .08em; font-weight: 900; margin-bottom: 8px; }
.qr-slot { width: 132px; height: 132px; display: grid; place-items: center; }
.qr-slot img, .qr-slot canvas { width: 132px !important; height: 132px !important; }
.label-code { margin-top: 9px; font-weight: 900; font-size: 1rem; letter-spacing: .08em; }
.label-scan { margin-top: 4px; font-size: .72rem; color: #555; font-weight: 700; }

@media print {
  @page { margin: 0.35in; }
  body { background: white !important; padding: 0 !important; }
  .app-shell { width: 100% !important; max-width: none !important; min-height: 0 !important; box-shadow: none !important; background: white !important; }
  .view { display: none !important; }
  #labelsView.active { display: block !important; min-height: 0 !important; }
  .no-print, #labelsView .list-header, .cart-button { display: none !important; }
  .label-sheet { padding: 0; grid-template-columns: repeat(3, 1fr); gap: 0.16in; }
  .ornament-label { min-height: 2.35in; border: 1px solid #aaa; border-radius: 0; padding: 0.08in; }
  .label-category { font-size: 11pt; }
  .label-code { font-size: 10pt; }
  .label-scan { font-size: 8pt; }
}

/* Ensure optional retailer controls fully disappear when hidden. */
.retailer-button[hidden],
.inline-retailer[hidden] {
  display: none !important;
}

/* Clarify that retailer links are suggestions, not purchasing requirements. */
.retailer-button,
.inline-retailer {
  flex-direction: column;
  gap: 3px;
  text-align: center;
}
.retailer-button::after,
.inline-retailer::after {
  content: "This link is provided as a convenience only. The gift may be purchased from any retailer.";
  display: block;
  max-width: 300px;
  font-size: .68rem;
  line-height: 1.25;
  font-weight: 500;
  color: var(--muted);
}

/* Keep the optional public label URL compact when printing. */
.ornament-label .label-url{margin-top:3px;font-size:.65rem;font-weight:800;color:#1c2733;overflow-wrap:anywhere}
@media print{.ornament-label .label-url{font-size:7pt;margin-top:2pt}}
