:root {
  --bg-1: #170f1f;
  --bg-2: #241327;
  --bg-3: #33192f;
  --rose: #e2a1b0;
  --rose-deep: #8a3c57;
  --gold: #dfbf82;
  --text: #f9edf2;
  --text-soft: #d7bdc8;
  --card: rgba(44, 23, 41, 0.52);
  --border: rgba(255, 217, 232, 0.2);
  --ok: #9dd3ab;
  --error: #f09aac;
  --shadow: 0 18px 56px rgba(0, 0, 0, 0.35);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 18% 12%, #462138 0%, var(--bg-1) 32%, var(--bg-2) 100%);
  overflow-x: hidden;
}

.app-shell {
  width: min(980px, 92vw);
  margin: 0 auto;
  padding: 4rem 0 3rem;
  position: relative;
  z-index: 3;
}

.glass {
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  border-radius: 24px;
}

.screen {
  padding: clamp(1.2rem, 4vw, 2rem);
  animation: fadeIn 0.7s ease;
}

.hero {
  text-align: center;
  padding: clamp(2rem, 8vw, 4rem);
}

h1,
h2,
h3 {
  font-family: "Cormorant Garamond", Georgia, serif;
  color: #ffe7ef;
  margin: 0 0 0.75rem;
  line-height: 1.12;
}

h1 {
  font-size: clamp(2rem, 7vw, 4.2rem);
}

h2 {
  font-size: clamp(1.6rem, 5vw, 2.8rem);
}

h3 {
  font-size: clamp(1.3rem, 4vw, 2rem);
}

p {
  line-height: 1.65;
  margin: 0.4rem 0 1rem;
}

.intro-copy {
  max-width: 660px;
  margin: 0 auto 1.2rem;
  color: var(--text-soft);
}

.hint,
.feedback {
  margin-top: 0.8rem;
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
  font-size: 0.95rem;
}

.hint {
  background: rgba(223, 191, 130, 0.16);
  border: 1px solid rgba(223, 191, 130, 0.45);
}

.feedback.success {
  background: rgba(157, 211, 171, 0.16);
  border: 1px solid rgba(157, 211, 171, 0.45);
  color: #d6f4dd;
}

.feedback.error {
  background: rgba(240, 154, 172, 0.15);
  border: 1px solid rgba(240, 154, 172, 0.35);
  color: #ffdbe4;
}

.buttons,
.inline-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
}

button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.btn {
  border-radius: 999px;
  padding: 0.72rem 1.25rem;
  font-weight: 600;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.btn:focus-visible {
  outline: 3px solid rgba(199, 164, 104, 0.4);
  outline-offset: 2px;
}

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

.btn.primary {
  background: linear-gradient(130deg, var(--rose), var(--rose-deep));
  color: #fff9fb;
  box-shadow: 0 8px 20px rgba(155, 85, 98, 0.28);
}

.btn.secondary {
  background: rgba(255, 239, 247, 0.1);
  border: 1px solid rgba(255, 221, 233, 0.24);
  color: var(--text);
}

.btn.ghost {
  background: transparent;
  border: 1px dashed rgba(255, 209, 225, 0.38);
  color: var(--text-soft);
}

.music-toggle {
  position: fixed;
  right: 1rem;
  top: 1rem;
  z-index: 11;
  border-radius: 999px;
  background: rgba(40, 20, 35, 0.88);
  border: 1px solid rgba(255, 222, 235, 0.25);
  color: #ffe6ef;
  padding: 0.55rem 0.95rem;
  box-shadow: 0 10px 25px rgba(83, 55, 61, 0.16);
}

.progress-shell {
  margin: 1rem 0 1.5rem;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-soft);
  margin-bottom: 0.45rem;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(241, 185, 208, 0.22);
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #df95a7, #c7a468);
  transition: width 0.4s ease;
}

.meta-row {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin: 1.2rem 0 0.3rem;
}

.meta-card {
  border: 1px solid rgba(255, 220, 233, 0.22);
  border-radius: 14px;
  background: rgba(255, 240, 250, 0.06);
  padding: 0.8rem;
}

.meta-card small {
  color: var(--text-soft);
  display: block;
}

.options-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
  margin-top: 1rem;
}

.option-card {
  text-align: left;
  border: 1px solid rgba(255, 209, 226, 0.24);
  border-radius: 16px;
  background: rgba(255, 240, 250, 0.1);
  padding: 0.95rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.option-card:hover {
  border-color: rgba(155, 85, 98, 0.7);
}

.option-card.selected {
  border-color: var(--rose-deep);
  box-shadow: 0 8px 20px rgba(155, 85, 98, 0.18);
}

.order-list {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.55rem;
}

.order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(133, 98, 106, 0.2);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
}

.order-controls button {
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(125, 92, 100, 0.35);
  padding: 0.2rem 0.5rem;
}

.answer-input {
  width: 100%;
  border: 1px solid rgba(255, 215, 230, 0.3);
  border-radius: 12px;
  font-size: 1rem;
  padding: 0.75rem 0.85rem;
  background: rgba(255, 247, 251, 0.12);
  color: var(--text);
}

.memory-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(52px, 1fr));
  gap: 0.5rem;
  margin-top: 1rem;
}

.memory-card {
  min-height: 68px;
  border-radius: 12px;
  border: 1px solid rgba(122, 95, 102, 0.26);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.95), rgba(255, 240, 240, 0.9));
  font-size: 1.4rem;
}

.memory-card.done {
  background: linear-gradient(150deg, rgba(255, 233, 237, 1), rgba(255, 255, 255, 0.95));
}

.souvenir {
  display: grid;
  gap: 1rem;
}

.souvenir-media {
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(126, 94, 101, 0.2);
  background: rgba(255, 255, 255, 0.5);
  min-height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  text-align: center;
  padding: 1rem;
  overflow: hidden;
}

.souvenir-photo {
  width: 100%;
  height: min(56vw, 360px);
  object-fit: cover;
  object-position: center center;
  border-radius: 12px;
  display: block;
}

.souvenir-media-fallback {
  width: 100%;
  min-height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  text-align: center;
  padding: 1rem;
}

.timeline {
  margin-top: 1rem;
  border-left: 2px solid rgba(199, 164, 104, 0.6);
  padding-left: 1rem;
}

.timeline-item {
  margin-bottom: 1rem;
}

.timeline-item strong {
  color: #6d4350;
}

.final-letter {
  white-space: pre-wrap;
  font-size: 1.03rem;
  line-height: 1.8;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(122, 93, 100, 0.25);
  border-radius: 16px;
  padding: 1rem;
}

.count-together {
  margin: 0.8rem 0 1rem;
  color: #6f4954;
  font-weight: 500;
}

#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: radial-gradient(circle at top, #fffcfb, #f7e5df 60%, #f0d7d1 100%);
  display: grid;
  place-items: center;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

#loading-screen.hide {
  opacity: 0;
  visibility: hidden;
}

.loading-inner {
  width: min(460px, 84vw);
  text-align: center;
}

.loading-subtitle {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #f1cad9;
  font-size: 0.78rem;
}

.loading-bar {
  margin-top: 1rem;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  overflow: hidden;
}

.loading-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #cb8a9b, #c8a66b);
}

#particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.particle {
  position: absolute;
  bottom: -30px;
  opacity: 0;
  animation: floatUp linear forwards;
}

.reveal-burst {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 13;
}

.burst-heart {
  position: absolute;
  font-size: 1.2rem;
  animation: burst 1500ms ease-out forwards;
}

.burst-heart.sad {
  filter: grayscale(0.2);
  opacity: 0.9;
}

.ending-screen {
  text-align: center;
  padding: clamp(1.6rem, 5vw, 3rem);
}

.ending-yes {
  background:
    radial-gradient(circle at top, rgba(255, 214, 230, 0.14), transparent 35%),
    var(--card);
}

.ending-no {
  background:
    radial-gradient(circle at top, rgba(163, 173, 235, 0.12), transparent 35%),
    rgba(30, 22, 44, 0.7);
}

.ending-copy {
  max-width: 680px;
  margin: 0 auto 1rem;
  font-size: 1.04rem;
}

.ending-emoji {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin: 1rem 0 1.4rem;
  letter-spacing: 0.25rem;
}

.no-js {
  padding: 1rem;
  margin: 1rem;
  border-radius: 14px;
  background: #fff;
}

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

@keyframes floatUp {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.9);
  }
  15% {
    opacity: 0.55;
  }
  100% {
    opacity: 0;
    transform: translateY(-110vh) scale(1.1);
  }
}

@keyframes burst {
  from {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    opacity: 0;
    transform: translate3d(var(--x), var(--y), 0) scale(1.4);
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding-top: 5rem;
  }

  .memory-board {
    grid-template-columns: repeat(3, minmax(64px, 1fr));
  }
}
