/* clube do livro e cards de comunidades */
  /* ---------- clube do livro: vidro, marca d'agua do atomo, cards grandes ---------- */
  .clube-lista-wrap { position: relative; overflow: hidden; padding-top: 4px; }
  .clube-watermark { position: absolute; top: -52px; right: -60px; width: 210px; height: 210px;
    animation: clubeSpinLento 60s linear infinite; pointer-events: none; z-index: 0; color: var(--ink); }
  @keyframes clubeSpinLento { to { transform: rotate(360deg); } }
  .clube-watermark path:first-child { fill: currentColor; fill-opacity: .05; stroke: currentColor; stroke-opacity: .15; }
  .clube-watermark .scribble-marca { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: .12; }

  .clube-kicker { position: relative; z-index: 1; font-family: 'DM Sans', sans-serif; font-size: 10.5px; font-weight: 700;
    letter-spacing: .12em; text-transform: uppercase; color: var(--accent-a); margin-bottom: 6px; }
  .clube-titulo-grande { position: relative; z-index: 1; font-family: 'Fraunces', serif; font-weight: 800;
    font-size: 25px; line-height: 1.1; color: var(--ink); margin: 2px 0 4px; letter-spacing: -.01em; white-space: nowrap; }
  .clube-sub-grande { position: relative; z-index: 1; font-family: 'DM Sans', sans-serif; font-size: 12px; color: var(--ink-dim); margin-bottom: 16px; }

  .clube-criar-btn { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 13px 22px; margin-bottom: 16px; border: none; border-radius: 999px; cursor: pointer;
    background: var(--accent-a); color: #fff; font-size: 13.5px; font-weight: 800;
    font-family: 'DM Sans', sans-serif; box-shadow: var(--shadow); transition: transform .15s ease; }
  .clube-criar-btn:active { transform: scale(.94); }

  /* card de clube COMPACTO (antes 16:10 e ocupava quase a tela toda):
     altura fixa de 124px, capa nítida à esquerda e a mesma capa borrada no fundo */
  .clube-card-grande { position: relative; z-index: 1; height: 124px; border-radius: 22px; overflow: hidden;
    margin-bottom: 12px; box-shadow: var(--shadow); cursor: pointer; background: var(--accent-a);
    display: flex; align-items: center; gap: 14px; padding: 12px;
    animation: clubeCardEntra .5s cubic-bezier(.2,.8,.2,1) backwards; transition: transform .15s ease; }
  .clube-card-grande:active { transform: scale(.98); }
  @keyframes clubeCardEntra { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
  /* fundo: capa ampliada e borrada (blur) — dá a cor do livro ao card */
  .clube-card-fundo { position: absolute; inset: -20px; background-size: cover; background-position: center; filter: blur(18px) saturate(1.2); }
  .clube-card-scrim { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10,8,6,.35), rgba(10,8,6,.62)); }
  .clube-card-livro-capa { position: relative; z-index: 2; flex: none; width: 66px; height: 100px; border-radius: 10px;
    background-size: cover; background-position: center; box-shadow: 0 6px 16px rgba(0,0,0,.35); }
  .clube-card-livro-capa.sem-capa { background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center; }
  .clube-card-info { position: relative; z-index: 2; min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
  .clube-card-pills { display: flex; gap: 6px; margin-bottom: 2px; }
  .clube-card-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
    background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.22); color: #fff;
    font-family: 'DM Sans', sans-serif; font-size: 10.5px; font-weight: 700; }
  .clube-card-nome { font-family: 'Fraunces', serif; font-size: 18px; font-weight: 700; color: #fff; line-height: 1.15; letter-spacing: -.01em;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .clube-card-livro { font-family: 'DM Sans', sans-serif; font-size: 12px; color: rgba(255,255,255,.9); display: flex; align-items: center; gap: 5px;
    overflow: hidden; white-space: nowrap; }

  .clube-hero-glass { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 20px; overflow: hidden;
    background-size: cover; background-position: center 25%; box-shadow: var(--shadow); }
  .clube-hero-glass.sem-livro { aspect-ratio: auto; padding: 22px; background: var(--card); border: 1px dashed var(--card-b);
    display: flex; align-items: center; justify-content: center; }
  .clube-hero-scrim { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(10,8,6,.75) 0%, rgba(10,8,6,.12) 55%, transparent 75%); }
  .clube-hero-info { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 16px; z-index: 1; }
  .clube-hero-titulo { font-family: 'Fraunces', serif; font-size: 22px; font-weight: 700; color: #fff; line-height: 1.15; text-shadow: 0 1px 10px rgba(0,0,0,.35); letter-spacing: -.01em; }
  .clube-hero-autor { font-family: 'DM Sans', sans-serif; font-size: 12px; color: rgba(255,255,255,.88); margin-top: 3px; }
  .clube-meta-pills { display: flex; gap: 8px; flex-wrap: wrap; }
  .clube-meta-pill-clicavel { cursor: pointer; }
  .clube-meta-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 999px;
    background: var(--accent-soft); color: var(--ink-dim); font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 800; }
  #clubeDetalheMural .post { animation: clubeCardEntra .4s cubic-bezier(.2,.8,.2,1) backwards; }
  #clubeDetalheMural .post-body { animation: clubeFadeIn .3s ease; }
  @keyframes clubeFadeIn { from { opacity: 0; } to { opacity: 1; } }

  /* ---------- aba Livros: chips só com ícone (todos do mesmo tamanho) ---------- */
  .feed-modo-chip.icon-only { padding: 9px 11px; }
  /* (#screen-livros na frente = regra mais forte que a pílula de vidro do estante.css) */
  /* aba Livros (item 1 do kit): cada aba é um BOTÃO DE ÍCONE redondo.
     Padrão: círculo do cartão com contorno fino. Aberta (.on): sálvia cheia.
     space-evenly espalha os 4 círculos pela largura toda (sem sobra num canto). */
  .feed-modo-row-livros { gap: 0; overflow-x: visible; justify-content: space-evenly; padding: 4px 0 10px; }
  #screen-livros .feed-modo-row-livros .feed-modo-chip { flex: none; width: 52px; height: 52px; min-width: 0; padding: 0; border-radius: 50%;
    justify-content: center; align-items: center; background: var(--card); border: 1px solid var(--card-b); color: var(--ink);
    transition: transform .15s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease, color .2s ease; }
  .feed-modo-row-livros .feed-modo-chip .icon-svg { width: 22px !important; height: 22px !important; }
  #screen-livros .feed-modo-row-livros .feed-modo-chip:active { transform: scale(.94); background: var(--salvia-suave); box-shadow: 0 0 0 7px var(--salvia-suave); }
  #screen-livros .feed-modo-row-livros .feed-modo-chip.on { background: var(--salvia); border-color: var(--salvia); color: #fff; box-shadow: none; }
  .feed-modo-row-livros .feed-modo-chip.on svg { animation: livrosIconePop .55s cubic-bezier(.2,.8,.2,1); }
  .feed-modo-row-livros .feed-modo-chip[data-modo-livros="comunidades"].on svg { animation-name: livrosIconeGira; }
  .feed-modo-row-livros .feed-modo-chip[data-modo-livros="gratuitos"].on svg { animation-name: livrosIconeAbre; }
  .feed-modo-row-livros .feed-modo-chip[data-modo-livros="estante"].on svg { animation-name: livrosIconeSobe; }
  .feed-modo-row-livros .feed-modo-chip[data-modo-livros="autoral"].on svg { animation-name: livrosIconeBalanca; }
  @keyframes livrosIconePop { 0% { transform: scale(1); } 35% { transform: scale(1.4); } 60% { transform: scale(.9); } 100% { transform: scale(1); } }
  @keyframes livrosIconeGira { 0% { transform: rotate(0) scale(1); } 40% { transform: rotate(-16deg) scale(1.3); } 70% { transform: rotate(6deg) scale(.95); } 100% { transform: rotate(0) scale(1); } }
  @keyframes livrosIconeAbre { 0% { transform: scaleX(1); } 30% { transform: scaleX(.25); } 65% { transform: scaleX(1.25); } 100% { transform: scaleX(1); } }
  @keyframes livrosIconeSobe { 0% { transform: translateY(0) scale(1); } 40% { transform: translateY(-5px) scale(1.2); } 70% { transform: translateY(1px) scale(.95); } 100% { transform: translateY(0) scale(1); } }
  @keyframes livrosIconeBalanca { 0% { transform: rotate(0); } 25% { transform: rotate(-16deg) scale(1.15); } 55% { transform: rotate(12deg) scale(1.1); } 80% { transform: rotate(-5deg); } 100% { transform: rotate(0) scale(1); } }
  @media (prefers-reduced-motion: reduce) { .feed-modo-row-livros .feed-modo-chip.on svg { animation: none; } }

  /* ---------- clube/comunidade: botoes de acao no cabecalho (ao lado dos 3 pontinhos), capa mini e bolhas por pessoa ---------- */
  .clube-header-icons { display: flex; align-items: center; gap: 6px; }
  .dm-header-icon-btn { width: 32px; height: 32px; border-radius: 50%; flex: none; border: 1px solid color-mix(in srgb, var(--card-b) 55%, transparent);
    background: color-mix(in srgb, var(--card) 55%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--ink-dim); transition: transform .15s ease; }
  .dm-header-icon-btn:active { transform: scale(.9); }
  .dm-header-pill { width: auto; border-radius: 999px; padding: 0 10px; gap: 4px; font-size: 10.5px; font-weight: 800;
    color: var(--accent-b); cursor: default; white-space: nowrap; font-family: 'DM Sans', sans-serif; }

  .clube-hero-mini { display: flex; align-items: center; gap: 10px; border-radius: 14px; padding: 8px;
    background: color-mix(in srgb, var(--card) 55%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid color-mix(in srgb, var(--card-b) 55%, transparent); }
  .clube-hero-mini-capa { width: 40px; height: 56px; border-radius: 6px; background-size: cover; background-position: center;
    flex: none; background-color: var(--accent-a); }
  .clube-hero-mini-info { min-width: 0; }
  .clube-hero-mini-titulo { font-family: 'Fraunces', serif; font-weight: 700; font-size: 14px; line-height: 1.2;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
  .clube-hero-mini-autor { font-family: 'DM Sans', sans-serif; font-size: 11px; color: var(--ink-dim); margin-top: 1px; }
  .clube-hero-mini.sem-livro { justify-content: center; color: var(--ink-faint); font-size: 12px; padding: 14px;
    font-family: 'DM Sans', sans-serif; }

  .clube-msg-row.other .clube-msg-bolha.cor-0 { background: color-mix(in srgb, var(--accent-b) 24%, var(--card)); }
  .clube-msg-row.other .clube-msg-bolha.cor-1 { background: color-mix(in srgb, var(--pink) 24%, var(--card)); }
  .clube-msg-row.other .clube-msg-bolha.cor-2 { background: color-mix(in srgb, var(--yellow) 24%, var(--card)); }
  .clube-msg-row.other .clube-msg-bolha.cor-3 { background: color-mix(in srgb, #8B7EC8 24%, var(--card)); }
  .clube-msg-row.other .clube-msg-bolha.cor-4 { background: color-mix(in srgb, #7A9B6E 24%, var(--card)); }
  .clube-msg-row.other .clube-msg-bolha.cor-5 { background: color-mix(in srgb, var(--accent-a) 22%, var(--card)); }
  .clube-msg-autor.cor-0 { color: color-mix(in srgb, var(--accent-b) 80%, var(--ink)); }
  .clube-msg-autor.cor-1 { color: color-mix(in srgb, var(--pink) 80%, var(--ink)); }
  .clube-msg-autor.cor-2 { color: color-mix(in srgb, var(--yellow) 75%, var(--ink)); }
  .clube-msg-autor.cor-3 { color: color-mix(in srgb, #8B7EC8 80%, var(--ink)); }
  .clube-msg-autor.cor-4 { color: color-mix(in srgb, #7A9B6E 80%, var(--ink)); }
  .clube-msg-autor.cor-5 { color: color-mix(in srgb, var(--accent-a) 80%, var(--ink)); }

  /* ---------- comunidades: card da lista (protótipo aprovado por ela) ---------- */
  .comunidade-card { position: relative; background: var(--card); border: 1px solid var(--card-b); border-radius: 20px;
    padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); cursor: pointer; transition: transform .15s ease;
    animation: clubeCardEntra .45s cubic-bezier(.2,.8,.2,1) backwards; }
  .comunidade-card:active { transform: scale(.98); }
  .comunidade-card-top { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
  .comunidade-icone { flex: none; width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center;
    justify-content: center; color: #fff; }
  .comunidade-badge { display: inline-block; font-size: 9px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
    color: var(--accent-b); background: color-mix(in srgb, var(--accent-b) 14%, transparent); padding: 2px 7px;
    border-radius: 999px; margin-bottom: 4px; font-family: 'DM Sans', sans-serif; }
  .comunidade-titulo { font-family: 'Baloo 2', sans-serif; font-size: 14.5px; color: var(--ink); line-height: 1.25; }
  .comunidade-desc { font-size: 11.5px; color: var(--ink-dim); line-height: 1.45; margin: 6px 0 10px; }
  .comunidade-footer { display: flex; align-items: center; justify-content: space-between; }
  .comunidade-avatar-stack { display: flex; align-items: center; }
  .comunidade-mini-avatar { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--card); margin-left: -7px;
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 9px; font-weight: 800;
    font-family: 'DM Sans', sans-serif; }
  .comunidade-mini-avatar:first-child { margin-left: 0; }
  .comunidade-membros-txt { font-size: 10.5px; color: var(--ink-faint); font-weight: 700; margin-left: 6px; font-family: 'DM Sans', sans-serif; }
  .comunidade-prazo-txt { font-size: 10.5px; color: var(--ink-faint); font-weight: 700; font-family: 'DM Sans', sans-serif;
    display: inline-flex; align-items: center; gap: 3px; }
  .comunidade-capa-picker { width: 100%; height: 108px; border-radius: 16px; background: var(--accent-soft);
    color: var(--accent-a); display: flex; align-items: center; justify-content: center; cursor: pointer;
    overflow: hidden; margin-bottom: 12px; border: 1px dashed color-mix(in srgb, var(--accent-a) 35%, transparent); }
  .comunidade-capa-picker img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .comunidade-capa-picker-vazio { display: flex; align-items: center; gap: 6px; font-family: 'DM Sans', sans-serif;
    font-size: 12.5px; font-weight: 700; }
  /* foto de quem está no grupo, com um + pra seguir na hora (networking em clube do livro / comunidades) */
  .avatar-seguir { position: relative; display: inline-flex; flex: none; vertical-align: middle; }
  .avatar-seguir-foto { width: 100%; height: 100%; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: var(--accent-soft); color: var(--ink); font-family: 'DM Sans', sans-serif; font-weight: 800; font-size: 10px; overflow: hidden; }
  .avatar-seguir-mais { position: absolute; right: -4px; bottom: -4px; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--card);
    background: var(--accent-a); color: #fff; font-size: 12px; line-height: 1; font-weight: 800; padding: 0; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: transform .15s, background .25s; }
  .avatar-seguir-mais::after { content: ''; position: absolute; inset: -10px; }
  .avatar-seguir-mais:active { transform: scale(.90); }
  .avatar-seguir-mais.ok { background: var(--accent-b); font-size: 9px; }
  .comunidade-membro-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px;
    border-bottom: 1px solid var(--card-b); }
  .comunidade-membro-avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; color: #fff; font-family: 'DM Sans', sans-serif; font-weight: 800; font-size: 12px; flex: none; }
  .comunidade-membro-handle { font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 13px; color: var(--ink); }
  .comunidade-membro-papel { font-size: 10.5px; color: var(--ink-faint); text-transform: capitalize; }
  .ranking-posicao { width: 24px; text-align: center; font-family: 'Baloo 2', sans-serif; font-weight: 800;
    font-size: 14px; color: var(--ink-faint); flex: none; }
  .ranking-paginas { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 14.5px; color: var(--accent-a); flex: none; white-space: nowrap; }
  .ranking-paginas small { font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 9.5px; color: var(--ink-faint); margin-left: 2px; }
  .ranking-periodo-row { display: flex; gap: 8px; margin-bottom: 14px; }


  /* botão da mesa ao vivo no clube (contorno sálvia do kit), largura toda */
  .clube-mesa-btn { width:100%; }

  /* ---------- card de comunidade COMPACTO (igual aos cards de clube, mais baixinho) ----------
     PRA APRENDER: "-webkit-line-clamp: 1" corta a descrição em 1 linha e põe "…"
     no fim — o texto inteiro continua lá dentro do detalhe da comunidade. */
  .comunidade-card { padding: 11px 13px; margin-bottom: 10px; border-radius: 18px; }
  .comunidade-card-top { align-items: center; gap: 10px; margin-bottom: 4px; }
  .comunidade-icone { width: 34px; height: 34px; border-radius: 11px; }
  .comunidade-titulo { font-size: 14px; line-height: 1.2; }
  .comunidade-desc { margin: 2px 0 6px; font-size: 11.5px;
    display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

  /* ---------- foto do grupo REDONDA (como foto de perfil) ---------- */
  .comunidade-icone { border-radius: 50%; overflow: hidden; }

  /* card com foto: fica "transparente" com a cor da foto escolhida.
     PRA APRENDER: o ::before é uma camada extra desenhada pelo CSS, atrás do
     conteúdo (z-index 0). Nela vai a própria foto, bem borrada (blur) e meio
     apagada (opacity) — sobra só a COR dela tingindo o card. A foto vem da
     variável --capa, que o js coloca no style de cada card. */
  .comunidade-card.com-capa { overflow: hidden; isolation: isolate;
    background: color-mix(in srgb, var(--card) 62%, transparent); }
  .comunidade-card.com-capa::before { content: ''; position: absolute; inset: -40px; z-index: -1;
    background-image: var(--capa); background-size: cover; background-position: center;
    filter: blur(28px) saturate(1.3); opacity: .42; }

  /* foto do grupo no topo do detalhe, ao lado dos 3 pontinhos */
  .comunidade-avatar-btn { flex: none; width: 34px; height: 34px; border-radius: 50%; padding: 0; margin-left: auto; margin-right: 6px;
    border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--card-b); background-size: cover; background-position: center;
    display: flex; align-items: center; justify-content: center; position: relative; cursor: default; }
  .comunidade-avatar-btn.pode-trocar { cursor: pointer; }
  .comunidade-avatar-btn.pode-trocar:active { transform: scale(.94); box-shadow: 0 0 0 6px var(--salvia-suave); }
  /* camerazinha no cantinho = "toque pra colocar uma foto" (só pra quem administra e ainda não pôs) */
  .comunidade-avatar-btn.pode-trocar.sem-foto::after { content: ''; position: absolute; right: -3px; bottom: -3px; width: 15px; height: 15px; border-radius: 50%;
    background: var(--terracota) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linejoin='round'%3E%3Cpath d='M4 8h3l1.5-2h7L17 8h3v11H4z'/%3E%3Ccircle cx='12' cy='13' r='3.2'/%3E%3C/svg%3E") center / 9px no-repeat;
    border: 2px solid var(--card); }
  /* topo do detalhe: o título ocupa o meio e empurra a foto pra encostar nos 3 pontinhos */
  #comunidadeDetalheOverlay .dm-chat-header h2 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #comunidadeDetalheOverlay .comunidade-avatar-btn { margin-left: 0; }
  #comunidadeDetalheOverlay .clube-overflow-wrap { margin-left: 0; }
