:root {
  --rose: #f4c9d6;
  --rose-deep: #e8a4b8;
  --rose-ink: #c45c7a;
  --blue: #c9e4f5;
  --blue-deep: #8ec4e6;
  --blue-ink: #4f86a8;
  --cream: #fff6f8;
  --paper: #fffcfb;
  --ink: #3f2e38;
  --muted: #8a6f7a;
  --seal: #c45c7a;
  --gold: #d4b08c;
  --shadow: 0 18px 50px rgba(140, 80, 110, 0.14);
  --radius: 28px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

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

body {
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #f8d5e2 0%, #f7eef8 38%, #dceef8 100%);
  background-attachment: fixed;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

img {
  max-width: 100%;
  display: block;
}

button,
input {
  font-family: inherit;
}

.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(30px);
  opacity: 0.7;
}

.blob-a {
  width: 280px;
  height: 280px;
  background: #ffd6e5;
  top: -80px;
  right: -60px;
}

.blob-b {
  width: 240px;
  height: 240px;
  background: #c5e8fb;
  bottom: 10%;
  left: -80px;
}

.blob-c {
  width: 180px;
  height: 180px;
  background: #ffe9c9;
  bottom: -40px;
  right: 10%;
}

.spark {
  position: absolute;
  color: #c45c7a;
  opacity: 0.35;
  animation: floaty 7s ease-in-out infinite;
}

.s1 { top: 12%; left: 10%; font-size: 18px; }
.s2 { top: 22%; right: 12%; font-size: 14px; animation-delay: 1.4s; color: #4f86a8; }
.s3 { bottom: 18%; left: 18%; font-size: 16px; animation-delay: 2.2s; }
.s4 { bottom: 28%; right: 8%; font-size: 13px; animation-delay: 3.1s; color: #4f86a8; }

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

#app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  padding: calc(20px + var(--safe-top)) 18px calc(28px + var(--safe-bottom));
  max-width: 460px;
  margin: 0 auto;
}

.screen {
  animation: rise 0.55s ease;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--rose-ink);
  font-weight: 800;
}

.stamp {
  border: 1.5px dashed var(--rose-ink);
  color: var(--rose-ink);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 6px;
  transform: rotate(-8deg);
  font-weight: 800;
}

h1, h2, .serif {
  font-family: "Cormorant Garamond", Georgia, serif;
}

.script {
  font-family: "Great Vibes", cursive;
}

.card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px 24px;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(63, 46, 56, 0.03) 0.6px, transparent 0.6px);
  background-size: 7px 7px;
  pointer-events: none;
}

.card > * {
  position: relative;
}

.cover {
  text-align: center;
  padding: 48px 22px 28px;
}

.cover::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 72%;
  height: 16px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #f4c9d6, #d5ecf8 50%, #f4c9d6);
  border-radius: 0 0 18px 18px;
}

.wax {
  width: 86px;
  height: 86px;
  margin: 8px auto 18px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #e57a96, #c45c7a 58%, #9e3d5d);
  box-shadow:
    inset 0 4px 8px rgba(255, 255, 255, 0.28),
    0 10px 20px rgba(160, 50, 80, 0.28);
  display: grid;
  place-items: center;
  color: #fff7f8;
  font-size: 34px;
  animation: pulse 2.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.cover h1 {
  font-size: 34px;
  line-height: 1.15;
  font-weight: 600;
  margin: 8px 0 10px;
}

.cover .for {
  font-size: 34px;
  color: var(--rose-ink);
  display: block;
  margin-bottom: 12px;
}

.lead {
  color: var(--muted);
  font-size: 15px;
}

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  width: 100%;
  border-radius: 999px;
  padding: 15px 18px;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #e38aa6, #c45c7a 55%, #8ec4e6);
  box-shadow: 0 10px 24px rgba(196, 92, 122, 0.28);
  transition: transform 0.18s ease, filter 0.18s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  filter: grayscale(0.35);
  opacity: 0.55;
  cursor: not-allowed;
}

a.btn {
  display: block;
  text-decoration: none;
  text-align: center;
}

.btn.secondary {
  background: #fff;
  color: var(--ink);
  border: 1.5px solid rgba(196, 92, 122, 0.22);
  box-shadow: none;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-weight: 700;
}

.stack {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.progress {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  margin: 4px 0 16px;
}

.pip {
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(196, 92, 122, 0.18);
}

.pip.done {
  background: linear-gradient(90deg, #e38aa6, #8ec4e6);
  border-color: transparent;
}

.pip.current {
  background: #c45c7a;
  box-shadow: 0 0 0 3px rgba(196, 92, 122, 0.18);
}

.cipher {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 0 0 16px;
}

.digit {
  min-width: 34px;
  height: 38px;
  padding: 0 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(142, 196, 230, 0.5);
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--blue-ink);
  font-size: 14px;
}

.digit.on {
  background: #fff;
  color: var(--rose-ink);
  border-color: var(--rose-deep);
}

.place-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(90deg, #fde4ec, #dff1fb);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}

.stage-title {
  font-size: 30px;
  line-height: 1.12;
  margin-bottom: 10px;
}

.story {
  font-size: 15.5px;
  color: #534049;
}

.story p + p {
  margin-top: 10px;
}

.step-done {
  margin-top: 10px;
  font-size: 13px;
  color: var(--blue-ink);
  font-weight: 700;
}

.answer-box {
  margin-top: 16px;
}

.answer-box input {
  width: 100%;
  border: 1.5px solid rgba(196, 92, 122, 0.28);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 16px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.answer-box input:focus {
  border-color: var(--blue-ink);
  box-shadow: 0 0 0 4px rgba(142, 196, 230, 0.28);
}

.answer-box input[readonly] {
  background: #f7eef2;
}

.task {
  margin-top: 16px;
  padding: 14px;
  border-radius: 18px;
  border: 1.5px dashed rgba(196, 92, 122, 0.35);
  background: #fff8fa;
}

.task b {
  display: block;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rose-ink);
  margin-bottom: 6px;
}

.polaroid {
  margin: 18px auto 8px;
  width: min(100%, 280px);
  background: #fff;
  padding: 12px 12px 42px;
  box-shadow: 0 16px 34px rgba(90, 40, 70, 0.14);
  transform: rotate(-1.4deg);
  border-radius: 6px;
}

.polaroid.ready {
  transform: rotate(0.6deg);
}

.frame {
  aspect-ratio: 1;
  background:
    linear-gradient(180deg, #f7e4eb, #e4f1f8);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  color: var(--muted);
  text-align: center;
  padding: 16px;
  font-size: 14px;
  cursor: pointer;
}

.frame input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

.caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  text-align: center;
  font-family: "Great Vibes", cursive;
  font-size: 22px;
  color: #7a4a58;
}

.file-btn {
  position: relative;
  overflow: hidden;
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.reveal {
  margin-top: 8px;
  text-align: center;
  animation: rise 0.5s ease;
}

.code-pair {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 14px 0 8px;
}

.code-pair span {
  width: 64px;
  height: 74px;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #fde8ef);
  border: 1px solid rgba(196, 92, 122, 0.25);
  display: grid;
  place-items: center;
  font-family: "Cormorant Garamond", serif;
  font-size: 40px;
  font-weight: 700;
  color: var(--rose-ink);
  box-shadow: var(--shadow);
  animation: flip 0.6s ease both;
}

.code-pair span:nth-child(2) {
  animation-delay: 0.12s;
  background: linear-gradient(180deg, #fff, #e7f4fb);
  color: var(--blue-ink);
}

@keyframes flip {
  from { transform: rotateX(90deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.riddle {
  margin-top: 8px;
  padding: 16px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid rgba(142, 196, 230, 0.45);
}

.riddle .label {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blue-ink);
  font-weight: 800;
  margin-bottom: 6px;
}

.finale .coords {
  font-family: "Cormorant Garamond", serif;
  font-size: 28px;
  text-align: center;
  letter-spacing: 0.04em;
  margin: 12px 0 4px;
}

.album {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}

.album figure {
  background: #fff;
  padding: 6px 6px 22px;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(90, 40, 70, 0.1);
}

.album img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.album figcaption {
  font-size: 11px;
  text-align: center;
  margin-top: 6px;
  color: var(--muted);
}

.map-links {
  display: grid;
  gap: 8px;
}

.tiny {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.warn {
  color: var(--rose-ink);
  font-size: 13px;
  text-align: center;
  min-height: 18px;
}

.dossier-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 4px;
  text-align: left;
}

.dossier-list li {
  list-style: none;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 14px;
}

.heart-line {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin: 10px 0 2px;
  color: var(--rose-ink);
  letter-spacing: 3px;
}

.btn,
.frame {
  touch-action: manipulation;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
