:root {
  color-scheme: dark;
  --aqua: #18e4df;
  --green: #7dff9b;
  --ink: #07090a;
  --panel: #171a1d;
  --muted: #aab3b6;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #050607;
}

body {
  min-height: 100vh;
  margin: 0;
  color: #f4f7f7;
  background:
    radial-gradient(circle at 50% 20%, rgba(24, 228, 223, 0.09), transparent 34rem),
    linear-gradient(180deg, #111416 0%, #050607 70%);
  font-family: "Raleway", sans-serif;
}

button {
  font: inherit;
}

.tv-app {
  width: min(100% - 28px, 1100px);
  margin: 0 auto;
  padding: clamp(28px, 6vw, 72px) 0 52px;
}

.app-intro {
  max-width: 760px;
  margin: 0 auto clamp(20px, 4vw, 42px);
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--aqua);
  font-family: "Orbitron", sans-serif;
  font-size: clamp(0.68rem, 1.5vw, 0.82rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.app-intro h1 {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  font-size: clamp(2rem, 7vw, 4.75rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.app-intro p:last-child {
  max-width: 620px;
  margin: 16px auto 0;
  color: #d3d9da;
  font-size: clamp(0.94rem, 2vw, 1.08rem);
  line-height: 1.65;
}

.television {
  display: grid;
  place-items: center;
}

.tv-stage {
  position: relative;
  width: min(100%, 973px);
  aspect-ratio: 973 / 597;
  isolation: isolate;
  filter: drop-shadow(0 26px 35px rgba(0, 0, 0, 0.65));
}

.tv-frame {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
}

.television-screen {
  position: absolute;
  z-index: 1;
  top: 15.3%;
  left: 9.6%;
  width: 68.6%;
  height: 74.5%;
  overflow: hidden;
  border-radius: 5.5% / 7%;
  background: #010302;
  box-shadow: inset 0 0 35px #000;
}

.broadcast,
.channel-video {
  width: 100%;
  height: 100%;
}

.broadcast {
  background: #010302;
}

.channel-video {
  display: block;
  object-fit: cover;
  opacity: 0;
  filter: contrast(1.08) saturate(0.88) brightness(0.82);
  transition: opacity 280ms ease;
}

.tv-stage.is-on .channel-video {
  opacity: 1;
}

.screen-glow,
.screen-static,
.screen-off {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.screen-glow {
  z-index: 2;
  background:
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.26) 50%),
    linear-gradient(90deg, rgba(255, 0, 0, 0.055), rgba(0, 255, 0, 0.018), rgba(0, 0, 255, 0.055));
  background-size: 100% 3px, 4px 100%;
  opacity: 0;
  transition: opacity 180ms ease;
}

.tv-stage.is-on .screen-glow {
  opacity: 0.72;
  animation: flicker 180ms infinite;
}

.screen-static {
  z-index: 3;
  background:
    repeating-radial-gradient(circle at 25% 30%, rgba(255,255,255,.9) 0 1px, transparent 1px 3px),
    repeating-radial-gradient(circle at 70% 60%, rgba(255,255,255,.6) 0 1px, transparent 1px 4px),
    #111;
  background-size: 5px 7px, 7px 5px;
  opacity: 0;
  mix-blend-mode: screen;
}

.tv-stage.is-tuning .screen-static {
  opacity: 0.72;
  animation: static-shift 90ms steps(2) infinite;
}

.screen-off {
  z-index: 5;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse, #111 0%, #020303 62%, #000 100%);
  opacity: 1;
  transition: opacity 160ms ease 220ms;
}

.screen-off span {
  width: 0;
  height: 2px;
  background: white;
  box-shadow: 0 0 12px white;
}

.tv-stage.is-on .screen-off {
  opacity: 0;
  animation: turn-on 620ms ease-out both;
}

.tv-stage.is-powering-off .screen-off {
  opacity: 1;
  animation: turn-off 420ms ease-in both;
}

.channel-overlay {
  position: absolute;
  z-index: 4;
  top: 7%;
  left: 6%;
  color: var(--green);
  font-family: "Orbitron", monospace;
  font-size: clamp(0.72rem, 3.5vw, 2rem);
  letter-spacing: 0.08em;
  opacity: 0;
  text-shadow: 0 0 8px rgba(85, 255, 115, 0.8);
  pointer-events: none;
}

.channel-overlay.is-visible {
  animation: channel-display 2.3s ease both;
}

.set-control {
  position: absolute;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: transparent;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.set-control:focus-visible {
  outline: 3px solid var(--aqua);
  outline-offset: 2px;
}

.power-control {
  top: 16%;
  left: 87.3%;
  width: 9.5%;
  aspect-ratio: 1;
}

.power-control::before {
  content: "";
  width: 34%;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  background: rgba(20, 22, 23, 0.72);
  box-shadow: inset 0 0 4px #000, 0 0 0 1px #050505;
  transition: box-shadow 180ms ease, background 180ms ease;
}

.power-control[aria-pressed="true"]::before {
  background: #50d26b;
  box-shadow: inset 0 0 4px #07350f, 0 0 10px rgba(80, 255, 110, 0.75);
}

.channel-dial {
  top: 17.2%;
  left: 78.6%;
  width: 11.5%;
  aspect-ratio: 1;
}

.channel-dial::before {
  content: "";
  width: 54%;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: linear-gradient(0deg, transparent 44%, rgba(230, 230, 220, 0.78) 45% 55%, transparent 56%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.75);
  transform: rotate(var(--dial-angle, 0deg));
  transition: transform 240ms cubic-bezier(.2,.8,.25,1.15);
}

.remote {
  width: min(100%, 560px);
  margin: clamp(18px, 4vw, 34px) auto 0;
  padding: 18px;
  border: 1px solid #343a3d;
  border-radius: 18px;
  background: linear-gradient(145deg, #252a2d, #111315);
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.42), inset 0 1px rgba(255,255,255,.06);
}

.remote-brand {
  margin-bottom: 8px;
  color: #758083;
  font-family: "Orbitron", sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  text-align: center;
}

.remote-display {
  min-height: 42px;
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px solid #071d17;
  border-radius: 6px;
  color: #6dff9a;
  background: #07110d;
  box-shadow: inset 0 2px 8px #000;
  font-family: "Orbitron", monospace;
  font-size: clamp(0.78rem, 2.5vw, 1rem);
  letter-spacing: 0.08em;
  text-align: center;
}

.remote-buttons {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 12px;
}

.channel-rocker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.remote-button {
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #424a4e;
  border-radius: 9px;
  color: #e6ebec;
  background: linear-gradient(#343a3d, #1b1f21);
  box-shadow: 0 3px 0 #090a0b;
  font-family: "Orbitron", sans-serif;
  font-size: clamp(0.62rem, 2vw, 0.74rem);
  cursor: pointer;
}

.remote-button:hover,
.remote-button:focus-visible {
  border-color: var(--aqua);
  color: var(--aqua);
  outline: none;
}

.remote-button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #090a0b;
}

.remote-power {
  color: #ff8c8c;
}

.remote-power[aria-pressed="true"] {
  color: #82ff9a;
}

.app-status,
.app-note {
  text-align: center;
}

.app-status {
  min-height: 1.4em;
  margin: 18px auto 0;
  color: #d9dfe0;
  font-size: 0.92rem;
}

.app-note {
  margin: 8px auto 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.creator-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: clamp(64px, 10vw, 120px);
  padding: clamp(36px, 6vw, 68px) 16px clamp(52px, 8vw, 88px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.creator-credit {
  margin: 0 0 24px;
  color: #dce2e3;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
}

.signature-link {
  display: inline-block;
  padding: 8px;
  border-radius: 8px;
  transition: opacity 180ms ease, transform 180ms ease;
}

.signature-link:hover,
.signature-link:focus-visible {
  opacity: 0.78;
  outline: 2px solid var(--aqua);
  outline-offset: 4px;
  transform: translateY(-2px);
}

.signature-link img {
  display: block;
  width: min(66vw, 250px);
  height: auto;
}

.creator-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
}

.creator-links a {
  color: var(--aqua);
  font-size: 0.88rem;
  text-underline-offset: 4px;
}

.creator-links a:hover,
.creator-links a:focus-visible {
  color: #fff;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@keyframes flicker {
  0%, 100% { opacity: 0.7; }
  45% { opacity: 0.58; }
  48% { opacity: 0.78; }
  52% { opacity: 0.62; }
}

@keyframes static-shift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 13px -9px, -11px 8px; }
}

@keyframes turn-on {
  0% { opacity: 1; transform: scale(1); }
  28% { opacity: 1; transform: scale(1, 0.012); filter: brightness(8); }
  55% { opacity: 0.8; transform: scale(0.04, 0.012); filter: brightness(16); }
  100% { opacity: 0; transform: scale(1); filter: none; }
}

@keyframes turn-off {
  0% { opacity: 0; transform: scale(1); }
  55% { opacity: 0.75; transform: scale(1, 0.012); filter: brightness(9); }
  75% { opacity: 1; transform: scale(0.04, 0.012); filter: brightness(16); }
  100% { opacity: 1; transform: scale(1); filter: none; }
}

@keyframes channel-display {
  0%, 8% { opacity: 0; }
  12%, 76% { opacity: 1; }
  100% { opacity: 0; }
}

@media (max-width: 600px) {
  .tv-app {
    width: min(100% - 16px, 1100px);
    padding-top: 24px;
  }

  .app-intro {
    margin-bottom: 16px;
  }

  .app-intro p:last-child {
    margin-top: 12px;
    line-height: 1.45;
  }

  .remote {
    padding: 14px;
    border-radius: 14px;
  }

  .remote-buttons {
    grid-template-columns: 1fr 1.7fr;
  }

  #mute-toggle {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
