* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #050608;
  color: #f1e6c8;
  font-family: 'Trebuchet MS', system-ui, sans-serif;
  overflow: hidden;
}

#stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #000;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
}
.screen.active { display: block; }

/* ---------- Title ---------- */
#screen-title {
  display: none;
}
#screen-title.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}
.title-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  filter: brightness(0.75);
}
.title-logo {
  position: absolute;
  top: 5%;
  left: 0;
  right: 0;
  z-index: 2;
  margin: 0;
  padding: 0 16px;
  text-align: center;
  pointer-events: none;
}
.logo-name, .logo-subtitle {
  display: block;
  color: #ffe27a;
  -webkit-text-stroke: 3px #14213d;
  text-shadow:
    3px 3px 0 #14213d, -3px 3px 0 #14213d,
    3px -3px 0 #14213d, -3px -3px 0 #14213d,
    0 10px 22px rgba(0,0,0,0.7);
}
.logo-name {
  font-weight: 900;
  font-size: clamp(2.6rem, 14vw, 5rem);
  letter-spacing: 3px;
  line-height: 1;
}
.logo-subtitle {
  font-weight: 800;
  font-size: clamp(1.05rem, 5vw, 1.7rem);
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-top: 6px;
  -webkit-text-stroke-width: 1.5px;
}
.title-panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 20px 48px;
  width: 100%;
  background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0));
}
.hint {
  max-width: 520px;
  text-align: center;
  font-size: 0.95rem;
  color: #d8c9a0;
  margin: 0;
  padding: 0 12px;
}

.press-any-key {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #ffe27a;
  text-shadow: 0 0 16px rgba(255, 210, 90, 0.8), 0 3px 6px rgba(0,0,0,0.8);
  animation: press-any-key-pulse 1.4s ease-in-out infinite;
}
@keyframes press-any-key-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.97); }
}
@media (prefers-reduced-motion: reduce) {
  .press-any-key { animation: none; }
}

.btn-primary {
  font-family: inherit;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 14px 48px;
  border-radius: 40px;
  border: 3px solid #f6c453;
  background: linear-gradient(180deg, #e2432b, #a5241a);
  color: #fff3d6;
  text-shadow: 0 2px 2px rgba(0,0,0,0.5);
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.6);
}
.btn-primary:active {
  transform: translateY(0);
}

/* ---------- Gameplay ---------- */
#screen-game.active {
  display: block;
}
#player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

#hud {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 5;
  display: flex;
  gap: 8px;
}
#lives {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(0,0,0,0.45);
  border-radius: 30px;
  backdrop-filter: blur(3px);
}
.life-icon {
  font-size: 1.4rem;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.7));
}
.life-icon.lost { opacity: 0.25; filter: grayscale(1); }

/* ---------- QTE prompt ---------- */
#qte-prompt {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
#qte-prompt.hidden { display: none; }

#qte-arrow {
  font-size: 5rem;
  line-height: 1;
  color: #ffe27a;
  text-shadow: 0 0 18px rgba(255, 210, 90, 0.9), 0 0 4px #000;
  animation: qte-pulse 0.5s ease-in-out infinite alternate;
}
@keyframes qte-pulse {
  from { transform: scale(1); }
  to { transform: scale(1.18); }
}

#qte-label {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

#qte-timer-track {
  width: 160px;
  height: 8px;
  border-radius: 6px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.3);
  overflow: hidden;
}
#qte-timer-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ffe27a, #e2432b);
  transform-origin: left center;
}

/* ---------- Flash message (life lost / evaded) ---------- */
#flash-message {
  position: absolute;
  bottom: 14%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 3px 8px rgba(0,0,0,0.9);
  padding: 10px 24px;
  background: rgba(0,0,0,0.4);
  border-radius: 30px;
  opacity: 0;
  transition: opacity 0.25s ease;
}
#flash-message.show { opacity: 1; }
#flash-message.hidden { display: none; }

/* ---------- End screens ---------- */
#screen-end.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  background: #050608;
}
.end-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.end-video.hidden { display: none; }
.end-panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 20px 48px;
  width: 100%;
  text-align: center;
  background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0));
}
#end-title {
  font-size: 2.6rem;
  margin: 0;
  color: #ffe27a;
  text-shadow: 0 3px 10px rgba(0,0,0,0.7);
}
#end-subtitle {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #d8c9a0;
  margin: 0;
}

@media (max-width: 560px) {
  .btn-primary { font-size: 1.15rem; padding: 12px 34px; }
  #qte-arrow { font-size: 3.6rem; }
  #end-title { font-size: 2rem; }
}
