/* ============================================================
   BrainSap.stream — Streaming Platform (Beta)
   No cookies, no tracking, no external fonts
   ============================================================ */

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

:root {
  --bg-deep: #0a0a0c;
  --bg-primary: #0f0f12;
  --bg-secondary: #161619;
  --bg-card: #1c1c21;
  --bg-card-hover: #232328;
  --bg-elevated: #28282e;
  --accent: #d4363c;
  --accent-hover: #e84449;
  --accent-dim: rgba(212,54,60,0.15);
  --gold: #c9a84c;
  --gold-dim: rgba(201,168,76,0.12);
  --live-red: #e91916;
  --online-green: #00d46a;
  --text-primary: #e8e8ed;
  --text-secondary: #9f9fad;
  --text-muted: #5f5f6e;
  --border: #2a2a30;
  --border-light: #35353d;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-card: 0 2px 12px rgba(0,0,0,0.4);
  --shadow-elevated: 0 8px 32px rgba(0,0,0,0.6);
  --max-w: 1360px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "Fira Code", monospace;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ============================================================
   BETA BANNER
   ============================================================ */
.beta-bar {
  background: var(--accent);
  background: linear-gradient(90deg, var(--accent) 0%, #8b1a1d 60%, #6b2fa0 100%);
  text-align: center;
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: #fff;
  text-transform: uppercase;
}
.beta-bar code {
  background: rgba(0,0,0,0.25);
  padding: 1px 8px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  margin-right: 8px;
  letter-spacing: 1.5px;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  height: 54px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 200;
}
.header-inner {
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.5px;
}
.logo-mark {
  width: 30px;
  height: 30px;
  background: var(--accent);
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 15px;
  box-shadow: 0 0 16px rgba(212,54,60,0.35);
  color: #fff;
  font-weight: 900;
  line-height: 1;
}
.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.logo-sub {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 1px;
}

.nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
}
.nav-links a {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color .15s, background .15s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
  background: var(--bg-card);
}

.header-search {
  position: relative;
}
.header-search input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 14px 7px 34px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font);
  width: 220px;
  outline: none;
  transition: border-color .2s, width .2s;
}
.header-search input:focus {
  border-color: var(--accent);
  width: 280px;
}
.header-search input::placeholder {
  color: var(--text-muted);
}
.header-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 2;
  pointer-events: none;
}

/* ============================================================
   HERO (index only)
   ============================================================ */
.hero {
  position: relative;
  padding: 48px 20px 40px;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 40%, rgba(212,54,60,0.06), transparent),
    radial-gradient(ellipse 40% 60% at 80% 30%, rgba(107,47,160,0.04), transparent);
  pointer-events: none;
}
.hero-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 40px;
  align-items: center;
  position: relative;
}
.hero h1 {
  font-size: 38px;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.5px;
  margin-bottom: 14px;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
}
.hero-desc {
  color: var(--text-secondary);
  font-size: 15px;
  max-width: 440px;
  margin-bottom: 22px;
  line-height: 1.65;
}
.hero-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tag {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 5px 13px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: border-color .2s, color .2s;
}
.tag:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
}
.hero-featured {
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16/9;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-elevated);
  position: relative;
}
.hero-featured .player-placeholder {
  width: 100%;
  height: 100%;
}

/* ============================================================
   SECTION HEADERS
   ============================================================ */
.section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}
.section + .section {
  margin-top: 40px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.section-head h2 {
  font-size: 19px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 9px;
}
.section-head .more {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  transition: opacity .2s;
}
.section-head .more:hover { opacity: .75; }

.live-dot {
  width: 8px;
  height: 8px;
  background: var(--live-red);
  border-radius: 50%;
  display: inline-block;
  animation: blink 1.6s ease-in-out infinite;
}
@keyframes blink {
  0%,100% { opacity: 1; }
  50% { opacity: .3; }
}

/* ============================================================
   STREAM CARDS
   ============================================================ */
.stream-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}
.stream-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.stream-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-light);
  box-shadow: var(--shadow-card);
}
.card-thumb {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--bg-deep);
  overflow: hidden;
}
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.badge-live {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--live-red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.badge-viewers {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0,0,0,.72);
  color: #ddd;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
}
.badge-offline {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
}
.card-info {
  padding: 11px 13px;
  display: flex;
  gap: 10px;
}
.card-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-elevated);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 700;
}
.card-meta h3 {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta .channel-name {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
}
.card-meta .card-cat {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   CATEGORY CARDS
   ============================================================ */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.cat-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform .18s, border-color .18s;
  background: var(--bg-card);
}
.cat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
}
.cat-cover {
  aspect-ratio: 3/4;
  display: grid;
  place-items: center;
  font-size: 44px;
  position: relative;
  overflow: hidden;
}
.cat-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,.55));
}
.cat-body {
  padding: 9px 11px 11px;
}
.cat-body h3 {
  font-size: 13px;
  font-weight: 700;
}
.cat-body .cat-stat {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   PLAYER / CHANNEL PAGE
   ============================================================ */
.channel-layout {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  min-height: calc(100vh - 120px);
}
.player-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  aspect-ratio: 16/9;
  position: relative;
}
.player-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 14px;
  background: var(--bg-deep);
}
.player-placeholder .play-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: grid;
  place-items: center;
}
.player-placeholder .play-icon svg {
  width: 22px;
  height: 22px;
  fill: var(--accent);
}
.player-placeholder video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.channel-info {
  padding: 16px 0;
}
.channel-info h1 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}
.channel-info .ch-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}
.channel-info .ch-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Chat panel */
.chat-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  text-align: center;
}
.chat-disabled {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}
.chat-disabled .chat-lock-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
}
.chat-disabled .chat-lock-icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 2;
}
.chat-disabled strong {
  display: block;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 6px;
}

/* ============================================================
   TEXT PAGES (about, contacts)
   ============================================================ */
.page-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}
.page-wrap h1 {
  font-size: 30px;
  font-weight: 800;
  margin-bottom: 8px;
}
.page-wrap .page-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.page-wrap h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 32px 0 10px;
  color: var(--text-secondary);
}
.page-wrap p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 14px;
}
.page-wrap ul {
  padding-left: 22px;
  margin-bottom: 16px;
}
.page-wrap li {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 6px;
}
.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-top: 20px;
}
.contact-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}
.contact-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 10px;
}
.contact-row svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 36px 20px;
  margin-top: 60px;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 32px;
}
.footer-col h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 14px;
}
.footer-col p,
.footer-col a {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 7px;
  transition: color .15s;
}
.footer-col a:hover {
  color: var(--text-primary);
}
.footer-legal {
  max-width: var(--max-w);
  margin: 20px auto 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }
  .channel-layout {
    grid-template-columns: 1fr;
  }
  .chat-panel {
    min-height: 260px;
  }
  .footer-inner {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 600px) {
  .hero h1 { font-size: 26px; }
  .nav-links { display: none; }
  .header-search input { width: 140px; }
  .header-search input:focus { width: 180px; }
  .stream-grid { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .footer-inner { grid-template-columns: 1fr; }
  .site-header { padding: 0 12px; }
}
