:root {
  --bg-ink: #0d1310;
  --bg-shadow: #1d1811;
  --stone-dark: #1a1f1c;
  --stone-mid: #28302b;
  --stone-light: #3d463e;
  --moss: #4c6b47;
  --torch: #ffb85c;
  --ember: #ff7a2f;
  --glow-cyan: #4ad7db;
  --glow-gold: #f4c66a;
  --frame: #69533a;
  --frame-shadow: rgba(0, 0, 0, 0.52);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(rgba(5, 8, 7, 0.18), rgba(5, 8, 7, 0.18)),
    url("./assets/dungeon-shell.svg"),
    linear-gradient(180deg, #21180f, #121712 36%, #0a0f0c 100%);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  color: #f2eee3;
  font-family: "Trebuchet MS", Verdana, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 2px, transparent 2px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 2px, transparent 2px),
    linear-gradient(180deg, rgba(0, 0, 0, 0.18), transparent 12%, transparent 88%, rgba(0, 0, 0, 0.24));
  background-size: 56px 56px, 56px 56px, 100% 100%;
  pointer-events: none;
  opacity: 0.18;
  animation: shellDrift 18s linear infinite;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 16% 22%, rgba(255, 184, 92, 0.28), transparent 3.8rem),
    radial-gradient(circle at 84% 22%, rgba(255, 184, 92, 0.28), transparent 3.8rem),
    radial-gradient(circle at 16% 22%, rgba(255, 122, 47, 0.16), transparent 8rem),
    radial-gradient(circle at 84% 22%, rgba(255, 122, 47, 0.16), transparent 8rem),
    radial-gradient(circle at 50% 82%, rgba(74, 215, 219, 0.08), transparent 24rem);
  pointer-events: none;
  animation: torchFlicker 3.4s steps(6) infinite alternate;
}

.shell {
  width: min(94vw, 1400px);
  aspect-ratio: 16 / 9;
  position: relative;
  display: grid;
  place-items: center;
  padding: 2rem;
  border-radius: 26px;
  background:
    radial-gradient(circle at 50% -10%, rgba(244, 198, 106, 0.1), transparent 24%),
    radial-gradient(circle at 8% 50%, rgba(74, 215, 219, 0.045), transparent 18%),
    radial-gradient(circle at 92% 50%, rgba(74, 215, 219, 0.045), transparent 18%),
    linear-gradient(180deg, rgba(11, 17, 23, 0.96), rgba(9, 14, 20, 0.98));
  box-shadow:
    0 34px 72px rgba(0, 0, 0, 0.42),
    inset 0 0 0 2px rgba(244, 198, 106, 0.12),
    inset 0 18px 32px rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 5%, rgba(0, 0, 0, 0.24) 5%, rgba(0, 0, 0, 0.24) 6%, transparent 6%, transparent 94%, rgba(0, 0, 0, 0.24) 94%, rgba(0, 0, 0, 0.24) 95%, transparent 95%),
    linear-gradient(180deg, transparent 6%, rgba(0, 0, 0, 0.2) 6%, rgba(0, 0, 0, 0.2) 7%, transparent 7%, transparent 93%, rgba(0, 0, 0, 0.24) 93%, rgba(0, 0, 0, 0.24) 94%, transparent 94%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 0, rgba(255, 255, 255, 0.015) 50%, rgba(0, 0, 0, 0.05) 50%, rgba(0, 0, 0, 0.05) 100%);
  background-size: auto, auto, 96px 96px;
  pointer-events: none;
  opacity: 0.9;
}

.shell::after {
  content: "";
  position: absolute;
  inset: 1.2rem;
  border-radius: 18px;
  border: 1px solid rgba(244, 198, 106, 0.16);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.24),
    inset 0 0 28px rgba(0, 0, 0, 0.28),
    inset 0 0 40px rgba(74, 215, 219, 0.03);
  pointer-events: none;
  animation: shellPulse 5.6s ease-in-out infinite;
}

canvas {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1280px;
  aspect-ratio: 16 / 9;
  display: block;
  image-rendering: pixelated;
  border-radius: 14px;
  border: 4px solid rgba(122, 98, 62, 0.92);
  box-shadow:
    0 30px 60px var(--frame-shadow),
    0 0 40px rgba(74, 215, 219, 0.08),
    inset 0 0 20px rgba(255, 255, 255, 0.06);
  background: #05070c;
}

@keyframes torchFlicker {
  0% {
    opacity: 0.72;
    transform: scale(1) translateY(0);
  }
  100% {
    opacity: 1;
    transform: scale(1.015) translateY(-2px);
  }
}

@keyframes shellDrift {
  0% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(8px, 4px, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes shellPulse {
  0%,
  100% {
    opacity: 0.9;
  }
  50% {
    opacity: 1;
  }
}
