:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  background: #050606;
  color: #fff;
  --scanOpacity: 0.32;
  --scanSize: 3px;
  --scanThickness: 1px;
  --glow: 0.28;
  --noiseOpacity: 0.14;
  --staticOpacity: 0.06;
}
@property --powerTop {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 0%;
}
@property --powerBottom {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 100%;
}
@property --powerLineWidth {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 100%;
}
@property --powerLineOpacity {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}
body {
  margin: 0;
  padding: 0;
  margin-inline: auto;
  background: url(/img/wall.png);
  background-size: cover;
  background-repeat: no-repeat;
}

.tvShell {
  position: relative;
  aspect-ratio: 4 / 3;
  margin-inline: auto 32%;
  max-height: 77vh;
  margin-bottom: 9vh;
}
.tvchannel {
  width: 11%;
  position: absolute;
  right: -10%;
  top: 18%;
  z-index: 40;
  transform-origin: center center;
  cursor: pointer;
  transition: transform 140ms ease-out;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  touch-action: manipulation;
}
.tvvolume {
  width: 11%;
  position: absolute;
  right: -10%;
  top: 38%;
  z-index: 40;
  transform-origin: center center;
  cursor: pointer;
  transition: transform 140ms ease-out;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  touch-action: manipulation;
}

.tvonoff {
  width: 4.5%;
  position: absolute;
  right: -7%;
  top: 90%;
  z-index: 40;
  transform-origin: center center;
  cursor: pointer;
  transition: transform 140ms ease-out;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  touch-action: manipulation;
}
.tvonoff:active {
  transform: scale(0.94);
}

.tvFrame {
  position: absolute;
  inset: 0;
  width: 115%;
  object-fit: contain;
  z-index: 10;
  pointer-events: none;
  top: -54%;
  left: 3%;
  user-select: none;
  filter: drop-shadow(25px 25px 47px rgba(0, 0, 0, 0.75));
}
.tvScreenOff {
  position: absolute;
  left: 8%;
  top: 10%;
  width: 84%;
  aspect-ratio: 2321 / 1964;
  object-fit: fill;
  z-index: 9;
  pointer-events: none;
  opacity: 0;
  user-select: none;
  -webkit-user-drag: none;
}

.tvShell.off .tvScreenOff {
  opacity: 1;
}

.table {
  position: absolute;
  width: 100%;
  z-index: 5;
  pointer-events: none;
  bottom: 0;
  left: 0;
  height: 25vh;
  user-select: none;
  background: url("/img/table.png");
  background-size: 100%;
  background-repeat: no-repeat;
}

.tv {
  aspect-ratio: 4 / 3.2;
  position: absolute;
  z-index: 8;
  left: 10%;
  top: 13%;
  width: 79%;
  background: #000;
  overflow: hidden;
  container-type: size;
}
.tv.off .videoLayer,
.tv.off canvas.noise,
.tv.off .over,
.tv.off .bug,
.tv.off .ident,
.tv.off .channelOverlay,
.tv.off .volumeOverlay {
  opacity: 0 !important;
}
.tv.poweringOff .bug,
.tv.poweringOff .ident,
.tv.poweringOff .channelOverlay,
.tv.poweringOff .volumeOverlay {
  opacity: 0 !important;
}

.videoLayer {
  position: absolute;
  inset: 0;
  filter: url(#crtFilter);
  transform: translateZ(0);
  z-index: 1;
}
video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.over,
canvas.noise {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.scanlines {
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, calc(0.22 * var(--scanOpacity))) 0,
    rgba(0, 0, 0, calc(0.22 * var(--scanOpacity))) var(--scanThickness),
    rgba(0, 0, 0, 0) var(--scanThickness),
    rgba(0, 0, 0, 0) var(--scanSize)
  );
  mix-blend-mode: multiply;
  opacity: calc(0.1 + var(--scanOpacity));
}
.phosphor {
  opacity: 0.18;
  background: repeating-linear-gradient(
    to right,
    rgba(255, 0, 0, 0.1) 0,
    rgba(255, 0, 0, 0.1) 1px,
    rgba(0, 255, 0, 0.1) 1px,
    rgba(0, 255, 0, 0.1) 2px,
    rgba(0, 120, 255, 0.1) 2px,
    rgba(0, 120, 255, 0.1) 3px
  );
  mix-blend-mode: overlay;
}
.glass {
  background:
    radial-gradient(
      110% 80% at 50% 18%,
      rgba(255, 255, 255, 0.1),
      rgba(255, 255, 255, 0) 55%
    ),
    radial-gradient(
      120% 100% at 50% 60%,
      rgba(0, 255, 180, 0.05),
      rgba(0, 0, 0, 0) 55%
    ),
    radial-gradient(
      160% 120% at 50% 60%,
      rgba(0, 0, 0, 0),
      rgba(0, 0, 0, 0.55) 72%,
      rgba(0, 0, 0, 0.9) 100%
    );
  mix-blend-mode: screen;
  opacity: calc(0.65 + var(--glow));
}
canvas.noise {
  width: 100%;
  height: 100%;
  opacity: var(--noiseOpacity);
  filter: url(#noiseBlurGrain);
  mix-blend-mode: overlay;
  image-rendering: pixelated;
}
canvas.static {
  opacity: var(--staticOpacity);
  filter: url(#noiseBlurStatic);
  mix-blend-mode: screen;
}
.powerMask {
  position: absolute;
  left: 8%;
  top: 10%;
  width: 84%;
  aspect-ratio: 2321 / 1964;
  z-index: 9;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
}
.powerMask::before,
.powerMask::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-image: url("/img/tvscreenoff.png");
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.powerMask::before {
  background-position: top center;
  clip-path: inset(0 0 100% 0);
}
.powerMask::after {
  background-position: bottom center;
  clip-path: inset(100% 0 0 0);
}
.powerMask span {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 100%;
  height: max(2px, 0.35cqh);
  transform: translate(-50%, -50%);
  opacity: 0;
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 0 1.2cqw rgba(255, 255, 255, 0.9),
    0 0 2.8cqw rgba(120, 210, 255, 0.35);
}
.powerMask.powerOff {
  animation: tvPowerMaskOff 650ms cubic-bezier(0.25, 0.75, 0.2, 1) forwards;
}
.powerMask.powerOff::before,
.powerMask.powerOff::after {
  animation: tvPowerShutterOff 650ms cubic-bezier(0.25, 0.75, 0.2, 1) forwards;
}
.powerMask.powerOff span {
  animation: tvPowerLineOff 650ms cubic-bezier(0.25, 0.75, 0.2, 1) forwards;
}
.powerMask.powerOn {
  animation: tvPowerMaskOn 650ms cubic-bezier(0.25, 0.75, 0.2, 1) forwards;
}
.powerMask.powerOn::before,
.powerMask.powerOn::after {
  animation: tvPowerShutterOn 650ms cubic-bezier(0.25, 0.75, 0.2, 1) forwards;
}
.powerMask.powerOn span {
  animation: tvPowerLineOn 650ms cubic-bezier(0.25, 0.75, 0.2, 1) forwards;
}
@keyframes tvPowerMaskOff {
  0% {
    opacity: 0;
  }
  12%,
  100% {
    opacity: 1;
  }
}
@keyframes tvPowerMaskOn {
  0%,
  88% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
@keyframes tvPowerShutterOff {
  0% {
    clip-path: inset(0 0 100% 0);
  }
  55% {
    clip-path: inset(0 0 50.2% 0);
  }
  100% {
    clip-path: inset(0 0 50% 0);
  }
}
.powerMask.powerOff::after {
  animation-name: tvPowerShutterBottomOff;
}
@keyframes tvPowerShutterBottomOff {
  0% {
    clip-path: inset(100% 0 0 0);
  }
  55% {
    clip-path: inset(50.2% 0 0 0);
  }
  100% {
    clip-path: inset(50% 0 0 0);
  }
}
@keyframes tvPowerShutterOn {
  0%,
  45% {
    clip-path: inset(0 0 50% 0);
  }
  100% {
    clip-path: inset(0 0 100% 0);
  }
}
.powerMask.powerOn::after {
  animation-name: tvPowerShutterBottomOn;
}
@keyframes tvPowerShutterBottomOn {
  0%,
  45% {
    clip-path: inset(50% 0 0 0);
  }
  100% {
    clip-path: inset(100% 0 0 0);
  }
}
@keyframes tvPowerLineOff {
  0% {
    opacity: 0;
    width: 100%;
  }
  18% {
    opacity: 0.9;
    width: 100%;
  }
  58% {
    opacity: 1;
    width: 100%;
  }
  100% {
    opacity: 0;
    width: 0%;
  }
}
@keyframes tvPowerLineOn {
  0% {
    opacity: 0;
    width: 0%;
  }
  12% {
    opacity: 1;
    width: 0%;
  }
  45% {
    opacity: 1;
    width: 100%;
  }
  78% {
    opacity: 0.75;
    width: 100%;
  }
  100% {
    opacity: 0;
    width: 100%;
  }
}
.bug {
  position: absolute;
  right: 4%;
  top: 6%;
  width: 10%;
  max-width: 110px;
  z-index: 7;
  opacity: 0.82;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px #000);
}
.ident {
  position: absolute;
  left: 0%;
  bottom: 7%;
  z-index: 8;
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.68);
  border-left: 4px solid rgba(255, 255, 255, 0.85);
  opacity: 0;
  transition: opacity 0.2s;
}
.ident.show {
  opacity: 1;
}
.identLogo {
  width: 66px;
  height: 66px;
  object-fit: contain;
}
.ident .ch {
  font-size: 13px;
  opacity: 0.75;
}
.ident .name {
  font-size: 26px;
  font-weight: 800;
}
.ident .title {
  font-size: 14px;
  opacity: 0.85;
  margin-top: 3px;
}
.channelOverlay,
.volumeOverlay {
  position: absolute;
  z-index: 2;
  color: #00f000;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 900;
  text-shadow: 0 0 4px rgba(0, 240, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease-out;
}
.channelOverlay {
  top: 6%;
  left: 5%;
  font-size: 8cqw;
  line-height: 1;
}
.volumeOverlay {
  right: 5%;
  bottom: 7%;
  text-align: right;
}
.channelOverlay.show,
.volumeOverlay.show {
  opacity: 1;
}
.volumeLabel {
  font-size: 3cqw;
  line-height: 1;
  margin-bottom: 0.7cqh;
}
.volumeBars {
  display: flex;
  align-items: flex-end;
  gap: 0.85cqw;
}
.volumeBars span {
  width: 1.6cqw;
  height: 5cqh;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.volumeBars span::before {
  content: "";
  width: 1.1cqw;
  height: 1.1cqw;
  border-radius: 999px;
  background: #00f000;
  opacity: 0.45;
}
.volumeBars span.on::before {
  width: 1.6cqw;
  height: 5cqh;
  border-radius: 0;
  opacity: 1;
}
@supports not (font-size: 1cqw) {
  .channelOverlay {
    font-size: 2.8vw;
  }
  .volumeLabel {
    font-size: 1vw;
    margin-bottom: 5px;
  }
  .volumeBars {
    gap: 0.5vw;
  }
  .volumeBars span {
    width: 1vw;
    height: 3.5vw;
  }
  .volumeBars span::before {
    width: 0.775vw;
    height: 0.775vw;
  }
  .volumeBars span.on::before {
    width: 1vw;
    height: 3.5vw;
  }
}
.controls {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
  z-index: 10;
  position: relative;
}
button,
a {
  font: inherit;
  border: 1px solid #3c4347;
  background: #191d20;
  color: white;
  padding: 11px 16px;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
}
#status {
  min-height: 24px;
  text-align: center;
  color: #aeb6bc;
  margin-top: 8px;
}
.channelPicker {
  min-width: 180px;
  padding: 10px;
  background: #191d20;
  color: white;
  border: 1px solid #3c4347;
  border-radius: 8px;
}
@media (max-width: 600px) {
  body {
    padding: 8px;
  }
  .ident {
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 10px;
  }
  .identLogo {
    width: 54px;
    height: 54px;
  }
  .ident .name {
    font-size: 20px;
  }
}

.backgroundnoise-wrapper {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -1;
}

.backgroundnoise-wrapper:after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(41, 56, 44, 0.5) 0%,
    #0c100d 100%
  );
}
.backgroundnoise {
  position: absolute;
  top: -500px;
  right: -500px;
  bottom: -500px;
  left: -500px;
  background: transparent url(noise.png) 0 0;
  background-size: 320px 320px;
  opacity: 0.35;
  -webkit-animation: noise 1s steps(8, end) infinite both;
  animation: noise 1s steps(8, end) infinite both;
}
@keyframes noise {
  0% {
    transform: translateX(0px, 0px);
  }
  10% {
    transform: translate(-100px, 100px);
  }
  20% {
    transform: translate(150px, -100px);
  }
  30% {
    transform: translate(-100px, 100px);
  }
  40% {
    transform: translate(100px, -150px);
  }
  50% {
    transform: translate(-100px, 200px);
  }
  60% {
    transform: translate(-200px, -100px);
  }
  70% {
    transform: translateY(50px, 100px);
  }
  80% {
    transform: translate(100px, -150px);
  }
  90% {
    transform: translate(0px, 200px);
  }
  100% {
    transform: translate(-100px, 100px);
  }
}
