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

:root {
  --bg: #080808;
  --fg: #e8e8e8;
  --dim: rgba(255,255,255,0.28);
  --dimmer: rgba(255,255,255,0.1);
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Courier New', monospace;
  -webkit-font-smoothing: antialiased;
}

/* Scanlines overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.06) 3px,
    rgba(0,0,0,0.06) 4px
  );
  pointer-events: none;
  z-index: 999;
}

.mono-sm {
  font-family: 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
  user-select: none;
}

/* Corner brackets */
.corner {
  position: fixed;
  width: 22px;
  height: 22px;
  pointer-events: none;
  z-index: 100;
}
.corner::before, .corner::after {
  content: '';
  position: absolute;
  background: rgba(255,255,255,0.18);
}
.c-tl { top: 16px; left: 16px; }
.c-tr { top: 16px; right: 16px; }
.c-bl { bottom: 16px; left: 16px; }
.c-br { bottom: 16px; right: 16px; }
.c-tl::before, .c-bl::before { width: 1px; height: 22px; left: 0; top: 0; }
.c-tl::after,  .c-bl::after  { width: 22px; height: 1px; left: 0; }
.c-tr::before, .c-br::before { width: 1px; height: 22px; right: 0; top: 0; }
.c-tr::after,  .c-br::after  { width: 22px; height: 1px; right: 0; }
.c-tl::after { top: 0; } .c-tr::after { top: 0; }
.c-bl::after { bottom: 0; top: auto; } .c-br::after { bottom: 0; top: auto; }

/* Blinking REC indicator */
.rec {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dimmer);
}
.rec::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  animation: blink 2.4s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.1; }
}

#app {
  height: 100dvh;
  position: relative;
}

.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.view.active {
  opacity: 1;
  pointer-events: all;
}

.bar {
  flex-shrink: 0;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.bar--top {
  border-top: none;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.bar--bottom {
  border-top: 1px solid rgba(255,255,255,0.04);
  border-bottom: none;
}

.btn {
  background: none;
  border: none;
  color: var(--dim);
  font-family: 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 8px;
  margin: -8px;
  transition: color 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { color: var(--fg); }

.home-link {
  text-decoration: none;
  color: var(--dim);
}
.home-link:hover { color: var(--fg); }

/* Episode info block */
.ep-info {
  position: fixed;
  left: 32px;
  bottom: 32px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: none;
}
.ep-season {
  font-family: 'Courier New', monospace;
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
}
.ep-episode {
  font-family: 'Arial Black', 'Helvetica Neue', sans-serif;
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.55);
  line-height: 1;
}
.ep-count {
  font-family: 'Courier New', monospace;
  font-size: 9px;
  letter-spacing: 0.22em;
  color: rgba(255,255,255,0.3);
  margin-top: 4px;
}

.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0 56px;
}

.frame {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#poster-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 24px 80px rgba(0,0,0,0.9);
  transition: opacity 0.15s ease;
  user-select: none;
}
#poster-img.out { opacity: 0; }

.nav-btn {
  position: absolute;
  top: 0;
  height: 100%;
  width: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: rgba(255,255,255,0.15);
  cursor: pointer;
  transition: color 0.15s;
}
.nav-btn:hover { color: rgba(255,255,255,0.55); }
.nav-btn:disabled { opacity: 0.08; cursor: default; }
#btn-prev { left: 0; }
#btn-next { right: 0; }

/* Orbital "universe" view */
.bar--grid {
  border-bottom: 1px solid rgba(255,255,255,0.05);
  border-top: none;
}

.grid {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.orbit-spokes {
  position: absolute;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 1;
}

.orbit-core {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;
  pointer-events: none;
  z-index: 2;
  opacity: 0.9;
}

.const-node {
  position: absolute;
  width: 66px;
  height: 66px;
  cursor: pointer;
  z-index: 3;
  will-change: transform;
}
.const-node img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: 1px solid rgba(255,255,255,0.08);
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.const-node:hover img {
  border-color: rgba(255,255,255,0.5);
  transform: scale(1.18);
  box-shadow: 0 0 26px rgba(255,255,255,0.1);
}
.const-node.is-current img {
  border-color: rgba(255,255,255,0.55);
  box-shadow: 0 0 22px rgba(255,255,255,0.12);
}
.const-tag {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Courier New', monospace;
  font-size: 8px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
  white-space: nowrap;
  pointer-events: none;
}
.const-node.is-current .const-tag { color: rgba(255,255,255,0.55); }

@media (max-width: 560px) {
  .const-node { width: 38px; height: 38px; }
  .const-tag { font-size: 7px; bottom: -13px; }
  .orbit-core { width: 130px; height: 130px; }
}

@media (prefers-reduced-motion: reduce) {
  #poster-img, .view, .grid-item img { transition: none; }
  .rec::before { animation: none; }
}
