@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;800;900&family=Plus+Jakarta+Sans:wght@400;500;700&display=swap');

:root {
  --void: #03060f;
  --navy-deep: #081226;
  --navy-mid: #132a52;
  --gold: #f0b429;
  --gold-light: #ffe4a3;
  --gold-dim: #b8862a;
  --paper: #eef2fb;
  --paper-dim: #9fb0d1;
  --glow-accent: rgba(240, 180, 41, 0.35);
}

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

body {
  background-color: var(--void);
  color: var(--paper);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 85px 16px 30px;
  overflow-x: hidden;
  position: relative;
}

/* Layered Ambient Background & Pulse Glow */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(ellipse 75% 50% at 50% 0%, rgba(28, 77, 143, 0.5), transparent 70%),
    radial-gradient(circle 350px at 50% 100%, rgba(240, 180, 41, 0.2), transparent 75%),
    linear-gradient(rgba(240, 180, 41, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240, 180, 41, 0.04) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 36px 36px, 36px 36px;
  background-position: center center;
  animation: ambientPulse 8s ease-in-out infinite alternate;
}

@keyframes ambientPulse {
  0% { opacity: 0.8; transform: scale(1); }
  100% { opacity: 1; transform: scale(2); }
}

/* Floating Animated Treasure Elements (Pure CSS/SVG, no assets) */
.floating-elements {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.treasure-symbol {
  position: absolute;
  color: var(--gold);
  opacity: 0.19;
  filter: drop-shadow(0 0 6px rgba(240, 180, 41, 0.3));
  animation: floatUp 18s linear infinite;
}

.treasure-symbol.compass {
  width: 30px; height: 30px;
  left: 6%;
  animation-duration: 20s;
  animation-delay: 0s;
}
.treasure-symbol.key {
  width: 28px; height: 28px;
  right: 8%;
  animation-duration: 24s;
  animation-delay: -5s;
}
.treasure-symbol.astrolabe {
  width: 30px; height: 30px;
  left: 88%;
  animation-duration: 22s;
  animation-delay: -10s;
}
.treasure-symbol.map {
  width: 26px; height: 26px;
  left: 18%;
  animation-duration: 17s;
  animation-delay: -14s;
}
.treasure-symbol.hourglass {
  width: 30px; height: 30px;
  right: 22%;
  animation-duration: 19s;
  animation-delay: -8s;
}

@keyframes floatUp {
  0% {
    top: 105%;
    transform: translateX(0) rotate(0deg);
    opacity: 0;
  }
  20% { opacity: 0.18; }
  80% { opacity: 0.18; }
  100% {
    top: -5%;
    transform: translateX(25px) rotate(180deg);
    opacity: 0;
  }
}

/* Corner HUD Elements */
.hud-corner {
  position: fixed;
  z-index: 9;
  width: 18px;
  height: 18px;
  opacity: 0.7;
  pointer-events: none;
}
.hud-corner.tl { top: 10px; left: 10px; border-top: 2px solid var(--gold); border-left: 2px solid var(--gold); }
.hud-corner.tr { top: 10px; right: 10px; border-top: 2px solid var(--gold); border-right: 2px solid var(--gold); }
.hud-corner.bl { bottom: 10px; left: 10px; border-bottom: 2px solid var(--gold); border-left: 2px solid var(--gold); }
.hud-corner.br { bottom: 10px; right: 10px; border-bottom: 2px solid var(--gold); border-right: 2px solid var(--gold); }

/* Navigation Strip */
.nav-strip {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 18, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(240, 180, 41, 0.3);
}

.nav-title {
  font-family: 'Cinzel', Georgia, serif;
  color: var(--gold-light);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: center;
  padding: 0 12px;
}

/* Fluid Container & Responsive Card */
.container {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
}

.clue-box {
  background: linear-gradient(180deg, #0d1a36, #060c1e);
  border: 1px solid rgba(240, 180, 41, 0.45);
  border-radius: 16px;
  padding: 28px 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85),
              0 0 25px rgba(240, 180, 41, 0.12),
              inset 0 1px 1px rgba(255, 255, 255, 0.15);
  text-align: center;
}

h1 {
  font-family: 'Cinzel', Georgia, serif;
  font-size: clamp(2rem, 7.5vw, 2.75rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
  background: linear-gradient(180deg, #ffffff 0%, var(--gold-light) 30%, var(--gold) 70%, var(--gold-dim) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 20px rgba(240, 180, 41, 0.3);
}

.clue-media {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(240, 180, 41, 0.3);
  margin-bottom: 18px;
  background: #000;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.clue-img, video {
  width: 100%;
  height: auto;
  max-height: 250px;
  object-fit: cover;
  display: block;
}

.riddle-text {
  font-size: clamp(0.95rem, 3.8vw, 1.05rem);
  line-height: 1.6;
  color: var(--paper);
  margin-bottom: 18px;
  padding: 0 4px;
}

input[type="text"] {
  width: 100%;
  padding: 13px 16px;
  border-radius: 8px;
  border: 1px solid rgba(240, 180, 41, 0.3);
  background: rgba(255, 255, 255, 0.06);
  color: var(--paper);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  text-align: center;
  margin-bottom: 16px;
  transition: all 0.25s ease;
}

input[type="text"]:focus {
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 12px rgba(240, 180, 41, 0.3);
}

.button-outer {
  width: 100%;
  padding: 2px;
  clip-path: polygon(0% 50%, 4% 0%, 96% 0%, 100% 50%, 96% 100%, 4% 100%);
  background: linear-gradient(180deg, var(--gold-light), var(--gold) 55%, var(--gold-dim));
  cursor: pointer;
  border: none;
  outline: none;
  text-decoration: none;
  display: block;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.button-outer:hover {
  transform: translateY(-2px);
  filter: drop-shadow(0 4px 12px rgba(240, 180, 41, 0.4));
}

.button-face {
  display: flex;
  align-items: center;
  justify-content: center;
  clip-path: polygon(0% 50%, 4% 0%, 96% 0%, 100% 50%, 96% 100%, 4% 100%);
  background: linear-gradient(180deg, var(--navy-mid), var(--navy-deep) 75%);
  padding: 13px 0;
  color: var(--gold-light);
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.button-outer:active .button-face {
  background: var(--navy-mid);
}

.message {
  margin-top: 14px;
  font-weight: 600;
  font-size: 0.92rem;
  min-height: 20px;
}
.message.success { color: #4ade80; }
.message.error { color: #f87171; }

.path-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

/* ---------- START PAGE: Wax Seal ---------- */
.wax-seal {
  width: 90px;
  height: 90px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-light), var(--gold) 45%, var(--gold-dim) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.6),
              inset 0 2px 4px rgba(255,255,255,0.4),
              inset 0 -3px 6px rgba(0,0,0,0.35);
  transition: transform 0.5s ease, opacity 0.5s ease;
}
.wax-seal svg { width: 42px; height: 42px; color: var(--navy-deep); }
.wax-seal.cracked {
  transform: scale(0.8) rotate(-10deg);
  opacity: 0;
}

.stage-fade-in {
  animation: fadeIn 0.6s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- SUCCESS PAGE: Trophy, Stamp, Sparkles ---------- */
.trophy-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.trophy-wrap::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow-accent), transparent 70%);
  animation: trophyPulse 2.4s ease-in-out infinite;
}
.trophy-icon {
  width: 54px;
  height: 54px;
  color: var(--gold-light);
  filter: drop-shadow(0 0 12px rgba(240,180,41,0.6));
  position: relative;
  z-index: 1;
}
@keyframes trophyPulse {
  0%, 100% { transform: scale(0.9); opacity: 0.6; }
  50%      { transform: scale(1.15); opacity: 1; }
}

.sparkle-burst {
  position: absolute;
  width: 16px;
  height: 16px;
  color: var(--gold-light);
  opacity: 0;
  animation: burstOut 1.6s ease-out forwards;
}
.sparkle-burst.s1 { top: -6px; left: -8px;  animation-delay: 0.1s; }
.sparkle-burst.s2 { top: 2px;  right: -14px; animation-delay: 0.4s; }
.sparkle-burst.s3 { bottom: -6px; left: 24px; animation-delay: 0.25s; }
@keyframes burstOut {
  0%   { opacity: 0; transform: scale(0.3) translateY(0); }
  30%  { opacity: 1; }
  100% { opacity: 0; transform: scale(1) translateY(-50px); }
}

.stamp {
  display: inline-block;
  margin: 4px 0 16px;
  padding: 6px 18px;
  border: 3px solid var(--gold);
  border-radius: 6px;
  color: var(--gold-light);
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transform: rotate(-4deg);
  animation: stampIn 0.5s ease-out;
}
@keyframes stampIn {
  0%   { transform: rotate(-4deg) scale(2); opacity: 0; }
  70%  { transform: rotate(-4deg) scale(0.95); opacity: 1; }
  100% { transform: rotate(-4deg) scale(1); }
}

/* Optimization for small screens */
@media (max-width: 380px) {
  body { padding-top: 75px; }
  .clue-box { padding: 20px 14px; }
  .clue-img, video { max-height: 200px; }
}


.nav-strip {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
  background: rgba(4, 8, 18, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(240, 180, 41, 0.3);
}

.nav-logo {
  height: 40px;
  width: 64px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-logo img {
  max-height: 100%;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 4px rgba(240, 180, 41, 0.35));
}

.nav-title {
  font-family: 'Cinzel', Georgia, serif;
  color: var(--gold-light);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: center;
  flex: 1;
  min-width: 0;
}


/* ---------- CLUE PAGES: Progress + Divider + Shake ---------- */
.progress-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
}
.progress-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(240, 180, 41, 0.25);
  border: 1px solid rgba(240, 180, 41, 0.4);
  transition: background 0.3s ease;
}
.progress-dots .dot.active {
  background: var(--gold);
  box-shadow: 0 0 8px rgba(240, 180, 41, 0.7);
}
.progress-dots .dot.done {
  background: var(--gold-dim);
}

.ornament-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 4px 0 16px;
  color: var(--gold-dim);
  opacity: 0.8;
}
.ornament-divider::before,
.ornament-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim));
}
.ornament-divider::after {
  background: linear-gradient(90deg, var(--gold-dim), transparent);
}
.ornament-divider svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
input.shake {
  animation: shake 0.35s ease;
  border-color: #f87171 !important;
}