:root {
  --ink: #10140b;
  --cream: #fff8e6;
  --gold: #f5c542;
  --font: 'SF Pro Rounded', 'Avenir Next Rounded', 'Avenir Next', Nunito, Quicksand,
          system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--ink);
  overflow: hidden;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  /* Stop iOS from selecting text or firing the callout on a long press. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: fixed;
  inset: 0;
}

/*
 * Absolutely positioned on purpose. As a normal flow/grid item the canvas's
 * own `height` attribute acts as its intrinsic size, so writing the backing
 * store each resize fed straight back into layout and the letterbox maths
 * drifted. Pinning it to the container makes its box independent of its
 * resolution.
 */
#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: pointer;
  /* The art is illustrative, so smooth scaling beats nearest-neighbour. */
  image-rendering: auto;
}

#loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 22px;
  background: radial-gradient(circle at 50% 42%, #1d2617 0%, var(--ink) 70%);
  transition: opacity .45s ease, visibility .45s;
  z-index: 2;
}

#loader.gone {
  opacity: 0;
  visibility: hidden;
}

.mark {
  font-size: clamp(44px, 8vw, 86px);
  font-weight: 900;
  letter-spacing: .14em;
  color: var(--cream);
  text-shadow: 0 6px 0 rgba(0, 0, 0, .35);
}

.track {
  width: min(340px, 62vw);
  height: 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .12);
  overflow: hidden;
}

#bar {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #e05848);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .28s ease;
}

#status {
  font-size: 15px;
  font-weight: 700;
  color: rgba(240, 246, 220, .68);
  text-align: center;
  line-height: 1.6;
  max-width: 46ch;
  padding: 0 20px;
}

#status small {
  font-size: 13px;
  font-weight: 600;
  opacity: .72;
}

#status.error { color: #f09890; }

/* --- rotate prompt --------------------------------------------------- */

#rotate {
  position: absolute;
  inset: 0;
  display: none;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: calc(24px + env(safe-area-inset-top)) 28px calc(24px + env(safe-area-inset-bottom));
  background: radial-gradient(circle at 50% 45%, #1d2617 0%, var(--ink) 72%);
  text-align: center;
  z-index: 3;
}

#rotate .glyph {
  font-size: 78px;
  line-height: 1;
  color: var(--gold);
  animation: tip 2.4s ease-in-out infinite;
}

#rotate .big {
  font-size: 25px;
  font-weight: 900;
  color: var(--cream);
}

#rotate .small {
  font-size: 15px;
  font-weight: 700;
  color: rgba(240, 246, 220, .6);
}

@keyframes tip {
  0%, 42%, 100% { transform: rotate(90deg) scale(.72); }
  62%, 84%      { transform: rotate(0deg) scale(1); }
}

/* Only phones/tablets held upright — never a narrow desktop window. */
@media (orientation: portrait) and (pointer: coarse) and (max-width: 950px) {
  #rotate { display: grid; }
}

@media (prefers-reduced-motion: reduce) {
  #loader, #bar { transition: none; }
  #rotate .glyph { animation: none; transform: rotate(90deg) scale(.8); }
}
