@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --pink: #ff00aa;
  --cyan: #00f0ff;
  --dark: #09090b;
  --dark-card: #18181b;
  --dark-hover: #27272a;
  --border: #3f3f46;
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f97316;
  --purple: #a855f7;
  --gold: #eab308;
  --gradient: linear-gradient(135deg, var(--pink), var(--cyan));
  --sidebar-w: 240px;
  --topbar-h: 56px;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--dark);
  color: var(--text);
  overflow-x: hidden;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
ul { list-style: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #52525b; }

/* Layout */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  min-height: 100vh;
}

.app-layout.sidebar-collapsed {
  grid-template-columns: 56px 1fr;
}

/* Topbar */
.topbar {
  grid-column: 1 / -1;
  background: #0c0c0e;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  z-index: 100;
  position: sticky;
  top: 0;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  font-size: 18px;
  white-space: nowrap;
}

.topbar-logo img {
  height: 32px;
  width: 32px;
  border-radius: 8px;
  object-fit: cover;
}

.topbar-logo span {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.topbar-search {
  flex: 1;
  max-width: 420px;
  margin: 0 auto;
  position: relative;
}

.topbar-search input {
  width: 100%;
  background: var(--dark-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px 8px 40px;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.topbar-search input:focus {
  border-color: var(--cyan);
}

.topbar-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-btn {
  background: var(--dark-card);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s;
}

.topbar-btn:hover {
  background: var(--dark-hover);
  border-color: var(--cyan);
}

.btn-primary {
  background: var(--gradient);
  color: #000;
  font-weight: 700;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  transition: transform 0.2s, opacity 0.2s;
  border: none;
}

.btn-primary:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.btn-secondary {
  background: var(--dark-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--dark-hover);
  border-color: var(--pink);
}

/* Sidebar */
.sidebar {
  background: #0c0c0e;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px 0;
}

.sidebar-section {
  padding: 0 12px;
  margin-bottom: 16px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 8px 8px 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
  color: var(--text-muted);
}

.sidebar-link:hover, .sidebar-link.active {
  background: var(--dark-hover);
  color: var(--text);
}

.sidebar-link i {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.sidebar-link.active i {
  color: var(--pink);
}

.sidebar-channel {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
  transition: background 0.15s;
}

.sidebar-channel:hover {
  background: var(--dark-hover);
}

.sidebar-channel-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--dark-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}

.sidebar-channel-avatar.live {
  border: 2px solid var(--red);
}

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

.sidebar-channel-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-channel-game {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-channel-viewers {
  font-size: 11px;
  color: var(--red);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.sidebar-channel-viewers::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--red);
  border-radius: 50%;
}

/* Main Content */
.main-content {
  overflow-y: auto;
  height: calc(100vh - var(--topbar-h));
  padding: 20px;
}

/* Stream Cards */
.streams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.stream-card {
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s;
  cursor: pointer;
}

.stream-card:hover {
  transform: translateY(-4px);
}

.stream-card-thumbnail {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--dark-card);
  overflow: hidden;
}

.stream-card-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stream-card-live {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--red);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.stream-card-viewers {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0,0,0,0.8);
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.stream-card-chaos {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--gradient);
  color: #000;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

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

.stream-card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--dark-hover);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

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

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

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

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

.stream-card-tags {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.tag {
  background: var(--dark-hover);
  color: var(--text-muted);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.tag-chaos {
  background: rgba(255,0,170,0.2);
  color: var(--pink);
}

/* Section Headers */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 20px;
  font-weight: 800;
}

.section-link {
  font-size: 14px;
  color: var(--purple);
  font-weight: 600;
}

.section-link:hover {
  text-decoration: underline;
}

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

.category-card {
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s;
  cursor: pointer;
}

.category-card:hover {
  transform: translateY(-2px);
}

.category-card-image {
  aspect-ratio: 3/4;
  background: var(--dark-card);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.category-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.category-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 50%, rgba(0,0,0,0.8));
  display: flex;
  align-items: flex-end;
  padding: 8px;
}

.category-card-name {
  font-weight: 700;
  font-size: 13px;
  margin-top: 8px;
}

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

/* Featured Banner */
.featured-banner {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 24px;
  aspect-ratio: 21/7;
  background: linear-gradient(135deg, #1a0020, #001a20);
}

.featured-banner-content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 40px;
  background: linear-gradient(90deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.3) 60%, transparent);
}

.featured-banner-text {
  max-width: 500px;
}

.featured-banner-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--red);
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 4px;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.featured-banner-live::before {
  content: '';
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.featured-banner-title {
  font-size: 28px;
  font-weight: 900;
  margin-bottom: 8px;
  line-height: 1.1;
}

.featured-banner-meta {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Chat Panel (stream viewer) */
.stream-page {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 0;
  height: calc(100vh - var(--topbar-h));
}

.stream-video-section {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.stream-player {
  aspect-ratio: 16/9;
  background: #000;
  position: relative;
  flex-shrink: 0;
}

.stream-player-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f0015, #001520);
}

.stream-player-placeholder i {
  font-size: 64px;
  color: var(--pink);
  opacity: 0.5;
}

.stream-info-bar {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.stream-info-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--dark-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  border: 2px solid var(--pink);
  flex-shrink: 0;
}

.stream-info-details {
  flex: 1;
}

.stream-info-title {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 2px;
}

.stream-info-streamer {
  font-size: 14px;
  font-weight: 600;
  color: var(--pink);
}

.stream-info-meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.stream-info-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Chat */
.chat-panel {
  background: #0c0c0e;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

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

.chat-header-title {
  font-weight: 700;
  font-size: 14px;
}

.chat-header-count {
  font-size: 12px;
  color: var(--text-muted);
}

.chat-header-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
}

.chat-tab {
  flex: 1;
  padding: 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.chat-tab.active {
  color: var(--text);
  border-bottom-color: var(--pink);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
}

.chat-msg {
  padding: 4px 0;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}

.chat-msg-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-right: 4px;
}

.chat-msg-badge img {
  width: 16px;
  height: 16px;
}

.chat-msg-name {
  font-weight: 700;
  cursor: pointer;
}

.chat-msg-name:hover {
  text-decoration: underline;
}

.chat-msg-text {
  color: #e4e4e7;
}

.chat-msg-system {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 8px 0;
  font-size: 12px;
}

.chat-msg-gift {
  background: linear-gradient(135deg, rgba(255,0,170,0.1), rgba(0,240,255,0.1));
  border: 1px solid rgba(255,0,170,0.3);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 4px 0;
}

.chat-input-area {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.chat-input-wrapper {
  display: flex;
  gap: 8px;
}

.chat-input {
  flex: 1;
  background: var(--dark-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}

.chat-input:focus {
  border-color: var(--cyan);
}

.chat-send-btn {
  background: var(--gradient);
  color: #000;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
}

.chat-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.chat-action-btn {
  background: none;
  color: var(--text-muted);
  font-size: 16px;
  padding: 4px;
  transition: color 0.15s;
}

.chat-action-btn:hover {
  color: var(--text);
}

/* Dashboard */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--dark-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.stat-card-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 4px;
}

.stat-card-value {
  font-size: 28px;
  font-weight: 800;
}

.stat-card-change {
  font-size: 13px;
  font-weight: 600;
  margin-top: 4px;
}

.stat-card-change.positive {
  color: var(--green);
}

.stat-card-change.negative {
  color: var(--red);
}

/* Revenue Card */
.revenue-highlight {
  background: linear-gradient(135deg, rgba(255,0,170,0.15), rgba(0,240,255,0.15));
  border: 1px solid rgba(255,0,170,0.4);
}

.revenue-split-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 12px;
}

.revenue-split-streamer {
  background: var(--gradient);
  flex: 97;
}

.revenue-split-platform {
  background: var(--border);
  flex: 3;
}

.revenue-split-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.data-table tr:hover td {
  background: var(--dark-hover);
}

/* Forms & Settings */
.settings-section {
  background: var(--dark-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
}

.settings-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: var(--dark);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--cyan);
}

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

/* Notifications / Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--dark-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 14px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
  max-width: 360px;
}

.toast-success { border-color: var(--green); }
.toast-error { border-color: var(--red); }

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

/* Chaos Mode Overlay */
.chaos-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.chaos-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.chaos-panel {
  background: var(--dark-card);
  border: 2px solid var(--pink);
  border-radius: 16px;
  padding: 32px;
  width: 90%;
  max-width: 600px;
  text-align: center;
}

.chaos-panel h2 {
  font-size: 24px;
  font-weight: 900;
  margin-bottom: 8px;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Prediction Market */
.prediction-card {
  background: var(--dark-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.prediction-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 12px;
}

.prediction-options {
  display: flex;
  gap: 8px;
}

.prediction-option {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s;
}

.prediction-option-yes {
  background: rgba(34,197,94,0.15);
  border: 1px solid var(--green);
  color: var(--green);
}

.prediction-option-no {
  background: rgba(239,68,68,0.15);
  border: 1px solid var(--red);
  color: var(--red);
}

.prediction-option:hover {
  transform: scale(1.02);
}

.prediction-pool {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Gift/Sub animations */
.gift-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 600;
  text-align: center;
  animation: giftBounce 2s ease-out forwards;
  pointer-events: none;
}

@keyframes giftBounce {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  40% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { transform: translate(-50%, -100%) scale(0.8); opacity: 0; }
}

.gift-popup-amount {
  font-size: 48px;
  font-weight: 900;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Responsive */
@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

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

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

  .streams-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }

  .featured-banner {
    aspect-ratio: 16/9;
  }

  .featured-banner-title {
    font-size: 20px;
  }
}

/* Clips gallery */
.clips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.clip-card {
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
}

.clip-card:hover {
  transform: translateY(-2px);
}

.clip-thumbnail {
  aspect-ratio: 16/9;
  background: var(--dark-card);
  position: relative;
}

.clip-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.8);
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Emote Picker */
.emote-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--dark-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  max-height: 300px;
  overflow-y: auto;
  display: none;
}

.emote-picker.active {
  display: block;
}

.emote-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}

.emote-item {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  font-size: 20px;
  transition: background 0.15s;
}

.emote-item:hover {
  background: var(--dark-hover);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  background: none;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--pink);
}

.tab:hover {
  color: var(--text);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.badge-live {
  background: var(--red);
  color: white;
}

.badge-partner {
  background: var(--purple);
  color: white;
}

.badge-chaos {
  background: var(--gradient);
  color: #000;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--dark-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
}

.modal-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 16px;
}

/* Subscribe button special */
.subscribe-btn {
  background: var(--gradient);
  color: #000;
  font-weight: 800;
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.2s;
}

.subscribe-btn:hover {
  transform: scale(1.05);
}

/* Predictions Panel (Chat Tab) */
.predictions-panel {
  flex: 1;
  overflow-y: auto;
  display: block;
}

.predictions-panel-inner {
  padding: 8px 12px;
}

.pred-section {
  margin-bottom: 16px;
}

.pred-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.pred-section-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}

/* Hot prediction mini cards */
.pred-mini-card {
  background: var(--dark-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  transition: border-color 0.2s;
}

.pred-mini-card:hover {
  border-color: var(--pink);
}

.pred-mini-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.pred-mini-cat {
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.pred-mini-time {
  font-size: 11px;
  color: var(--orange);
  font-weight: 600;
}

.pred-mini-question {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.3;
}

.pred-mini-bar {
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
  display: flex;
  margin-bottom: 8px;
  background: var(--red);
}

.pred-mini-bar-fill.pred-mini-bar-yes {
  background: var(--green);
  transition: width 0.3s;
}

.pred-mini-options {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.pred-mini-btn {
  flex: 1;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.pred-mini-btn-yes {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid var(--green);
  color: var(--green);
}

.pred-mini-btn-yes:hover {
  background: rgba(34, 197, 94, 0.25);
}

.pred-mini-btn-no {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid var(--red);
  color: var(--red);
}

.pred-mini-btn-no:hover {
  background: rgba(239, 68, 68, 0.25);
}

.pred-mini-odds {
  font-size: 11px;
  opacity: 0.7;
}

.pred-mini-stats {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
}

/* Prediction category chips */
.pred-cat-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pred-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 600;
  background: color-mix(in srgb, var(--cat-color) 12%, var(--dark-card));
  border: 1px solid color-mix(in srgb, var(--cat-color) 30%, transparent);
  color: var(--cat-color);
  cursor: pointer;
  transition: all 0.2s;
}

.pred-cat-chip:hover {
  background: color-mix(in srgb, var(--cat-color) 25%, var(--dark-card));
  border-color: var(--cat-color);
}

.pred-cat-count {
  background: color-mix(in srgb, var(--cat-color) 25%, transparent);
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
}

/* Prediction category rows */
.pred-cat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  color: var(--text);
  margin-bottom: 4px;
}

.pred-cat-row:hover {
  background: var(--dark-hover);
}

.pred-cat-row-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.pred-cat-row-info {
  flex: 1;
  min-width: 0;
}

.pred-cat-row-name {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pred-cat-row-desc {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pred-cat-row-stats {
  text-align: right;
  flex-shrink: 0;
}

.pred-cat-row-active {
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
}

.pred-cat-row-pool {
  font-size: 11px;
  color: var(--text-muted);
}

/* Trending predictions on homepage */
.trending-predictions-banner {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), rgba(0, 240, 255, 0.1));
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 32px;
}

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

.trending-pred-card {
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.2s;
  cursor: pointer;
}

.trending-pred-card:hover {
  border-color: var(--pink);
  transform: translateY(-2px);
}

.trending-pred-card-cat {
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}

.trending-pred-card-question {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
  line-height: 1.3;
}

.trending-pred-card-bar {
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  margin-bottom: 10px;
}

.trending-pred-card-options {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.trending-pred-card-options button {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.trending-pred-card-options .opt-yes {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid var(--green);
  color: var(--green);
}

.trending-pred-card-options .opt-yes:hover {
  background: rgba(34, 197, 94, 0.25);
}

.trending-pred-card-options .opt-no {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--red);
  color: var(--red);
}

.trending-pred-card-options .opt-no:hover {
  background: rgba(239, 68, 68, 0.25);
}

.trending-pred-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.hot-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  background: var(--red);
  color: white;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

/* Viewer takeover panel */
.takeover-panel {
  background: linear-gradient(135deg, rgba(255,0,170,0.1), rgba(0,240,255,0.1));
  border: 1px solid var(--pink);
  border-radius: 12px;
  padding: 16px;
  margin: 8px 0;
}

.takeover-title {
  font-weight: 800;
  font-size: 14px;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.takeover-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.takeover-btn {
  background: var(--dark);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  transition: all 0.2s;
}

.takeover-btn:hover {
  border-color: var(--cyan);
  background: var(--dark-hover);
}

.takeover-btn i {
  display: block;
  font-size: 18px;
  margin-bottom: 4px;
}

/* ==================== */
/* Accessibility Styles */
/* ==================== */

/* Screen-reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip navigation link */
.skip-nav {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 9999;
  background: var(--gradient);
  color: #000;
  padding: 12px 24px;
  border-radius: 0 0 12px 12px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transition: top 0.2s;
}

.skip-nav:focus {
  top: 0;
}

/* Focus-visible styles for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.sidebar-link:focus-visible,
.sidebar-channel:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: -2px;
  border-radius: 8px;
}

.topbar-btn:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.stream-card:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
  border-radius: 12px;
}

.category-card:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
}

.btn-primary:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.tab:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: -2px;
}

.modal:focus-visible {
  outline: none;
}

/* Auth container and profile avatar */
.auth-container {
  display: flex;
  align-items: center;
}

.auth-btn {
  background: var(--dark-card);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s;
  cursor: pointer;
}

.auth-btn:hover {
  background: var(--dark-hover);
  border-color: var(--cyan);
}

.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff00aa, #00f0ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  border: none;
  color: var(--text);
}

/* Search results dropdown */
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--dark-card);
  border: 1px solid var(--border);
  border-radius: 0 0 12px 12px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.search-results[hidden] {
  display: none;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  color: var(--text);
}

.search-result-item:hover,
.search-result-item:focus,
.search-result-item[aria-selected="true"] {
  background: var(--dark-hover);
}

.search-result-item .search-result-type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.search-result-item .search-result-name {
  font-weight: 600;
  font-size: 14px;
}

.search-result-item .search-result-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.search-no-results {
  padding: 20px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .stream-card:hover,
  .category-card:hover,
  .trending-pred-card:hover {
    transform: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --border: #71717a;
    --text-muted: #d4d4d8;
  }

  .stream-card-live,
  .badge-live {
    background: #dc2626;
  }
}

/* Custom Signup Form */
.signup-form-scroll {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}

.signup-form-scroll::-webkit-scrollbar {
  width: 4px;
}

.signup-form-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.signup-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

@media (max-width: 480px) {
  .signup-form-grid {
    grid-template-columns: 1fr;
  }
}

.signup-error {
  color: var(--red);
  font-size: 13px;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Wider modal for signup */
.modal-overlay.active .modal {
  position: relative;
}
