/* ===== 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, #1a0a05 0%, #3d1810 40%, #6b2a08 70%, #2a1208 100%);
  color: #f5e7d0;
  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(255, 200, 100, 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, #ffd27a, #ff9a3c, #ff6b35);
  -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(40, 20, 10, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 180, 80, 0.18);
  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(255, 200, 120, 0.12);
}

/* ===== Heading ===== */
h1 {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #ffd27a, #ff9a3c, #ff6b35);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  text-align: center;
  font-size: 0.9rem;
  color: rgba(240, 210, 170, 0.7);
  margin-bottom: 28px;
}

/* ===== Form Elements ===== */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(240, 200, 150, 0.8);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

input[type="text"],
textarea {
  width: 100%;
  padding: 14px 16px;
  background: rgba(30, 15, 8, 0.6);
  border: 1px solid rgba(255, 180, 80, 0.2);
  border-radius: 12px;
  color: #f5e7d0;
  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(255, 200, 100, 0.5);
  box-shadow: 0 0 0 3px rgba(255, 200, 100, 0.1);
}

input[type="text"]::placeholder,
textarea::placeholder {
  color: rgba(220, 180, 130, 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(220, 180, 130, 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, #ffb347, #ff7a3d, #d6420e);
  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(255, 140, 60, 0.35),
    0 0 40px rgba(255, 180, 80, 0.15);
  margin-top: 8px;
}

.submit-btn::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(135deg, #ffb347, #ff7a3d, #d6420e);
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
  border-radius: 16px;
  z-index: -1;
  filter: blur(12px);
  opacity: 0.45;
}

@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(255, 140, 60, 0.45),
    0 0 50px rgba(255, 180, 80, 0.2);
}

.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, #ffd27a, #ff9a3c, #ff6b35);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#success-message p {
  color: rgba(240, 210, 170, 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(255, 180, 80, 0.3);
  border-radius: 12px;
  background: rgba(60, 30, 12, 0.4);
  color: #ffc875;
  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(90, 45, 18, 0.5);
  border-color: rgba(255, 200, 120, 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;
  }
}
