:root {
  --bg: #06060a;
  --bg-alt: #0b0b14;
  --card-bg: rgba(255, 255, 255, 0.035);
  --card-bg-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-live: rgba(255, 23, 68, 0.55);

  --neon-cyan: #00e5ff;
  --neon-purple: #9146ff;
  --neon-pink: #ff2bd6;
  --live-red: #ff1744;

  --text: #eaeaf4;
  --text-muted: #8d8da3;
  --text-dim: #5c5c70;

  --font-display: "Orbitron", sans-serif;
  --font-body: "Inter", sans-serif;

  --radius: 16px;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Background effects */

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: linear-gradient(rgba(145, 70, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(145, 70, 255, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 40%, transparent 100%);
  pointer-events: none;
}

.bg-glow {
  position: fixed;
  z-index: 0;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.16;
  pointer-events: none;
}

.bg-glow--cyan {
  top: -20vmax;
  left: -15vmax;
  background: var(--neon-cyan);
}

.bg-glow--pink {
  bottom: -25vmax;
  right: -15vmax;
  background: var(--neon-pink);
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
  background: linear-gradient(to bottom, rgba(6, 6, 10, 0.92), rgba(6, 6, 10, 0.65));
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand__avatar-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}

.brand__avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  background: #101018;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.brand__avatar-wrap.is-live .brand__avatar {
  border-color: var(--live-red);
  box-shadow: 0 0 14px rgba(255, 23, 68, 0.6);
}

.brand__live-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--live-red);
  border: 2px solid var(--bg);
  box-shadow: 0 0 8px var(--live-red);
  animation: pulse-dot 1.6s infinite;
}

.brand.is-live {
  cursor: pointer;
}

.brand__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  margin: 0;
  letter-spacing: 0.5px;
}

.brand__title .accent {
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand__subtitle {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.status-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
}

.status-summary__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  box-shadow: none;
  transition: all 0.3s ease;
}

.status-summary__dot.is-live {
  background: var(--live-red);
  box-shadow: 0 0 8px var(--live-red), 0 0 16px var(--live-red);
  animation: pulse-dot 1.6s infinite;
}

.btn-refresh {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(145, 70, 255, 0.1);
  border: 1px solid rgba(145, 70, 255, 0.4);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-refresh:hover {
  background: rgba(145, 70, 255, 0.22);
  border-color: var(--neon-purple);
  box-shadow: 0 0 16px rgba(145, 70, 255, 0.35);
}

.btn-refresh svg {
  transition: transform 0.4s ease;
}

.btn-refresh.is-spinning svg {
  animation: spin 0.7s linear;
}

/* Main / grid */

.main {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 12px;
}

.error-banner {
  background: rgba(255, 23, 68, 0.1);
  border: 1px solid rgba(255, 23, 68, 0.4);
  color: #ffb3c1;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.updated-at {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.78rem;
  margin: 28px 0 8px;
}

/* Card */

.card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}

.card--skeleton {
  min-height: 190px;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.03) 30%, rgba(255, 255, 255, 0.07) 50%, rgba(255, 255, 255, 0.03) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
}

.card--live {
  border-color: var(--border-live);
  cursor: pointer;
  background: linear-gradient(160deg, rgba(255, 23, 68, 0.07), rgba(145, 70, 255, 0.04));
}

.card--live:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(255, 23, 68, 0.25), 0 0 0 1px var(--border-live);
  background: var(--card-bg-hover);
}

.card--offline {
  opacity: 0.6;
}

.card--offline:hover {
  opacity: 0.85;
}

.card__thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #101018;
}

.card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card__thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 2rem;
}

.card__live-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--live-red);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 5px;
  box-shadow: 0 0 12px rgba(255, 23, 68, 0.7);
}

.card__live-badge .live-dot {
  width: 6px;
  height: 6px;
}

.card__viewers {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 5px;
  backdrop-filter: blur(4px);
}

.card__body {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
  background: #101018;
}

.card--live .card__avatar {
  border-color: var(--live-red);
  box-shadow: 0 0 12px rgba(255, 23, 68, 0.5);
}

.card--offline .card__avatar {
  filter: grayscale(0.6);
}

.card__info {
  min-width: 0;
  flex: 1;
}

.card__name {
  font-weight: 700;
  font-size: 1rem;
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__status-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.card--offline .card__status-line {
  color: var(--text-dim);
}

.card__title {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__watch-btn {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 0.82rem;
  font-family: var(--font-body);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.card--live .card__watch-btn {
  background: linear-gradient(90deg, var(--live-red), var(--neon-pink));
  color: #fff;
  box-shadow: 0 0 14px rgba(255, 43, 214, 0.35);
}

.card--live .card__watch-btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 20px rgba(255, 43, 214, 0.55);
}

.card--offline .card__watch-btn {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  border-color: var(--border);
  cursor: default;
}

.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  animation: pulse-dot 1.6s infinite;
}

/* Footer */

.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 30px 20px 50px;
  color: var(--text-dim);
  font-size: 0.78rem;
}

/* Modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 8, 0.85);
  backdrop-filter: blur(6px);
}

.modal__dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1200px;
  background: var(--bg-alt);
  border: 1px solid var(--border-live);
  border-radius: var(--radius);
  box-shadow: 0 0 60px rgba(255, 23, 68, 0.2), 0 20px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: modal-in 0.2s ease;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.modal__heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal__title {
  margin: 0;
  font-size: 1.05rem;
  font-family: var(--font-display);
}

.modal__meta {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.modal__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-external {
  font-size: 0.78rem;
  color: var(--neon-cyan);
  text-decoration: none;
  border: 1px solid rgba(0, 229, 255, 0.35);
  padding: 6px 12px;
  border-radius: 999px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-external:hover {
  background: rgba(0, 229, 255, 0.1);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
}

.btn-popout {
  font-size: 0.78rem;
  font-family: var(--font-body);
  color: var(--neon-purple);
  background: none;
  text-decoration: none;
  border: 1px solid rgba(145, 70, 255, 0.4);
  padding: 6px 12px;
  border-radius: 999px;
  transition: all 0.2s ease;
  white-space: nowrap;
  cursor: pointer;
}

.btn-popout:hover {
  background: rgba(145, 70, 255, 0.14);
  box-shadow: 0 0 12px rgba(145, 70, 255, 0.35);
}

.btn-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-close:hover {
  border-color: var(--live-red);
  color: var(--live-red);
}

.modal__stage {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.modal__player {
  flex: 1 1 auto;
  min-width: 0;
  aspect-ratio: 16 / 9;
  background: #000;
}

.modal__player-inner {
  width: 100%;
  height: 100%;
}

.modal__player-inner iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.modal__chat {
  flex: 0 0 340px;
  border-left: 1px solid var(--border);
  background: var(--bg-alt);
  display: flex;
  flex-direction: column;
}

.modal__chat-hint {
  flex: 0 0 auto;
  margin: 0;
  padding: 8px 12px;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--text-muted);
  background: rgba(145, 70, 255, 0.08);
  border-bottom: 1px solid var(--border);
}

.modal__chat-hint button {
  background: none;
  border: none;
  padding: 0;
  color: var(--neon-cyan);
  font-size: inherit;
  font-family: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.modal__chat-inner {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

.modal__chat-inner iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

@media (max-width: 780px) {
  .modal__stage {
    flex-direction: column;
  }

  .modal__chat {
    flex-basis: 320px;
    border-left: none;
    border-top: 1px solid var(--border);
  }
}

/* Animations */

@keyframes pulse-dot {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.85);
  }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Responsive */

@media (max-width: 640px) {
  .site-header__inner {
    padding: 16px;
  }

  .brand__title {
    font-size: 1.2rem;
  }

  .header-controls {
    width: 100%;
    justify-content: space-between;
  }

  .main {
    padding: 24px 16px 12px;
  }

  .grid {
    grid-template-columns: 1fr;
  }
}
