/* ===========================
   FUTBOL TV — style.css
   =========================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #060d1a; 
  --surface:    #0d1829;  
  --surface2:   #142236; 
  --border:     #1e3a5f30; 
  --accent:     #00b4d8;
  --accent-dim: #00b4d820;
  --red:        #ff3d57;
  --purple:     #9147ff;
  --text:       #e8eaf0;
  --muted:      #6b7280;
  --radius:     10px;
  --font-head:  'Bebas Neue', sans-serif;
  --font-body:  'DM Sans', sans-serif;
  --transition: 0.18s ease;
  --chat-width: 320px;
  --header-h:   60px;
}
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- SVG ICONS ---- */
.logo-icon svg,
.tab-icon svg,
.search-icon svg,
.chat-title svg,
.chat-close-btn svg,
.modal-close svg,
.chat-toggle-btn svg {
  width: 18px; height: 18px; display: block;
}
.logo-icon svg { width: 22px; height: 22px; color: var(--accent); }
.tab-icon svg  { width: 15px; height: 15px; }

/* ===========================
   HEADER
   =========================== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: #0a0c10ee;
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  height: 100%;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

/* ---- LOGO ---- */
/* El div.logo contiene el <a> con dos <img>.
   Corregimos el conflicto: el <img class="logo"> dentro del <a>
   no debe heredar los estilos del div.logo */
div.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  /* sin width fijo — se adapta al contenido */
}

div.logo a {
  display: flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: inherit;
}

/* img con class="logo" (el escudo pequeño) */
div.logo a img.logo {
  height: 32px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(114,214,255,0.4));
}

/* img con class="logo2" (el texto/logo principal) */
div.logo a img.logo2 {
  height: 28px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(114,214,255,0.55));
  position: relative;
  top: -2px;
}

/* ---- TABS NAV ---- */
.tabs {
  display: flex;
  gap: 2px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}
.tab:hover  { color: var(--text); background: var(--surface2); }
.tab.active { color: var(--accent); }

/* ---- HEADER ACTIONS ---- */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--purple);
  animation: pulse 1.4s infinite;
}

.chat-toggle-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  width: 34px; height: 34px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.chat-toggle-btn:hover,
.chat-toggle-btn.active {
  color: var(--purple);
  border-color: var(--purple);
  background: #9147ff18;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(.8); }
}

/* ===========================
   LAYOUT
   =========================== */
.layout {
  display: flex;
  height: calc(100vh - var(--header-h));
  overflow: hidden;
}

/* ===========================
   MAIN
   =========================== */
.main {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 5px 5px 5px;
  background: #060d1a;
}

#tab-stream.active {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  margin: 0;
}

.stream-active .main { padding: 0; overflow: hidden; }

/* ===========================
   SECTION HEADER
   =========================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px;
}

.section-header h2 {
  font-family: var(--font-head);
  font-size: 28px;
  letter-spacing: 1px;
}

.filter-group { display: flex; gap: 6px; }

.filter-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 5px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition);
}
.filter-btn:hover { color: var(--text); border-color: #ffffff25; }
.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ---- SEARCH ---- */
.search-wrap { position: relative; display: flex; align-items: center; }
.search-icon {
  position: absolute;
  left: 10px;
  color: var(--muted);
  pointer-events: none;
  display: flex;
}
.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 8px 14px 8px 36px;
  border-radius: 8px;
  width: 200px;
  outline: none;
  transition: var(--transition);
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--muted); }

/* ===========================
   TAB CONTENT
   =========================== */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===========================
   EVENT GRID & CARDS
   =========================== */
.event-grid { display: flex; flex-direction: column; gap: 8px; }

.event-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: var(--transition);
  animation: fadeIn .25s ease;
}
.event-card:hover {
  border-color: var(--accent);
  background: var(--surface2);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px #00e67615;
}

.event-time { text-align: center; }

.event-competition-logo {
  width: 28px; height: 28px;
  object-fit: contain;
  border-radius: 4px;
  margin-top: 5px;
  opacity: 0.85;
  transition: opacity var(--transition);
}
.event-card:hover .event-competition-logo { opacity: 1; }

.event-competition-logo-placeholder { width: 28px; height: 28px; margin-top: 5px; }

.event-time .time { font-family: var(--font-head); font-size: 22px; line-height: 1; }
.event-time .date { font-size: 11px; color: var(--muted); margin-top: 2px; text-transform: capitalize; }

.event-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  margin-bottom: 6px;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.badge-live     { background: var(--red);       color: #fff; }
.badge-soon     { background: var(--accent-dim); color: var(--accent); }
.badge-finished { background: #ffffff10;         color: var(--muted); }

.badge-live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #fff;
  animation: pulse 1.4s infinite;
  display: inline-block;
}

.event-title { font-size: 15px; font-weight: 600; line-height: 1.3; }
.event-meta  { font-size: 12px; color: var(--muted); margin-top: 3px; }

.event-channels {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.channel-pill {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}
.channel-pill:hover {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

/* ===========================
   CHANNELS GRID
   =========================== */
.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.channel-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: var(--transition);
  animation: fadeIn .25s ease;
}
.channel-card:hover {
  background: var(--surface2);
  box-shadow: 0 4px 20px #00e67615;
}

.channel-logo {
  width: 90px; height: 90px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid transparent;
  pointer-events: none;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.channel-name { font-size: 13px; font-weight: 500; text-align: center; color: var(--muted); transition: var(--transition); }
.channel-card:hover .channel-name { color: var(--text); }

/* ===========================
   SKELETON
   =========================== */
.skeleton-group { display: flex; flex-direction: column; gap: 8px; }

.skeleton {
  height: 80px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

.channels-grid .skeleton-group {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.channels-grid .skeleton { height: 110px; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===========================
   CHAT SIDEBAR
   =========================== */
.chat-sidebar {
  width: var(--chat-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--surface);
  transition: width var(--transition), opacity var(--transition);
  overflow: hidden;
  height: 100%;
}
.chat-sidebar.hidden {
  width: 0;
  opacity: 0;
  border-left: none;
  pointer-events: none;
}

.stream-active .layout { overflow: hidden; }

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--purple);
  letter-spacing: .3px;
}
.chat-title svg { color: var(--purple); }

.chat-close-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
}
.chat-close-btn:hover { color: var(--text); background: var(--surface2); }

.twitch-chat-frame { flex: 1; width: 100%; border: none; display: block; }

/* ===========================
   MODAL
   =========================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: #000000cc;
  backdrop-filter: blur(6px);
}

.modal-box {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 860px;
  overflow: hidden;
  animation: scaleIn .2s ease;
}

@keyframes scaleIn {
  from { transform: scale(.95); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title    { font-family: var(--font-head); font-size: 22px; letter-spacing: .5px; }
.modal-subtitle { font-size: 13px; color: var(--muted); margin-top: 2px; }

.modal-close {
  background: var(--surface2);
  border: none;
  color: var(--muted);
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.modal-close:hover { background: var(--red); color: #fff; }

.player-wrap { padding: 16px; }

.stream-select-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

.stream-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}
.stream-btn:hover { color: var(--text); }
.stream-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.stream-group-label {
  display: flex;
  align-items: center;
  width: 100%;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 0 2px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.stream-group-label:first-child { border-top: none; margin-top: 0; padding-top: 0; }

.channel-logo-placeholder {
  width: 60px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  opacity: .4;
}

.player-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}
.player-container iframe { width: 100%; height: 100%; border: none; }

/* ===========================
   DEBUG / TOAST
   =========================== */
.debug-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #1a0a0a;
  border-top: 1px solid var(--red);
  color: #ff8a8a;
  font-family: monospace;
  font-size: 12px;
  padding: 8px 16px;
  z-index: 400;
  white-space: pre-wrap;
  word-break: break-all;
}
.debug-bar.hidden { display: none; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 300;
  animation: fadeIn .2s ease;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.hidden { display: none; }

/* ===========================
   EMPTY STATE / DIVIDERS
   =========================== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .icon { width: 40px; height: 40px; margin: 0 auto 12px; opacity: .4; }
.empty-state p { font-size: 15px; }

.date-divider {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  margin-top: 14px;
}
.date-divider:first-child { margin-top: 0; }

/* ===========================
   ANIMATIONS
   =========================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===========================
   STREAM TAB
   =========================== */
.stream-tab { height: 100%; padding: 0 !important; overflow: hidden; }
.stream-layout { height: 100%; display: flex; flex-direction: column; }

.stream-player-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  padding: 12px 16px 16px;
  gap: 10px;
  min-height: 0;
}

.stream-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.stream-info-title {
  font-family: var(--font-head);
  font-size: 18px;
  letter-spacing: .5px;
  color: var(--text);
}

.stream-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stream-selector-wrap { position: relative; }

.stream-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
  min-width: 160px;
  white-space: nowrap;
}
.stream-selector:hover,
.stream-selector.open { border-color: var(--accent); background: var(--accent-dim); }

.stream-selector-icon svg  { width: 14px; height: 14px; color: var(--accent); }
.stream-selector-arrow svg { width: 14px; height: 14px; color: var(--muted); margin-left: auto; transition: transform var(--transition); }
.stream-selector.open .stream-selector-arrow svg { transform: rotate(180deg); }

.stream-selector-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.stream-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  max-width: 320px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  z-index: 50;
  overflow: hidden;
  box-shadow: 0 8px 32px #00000060;
  display: none;
}
.stream-dropdown.open { display: block; animation: fadeIn .15s ease; }

.stream-dd-group {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 14px 4px;
  border-top: 1px solid var(--border);
}
.stream-dd-group:first-child { border-top: none; }

.stream-dd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: var(--transition);
}
.stream-dd-item:hover  { background: #ffffff08; color: var(--text); }
.stream-dd-item.active { color: var(--accent); background: var(--accent-dim); }

.stream-dd-item .dd-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  transition: var(--transition);
}
.stream-dd-item.active .dd-dot { background: var(--accent); }

.stream-player-container {
  position: relative;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  min-height: 0;
}
/* Hack para mantener 16:9 dentro de flex */
.stream-player-container::before {
  content: '';
  display: block;
  padding-top: 56.25%;
}
.stream-player-container iframe,
.stream-default {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  border: none;
  display: block;
}

.stream-default {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--surface);
  text-align: center;
  padding: 24px;
}
.stream-default-icon        { color: var(--muted); opacity: .3; }
.stream-default-icon svg    { width: 56px; height: 56px; }
.stream-default-text        { font-family: var(--font-head); font-size: 20px; letter-spacing: .5px; color: var(--muted); }
.stream-default-sub         { font-size: 13px; color: var(--muted); opacity: .6; max-width: 320px; }

/* stream reload buttons */
.stream-reload-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.stream-reload-btn svg   { width: 14px; height: 14px; }
.stream-reload-btn:hover { color: var(--text); border-color: #ffffff25; }
.stream-reload-btn.spinning svg { animation: spin .6s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

.stream-share-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.stream-share-btn svg   { width: 14px; height: 14px; }
.stream-share-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }

.stream-controls.hidden { display: none; }

/* Stream tab button accent */
.tab-stream { color: var(--purple) !important; }
.tab-stream.active { background: #9147ff18 !important; color: var(--purple) !important; }

/* Modal stream button */
.modal-header-actions { display: flex; align-items: center; gap: 8px; }

.modal-stream-btn {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
  white-space: nowrap;
}
.modal-stream-btn svg   { width: 14px; height: 14px; }
.modal-stream-btn:hover { background: var(--accent); color: #000; }

/* Scrollbar global */
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(114,214,255,0.8) rgba(10,15,30,0.9);
}

/* Active toggle buttons (scroll, etc.) */
.active-btn {
  color: var(--accent) !important;
  border-color: var(--accent) !important;
  background: var(--accent-dim) !important;
}

/* ===========================
   RESPONSIVE
   =========================== */

/* ---- Tablet (≤900px) ---- */
@media (max-width: 900px) {
  :root { --chat-width: 260px; }

  .tab { font-size: 13px; padding: 6px 10px; }
}

/* ---- Mobile landscape / tablet chico (≤700px) ---- */
@media (max-width: 700px) {
  :root { --header-h: 54px; }

  /* Header: logo solo el ícono pequeño, ocultar logo2 */
  div.logo a img.logo2 { display: none; }
  div.logo a img.logo  { height: 30px; }

  /* Tabs: solo íconos, sin texto */
  .tab { padding: 6px 10px; font-size: 0; gap: 0; }
  .tab .tab-icon { display: flex; }
  .tab-icon svg  { width: 18px; height: 18px; }

  /* Ocultar live-dot label, mantener solo el dot */
  .header-status span:not(.live-dot) { display: none; }

  /* Main con padding reducido */
  .main { padding: 16px 12px 80px; }

  /* Section header compacto */
  .section-header h2 { font-size: 22px; }
  .search-input      { width: 100%; max-width: 180px; font-size: 13px; }

  /* Event cards: 2 columnas, sin canales a la derecha */
  .event-card {
    grid-template-columns: 64px 1fr;
    padding: 10px 12px;
    gap: 10px;
  }
  .event-channels { grid-column: 1 / -1; justify-content: flex-start; }
  .event-time .time { font-size: 18px; }
  .event-title      { font-size: 13px; }

  /* Channels grid más pequeño */
  .channels-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
  .channel-logo  { width: 64px; height: 64px; }
  .channel-name  { font-size: 12px; }
  .channel-card  { padding: 14px 8px; gap: 8px; }

  /* Stream info bar: apilar título y controles */
  .stream-info-bar   { flex-direction: column; align-items: flex-start; gap: 6px; }
  .stream-info-title { font-size: 15px; }
  .stream-controls   { gap: 6px; flex-wrap: wrap; }

  /* Botones de stream: solo ícono */
  .stream-reload-btn { font-size: 0; gap: 0; padding: 8px 10px; }
  .stream-reload-btn svg { width: 15px; height: 15px; }
  .stream-selector   { min-width: 120px; }
  .stream-selector-label { max-width: 100px; font-size: 12px; }

  /* Player wrap más compacto */
  .stream-player-wrap { padding: 8px 10px 10px; gap: 8px; }

  /* Layout → columna: contenido arriba, chat abajo, sin superposición */
  .layout {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - var(--header-h));
    overflow: visible;
  }

  /* Main: alto automático, scroll interno desactivado */
  .main {
    flex: none;
    height: auto;
    overflow-y: visible;
    padding: 12px 12px 16px;
  }

  /* Chat sidebar: bloque estático debajo del contenido */
  .chat-sidebar {
    position: static;
    width: 100% !important;
    height: 50vh;
    border-left: none;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    transition: height 0.24s ease, opacity 0.18s ease;
  }
  .chat-sidebar.hidden {
    height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
  }

  /* Stream tab: altura fija = ancho de pantalla * 9/16 + espacio para controles */
  #tab-stream.active {
    height: calc(100vw * 0.5625 + 110px);
    overflow: hidden;
  }

  /* Stream active: layout sigue siendo columna */
  .stream-active .layout { flex-direction: column; overflow: visible; }
  .stream-active .main   { padding: 0; overflow: hidden; }

  /* Modal: slide desde abajo */
  .modal { align-items: flex-end; padding: 0; }
  .modal-box {
    border-radius: 14px 14px 0 0;
    max-height: 85vh;
    overflow-y: auto;
  }
}

/* ---- Mobile chico (≤480px) ---- */
@media (max-width: 480px) {
  :root { --header-h: 50px; }

  div.logo a img.logo { height: 26px; }

  .tab { padding: 5px 9px; }

  .main { padding: 12px 10px 80px; }

  /* Cards de eventos aún más compactas */
  .event-card { padding: 8px 10px; gap: 8px; }
  .event-competition-logo,
  .event-competition-logo-placeholder { width: 22px; height: 22px; }

  /* Channels: mínimo 2 por fila */
  .channels-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .channel-logo  { width: 54px; height: 54px; }
  .channel-card  { padding: 12px 6px; }

  /* Chat sidebar más alto en mobile chico */
  .chat-sidebar { height: 55vh; }
  .chat-sidebar.hidden { height: 0; }

  /* Section header: apilar */
  .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .search-input   { width: 100%; max-width: none; }
  .search-wrap    { width: 100%; }
}

/* ---- Mobile muy chico (≤360px) ---- */
@media (max-width: 360px) {
  .tab { padding: 5px 7px; }
  .channels-grid { grid-template-columns: repeat(2, 1fr); }
  .stream-selector { min-width: 100px; }
}