/* Shell around the Unity canvas, matching the marketing site's palette. */
:root {
  --night: #04110e;
  --card: #0b211b;
  --ivory: #faf3df;
  --paper: #f3ecd9;
  --gold: #deb871;
  --mint: #65dd9f;
  --muted: #8fa295;
  --edge: #465e4f;
  --sans: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Cormorant", "Iowan Old Style", Georgia, serif;
  color-scheme: dark;
}

@font-face {
  font-family: "Cormorant";
  src: url("../assets/fonts/Cormorant.ttf") format("truetype");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("../assets/fonts/ManropeMedium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("../assets/fonts/ManropeBold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--night);
  color: var(--paper);
  font-family: var(--sans);
  font-weight: 500;
  overflow: hidden;
}

#stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--night);
}

#unity-canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: var(--night);
  outline: none;
}

/* ---------- Loading ---------- */

.loader {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(90% 70% at 50% 40%, #0a2419 0%, var(--night) 70%),
    var(--night);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.7s;
}

.loader[hidden] {
  display: grid !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader__inner {
  width: min(430px, 100%);
  text-align: center;
}

.loader__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--paper);
}

.loader__mark {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 2px 5px rgb(0 0 0 / 0.45));
}

.loader__title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(30px, 6vw, 46px);
  color: var(--ivory);
  margin: 26px 0 22px;
  line-height: 1;
}

.loader__bar {
  height: 2px;
  background: color-mix(in srgb, var(--edge) 55%, transparent);
  border-radius: 2px;
  overflow: hidden;
}

.loader__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--mint));
  transition: width 0.25s linear;
}

.loader__pct {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--mint);
  margin: 12px 0 0;
}

.loader__sig {
  font-family: var(--serif);
  font-style: italic;
  font-size: 19px;
  color: var(--gold);
  margin: 26px 0 0;
}

.loader__note {
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
  margin: 14px 0 0;
}

/* ---------- Banner ---------- */

.banner {
  position: fixed;
  left: 50%;
  bottom: 18px;
  translate: -50% 0;
  z-index: 20;
  max-width: min(560px, calc(100% - 32px));
  padding: 11px 17px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--card) 96%, transparent);
  border: 1px solid color-mix(in srgb, var(--edge) 60%, transparent);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.banner[data-show="true"] { opacity: 1; }
.banner[data-kind="warning"] { border-color: var(--gold); color: var(--gold); }
.banner[data-kind="error"] { border-color: #d4564a; color: #ffb3ab; }

/* ---------- Install gate ---------- */

.install {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  overflow-y: auto;
  background:
    radial-gradient(90% 70% at 50% 30%, #0a2419 0%, var(--night) 70%),
    var(--night);
}

.install[hidden] { display: none; }

.install__inner {
  width: min(400px, 100%);
  text-align: center;
}

.install__icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.45);
}

.install__brand {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--paper);
  margin: 18px 0 0;
}

.install__title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(32px, 8vw, 44px);
  color: var(--ivory);
  margin: 12px 0 14px;
  line-height: 1;
}

.install__text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 22px;
}

.install__button {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--night);
  background: var(--mint);
  border: 0;
  border-radius: 999px;
  padding: 15px 28px;
  width: 100%;
  cursor: pointer;
  box-shadow: 0 12px 30px rgb(101 221 159 / 0.25);
}

.install__button:active { transform: translateY(1px); }
.install__button[hidden] { display: none; }

.install__steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  text-align: left;
}

.install__steps[hidden] { display: none; }

.install__step {
  counter-increment: step;
  display: flex;
  gap: 14px;
  align-items: baseline;
  font-size: 14px;
  line-height: 1.55;
  color: var(--paper);
  padding: 12px 0;
  border-top: 1px solid color-mix(in srgb, var(--edge) 45%, transparent);
}

.install__step::before {
  content: counter(step);
  flex: 0 0 24px;
  height: 24px;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--night);
  background: var(--gold);
  border-radius: 50%;
  transform: translateY(2px);
}

.install__body { flex: 1 1 auto; }
.install__step strong { color: var(--ivory); font-weight: 700; }

.install__glyph {
  width: 18px;
  height: 18px;
  vertical-align: -4px;
  color: var(--mint);
}

/* Each platform sees only its own steps; the last one is shared. */
.install[data-platform="ios"] .install__step--android,
.install[data-platform="android"] .install__step--ios { display: none; }

.install__hint,
.install__done {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
  margin: 18px 0 0;
}

.install__done {
  font-size: 15px;
  color: var(--paper);
}

.install__hint[hidden],
.install__done[hidden] { display: none; }

/* ---------- Rotate prompt ---------- */

/* Phones that will not honour screen.orientation.lock (iOS) get asked to turn
 * the device. Tapping it doubles as the gesture that requests fullscreen. */
.rotate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(90% 70% at 50% 40%, #0a2419 0%, var(--night) 70%),
    var(--night);
  text-align: center;
  cursor: pointer;
}

@media (orientation: portrait) and (pointer: coarse) and (max-width: 767px) {
  .rotate { display: grid; }
}

.rotate__inner { width: min(320px, 100%); }

.rotate__icon {
  width: 72px;
  height: 72px;
  color: var(--mint);
  animation: rotate-hint 2.4s ease-in-out infinite;
}

@keyframes rotate-hint {
  0%, 20% { transform: rotate(0deg); }
  50%, 70% { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
  .rotate__icon { animation: none; }
}

.rotate__title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 34px;
  color: var(--ivory);
  margin: 22px 0 10px;
  line-height: 1;
}

.rotate__text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
}

/* ---------- Chrome ---------- */

.back,
.expand {
  position: fixed;
  top: 14px;
  z-index: 15;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: color-mix(in srgb, var(--night) 72%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid color-mix(in srgb, var(--edge) 50%, transparent);
  border-radius: 999px;
  padding: 8px 15px;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.25s, border-color 0.25s, opacity 0.4s;
}

.back { left: max(14px, env(safe-area-inset-left)); }
.expand { right: max(14px, env(safe-area-inset-right)); }
.back, .expand { top: max(14px, env(safe-area-inset-top)); }

.back:hover,
.expand:hover {
  color: var(--paper);
  border-color: var(--mint);
}

/* Installed as an app the window is already fullscreen and there is no site
 * to go back to; the chrome would only sit on top of the game's own header. */
@media (display-mode: fullscreen), (display-mode: standalone) {
  .expand, .back { display: none; }
}

/* Fade the chrome out of the way once play starts; it returns on hover. */
body[data-playing="true"] .back,
body[data-playing="true"] .expand {
  opacity: 0.22;
}

body[data-playing="true"] .back:hover,
body[data-playing="true"] .expand:hover {
  opacity: 1;
}

:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}
