@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600&family=Cormorant+Garamond:ital,wght@1,500;1,600;1,700&display=swap");

:root {
  --bg-1: #0a0a0d;
  --bg-2: #161218;
  --ink: #efe4c3;
  --ink-soft: #f0e2bf;
  --gold: #c8a86a;
  --error: #d6b37a;
  --card: rgba(16, 13, 18, 0.72);
  --border: rgba(200, 168, 106, 0.35);
  --shadow: 0 0 35px rgba(200, 168, 106, 0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
  font-family: "Cinzel", "Georgia", serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 20% 10%, rgba(200, 168, 106, 0.14), transparent 60%),
    radial-gradient(900px 500px at 80% 90%, rgba(239, 228, 195, 0.08), transparent 65%),
    linear-gradient(150deg, var(--bg-1), var(--bg-2));
  display: grid;
  place-items: center;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
}

.fireworks-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999;
  pointer-events: none;
}

.app-shell { width: min(100%, 44rem); }

.card {
  position: relative;
  z-index: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  padding: 1.2rem 1rem;
  overflow: hidden;
}


.mystery-line {
  margin: 0 0 1.2rem;
  text-align: center;
  font-size: clamp(1.15rem, 4.6vw, 1.55rem);
  line-height: 1.4;
  text-shadow: 0 0 14px rgba(200, 168, 106, 0.2);
}

.unlock-form { display: grid; gap: 0.75rem; }

input, button {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  font: inherit;
  color: var(--ink);
}

input { background: rgba(8, 8, 10, 0.55); padding: 0.9rem; font-size: 16px; }
input:focus { outline: 2px solid rgba(200, 168, 106, 0.55); outline-offset: 1px; }

button {
  background: linear-gradient(135deg, rgba(200, 168, 106, 0.18), rgba(200, 168, 106, 0.3));
  padding: 0.85rem 0.9rem;
  cursor: pointer;
}
button:hover, button:focus-visible {
  background: linear-gradient(135deg, rgba(200, 168, 106, 0.32), rgba(200, 168, 106, 0.45));
}

.feedback { min-height: 1.5rem; margin: 0.75rem 0 0; color: var(--error); text-align: center; }
.hidden { display: none; }
.fade-out { animation: fadeOut 550ms ease forwards; }
.fade-in { animation: fadeIn 650ms ease forwards; }

.reveal-image {
  display: block;
  width: 100%;
  max-height: 66vh;
  object-fit: cover;
  object-position: center;
  border-radius: 14px;
  border: 1px solid rgba(200, 168, 106, 0.35);
  margin: 0 0 1rem;
  box-shadow: 0 0 18px rgba(200, 168, 106, 0.2);
  animation: livingPortrait 10s ease-in-out infinite;
  transform-origin: center;
}

.reveal-message-wrap { position: relative; border-radius: 12px; overflow: hidden; }
.reveal-message-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(247, 230, 187, 0.2), rgba(140, 109, 56, 0.1) 42%, rgba(10, 10, 14, 0.24));
  z-index: 0;
}
.reveal-message-wrap::after {
  content: "";
  position: absolute;
  inset: -10% -55%;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 244, 219, 0.3) 50%, transparent 80%);
  z-index: 0;
  animation: spellSweep 5.6s linear infinite;
}

.reveal-text {
  position: relative;
  z-index: 1;
  white-space: pre-line;
  text-align: center;
  line-height: 1.66;
  font-size: clamp(1.12rem, 4.35vw, 1.48rem);
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  text-shadow: 0 0 12px rgba(216, 201, 160, 0.22);
  min-height: 12rem;
  padding: 1rem 0.95rem;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

@keyframes fadeOut { to { opacity: 0; transform: translateY(-3px); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }


@keyframes spellSweep {
  0% { transform: translateX(-40%) rotate(2deg); opacity: 0; }
  15% { opacity: 0.8; }
  55% { opacity: 0.35; }
  100% { transform: translateX(40%) rotate(2deg); opacity: 0; }
}

@keyframes livingPortrait {
  0%, 100% { transform: scale(1) translate3d(0,0,0); filter: saturate(1) brightness(1); }
  25% { transform: scale(1.012) translate3d(-0.3%, -0.2%, 0); filter: saturate(1.03) brightness(1.01); }
  50% { transform: scale(1.008) translate3d(0.35%, 0.15%, 0); filter: saturate(1.02) brightness(1.015); }
  75% { transform: scale(1.012) translate3d(-0.15%, 0.25%, 0); filter: saturate(1.03) brightness(1.01); }
}

@media (max-width: 430px) and (min-height: 900px) {
  .card { padding: 1rem 0.9rem; }
  .reveal-image { max-height: 69vh; }
  .reveal-text { font-size: 1.14rem; line-height: 1.62; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
