@import url('https://fonts.googleapis.com/css2?family=Archivo+Black&family=Space+Grotesk:wght@400;500;600&display=swap');

:root {
  color-scheme: dark;
  --ink: #f5f3ed;
  --paper: #0a0a09;
  --signal: #b48bff;
  --alert: #ff5b3d;
}

* { box-sizing: border-box; }

html,
body,
.player {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
}

body {
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  cursor: none;
}

.stage,
.scene,
.scene__media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.scene {
  overflow: hidden;
  background: var(--paper);
  opacity: 0;
}

.scene--visible { opacity: 1; }

.scene__media {
  object-fit: cover;
}

.scene--video .scene__media { transform: none; }

body[data-orientation="90"] .stage,
body[data-orientation="270"] .stage {
  width: 100vh;
  height: 100vw;
  inset: 50% auto auto 50%;
}

body[data-orientation="90"] .stage { transform: translate(-50%, -50%) rotate(90deg); }
body[data-orientation="180"] .stage { transform: rotate(180deg); }
body[data-orientation="270"] .stage { transform: translate(-50%, -50%) rotate(270deg); }

.scene--enter.scene--zoom-in .scene__media {
  animation: cloudtv-zoom-in var(--scene-duration, 10s) ease-out both;
}

.scene--enter.scene--zoom-out .scene__media {
  animation: cloudtv-zoom-out var(--scene-duration, 10s) ease-out both;
}

.pairing,
.fallback {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-content: safe center;
  justify-items: center;
  padding: max(5vw, env(safe-area-inset-top)) max(5vw, env(safe-area-inset-right));
  background: url('/assets/img/screen-h.svg') center / cover no-repeat, var(--paper);
}

@media (orientation: portrait) {
  .pairing,
  .fallback {
    background-image: url('/assets/img/screen-v.svg');
  }
}

.pairing[hidden],
.fallback[hidden],
.connection[hidden] { display: none; }

.pairing__brand,
.fallback__brand {
  width: min(30rem, 60vmin);
  height: auto;
  margin-bottom: min(4rem, 5vh);
}

.pairing__label {
  margin: 1vh 0 1vh;
  font-size: clamp(1rem, 2.4vh, 2rem);
  text-transform: uppercase;
}

.pairing__code {
  color: var(--signal);
  font-family: "Archivo Black", sans-serif;
  font-size: clamp(4rem, 22vmin, 16rem);
  line-height: .9;
}

.pairing__status,
.fallback__message {
  margin-top: 3vh;
  font-weight: 700;
  font-size: clamp(1.8rem, 2vh, 1.8rem);
  text-align: center;
}

.pairing__timer {
  margin-top: 0.1vh;
  color: var(--signal);
  font-size: clamp(1.2rem, 1.8vh, 1.5rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: .05em;
}

.pairing__timer[hidden] { display: none; }

.fallback__clock {
  margin-top: min(8vh, 6vmin);
  color: var(--signal);
  font-family: "Archivo Black", sans-serif;
  font-size: clamp(4rem, 22vmin, 16rem);
  line-height: .9;
}

.connection {
  position: absolute;
  right: max(2vw, env(safe-area-inset-right));
  bottom: max(2vw, env(safe-area-inset-bottom));
  z-index: 20;
  padding: .55rem .8rem;
  border-left: .3rem solid var(--alert);
  background: rgba(10, 10, 9, .8);
  font-weight: 600;
}

@keyframes cloudtv-zoom-in {
  from { transform: scale(1.01) translate3d(0, 0, 0); }
  to { transform: scale(1.08) translate3d(-1%, -.6%, 0); }
}

@keyframes cloudtv-zoom-out {
  from { transform: scale(1.08) translate3d(-1%, -.6%, 0); }
  to { transform: scale(1.01) translate3d(0, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .scene--enter.scene--zoom-in .scene__media,
  .scene--enter.scene--zoom-out .scene__media { animation: none; }
}

@media (orientation: portrait) {
  .pairing__code { font-size: clamp(3rem, 15vmin, 13rem); }
  .fallback__clock { font-size: clamp(3rem, 17vmin, 13rem); }
}