/* =============================================================================
   TheLastWeb Stream — Complete Dark Theme CSS
   A clean, deduplicated stylesheet for an interactive streaming platform.
   ============================================================================= */

/* =============================================================================
   1. CSS VARIABLES (Design Tokens)
   ============================================================================= */
:root {
  /* Colors — Surfaces */
  --bg:              #0e0e10;
  --surface:         #18181b;
  --card:            #1f1f23;
  --elevated:        #26262c;
  --border:          #303036;

  /* Colors — Brand */
  --primary:         #9147ff;
  --primary-hover:   #a970ff;
  --primary-dim:     rgba(145, 71, 255, .15);
  --secondary:       #00f0ff;
  --accent:          #ff4500;

  /* Colors — Semantic */
  --success:         #00c853;
  --warning:         #ffd600;
  --error:           #ff1744;

  /* Colors — Text */
  --text:            #efeff1;
  --text-secondary:  #adadb8;
  --text-muted:      #636369;

  /* Radii */
  --radius:          8px;
  --radius-sm:       4px;
  --radius-lg:       12px;

  /* Shadows */
  --shadow:          0 2px 8px rgba(0, 0, 0, .4);
  --shadow-lg:       0 8px 24px rgba(0, 0, 0, .5);

  /* Motion */
  --transition:      .2s ease;

  /* Layout */
  --nav-h:           56px;
  --chat-w:          340px;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}


/* =============================================================================
   2. RESET & BASE
   ============================================================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--primary-hover); }

img { max-width: 100%; display: block; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}
button { cursor: pointer; }

ul, ol { list-style: none; }

code {
  font-family: 'Courier New', Consolas, monospace;
  background: var(--elevated);
  padding: .15em .4em;
  border-radius: var(--radius-sm);
  font-size: .875em;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }


/* =============================================================================
   3. LOADING SCREEN
   ============================================================================= */
.app-loading {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.loading-content { text-align: center; }

.loading-logo {
  font-size: 3rem;
  color: var(--primary);
  animation: pulse-glow 2s ease-in-out infinite;
}

.loading-text {
  color: var(--text-muted);
  margin-top: 1rem;
  font-size: .875rem;
}

.loading-spinner {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
}

.spinner-ring {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}


/* =============================================================================
   4. APP SHELL
   ============================================================================= */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  padding-top: var(--nav-h);
}


/* =============================================================================
   5. NAVBAR
   ============================================================================= */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  z-index: 1000;
  gap: .75rem;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
}
.nav-logo i { color: var(--primary); font-size: 1.3rem; }
.nav-logo:hover i { color: var(--secondary); }

.nav-link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}
.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: var(--elevated);
}

.nav-links {
  display: flex;
  gap: .25rem;
  margin-left: .5rem;
}
.nav-links a {
  padding: .4rem .75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: .875rem;
  transition: background var(--transition), color var(--transition);
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: var(--elevated);
}

/* Navbar Search */
.nav-search {
  flex: 1;
  max-width: 380px;
  margin: 0 auto;
  position: relative;
}
.nav-search input {
  width: 100%;
  padding: .45rem .75rem .45rem 2.2rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .875rem;
  transition: border-color var(--transition), background var(--transition);
}
.nav-search input::placeholder { color: var(--text-muted); }
.nav-search input:focus {
  border-color: var(--primary);
  background: var(--elevated);
}
.nav-search i {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .8rem;
  pointer-events: none;
}

/* Navbar Actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-left: auto;
}

/* Navbar Avatar Button (dropdown trigger) */
.nav-avatar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: background var(--transition);
  background: none;
  color: var(--text);
}
.nav-avatar-btn:hover { background: var(--elevated); }

.nav-username {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text);
}

/* Navbar Dropdown */
.nav-dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 200px;
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 1000;
  overflow: hidden;
}
.nav-dropdown.open .dropdown-menu { display: block; }

.dropdown-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.dropdown-header strong { display: block; }
.dropdown-header .text-muted { font-size: 13px; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  color: var(--text);
  transition: background var(--transition);
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-size: .875rem;
}
.dropdown-item:hover {
  background: var(--elevated);
  color: var(--text);
}

.dropdown-menu hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

.nav-dropdown .dd-divider {
  height: 1px;
  background: var(--border);
  margin: .25rem 0;
}
.nav-dropdown .dd-danger:hover { color: var(--error); }


/* =============================================================================
   6. AVATARS
   ============================================================================= */
.avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  color: #fff;
  flex-shrink: 0;
}

.avatar-md {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}

.avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.5rem;
  color: #fff;
  flex-shrink: 0;
}

/* Legacy avatar selectors used in channel cards */
.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  color: #fff;
  flex-shrink: 0;
}


/* =============================================================================
   7. BUTTONS
   ============================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .5rem 1rem;
  font-size: .875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
}
.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* Variants */
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-secondary { background: var(--secondary); color: #000; }
.btn-secondary:hover:not(:disabled) { filter: brightness(1.15); }

.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.15); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover:not(:disabled) {
  border-color: var(--text-muted);
  color: var(--text);
  background: var(--elevated);
}

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--elevated);
}

.btn-following {
  background: var(--elevated);
  color: var(--success);
  border: 1px solid var(--success);
}
.btn-following:hover { background: rgba(0, 200, 83, .15); }

/* Sizes */
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-lg { padding: .65rem 1.5rem; font-size: 1rem; }
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}


/* =============================================================================
   8. BADGES
   ============================================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .15rem .5rem;
  font-size: .7rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.badge-live {
  background: var(--accent);
  color: #fff;
  animation: badge-pulse 2s ease-in-out infinite;
}

.badge-offline  { background: var(--text-muted); color: var(--bg); }
.badge-mode     { background: var(--primary-dim); color: var(--primary); }
.badge-role     { background: var(--primary-dim); color: var(--primary); }
.badge-cost     { background: var(--warning); color: #000; font-weight: 800; }
.badge-cat      { background: var(--primary-dim); color: var(--primary); font-size: 11px; }

.badge-category {
  background: var(--elevated);
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: none;
}


/* =============================================================================
   9. FORMS & INPUTS
   ============================================================================= */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: .35rem;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 12px 0 4px;
}

.form-label-inline {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 4px;
  white-space: nowrap;
}

.form-input {
  width: 100%;
  padding: .55rem .75rem;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:disabled { opacity: .5; cursor: not-allowed; }

.form-input-sm {
  padding: .3rem .5rem;
  font-size: .85rem;
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23636369' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2rem;
}

.form-error {
  color: var(--error);
  font-size: .8rem;
  margin-top: .3rem;
}

.form-hint {
  color: var(--text-muted);
  font-size: .75rem;
  margin-top: .25rem;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 42px;
  height: 22px;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-block;
  background: var(--border);
  border-radius: 11px;
  transition: background var(--transition);
}
.toggle-switch::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
}
.toggle-switch.active {
  background: var(--primary);
}
.toggle-switch.active::before {
  transform: translateX(20px);
}

/* Toggle with hidden checkbox (alternative pattern) */
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 11px;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }


/* =============================================================================
   10. CARDS (Generic)
   ============================================================================= */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}
.card-body { padding: 1rem; }


/* =============================================================================
   11. HERO BANNER
   ============================================================================= */
.hero {
  position: relative;
  padding: 3rem 2rem;
  background: linear-gradient(135deg, var(--primary) 0%, #1a0533 40%, var(--bg) 100%);
  overflow: hidden;
  margin-bottom: 2rem;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 50%, rgba(145, 71, 255, .2), transparent 60%),
    radial-gradient(circle at 80% 30%, rgba(0, 240, 255, .1), transparent 50%);
}

.hero-content {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 1.15;
  background: linear-gradient(135deg, #fff 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: .75rem;
}

.hero p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

.hero-actions {
  display: flex;
  gap: .75rem;
  justify-content: center;
  flex-wrap: wrap;
}


/* =============================================================================
   12. CHANNEL CARDS GRID
   ============================================================================= */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  margin-bottom: 1rem;
}
.section-header h2 { font-size: 1.2rem; font-weight: 700; }

.section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section {
  padding: 0 1.5rem;
  margin-bottom: 2rem;
}

/* channels-grid: legacy name from original cards */
.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.25rem;
  padding: 0 1.5rem;
  margin-bottom: 2rem;
}

/* channel-grid: used by JS renderer */
.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* Individual channel card */
.channel-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid transparent;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.channel-card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 8px 30px rgba(145, 71, 255, .15);
  border-color: var(--primary);
}

/* Thumbnail */
.channel-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--elevated) 0%, var(--card) 100%);
  overflow: hidden;
}
.channel-thumb img { width: 100%; height: 100%; object-fit: cover; }

.channel-thumb-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 60%, rgba(0, 0, 0, .7) 100%);
}

.thumb-badges {
  position: absolute;
  top: .5rem;
  left: .5rem;
  display: flex;
  gap: .35rem;
}

.thumb-viewers {
  position: absolute;
  bottom: .5rem;
  left: .5rem;
  font-size: .75rem;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: .3rem;
  background: rgba(0, 0, 0, .6);
  padding: .15rem .45rem;
  border-radius: var(--radius-sm);
}

/* Card-based thumbs (JS-created cards) */
.card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--elevated);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}

.card-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 32px;
}

.card-badges {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: flex;
  gap: 4px;
}

.card-viewers {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 12px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Channel info row */
.channel-info {
  padding: .75rem;
  display: flex;
  gap: .6rem;
}

.card-info {
  display: flex;
  gap: 10px;
  padding: 10px;
}

.card-meta {
  min-width: 0;
  flex: 1;
}

.card-title {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-streamer {
  font-size: 12px;
  color: var(--text-muted);
}

.channel-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  color: #fff;
  flex-shrink: 0;
}

.channel-meta { flex: 1; min-width: 0; }

.channel-title {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-username {
  font-size: .8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-tags {
  display: flex;
  gap: .35rem;
  margin-top: .35rem;
  flex-wrap: wrap;
}


/* =============================================================================
   13. EMPTY STATE
   ============================================================================= */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
}

.empty-icon {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.empty-state i {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  display: block;
}

.empty-state h3,
.empty-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: .5rem;
}

.empty-state p,
.empty-text {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}


/* =============================================================================
   14. STREAM PAGE LAYOUT
   ============================================================================= */
.stream-page {
  display: grid;
  grid-template-columns: 1fr var(--chat-w);
  height: calc(100vh - var(--nav-h));
  overflow: hidden;
}

.stream-main { overflow-y: auto; }

/* stream-sidebar: the sidebar container used by JS */
.stream-sidebar {
  width: var(--chat-w);
  min-width: var(--chat-w);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-h));
}


/* =============================================================================
   15. VIDEO PLAYER
   ============================================================================= */
.player-wrapper {
  position: relative;
  width: 100%;
  background: #000;
}

.player-aspect {
  position: relative;
  padding-top: 56.25%; /* 16:9 */
}

.stream-player-wrapper {
  position: relative;
  width: 100%;
  background: #000;
  aspect-ratio: 16 / 9;
}

.stream-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0a0012 0%, #0e0e10 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stream-player video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* Offline state */
.player-offline {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  color: var(--text-muted);
}
.player-offline i { font-size: 3rem; opacity: .4; }
.player-offline p { font-size: .9rem; }

.offline-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.offline-sub {
  font-size: .85rem;
  color: var(--text-muted);
}

/* Live badge on player */
.player-live-badge {
  position: absolute;
  top: .75rem;
  left: .75rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--accent);
  color: #fff;
  padding: .25rem .6rem;
  border-radius: var(--radius-sm);
  font-size: .75rem;
  font-weight: 700;
}

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

/* Player overlays */
.player-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .6);
  z-index: 5;
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  text-align: center;
  padding: 2rem;
}

.player-countdown {
  font-size: 3rem;
  font-weight: 900;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}


/* =============================================================================
   16. CHANNEL INFO BAR
   ============================================================================= */
.channel-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.channel-bar-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}

.channel-bar-info { flex: 1; min-width: 0; }

.channel-bar-name {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1rem;
  font-weight: 700;
}

.channel-bar-title {
  font-size: .85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-bar-actions {
  display: flex;
  gap: .5rem;
}

/* Stream info bar (JS-built alternative) */
.stream-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.stream-info-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stream-info-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stream-info-name {
  display: flex;
  align-items: center;
  font-size: 15px;
}

.stream-info-title {
  font-size: 13px;
  color: var(--text-secondary);
}

.stream-info-right {
  display: flex;
  gap: 8px;
}


/* =============================================================================
   17. STREAM TABS
   ============================================================================= */
.stream-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.stream-tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  background: none;
}
.stream-tab:hover { color: var(--text-secondary); }
.stream-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.stream-tab-content { padding: 16px; }


/* =============================================================================
   18. CHAT SIDEBAR
   ============================================================================= */
.chat-panel {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--surface);
  height: 100%;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem .85rem;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
  font-weight: 600;
}

.chat-viewers,
.chat-viewer-count {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 400;
}
.chat-viewer-count i,
.chat-viewers i {
  color: var(--accent);
  font-size: .65rem;
}

/* Mode banners */
.chat-mode-banner {
  text-align: center;
  padding: 6px .75rem;
  font-size: 12px;
  font-weight: 600;
}
.chat-mode-banner.chaos  { background: rgba(255, 69, 0, .15); color: var(--accent); }
.chat-mode-banner.slow   { background: rgba(255, 214, 0, .15); color: var(--warning); }
.chat-mode-banner.sub-only { background: var(--primary-dim); color: var(--primary); }

.chat-mode-chaos      { background: rgba(255, 23, 68, .2); color: var(--error); }
.chat-mode-democracy  { background: rgba(0, 200, 83, .2); color: var(--success); }
.chat-mode-challenge  { background: rgba(255, 214, 0, .2); color: var(--warning); }

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: .5rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.chat-msg {
  padding: .25rem 0;
  font-size: .85rem;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.chat-msg-user,
.chat-username {
  font-weight: 700;
  cursor: pointer;
}
.chat-msg-user:hover,
.chat-username:hover {
  text-decoration: underline;
}

.chat-msg-badge,
.chat-badge {
  font-size: .7rem;
  margin-right: .15rem;
}

.chat-text {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.chat-msg-system {
  color: var(--text-muted);
  font-style: italic;
  font-size: .8rem;
  padding: .35rem .5rem;
  background: var(--elevated);
  border-radius: var(--radius-sm);
  margin: .25rem 0;
}

.chat-system {
  padding: 4px 12px;
  font-size: 12px;
  color: var(--secondary);
  font-style: italic;
}

.chat-msg-event {
  background: linear-gradient(135deg, var(--primary-dim), rgba(0, 240, 255, .08));
  padding: .5rem .65rem;
  border-radius: var(--radius-sm);
  margin: .35rem 0;
  font-size: .8rem;
  border-left: 3px solid var(--primary);
}
.chat-msg-event strong { color: var(--secondary); }

.chat-event {
  padding: 4px 12px;
  font-size: 12px;
  color: var(--warning);
  font-weight: 600;
}

/* Chat input */
.chat-input-area {
  padding: .6rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: .4rem;
  align-items: flex-end;
}

.chat-input-area input,
.chat-input {
  flex: 1;
  padding: .5rem .65rem;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .85rem;
  transition: border-color var(--transition);
}
.chat-input-area input:focus,
.chat-input:focus {
  border-color: var(--primary);
}
.chat-input-area input:disabled { opacity: .5; }

.chat-input-area button,
.chat-send-btn {
  padding: .5rem .7rem;
  background: var(--primary);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: .85rem;
  cursor: pointer;
  transition: background var(--transition);
}
.chat-input-area button:hover,
.chat-send-btn:hover {
  background: var(--primary-hover);
}
.chat-input-area button:disabled { opacity: .5; cursor: not-allowed; }

/* Login prompt */
.chat-login-prompt {
  text-align: center;
  padding: 12px;
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-top: 1px solid var(--border);
}
.chat-login-prompt a { font-weight: 600; }

/* Chat context menu */
.chat-context-menu {
  position: fixed;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  min-width: 140px;
  padding: .3rem 0;
}
.chat-context-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: .4rem .75rem;
  font-size: .8rem;
  color: var(--text-secondary);
  transition: background var(--transition);
}
.chat-context-menu button:hover {
  background: var(--elevated);
  color: var(--text);
}
.chat-context-menu .ctx-danger:hover { color: var(--error); }

/* Chat user menu (mod actions) */
.chat-user-menu {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  min-width: 200px;
}

.chat-user-menu-header {
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}


/* =============================================================================
   19. EVENTS GRID
   ============================================================================= */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .85rem;
}

.event-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
}
.event-card:hover:not(.disabled) {
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(145, 71, 255, .2);
  transform: translateY(-2px);
}
.event-card.disabled {
  opacity: .45;
  cursor: not-allowed;
}

.event-icon  { font-size: 1.8rem; margin-bottom: .5rem; }
.event-name  { font-size: .9rem; font-weight: 600; margin-bottom: .25rem; }
.event-desc  { font-size: .75rem; color: var(--text-muted); margin-bottom: .6rem; }

.event-cost,
.event-card-cost {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .8rem;
  font-weight: 700;
  color: var(--warning);
}

.event-card-icon  { font-size: 1.8rem; margin-bottom: .5rem; }
.event-card-name  { font-size: .9rem; font-weight: 600; margin-bottom: .25rem; }
.event-card-desc  { font-size: .75rem; color: var(--text-muted); margin-bottom: .6rem; }

.event-card-cooldown {
  font-size: .75rem;
  color: var(--accent);
  margin-top: .35rem;
}

.event-card.triggering {
  animation: event-trigger-flash .4s ease;
}

/* Event config rows (dashboard) */
.event-config-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border);
}
.event-config-row:last-child { border-bottom: none; }

.event-config-name {
  flex: 1;
  font-size: .9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.event-config-cost {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .85rem;
}
.event-config-cost input {
  width: 70px;
  padding: .3rem .5rem;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: .85rem;
  color: var(--text);
}


/* =============================================================================
   20. POLLS
   ============================================================================= */
.poll-container {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.25rem;
}

.poll-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .5rem;
}

.poll-question {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: .5rem;
}

.poll-timer {
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .35rem;
  font-variant-numeric: tabular-nums;
}
.poll-timer.ending {
  color: var(--accent);
  animation: timer-pulse 1s ease-in-out infinite;
}

.poll-option {
  position: relative;
  padding: .6rem .85rem;
  margin-bottom: .5rem;
  background: var(--elevated);
  border-radius: var(--radius-sm);
  cursor: pointer;
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color var(--transition);
}
.poll-option:hover:not(.voted):not(.disabled) { border-color: var(--primary); }
.poll-option.selected { border-color: var(--primary); }

.poll-option-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 100%;
  background: var(--primary-dim);
  border-radius: var(--radius-sm);
  transform-origin: left;
  transition: transform .6s ease;
}

.poll-option-content {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1;
}

.poll-option-text { font-size: .9rem; font-weight: 500; }
.poll-option-pct  { font-size: .85rem; font-weight: 700; color: var(--primary); }
.poll-option-votes { font-size: .75rem; color: var(--text-muted); margin-left: .5rem; }

.poll-total {
  text-align: center;
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .75rem;
}

/* Poll creation (dashboard) */
.poll-options-list { margin-bottom: .75rem; }
.poll-option-input {
  display: flex;
  gap: .4rem;
  margin-bottom: .4rem;
  align-items: center;
}
.poll-option-input input { flex: 1; }
.poll-option-input .btn-icon { color: var(--error); }


/* =============================================================================
   21. AUTH PAGES
   ============================================================================= */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--nav-h));
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}

.auth-card h1,
.auth-card h2 {
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: .35rem;
}

.auth-card .auth-sub {
  text-align: center;
  font-size: .9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.auth-error {
  background: rgba(255, 23, 68, .1);
  border: 1px solid rgba(255, 23, 68, .3);
  color: var(--error);
  padding: .6rem .85rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  margin-bottom: 1rem;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.25rem 0;
  color: var(--text-muted);
  font-size: .8rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-footer {
  text-align: center;
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: 1.25rem;
}
.auth-footer a { font-weight: 600; }

.auth-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-muted);
}


/* =============================================================================
   22. DASHBOARD PAGE
   ============================================================================= */
.dashboard {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem;
}
.dashboard h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
}

.dashboard-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* Stat grids */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.dash-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.dash-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.dash-stat-label {
  font-size: .75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.dash-stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  margin-top: .25rem;
}
.dash-stat-value.live { color: var(--accent); }

/* Dashboard sections & cards */
.dash-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.dash-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--border);
}

.dash-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.dash-card h3 {
  font-size: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: .75rem;
}
.dash-row label {
  min-width: 120px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.dash-row .form-input { flex: 1; }

/* Stream Key */
.stream-key-display {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--elevated);
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  font-family: 'Courier New', monospace;
  font-size: .85rem;
}
.stream-key-value { flex: 1; word-break: break-all; }
.stream-key-display .btn-icon { flex-shrink: 0; }


/* =============================================================================
   23. PROFILE PAGE
   ============================================================================= */
.profile-page {
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.profile-page h1,
.profile-page h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.profile-header h3 { margin: 0; }

.profile-avatar-section {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.profile-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 2rem;
  color: #fff;
}

.profile-points {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-bottom: 1.5rem;
}
.profile-points i { color: var(--warning); }
.profile-points-value {
  font-weight: 800;
  font-size: 1.25rem;
}
.profile-points-label {
  font-size: .8rem;
  color: var(--text-muted);
}


/* =============================================================================
   24. ADMIN PANEL
   ============================================================================= */
.admin-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}
.admin-page h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.admin-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.admin-stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
}
.admin-stat-label {
  font-size: .75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.admin-table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.admin-table th {
  text-align: left;
  padding: .65rem .85rem;
  background: var(--elevated);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.admin-table td {
  padding: .55rem .85rem;
  border-top: 1px solid var(--border);
}
.admin-table tr:hover td {
  background: rgba(255, 255, 255, .02);
}


/* =============================================================================
   25. BROWSE PAGE
   ============================================================================= */
.browse-page { padding: 1.5rem; }
.browse-page h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  padding: 0 .5rem;
}

.home-page {
  padding: 0;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
  padding: 0 .5rem;
}

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

.category-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
}
.category-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(145, 71, 255, .15);
}
.category-card i { font-size: 2rem; }

.category-icon { font-size: 2rem; margin-bottom: .6rem; }
.category-name { font-size: .9rem; font-weight: 600; }
.category-count {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .2rem;
}


/* =============================================================================
   26. ABOUT SECTION (stream tab)
   ============================================================================= */
.about-section { padding: 20px; }
.about-section h3 { margin-bottom: 8px; }
.about-section p { color: var(--text-secondary); margin-bottom: 16px; }
.about-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 14px;
}


/* =============================================================================
   27. MODALS
   ============================================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, .65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.hidden { display: none; }

.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: .75rem;
  right: .75rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition);
}
.modal-close:hover {
  background: var(--elevated);
  color: var(--text);
}

.modal-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
}


/* =============================================================================
   28. TOAST NOTIFICATIONS
   ============================================================================= */
.toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  z-index: 3000;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .65rem 1rem;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: .85rem;
  pointer-events: auto;
  min-width: 250px;
  max-width: 380px;
  animation: toast-in .3s ease;
}
.toast.removing,
.toast.toast-out {
  animation: toast-out .3s ease forwards;
}

.toast-icon { font-size: 1rem; flex-shrink: 0; }
.toast-success .toast-icon,
.toast-success i { color: var(--success); }
.toast-error .toast-icon,
.toast-error i { color: var(--error); }
.toast-info .toast-icon,
.toast-info i { color: var(--secondary); }
.toast-warning .toast-icon,
.toast-warning i { color: var(--warning); }
.toast-msg { flex: 1; }


/* =============================================================================
   29. VISUAL EFFECTS (Player FX)
   ============================================================================= */
.fx-shake {
  animation: fx-shake-kf .4s ease infinite;
}

.fx-grayscale {
  filter: grayscale(1);
  transition: filter .5s;
}
.fx-grayscale video { filter: grayscale(1); }

.fx-invert {
  filter: invert(1);
  transition: filter .5s;
}
.fx-invert video { filter: invert(1); }

.fx-highlight-border {
  box-shadow: 0 0 20px var(--secondary), 0 0 40px rgba(0, 240, 255, .3), inset 0 0 20px rgba(0, 240, 255, .1) !important;
  transition: box-shadow .3s;
}

/* Event overlay */
.event-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  animation: fadeIn .3s;
}

.event-overlay-content {
  text-align: center;
  color: #fff;
}
.event-overlay-content i {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
}
.event-overlay-content h3 { font-size: 20px; }

/* Penalty overlay variant */
.penalty-overlay {
  background: rgba(255, 23, 68, .3);
}


/* =============================================================================
   30. SKELETON LOADING
   ============================================================================= */
.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, var(--elevated) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: .85rem;
  margin-bottom: .35rem;
  width: 80%;
}
.skeleton-text.short { width: 40%; }

.skeleton-rect {
  height: 160px;
  width: 100%;
}

.skeleton-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.skeleton-card {
  border-radius: var(--radius);
  height: 200px;
}


/* =============================================================================
   31. STREAMER DOCS PAGE
   ============================================================================= */
.docs-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.docs-page h1 {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: .5rem;
  background: linear-gradient(135deg, #fff 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.docs-page h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}

.docs-page h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: .75rem;
  color: var(--primary);
}

.docs-page p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.7;
}

.docs-page ul,
.docs-page ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
  color: var(--text-secondary);
}
.docs-page li {
  margin-bottom: .5rem;
  line-height: 1.6;
  list-style: disc;
}
.docs-page ol li { list-style: decimal; }

/* Code blocks */
.docs-page pre,
.code-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  font-family: 'Courier New', Consolas, 'Fira Code', monospace;
  font-size: .85rem;
  line-height: 1.6;
  color: var(--text);
}

.docs-page code {
  font-family: 'Courier New', Consolas, monospace;
  background: var(--elevated);
  padding: .15em .4em;
  border-radius: var(--radius-sm);
  font-size: .875em;
  color: var(--secondary);
}
.docs-page pre code {
  background: none;
  padding: 0;
  color: var(--text);
}

/* Steps */
.doc-step {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.doc-step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .85rem;
  flex-shrink: 0;
}

.doc-step-content { flex: 1; }
.doc-step-content h4 {
  font-weight: 600;
  margin-bottom: .25rem;
}
.doc-step-content p {
  font-size: .9rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Tips / callouts */
.doc-tip {
  background: var(--primary-dim);
  border: 1px solid rgba(145, 71, 255, .3);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: .9rem;
  color: var(--text);
}
.doc-tip strong {
  color: var(--primary);
}

.doc-warning {
  background: rgba(255, 214, 0, .1);
  border: 1px solid rgba(255, 214, 0, .3);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: .9rem;
}
.doc-warning strong {
  color: var(--warning);
}


/* =============================================================================
   32. UTILITY CLASSES
   ============================================================================= */
.hidden { display: none !important; }

.text-center  { text-align: center; }
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-error   { color: var(--error); }
.text-primary { color: var(--primary); }
.text-warning { color: var(--warning); }

.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.p-2  { padding: .5rem; }
.p-4  { padding: 1rem; }

.w-full { width: 100%; }

.flex            { display: flex; }
.flex-col        { flex-direction: column; }
.items-center    { align-items: center; }
.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .25rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }
.flex-1    { flex: 1; }


/* =============================================================================
   33. KEYFRAME ANIMATIONS
   ============================================================================= */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse-glow {
  0%, 100% { opacity: .6; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.08); }
}

@keyframes badge-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .7; }
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .5; transform: scale(.8); }
}

@keyframes timer-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .5; }
}

@keyframes event-trigger-flash {
  0%, 100% { border-color: var(--border); }
  50%      { border-color: var(--secondary); box-shadow: 0 0 25px rgba(0, 240, 255, .3); }
}

@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}

@keyframes fx-shake-kf {
  0%, 100% { transform: translateX(0); }
  10%  { transform: translateX(-8px) rotate(-.5deg); }
  30%  { transform: translateX(6px) rotate(.5deg); }
  50%  { transform: translateX(-5px); }
  70%  { transform: translateX(4px); }
  90%  { transform: translateX(-2px); }
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}


/* =============================================================================
   34. RESPONSIVE — 1024px (tablet landscape)
   ============================================================================= */
@media (max-width: 1024px) {
  .stream-page {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .stream-sidebar {
    width: 100%;
    min-width: 0;
    height: 400px;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .chat-panel {
    border-left: none;
    border-top: 1px solid var(--border);
    height: 450px;
  }

  .stream-main { overflow: visible; }
}


/* =============================================================================
   35. RESPONSIVE — 768px (tablet portrait)
   ============================================================================= */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.6rem; }
  .hero { padding: 2rem 1rem; }

  .channels-grid {
    grid-template-columns: 1fr;
    padding: 0 .75rem;
  }
  .channel-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
  .section-header { padding: 0 .75rem; }

  .nav-search   { display: none; }
  .nav-links    { display: none; }
  .nav-username { display: none; }
  .navbar       { padding: 0 .75rem; }

  .dashboard,
  .dashboard-page,
  .profile-page,
  .admin-page { padding: 1rem; }

  .dash-stats { grid-template-columns: repeat(2, 1fr); }
  .events-grid { grid-template-columns: repeat(2, 1fr); }
  .categories-grid { grid-template-columns: repeat(2, 1fr); }
  .category-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }

  .chat-panel { height: 350px; }
  .stream-tabs { overflow-x: auto; }

  .channel-bar { flex-wrap: wrap; }
  .channel-bar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .stream-info-bar { flex-wrap: wrap; gap: 8px; }
  .stream-info-right { width: 100%; justify-content: flex-end; }
}


/* =============================================================================
   36. RESPONSIVE — 480px (mobile)
   ============================================================================= */
@media (max-width: 480px) {
  .dash-stats,
  .dash-stat-grid { grid-template-columns: 1fr; }
  .events-grid { grid-template-columns: 1fr; }
  .categories-grid,
  .category-grid { grid-template-columns: 1fr; }

  .auth-card { padding: 1.25rem; }
  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .stream-sidebar { height: 300px; }
  .chat-panel { height: 300px; }

  .toast-container {
    left: 1rem;
    right: 1rem;
  }
  .toast {
    min-width: auto;
    max-width: none;
  }
}
