/* CRT outline — solid-block SVG + calm phosphor motion (v3: half amp, 2× slow, TV flicker) */
:root {
  --bg: #000000;
  --mark: #f0b429;
  --mark-glow-a: rgba(240, 180, 41, 0.9);
  --mark-glow-b: rgba(240, 180, 41, 0.5);
  --footer: #f0b429;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--mark);
  font-family: "Courier New", Courier, ui-monospace, monospace;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  position: relative;
}

.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem 4.5rem;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.mark-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: mark-drift 18s ease-in-out infinite;
  will-change: transform;
}

.mark {
  display: block;
  width: min(70vw, 420px);
  height: auto;
  max-height: min(52vh, 520px);
  color: var(--mark);
  filter:
    drop-shadow(0 0 8px var(--mark-glow-a))
    drop-shadow(0 0 20px var(--mark-glow-b));
  shape-rendering: crispEdges;
  user-select: none;
  animation:
    mark-breathe 7.6s ease-in-out infinite,
    mark-flicker 9s ease-in-out infinite;
  will-change: filter, opacity, color;
}

.mark--wide {
  width: min(88vw, 640px);
  max-height: min(40vh, 320px);
}

.scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0.14;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    rgba(240, 180, 41, 0.55) 3px,
    rgba(240, 180, 41, 0.55) 4px
  );
  background-size: 100% 8px;
  animation: scan-crawl 14s linear infinite;
  mix-blend-mode: screen;
}

.mark rect.is-glitch {
  opacity: 0.25;
}

/* ~50% of v2 pulse delta; 2× duration (was 3.8s) */
@keyframes mark-breathe {
  0%, 100% {
    opacity: 0.86;
    filter:
      drop-shadow(0 0 6px rgba(240, 180, 41, 0.7))
      drop-shadow(0 0 14px rgba(240, 180, 41, 0.38));
  }
  50% {
    opacity: 1;
    filter:
      drop-shadow(0 0 10px rgba(240, 180, 41, 0.95))
      drop-shadow(0 0 22px rgba(240, 180, 41, 0.55))
      drop-shadow(0 0 32px rgba(240, 180, 41, 0.28));
  }
}

/* ~50% of v2 ±5px → ~±2.5px; 2× duration (was 9s) */
@keyframes mark-drift {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(2.5px, -2px); }
  50% { transform: translate(-2px, 1.5px); }
  75% { transform: translate(1.5px, 2.5px); }
}

/* TV flicker: core cyan ~⅔ of cycle, brief soft hue offs then return */
@keyframes mark-flicker {
  0%, 66%, 100% {
    color: #f0b429;
  }
  72% {
    color: #ffd56a; /* cooler / brighter cyan-white */
  }
  78% {
    color: #d4a01e; /* slightly greener cyan */
  }
  84% {
    color: #f5c24a; /* soft azure */
  }
  90% {
    color: #f0b429;
  }
}

@keyframes scan-crawl {
  from { background-position: 0 0; }
  to { background-position: 0 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .mark-wrap,
  .mark,
  .scanlines {
    animation: none !important;
  }
  .scanlines { opacity: 0.1; }
  .mark { opacity: 1; color: #f0b429; }
}

footer {
  position: fixed;
  bottom: 1.25rem;
  left: 0;
  right: 0;
  text-align: center;
  z-index: 4;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

footer a {
  color: var(--footer);
  text-decoration: none;
  filter: drop-shadow(0 0 6px var(--mark-glow-a));
  opacity: 0.85;
  transition: opacity 0.25s ease;
}

footer a:hover { opacity: 1; }

.nf {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  z-index: 1;
  position: relative;
  padding: 2rem;
}

.nf .code {
  font-size: clamp(1.5rem, 6vw, 2.5rem);
  letter-spacing: 0.2em;
  color: var(--mark);
  filter:
    drop-shadow(0 0 6px var(--mark-glow-a))
    drop-shadow(0 0 14px var(--mark-glow-b));
}

.nf p {
  font-size: 0.85rem;
  opacity: 0.8;
  letter-spacing: 0.12em;
}
