/* The colours are pooppopper.com's (src/index.css). */
:root {
  --bg: #0b1f22;
  --panel: #143034;
  --line: #23555a;
  --teal: #37d0be;
  --gold: #ffcf3a;
  --amber: #ffb52e;
  --text: #eaf7f3;
  --muted: #a9ccc7;
  --ink-2: #071b1d;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
  font: 500 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
  background: var(--bg) url("bg-sewer.webp") center / cover no-repeat;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(7, 27, 29, 0.78);
}

#stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}

/* The game at 9:16, its UI's reference shape (1080 x 1920), as tall as the window allows. */
#game {
  position: relative;
  height: calc(100vh - 32px);
  height: min(calc(100dvh - 32px), calc((100vw - 32px) * 16 / 9));
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 2px solid var(--ink-2);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  touch-action: none;
}

#unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--bg);
  outline: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px;
  background: var(--bg) url("bg-sewer.webp") center / cover no-repeat;
}

#loader[hidden] {
  display: none;
}

#loader-logo {
  width: min(78%, 420px);
  height: auto;
}

#loader-bar {
  width: min(64%, 320px);
  height: 16px;
  padding: 2px;
  border: 2px solid var(--ink-2);
  border-radius: 8px;
  background: rgba(7, 27, 29, 0.7);
}

#loader-fill {
  width: 0;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--gold), var(--amber));
  transition: width 0.2s ease-out;
}

#loader-message {
  margin: 0;
  max-width: 32ch;
  text-align: center;
  color: var(--text);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

#rotate {
  position: fixed;
  inset: 0;
  display: none;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 24px;
  background: var(--bg);
  text-align: center;
  font-size: 18px;
}

#rotate svg {
  width: 72px;
  height: 72px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#rotate p {
  margin: 0;
}

#links {
  position: fixed;
  left: 20px;
  bottom: 16px;
  display: flex;
  gap: 18px;
  font-size: 14px;
}

#links[hidden] {
  display: none;
}

#links a {
  color: var(--muted);
  text-decoration: none;
}

#links a:hover,
#links a:focus-visible {
  color: var(--text);
  text-decoration: underline;
}

#banner {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 6px;
  width: min(92vw, 480px);
  pointer-events: none;
}

#banner div {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--ink-2);
  background: var(--gold);
}

#banner div.error {
  color: #fff;
  background: #b3261e;
}

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 24px;
  text-align: center;
}

/* A phone or tablet held upright: the game fills its screen. */
@media (orientation: portrait) {
  .handheld #game {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

/* A phone held sideways: too short for the game, so it asks to be turned upright. The game keeps running behind. */
@media (orientation: landscape) and (max-height: 560px) {
  .handheld #rotate {
    display: grid;
  }
}
