@font-face {
  font-family: 'Nunito';
  src: url('/fonts/nunito-latin.woff2') format('woff2');
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Great Vibes';
  src: url('/fonts/great-vibes-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #14211a;
  --muted: #5c6b62;
  --green: #0f5132;
  --green-bright: #157347;
  --red: #b02a37;
  --paper: #fffdf7;
  --card: #ecf7ec;
  --line: #e4e7e2;
  --wash: #f2f6f1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(circle at 15% 10%, rgba(15, 81, 50, 0.14), transparent 45%),
    radial-gradient(circle at 85% 0%, rgba(176, 42, 55, 0.12), transparent 40%),
    var(--paper);
  color: var(--ink);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 32px;
  box-shadow: 0 18px 50px rgba(20, 33, 26, 0.12);
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green-bright);
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(26px, 5vw, 34px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.lede {
  margin: 0 0 22px;
  color: var(--muted);
}

.recipient {
  margin: 6px 0 22px;
  font-size: clamp(38px, 9vw, 60px);
  color: var(--red);
  letter-spacing: -0.03em;
}

.stack {
  display: grid;
  gap: 8px;
}

label {
  font-family: 'Nunito', ui-rounded, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

input,
textarea {
  width: 100%;
  font-family: 'Nunito', ui-rounded, system-ui, sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: #0b3d2e;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  padding: 11px 13px;
  caret-color: #fff;
}

input::placeholder,
textarea::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

input:focus,
textarea:focus {
  background: #0d4433;
  outline: 3px solid rgba(126, 214, 165, 0.25);
  border-color: #7ed6a5;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

button {
  margin-top: 10px;
  font-family: 'Nunito', ui-rounded, system-ui, sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  background: var(--green);
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  cursor: pointer;
}

button:hover {
  background: var(--green-bright);
}

button.secondary {
  margin: 0;
  color: var(--green);
  background: var(--wash);
  border: 1px solid var(--line);
}

button.secondary:hover {
  background: #e6ede4;
}

button.danger {
  margin: 0;
  background: #fff;
  color: var(--red);
  border: 1px solid rgba(176, 42, 55, 0.35);
}

button.danger:hover {
  background: #fdf2f3;
}

.footnote {
  margin: 22px 0 0;
  font-size: 13px;
  color: var(--muted);
}

a {
  color: var(--green-bright);
}

.button-link {
  display: inline-block;
  margin-top: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  color: #fff;
  background: var(--green);
  text-decoration: none;
  font-weight: 650;
}

.alert {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(176, 42, 55, 0.3);
  background: #fdf2f3;
  color: #7d1f28;
}

.alert.success {
  border-color: rgba(21, 115, 71, 0.3);
  background: #eef7f1;
  color: #0f5132;
}

.note {
  padding: 14px 16px;
  border-left: 4px solid var(--red);
  border-radius: 0 10px 10px 0;
  background: #fdf2f3;
  color: #7d1f28;
}

.panel {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.topline {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}

.hint {
  margin: 0 0 14px;
  font-size: 13.5px;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  background: var(--wash);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

tbody tr:last-child td {
  border-bottom: 0;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--wash);
  color: var(--muted);
}

.pill.viewed {
  background: #eef7f1;
  color: var(--green);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.actions form {
  margin: 0;
}

.danger-zone h2 {
  color: var(--red);
}

@media (max-width: 520px) {
  .card {
    padding: 22px;
    border-radius: 14px;
  }

  .topline {
    flex-direction: column;
  }
}

/* ---------- Festive opening screen ---------- */

body.festive {
  overflow-x: hidden;
  background: radial-gradient(circle at 50% 118%, #0d4433 0%, #07281f 46%, #04120d 100%);
}

.festive-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.aurora {
  position: absolute;
  inset: -22%;
  background:
    radial-gradient(45% 35% at 18% 18%, rgba(46, 160, 67, 0.38), transparent 70%),
    radial-gradient(42% 32% at 82% 8%, rgba(200, 40, 50, 0.3), transparent 70%),
    radial-gradient(52% 42% at 62% 92%, rgba(255, 200, 80, 0.2), transparent 72%);
  filter: blur(12px);
  animation: auroraShift 16s ease-in-out infinite alternate;
}

@keyframes auroraShift {
  from {
    transform: translate3d(-4%, -2%, 0) scale(1);
  }
  to {
    transform: translate3d(4%, 3%, 0) scale(1.14);
  }
}

.lights {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 4px 10px 0;
}

.lights::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 0;
  right: 0;
  border-top: 2px solid rgba(255, 255, 255, 0.35);
}

.lights i {
  width: 9px;
  height: 14px;
  border-radius: 50% 50% 45% 45%;
  background: #f8d477;
  box-shadow: 0 0 12px 4px rgba(248, 212, 119, 0.75);
  animation: twinkle 1.7s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.14s);
}

.lights i:nth-child(3n) {
  background: #e35d6a;
  box-shadow: 0 0 12px 4px rgba(227, 93, 106, 0.7);
}

.lights i:nth-child(3n + 1) {
  background: #7ed6a5;
  box-shadow: 0 0 12px 4px rgba(126, 214, 165, 0.65);
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1.25);
  }
}

.flake {
  position: absolute;
  top: -12vh;
  left: var(--x);
  font-size: var(--size);
  font-style: normal;
  line-height: 1;
  color: #f3fbff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.85);
  opacity: 0.9;
  animation: snowfall var(--dur) linear infinite;
  animation-delay: var(--delay);
  will-change: transform;
}

@keyframes snowfall {
  0% {
    transform: translate3d(0, -12vh, 0) rotate(0deg);
  }
  100% {
    transform: translate3d(var(--drift), 114vh, 0) rotate(360deg);
  }
}

.gift {
  position: absolute;
  top: -16vh;
  left: var(--x);
  font-size: var(--size);
  font-style: normal;
  line-height: 1;
  opacity: 0.95;
  animation: giftFall var(--dur) linear infinite;
  animation-delay: var(--delay);
  will-change: transform;
}

@keyframes giftFall {
  0% {
    transform: translate3d(0, -16vh, 0) rotate(-18deg);
  }
  50% {
    transform: translate3d(34px, 52vh, 0) rotate(18deg);
  }
  100% {
    transform: translate3d(-12px, 118vh, 0) rotate(-12deg);
  }
}

.santa-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding: 0 3vw;
}

.santa {
  display: inline-block;
  font-size: clamp(32px, 5.6vw, 58px);
  line-height: 1;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.35));
  transform-origin: bottom center;
  animation: santaDance 1.05s ease-in-out infinite alternate;
  will-change: transform;
}

.s1 {
  animation-duration: 0.95s;
  animation-delay: -0.2s;
}
.s2 {
  animation-duration: 1.25s;
  animation-delay: -0.6s;
}
.s3 {
  animation-duration: 0.85s;
  animation-delay: -0.1s;
}
.s4 {
  animation-duration: 1.35s;
  animation-delay: -0.45s;
}
.s5 {
  animation-duration: 1.1s;
  animation-delay: -0.8s;
}

@keyframes santaDance {
  0% {
    transform: translate3d(-8px, 4px, 0) rotate(-11deg) scale(0.97);
  }
  50% {
    transform: translate3d(0, -20px, 0) rotate(6deg) scale(1.1);
  }
  100% {
    transform: translate3d(9px, 2px, 0) rotate(12deg) scale(1);
  }
}

.tree {
  position: absolute;
  bottom: -14px;
  font-size: clamp(58px, 11vw, 118px);
  line-height: 1;
  transform-origin: bottom center;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.35));
  will-change: transform;
}

.tree-l {
  left: -14px;
  animation: treeSway 3.4s ease-in-out infinite alternate;
}

.tree-r {
  right: -14px;
  animation: treeSway 4.2s ease-in-out infinite alternate-reverse;
}

@keyframes treeSway {
  from {
    transform: rotate(-5deg);
  }
  to {
    transform: rotate(5deg);
  }
}

.star {
  position: absolute;
  font-size: 18px;
  animation: starTwinkle 1.8s ease-in-out infinite;
  animation-delay: var(--star-delay, 0s);
}

.st1 {
  top: 18%;
  left: 7%;
  --star-delay: -0.3s;
}
.st2 {
  top: 32%;
  right: 9%;
  font-size: 24px;
  --star-delay: -0.9s;
}
.st3 {
  top: 62%;
  left: 4%;
  font-size: 15px;
  --star-delay: -1.4s;
}
.st4 {
  top: 74%;
  right: 6%;
  --star-delay: -0.5s;
}
.st5 {
  top: 12%;
  right: 24%;
  font-size: 20px;
  --star-delay: -1.1s;
}

@keyframes starTwinkle {
  0%,
  100% {
    opacity: 0.25;
    transform: scale(0.7) rotate(-8deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.25) rotate(8deg);
  }
}

body.festive button[type="submit"] {
  animation: buttonGlow 2.4s ease-in-out infinite;
}

@keyframes buttonGlow {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 200, 80, 0);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(255, 200, 80, 0.16);
  }
}

@media (max-width: 520px) {
  .santa-line {
    padding: 0 6vw;
  }

  .santa {
    font-size: 34px;
  }

  .tree {
    font-size: 62px;
  }

  .ho {
    top: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .festive-bg *,
  body.festive button[type="submit"] {
    animation: none !important;
  }

  .festive-bg {
    opacity: 0.6;
  }
}

.title-block {
  margin: 0 0 30px;
  text-align: center;
}

.presents {
  margin: 0 0 2px;
  font-family: 'Great Vibes', 'Segoe Script', cursive;
  font-size: clamp(20px, 3.4vw, 32px);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.15;
  white-space: nowrap;
  color: var(--green);
}

.mega {
  margin: 0;
  font-size: clamp(36px, 10.5vw, 84px);
  line-height: 0.92;
  letter-spacing: -0.01em;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--red);
  animation: megaFlash 0.95s ease-in-out infinite;
}

@keyframes megaFlash {
  0%,
  100% {
    color: #b02a37;
    text-shadow: 0 3px 0 #fff, 0 0 0 rgba(255, 60, 80, 0);
    transform: scale(1);
  }
  50% {
    color: #ff2438;
    text-shadow: 0 3px 0 #fff, 0 0 34px rgba(255, 50, 70, 0.9), 0 0 72px rgba(255, 50, 70, 0.45);
    transform: scale(1.03);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mega {
    animation: none;
  }
}

.icon-button {
  justify-self: center;
  width: 54px;
  height: 54px;
  padding: 0;
  margin: 16px 0 4px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--red);
  box-shadow: 0 10px 22px rgba(176, 42, 55, 0.32);
}

.icon-button:hover {
  background: #c8323f;
}

.icon-button svg {
  width: 28px;
  height: 28px;
}

.countdown {
  display: inline-block;
  min-width: 1.2em;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--red);
  animation: countPulse 1s ease-in-out infinite;
}

@keyframes countPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.35);
    opacity: 0.75;
  }
}

.recipient.explode {
  animation: explodeName 0.65s ease-in forwards;
}

@keyframes explodeName {
  0% {
    transform: scale(1);
    filter: blur(0);
    opacity: 1;
  }
  35% {
    transform: scale(1.12) rotate(-2deg);
  }
  65% {
    transform: scale(1.35) rotate(2deg);
    filter: blur(2px);
    opacity: 0.85;
  }
  100% {
    transform: scale(2);
    filter: blur(16px);
    opacity: 0;
  }
}

.recipient.boom {
  animation: boomIn 0.5s ease-out;
}

@keyframes boomIn {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.particle {
  position: fixed;
  z-index: 5;
  pointer-events: none;
  font-size: 22px;
  line-height: 1;
  transform: translate(-50%, -50%);
  animation: particleFly 0.95s ease-out forwards;
}

@keyframes particleFly {
  to {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.35) rotate(200deg);
    opacity: 0;
  }
}

.note {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.countdown {
  display: block;
  font-size: clamp(64px, 12vw, 128px);
  line-height: 1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--red);
  text-shadow: 0 4px 0 #fff, 0 10px 30px rgba(176, 42, 55, 0.25);
  animation: countPulse 1s ease-in-out infinite;
}

.card.card-explode {
  animation: cardExplode 1.15s ease-in forwards;
  pointer-events: none;
}

@keyframes cardExplode {
  0% {
    transform: scale(1) rotate(0deg);
    filter: blur(0);
    opacity: 1;
  }
  25% {
    transform: scale(0.98) rotate(-1deg);
  }
  50% {
    transform: scale(1.05) rotate(1.5deg);
    filter: blur(2px);
    opacity: 0.95;
  }
  100% {
    transform: scale(1.55) rotate(5deg);
    filter: blur(26px);
    opacity: 0;
  }
}

.pill.locked {
  background: #fdf2f3;
  color: var(--red);
}

.santa-line {
  bottom: -10px;
  gap: 0;
  padding: 0 1vw;
}

.santa-slot {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transform-origin: bottom center;
}

.santa-slot .santa {
  font-size: clamp(26px, 4.4vw, 48px);
  animation: santaDance var(--d, 1.1s) ease-in-out infinite alternate;
  animation-delay: var(--delay, 0s);
}

.santa-label {
  font-family: 'Nunito', ui-rounded, system-ui, sans-serif;
  font-size: clamp(8px, 1vw, 12px);
  font-weight: 800;
  line-height: 1.1;
  color: #eafff2;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.santa-slot.done {
  animation: recede 1.4s ease-out forwards;
}

@keyframes recede {
  from {
    transform: scale(1);
    opacity: 1;
    filter: none;
  }
  to {
    transform: scale(0.5) translateY(7px);
    opacity: 0.45;
    filter: blur(0.8px) grayscale(0.4);
  }
}

@media (prefers-reduced-motion: reduce) {
  .santa-slot.done {
    animation: none;
    transform: scale(0.5) translateY(7px);
    opacity: 0.45;
    filter: blur(0.8px) grayscale(0.4);
  }
}

body.festive {
  padding-bottom: 150px;
}

.santa-line {
  left: 0;
  right: 0;
  bottom: 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  justify-items: center;
  gap: 4px 8px;
  padding: 0 8px;
}

.santa-slot {
  width: 100%;
}

.santa-slot .santa {
  font-size: clamp(24px, 4vw, 44px);
}

.santa-label {
  font-size: clamp(10px, 1.2vw, 13px);
}

@media (max-width: 640px) {
  body.festive {
    padding-bottom: 240px;
  }
}

.santa-dance {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transform-origin: bottom center;
  will-change: transform;
  animation: santaDance var(--d, 1.1s) ease-in-out infinite alternate;
  animation-delay: var(--delay, 0s);
}

.santa-slot .santa {
  animation: none;
  font-size: clamp(26px, 4.2vw, 46px);
}

body.festive {
  padding-bottom: 270px;
}

.santa-line {
  left: 0;
  right: 0;
  bottom: 14px;
  max-width: 640px;
  margin: 0 auto;
  grid-template-columns: repeat(3, 1fr);
  gap: 52px 4px;
  padding: 0;
}

.santa-slot {
  width: 100%;
}

.santa-label {
  font-size: clamp(10px, 1.1vw, 13px);
}

@media (max-width: 640px) {
  body.festive {
    padding-bottom: 240px;
  }

  .santa-line {
    max-width: 360px;
    gap: 24px 2px;
  }

  .santa-slot .santa {
    font-size: 22px;
  }

  .santa-label {
    font-size: 9px;
  }
}

body.festive {
  padding-bottom: 340px;
}

.santa-line {
  bottom: 70px;
  max-width: 700px;
  gap: 54px 6px;
}

.santa-slot .santa {
  font-size: clamp(52px, 8.2vw, 92px);
}

.santa-label {
  font-size: clamp(12px, 1.5vw, 16px);
}

@media (max-width: 640px) {
  body.festive {
    padding-bottom: 300px;
  }

  .santa-line {
    bottom: 40px;
    max-width: 380px;
    gap: 18px 2px;
  }

  .santa-slot .santa {
    font-size: 40px;
  }

  .santa-label {
    font-size: 11px;
  }
}
