:root {
  color-scheme: dark;
  font-family: Georgia, "Times New Roman", serif;
  background: #060507;
  color: #fff7df;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 189, 87, 0.18), transparent 34%),
    linear-gradient(180deg, #070509, #120914 54%, #040204);
}

.game-shell {
  position: relative;
  width: min(100vw, 56.25vh);
  height: min(100vh, 177.78vw);
  min-width: 180px;
  min-height: 320px;
  overflow: hidden;
  background: #050406;
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.8);
  touch-action: none;
}

canvas,
.death-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

canvas {
  display: block;
}

.death-video {
  display: none;
  object-fit: cover;
  object-position: 50% 50%;
  background: rgba(0, 0, 0, 0.18);
  mix-blend-mode: screen;
  pointer-events: none;
}

.death-video.show {
  display: block;
}

.panel,
.end-panel {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 4, 7, 0.84);
}

.panel {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.18) 62%, rgba(0, 0, 0, 0.72)),
    url("assets/game_start.png") center / cover no-repeat;
}

.panel.hidden,
.end-panel {
  display: none;
}

.end-panel.show {
  display: grid;
  background: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.42) 72%);
}

.panel-inner {
  position: absolute;
  bottom: max(28px, 5vh);
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

h1 {
  margin: 0 0 14px;
  font-size: clamp(1.9rem, 4vw, 4.6rem);
  line-height: 0.98;
  font-weight: 700;
  text-shadow: 0 0 22px rgba(255, 190, 82, 0.45);
}

p {
  margin: 0 auto 24px;
  max-width: 620px;
  color: #f3dfbd;
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  line-height: 1.45;
}

button {
  border: 1px solid rgba(255, 223, 156, 0.7);
  border-radius: 8px;
  color: #1a0f02;
  background: linear-gradient(180deg, #fff2b9, #e2a63f 58%, #8c5719);
  box-shadow: 0 10px 30px rgba(226, 166, 63, 0.24);
  font: 700 1rem/1 Georgia, "Times New Roman", serif;
  cursor: pointer;
}

#startButton,
#restartButton {
  min-width: 170px;
  min-height: 48px;
  padding: 0 22px;
}

button:active {
  filter: brightness(0.95);
}

.end-panel img {
  width: min(620px, 86%);
  max-height: 34%;
  object-fit: contain;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.75));
  z-index: 2;
}

.end-panel .final-angel {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  object-position: center;
  filter: none;
}

.end-panel.final-victory {
  background: #050406;
}

.end-panel.final-victory #endTitle {
  display: none;
}

.end-panel.final-victory .final-angel {
  display: block;
}

.end-panel button {
  position: absolute;
  bottom: 7vh;
  z-index: 2;
}

.mobile-controls {
  position: absolute;
  right: max(18px, 3vw);
  bottom: max(18px, 4vh);
  display: none;
  gap: 12px;
  pointer-events: auto;
}

.mobile-controls button {
  width: 54px;
  height: 54px;
  font-size: 1.45rem;
  border-radius: 50%;
}

@media (hover: none), (pointer: coarse) {
  .mobile-controls {
    display: flex;
  }
}

@media (max-width: 700px) {
  .panel-inner {
    padding: 20px;
  }

  #startButton,
  #restartButton {
    min-width: 150px;
  }
}
