/* Gilded lapis restyle R10 (S1, S1b): the library's colours (C · Gilded lapis, its colour variables)
   and EB Garamond, through the page's own CSS. The frames: S1 desktop 1920×1080, S1 phone 844×390,
   S1b phone 390×844. */
@font-face {
  font-family: "EB Garamond";
  src: url("fonts/EBGaramond-Regular.woff") format("woff");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("fonts/EBGaramond-Bold.woff") format("woff");
  font-weight: 700; font-style: normal; font-display: swap;
}
:root {
  --bg-lapis-deep: #14203c;   /* bg/lapis-deep */
  --bg-trough: #060a18;       /* bg/trough */
  --line-gold: #e8c25a;       /* line/gold */
  --metal-gold: #e8c25a;      /* metal/gold */
  --action-live: #ffe08a;     /* action/live */
  --text-vellum: #f7eed8;     /* text/vellum */
  --text-label: #f7e3a8;      /* text/label */
  --text-danger: #ff9a80;     /* text/danger: danger words (never the danger red) */
  --state-danger: #e5553b;    /* state/danger: rims only */
  --words: "EB Garamond", Georgia, serif;
}

html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  background: var(--bg-lapis-deep); overflow: hidden;
  overscroll-behavior: none; touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#unity-canvas {
  position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh;
  display: block; background: var(--bg-lapis-deep); outline: none;
}

/* S1 Loader · Descending… : the flame, the title, the Progress bar and the status, 22 px apart. */
#loader {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 22px;
  background: var(--bg-lapis-deep);
  color: var(--text-vellum); font-family: var(--words);
  transition: opacity 0.5s ease;
}
#loader.done { opacity: 0; pointer-events: none; }
#loader .title {
  font-weight: 700; font-size: 72px; line-height: 76px; letter-spacing: 0.12em;
  text-align: center; color: var(--text-vellum); /* Display/Large desktop */
}
#loader .bar {
  position: relative; width: 420px; height: 14px; border-radius: 7px; box-sizing: border-box;
  background: var(--bg-trough); border: 1px solid var(--line-gold);
  box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.85); overflow: visible;
}
#bar-fill {
  position: absolute; left: -1px; top: -1px; bottom: -1px; width: 0; border-radius: 7px;
  background: var(--action-live); box-shadow: 0 0 12px 1px rgba(255, 224, 138, 0.9);
  transition: width 0.2s ease;
}
#loader-text { font-size: 16px; line-height: 21px; font-weight: 400; color: var(--text-label); } /* Caption/Desktop */
#loader.error #loader-text { color: var(--text-danger); }
#loader .flame {
  width: 44px; height: 44px; background: var(--text-label);
  -webkit-mask: url("icons/flame.png") center / contain no-repeat; mask: url("icons/flame.png") center / contain no-repeat;
  filter: drop-shadow(0 0 14px rgba(255, 224, 138, 0.7));
  animation: flicker 1.6s ease-in-out infinite;
}
@keyframes flicker {
  0%, 100% { transform: scale(1, 1) rotate(-2deg); }
  50% { transform: scale(0.94, 1.06) rotate(2deg); }
}
@media (prefers-reduced-motion: reduce) { #loader .flame { animation: none; } }

/* Phone sizes (S1 phone, 844×390): the same parts, 14 px apart. */
@media (max-width: 1000px), (max-height: 500px) {
  #loader { gap: 14px; }
  #loader .flame { width: 32px; height: 32px; }
  #loader .title { font-size: 36px; line-height: 38px; letter-spacing: 0.08em; } /* Display/Large phone */
  #loader .bar { width: 300px; height: 12px; border-radius: 6px; }
  #bar-fill { border-radius: 6px; }
  #loader-text { font-size: 14px; line-height: 18px; } /* Caption/Phone */
}

/* S1b Turn your device sideways: the phone outline in the gold, the line and the note, 18 px apart. */
#rotate {
  position: fixed; inset: 0; display: none; z-index: 10;
  align-items: center; justify-content: center; flex-direction: column; gap: 18px;
  background: var(--bg-lapis-deep); color: var(--text-vellum); text-align: center;
  font-family: var(--words);
}
#rotate p { margin: 0; display: flex; flex-direction: column; gap: 18px; font-size: 16px; line-height: 20px; font-weight: 700; } /* Label/Control phone */
#rotate small { color: var(--text-label); font-size: 14px; line-height: 18px; font-weight: 400; } /* Caption/Phone */
#rotate .phone {
  width: 46px; height: 80px; box-sizing: border-box; border: 3px solid var(--metal-gold); border-radius: 10px;
  animation: turn 2.2s ease-in-out infinite;
}
@keyframes turn { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (prefers-reduced-motion: reduce) { #rotate .phone { animation: none; } }
@media (orientation: portrait) and (pointer: coarse) { #rotate { display: flex; } }

/* The page's banner messages (Unity's warnings and errors), on the trough in a gold line. */
#banner { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 20; font-family: var(--words); }
#banner .msg {
  margin-top: 6px; padding: 10px 16px; border-radius: 8px; font-size: 16px; line-height: 21px;
  background: rgba(6, 10, 24, 0.94); color: var(--text-vellum); border: 1px solid var(--line-gold);
}
#banner .msg.error { border-color: var(--state-danger); color: var(--text-danger); }
#banner .msg.warning { border-color: var(--action-live); }
