:root {
  --night-deep: #0b132b;
  --night-sky: #132247;
  --aurora-glow: #34d399;
  --aurora-teal: #5eead4;
  --forest-green: #153e2e;
  --forest-green-deep: #0f2c21;
  --green-soft: #e9f5ee;
  --santa-red: #b8282e;
  --santa-red-dark: #8f1d22;
  --warm-gold: #e3b34c;
  --star-light: #fde68a;
  --paper-cream: #fffbf2;
  --paper-warm: #fff4dc;
  --paper-border: #e6d3b3;
  --ink-main: #2a1e17;
  --ink-muted: #5c4b41;
  --radius: 16px;
  --font-ui: "Hiragino Maru Gothic ProN", "BIZ UDPGothic", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --font-letter: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--night-deep);
  background-image: linear-gradient(180deg, var(--night-deep) 0%, var(--night-sky) 55%, #162952 100%);
  color: var(--ink-main);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
  position: relative;
}

a {
  color: var(--santa-red);
}

.site-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 16px 56px;
  flex: 1 0 auto;
}

.container-wide {
  max-width: 1140px;
}

.site-header {
  background: rgba(11, 19, 43, 0.88);
  backdrop-filter: blur(8px);
  color: #fffdf8;
  border-bottom: 3px solid var(--warm-gold);
  position: relative;
  z-index: 10;
}

.header-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.06rem;
  color: #fffdf8;
  text-decoration: none;
  min-height: 44px;
  white-space: nowrap;
}

.brand-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
  width: 100%;
}

.nav-link {
  color: #f8edd8;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 999px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: rgba(255, 255, 255, 0.14);
}

.nav-logout-form {
  margin: 0;
}

.motion-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1.5px solid rgba(253, 230, 138, 0.55);
  background: rgba(255, 255, 255, 0.08);
  color: var(--star-light);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
  flex-shrink: 0;
}

@media (min-width: 720px) {
  .header-inner {
    padding: 12px 16px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .header-top-row {
    display: contents;
  }
  .brand {
    order: 1;
    font-size: 1.2rem;
    gap: 10px;
  }
  .brand-icon {
    width: 26px;
    height: 26px;
  }
  .nav-actions {
    order: 2;
    width: auto;
    margin-left: auto;
    gap: 8px;
  }
  .nav-link {
    font-size: 0.95rem;
    padding: 8px 14px;
  }
  .motion-toggle-btn {
    order: 3;
    padding: 8px 14px;
    font-size: 0.85rem;
  }
}

.motion-toggle-btn:hover,
.motion-toggle-btn:focus-visible {
  background: rgba(255, 255, 255, 0.16);
}

.card {
  background: var(--paper-cream);
  border: 1.5px solid var(--paper-border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 10px 28px rgba(6, 11, 28, 0.28);
}

.card-warm {
  background: var(--paper-warm);
  border: 2px solid var(--warm-gold);
}

.card-green {
  background: var(--green-soft);
  border: 2px solid #8ac4a3;
}

.card-red {
  background: #fff3f2;
  border: 2px solid #e7a5a0;
}

.card-flush-bottom {
  margin-bottom: 0;
}

.card-centered {
  text-align: center;
  padding: 32px 22px;
}

.card-eve-banner {
  background: linear-gradient(135deg, #0f1f48 0%, #1b3670 60%, #163d47 100%);
  color: #ffffff;
  border: 2px solid var(--warm-gold);
  position: relative;
  overflow: hidden;
}

.card-eve-banner h2 {
  color: var(--star-light);
}

h1,
h2,
h3 {
  margin-top: 0;
  line-height: 1.38;
}

h1 {
  font-size: 1.55rem;
  color: var(--forest-green);
}

h2 {
  font-size: 1.24rem;
  color: var(--forest-green);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  min-height: 48px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  line-height: 1.35;
  touch-action: manipulation;
  position: relative;
  transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.16s ease, opacity 0.16s ease;
}

.btn:active {
  transform: scale(0.96);
}

.btn-lg {
  min-height: 54px;
  padding: 14px 28px;
  font-size: 1.06rem;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--santa-red);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(184, 40, 46, 0.3);
}

.btn-primary:hover {
  background: var(--santa-red-dark);
}

.btn-secondary {
  background: var(--forest-green);
  color: #ffffff;
}

.btn-secondary:hover {
  background: var(--forest-green-deep);
}

.btn-outline {
  background: #ffffff;
  color: var(--forest-green);
  border: 1.5px solid var(--forest-green);
}

.btn-outline:hover {
  background: #f4f9f6;
}

.btn-header-outline {
  background: rgba(255, 255, 255, 0.94);
  color: var(--forest-green);
  border: 1.5px solid var(--warm-gold);
}

.btn-danger {
  background: #ffffff;
  color: #9e1c1c;
  border: 1.5px solid #d98282;
}

.btn-sm {
  min-height: 44px;
  padding: 9px 16px;
  font-size: 0.92rem;
}

.tab-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.tab-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  min-height: 54px;
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  border: 2px solid var(--paper-border);
  background: var(--paper-cream);
  color: var(--forest-green);
  touch-action: manipulation;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.tab-link.active {
  background: var(--forest-green);
  border-color: var(--warm-gold);
  color: #ffffff;
}

.field {
  margin-bottom: 16px;
}

label {
  display: block;
  font-weight: 700;
  font-size: 0.96rem;
  margin-bottom: 6px;
}

.sub-label {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 700;
  font-size: 0.98rem;
  padding: 12px 14px;
  border: 1.5px solid #d7c7b2;
  border-radius: 12px;
  background: #fffdf9;
  cursor: pointer;
  min-height: 48px;
}

.checkbox-label input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  flex-shrink: 0;
}

input[type="text"],
input[type="email"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1.5px solid #d7c7b2;
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  background: #ffffff;
  color: var(--ink-main);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.help {
  font-size: 0.92rem;
  color: var(--ink-muted);
  margin-top: 6px;
}

.help-block {
  display: block;
  font-weight: 400;
  margin-top: 2px;
}

.help-danger {
  color: #6d1f1b;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.badge-draft {
  background: #eee6dc;
  color: #55473e;
}

.badge-revision {
  background: #fde2e1;
  color: #9c1f1a;
}

.badge-approved {
  background: #dff4e7;
  color: #165b3a;
}

.badge-sent {
  background: var(--forest-green);
  color: #ffffff;
}

.alert {
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 0.96rem;
}

.alert-success {
  background: #dff4e7;
  border: 1.5px solid #8bc8a5;
  color: #144d31;
}

.alert-error {
  background: #fde2e1;
  border: 1.5px solid #e49b97;
  color: #8c1a16;
}

.alert-info {
  background: #eef5ff;
  border: 1.5px solid #aec9f0;
  color: #1c3f73;
}

.letter-paper {
  background: #fffdf7;
  border: 3px double var(--santa-red);
  border-radius: 16px;
  padding: 28px 24px;
  font-family: var(--font-letter);
  box-shadow: inset 0 0 0 1px rgba(227, 179, 76, 0.35);
}

.letter-paper-title {
  color: var(--santa-red);
  text-align: center;
  margin-bottom: 18px;
}

.letter-paper-greeting {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--forest-green);
  margin-bottom: 14px;
}

.letter-paper-sign {
  text-align: right;
  font-weight: 700;
  color: var(--santa-red);
  margin-bottom: 0;
  font-size: 1.08rem;
}

.letter-deeds-flow {
  margin: 0;
}

.letter-deeds-intro,
.letter-deed-paragraph {
  margin: 0 0 14px;
  line-height: 1.9;
}

.site-footer {
  border-top: 1px solid rgba(227, 179, 76, 0.35);
  background: rgba(11, 19, 43, 0.9);
  padding: 22px 16px;
  text-align: center;
  font-size: 0.9rem;
  color: #e6dfd3;
  position: relative;
  z-index: 5;
}

.site-footer a {
  color: var(--star-light);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.row-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.row-actions-center {
  justify-content: center;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.grid-stack {
  display: grid;
  gap: 14px;
}

.grid-stack-sm {
  display: grid;
  gap: 10px;
}

.child-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

.child-card {
  border: 1.5px solid var(--paper-border);
  border-radius: 14px;
  padding: 18px;
  background: #fffdf9;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.child-card-title {
  font-size: 1.18rem;
}

.child-card-cta {
  margin-top: auto;
}

.mono {
  font-family: var(--font-mono);
  word-break: break-all;
}

.divider {
  border: none;
  border-top: 1px solid var(--paper-border);
  margin: 20px 0;
}

.pre-wrap {
  white-space: pre-wrap;
}

.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.m-0 { margin: 0; }
.mt-xs { margin-top: 4px; }
.mt-sm { margin-top: 6px; }
.mt-md { margin-top: 10px; }
.mt-lg { margin-top: 14px; }
.mt-xl { margin-top: 16px; }
.mb-sm { margin-bottom: 6px; }
.mb-md { margin-bottom: 12px; }
.mb-lg { margin-bottom: 14px; }
.my-sm { margin: 8px 0; }

.eyebrow-red {
  margin: 0 0 6px;
  font-weight: 700;
  color: var(--santa-red);
}

.lead-strong {
  font-size: 1.08rem;
  font-weight: 700;
  margin-top: 0;
}

.guard-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.guard-body {
  max-width: 560px;
  margin: 0 auto 24px;
}

.page-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.page-title-bar h1 {
  margin: 0;
  color: #fffdf8;
}

.back-link-bar {
  margin-top: 0;
  margin-bottom: 12px;
}

.back-link-bar a {
  color: var(--star-light);
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.back-link-bar a:hover {
  text-decoration: underline;
}

.on-night-heading {
  color: #fffdf8;
}

.on-night-sub {
  color: #e6dfd3;
}

.on-night-sub a {
  color: var(--star-light);
}

details.parent-tools summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink-muted);
  padding: 10px 0;
  min-height: 44px;
}

.sending-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 19, 43, 0.94);
  color: #fffdf8;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 24px;
}

.sending-overlay.active {
  display: flex;
}

.sending-overlay h2 {
  color: #fffdf8;
  font-size: 1.5rem;
  margin: 16px 0 8px;
}

.sending-overlay p {
  color: #f8edd8;
  margin: 0;
}

/* Send Wish 3-Stage Animation Overlay */
.send-stage {
  position: relative;
  width: 280px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.send-step-envelope,
.send-step-sleigh,
.send-step-stamp {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.send-letter-sheet {
  position: absolute;
  font-size: 2.2rem;
  opacity: 0;
  transform: translate3d(0, -54px, 0) scale(1);
}

.send-envelope-img {
  width: 132px;
  height: 132px;
  object-fit: contain;
  opacity: 0;
  transform: translate3d(0, 12px, 0) scale(0.92);
}

.send-sleigh-img {
  width: 210px;
  height: auto;
  opacity: 0;
  transform: translate3d(-110px, 24px, 0) scale(0.85);
}

.send-step-stamp {
  opacity: 0;
  transform: scale(1.65) rotate(-8deg);
}

.send-stamp-seal {
  background: rgba(255, 251, 242, 0.96);
  border: 3px solid var(--santa-red);
  border-radius: 12px;
  padding: 12px 20px;
  color: var(--santa-red);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.send-stamp-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.send-stamp-seal strong {
  font-size: 1.35rem;
}

.sending-overlay.active .send-letter-sheet {
  animation: sendLetterIntoEnv 0.65s ease-in forwards;
}

.sending-overlay.active .send-envelope-img {
  animation: sendEnvelopePulse 1.15s ease-in-out forwards;
}

.sending-overlay.active .send-sleigh-img {
  animation: sendSleighTakeoff 0.9s 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.sending-overlay.stage-stamped .send-step-stamp {
  animation: sendStampSlam 0.4s cubic-bezier(0.22, 1.25, 0.36, 1) forwards;
}

@keyframes sendLetterIntoEnv {
  0% { opacity: 0; transform: translate3d(0, -68px, 0) scale(1.1); }
  30% { opacity: 1; transform: translate3d(0, -28px, 0) scale(1); }
  100% { opacity: 0; transform: translate3d(0, 18px, 0) scale(0.45); }
}

@keyframes sendEnvelopePulse {
  0% { opacity: 0; transform: translate3d(0, 12px, 0) scale(0.85); }
  25% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
  75% { opacity: 1; transform: translate3d(0, -6px, 0) scale(1.04); }
  100% { opacity: 0; transform: translate3d(40px, -24px, 0) scale(0.6); }
}

@keyframes sendSleighTakeoff {
  0% { opacity: 0; transform: translate3d(-110px, 26px, 0) scale(0.82); }
  25% { opacity: 1; transform: translate3d(-20px, 4px, 0) scale(0.98); }
  80% { opacity: 1; transform: translate3d(70px, -28px, 0) scale(1.04); }
  100% { opacity: 0; transform: translate3d(140px, -54px, 0) scale(0.85); }
}

@keyframes sendStampSlam {
  0% { opacity: 0; transform: scale(1.7) rotate(-10deg); }
  65% { opacity: 1; transform: scale(0.95) rotate(-2deg); }
  100% { opacity: 1; transform: scale(1) rotate(-3deg); }
}

/* Ambient Christmas Night Animations (transform + opacity only) */
.aurora-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.aurora-ribbon {
  position: absolute;
  top: -12%;
  width: 72%;
  height: 54%;
  border-radius: 50%;
  filter: blur(36px);
  will-change: transform, opacity;
}

.aurora-ribbon-1 {
  left: -8%;
  background: radial-gradient(ellipse at center, rgba(52, 211, 153, 0.26) 0%, rgba(94, 234, 212, 0.08) 55%, transparent 75%);
  animation: auroraDriftA 18s ease-in-out infinite alternate;
}

.aurora-ribbon-2 {
  right: -10%;
  background: radial-gradient(ellipse at center, rgba(94, 234, 212, 0.22) 0%, rgba(52, 211, 153, 0.07) 55%, transparent 75%);
  animation: auroraDriftB 22s ease-in-out infinite alternate;
}

@keyframes auroraDriftA {
  0% { transform: translate3d(0, 0, 0) scaleX(1); opacity: 0.55; }
  100% { transform: translate3d(6vw, 18px, 0) scaleX(1.12); opacity: 0.85; }
}

@keyframes auroraDriftB {
  0% { transform: translate3d(0, 12px, 0) scaleX(1.08); opacity: 0.45; }
  100% { transform: translate3d(-5vw, -10px, 0) scaleX(0.95); opacity: 0.78; }
}

.starfield,
.snowfield {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.twinkle-star {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--star-light);
  box-shadow: 0 0 8px rgba(253, 230, 138, 0.8);
  animation: starTwinkle 3.6s ease-in-out infinite;
}

.twinkle-star:nth-child(1) { left: 8%; top: 9%; animation-delay: 0s; }
.twinkle-star:nth-child(2) { left: 19%; top: 18%; animation-delay: 0.8s; width: 4px; height: 4px; }
.twinkle-star:nth-child(3) { left: 31%; top: 7%; animation-delay: 1.4s; }
.twinkle-star:nth-child(4) { left: 44%; top: 15%; animation-delay: 2.1s; width: 5px; height: 5px; }
.twinkle-star:nth-child(5) { left: 56%; top: 8%; animation-delay: 0.5s; }
.twinkle-star:nth-child(6) { left: 67%; top: 20%; animation-delay: 1.9s; width: 4px; height: 4px; }
.twinkle-star:nth-child(7) { left: 76%; top: 11%; animation-delay: 2.6s; }
.twinkle-star:nth-child(8) { left: 88%; top: 16%; animation-delay: 1.1s; width: 5px; height: 5px; }
.twinkle-star:nth-child(9) { left: 14%; top: 29%; animation-delay: 2.9s; width: 4px; height: 4px; }
.twinkle-star:nth-child(10) { left: 92%; top: 27%; animation-delay: 0.4s; }

@keyframes starTwinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.75); }
  50% { opacity: 0.95; transform: scale(1.25); }
}

.snowflake {
  position: absolute;
  top: -16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  animation: snowFall 12s linear infinite;
  will-change: transform, opacity;
}

.snowflake:nth-child(1)  { left: 4%;  width: 6px; height: 6px; animation-duration: 11s; animation-delay: -2s; }
.snowflake:nth-child(2)  { left: 10%; width: 8px; height: 8px; animation-duration: 14s; animation-delay: -7s; }
.snowflake:nth-child(3)  { left: 16%; width: 5px; height: 5px; animation-duration: 10s; animation-delay: -4s; }
.snowflake:nth-child(4)  { left: 22%; width: 7px; height: 7px; animation-duration: 13s; animation-delay: -9s; }
.snowflake:nth-child(5)  { left: 28%; width: 6px; height: 6px; animation-duration: 15s; animation-delay: -1s; }
.snowflake:nth-child(6)  { left: 34%; width: 9px; height: 9px; animation-duration: 12s; animation-delay: -5s; }
.snowflake:nth-child(7)  { left: 41%; width: 5px; height: 5px; animation-duration: 11s; animation-delay: -8s; }
.snowflake:nth-child(8)  { left: 48%; width: 7px; height: 7px; animation-duration: 14s; animation-delay: -3s; }
.snowflake:nth-child(9)  { left: 55%; width: 6px; height: 6px; animation-duration: 10s; animation-delay: -6s; }
.snowflake:nth-child(10) { left: 61%; width: 8px; height: 8px; animation-duration: 16s; animation-delay: -10s; }
.snowflake:nth-child(11) { left: 67%; width: 5px; height: 5px; animation-duration: 12s; animation-delay: -2s; }
.snowflake:nth-child(12) { left: 73%; width: 7px; height: 7px; animation-duration: 13s; animation-delay: -11s; }
.snowflake:nth-child(13) { left: 79%; width: 6px; height: 6px; animation-duration: 11s; animation-delay: -4s; }
.snowflake:nth-child(14) { left: 84%; width: 8px; height: 8px; animation-duration: 15s; animation-delay: -7s; }
.snowflake:nth-child(15) { left: 89%; width: 5px; height: 5px; animation-duration: 10s; animation-delay: -1s; }
.snowflake:nth-child(16) { left: 94%; width: 7px; height: 7px; animation-duration: 14s; animation-delay: -6s; }
.snowflake:nth-child(17) { left: 25%; width: 5px; height: 5px; animation-duration: 12s; animation-delay: -9s; }
.snowflake:nth-child(18) { left: 70%; width: 6px; height: 6px; animation-duration: 13s; animation-delay: -3s; }

@keyframes snowFall {
  0%   { transform: translate3d(0, -10px, 0); opacity: 0; }
  10%  { opacity: 0.78; }
  50%  { transform: translate3d(18px, 52vh, 0); opacity: 0.72; }
  90%  { opacity: 0.6; }
  100% { transform: translate3d(-10px, 106vh, 0); opacity: 0; }
}

@media (max-width: 640px) {
  .snowflake:nth-child(n + 10) {
    display: none;
  }
}

/* Sleigh Flying Across Top Hero & 12/24 Eve Banner */
.hero-sleigh,
.eve-sleigh-img {
  animation: sleighGlide 16s linear infinite;
  will-change: transform, opacity;
}

@keyframes sleighGlide {
  0% { transform: translate3d(-240px, 6px, 0) rotate(-2deg); opacity: 0; }
  8% { opacity: 0.95; }
  50% { transform: translate3d(320px, -4px, 0) rotate(1deg); opacity: 0.95; }
  88% { opacity: 0.95; }
  100% { transform: translate3d(920px, 4px, 0) rotate(-1deg); opacity: 0; }
}

/* Button Sparkle Glint on Primary Santa CTA */
.btn-santa-send::after {
  content: "✨";
  font-size: 0.95rem;
  display: inline-block;
  margin-left: 2px;
  animation: ctaSparkle 2.4s ease-in-out infinite;
}

@keyframes ctaSparkle {
  0%, 100% { opacity: 0.7; transform: scale(0.9) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.2) rotate(12deg); }
}

/* Christmas Morning Letter Reveal Animation */
.letter-reveal-envelope {
  animation: envelopeOpenLift 0.7s ease-out both;
}

.letter-reveal-paper {
  animation: letterRiseUp 0.8s 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.reveal-deed-item {
  animation: deedReveal 0.45s ease-out both;
}

.reveal-deed-item:nth-child(1) { animation-delay: 0.85s; }
.reveal-deed-item:nth-child(2) { animation-delay: 1.15s; }
.reveal-deed-item:nth-child(3) { animation-delay: 1.45s; }
.reveal-deed-item:nth-child(4) { animation-delay: 1.75s; }
.reveal-deed-item:nth-child(5) { animation-delay: 2.05s; }

@keyframes envelopeOpenLift {
  0% { opacity: 0; transform: translate3d(0, 16px, 0) scale(0.9); }
  100% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes letterRiseUp {
  0% { opacity: 0; transform: translate3d(0, 36px, 0) scale(0.97); }
  100% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes deedReveal {
  0% { opacity: 0; transform: translate3d(0, 12px, 0); }
  100% { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* Pause & Reduced Motion Overrides */
html.motion-paused .letter-reveal-envelope,
html.motion-paused .letter-reveal-paper,
html.motion-paused .reveal-deed-item {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}

html.motion-paused *,
html.motion-paused *::before,
html.motion-paused *::after,
html.page-hidden *,
html.page-hidden *::before,
html.page-hidden *::after {
  animation-play-state: paused !important;
  transition-duration: 0.01ms !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .letter-reveal-envelope,
  .letter-reveal-paper,
  .reveal-deed-item {
    opacity: 1 !important;
    transform: none !important;
  }
}

.is-hidden {
  display: none !important;
}

.scene-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background-color: var(--night-deep);
}

.scene-bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
  opacity: 0.56;
  display: block;
}

.scene-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(11, 19, 43, 0.72) 0%,
    rgba(11, 19, 43, 0.42) 45%,
    rgba(11, 19, 43, 0.68) 100%
  );
}

/* Hero & 3-Step Top Page */
.hero-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(140deg, rgba(16, 34, 72, 0.94) 0%, rgba(21, 62, 46, 0.92) 100%);
  border: 2px solid var(--warm-gold);
  border-radius: var(--radius);
  padding: 28px 24px;
  margin-bottom: 22px;
  color: #fffdf8;
  box-shadow: 0 14px 34px rgba(5, 10, 26, 0.45);
}

.hero-sky {
  position: relative;
  height: 44px;
  margin-bottom: 6px;
  overflow: hidden;
}

.hero-sleigh {
  height: 42px;
  width: auto;
  display: block;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: center;
}

.hero-eyebrow {
  margin: 0 0 6px;
  color: var(--star-light);
  font-weight: 700;
  letter-spacing: 0.06em;
}

.hero-title {
  color: #ffffff;
  font-size: 1.65rem;
  margin-bottom: 12px;
  word-break: auto-phrase;
  overflow-wrap: break-word;
}

.phrase-keep {
  display: inline-block;
  white-space: nowrap;
}

.hero-lead {
  color: #f3ece0;
  margin: 0 0 20px;
}

.hero-art {
  display: flex;
  justify-content: center;
}

.hero-postbox-img {
  width: 180px;
  height: auto;
  max-width: 100%;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.35));
}

.steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.step-card {
  background: var(--paper-warm);
  border: 1.5px solid var(--paper-border);
  border-radius: 14px;
  padding: 18px 16px;
  text-align: center;
}

.step-icon {
  display: block;
  margin: 0 auto 10px;
  object-fit: contain;
}

.step-card h3 {
  font-size: 1.06rem;
  color: var(--forest-green);
  margin-bottom: 6px;
}

/* Home Countdown & Child Cards */
.countdown-card {
  background: linear-gradient(135deg, rgba(21, 62, 46, 0.94), rgba(16, 36, 68, 0.95));
  color: #fffdf8;
  border: 2px solid var(--warm-gold);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: 0 10px 26px rgba(6, 11, 28, 0.34);
}

.countdown-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.countdown-icon {
  flex-shrink: 0;
}

.countdown-headline {
  margin: 0 0 4px;
  font-size: 1.18rem;
  font-weight: 700;
  color: #ffffff;
}

.countdown-days {
  font-size: 1.65rem;
  color: var(--star-light);
  padding: 0 2px;
}

.countdown-sub {
  margin: 0;
  font-size: 0.92rem;
  color: #e8e0d0;
}

.eve-sleigh-track {
  position: relative;
  height: 46px;
  margin-bottom: 8px;
  overflow: hidden;
}

.eve-sleigh-img {
  height: 44px;
  width: auto;
  display: block;
}

.child-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.child-card-illus {
  width: 60px;
  height: 60px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Wish Compose & Receipt */
.wish-compose-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.wish-postbox-img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  flex-shrink: 0;
}

.wish-textarea {
  min-height: 150px;
  font-size: 1.08rem;
  background: #fffdf8;
  border: 2px solid #d5be96;
}

.btn-santa-send {
  background: linear-gradient(180deg, #c92e35 0%, var(--santa-red) 100%);
  border: 2px solid var(--warm-gold);
  box-shadow: 0 6px 18px rgba(184, 40, 46, 0.35);
}

.receipt-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: center;
}

.receipt-elf-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.elf-portrait {
  width: 172px;
  height: 172px;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(21, 62, 46, 0.16));
}

.elf-name-pill {
  display: inline-block;
  background: var(--forest-green);
  color: #fffdf8;
  padding: 4px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.92rem;
}

.receipt-wish-box {
  background: #ffffff;
  border: 1.5px solid #9ccab0;
  border-radius: 12px;
  padding: 12px 14px;
  margin: 10px 0 14px;
}

.receipt-wish-text {
  margin: 4px 0 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink-main);
}

.receipt-stamp-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
}

.tracking-stamp {
  display: inline-block;
  margin-top: 4px;
  padding: 6px 14px;
  border: 2.5px solid var(--santa-red);
  border-radius: 8px;
  color: var(--santa-red);
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: 0.04em;
  background: #fff8f8;
}

/* Letter Tab, Edit 2-Col & Open */
.letter-ready-box,
.letter-locked-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}

.envelope-spot-img {
  width: 112px;
  height: 112px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.letter-paper-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.letter-paper-head .letter-paper-title {
  margin: 0;
}

.letter-edit-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

.letter-reveal-stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.letter-reveal-envelope .envelope-spot-img {
  width: 65%;
  max-width: 240px;
  height: auto;
}

@media (min-width: 640px) {
  .child-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hero-grid {
    grid-template-columns: 1.45fr 0.85fr;
  }
  .steps-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .receipt-grid {
    grid-template-columns: 200px 1fr;
  }
}

@media (min-width: 900px) {
  .letter-edit-grid {
    grid-template-columns: 1.05fr 0.95fr;
  }
  .letter-preview-sticky {
    position: sticky;
    top: 20px;
  }
}

@media (max-width: 520px) {
  .container {
    padding: 16px 12px 44px;
  }
  .card,
  .hero-card {
    padding: 16px;
  }
  .hero-title {
    font-size: 1.32rem;
    line-height: 1.45;
  }
  .tab-bar {
    grid-template-columns: 1fr;
  }
  .row-actions .btn {
    width: 100%;
  }
  .wish-compose-head {
    flex-direction: column;
    text-align: center;
  }
}

/* Kids Mode & Parent Entry Panel */
.kids-header {
  background: rgba(11, 19, 43, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid rgba(227, 179, 76, 0.6);
  position: sticky;
  top: 0;
  z-index: 20;
}

.kids-header-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.kids-header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.kids-header-sub-row {
  display: flex;
  justify-content: flex-end;
}

.kids-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: #fffdf8;
  min-height: 44px;
  white-space: nowrap;
}

.kids-exit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(245, 239, 228, 0.86);
  border: 1px solid rgba(207, 196, 176, 0.75);
  color: #3a2e26;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  touch-action: manipulation;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.kids-exit-btn:hover,
.kids-exit-btn:focus-visible {
  background: #ebe2d2;
  border-color: #b5a78e;
  color: var(--ink-main);
}

.kids-motion-btn {
  font-size: 0.74rem;
  padding: 6px 10px;
  border-color: rgba(245, 239, 228, 0.28);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(245, 239, 228, 0.84);
  font-weight: 600;
}

.kids-motion-btn:hover,
.kids-motion-btn:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  color: #fffdf8;
}

/* Parent Caution Banner */
.parent-caution-banner {
  width: 100%;
  min-height: 52px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
  position: relative;
  z-index: 9;
}

@media (min-width: 640px) {
  .parent-caution-banner {
    font-size: 1.0625rem;
    padding: 15px 24px;
  }
}

.parent-caution-icon {
  font-size: 1.4em;
  line-height: 1;
  flex-shrink: 0;
}

.parent-caution-banner-subtle {
  background: #ffd76a;
  color: #3a2410;
  border-bottom: 3px solid #b8860b;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}

.parent-caution-banner-warning {
  background: #ffe3e0;
  color: #5b0f0f;
  border-top: 3px solid #a61b1b;
  border-bottom: 4px solid #a61b1b;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

@media (min-width: 640px) {
  .kids-header-inner {
    padding: 10px 16px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .kids-header-top-row {
    display: contents;
  }
  .kids-header-sub-row {
    order: 2;
    margin-left: auto;
  }
  .kids-brand {
    order: 1;
    font-size: 1.08rem;
  }
  .kids-exit-btn {
    order: 3;
    font-size: 0.82rem;
    padding: 6px 14px;
  }
}

.container-kids {
  max-width: 760px;
}

.kids-main-title {
  text-align: center;
  font-size: 1.44rem;
  margin-bottom: 18px;
  word-break: auto-phrase;
  overflow-wrap: break-word;
}

.guard-challenge-form {
  max-width: 420px;
  margin: 0 auto;
  text-align: left;
}

.guard-question-box {
  background: #fffdf8;
  border: 2px solid var(--warm-gold);
  border-radius: 14px;
  padding: 14px 18px;
  text-align: center;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.guard-question-text {
  font-size: 1.5rem;
  color: var(--forest-green);
  font-family: var(--font-mono);
}

.parent-entry-card {
  background: var(--paper-warm);
  border: 2px solid var(--warm-gold);
}

.parent-entry-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.parent-entry-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

@media (min-width: 640px) {
  .parent-entry-grid {
    grid-template-columns: 1fr 1fr;
  }
}
