/* ColoRef demo page: Luma, The Chromatic Run.
   The frame is lit by the game's two skies: the Sun's gold at the top left,
   the Moon's indigo at the bottom right. */

@font-face {
  font-family: "Manrope";
  src: url("fonts/manrope.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --bg: #071014;
  --ink: #f7f1dc;
  --ink-2: rgba(247, 241, 220, 0.68);
  --ink-3: rgba(247, 241, 220, 0.44);
  --line: rgba(247, 241, 220, 0.10);
  --sun: #f4c375;
  --moon: #a9c4ff;
  --indigo: #6366f1;
  --teal: #143744;
  --teal-2: #2c6567;
  --graphite: #1c1915;

  --pad-x: clamp(14px, 1.8vw, 28px);
  --pad-y: 14px;
  --gap: 14px;
  --top-h: 46px;
  --bottom-h: 34px;
  /* Everything around the stage, so the frame can cap its width on very wide screens. */
  --chrome: calc(var(--pad-y) * 2 + var(--gap) * 2 + var(--top-h) + var(--bottom-h));

  color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.4;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

a, button { -webkit-tap-highlight-color: transparent; }

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

/* ------------------------------------------------------------------ Ambient */

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.glow {
  position: absolute;
  width: 75vmax;
  height: 75vmax;
  border-radius: 50%;
  filter: blur(20px);
  will-change: transform;
}

.glow-sun {
  left: -28vmax;
  top: -40vmax;
  background: radial-gradient(circle, rgba(244, 195, 117, 0.20) 0%, rgba(244, 195, 117, 0.06) 35%, transparent 62%);
  animation: drift-sun 28s ease-in-out infinite alternate;
}

.glow-moon {
  right: -26vmax;
  bottom: -42vmax;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.30) 0%, rgba(99, 102, 241, 0.08) 38%, transparent 64%);
  animation: drift-moon 32s ease-in-out infinite alternate;
}

.glow-teal {
  left: 30%;
  top: 25%;
  width: 60vmax;
  height: 40vmax;
  background: radial-gradient(ellipse, rgba(44, 101, 103, 0.16) 0%, transparent 65%);
}

.stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 20px 30px, rgba(247, 241, 220, 0.55), transparent 60%),
    radial-gradient(1px 1px at 90px 110px, rgba(169, 196, 255, 0.55), transparent 60%),
    radial-gradient(1.5px 1.5px at 160px 60px, rgba(247, 241, 220, 0.4), transparent 60%);
  background-size: 190px 170px;
  opacity: 0.35;
  -webkit-mask-image: radial-gradient(ellipse at 85% 100%, #000 0%, transparent 55%);
          mask-image: radial-gradient(ellipse at 85% 100%, #000 0%, transparent 55%);
}

@keyframes drift-sun {
  to { transform: translate(8vmax, 5vmax) scale(1.08); }
}

@keyframes drift-moon {
  to { transform: translate(-7vmax, -6vmax) scale(1.1); }
}

/* ------------------------------------------------------------------ Layout */

/* Fixed to the viewport, so nothing (a focused canvas, a phone's toolbar) can scroll it. */
.page {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  grid-template-rows: var(--top-h) minmax(0, 1fr) var(--bottom-h);
  gap: var(--gap);
  padding: var(--pad-y) var(--pad-x);
}

/* ------------------------------------------------------------------ Top bar */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  box-shadow: 0 6px 18px -6px rgba(242, 124, 37, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.brand-name {
  font-size: 18px;
  font-weight: 760;
  letter-spacing: -0.015em;
}

.divider {
  width: 1px;
  height: 28px;
  background: var(--line);
  flex-shrink: 0;
}

.demo-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--sun);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sun);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(244, 195, 117, 0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(244, 195, 117, 0); }
  100% { box-shadow: 0 0 0 0 rgba(244, 195, 117, 0); }
}

.demo-title {
  font-size: 14.5px;
  font-weight: 620;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spacer { flex: 1; }

.link-quiet {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 650;
  text-decoration: none;
  transition: color 0.15s, background-color 0.15s;
}

.link-quiet:hover {
  color: var(--ink);
  background: rgba(247, 241, 220, 0.06);
}

.link-quiet svg { width: 16px; height: 16px; }

/* Get it on the Asset Store: ColoRef's amber key-art gradient. */
.store-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 18px 0 14px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  color: var(--graphite);
  text-decoration: none;
  background: linear-gradient(115deg, #ffe877 0%, #ffb62e 50%, #f27c25 100%);
  box-shadow:
    0 10px 26px -10px rgba(242, 124, 37, 0.75),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(120, 50, 0, 0.25);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.store-btn::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-18deg);
  transition: left 0.6s ease;
}

.store-btn:hover {
  transform: translateY(-1px);
  filter: saturate(1.08);
  box-shadow:
    0 14px 32px -10px rgba(242, 124, 37, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -1px 0 rgba(120, 50, 0, 0.25);
}

.store-btn:hover::after { left: 120%; }
.store-btn:active { transform: translateY(0); }

.store-btn svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.store-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.store-small {
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.78;
}

.store-big {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ------------------------------------------------------------------ Stage */

/* Flex rows all the way down: every box gets a definite size from the one above it, never
   from the canvas, whose drawing buffer Unity resizes to match. */
.stage {
  position: relative;
  min-height: 0;
  display: flex;
  justify-content: center;
}

.frame {
  position: relative;
  isolation: isolate;
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  max-width: calc((100dvh - var(--chrome)) * 2.4);
  padding: 1.5px;
  border-radius: 18px;
  background: linear-gradient(118deg,
    rgba(244, 195, 117, 0.95) 0%,
    rgba(244, 195, 117, 0.25) 18%,
    rgba(247, 241, 220, 0.07) 40%,
    rgba(247, 241, 220, 0.07) 60%,
    rgba(99, 102, 241, 0.35) 82%,
    rgba(169, 196, 255, 0.95) 100%);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.85);
}

/* A soft halo of the same two lights behind the frame. */
.frame::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(118deg, rgba(244, 195, 117, 0.9), transparent 35%, transparent 65%, rgba(99, 102, 241, 0.95));
  filter: blur(34px);
  opacity: 0.32;
}

/* The game's own symbols: Sun bridges are round, Moon bridges are diamonds. */
.mark {
  position: absolute;
  z-index: 3;
  width: 9px;
  height: 9px;
  pointer-events: none;
}

.mark-sun {
  top: -4px;
  left: 34px;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: 0 0 0 3px var(--bg), 0 0 14px 2px rgba(244, 195, 117, 0.8);
}

.mark-moon {
  bottom: -4px;
  right: 34px;
  transform: rotate(45deg);
  background: var(--moon);
  box-shadow: 0 0 0 3px var(--bg), 0 0 14px 2px rgba(169, 196, 255, 0.8);
}

.screen {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  border-radius: 16.5px;
  overflow: hidden;
  background: var(--teal);
}

#unity-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: var(--teal);
  outline: none;
}

/* ------------------------------------------------------------------ Loader */

.loader {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background:
    radial-gradient(120% 90% at 78% 18%, rgba(44, 101, 103, 0.95) 0%, transparent 60%),
    linear-gradient(180deg, #143744 0%, #0e2830 100%);
  transition: opacity 0.8s ease, visibility 0.8s;
}

.loader.is-done {
  opacity: 0;
  visibility: hidden;
}

.loader-icon {
  width: 104px;
  height: 104px;
  border-radius: 24px;
  margin-bottom: 28px;
  box-shadow: 0 24px 50px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(247, 241, 220, 0.08);
  animation: float 4.5s ease-in-out infinite;
}

@keyframes float {
  50% { transform: translateY(-6px); }
}

.loader-title {
  margin: 0 -0.34em 0 0;
  font-size: clamp(34px, 5.2vw, 60px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.34em;
  color: var(--ink);
}

.loader-sub {
  margin: 14px -0.32em 0 0;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--sun);
}

.progress {
  width: min(280px, 64%);
  height: 3px;
  margin-top: 38px;
  border-radius: 3px;
  background: rgba(247, 241, 220, 0.14);
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sun), #fff2d4);
  box-shadow: 0 0 12px rgba(244, 195, 117, 0.9);
  transition: width 0.25s ease;
}

.loader-status {
  margin-top: 14px;
  min-height: 1.4em;
  font-size: 12px;
  font-weight: 550;
  color: rgba(214, 224, 211, 0.72);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.loader.is-error .progress { display: none; }
.loader.is-error .loader-icon { animation: none; filter: grayscale(0.6); }

.loader.is-error .loader-status {
  max-width: 460px;
  color: #ffc4b0;
  line-height: 1.5;
}

/* ------------------------------------------------------------------ Toasts */

#unity-warning {
  position: absolute;
  z-index: 4;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: max-content;
  max-width: calc(100% - 32px);
  pointer-events: none;
}

.toast {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--ink);
  background: rgba(9, 24, 30, 0.88);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.7);
}

.toast-warning { border-color: rgba(244, 195, 117, 0.5); }
.toast-error   { border-color: rgba(255, 140, 110, 0.6); color: #ffd6c8; }

/* ------------------------------------------------------------------ Bottom bar */

.bottombar {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  font-size: 12.5px;
  color: var(--ink-2);
}

.keys {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.key-group {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.key-group > span { margin-left: 2px; }

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: linear-gradient(rgba(247, 241, 220, 0.11), rgba(247, 241, 220, 0.04));
  border: 1px solid rgba(247, 241, 220, 0.13);
  border-bottom-width: 2px;
}

.key-group.is-accent { color: var(--ink); }

.key-group.is-accent kbd {
  color: var(--graphite);
  background: linear-gradient(var(--sun), #e5ad55);
  border-color: #b98a3e;
  box-shadow: 0 0 14px -2px rgba(244, 195, 117, 0.55);
}

.note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
  color: var(--ink-3);
  white-space: nowrap;
}

.note strong {
  color: var(--ink-2);
  font-weight: 650;
}

.skies {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.sky {
  width: 8px;
  height: 8px;
}

.sky-sun  { border-radius: 50%; background: var(--sun); }
.sky-moon { transform: rotate(45deg) scale(0.9); background: var(--moon); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(247, 241, 220, 0.03);
  color: var(--ink-2);
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}

.icon-btn:hover {
  color: var(--ink);
  background: rgba(247, 241, 220, 0.08);
  border-color: rgba(247, 241, 220, 0.2);
}

.icon-btn svg { width: 16px; height: 16px; }

/* ------------------------------------------------------------------ Smaller windows */

@media (max-width: 1180px) {
  .note { display: none; }
  .icon-btn { margin-left: auto; }
}

@media (max-width: 900px) {
  .key-group.is-minor { display: none; }
  .link-quiet span { display: none; }
}

@media (max-width: 640px) {
  :root { --pad-x: 12px; --gap: 10px; }
  .divider, .demo-label { display: none; }
  .store-small { display: none; }
  .store-btn { height: 40px; padding: 0 14px 0 12px; }
  .store-big { font-size: 14px; }
}

@media (max-height: 600px) {
  :root { --pad-y: 10px; --gap: 10px; --bottom-h: 0px; }
  .page { grid-template-rows: var(--top-h) minmax(0, 1fr); }
  .bottombar { display: none; }
}

/* Phones and tablets: the game takes the whole screen below a slim bar. */
.is-mobile {
  --pad-x: 0px;
  --pad-y: 0px;
  --gap: 0px;
  --top-h: 52px;
  --bottom-h: 0px;
}

.is-mobile .page { grid-template-rows: var(--top-h) minmax(0, 1fr); }
.is-mobile .topbar { padding: 0 12px; }
.is-mobile .bottombar,
.is-mobile .mark,
.is-mobile .frame::before { display: none; }
.is-mobile .frame { padding: 0; border-radius: 0; max-width: none; box-shadow: none; }
.is-mobile .screen { border-radius: 0; }

@media (prefers-reduced-motion: reduce) {
  .glow, .live-dot, .loader-icon { animation: none; }
  .store-btn, .store-btn::after, .loader, .progress-fill { transition: none; }
}
