:root {
  --bg-deep: #180b10;
  --bg-emerald: #132c26;
  --card-bg: rgba(252, 244, 227, 0.96);
  --card-ink: #1e2d26;
  --wine: #581b27;
  --wine-bright: #98283b;
  --gold: #e7be73;
  --gold-deep: #b37b2c;
  --cream: #fff7e6;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--cream);
  background: radial-gradient(ellipse at 30% 10%, #24453c 0%, #191f24 42%, #180a10 100%);
}

.gift-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(231, 190, 115, 0.25);
  background: rgba(16, 10, 14, 0.55);
  backdrop-filter: blur(12px);
}
.gift-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff6e0;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
}
.gift-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.gift-nav a {
  color: rgba(255, 244, 220, 0.85);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.gift-nav a:hover { color: var(--gold); }
.nav-pill {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(231, 190, 115, 0.5);
  background: rgba(255, 248, 232, 0.08);
  color: var(--cream);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.gift-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 22px 20px 44px;
}

/* Sealed Envelope Cover for Recipients */
.envelope-cover {
  display: grid;
  place-items: center;
  min-height: 70vh;
}
.envelope-cover[hidden] { display: none; }
.envelope-card {
  width: min(460px, 100%);
  padding: 36px 28px;
  border-radius: 22px;
  text-align: center;
  background: linear-gradient(160deg, #5a1c28, #271018);
  border: 2px solid var(--gold);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 235, 190, 0.2);
}
.envelope-wax {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 34px;
  background: radial-gradient(circle, #f7d992, #c38530);
  box-shadow: 0 10px 26px rgba(231, 190, 115, 0.35);
}
.envelope-eyebrow { margin: 0 0 8px; color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.envelope-card h1 { margin: 0 0 10px; font-size: 24px; color: #fff8eb; }
.envelope-sub { margin: 0 0 22px; font-size: 14px; color: rgba(255, 240, 214, 0.85); line-height: 1.6; }

/* Main 2-column Stage + Controls Layout */
.gift-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 24px;
  align-items: start;
}
.gift-layout[hidden] { display: none; }

.stage-frame {
  position: relative;
  aspect-ratio: 4 / 5;
  max-height: 76vh;
  width: 100%;
  border-radius: 20px;
  overflow: hidden;
  border: 1.5px solid rgba(231, 190, 115, 0.55);
  background: radial-gradient(circle at 50% 42%, #1d3932, #0d161a 82%);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}
#gift-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}
#gift-canvas:active { cursor: grabbing; }

.stage-watermark {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(16, 10, 14, 0.56);
  border: 1px solid rgba(231, 190, 115, 0.4);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255, 236, 196, 0.85);
  pointer-events: none;
}
.stage-watermark[hidden] { display: none; }

.stage-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 6px;
}
.stage-pill {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(231, 190, 115, 0.45);
  background: rgba(15, 26, 24, 0.72);
  backdrop-filter: blur(8px);
  color: var(--cream);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.stage-pill[aria-pressed="true"] {
  background: rgba(231, 190, 115, 0.25);
  border-color: #ffe3a8;
  color: #ffe7b2;
}

.stage-plaque {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  padding: 12px 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(24, 12, 17, 0.72), rgba(14, 8, 12, 0.86));
  backdrop-filter: blur(10px);
  border: 1px solid rgba(231, 190, 115, 0.5);
  text-align: center;
  pointer-events: none;
}
.plaque-to {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold);
  text-transform: uppercase;
}
.plaque-msg {
  margin: 4px 0 2px;
  font-size: 15px;
  font-weight: 600;
  color: #fff8ea;
  line-height: 1.45;
}
.plaque-from { font-size: 12px; color: rgba(255, 240, 214, 0.78); }

.stage-export-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.export-status {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: #ffe2a4;
}

/* Right Panel Cards */
.panel-card {
  padding: 22px 22px 24px;
  border-radius: 18px;
  background: var(--card-bg);
  color: var(--card-ink);
  border: 1.5px solid #d9ac68;
  box-shadow: 0 20px 52px rgba(0, 0, 0, 0.42);
}
.panel-card[hidden] { display: none; }
.panel-eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: #8c2739; }
.panel-card h1, .panel-card h2 { margin: 0 0 8px; font-size: 21px; line-height: 1.3; color: #461722; }
.panel-desc { margin: 0 0 16px; font-size: 13px; line-height: 1.55; color: #52433a; }

.gift-form { display: flex; flex-direction: column; gap: 13px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gift-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 650; color: #3a2923; }
.gift-form input, .gift-form textarea, .pay-email-row input, .gift-link-box input {
  width: 100%;
  font: inherit;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid #cca872;
  background: #fffdf8;
  color: #1d2c25;
}

.chip-label { display: block; font-size: 12.5px; font-weight: 650; color: #3a2923; margin-bottom: 6px; }
.chip-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(154, 108, 52, 0.38);
  background: #fffaf0;
  color: #463228;
  font-size: 12px;
  cursor: pointer;
}
.chip[aria-pressed="true"] {
  background: #8c2739;
  border-color: #6b1a29;
  color: #fff8ea;
}

.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.theme-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1.5px solid rgba(170, 126, 66, 0.36);
  background: #fffaf0;
  color: #2f201a;
  text-align: left;
  cursor: pointer;
}
.theme-btn strong { font-size: 13px; color: #4c1924; }
.theme-btn small { font-size: 11px; color: #6c594c; }
.theme-btn[aria-pressed="true"] {
  border-color: #98283b;
  background: #fff0d8;
  box-shadow: 0 0 0 2px rgba(152, 40, 59, 0.22);
}

/* Buttons */
.btn-primary, .btn-gold, .btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 120ms ease, filter 120ms ease;
}
.btn-primary:active:not(:disabled), .btn-gold:active:not(:disabled), .btn-outline:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled, .btn-gold:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #a62b40, #731929);
  border-color: #dba862;
  color: #fff8eb;
}
.btn-gold {
  background: linear-gradient(180deg, #f5d388, #d49b42);
  border-color: #a87122;
  color: #2c1509;
}
.btn-outline {
  background: rgba(255, 249, 236, 0.12);
  border-color: rgba(231, 190, 115, 0.55);
  color: var(--cream);
}
.panel-card .btn-outline {
  background: #fffaf0;
  border-color: rgba(154, 108, 52, 0.45);
  color: #3f2820;
}
.btn-primary.huge { width: 100%; min-height: 48px; font-size: 15px; }
.btn-primary.small, .btn-gold.small, .btn-outline.small { min-height: 34px; padding: 0 11px; font-size: 12px; }

/* Unlock Dual-Track Boxes */
.unlock-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(152, 40, 59, 0.12);
  color: #7c1f30;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}
.unlock-badge.success { background: rgba(31, 108, 68, 0.14); color: #195e3a; }
.unlock-perks {
  margin: 0 0 14px;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.7;
  color: #3a2e28;
}
.track-box {
  padding: 13px 14px;
  border-radius: 12px;
  background: #fffbf2;
  border: 1.5px solid rgba(186, 138, 74, 0.42);
  margin-bottom: 12px;
}
.track-box.points-track {
  background: linear-gradient(180deg, #fffaf0, #fbf0d8);
  border-color: #d49b42;
}
.track-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13.5px;
  color: #461722;
}
.pts-counter { font-weight: 800; color: #9c6216; font-variant-numeric: tabular-nums; }
.pts-bar { height: 7px; border-radius: 999px; background: rgba(156, 98, 22, 0.18); overflow: hidden; margin-bottom: 8px; }
.pts-bar span { display: block; height: 100%; background: linear-gradient(90deg, #d89b3c, #f6cf77); transition: width 320ms ease; }
.track-desc { margin: 0 0 10px; font-size: 12px; line-height: 1.5; color: #5c4b41; }
.track-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.price-tag s { color: #8c7b6f; font-size: 12.5px; margin-right: 4px; }
.price-tag b { font-size: 18px; color: #8c2335; }
.pay-email-row { display: flex; gap: 8px; }
.pay-email-row input { flex: 1; font-size: 12.5px; }
.track-note { margin: 8px 0 0; font-size: 12px; color: #7c2434; line-height: 1.5; }
.unlock-footer-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.link-btn {
  border: 0;
  background: transparent;
  color: #7c2434;
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.gift-link-box { display: flex; gap: 8px; margin-bottom: 16px; }
.recipient-viral-box {
  padding: 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4b1823, #1a3b32);
  border: 1px solid var(--gold);
  color: var(--cream);
}
.recipient-viral-box strong { display: block; font-size: 14px; color: #ffe5a4; margin-bottom: 4px; }
.recipient-viral-box p { margin: 0 0 10px; font-size: 12.5px; color: rgba(255, 245, 224, 0.88); }

@media (max-width: 860px) {
  .gift-layout { grid-template-columns: 1fr; }
  .stage-frame { max-height: 58vh; }
  .form-row, .theme-grid { grid-template-columns: 1fr; }
}
