/* exandric.dev: neon HUD theme. Dark only. No build step.
 *
 * Hard rule (Twitch embed policy + browser visibility checks): never put
 * filter, opacity, transform, clip-path or mask on .player, .chat or any of
 * their ancestors (.stage-body, .stage, main, .shell, body), and never paint
 * anything above them. Frames and glow are pseudo-elements or siblings that
 * sit BEHIND the iframes.
 */

:root {
  --bg: #07060d;
  --grid: rgba(145, 70, 255, 0.07);
  --panel: #0f0c1f;
  --panel-2: #15112b;
  --line: #2a2450;
  --purple: #9146ff;
  --purple-soft: #b98cff;
  --cyan: #00e5ff;
  --red: #ff2a4f;
  --text: #d9d6ee;
  --muted: #8f8ab0;
  --font-display: "Orbitron", "Rajdhani", system-ui, sans-serif;
  --font-body: "Rajdhani", system-ui, -apple-system, "Segoe UI", sans-serif;
  --cut: 18px;
  --gutter: 16px;
  --max: 1400px;
}

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

[hidden] {
  display: none !important;
}

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 520px at 50% -80px, rgba(145, 70, 255, 0.3), transparent 70%),
    radial-gradient(ellipse 600px 420px at 100% 100%, rgba(0, 229, 255, 0.1), transparent 70%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: auto, auto, 48px 48px, 48px 48px;
  background-repeat: no-repeat, no-repeat, repeat, repeat;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.55;
}

/* Static scanlines BEHIND all content (z-index 0; .shell is z-index 1). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 4px);
}

.shell {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter) 48px;
}

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

a {
  color: var(--cyan);
}

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

/* ---------- HUD bar ---------- */

.hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 18px 0;
}

.hud-id {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: auto;
  color: inherit;
  text-decoration: none;
}

.avatar {
  display: block;
  width: 44px;
  height: 44px;
  background: var(--panel-2);
  clip-path: polygon(25% 0, 100% 0, 100% 75%, 75% 100%, 0 100%, 0 25%);
}

.wordmark {
  position: relative;
  display: inline-block;
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-shadow: 0 0 14px rgba(145, 70, 255, 0.9), 0 0 2px rgba(0, 229, 255, 0.8);
}

.wordmark::before,
.wordmark::after {
  content: attr(data-text);
  content: attr(data-text) / "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  text-shadow: none;
}

.wordmark::before {
  color: var(--cyan);
  clip-path: inset(0 0 100% 0);
  animation: glitch-a 4s steps(1) infinite;
}

.wordmark::after {
  color: var(--red);
  clip-path: inset(100% 0 0 0);
  animation: glitch-b 4s steps(1) infinite;
}

@keyframes glitch-a {
  0%, 91%, 100% { clip-path: inset(0 0 100% 0); transform: none; }
  92% { clip-path: inset(10% 0 55% 0); transform: translate(-3px, 0); }
  94% { clip-path: inset(60% 0 10% 0); transform: translate(3px, 0); }
  96% { clip-path: inset(30% 0 40% 0); transform: translate(-2px, 0); }
  98% { clip-path: inset(0 0 100% 0); transform: none; }
}

@keyframes glitch-b {
  0%, 92%, 100% { clip-path: inset(100% 0 0 0); transform: none; }
  93% { clip-path: inset(50% 0 20% 0); transform: translate(3px, 0); }
  95% { clip-path: inset(5% 0 70% 0); transform: translate(-3px, 0); }
  97% { clip-path: inset(75% 0 5% 0); transform: translate(2px, 0); }
  99% { clip-path: inset(100% 0 0 0); transform: none; }
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 12px;
  border: 1px solid var(--line);
  background: rgba(15, 12, 31, 0.85);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

body[data-live="true"] .status {
  border-color: var(--red);
  color: var(--red);
  box-shadow: 0 0 16px rgba(255, 42, 79, 0.45), inset 0 0 10px rgba(255, 42, 79, 0.15);
}

body[data-live="true"] .status-dot {
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.7); }
}

.btn {
  display: inline-block;
  padding: 10px 22px;
  background: var(--purple);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-decoration: none;
  text-transform: uppercase;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  transition: background-color 0.15s, color 0.15s;
}

.btn:hover,
.btn:focus-visible {
  background: var(--cyan);
  color: var(--bg);
}

/* clip-path would cut off an outline, so the focus ring is an inset shadow. */
.btn:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--bg);
}

/* ---------- Angular frame (pseudo-elements behind the content) ---------- */

.frame {
  position: relative;
  z-index: 0;
}

.frame::before,
.frame::after {
  content: "";
  position: absolute;
  z-index: -1;
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
}

.frame::before {
  inset: 0;
  background: linear-gradient(135deg, var(--purple), var(--cyan));
}

.frame::after {
  inset: 1px;
  background: var(--panel);
}

/* ---------- Stage: player + chat ---------- */

.stage {
  margin-top: 8px;
  padding: 14px;
}

.stage.frame::after {
  inset: 2px;
}

.stage-glow {
  position: absolute;
  inset: 8px;
  z-index: -2;
  pointer-events: none;
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  filter: blur(32px);
  opacity: 0.35;
}

.stage-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 2px 6px 12px var(--cut);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.stage-bar b {
  color: var(--cyan);
  font-weight: 700;
}

.stage-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 12px;
  align-items: stretch;
}

.player {
  position: relative;
  align-self: center;
  aspect-ratio: 16 / 9;
  background: #000;
}

.chat {
  position: relative;
  min-height: 400px;
  background: #000;
}

.player iframe,
.chat iframe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.stage-fallback {
  margin: 0;
  padding: 64px 24px;
  text-align: center;
}

/* ---------- Info panels ---------- */

.panels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 28px;
}

.panel {
  padding: 24px 24px 28px;
}

.panel-tag {
  margin: 0 0 6px;
  color: var(--cyan);
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.panel h2 {
  margin: 0 0 12px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.panel p {
  margin: 0 0 12px;
}

.panel p:last-child {
  margin-bottom: 0;
}

.panel strong {
  color: var(--purple-soft);
  font-weight: 700;
}

.links {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}

.links a::after {
  content: "\2192";
  content: "\2192" / "";
  color: var(--cyan);
}

.links a:hover,
.links a:focus-visible {
  border-color: var(--cyan);
  background: rgba(0, 229, 255, 0.08);
  color: #fff;
}

/* ---------- Footer ---------- */

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 18px;
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- 404 ---------- */

.lost {
  display: grid;
  place-content: center;
  gap: 12px;
  min-height: 60vh;
  padding: 48px 0;
  text-align: center;
}

.lost-code {
  margin: 0;
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(5rem, 22vw, 12rem);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 30px rgba(145, 70, 255, 0.9), 4px 0 0 rgba(0, 229, 255, 0.6), -4px 0 0 rgba(255, 42, 79, 0.6);
}

.lost h1 {
  margin: 0;
  color: var(--cyan);
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 4vw, 2rem);
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.lost p {
  margin: 0;
}

/* ---------- Responsive ---------- */

@media (max-width: 1023.98px) {
  .stage-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat {
    height: 500px;
    min-height: 0;
  }
}

@media (max-width: 799.98px) {
  .panels {
    grid-template-columns: minmax(0, 1fr);
  }

  .stage {
    padding: 10px;
  }
}

@media (max-width: 479.98px) {
  .hud .btn {
    width: 100%;
    text-align: center;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .wordmark::before,
  .wordmark::after,
  body[data-live="true"] .status-dot {
    animation: none;
  }

  .btn,
  .links a {
    transition: none;
  }
}
