/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #0a0a2e 0%, #1a1040 40%, #0d2137 70%, #0a1628 100%);
  color: #e0e8f0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100dvh;
  padding: 20px;
}

/* ===== Celebration Canvas ===== */
#celebration-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
}

/* ===== Flash Overlay ===== */
.flash-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(100, 200, 255, 0.8);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease-out;
  z-index: 999;
}

/* ===== Page Title ===== */
.page-title {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 32px;
  background: linear-gradient(135deg, #64d8ff, #a78bfa, #e879f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  letter-spacing: -0.02em;
}

/* ===== Container (Glassmorphism) ===== */
.container {
  width: 100%;
  max-width: 420px;
  background: rgba(20, 30, 60, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(100, 180, 255, 0.15);
  border-radius: 24px;
  padding: 36px 28px;
  position: relative;
  z-index: 10;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(100, 180, 255, 0.1);
}

/* ===== Heading ===== */
h1 {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #64d8ff, #a78bfa, #e879f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  text-align: center;
  font-size: 0.9rem;
  color: rgba(180, 200, 230, 0.7);
  margin-bottom: 28px;
}

/* ===== Form Elements ===== */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(160, 200, 240, 0.8);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

input[type="text"],
textarea {
  width: 100%;
  padding: 14px 16px;
  background: rgba(15, 25, 50, 0.6);
  border: 1px solid rgba(100, 180, 255, 0.2);
  border-radius: 12px;
  color: #e0e8f0;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.3s, box-shadow 0.3s;
  outline: none;
}

input[type="text"]:focus,
textarea:focus {
  border-color: rgba(100, 200, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(100, 200, 255, 0.1);
}

input[type="text"]::placeholder,
textarea::placeholder {
  color: rgba(140, 170, 200, 0.4);
}

textarea {
  resize: none;
  height: 100px;
  line-height: 1.5;
}

/* ===== Character Counter ===== */
.char-counter {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
  font-size: 0.8rem;
  color: rgba(140, 180, 220, 0.5);
  transition: color 0.3s;
}

.char-counter.warning {
  color: #f0c040;
}

.char-counter.danger {
  color: #f06060;
}

/* ===== Error Message ===== */
.error-message {
  display: none;
  color: #f06060;
  font-size: 0.85rem;
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(240, 60, 60, 0.1);
  border: 1px solid rgba(240, 60, 60, 0.2);
  border-radius: 8px;
}

.error-message.visible {
  display: block;
}

/* ===== Submit Button ===== */
.submit-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 14px;
  font-size: 1.1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #2dd4bf, #6366f1, #c084fc);
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow:
    0 4px 20px rgba(99, 102, 241, 0.3),
    0 0 40px rgba(45, 212, 191, 0.1);
  margin-top: 8px;
}

.submit-btn::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(135deg, #2dd4bf, #6366f1, #c084fc);
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
  border-radius: 16px;
  z-index: -1;
  filter: blur(12px);
  opacity: 0.4;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    0 6px 28px rgba(99, 102, 241, 0.4),
    0 0 50px rgba(45, 212, 191, 0.15);
}

.submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== Success State ===== */
.hidden {
  display: none !important;
}

#success-message {
  text-align: center;
  opacity: 0;
  transition: opacity 0.6s ease;
}

#success-message.visible {
  opacity: 1;
}

#success-message h2 {
  font-size: 1.5rem;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #2dd4bf, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#success-message p {
  color: rgba(180, 200, 230, 0.7);
  font-size: 0.95rem;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ===== Send Another Button ===== */
.send-another-btn {
  display: inline-block;
  padding: 12px 28px;
  border: 1px solid rgba(100, 180, 255, 0.3);
  border-radius: 12px;
  background: rgba(20, 40, 80, 0.4);
  color: #64d8ff;
  font-size: 1rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s, transform 0.2s;
}

.send-another-btn:hover {
  background: rgba(30, 60, 120, 0.5);
  border-color: rgba(100, 200, 255, 0.5);
  transform: translateY(-1px);
}

/* ===== Shake Animation ===== */
@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-4px, 2px); }
  20% { transform: translate(4px, -2px); }
  30% { transform: translate(-3px, 3px); }
  40% { transform: translate(3px, -1px); }
  50% { transform: translate(-2px, 2px); }
  60% { transform: translate(2px, -2px); }
  70% { transform: translate(-1px, 1px); }
  80% { transform: translate(1px, -1px); }
  90% { transform: translate(-1px, 0); }
}

.shake-active {
  animation: shake 0.5s ease-out;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  body {
    padding: 16px;
    align-items: center;
  }

  .container {
    padding: 28px 20px;
    border-radius: 20px;
  }

  h1 {
    font-size: 1.5rem;
  }
}

@media (max-height: 600px) {
  textarea {
    height: 80px;
  }
}
