/* duvdcat: the browser window is the TV screen. */
@font-face { font-family: "Silkscreen"; src: url("/fonts/silkscreen-latin-400-normal.woff2") format("woff2"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "Silkscreen"; src: url("/fonts/silkscreen-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Space Mono"; src: url("/fonts/space-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --bg: #000; --ink: #ececec; --accent: #3cff6e; --muted: #8a8a8a;
  --font-display: "Silkscreen", system-ui, sans-serif;
  --font-body: "Silkscreen", system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, monospace;
  --display: clamp(36px, 5vw, 80px);
  --osd-x: max(var(--s3), 3.6vw, env(safe-area-inset-left));
  --osd-y: max(var(--s3), 4vh, env(safe-area-inset-bottom));
  --glow-ink: 1px 0 rgba(255, 40, 110, .35), -1px 0 rgba(40, 200, 255, .35), 0 0 10px rgba(255, 255, 255, .25);
  --glow-go: 1px 0 rgba(255, 40, 110, .3), -1px 0 rgba(40, 200, 255, .3), 0 0 12px rgba(60, 255, 110, .45);
}

html, body { height: 100%; overflow: hidden; background: #000; overscroll-behavior: none; }
body { font-family: var(--font-body); }

.tv { position: fixed; inset: 0; overflow: hidden; background: #000; isolation: isolate; animation: power-on .32s steps(4, end) both; }
@keyframes power-on { 0% { clip-path: inset(49.6% 0 49.6% 0); filter: brightness(4); } 60% { clip-path: inset(30% 0 30% 0); filter: brightness(2); } 100% { clip-path: inset(0); filter: none; } }

/* signal noise and the rolling band */
.tv__static { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; image-rendering: pixelated; z-index: 0; }
.tv__band { position: absolute; left: 0; right: 0; top: -20%; height: 18%; z-index: 1; pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgba(255,255,255,.035) 45%, rgba(255,255,255,.06) 50%, rgba(255,255,255,.035) 55%, transparent);
  animation: band 9s linear infinite; will-change: transform; }
@keyframes band { to { transform: translateY(700%); } }

/* the cat */
.dvd { position: absolute; left: 0; top: 0; z-index: 2; width: var(--dvd-w, 300px); height: auto; max-width: none;
  transform: translate3d(var(--x, 0), var(--y, 0), 0); will-change: transform, filter;
  filter: hue-rotate(var(--hue, 0deg)) saturate(var(--sat, 1.15)) drop-shadow(0 0 14px rgba(140, 90, 255, .28));
  user-select: none; -webkit-user-drag: none; pointer-events: none; }

/* CRT glass: scanlines, vignette, flicker */
.tv__glass { position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.32) 2px 3px),
    radial-gradient(ellipse 120% 110% at 50% 50%, transparent 58%, rgba(0,0,0,.55) 88%, #000 110%);
  animation: flicker 4.3s steps(1) infinite; }
@keyframes flicker { 0%, 100% { opacity: 1; } 41% { opacity: .9; } 42% { opacity: 1; } 77% { opacity: .94; } 78% { opacity: 1; } }

.tv__flash { position: absolute; inset: 0; z-index: 6; background: #fff; opacity: 0; pointer-events: none; }
.tv__flash.is-on { animation: flash .42s steps(3, end) forwards; }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }

/* the TV on-screen display */
.osd { position: absolute; left: var(--osd-x); bottom: var(--osd-y); right: var(--osd-x); z-index: 3; max-width: 1240px;
  text-transform: uppercase; color: var(--ink); text-shadow: var(--glow-ink); letter-spacing: .02em;
  transition: opacity .6s steps(4, end); }
.osd.is-idle { opacity: 0; pointer-events: none; }
.osd p { margin: 0; }
.osd__ch { font-size: clamp(20px, 1.9vw, 30px); line-height: 1.2; margin-bottom: var(--s1) !important; }
.osd__name { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: var(--display); line-height: 1; color: var(--accent); text-shadow: var(--glow-go); }
.osd__name span { white-space: nowrap; }
.osd__ticker { font-weight: 400; }
.osd__line { font-size: clamp(18px, 1.6vw, 24px); line-height: 1.3; margin: var(--s1) 0 var(--s2) !important; }

.osd__ca { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--s2); font-size: clamp(18px, 1.5vw, 22px); }
.osd__label { color: var(--accent); text-shadow: var(--glow-go); }
.osd__ca code { font-family: var(--font-mono); font-size: clamp(16px, 1.25vw, 19px); text-transform: none; letter-spacing: 0; line-height: 1.35; min-width: 0; }
.osd__ca code.is-off { font-family: var(--font-body); text-transform: uppercase; font-size: inherit; letter-spacing: .02em; opacity: .7; }

.osd__key { display: inline-flex; align-items: center; gap: .45em; min-height: 48px; padding: 0 .2em; margin: 0;
  background: none; border: 0; border-radius: 0; color: inherit; font: inherit; text-transform: uppercase; letter-spacing: .04em;
  text-shadow: inherit; text-decoration: none; cursor: pointer; transition: color .25s cubic-bezier(.3, 1.4, .5, 1), transform .25s cubic-bezier(.3, 1.4, .5, 1); }
.osd__key:hover, .osd__key:focus-visible { color: #000; background: var(--ink); text-shadow: none; }
.osd__key--go:hover, .osd__key--go:focus-visible { background: var(--accent); }
.osd__key:active { transform: translateY(1px); transition-duration: .035s; }
.osd__key.is-off:hover { background: none; color: inherit; text-shadow: inherit; }
.osd__key img { width: 1.1em; height: 1.1em; object-fit: contain; image-rendering: auto; }
.osd__arrow { font-size: max(16px, .62em); color: var(--accent); }
.osd__key:hover .osd__arrow, .osd__key:focus-visible .osd__arrow { color: #000; }

.osd__menu { display: flex; flex-wrap: wrap; gap: 0 var(--s4); font-size: clamp(22px, 2vw, 32px); margin-top: var(--s1); }
.osd__key--go { color: var(--accent); text-shadow: var(--glow-go); }

.osd__risk { margin-top: var(--s2) !important; font-size: clamp(16px, 1vw, 19px); line-height: 1.3; color: var(--muted); text-shadow: none; text-transform: none; letter-spacing: .02em; max-width: 60ch; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

@media (max-width: 560px) {
  .osd__name span { display: block; }
  .osd__ticker { font-size: .62em; margin-top: .15em; }
  .osd__line { margin-bottom: var(--s1) !important; }
}

/* 404 */
.osd--nosignal .osd__name { color: var(--ink); text-shadow: var(--glow-ink); }

@media (prefers-reduced-motion: reduce) {
  .tv { animation: none; }
  .tv__band, .tv__glass { animation: none; }
  .osd.is-idle { opacity: 1; pointer-events: auto; }
}
