:root {
  --ink: #07131c;
  --paper: #f7fbf2;
  --lemon: #ffe14a;
  --cherry: #ff4d7a;
  --teal: #2fe0c4;
  --ice: #8ef0ff;
  --muted: rgba(247, 251, 242, 0.72);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  color: var(--paper);
  background: var(--ink);
  font-family: "Sora", system-ui, sans-serif;
}

a {
  color: var(--ice);
  text-decoration: none;
}

a:hover {
  color: var(--lemon);
}

.hub {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem 3rem;
}

.hub__inner {
  width: min(36rem, 100%);
}

.hub__eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lemon);
}

.hub__title {
  margin: 0 0 0.75rem;
  font-family: "Syne", sans-serif;
  font-weight: 800;
  font-size: clamp(2.2rem, 8vw, 3.4rem);
  letter-spacing: -0.03em;
}

.hub__lede {
  margin: 0 0 1.75rem;
  color: var(--muted);
  line-height: 1.55;
}

.game-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.game-list a {
  display: block;
  padding: 1rem 1.15rem;
  border: 1px solid rgba(255, 225, 74, 0.28);
  border-radius: 0.85rem;
  background: rgba(247, 251, 242, 0.04);
  color: var(--paper);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.game-list a:hover {
  border-color: var(--teal);
  background: rgba(47, 224, 196, 0.08);
  color: var(--paper);
}

.game-list strong {
  display: block;
  font-family: "Syne", sans-serif;
  font-size: 1.15rem;
  margin-bottom: 0.25rem;
}

.game-list span {
  color: var(--muted);
  font-size: 0.92rem;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

.hud {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-rows: auto 1fr auto;
  padding: clamp(0.75rem, 2vw, 1.25rem);
  gap: 0.75rem;
}

.hud__panel {
  pointer-events: none;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(255, 225, 74, 0.28);
  border-radius: 0.75rem;
  background: rgba(7, 19, 28, 0.62);
  backdrop-filter: blur(8px);
  width: max-content;
  max-width: 100%;
}

.hud__left {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}

.hud__right {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  text-align: right;
}

.hud__bottom {
  grid-column: 1 / -1;
  grid-row: 3;
  justify-self: center;
  text-align: center;
}

.hud__label {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--lemon);
}

.hud__value {
  margin: 0.15rem 0 0;
  font-family: "Syne", sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
}

.hud__meta {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.hud__nav {
  pointer-events: auto;
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgba(7, 19, 28, 0.72);
  backdrop-filter: blur(6px);
  padding: 1.25rem;
}

.overlay[hidden] {
  display: none;
}

.overlay__card {
  width: min(22rem, 100%);
  padding: 1.4rem 1.35rem;
  border: 1px solid rgba(255, 225, 74, 0.35);
  border-radius: 1rem;
  background: rgba(7, 19, 28, 0.92);
  text-align: center;
}

.overlay__card h1 {
  margin: 0 0 0.5rem;
  font-family: "Syne", sans-serif;
  font-size: 1.8rem;
}

.overlay__card p {
  margin: 0 0 1rem;
  color: var(--muted);
}

.overlay__card button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.25rem;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  background: var(--lemon);
  cursor: pointer;
}

.overlay__card button:hover {
  background: var(--teal);
}

@media (max-width: 640px) {
  .hud {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto 1fr auto;
  }

  .hud__left {
    grid-column: 1;
    grid-row: 1;
  }

  .hud__right {
    grid-column: 2;
    grid-row: 1;
  }

  .hud__bottom {
    grid-column: 1 / -1;
    grid-row: 4;
  }

  .hud__meta kbd {
    display: none;
  }
}

/* ThreeDoom */
.doom-hud {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(0.75rem, 2vw, 1.25rem);
}

.doom-hud__top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.doom-hud__bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.75rem;
}

.doom-face {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(255, 225, 74, 0.35);
  background: linear-gradient(160deg, #3a2218, #1a0e0a);
  position: relative;
  overflow: hidden;
}

.doom-face::before,
.doom-face::after {
  content: "";
  position: absolute;
  background: var(--lemon);
}

.doom-face::before {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  top: 1.05rem;
  left: 0.85rem;
  box-shadow: 1.1rem 0 0 var(--lemon);
}

.doom-face::after {
  width: 1.2rem;
  height: 0.2rem;
  border-radius: 999px;
  left: 1rem;
  bottom: 0.85rem;
  background: var(--cherry);
}

.doom-crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  z-index: 3;
  pointer-events: none;
  opacity: 0.85;
}

.doom-crosshair::before,
.doom-crosshair::after {
  content: "";
  position: absolute;
  background: var(--lemon);
}

.doom-crosshair::before {
  left: 5px;
  top: 0;
  width: 2px;
  height: 12px;
}

.doom-crosshair::after {
  left: 0;
  top: 5px;
  width: 12px;
  height: 2px;
}

.doom-hint {
  position: fixed;
  left: 50%;
  bottom: 5.5rem;
  transform: translateX(-50%);
  z-index: 3;
  pointer-events: none;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(7, 19, 28, 0.72);
  border: 1px solid rgba(255, 225, 74, 0.28);
  color: var(--muted);
  font-size: 0.85rem;
}

.doom-flash {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s linear;
}
.doom-flash.pain { background: rgba(168, 28, 16, 0.55); }
.doom-flash.muzzle { background: rgba(255, 224, 120, 0.32); }
.doom-flash.pickup { background: rgba(120, 200, 120, 0.28); }
.doom-flash.on { opacity: 1; transition: opacity 0.02s linear; }

.doom-hint[hidden] {
  display: none;
}

.td-debug {
  position: fixed;
  left: 0.75rem;
  top: 4.5rem;
  z-index: 8;
  margin: 0;
  padding: 0.55rem 0.7rem;
  max-width: min(28rem, 92vw);
  border: 1px solid rgba(142, 240, 255, 0.35);
  border-radius: 0.55rem;
  background: rgba(7, 19, 28, 0.82);
  color: var(--ice);
  font: 11px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  pointer-events: none;
}

.td-debug[hidden] {
  display: none;
}
