/* LAST NIGHT — page shell
 * The game is a canvas; the page exists only to frame it and get out of the way.
 */

@font-face {
  font-family: "IM Fell English SC";
  src: url("./assets/fonts/im-fell-english-sc-latin-400-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Special Elite";
  src: url("./assets/fonts/special-elite-latin-400-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --ink: #05060b;
  --ash: #cfc6b0;
  --blood: #7d1220;
  --gold: #a8833c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #04050a;
  color: var(--ash);
  font-family: "Special Elite", "Courier New", monospace;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: none;
}

/* One vertical 9:16 frame. Wide screens letterbox. The plate is never stretched. */
#stage {
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(100vw, calc(100vh * 9 / 16));
  height: min(100vh, calc(100vw * 16 / 9));
  width: min(100vw, calc((100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) * 9 / 16));
  height: min(calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)), calc(100vw * 16 / 9));
  transform: translate(-50%, -50%);
  overflow: hidden;
  background: #04050a;
}

canvas.world3d,
canvas#game {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

canvas.world3d {
  z-index: 0;
  pointer-events: none;
}

canvas#game {
  z-index: 1;
  touch-action: none;
  image-rendering: auto;
  cursor: crosshair;
  background: transparent;
}

@media (pointer: coarse) {
  canvas#game { cursor: default; }
}

/* ---------------- fullscreen button ---------------- */

#privacy-link {
  position: fixed;
  left: max(8px, env(safe-area-inset-left));
  top: max(8px, env(safe-area-inset-top));
  z-index: 20;
  min-height: 44px;
  display: grid;
  place-items: center;
  font: 11px/1 "Special Elite", "Courier New", monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: rgba(200, 190, 172, 0.72);
  background: rgba(8, 9, 14, 0.62);
  border: 1px solid rgba(168, 131, 60, 0.28);
  padding: 0 12px;
  touch-action: manipulation;
}
#privacy-link:hover { color: rgba(240, 232, 214, 0.95); border-color: rgba(168, 131, 60, 0.7); }

#fullscreen {
  position: fixed;
  right: max(8px, env(safe-area-inset-right));
  top: max(8px, env(safe-area-inset-top));
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: rgba(200, 190, 172, 0.45);
  background: rgba(8, 9, 14, 0.5);
  border: 1px solid rgba(168, 131, 60, 0.25);
  border-radius: 4px;
  cursor: pointer;
  transition: color .25s, border-color .25s, background .25s;
  z-index: 20;
}
#fullscreen:hover {
  color: rgba(240, 232, 214, 0.9);
  border-color: rgba(168, 131, 60, 0.7);
  background: rgba(14, 12, 10, 0.8);
}

/* ---------------- loading veil ---------------- */

#veil {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: #04050a;
  transition: opacity .8s ease;
}
#veil.gone { opacity: 0; pointer-events: none; }

.veil-frame {
  position: relative;
  width: min(100vw, calc(100vh * 9 / 16));
  height: min(100vh, calc(100vw * 16 / 9));
  width: min(100vw, calc((100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) * 9 / 16));
  height: min(calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)), calc(100vw * 16 / 9));
  overflow: hidden;
  background: #05060b;
}
.veil-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  image-rendering: auto;
}
.veil-bar {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 1;
  margin: 0;
  width: min(180px, 46%);
  height: 2px;
  background: rgba(200, 190, 172, .22);
  overflow: hidden;
}
.veil-bar span {
  display: block;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, transparent, var(--blood), transparent);
  animation: veilSlide 1.6s ease-in-out infinite;
}

@keyframes veilPulse {
  0%, 100% { opacity: .92; }
  50% { opacity: 1; text-shadow: 0 0 44px rgba(125, 18, 32, .75); }
}
@keyframes veilSlide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(320%); }
}



/* The night owns the corners. The policy link stays on every menu. */
body[data-screen="playing"] #privacy-link,
body[data-screen="playing"] #fullscreen,
body[data-screen="dying"] #privacy-link,
body[data-screen="dying"] #fullscreen,
body[data-screen="intro"] #privacy-link,
body[data-screen="intro"] #fullscreen,
body[data-screen="dawn"] #privacy-link,
body[data-screen="dawn"] #fullscreen {
  visibility: hidden;
  pointer-events: none;
}
