:root {
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
  color: #fff;
  background: #141414;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow: hidden;
}
[hidden] {
  display: none !important;
}
#waiting {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100dvh;
}
.brand {
  background: #252525;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6vw;
}
.brand img {
  width: 100%;
  max-width: 640px;
  display: block;
}
.brand > div {
  width: 100%;
  max-width: 640px;
}
.brand p {
  text-align: center;
  font-size: clamp(36px, 5vw, 100px);
  font-weight: 300;
  margin: 0;
}
.pairing {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 3vw 10vh;
}
.pairing-content {
  text-align: center;
  width: 100%;
}
h1 {
  font-size: clamp(20px, 2.5vw, 50px);
  font-weight: 400;
  margin: 0 0 3vh;
}
#code {
  font-size: clamp(48px, 5vw, 100px);
  letter-spacing: 0.08em;
  margin: 2vh 0 4vh;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
}
#qr-box {
  display: inline-flex;
  background: white;
  border-radius: clamp(20px, 2.5vw, 48px);
  padding: 2vw;
  width: min(21vw, 38vh);
  height: min(21vw, 38vh);
}
#qr {
  width: 100% !important;
  height: 100% !important;
  image-rendering: pixelated;
}
#connect {
  display: block;
  color: white;
  text-decoration: none;
  font-size: clamp(14px, 1.9vw, 38px);
  margin-top: 4vh;
  overflow-wrap: anywhere;
}
#status {
  font-size: clamp(13px, 1vw, 20px);
  color: #aaa;
  margin: 2vh 0 0;
}
#error {
  font-size: clamp(13px, 1vw, 20px);
  color: #f8b4b4;
  margin: 8px 0;
}
.version {
  position: absolute;
  bottom: 18px;
  right: 20px;
  color: #777;
  font-size: 12px;
}
button {
  font: inherit;
  color: #ddd;
  background: #292929;
  border: 1px solid #555;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #9887f4;
  outline-offset: 3px;
}
button:hover {
  background: #5737f1;
  color: white;
}
#tools {
  position: fixed;
  right: 20px;
  bottom: 18px;
  display: flex;
  gap: 8px;
  z-index: 5;
  opacity: 0.25;
  transition: opacity 0.2s;
}
#tools:hover,
#tools:focus-within,
body.tools-visible #tools {
  opacity: 1;
}
#stage {
  position: fixed;
  inset: 0;
  background: black;
  overflow: hidden;
}
#stage > img,
#stage > video {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  object-fit: contain;
}
dialog {
  max-width: min(600px, 90vw);
  max-height: 85vh;
  overflow: auto;
  background: #252525;
  color: #eee;
  border: 1px solid #666;
  border-radius: 18px;
  padding: 24px;
}
dialog::backdrop {
  background: #000b;
}
pre {
  white-space: pre-wrap;
  font: 14px/1.6 monospace;
  overflow-wrap: anywhere;
}
dialog p {
  color: #aaa;
  font-size: 14px;
  line-height: 1.6;
}
dialog button {
  margin: 8px 8px 0 0;
}
@media (max-aspect-ratio: 1/1) {
  #waiting {
    grid-template-columns: 1fr;
    grid-template-rows: 26dvh 74dvh;
  }
  .brand {
    padding: 3vh 12vw;
  }
  .brand img {
    max-width: 300px;
  }
  .brand p {
    font-size: 30px;
  }
  .pairing {
    padding: 2vh 16px 11vh;
  }
  h1 {
    font-size: 22px;
    margin-bottom: 1vh;
  }
  #code {
    font-size: 54px;
    margin: 1vh 0 2vh;
  }
  #qr-box {
    width: 24vh;
    height: 24vh;
    padding: 2vh;
  }
  #connect {
    font-size: 16px;
    margin-top: 2vh;
  }
  #tools {
    right: 10px;
    bottom: 12px;
    gap: 6px;
  }
  #tools button {
    font-size: 12px;
    padding: 8px;
  }
  .version {
    bottom: 60px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
