:root {
  --bg: #07111f;
  --bg-elev: #0d1f35;
  --bg-card: rgba(10, 28, 46, 0.88);
  --line: rgba(131, 178, 226, 0.28);
  --text: #f3f9ff;
  --muted: #9db3cc;
  --ok: #34d399;
  --chip-chat: #52c7ff;
  --chip-sub: #ffbb55;
  --chip-points: #ff7b7b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Bricolage Grotesque", sans-serif;
  background:
    radial-gradient(1100px 620px at 8% 8%, #103861 0%, transparent 60%),
    radial-gradient(900px 560px at 94% 90%, #4e2237 0%, transparent 52%),
    linear-gradient(155deg, #060d18, var(--bg));
  padding: 1.2rem;
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  filter: blur(56px);
  border-radius: 999px;
  opacity: 0.55;
  pointer-events: none;
}

.bg-orb-a {
  width: 260px;
  height: 260px;
  top: -60px;
  right: 10%;
  background: #1f7aff;
}

.bg-orb-b {
  width: 280px;
  height: 280px;
  bottom: -70px;
  left: 5%;
  background: #ff6f5e;
}

.layout {
  width: min(1040px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 1rem;
  position: relative;
  z-index: 3;
}

.card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 45px rgba(1, 7, 16, 0.5);
}

.hero {
  padding: 1.25rem;
  animation: in 520ms ease-out;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.top-right-tools {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.brand-pill {
  margin: 0;
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(140, 195, 250, 0.5);
  color: #d4e9ff;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-size: 0.76rem;
  font-weight: 700;
}

.status-chip {
  margin: 0;
  padding: 0.3rem 0.72rem;
  border-radius: 999px;
  background: rgba(10, 24, 40, 0.82);
  border: 1px solid rgba(128, 167, 204, 0.45);
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
}

.auth-link {
  margin: 0;
  border-radius: 999px;
  border: 1px solid rgba(131, 178, 226, 0.5);
  color: #d8ecff;
  background: rgba(12, 31, 52, 0.85);
  font-size: 0.74rem;
  padding: 0.3rem 0.72rem;
  text-decoration: none;
  font-family: "JetBrains Mono", monospace;
  cursor: pointer;
}

.auth-link:hover {
  border-color: rgba(112, 189, 255, 0.9);
  color: #ffffff;
}

.auth-logout {
  color: #ffd1d1;
  border-color: rgba(255, 125, 125, 0.5);
}

.user-chip {
  margin: 0;
  border-radius: 999px;
  border: 1px solid rgba(52, 211, 153, 0.6);
  color: #c8ffe9;
  padding: 0.3rem 0.72rem;
  font-size: 0.74rem;
  font-family: "JetBrains Mono", monospace;
  background: rgba(4, 42, 33, 0.7);
}

h1 {
  margin: 0.8rem 0 0.3rem;
  font-size: clamp(1.6rem, 3.2vw, 2.45rem);
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.kpis {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}

.kpi {
  border: 1px solid rgba(125, 167, 210, 0.34);
  border-radius: 14px;
  background: rgba(8, 22, 37, 0.64);
  padding: 0.65rem 0.75rem;
}

.kpi-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.kpi-value {
  margin: 0.2rem 0 0;
  font-size: 1.2rem;
  font-weight: 800;
}

.panel {
  padding: 1rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.06rem;
}

.panel-note {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.events {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.event-item {
  border: 1px solid rgba(128, 172, 216, 0.26);
  border-radius: 14px;
  padding: 0.78rem;
  background: linear-gradient(130deg, rgba(9, 24, 40, 0.74), rgba(13, 30, 49, 0.64));
  display: grid;
  gap: 0.3rem;
  animation: in 280ms ease-out;
}

.event-type {
  width: fit-content;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  background: rgba(255, 255, 255, 0.2);
}

.event-type.chat-message {
  background: var(--chip-chat);
  color: #0b132b;
}

.event-type.channel-subscribe {
  background: var(--chip-sub);
  color: #1b1b1b;
}

.event-type.channel-channel-points-redeem {
  background: var(--chip-points);
  color: #1b1b1b;
}

.event-content {
  color: var(--text);
}

.event-time {
  color: var(--muted);
  font-size: 0.75rem;
  font-family: "JetBrains Mono", monospace;
}

.debug-tools {
  padding: 1rem;
  background: rgba(9, 24, 40, 0.88);
  border: 1px solid rgba(131, 178, 226, 0.28);
  border-radius: 18px;
  margin-top: 1rem;
}

.debug-tools h3 {
  margin: 0 0 0.8rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.debug-btn {
  padding: 0.5rem 1rem;
  margin-right: 0.6rem;
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid var(--ok);
  color: var(--ok);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 150ms;
}

.debug-btn:hover {
  background: rgba(52, 211, 153, 0.25);
}

.debug-btn:active {
  opacity: 0.7;
}

.eventsub-status {
  margin-top: 0.8rem;
  padding: 0.8rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  font-size: 0.75rem;
  font-family: "JetBrains Mono", monospace;
  line-height: 1.5;
  color: var(--muted);
  max-height: 200px;
  overflow-y: auto;
}

@media (max-width: 900px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .layout {
    gap: 0.8rem;
  }

  .hero,
  .panel {
    padding: 0.9rem;
  }

  .kpis {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 1.42rem;
  }
}

@keyframes in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
