:root {
  --bg: #fcfbf8;
  --bg-soft: #fff9f5;
  --text: #3d2b2b;
  --text-muted: #7a6464;
  --primary: #e68a9c;
  --primary-dark: #c96b7e;
  --secondary: #8ecae6;
  --accent: #ffb703;
  --card: #ffffff;
  --shadow: 0 8px 30px rgba(61, 43, 43, 0.12);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

.music-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 50;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  font-size: 1.3rem;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.music-toggle:hover {
  transform: scale(1.08);
}

.music-toggle.muted {
  opacity: 0.6;
}

.step {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  z-index: 1;
}

.step.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  z-index: 2;
}

.scene-container {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.step-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 640px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.step-content.overlay {
  margin-top: auto;
  margin-bottom: 6rem;
}

.title {
  font-size: clamp(2.2rem, 6vw, 4rem);
  margin: 0 0 0.5rem;
  color: var(--primary-dark);
  letter-spacing: -0.02em;
}

.subtitle, .step-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--text-muted);
  margin: 0 0 1.5rem;
}

h2 {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  margin: 0 0 0.5rem;
  color: var(--primary-dark);
}

.step-header {
  text-align: center;
  margin-bottom: 1.5rem;
  z-index: 1;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.6rem;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

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

.btn.secondary {
  background: #fff;
  color: var(--primary-dark);
  border: 2px solid var(--primary);
}

.step-actions {
  position: absolute;
  bottom: 1.5rem;
  left: 1.5rem;
  right: 1.5rem;
  display: flex;
  justify-content: space-between;
  z-index: 3;
}

.overlay-actions {
  bottom: 1.5rem;
}

/* Memory map */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  width: 100%;
  max-width: 900px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 0.5rem;
  z-index: 1;
}

.memory-card {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.memory-card:hover {
  transform: scale(1.03);
}

.memory-card img,
.memory-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.memory-card .caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.75rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
  color: #fff;
  font-size: 0.9rem;
  text-align: left;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.lightbox:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
}

.lightbox-inner img,
.lightbox-inner video {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--radius);
}

/* Voice notes */
.voice-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 600px;
  z-index: 1;
}

.voice-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card);
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.voice-card button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}

.voice-card span {
  font-weight: 600;
}

/* Quiz */
.quiz-form {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  z-index: 1;
  overflow-y: auto;
  max-height: 55vh;
  padding-right: 0.5rem;
}

.quiz-question {
  background: var(--card);
  padding: 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.quiz-question p {
  font-weight: 700;
  margin: 0 0 0.75rem;
}

.quiz-option {
  display: block;
  margin: 0.4rem 0;
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  border: 2px solid var(--border, #e5d5d5);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.quiz-option:hover {
  background: var(--bg-soft);
}

.quiz-option input {
  margin-right: 0.6rem;
}

.quiz-result {
  background: var(--card);
  padding: 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  margin-top: 1rem;
}

/* Wish wall */
.wall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  width: 100%;
  max-width: 900px;
  max-height: 35vh;
  overflow-y: auto;
  padding: 0.5rem;
  z-index: 1;
}

.wish-card {
  background: var(--card);
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform: rotate(var(--rot, -1deg));
}

.wish-card:nth-child(even) {
  --rot: 1.5deg;
}

.wish-card strong {
  color: var(--primary-dark);
}

.wish-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 500px;
  margin-top: 1rem;
  z-index: 1;
}

.wish-form input,
.wish-form textarea {
  padding: 0.85rem;
  border: 2px solid #e5d5d5;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
}

.wish-form textarea {
  min-height: 90px;
  resize: vertical;
}

/* Candle */
.status-text {
  min-height: 1.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.countdown {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1rem;
}

.countdown-item {
  background: rgba(255, 255, 255, 0.85);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  text-align: center;
  min-width: 70px;
}

.countdown-item span {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.countdown-item label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
  .memory-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .wall-grid {
    grid-template-columns: 1fr;
    max-height: 28vh;
  }

  .step-content {
    padding: 1.25rem;
  }

  .btn {
    padding: 0.75rem 1.2rem;
  }
}
