.feed-page {
  background: #f7f6fb;
  min-height: 100vh;
  /* Fijar `min-height` anula el mínimo automático que impide encoger a un
     hijo flex, así que sin esto el body podría volver a aplastar el feed y
     dejar las publicaciones por debajo del footer. */
  flex-shrink: 0;
  padding: 0 0 3rem;
}
html.dark-mode .feed-page { background: var(--dm-bg); }

.feed-layout {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.5rem;
  align-items: start;
}
/* =============================================
   Barra lateral -> boton flotante

   Por debajo de 900px la lateral no cabe y se oculta; el boton flotante la
   sustituye abriendo su mismo contenido en un modal. Los dos van atados al
   MISMO breakpoint: si uno se mueve sin el otro, o se ve la lateral y el boton
   a la vez, o no se ve ninguno de los dos.
   ============================================= */
@media (max-width: 900px) {
  .feed-layout { grid-template-columns: 1fr; }
  .feed-layout .feed-side { display: none; }
  .feed-page .feed-side-fab { display: flex; }
  /* Selectores de dos clases a proposito: las reglas base .feed-side
     (display:flex) y .feed-side-fab (display:none) van MAS ABAJO en este
     fichero y, con la misma especificidad, ganaban a este media query: la
     lateral se veia en movil y el boton flotante no aparecia nunca. */
}

.feed-side-fab {
  display: none;   /* solo existe donde la lateral no cabe */
  position: fixed;
  /* Abajo a la derecha: el boton de avisos ocupa la esquina de arriba. Se
     levanta por encima de la barra inferior movil (65px) y del notch. */
  bottom: calc(65px + 16px + env(safe-area-inset-bottom));
  right: 16px;
  z-index: 1045;   /* sobre el contenido, bajo el backdrop del modal (1050) */
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, #C52110 0%, #333 50%, #5810c5 100%);
  box-shadow: 0 4px 16px rgba(88,16,197,0.4);
  cursor: pointer;
  transition: transform 0.2s ease;
}
.feed-side-fab:hover,
.feed-side-fab:focus { transform: scale(1.06); color: #fff; }
/* `.bi` global pinta los iconos de rojo; aqui hace falta blanco. */
.feed-side-fab .bi { color: #fff; font-size: 1.3rem; }

/* Dentro del modal las tarjetas no necesitan su marco: ya lo pone el modal. */
.feed-side-modal-body .feed-side-card {
  border: none;
  box-shadow: none;
  padding: 0 0 4px;
}
.feed-side-modal-body .feed-side-card + .feed-side-card {
  margin-top: 14px;
  border-top: 1px solid rgba(0,0,0,0.08);
  padding-top: 14px;
}
html.dark-mode .feed-side-modal-body .feed-side-card { background: transparent; }
html.dark-mode .feed-side-modal-body .feed-side-card + .feed-side-card {
  border-top-color: var(--dm-border);
}

.feed-pending-strip {
  background: #fff6e5;
  border: 1px solid #ffd58a;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 1rem;
}
html.dark-mode .feed-pending-strip { background: #2e2717; border-color: #6b551f; }
.feed-pending-head {
  font-weight: 700;
  font-size: 0.85rem;
  color: #8a5a00;
  margin-bottom: 8px;
}
.feed-pending-head i { color: #8a5a00; }
html.dark-mode .feed-pending-head,
html.dark-mode .feed-pending-head i { color: #ffcf7a; }
.feed-pending-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px dashed rgba(0,0,0,0.12);
  font-size: 0.85rem;
}
.feed-pending-item:first-of-type { border-top: none; }
.feed-pending-buttons { display: flex; gap: 6px; flex-shrink: 0; }
.feed-pending-publish,
.feed-pending-discard {
  border: none;
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}
.feed-pending-publish { background: linear-gradient(135deg, #C52110 0%, #333 50%, #5810c5 100%); color: #fff; }
.feed-pending-discard { background: transparent; border: 1px solid rgba(0,0,0,0.2); color: #666; }
html.dark-mode .feed-pending-discard { color: var(--dm-text-muted); border-color: rgba(255,255,255,0.2); }

.feed-stream { display: flex; flex-direction: column; gap: 1rem; }
.feed-empty {
  text-align: center;
  color: #aaa;
  padding: 3rem 1rem;
  font-size: 0.9rem;
}
.feed-empty i { font-size: 2.5rem; margin-bottom: 0.75rem; display: block; color: #ddd; }

.feed-pub {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 .15rem 1.75rem rgba(33,40,50,0.08);
}
html.dark-mode .feed-pub { background: var(--dm-bg-card); border-color: var(--dm-border); }

.feed-pub-head { display: flex; gap: 10px; align-items: center; }
.feed-avatar img,
.feed-comment-avatar img {
  width: 42px; height: 42px;
  border-radius: 10px;
  object-fit: cover;
  background: #f0ebff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.feed-comment-avatar img { width: 32px; height: 32px; border-radius: 8px; }
/* El CONTENEDOR del avatar tiene tamaño fijo. Sin esto su ancho salia de su
   contenido: si el logo no carga, el navegador pinta el texto alternativo (el
   nombre de usuario) y el avatar se ensanchaba a 124-147px, aplastando la
   respuesta de al lado hasta 23px de ancho. */
.feed-avatar { flex: 0 0 42px; width: 42px; height: 42px; }
.feed-comment-avatar { flex: 0 0 32px; width: 32px; height: 32px; }
.feed-pub-line { margin: 0; font-size: 0.9rem; }
.feed-pub-author { font-weight: 700; color: #2d2d2d; text-decoration: none; }
html.dark-mode .feed-pub-author { color: var(--dm-text); }
.feed-pub-action { color: #666; }
html.dark-mode .feed-pub-action { color: var(--dm-text-muted); }
.feed-pub-time { margin: 0; font-size: 0.72rem; color: #9a9a9a; }

.feed-pub-body { margin: 12px 0; }
.feed-target {
  display: block;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 10px 12px;
  text-decoration: none;
  color: inherit;
}
html.dark-mode .feed-target { border-color: var(--dm-border); }
.feed-target-name { font-weight: 700; font-size: 0.9rem; display: block; }
.feed-target-name i { color: #C52110; }
.feed-target-sub { font-size: 0.78rem; color: #5810c5; text-decoration: none; }
.feed-target-thumbs { display: flex; gap: 6px; margin-top: 8px; }
.feed-target-thumbs img {
  width: 44px; height: 62px;
  object-fit: cover;
  border-radius: 6px;
  background: #f0ebff;
}
.feed-target-product { display: flex; gap: 12px; align-items: center; }
.feed-target-product img { width: 54px; height: 76px; object-fit: cover; border-radius: 8px; }
.feed-pub-text { margin: 10px 0 0; font-size: 0.88rem; }

.feed-pub-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(0,0,0,0.06);
  padding-top: 10px;
}
html.dark-mode .feed-pub-actions { border-color: var(--dm-border); }
.feed-reaction-bar { display: flex; gap: 4px; flex-wrap: wrap; }
.feed-reaction {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid transparent;
  background: #f2f0f9;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}
html.dark-mode .feed-reaction { background: var(--dm-bg-3); }
.feed-reaction:hover { transform: translateY(-1px); }
.feed-reaction.is-mine { background: #e7dbff; border-color: #5810c5; }
html.dark-mode .feed-reaction.is-mine { background: #3a2a63; }
.feed-reaction i { font-size: 0.9rem; }
.feed-reaction-count { font-size: 0.75rem; font-weight: 700; color: #5810c5; }
html.dark-mode .feed-reaction-count { color: #c9b3ff; }
.feed-see-reactions {
  background: none;
  border: none;
  color: #5810c5;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.feed-see-reactions i { color: #5810c5; font-size: 0.85rem; }

.feed-comments { margin-top: 12px; }
.feed-comment-list,
.feed-reply-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.feed-reply-list { margin-top: 10px; padding-left: 12px; border-left: 2px solid rgba(88,16,197,0.2); }
.feed-comment { display: flex; gap: 8px; }
.feed-comment-main { flex: 1; min-width: 0; }
/* flex-wrap en la cabecera y en las herramientas: sin el, autor + etiqueta
   'AUTOR' + '5 dias, 17 horas' formaban una fila que no podia partirse, y en
   una respuesta anidada en movil ese minimo se propagaba hacia arriba por los
   flex hasta ensanchar toda la pagina a 537px (scroll horizontal). */
.feed-comment-head { margin: 0; font-size: 0.8rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; }
.feed-comment-author { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.feed-comment-badge {
  background: #5810c5; color: #fff;
  border-radius: 999px; padding: 0 6px;
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
}
.feed-comment-time { color: #9a9a9a; font-size: 0.7rem; }
.feed-comment-text { margin: 2px 0 0; font-size: 0.85rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.feed-comment-tools { display: flex; flex-wrap: wrap; gap: 0 10px; margin-top: 3px; }
.feed-comment-tools button {
  background: none; border: none; padding: 0;
  font-size: 0.72rem; color: #9a9a9a; cursor: pointer;
}
.feed-comment-tools button:hover { color: #C52110; }

.feed-comment-form,
.feed-reply-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: flex-end;
}
.feed-reply-form { margin-top: 8px; }
.feed-comment-input {
  flex: 1;
  border: 1.5px solid #e0e0e0;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.85rem;
  resize: vertical;
  min-height: 38px;
  background: #f7f6fb;
  color: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.feed-comment-input:focus { border-color: #5810c5; box-shadow: 0 0 0 3px rgba(88,16,197,0.1); background: #fff; }
html.dark-mode .feed-comment-input { background: var(--dm-input-bg); border-color: var(--dm-border); color: var(--dm-input-text); }
.feed-comment-send {
  border: none;
  background: linear-gradient(135deg, #5810c5, #7a30e0);
  color: #fff;
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(88,16,197,0.3);
  transition: transform 0.15s, filter 0.15s;
}
.feed-comment-send:hover { transform: translateY(-1px); filter: brightness(1.08); }
.feed-comment-send i { color: #fff; }

.feed-more-btn {
  display: block;
  width: 100%;
  margin-top: 1rem;
  padding: 10px;
  border: 1.5px solid #5810c5;
  background: transparent;
  color: #5810c5;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}
.feed-more-btn:hover { background: rgba(88,16,197,0.08); }
.feed-more-btn:disabled { opacity: 0.5; cursor: default; }

.feed-side { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 90px; }
.feed-side-card {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 .15rem 1.75rem rgba(33,40,50,0.08);
}
html.dark-mode .feed-side-card { background: var(--dm-bg-card); border-color: var(--dm-border); }
.feed-side-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #9a9a9a;
  margin: 0 0 10px;
}
.feed-side-title-link { color: inherit; text-decoration: none; }
.feed-side-title-link:hover { color: #5810c5; }
.feed-games-list,
.feed-shops-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.feed-game-link,
.feed-shop-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  font-size: 0.86rem;
  font-weight: 600;
}
.feed-game-link:hover,
.feed-shop-link:hover { background: rgba(88,16,197,0.08); }
.feed-game-link img { width: 26px; height: 26px; object-fit: contain; }
.feed-shop-link img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.feed-side-empty { font-size: 0.8rem; color: #9a9a9a; margin: 0; }

.feed-reactions-dialog {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.feed-reactions-dialog[hidden] { display: none; }
.feed-reactions-dialog-inner {
  background: #fff;
  border-radius: 16px;
  width: min(90vw, 360px);
  max-height: 70vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
html.dark-mode .feed-reactions-dialog-inner { background: var(--dm-bg-card); }
.feed-reactions-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-weight: 700;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.feed-reactions-dialog-close {
  background: none; border: none; font-size: 1.4rem; line-height: 1; cursor: pointer; color: inherit;
}
.feed-reactions-list { list-style: none; margin: 0; padding: 8px 0; overflow-y: auto; }
.feed-reactions-row,
.feed-reactions-empty { padding: 8px 16px; font-size: 0.88rem; }
.feed-reactions-empty { color: #9a9a9a; }

.feed-confirm-modal { border-radius: 16px; overflow: hidden; }
.feed-confirm-head {
  background: linear-gradient(135deg, #C52110 0%, #333 50%, #5810c5 100%);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.feed-confirm-head i { font-size: 1.1rem; color: #fff; }
.feed-confirm-text { font-size: 0.9rem; margin: 0; }
.feed-confirm-foot { border-top: 1px solid rgba(0,0,0,0.08); gap: 8px; }
.feed-confirm-btn {
  border: none;
  border-radius: 10px;
  padding: 8px 18px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}
.feed-confirm-btn.publish { background: linear-gradient(135deg, #C52110 0%, #333 50%, #5810c5 100%); color: #fff; }
.feed-confirm-btn.discard { background: transparent; border: 1px solid rgba(0,0,0,0.2); color: #666; }
html.dark-mode .feed-confirm-btn.discard { color: var(--dm-text-muted); border-color: rgba(255,255,255,0.2); }

.feed-target-wanted { border-color: rgba(197,33,16,0.35); }
.feed-target-wanted .feed-target-name i { color: #C52110; }
.feed-offer-btn {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #157347, #0f5132);
  box-shadow: 0 2px 8px rgba(21,115,71,0.3);
}
.feed-offer-btn i { color: #fff; }
.feed-offer-btn:disabled { opacity: 0.6; cursor: default; }

.request-card-modal { border-radius: 16px; overflow: hidden; }
.request-card-head {
  background: linear-gradient(135deg, #C52110 0%, #333 50%, #5810c5 100%);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.request-card-head i { color: #fff; font-size: 1.1rem; }
.request-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0 0 14px;
  text-align: center;
}
.request-card-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 12px;
  background: #fff;
  padding: 12px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
html.dark-mode .request-card-option { background: var(--dm-bg-card); border-color: var(--dm-border); }
.request-card-option:hover { border-color: #5810c5; transform: translateY(-1px); }
.request-card-option-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(88,16,197,0.1);
}
.request-card-option-icon i { color: #5810c5; font-size: 1.1rem; }
.request-card-option-icon.whatsapp { background: rgba(37,211,102,0.14); }
.request-card-option-icon.whatsapp i { color: #25D366; }
.request-card-option-text { display: flex; flex-direction: column; }
.request-card-option-title { font-weight: 700; font-size: 0.88rem; }
.request-card-option-sub { font-size: 0.75rem; color: #9a9a9a; }
.request-card-community {
  border-top: 1px solid rgba(0,0,0,0.08);
  padding-top: 12px;
  margin-top: 4px;
}
.request-card-community label { font-size: 0.8rem; font-weight: 600; display: block; margin-bottom: 6px; }
.request-card-nocommunity { font-size: 0.8rem; color: #9a9a9a; margin: 8px 0 0; }
.request-card-send {
  margin-top: 10px;
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 9px;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #C52110 0%, #333 50%, #5810c5 100%);
}
.request-card-foot { border-top: 1px solid rgba(0,0,0,0.08); }
.request-card-close {
  border: 1px solid rgba(0,0,0,0.15);
  background: transparent;
  border-radius: 10px;
  padding: 7px 16px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  color: inherit;
}
