:root {
  --ink: #f5e9d2;
  --accent: #8b0000;
  --accent-dark: #6f0909;
  --gold: #d4b483;
  --shadow: rgba(0, 0, 0, 0.45);
  --card-bg: rgba(20, 12, 8, 0.58);
  --card-border: rgba(212, 180, 131, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Georgia, serif;
  background:
    linear-gradient(rgba(10, 10, 10, 0.55), rgba(10, 10, 10, 0.72)),
    url("assets/img/parchment.svg") center/cover no-repeat fixed;
  overflow-x: hidden;
}

.overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255,255,255,0.05), rgba(0,0,0,0.25));
  pointer-events: none;
}

.container {
  position: relative;
  z-index: 2;
  width: min(920px, 92vw);
  margin: 0 auto;
  padding: 24px 12px 48px;
  text-align: center;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  box-shadow: 0 20px 50px var(--shadow);
  padding: 22px 14px 28px;
  backdrop-filter: blur(2px);
}

.card-welcome {
  max-width: 760px;
  margin: 24px auto 0;
}

.ornament {
  color: var(--gold);
  letter-spacing: 4px;
  margin-bottom: 12px;
  font-size: 16px;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 7vw, 3.2rem);
  letter-spacing: 0.05em;
  line-height: 1.15;
  color: #fff4df;
}

.intro {
  margin: 0 0 22px;
  opacity: 0.96;
  line-height: 1.6;
  font-size: clamp(1rem, 3.8vw, 1.15rem);
}

.intro-large {
  font-size: clamp(1rem, 4vw, 1.2rem);
}

.welcome-box {
  margin: 16px auto;
  max-width: 620px;
  padding: 14px 16px;
  border: 1px solid rgba(212, 180, 131, 0.35);
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  line-height: 1.75;
  font-size: clamp(0.98rem, 3.6vw, 1.06rem);
}

.welcome-box.soft {
  background: rgba(255,255,255,0.04);
  font-style: italic;
}

.primaryButton {
  border: none;
  border-radius: 12px;
  width: 100%;
  max-width: 340px;
  padding: 14px 20px;
  font-size: 1rem;
  font-family: Georgia, serif;
  cursor: pointer;
  background: linear-gradient(180deg, #a81414, var(--accent-dark));
  color: white;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  transition: transform 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
}

.primaryButton:hover {
  transform: translateY(-1px) scale(1.02);
  filter: brightness(1.05);
}

.primaryButton:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.countdown {
  margin-top: 18px;
  min-height: 26px;
  font-size: clamp(0.95rem, 3.5vw, 1.05rem);
  color: #f8dfb7;
  line-height: 1.4;
}

.phraseBox {
  margin-top: 22px;
  min-height: 56px;
  font-style: italic;
  line-height: 1.65;
  color: #f1ddbc;
  font-size: clamp(0.98rem, 3.6vw, 1.05rem);
}

.typewriterBox {
  margin-top: 24px;
  min-height: 58px;
  font-size: clamp(1.25rem, 6vw, 2.2rem);
  letter-spacing: 0.08em;
  font-family: "Courier New", monospace;
  color: #fff9ef;
  white-space: pre-wrap;
  word-break: break-word;
}

.cursor {
  display: inline-block;
  width: 9px;
  height: 1.1em;
  margin-left: 4px;
  background: #d4b483;
  vertical-align: middle;
  animation: blink 1s infinite;
}

.hidden {
  display: none !important;
}

.answerBox {
  margin-top: 24px;
}

.answerLabel {
  margin: 0 0 10px;
  font-size: clamp(0.98rem, 3.6vw, 1rem);
}

.answerControls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

input {
  width: 100%;
  max-width: 340px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(212, 180, 131, 0.5);
  background: rgba(255, 246, 231, 0.95);
  color: #2a1d14;
  font-size: 1rem;
  outline: none;
}

.feedback {
  min-height: 28px;
  margin-top: 16px;
  color: #ffd9cf;
  line-height: 1.5;
  font-size: clamp(0.95rem, 3.4vw, 1rem);
}

.roseScene {
  margin-top: 28px;
  animation: fadeIn 1.5s ease forwards;
}

.roseImage {
  width: min(180px, 52vw);
  filter: drop-shadow(0 0 12px rgba(180, 0, 0, 0.25));
}

.finalScene {
  margin-top: 32px;
  animation: fadeIn 1.8s ease forwards;
}

.finalScene h2 {
  margin: 0;
  font-size: clamp(1.9rem, 8vw, 3rem);
  color: #fff2d8;
  line-height: 1.15;
}

.finalScene p {
  margin: 10px 0 0;
  font-size: clamp(1rem, 4vw, 1.2rem);
}

.concertName {
  letter-spacing: 0.05em;
  color: #ffd8d8;
}

.ticketScene {
  margin-top: 22px;
  animation: fadeIn 1.6s ease forwards;
}

.ticketImage {
  width: min(720px, 92vw);
  max-width: 100%;
  height: auto;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.45);
}

.petal {
  position: fixed;
  top: -80px;
  width: 34px;
  pointer-events: none;
  opacity: 0.9;
  animation: fall linear forwards;
  z-index: 3;
}

.footer-quote {
  margin-top: 22px;
  font-style: italic;
  color: #ecd7b4;
  font-size: clamp(0.9rem, 3.2vw, 0.98rem);
  line-height: 1.6;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fall {
  0% {
    transform: translateY(-60px) rotate(0deg) translateX(0);
    opacity: 0;
  }
  10% {
    opacity: 0.95;
  }
  100% {
    transform: translateY(110vh) rotate(360deg) translateX(60px);
    opacity: 0;
  }
}

@media (min-width: 768px) {
  .container {
    padding: 40px 16px 64px;
  }

  .card {
    padding: 28px 18px 34px;
  }

  .ornament {
    font-size: 20px;
  }

  .answerControls {
    flex-direction: row;
    justify-content: center;
    align-items: stretch;
  }

  input {
    max-width: 320px;
  }

  #answerButton {
    width: auto;
    min-width: 140px;
  }

  .roseImage {
    width: min(240px, 40vw);
  }
}