:root {
  --pink: #ff6b9d;
  --yellow: #ffd93d;
  --teal: #4ecdc4;
  --purple: #a855f7;
  --orange: #ff8c42;
  --blue: #60a5fa;
  --bg: #fff9f0;
  --card-bg: #ffffff;
  --text: #2d2d2d;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(255,107,157,0.12) 0%, transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(78,205,196,0.12) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(168,85,247,0.1) 0%, transparent 40%),
    radial-gradient(circle at 20% 80%, rgba(255,217,61,0.15) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: fall linear infinite;
  pointer-events: none;
  z-index: 1;
  opacity: 0.7;
}

@keyframes fall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 0.8; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

.hero {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 60px 20px 40px;
}

.hero-badge {
  display: inline-block;
  background: none;
  color: #aaa;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 20px;
  border: none;
  box-shadow: none;
  padding: 0;
}

.hero h1 {
  font-family: 'Pacifico', cursive;
  font-size: clamp(52px, 10vw, 96px);
  line-height: 1.05;
  background: linear-gradient(135deg, var(--pink) 0%, var(--purple) 40%, var(--teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(3px 4px 0 rgba(0,0,0,0.08));
  margin-bottom: 12px;
}

.hero-sub {
  font-size: 18px;
  font-weight: 700;
  color: #888;
  letter-spacing: 1px;
}

.emoji-row {
  font-size: 32px;
  margin: 18px 0 0;
  animation: bounce 1.5s ease-in-out infinite alternate;
  display: block;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}

.cta-wrap {
  position: relative;
  z-index: 2;
  text-align: center;
  margin: 0 0 50px;
}

.btn-sign {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--pink), var(--orange));
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 18px;
  font-weight: 800;
  padding: 16px 38px;
  border: none;
  border-radius: 99px;
  cursor: pointer;
  box-shadow: 0 6px 0 #c04060, 0 10px 30px rgba(255,107,157,0.35);
  transition: transform 0.1s, box-shadow 0.1s;
  letter-spacing: 0.5px;
}

.btn-sign:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #c04060, 0 14px 35px rgba(255,107,157,0.4);
}

.btn-sign:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #c04060;
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: #fff;
  border-radius: 24px;
  padding: 36px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.2);
  position: relative;
  animation: popIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes popIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal h2 {
  font-family: 'Pacifico', cursive;
  font-size: 28px;
  color: var(--pink);
  margin-bottom: 6px;
}

.modal p.subtitle {
  color: #999;
  font-size: 14px;
  margin-bottom: 24px;
}

.close-btn {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #bbb;
  transition: color 0.2s;
}

.close-btn:hover { color: #555; }

.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: #555;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 7px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #eee;
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  color: var(--text);
  transition: border-color 0.2s;
  outline: none;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus { border-color: var(--pink); }

.photo-upload-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 2px dashed #ddd;
  border-radius: 12px;
  cursor: pointer;
  color: #999;
  font-size: 14px;
  font-weight: 700;
  transition: border-color 0.2s, color 0.2s;
}

.photo-upload-label:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.photo-upload-label span { font-size: 22px; }

#photo-input { display: none; }

#photo-preview {
  max-width: 100%;
  border-radius: 10px;
  margin-top: 10px;
  display: none;
}

.media-toggle {
  display: inline-flex;
  border: 2px solid #ececec;
  border-radius: 999px;
  overflow: hidden;
}

.media-toggle-btn {
  border: none;
  background: #fff;
  color: #777;
  font-weight: 800;
  padding: 8px 16px;
  cursor: pointer;
}

.media-toggle-btn.selected {
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #fff;
}

.gif-search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.gif-search-btn {
  border: none;
  border-radius: 10px;
  padding: 0 14px;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.gif-hint {
  color: #8b8b8b;
  font-size: 12px;
  font-weight: 700;
  margin-top: 8px;
}

.gif-results {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.gif-tile {
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  background: #f4f4f4;
  cursor: pointer;
  padding: 0;
  line-height: 0;
}

.gif-tile.selected {
  border-color: var(--teal);
}

.gif-tile img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
}

.gif-empty {
  margin-top: 8px;
  color: #999;
  font-size: 13px;
  font-weight: 700;
}

.gif-selected-wrap {
  margin-top: 10px;
  border: 2px dashed #ddd;
  border-radius: 12px;
  padding: 10px;
}

.gif-selected-title {
  font-size: 12px;
  font-weight: 800;
  color: #666;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.gif-selected-preview {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

.gif-clear-btn {
  margin-top: 8px;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  background: #efefef;
  color: #444;
  font-weight: 700;
  cursor: pointer;
}

.color-dots {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.color-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
}

.color-dot:hover { transform: scale(1.15); }

.color-dot.selected {
  border-color: #333;
  transform: scale(1.15);
}

.btn-submit {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 17px;
  font-weight: 800;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 5px 0 #2a9d96;
  transition: transform 0.1s, box-shadow 0.1s;
  margin-top: 6px;
}

.btn-submit:hover { transform: translateY(-1px); }

.btn-submit:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #2a9d96;
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.section-title {
  position: relative;
  z-index: 2;
  text-align: center;
  font-family: 'Pacifico', cursive;
  font-size: 28px;
  color: var(--purple);
  margin-bottom: 30px;
}

.cards-grid {
  position: relative;
  z-index: 2;
  columns: 320px;
  column-gap: 22px;
  padding: 0 24px 80px;
  max-width: 1200px;
  margin: 0 auto;
}

.message-card {
  display: inline-block;
  width: 100%;
  background: var(--card-bg);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.07);
  border-top: 5px solid var(--pink);
  animation: cardIn 0.4s cubic-bezier(0.34,1.3,0.64,1) both;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  margin: 0 0 22px;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
}

.message-card:hover {
  transform: translateY(-4px) rotate(0.5deg);
  box-shadow: 0 12px 35px rgba(0,0,0,0.12);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(30px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.card-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.card-name {
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
}

.card-time {
  font-size: 11px;
  color: #bbb;
  font-weight: 600;
}

.card-message {
  font-size: 15px;
  color: #555;
  line-height: 1.6;
  margin-bottom: 14px;
  white-space: pre-wrap;
}

.card-photo {
  width: 100%;
  border-radius: 12px;
  object-fit: cover;
  margin-bottom: 12px;
  display: block;
}

.card-music {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5f5ff;
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--purple);
  text-decoration: none;
  transition: background 0.2s;
  word-break: break-all;
}

.card-music:hover { background: #ede9ff; }

.card-music .music-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.empty-state {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 40px 20px 80px;
  color: #bbb;
  font-size: 18px;
  font-weight: 700;
}

.empty-state .big-emoji {
  font-size: 60px;
  display: block;
  margin-bottom: 16px;
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: #fff;
  padding: 14px 28px;
  border-radius: 99px;
  font-weight: 700;
  font-size: 15px;
  z-index: 999;
  transition: transform 0.4s cubic-bezier(0.34,1.4,0.64,1);
  white-space: nowrap;
}

.toast.show { transform: translateX(-50%) translateY(0); }

.loading-spinner {
  text-align: center;
  padding: 40px;
  font-size: 32px;
  position: relative;
  z-index: 2;
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.loading-wrap {
  text-align: center;
  position: relative;
  z-index: 2;
}

.counter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 2px solid #eee;
  border-radius: 99px;
  padding: 6px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #888;
  position: relative;
  z-index: 2;
  width: fit-content;
  margin: 0 auto 30px;
}

.counter-pill span.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  display: inline-block;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}
