:root {
  --pink: #e8488a;
  --pink-dark: #c93675;
  --cream: #f7eed8;
  --plum: #2e1a30;
  --gold: #e8b85a;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: #1a0e1c;
  font-family: 'Nunito', system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

#vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(40, 12, 30, 0.38) 100%);
}

.key {
  display: inline-block;
  background: var(--cream);
  color: var(--plum);
  border-radius: 6px;
  border-bottom: 3px solid #c9b88a;
  padding: 2px 9px;
  margin: 0 2px;
  font-weight: 800;
  font-size: 0.85em;
  letter-spacing: 0.04em;
}

/* ============================== HUD ============================== */
#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5;
  display: none;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px 26px;
  pointer-events: none;
  color: var(--cream);
  text-shadow: 0 2px 8px rgba(40, 10, 30, 0.55);
}
#hud.show { display: flex; }

.hud-left { display: flex; flex-direction: column; gap: 6px; min-width: 170px; }
#hearts { font-size: 26px; letter-spacing: 4px; }
.heart { color: var(--pink); }
.heart.empty { color: rgba(247, 238, 216, 0.45); }

.hud-stat { display: flex; gap: 10px; align-items: baseline; font-size: 19px; font-weight: 800; }
.hud-label {
  font-size: 11px; font-weight: 800; letter-spacing: 0.18em;
  text-transform: uppercase; opacity: 0.75;
}

.hud-center { text-align: center; flex: 1; max-width: 460px; margin: 0 20px; }
#chapter-label {
  font-family: 'Playfair Display', serif;
  font-size: 19px; font-weight: 700; font-style: italic;
  margin-bottom: 8px;
}
#chapter-bar {
  height: 8px; border-radius: 99px;
  background: rgba(247, 238, 216, 0.25);
  border: 1px solid rgba(247, 238, 216, 0.35);
  overflow: hidden;
}
#chapter-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--pink), #ff7fb3);
  border-radius: 99px;
  transition: width 0.25s linear;
}

.hud-right { min-width: 170px; text-align: right; }
.hud-keys { font-size: 12px; font-weight: 600; opacity: 0.8; }

/* ============================ prompts ============================ */
#eat-prompt {
  position: fixed; left: 50%; bottom: 17%; transform: translateX(-50%) scale(0.9);
  z-index: 5; pointer-events: none;
  background: rgba(46, 26, 48, 0.85);
  border: 2px solid var(--pink);
  color: var(--cream);
  font-weight: 800; font-size: 20px;
  padding: 12px 26px; border-radius: 99px;
  opacity: 0; transition: opacity 0.15s, transform 0.15s;
  box-shadow: 0 0 30px rgba(232, 72, 138, 0.45);
}
#eat-prompt.show { opacity: 1; transform: translateX(-50%) scale(1); animation: pulse 0.9s infinite; }
@keyframes pulse {
  50% { box-shadow: 0 0 48px rgba(232, 72, 138, 0.8); }
}

#toast {
  position: fixed; left: 50%; bottom: 7%; transform: translateX(-50%);
  z-index: 5; pointer-events: none;
  max-width: min(620px, 86vw);
  background: rgba(247, 238, 216, 0.95);
  color: var(--plum);
  font-weight: 700; font-size: 15.5px; text-align: center;
  padding: 11px 24px; border-radius: 14px;
  border-left: 5px solid var(--pink);
  opacity: 0; transition: opacity 0.3s;
  box-shadow: 0 8px 30px rgba(30, 8, 25, 0.4);
}
#toast.show { opacity: 1; }

/* ===================== card / overlay screens ===================== */
#card, #gameover {
  position: fixed; inset: 0; z-index: 8;
  display: flex; align-items: center; justify-content: center;
  background: rgba(30, 10, 28, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s;
}
#card.show, #gameover.show { opacity: 1; pointer-events: auto; }

.card-inner {
  width: min(620px, 90vw);
  background: linear-gradient(170deg, #fdf6e3, var(--cream));
  border-radius: 18px;
  border: 2px solid var(--gold);
  outline: 6px solid rgba(232, 72, 138, 0.16);
  padding: 38px 46px 30px;
  text-align: center;
  color: var(--plum);
  box-shadow: 0 30px 80px rgba(20, 5, 18, 0.6);
  transform: translateY(12px);
  transition: transform 0.35s;
}
#card.show .card-inner, #gameover.show .card-inner { transform: translateY(0); }

.card-dots { margin-bottom: 14px; }
.card-dots i {
  display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  background: var(--pink); margin: 0 5px;
}
.card-dots i:nth-child(2) { width: 15px; height: 15px; }

#card-year {
  font-family: 'Playfair Display', serif;
  font-size: 15px; font-weight: 700; letter-spacing: 0.45em;
  color: var(--pink-dark);
}
#card-place {
  font-size: 12px; font-weight: 800; letter-spacing: 0.14em;
  text-transform: uppercase; opacity: 0.6; margin-top: 5px;
}
#card h2, #gameover h2 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(26px, 4.4vw, 38px);
  font-weight: 900;
  margin: 12px 0 14px;
}
#card-text {
  font-size: 16.5px; line-height: 1.65; font-weight: 600;
  color: #4a3450;
}
.card-hint { margin-top: 24px; font-size: 14px; font-weight: 700; opacity: 0.75; }

/* =========================== start screen =========================== */
#start-screen {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 110%, rgba(232, 72, 138, 0.28), transparent 60%),
    linear-gradient(180deg, #2e1230, #1a0e1c 70%);
  color: var(--cream);
  transition: opacity 0.5s;
}
#start-screen.hidden { opacity: 0; pointer-events: none; }

.start-inner { width: min(680px, 92vw); padding: 20px; }

.brand {
  font-family: 'Playfair Display', serif;
  letter-spacing: 0.5em; font-size: 16px; font-weight: 700;
  color: var(--gold);
}
.brand span {
  display: block; letter-spacing: 0.3em; font-size: 11px;
  font-style: italic; color: rgba(247, 238, 216, 0.6); margin-top: 6px;
  text-transform: lowercase;
}

#start-screen h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(54px, 11vw, 104px);
  font-weight: 900;
  line-height: 1.02;
  margin: 14px 0 6px;
  background: linear-gradient(180deg, #ffd9ea, var(--pink) 75%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 6px 24px rgba(232, 72, 138, 0.35));
}

.subtitle {
  font-family: 'Playfair Display', serif;
  font-style: italic; font-size: clamp(15px, 2.4vw, 20px);
  color: var(--gold); margin-bottom: 22px;
}

.prologue {
  font-size: 15.5px; line-height: 1.7; font-weight: 600;
  color: rgba(247, 238, 216, 0.88);
  max-width: 560px; margin: 0 auto 26px;
}
.prologue em { color: #ff9cc4; }

.controls {
  display: flex; gap: 26px; justify-content: center; flex-wrap: wrap;
  font-size: 14px; font-weight: 700; margin-bottom: 30px;
  color: rgba(247, 238, 216, 0.85);
}

.start-cta {
  font-size: 19px; font-weight: 800;
  animation: breathe 1.6s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: 0.55; } }

.age-note {
  margin-top: 30px; font-size: 11.5px;
  color: rgba(247, 238, 216, 0.45);
}

/* =========================== game over =========================== */
.go-stats {
  display: flex; justify-content: center; gap: 44px; margin: 8px 0 20px;
}
.go-stats > div { display: flex; flex-direction: column; gap: 3px; }
.go-stats b { font-size: 26px; font-family: 'Playfair Display', serif; }

.go-timeline-title {
  font-size: 12px; font-weight: 800; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--pink-dark); margin-bottom: 10px;
}
#go-chapters { list-style: none; text-align: left; max-width: 400px; margin: 0 auto; }
#go-chapters li {
  font-size: 14.5px; font-weight: 700; padding: 5px 0 5px 26px; position: relative;
}
#go-chapters li::before {
  content: ''; position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--pink);
}
#go-chapters li.locked { opacity: 0.4; }
#go-chapters li.locked::before { background: #b5a78a; }
#go-chapters b { color: var(--pink-dark); margin-right: 8px; font-family: 'Playfair Display', serif; }

@media (max-width: 720px) {
  .hud-right { display: none; }
  .hud-left { min-width: 110px; }
  .card-inner { padding: 26px 24px 22px; }
}
