:root {
  --ivory: #fff6e6;
  --cream: #fbe6c8;
  --gold: #d9a441;
  --gold-light: #f0c760;
  --marigold: #e57e2e;
  --maroon: #8f2d3b;
  --ink: #4a3324;
}

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

html, body {
  height: 100%;
  background: #2a1d14;
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  color: var(--ink);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

#stage {
  position: relative;
  width: 100vw;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2a1d14;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Overlays */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6vmin;
  transition: opacity 0.6s ease;
}

.overlay.hidden,
.hidden { display: none; }

.overlay.fade-out { opacity: 0; pointer-events: none; }

.panel {
  text-align: center;
  max-width: 34rem;
  padding: 6vmin 7vmin;
  background: rgba(255, 246, 230, 0.92);
  border: 1px solid rgba(217, 164, 65, 0.55);
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(217, 164, 65, 0.25) inset,
              0 24px 60px rgba(42, 29, 20, 0.45);
  backdrop-filter: blur(2px);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.42em;
  font-size: clamp(0.6rem, 1.6vw, 0.78rem);
  color: var(--marigold);
  margin-bottom: 1.4rem;
  font-family: Georgia, serif;
  padding-left: 0.42em;
}

h1 {
  font-size: clamp(2.2rem, 7vw, 3.6rem);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--maroon);
  line-height: 1.05;
}

h2 {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 500;
  color: var(--maroon);
  margin-bottom: 2rem;
}

.sub {
  margin-top: 1rem;
  font-size: clamp(1rem, 2.6vw, 1.25rem);
  color: var(--ink);
  opacity: 0.8;
}

/* Decorative divider under h1 on title/reveal */
.panel h1 + .sub::before {
  content: "❁";
  display: block;
  color: var(--gold);
  font-size: 1.1rem;
  margin: 1rem 0;
  opacity: 0.8;
}

.btn {
  margin-top: 2.4rem;
  font-family: Georgia, serif;
  font-size: clamp(0.8rem, 2vw, 0.95rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ivory);
  background: var(--maroon);
  border: none;
  padding: 0.95rem 2.6rem;
  border-radius: 2px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 6px 18px rgba(143, 45, 59, 0.35);
}
.btn:hover { transform: translateY(-2px); background: #7a2532; }
.btn:active { transform: translateY(0); }

.btn.ghost {
  background: transparent;
  color: var(--maroon);
  border: 1px solid var(--gold);
  box-shadow: none;
}
.btn.ghost:hover { background: rgba(217, 164, 65, 0.14); }

/* Choose screen */
.choices {
  display: flex;
  gap: clamp(1.2rem, 5vw, 3rem);
  justify-content: center;
}

.choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  background: transparent;
  border: 1px solid rgba(217, 164, 65, 0.5);
  border-radius: 3px;
  padding: 1.6rem 1.8rem;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
  font-family: Georgia, serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.82rem;
  color: var(--maroon);
}
.choice:hover {
  transform: translateY(-4px);
  background: rgba(255, 246, 230, 0.7);
  border-color: var(--gold);
}

.portrait {
  width: 96px;
  height: 128px;
  image-rendering: pixelated;
}

/* Touch controls */
#touch {
  position: absolute;
  bottom: 4vmin;
  left: 0;
  right: 0;
  justify-content: space-between;
  padding: 0 5vmin;
  pointer-events: none;
}
#touch:not(.hidden) { display: flex; }

.dpad {
  pointer-events: auto;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 1px solid rgba(255, 246, 230, 0.7);
  background: rgba(74, 51, 36, 0.35);
  color: var(--ivory);
  font-size: 2.4rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(3px);
  transition: background 0.15s ease, transform 0.1s ease;
  user-select: none;
}
.dpad:active { background: rgba(143, 45, 59, 0.6); transform: scale(0.94); }

.hint {
  position: absolute;
  bottom: 4vmin;
  left: 50%;
  transform: translateX(-50%);
  font-family: Georgia, serif;
  font-size: clamp(0.72rem, 2vw, 0.9rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 246, 230, 0.9);
  text-shadow: 0 1px 6px rgba(42, 29, 20, 0.8);
  pointer-events: none;
  transition: opacity 0.4s ease;
  text-align: center;
  white-space: nowrap;
}

.hint.pulse { animation: hintpulse 1.1s ease-in-out infinite; }
@keyframes hintpulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
