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

:root {
  --bg-deep: #06060e;
  --bg-surface: #0e0e1a;
  --bg-card: #131320;
  --bg-warm: #16121c;
  --text-primary: #ede4d3;
  --text-muted: #7a7189;
  --text-dim: #4a4358;
  --accent: #8b7cf7;
  --accent-dim: rgba(139, 124, 247, 0.12);
  --accent-glow: rgba(139, 124, 247, 0.3);
  --rose: #c9647a;
  --rose-dim: rgba(201, 100, 122, 0.12);
  --warm: #d4a574;
  --glass: rgba(14, 14, 26, 0.85);
  --glass-border: rgba(139, 124, 247, 0.08);
  --radius: 12px;
  --radius-lg: 20px;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  background: var(--bg-deep);
  color: var(--text-primary);
  overflow-x: hidden;
  line-height: 1.6;
}

/* Grain overlay */
.grain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px;
}

/* Particles */
.particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  animation: float-up var(--dur) linear infinite;
  animation-delay: var(--delay);
}

@keyframes float-up {
  0% {
    transform: translateY(100vh) translateX(0) scale(0);
    opacity: 0;
  }
  5% {
    opacity: var(--max-opacity, 0.4);
  }
  50% {
    transform: translateY(50vh) translateX(var(--drift)) scale(1);
  }
  95% {
    opacity: 0.1;
  }
  100% {
    transform: translateY(-5vh) translateX(var(--drift-end)) scale(0.5);
    opacity: 0;
  }
}

/* Container */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Hero */
.hero {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px;
}

.hero::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(600px, 100vw);
  height: min(600px, 100vw);
  background: radial-gradient(circle, rgba(139, 124, 247, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content {
  position: relative;
}

.hero-date {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 32px;
  opacity: 0;
  animation: fadeUp 1s ease 0.2s forwards;
}

.hero-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(3rem, 10vw, 6.5rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 32px;
  background: linear-gradient(135deg, var(--text-primary) 40%, var(--rose) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0;
  animation: fadeUp 1.2s ease 0.5s forwards;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 20px;
  opacity: 0;
  animation: fadeUp 1s ease 0.9s forwards;
}

.hero-sub--delay {
  animation-delay: 1.3s;
  font-style: italic;
  color: var(--text-dim);
}

.hero-ctas {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 48px;
  opacity: 0;
  animation: fadeUp 1s ease 1.6s forwards;
  flex-wrap: wrap;
}

.scroll-hint {
  position: absolute;
  bottom: -120px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-dim);
  opacity: 0;
  animation: fadeUp 1s ease 2s forwards;
}

.scroll-dot {
  animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
  0%, 100% { cy: 8; opacity: 1; }
  50% { cy: 20; opacity: 0.3; }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Buttons */
.btn {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  font-size: 0.9rem;
  padding: 14px 32px;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.03em;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: #9d90f9;
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(139, 124, 247, 0.3);
}

.btn--primary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--glass-border);
}

.btn--ghost:hover {
  color: var(--text-primary);
  border-color: rgba(139, 124, 247, 0.25);
  background: var(--accent-dim);
}

.btn--sm {
  padding: 8px 20px;
  font-size: 0.8rem;
}

.btn--lg {
  padding: 16px 48px;
  font-size: 1rem;
}

/* Section titles */
.section-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(2rem, 5vw, 3.2rem);
  text-align: center;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.section-sub {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 48px;
}

/* Record Section */
.record-section {
  position: relative;
  z-index: 1;
  padding: 120px 0 80px;
}

.recorder-tabs {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 32px;
  background: var(--bg-surface);
  border-radius: 100px;
  padding: 4px;
  max-width: 240px;
  margin-left: auto;
  margin-right: auto;
}

.tab {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  font-size: 0.85rem;
  padding: 8px 24px;
  border-radius: 100px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s ease;
  flex: 1;
}

.tab--active {
  background: var(--accent-dim);
  color: var(--text-primary);
}

.tab-content {
  display: none;
}

.tab-content--active {
  display: block;
}

/* Video container */
.video-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 55vh;
  margin: 0 auto 24px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-container video {
  width: 100%;
  max-height: 55vh;
  object-fit: contain;
  display: block;
}

#preview {
  transform: scaleX(-1);
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-dim);
}

.video-placeholder p {
  font-size: 0.85rem;
}

.timer-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
}

.timer-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--rose));
  transition: width 0.1s linear;
}

.timer-text {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 10px;
  border-radius: 100px;
  backdrop-filter: blur(8px);
}

/* Record button */
.record-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.record-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid var(--rose);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
}

.record-btn:hover {
  border-color: #e07a90;
}

.record-btn-inner {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--rose);
  transition: all 0.2s ease;
}

.record-btn.recording {
  animation: pulse-ring 1.5s ease-in-out infinite;
}

.record-btn.recording .record-btn-inner {
  border-radius: 4px;
  width: 22px;
  height: 22px;
}

@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 100, 122, 0.4); }
  50% { box-shadow: 0 0 0 12px rgba(201, 100, 122, 0); }
}

.record-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Audio recorder */
.audio-recorder {
  width: 100%;
  max-width: 640px;
  margin: 0 auto 24px;
  position: relative;
}

.audio-visualizer {
  width: 100%;
  aspect-ratio: 4/1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  position: relative;
}

.audio-visualizer canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.audio-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-dim);
}

.audio-placeholder p {
  font-size: 0.85rem;
}

.audio-playback-container {
  max-width: 640px;
  margin: 16px auto 0;
}

.audio-playback-container audio {
  width: 100%;
  height: 40px;
  border-radius: 100px;
}

#audioTimerBar {
  position: relative;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

#audioTimerText {
  position: absolute;
  top: -40px;
  right: 12px;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 10px;
  border-radius: 100px;
  backdrop-filter: blur(8px);
  z-index: 1;
}

/* Gallery audio card */
.gallery-card-audio {
  aspect-ratio: 16/7;
  position: relative;
  overflow: hidden;
  background: var(--bg-deep);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
}

.gallery-card-audio svg {
  color: var(--accent);
  opacity: 0.5;
}

.gallery-card-audio .gallery-card-play {
  background: rgba(0, 0, 0, 0.15);
}

/* Lightbox audio */
.lightbox-audio-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 48px 0;
}

.lightbox-audio-visual {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.lightbox-audio-container audio {
  width: 100%;
  max-width: 400px;
  height: 40px;
}

/* Form */
.submit-form {
  max-width: 640px;
  margin: 40px auto 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.optional {
  color: var(--text-dim);
}

.private-badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--rose-dim);
  color: var(--rose);
  padding: 2px 8px;
  border-radius: 100px;
  margin-left: 6px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  font-size: 0.9rem;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.3s ease;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-dim);
}

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

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.char-count {
  display: block;
  text-align: right;
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.submit-form .btn {
  display: block;
  width: 100%;
  margin-top: 8px;
}

.form-note {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 16px;
}

/* Success state */
.success-state {
  text-align: center;
  max-width: 480px;
  margin: 0 auto;
  padding: 80px 0;
}

.success-icon {
  color: var(--rose);
  margin-bottom: 24px;
  animation: floatHeart 3s ease-in-out infinite;
}

@keyframes floatHeart {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.success-state h3 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.success-state p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 32px;
}

/* Gallery */
.gallery-section {
  position: relative;
  z-index: 1;
  padding: 80px 0 120px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

.gallery-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: all 0.3s ease;
  opacity: 0;
  animation: fadeUp 0.6s ease forwards;
}

.gallery-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-glow);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.gallery-card-video {
  position: relative;
  overflow: hidden;
  background: var(--bg-deep);
}

.gallery-card-video video {
  width: 100%;
  display: block;
}

.gallery-card-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  opacity: 1;
  transition: opacity 0.3s ease;
}

.gallery-card:hover .gallery-card-play {
  background: rgba(0, 0, 0, 0.4);
}

.play-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.play-circle svg {
  margin-left: 3px;
}

.gallery-card-info {
  padding: 16px;
}

.gallery-card-name {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.gallery-card-msg {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

.gallery-card-time {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.gallery-empty {
  text-align: center;
  padding: 80px 0;
  color: var(--text-dim);
  font-style: italic;
}

.gallery-loading {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--glass-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

#loadMoreBtn {
  display: block;
  margin: 0 auto;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(20px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox.active {
  display: flex;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 2rem;
  cursor: pointer;
  z-index: 10001;
  transition: color 0.3s ease;
  line-height: 1;
}

.lightbox-close:hover {
  color: var(--text-primary);
}

.lightbox-content {
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.lightbox-content video {
  width: 100%;
  max-height: 75vh;
  border-radius: var(--radius-lg);
  background: #000;
}

.lightbox-info {
  padding: 20px 4px;
}

.lightbox-info h3 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-size: 1.3rem;
  margin-bottom: 6px;
}

.lightbox-info p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.lightbox-info time {
  color: var(--text-dim);
  font-size: 0.75rem;
}

/* Footer */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 60px 24px;
  border-top: 1px solid var(--glass-border);
}

.footer p {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-style: italic;
}

.footer-sub {
  margin-top: 4px;
  font-size: 0.75rem !important;
  opacity: 0.5;
}

.footer-terms {
  margin-top: 24px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.footer-terms p {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-style: normal;
  line-height: 1.6;
}

.footer-terms a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Responsive */
@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .record-section {
    padding: 80px 0 60px;
  }

  .gallery-card-info {
    padding: 12px;
  }

  .gallery-card-name {
    font-size: 0.95rem;
  }

  .gallery-card-msg {
    font-size: 0.75rem;
  }
}

@media (min-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Progress overlay */
.upload-progress {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(6, 6, 14, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.progress-bar-bg {
  width: 240px;
  height: 3px;
  background: var(--bg-surface);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--rose));
  transition: width 0.3s ease;
}

.upload-progress p {
  font-size: 0.85rem;
  color: var(--text-muted);
}
