:root {
  color-scheme: dark;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #0f1b2b;
  color: #f4f4f4;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.15), transparent 60%), #0f1b2b;
  overflow-x: hidden;
}

.app {
  max-width: 960px;
  width: 90%;
  padding: 3rem 2rem;
  background: rgba(12, 26, 43, 0.85);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  text-align: center;
}

.hero h1 {
  margin-bottom: 0.5rem;
  font-size: clamp(2rem, 4vw, 3rem);
  color: #ffe082;
}

.hero p {
  margin-top: 0;
  color: #d4e4ff;
}

.button-grid {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.name-btn {
  flex: 1 1 160px;
  max-width: 210px;
  padding: 1.25rem;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  background: #ffffff;
  color: #0f1b2b;
  box-shadow: 0 15px 25px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.name-btn:hover,
.name-btn:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 20px 35px rgba(0, 0, 0, 0.2);
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(4, 9, 17, 0.72);
  backdrop-filter: blur(6px);
  z-index: 10;
}

.modal.hidden {
  display: none;
}

.modal-content {
  width: min(480px, 90%);
  padding: 2rem;
  border-radius: 20px;
  background: linear-gradient(145deg, #123, #102031);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
  color: #fffaf1;
  position: relative;
  overflow: hidden;
}

.modal-content h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.8rem;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.modal-btn {
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  background: #ffe082;
  color: #2b0f0f;
  transition: opacity 0.2s ease;
}

.modal-btn:hover,
.modal-btn:focus-visible {
  opacity: 0.8;
}

.modal-btn.secondary {
  background: rgba(255, 255, 255, 0.14);
  color: #ffe9c7;
  border: 1px solid rgba(255, 255, 255, 0.24);
}

canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

.draw-modal {
  padding-top: 2.5rem;
}

.name-cycle {
  margin: 2.5rem 0 1.5rem;
  font-size: clamp(2.5rem, 6vw, 3.75rem);
  font-weight: 700;
  color: #ffefba;
  letter-spacing: 0.04em;
  text-shadow: 0 0 30px rgba(255, 238, 186, 0.6);
}

.receiver-name {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.15);
  color: #ffe082;
  border: 1px solid rgba(255, 208, 120, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.result-instructions {
  margin: 0 0 1.5rem;
  font-weight: 600;
  color: #ffe9c7;
}

.banner-message {
  margin: 0.5rem 0 1.5rem;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  background: rgba(255, 232, 156, 0.12);
  border: 1px solid rgba(255, 232, 156, 0.3);
  color: #ffe9c7;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.particle-layer {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}

.particle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: hsl(var(--hue), 80%, 65%);
  transform: translate(-50%, -50%);
  animation: burst 1s ease-out forwards;
}

@keyframes burst {
  0% {
    transform: translate(-50%, -50%) scale(0.6);
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2);
    opacity: 0;
  }
}

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

.snowflake {
  position: absolute;
  top: -10px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  animation-name: snowfall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  opacity: 0.8;
}

@keyframes snowfall {
  0% {
    transform: translate3d(0, -10px, 0);
    opacity: 0;
  }
  10% {
    opacity: 0.8;
  }
  100% {
    transform: translate3d(-30px, 110vh, 0);
    opacity: 0;
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate3d(-50%, 40px, 0);
  padding: 0.9rem 1.6rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.75);
  color: #fffbe6;
  font-weight: 600;
  letter-spacing: 0.04em;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 20;
}

.toast.visible {
  opacity: 1;
  transform: translate3d(-50%, 0, 0);
}
