:root {
  --bg: #0b0b0f;
  --surface: #17181c;
  --surface-2: #1f2127;
  --line: #2a2d35;
  --text: #f3f4f6;
  --muted: #9aa0ac;
  --blurple: #5865f2;
  --blurple-hi: #6f7bf7;
  --danger: #f0616d;
  --radius: 18px;
  /* Largura padrão de conteúdo — TL, perfil, /stories e a busca do topo
     compartilham este eixo pra tudo encaixar. */
  --page-w: 1080px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }
/* Reserva sempre o espaço da barra de rolagem, então a largura útil não muda
   entre uma aba com scroll e outra sem — sem "pulo" horizontal do conteúdo. */
html { scrollbar-gutter: stable; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg); /* flat — o brilho radial atrás da timeline ficava estranho */
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100%;
  display: grid;
  /* coluna limitada à viewport (minmax base 0): conteúdo largo — como o
     heatmap das stats — encolhe/quebra em vez de estourar a tela. */
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.hidden { display: none !important; }

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

.muted { color: var(--muted); margin: 0; font-size: 0.95rem; }

.glyph {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(160deg, var(--blurple), #3b45c9);
  color: #fff;
  font-size: 1.5rem;
  box-shadow: 0 8px 24px rgba(88, 101, 242, 0.45);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 24px;
  padding: 13px 18px;
  border: none;
  border-radius: 12px;
  background: var(--blurple);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn:hover { background: var(--blurple-hi); }
.btn:active { transform: translateY(1px); }

.btn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.9;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.badge {
  display: inline-block;
  margin-bottom: 16px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(88, 101, 242, 0.15);
  color: var(--blurple-hi);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.glyph-muted {
  background: var(--surface-2);
  color: var(--muted);
  box-shadow: none;
}

.avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  margin: 0 auto 18px;
  display: block;
  object-fit: cover;
  background: var(--surface-2);
  border: 3px solid var(--blurple);
  box-shadow: 0 8px 24px rgba(88, 101, 242, 0.35);
}

#username { margin-top: 2px; font-variant-ligatures: none; }

.error {
  margin: 16px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(240, 97, 109, 0.12);
  color: var(--danger);
  font-size: 0.9rem;
}

.spinner {
  width: 28px;
  height: 28px;
  margin: 8px auto;
  border: 3px solid var(--line);
  border-top-color: var(--blurple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
.spinner-sm { width: 22px; height: 22px; border-width: 2px; margin: 0; }
.home-sentinel { display: flex; justify-content: center; align-items: center; padding: 26px 0; min-height: 44px; }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  .btn:active { transform: none; }
}

/* ------------------------------ top bar --------------------------------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: rgba(11, 11, 15, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  z-index: 50;
}
/* A marca: serif elegante com varredura de cor no hover e "press" no clique.
   O gradiente tem 300% de largura com a faixa colorida no meio — parado fica
   branco, e no hover a faixa azul atravessa o texto. */
.brand {
  display: inline-block;
  text-decoration: none;
  font-family: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-style: italic;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: linear-gradient(100deg, #fff 0%, #fff 38%, var(--blurple-hi) 50%, #a8b4ff 56%, #fff 68%, #fff 100%);
  background-size: 300% 100%;
  background-position: 0% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: background-position 0.6s ease, transform 0.18s ease, filter 0.35s ease;
}
.brand:hover {
  background-position: 100% 0;
  transform: translateY(-1px) scale(1.05);
  filter: drop-shadow(0 0 14px rgba(88, 101, 242, 0.5));
}
.brand:active { transform: scale(0.92); transition-duration: 0.08s; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* Anônimo: some com os menus de conta e o "Publicar"; entra o botão de login. */
.topbar-login { display: none; width: auto; margin-top: 0; white-space: nowrap; }
body.anon .topbar-login { display: inline-flex; }
body.anon .topbar-actions .menu, body.anon .btn-publish { display: none; }

/* Busca de histórias no topo: ocupa a maior parte do espaço entre a marca e
   os ícones. [input flexível][Buscar azul][Publicar História verde] */
.top-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0 18px;
  max-width: 860px;
}
/* Em telas largas a busca é ancorada no MESMO eixo central das páginas
   (--page-w), então topo e conteúdo se alinham. Em telas menores volta ao
   flex normal pra nunca sobrepor a marca/ações. */
@media (min-width: 1180px) {
  .top-search {
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: min(var(--page-w), 100% - 560px);
    max-width: none;
    margin: 0;
  }
  /* Com o trilho aberto, o conteúdo recua 224px à esquerda — seu eixo central
     desloca +100px. A busca do topo acompanha pra topo e páginas se alinharem. */
  body.has-rail .top-search { left: calc(50% + 100px); }
}
.top-search input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 14px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.top-search input:focus { outline: none; border-color: var(--blurple); }
.top-search input::placeholder { color: var(--muted); }
.top-search-go { flex: none; }
.btn-publish {
  flex: none;
  background: #2f9e63;
  white-space: nowrap;
}
.btn-publish:hover { background: #3cb576; }
.bp-min { display: none; font-size: 1.1rem; line-height: 1; }
@media (max-width: 860px) {
  .top-search { margin: 0 10px; }
  .top-search input::placeholder { color: transparent; } /* placeholder longo some no mobile */
  .bp-full { display: none; }        /* no celular o botão verde vira um "+" */
  .bp-min { display: inline; }
  .btn-publish { padding: 8px 12px; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 10px; }
  .brand { font-size: 1.3rem; }
  .top-search { margin: 0 8px; gap: 6px; }
  .top-search-go { display: none; }  /* o Enter já dispara a busca */
  .topbar-actions { gap: 6px; }
  .iconbtn, .avatarbtn { width: 38px; height: 38px; }
}
@media (max-width: 400px) {
  .brand { font-size: 1.15rem; }
  .top-search { margin: 0 6px; }
  .iconbtn, .avatarbtn { width: 34px; height: 34px; }
  .topbar-login { padding: 7px 10px; font-size: 0.82rem; }
}

.menu { position: relative; }

.iconbtn {
  position: relative;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.iconbtn:hover { color: var(--text); background: var(--surface-2); border-color: #3a3e48; }

.count {
  position: absolute;
  top: -6px; right: -6px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  border: 2px solid var(--bg);
}

/* ------------------------------ panels ---------------------------------- */
.panel {
  position: absolute;
  top: 52px; right: 0;
  width: 320px;
  max-width: calc(100vw - 24px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.panel-head {
  padding: 14px 16px;
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--line);
}
.panel-body { max-height: 380px; overflow-y: auto; }
.panel-empty { padding: 24px 16px; color: var(--muted); text-align: center; font-size: 0.9rem; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: none; }
.row-unread { background: rgba(88, 101, 242, 0.07); }
.row-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; background: var(--surface-2); object-fit: cover; }
.row-info { flex: 1; min-width: 0; text-align: left; }
.row-name { font-size: 0.9rem; font-weight: 500; color: var(--text); }
.row-link { color: var(--text); text-decoration: none; font-weight: 600; }
.row-link:hover { text-decoration: underline; }
.row-name a.row-name { text-decoration: none; }
.row-sub { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.row-btns { display: flex; gap: 6px; flex: none; }

.mini {
  padding: 6px 12px;
  border: none;
  border-radius: 9px;
  background: var(--blurple);
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.mini:hover { background: var(--blurple-hi); }
.mini-ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.mini-ghost:hover { background: var(--surface-2); color: var(--text); }

/* --------------------------- profile actions ---------------------------- */
.actions-row { display: flex; gap: 10px; margin-top: 22px; }
.actions-row .btn { margin-top: 0; }
.btn-dim { opacity: 0.7; }

/* keep profile cards clear of the fixed top bar */
.stage { padding-top: 84px; }

/* ------------------------------ home feed -------------------------------- */
.home {
  width: 100%;
  max-width: var(--page-w);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 28px;
  align-items: start;
  align-self: start; /* pin the timeline to the top, don't vertically center it */
}
.timeline { min-width: 0; }

/* profile pinned to the right while the timeline scrolls */
.sidebar { position: sticky; top: 84px; }
.profile-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.avatar-sm {
  width: 72px; height: 72px;
  border-radius: 50%;
  margin: 0 auto 12px;
  display: block;
  object-fit: cover;
  background: var(--surface-2);
  border: 3px solid var(--blurple);
}
.pc-name { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; }
.pc-handle { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.profile-card .btn { margin-top: 18px; }

@media (max-width: 720px) {
  .home { grid-template-columns: 1fr; }
  .sidebar { position: static; order: -1; }
}

.muted-sm { color: var(--muted); font-size: 0.8rem; }
.muted-sm.over { color: var(--danger); }

.composer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 16px 14px;
  margin-bottom: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.composer:focus-within {
  border-color: var(--blurple);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.18);
}
/* contenteditable input used by the composer and the inline editor */
.mention-box {
  width: 100%;
  min-height: 60px;
  padding: 8px 0;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  outline: none;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.mention-box:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

/* a mention rendered as one atomic, clickable pill inside the input */
.chip {
  display: inline-block;
  padding: 0 5px;
  border-radius: 6px;
  background: rgba(88, 101, 242, 0.18);
  color: var(--blurple-hi);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  user-select: all;
}
.chip:hover { background: rgba(88, 101, 242, 0.32); }

.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
/* the Post button is a compact CTA, not a full-width bar */
.composer-foot .btn {
  width: auto;
  margin-top: 0;
  padding: 9px 22px;
  border-radius: 999px;
}
.composer-foot .btn:disabled { opacity: 0.5; cursor: not-allowed; }

.tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1;
  padding: 12px 0;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--blurple); }

.feed { display: flex; flex-direction: column; }
.feed-empty { padding: 40px 16px; text-align: center; color: var(--muted); }

/* "N new posts" bar — full-width, centered, sticks to the top while scrolling */
.new-posts {
  position: sticky;
  top: 76px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin: 0 0 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(rgba(88, 101, 242, 0.1), rgba(88, 101, 242, 0.1)),
    var(--surface);
  color: var(--blurple-hi);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.08s ease;
  animation: newPostsIn 0.25s ease;
}
.new-posts:hover {
  border-color: var(--blurple);
  background:
    linear-gradient(rgba(88, 101, 242, 0.18), rgba(88, 101, 242, 0.18)),
    var(--surface);
}
.new-posts:active { transform: translateY(1px); }

/* transform-only entrance — never animates opacity, so the bar can't get
   stuck invisible when it's toggled on/off. */
@keyframes newPostsIn {
  from { transform: translateY(-6px); }
  to   { transform: translateY(0); }
}

.np-avatars { display: inline-flex; }
.np-avatar {
  width: 25px; height: 25px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px rgba(88, 101, 242, 0.25);
}
.np-avatar + .np-avatar { margin-left: -10px; }

/* Merged status bar: [new posts | · | typing]. SEMPRE renderizada na feed com
   altura fixa — a timeline nunca pula quando algo aparece/some. Grid de colunas
   fixas: cada metade ancora em direção ao ponto central, então a posição do
   texto não se move conforme muda quem está digitando. A barra INTEIRA é
   clicável para atualizar quando há posts novos. */
.feed-bar {
  position: sticky;
  top: 76px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 44px;
  box-sizing: border-box;
  margin: 0 0 12px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 600;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.feed-bar.is-idle { border-color: rgba(255, 255, 255, 0.05); background: rgba(255, 255, 255, 0.015); }
.feed-bar.has-new { cursor: pointer; background: linear-gradient(rgba(88, 101, 242, 0.08), rgba(88, 101, 242, 0.08)), var(--surface); }
.feed-bar.has-new:hover {
  border-color: var(--blurple);
  background: linear-gradient(rgba(88, 101, 242, 0.16), rgba(88, 101, 242, 0.16)), var(--surface);
}
.feed-bar-inner {
  display: inline-flex; align-items: center; gap: 10px;
  min-width: 0; overflow: hidden; white-space: nowrap;
  pointer-events: none; /* o clique é da barra inteira */
}
.feed-bar-label { overflow: hidden; text-overflow: ellipsis; }
/* Azul (convite a clicar) só quando há posts novos; só digitação fica neutro. */
.feed-bar.has-new .feed-bar-label { color: var(--blurple-hi); }
.feed-bar:not(.has-new) .feed-bar-label { color: var(--muted); }
.typing-label { font-weight: 600; }
/* Animated three dots */
.typing-dots { display: inline-flex; gap: 3px; align-items: flex-end; height: 1em; }
.typing-dots span {
  width: 4px; height: 4px; border-radius: 50%;
  background: currentColor; opacity: 0.35;
  animation: typingBlink 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBlink {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .feed-bar { animation: none; }
  .typing-dots span { animation: none; opacity: 0.6; }
}

.post {
  display: flex;
  gap: 12px;
  padding: 16px 4px;
  border-bottom: 1px solid var(--line);
  position: relative; /* anchors the "…" menu */
}
.post-body { min-width: 0; flex: 1; }

/* Footer: votes + reply */
/* Every footer child is a 30px-tall box with centered contents, so icons,
   the score and the button labels all share one optical centerline. */
.post-footer { display: flex; align-items: center; gap: 18px; margin-top: 10px; }
.post-footer > * { height: 30px; }
.vote-group { display: inline-flex; align-items: center; gap: 6px; }
.vote-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  background: none; border: none; border-radius: 8px;
  color: var(--muted); cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.vote-btn svg, .foot-btn svg { display: block; flex: none; }
.vote-btn:hover { background: var(--surface-2); color: var(--text); }
.vote-up.voted { color: #3ba55d; background: rgba(59, 165, 93, 0.14); }
.vote-down.voted { color: var(--danger); background: rgba(240, 97, 109, 0.14); }
.vote-score { min-width: 14px; display: inline-flex; align-items: center; justify-content: center; text-align: center; font-weight: 700; font-size: 0.9rem; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1; }
.vote-score.pos { color: #3ba55d; }
.vote-score.neg { color: var(--danger); }
.foot-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; font: inherit; font-size: 0.85rem; font-weight: 600;
  color: var(--muted); cursor: pointer; padding: 0 8px; border-radius: 8px; line-height: 1;
  transition: background 0.12s ease, color 0.12s ease;
}
.foot-btn:hover { background: var(--surface-2); color: var(--text); }

/* "…" menu (top-right of each post) */
.post-menu { position: absolute; top: 12px; right: 4px; }
.post-menu-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  background: none; border: none; border-radius: 8px;
  color: var(--muted); cursor: pointer;
}
.post-menu-btn:hover { background: var(--surface-2); color: var(--text); }
.post-menu-drop {
  position: absolute; top: 34px; right: 0; z-index: 30;
  min-width: 150px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.menu-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: none; border-radius: 8px;
  background: none; font: inherit; font-size: 0.9rem; font-weight: 600;
  color: var(--text); text-align: left; cursor: pointer;
}
.menu-row:hover { background: var(--surface-2); }
.menu-row.danger { color: var(--danger); }
.menu-row.danger:hover { background: rgba(240, 97, 109, 0.12); }
.menu-row svg { flex: none; color: var(--muted); }
.menu-row.danger svg { color: var(--danger); }

/* ----- "See replies" button ----- */
.see-replies { gap: 8px; }
.see-replies.hidden { display: none; }
.sr-avatars { display: inline-flex; align-items: center; }
.sr-icon { display: inline-flex; margin-right: 6px; }
.sr-avatar {
  width: 18px; height: 18px; border-radius: 50%;
  object-fit: cover; background: var(--surface-2);
  border: 2px solid var(--surface);
}
.sr-avatar + .sr-avatar { margin-left: -7px; }

/* ----- inline reply composer ----- */
.reply-box { display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; }
.reply-box.hidden { display: none; }
.reply-input {
  flex: 1; min-height: 38px; max-height: 140px; overflow-y: auto;
  padding: 9px 12px; font-size: 0.9rem;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
}
.reply-input:focus { outline: none; border-color: var(--blurple); }

/* ----- replies thread: compact rows, smaller type, no votes ----- */
.post-replies {
  margin-top: 10px; padding-left: 14px;
  border-left: 2px solid var(--line);
  display: flex; flex-direction: column;
}
.post-replies.hidden { display: none; }
.reply { display: flex; gap: 8px; padding: 6px 0; position: relative; }
.reply + .reply { border-top: 1px solid rgba(255, 255, 255, 0.04); }
.reply-avatar { width: 26px; height: 26px; border-radius: 50%; flex: none; object-fit: cover; background: var(--surface-2); }
.reply-body { min-width: 0; flex: 1; }
.reply-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.reply-name { color: var(--text); font-weight: 700; font-size: 0.84rem; text-decoration: none; }
.reply-name:hover { text-decoration: underline; }
.reply-handle, .reply-time { color: var(--muted); font-size: 0.75rem; }
.reply-content { font-size: 0.88rem; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.reply-loading { padding: 8px 0; color: var(--muted); font-size: 0.85rem; }
/* "Responder" pequeno em cada resposta (não aninha — só pré-preenche a menção) */
.reply-foot { margin-top: 2px; }
.foot-btn.reply-sm { padding: 2px 6px; font-size: 0.78rem; height: auto; }
.foot-btn.reply-sm svg { width: 13px; height: 13px; }
/* Pill "N novas respostas" dentro da thread aberta (não fecha a thread) */
.new-replies-pill {
  align-self: flex-start; margin: 8px 0 2px; padding: 5px 12px;
  background: rgba(88, 101, 242, 0.14); color: var(--blurple);
  border: 1px solid rgba(88, 101, 242, 0.35); border-radius: 999px;
  font: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer;
  transition: background 0.12s ease;
}
.new-replies-pill:hover { background: rgba(88, 101, 242, 0.24); }
.new-replies-pill.hidden { display: none; }
.reply-menu { position: static; margin-left: auto; }
.reply-menu .post-menu-btn { width: 24px; height: 24px; }
.reply-menu .post-menu-drop { top: 26px; }
.reply .post-menu-drop { right: 0; }
.post-avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; object-fit: cover; background: var(--surface-2); }
.post-body { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.post-name { color: var(--text); font-weight: 700; text-decoration: none; }
.post-name:hover { text-decoration: underline; }
.post-handle, .post-time, .post-dot { color: var(--muted); font-size: 0.88rem; text-decoration: none; }
a.post-time:hover { text-decoration: underline; }  /* permalink affordance */
.post-edited { color: var(--muted); font-size: 0.78rem; }
/* Permalink / single-post view */
.back-to-feed {
  display: inline-block; margin-bottom: 12px; color: var(--muted);
  font-size: 0.9rem; font-weight: 600; text-decoration: none;
}
.back-to-feed:hover { color: var(--text); }
.post-single { border-color: var(--blurple); }
.post-content { margin-top: 4px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.post-deleted { color: var(--muted); font-style: italic; }
.mention { color: var(--blurple-hi); text-decoration: none; font-weight: 500; }
.mention:hover { text-decoration: underline; }

.post-actions { display: flex; gap: 16px; margin-top: 8px; }
.linkbtn {
  border: none; background: none; padding: 0;
  color: var(--muted); font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.linkbtn:hover { color: var(--text); }
.linkbtn.danger:hover { color: var(--danger); }

.edit-input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  margin-top: 6px;
  min-height: 72px;
}
.edit-bar { display: flex; gap: 8px; margin-top: 8px; }
.btn-sm { width: auto; margin-top: 0; padding: 8px 16px; font-size: 0.85rem; }

/* --------------------------- avatar menu --------------------------------- */
.avatarbtn {
  width: 42px; height: 42px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%;
  overflow: hidden; background: var(--surface); cursor: pointer;
}
.avatarbtn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.panel-sm { width: 200px; }
.menu-item {
  display: block; width: 100%; text-align: left;
  padding: 12px 16px; border: none; background: none;
  color: var(--text); font: inherit; font-size: 0.9rem; cursor: pointer; text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.menu-item:last-child { border-bottom: none; }
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--danger); }

/* ----------------------- live notification toasts ------------------------ */
.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(340px, calc(100vw - 36px));
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--blurple);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  opacity: 0;
  transform: translateX(16px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  flex: none;
  object-fit: cover;
  background: var(--surface);
}
.toast-text { font-size: 0.9rem; line-height: 1.35; }

@media (prefers-reduced-motion: reduce) {
  .toast { transition: opacity 0.2s ease; transform: none; }
  .toast.show { transform: none; }
}

/* ------------------------------ stories ---------------------------------- */
/* green + button in the top bar */
.addbtn {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: #43b581;
  color: #fff;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.05s ease;
}
.addbtn:hover { background: #3ca374; }
.addbtn:active { transform: translateY(1px); }

/* create-story form */
.story-form { max-width: 520px; text-align: left; }
.story-form h1 { text-align: left; }
.story-form .muted { margin-bottom: 18px; }
.cover-drop {
  display: grid; place-items: center;
  width: 180px; aspect-ratio: 2 / 3;
  margin: 0 0 18px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  cursor: pointer;
  overflow: hidden;
  position: relative;
}
.cover-drop:hover { border-color: var(--blurple); }
.cover-preview { width: 100%; height: 100%; object-fit: cover; }
.drop-hint { color: var(--muted); font-size: 0.85rem; padding: 0 12px; text-align: center; }
.field-input {
  width: 100%;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}
.field-input:focus { outline: none; border-color: var(--blurple); }
textarea.field-input { resize: vertical; line-height: 1.5; }
.tag-fields { display: flex; flex-direction: column; }

/* tag autocomplete rows (reuses .mention-pop container) */
.tag-suggest {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 9px 12px;
  border: none; background: none; cursor: pointer; text-align: left;
  border-bottom: 1px solid var(--line);
}
.tag-suggest:last-child { border-bottom: none; }
.tag-suggest:hover { background: var(--surface-2); }
.tag-suggest-name { color: var(--text); font-size: 0.9rem; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; }
.tag-suggest-badge {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: #e0a53d; background: rgba(224, 165, 61, 0.14); padding: 2px 6px; border-radius: 5px;
}
.tag-suggest-count { color: var(--muted); font-size: 0.78rem; flex: none; }

/* tags shown on the story page — the author's exact strings (§4.3) */
.story-tags .tag-group { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.tag-group-label { flex: none; width: 110px; color: var(--muted); font-size: 0.8rem; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.work-tag {
  display: inline-block; padding: 4px 10px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2); color: var(--text); font-size: 0.85rem;
  text-decoration: none; transition: border-color 0.15s, color 0.15s;
}
a.work-tag:hover { border-color: var(--blurple); color: var(--blurple-hi); }
.work-tag-wrap { display: inline-flex; align-items: center; gap: 2px; }
.work-tag-report {
  border: none; background: none; cursor: pointer; padding: 2px 4px;
  color: var(--muted); font-size: 0.8rem; line-height: 1; border-radius: 6px;
}
.work-tag-report:hover { color: var(--danger); }
.work-tag-report:disabled { color: var(--muted); cursor: default; opacity: 0.6; }

/* stories-list search bar + filter panel */
.stories-search { margin-bottom: 22px; }
.search-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 8px 18px;
  border-radius: 16px;
  background: rgba(20, 21, 27, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: border-color 0.15s ease;
}
.search-bar:focus-within { border-color: rgba(111, 123, 247, 0.55); }
.search-icon { color: var(--muted); line-height: 0; flex: none; }
.search-icon svg { width: 18px; height: 18px; }
.search-input {
  flex: 1; min-width: 0;
  border: none; background: none; outline: none;
  color: var(--text); font: inherit; font-size: 0.98rem;
  padding: 8px 0;
}
.search-input::placeholder { color: var(--muted); opacity: 0.75; }
.filter-btn {
  display: inline-flex; align-items: center; gap: 7px;
  flex: none;
  padding: 9px 15px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: none;
  color: var(--text); font: inherit; font-size: 0.9rem; font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.filter-btn:hover { background: rgba(255, 255, 255, 0.06); }
.filter-btn svg { width: 16px; height: 16px; }
.filter-badge {
  display: inline-grid; place-items: center;
  min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 999px;
  background: var(--blurple); color: #fff;
  font-size: 0.72rem; font-weight: 700;
}
.search-go { width: auto; margin-top: 0; flex: none; border-radius: 11px; }

.filter-panel {
  margin-top: 10px;
  padding: 20px;
  border-radius: 16px;
  background: rgba(20, 21, 27, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(12px);
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}
.filter-field { display: flex; flex-direction: column; gap: 7px; }
.filter-field .field-input { margin-bottom: 0; }
.filter-label {
  font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--muted);
}
.filter-field-exclude .filter-label { color: var(--danger); }
.filter-field-exclude .field-input:focus { border-color: var(--danger); }
.filter-actions { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
.filter-actions .btn-sm { width: auto; margin-top: 0; }
.filter-hint { color: var(--muted); font-size: 0.8rem; margin-left: auto; }
.stories-clear { color: var(--muted); text-decoration: underline; font-size: 0.85rem; }
.stories-clear:hover { color: var(--text); }

/* active filter chips */
.active-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: -6px 0 20px; }
.afilter {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 12px 4px 6px;
  border-radius: 999px;
  background: rgba(88, 101, 242, 0.13);
  border: 1px solid rgba(111, 123, 247, 0.35);
  color: #c3caff; font-size: 0.84rem; font-weight: 600;
}
.afilter-kind {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(88, 101, 242, 0.25);
  font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.afilter:not(:has(.afilter-kind)) { padding-left: 12px; }
.afilter-not { background: rgba(240, 97, 109, 0.1); border-color: rgba(240, 97, 109, 0.4); color: #f4a2a9; }
.afilter-not .afilter-kind { background: rgba(240, 97, 109, 0.22); }

/* result sections: exact matches vs related */
.results-section { margin-top: 30px; }
.results-head { display: flex; align-items: baseline; gap: 10px; }
.results-title {
  margin: 0;
  font-size: 1.15rem; font-weight: 800; letter-spacing: -0.01em;
}
.results-count {
  padding: 1px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 0.78rem; font-weight: 700;
}
.results-sub { margin: 5px 0 16px; color: var(--muted); font-size: 0.87rem; }
.results-more { margin: 14px 0 0; color: var(--muted); font-size: 0.84rem; }
.results-related { margin-top: 42px; padding-top: 28px; border-top: 1px solid var(--line); }
.results-related .results-title { color: #c3caff; }

@media (max-width: 700px) {
  .filter-grid { grid-template-columns: 1fr; }
  .search-bar { flex-wrap: wrap; padding: 10px; }
  .search-input { flex-basis: 100%; order: -1; padding: 6px 8px; }
}

/* single story page (view + edit share this layout) */
html, body { overflow-x: clip; } /* lets the full-bleed backdrop span the viewport without a scrollbar */

.story-page { position: relative; z-index: 1; width: 100%; max-width: var(--page-w); align-self: start; text-align: left; }

/* full-bleed blurred cover backdrop behind the hero (the "movie page" look) */
.story-backdrop, .story-veil {
  position: absolute; top: -84px; left: 50%; width: 100vw; margin-left: -50vw;
  height: 560px; z-index: 0; pointer-events: none;
}
.story-backdrop {
  background-size: cover; background-position: center 22%;
  filter: blur(52px) saturate(1.3);
  opacity: 0.5;
  transform: scale(1.12);
  -webkit-mask-image: linear-gradient(to bottom, #000 45%, transparent 98%);
  mask-image: linear-gradient(to bottom, #000 45%, transparent 98%);
}
.story-veil {
  background: linear-gradient(
    to bottom,
    rgba(11, 11, 15, 0.45) 0%,
    rgba(11, 11, 15, 0.74) 52%,
    var(--bg) 92%
  );
}

.story-hero {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 42px;
  align-items: start;
  padding-top: 28px;
}
/* view mode: cover | info | rating rail */
.story-hero.has-rating { grid-template-columns: 250px minmax(0, 1fr) 280px; gap: 40px; }
.story-cover {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid; place-items: center;
  box-shadow: 0 26px 64px rgba(0, 0, 0, 0.62);
}
.story-cover.editable { cursor: pointer; }
.story-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* when a cover exists, show it whole at its own aspect ratio — no crop/zoom */
.story-cover.has-image { aspect-ratio: auto; background: transparent; }
.story-cover.has-image img { height: auto; object-fit: contain; }
.cover-fallback { font-size: 3.4rem; font-weight: 700; color: var(--muted); }

/* Grid areas so uma capa LARGA (600x400) possa subir pra cima do título. */
.story-hero { grid-template-areas: "cover main"; }
.story-hero.has-rating { grid-template-areas: "cover main rating"; }
.story-hero > .story-cover { grid-area: cover; }
.story-hero > .story-main { grid-area: main; }
.story-hero > .rating-panel { grid-area: rating; }
/* capa larga → vira um banner acima do título (ocupa mais espaço) */
.story-hero.wide-cover { grid-template-columns: minmax(0, 1fr); grid-template-areas: "cover" "main"; }
.story-hero.has-rating.wide-cover {
  grid-template-columns: minmax(0, 1fr) 280px;
  grid-template-areas: "cover cover" "main rating";
}
.story-cover.cover-wide { aspect-ratio: 3 / 2; width: 100%; max-width: 660px; justify-self: start; }
.story-cover.cover-wide.has-image { aspect-ratio: 3 / 2; background: var(--surface-2); }
.story-cover.cover-wide img { width: 100%; height: 100%; object-fit: cover; }
.cover-hint {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 9px; text-align: center;
  background: rgba(0, 0, 0, 0.62); color: #fff; font-size: 0.8rem;
}

.story-main { min-width: 0; padding-top: 6px; }
.story-titlerow { display: flex; align-items: center; gap: 14px; }
.story-title {
  margin: 0;
  font-family: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-size: 2.7rem; line-height: 1.06; letter-spacing: -0.01em;
}
.pencil {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.pencil:hover { color: var(--text); background: var(--surface-2); border-color: #3a3e48; }
.pencil svg { width: 18px; height: 18px; }

.story-meta { display: flex; align-items: center; gap: 10px; margin-top: 18px; color: var(--muted); font-size: 0.95rem; }
.story-author-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--surface-2); flex: none; }
.story-by-link { color: var(--text); text-decoration: none; font-weight: 600; }
.story-by-link:hover { color: var(--blurple-hi); }
.story-dot { opacity: 0.55; }

.story-section { margin-top: 30px; }
.story-label {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 12px;
}
.story-synopsis {
  margin: 0; max-width: 62ch;
  font-size: 1.05rem; line-height: 1.72; color: #d6dae2;
  white-space: pre-wrap; word-wrap: break-word;
}
.story-title-input {
  width: 100%;
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: 2.2rem; font-weight: 700; letter-spacing: -0.01em;
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(20, 21, 26, 0.72); color: var(--text);
}
.story-synopsis-input {
  width: 100%; min-height: 180px; padding: 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(20, 21, 26, 0.72); color: var(--text);
  font: inherit; font-size: 1.02rem; line-height: 1.7; resize: vertical;
}
.story-title-input:focus, .story-synopsis-input:focus { outline: none; border-color: var(--blurple); }

/* chapters + edit footer */
.story-chapters { position: relative; z-index: 1; margin-top: 44px; padding-top: 26px; border-top: 1px solid var(--line); }
/* Two-column split (view mode): capítulos à esquerda, resenhas à direita. */
.story-columns {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 34px; margin-top: 40px;
}
.story-columns .story-chapters,
.story-columns .story-reviews {
  margin-top: 0; padding-top: 26px; border-top: 1px solid var(--line);
}
.story-columns .story-chapters { min-width: 0; }
.story-columns .story-reviews { min-width: 0; }
@media (max-width: 900px) {
  .story-columns { grid-template-columns: 1fr; gap: 0; }
  .story-columns .story-reviews { margin-top: 8px; }
}
.story-chapters-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.story-chapters-head .story-label { margin-bottom: 0; }
.story-chapters-head .btn-sm { width: auto; margin-top: 0; }
.chapters-empty {
  padding: 30px; text-align: center;
  color: var(--muted); font-size: 0.95rem;
  border: 1px dashed var(--line); border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}
.story-editbar { position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; margin-top: 22px; }
.story-editbar .btn-sm { width: auto; margin-top: 0; }

/* Celular (e phablets/landscape): CAPA SEMPRE ACIMA DO TÍTULO — uma coluna
   só, e as ÁREAS também colapsam (senão o grid mantém as colunas nomeadas e
   o conteúdo espreme/sobrepõe). */
@media (max-width: 768px) {
  .story-hero, .story-hero.wide-cover {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "cover" "main";
    gap: 24px;
  }
  .story-hero.has-rating, .story-hero.has-rating.wide-cover {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "cover" "main" "rating";
  }
  .story-hero.has-rating .rating-panel { max-width: none; width: 100%; }
  .story-cover { max-width: 220px; justify-self: start; }
  .story-title { font-size: 2.1rem; }
}

/* ===== stars & ratings (story page; data is a design mockup for now) ===== */
:root { --star: #f6c453; --star-dim: rgba(255, 255, 255, 0.16); }

.stars { display: inline-flex; gap: 2px; line-height: 0; }
.star {
  position: relative;
  width: 1em; height: 1em;
  font-size: 17px;
  display: inline-block;
  color: var(--star-dim);
}
.star svg { width: 1em; height: 1em; fill: currentColor; display: block; }
.star-fill {
  position: absolute; inset: 0;
  overflow: hidden;
  color: var(--star);
  filter: drop-shadow(0 0 6px rgba(246, 196, 83, 0.35));
}
.stars-sm .star { font-size: 13px; }

/* interactive-looking picker */
.stars-pick { gap: 4px; }
.star-btn {
  border: none; background: none; padding: 0; margin: 0;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.22);
  transition: color 0.12s ease, transform 0.12s ease;
}
.star-btn.is-hot { color: var(--star); transform: scale(1.12); filter: drop-shadow(0 0 8px rgba(246, 196, 83, 0.45)); }

/* rating strip under the byline */
.story-rating-strip {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px;
}
.story-rating-strip .star { font-size: 19px; }
.strip-avg { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; }
.strip-count { color: var(--muted); font-size: 0.88rem; }

/* rating rail (right column of the hero) */
.rating-panel {
  position: relative;
  padding: 22px 22px 18px;
  border-radius: 18px;
  background: rgba(20, 21, 27, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
.rating-headline { display: flex; align-items: center; gap: 14px; margin-top: 2px; }
.rating-avg {
  font-family: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-size: 3rem; font-weight: 700; line-height: 1;
  letter-spacing: -0.02em;
}
.rating-headline-right { display: flex; flex-direction: column; gap: 6px; }
.rating-count { color: var(--muted); font-size: 0.82rem; }

.rating-histo { margin-top: 18px; display: flex; flex-direction: column; gap: 7px; }
.histo-row {
  display: grid;
  grid-template-columns: 26px 1fr 34px;
  align-items: center;
  gap: 10px;
}
.histo-star { color: var(--muted); font-size: 0.75rem; text-align: right; }
.histo-bar {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.histo-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #d99a2b, var(--star));
}
.histo-pct { color: var(--muted); font-size: 0.72rem; }

.rate-box {
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.rate-box-label { color: var(--muted); font-size: 0.86rem; font-weight: 600; }
.rate-box .star-btn { font-size: 21px; }

/* tagline — italic serif lead-in above the synopsis */
.story-tagline {
  margin: 2px 0 10px;
  font-family: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-style: italic;
  font-size: 1.22rem;
  color: #cdd3ea;
  letter-spacing: 0.01em;
}

/* ===== reviews (design mockup) ===== */
.story-reviews {
  position: relative; z-index: 1;
  margin-top: 44px; padding-top: 26px;
  border-top: 1px solid var(--line);
}
.reviews-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; }
.reviews-head .story-label { margin-bottom: 0; }
.mock-note {
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid rgba(246, 196, 83, 0.35);
  color: var(--star);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.review-composer {
  display: flex; gap: 14px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 22px;
}
.review-composer-body { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.review-composer .star-btn { font-size: 19px; }
.review-input { color: var(--muted); font-size: 0.94rem; opacity: 0.75; }

.review { display: flex; gap: 14px; padding: 16px 2px; }
.review + .review { border-top: 1px solid rgba(255, 255, 255, 0.06); }
.review-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  flex: none;
}
.review-body { min-width: 0; flex: 1; }
.review-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.review-name { font-weight: 700; font-size: 0.95rem; color: var(--text); text-decoration: none; }
.review-name:hover { text-decoration: underline; }
.review-when { color: var(--muted); font-size: 0.8rem; }
.review-text {
  margin: 7px 0 0;
  color: #d6dae2;
  font-size: 0.97rem;
  line-height: 1.65;
  max-width: 72ch;
}

/* ===== live ratings/reviews: picker selection, actions, composer ===== */
.star-btn.is-on { color: var(--star); }
.strip-empty { color: var(--muted); font-size: 0.9rem; }

/* rate box now holds label + picker (+ optional remove / login) */
.rate-box { flex-wrap: wrap; }
.rate-clear {
  border: none; background: none; padding: 0; cursor: pointer;
  color: var(--muted); font-size: 0.78rem; text-decoration: underline;
}
.rate-clear:hover { color: var(--text); }
.rate-login { color: var(--star); font-size: 0.84rem; font-weight: 700; text-decoration: none; }
.rate-login:hover { text-decoration: underline; }

/* classic action buttons under "Avalie esta história": like + add to list */
.story-actions {
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex; gap: 10px; flex-wrap: wrap;
}
.action-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text); font: inherit; font-size: 0.86rem; font-weight: 700;
  cursor: pointer; transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.action-btn svg { display: block; flex: none; }
.action-btn:hover { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.28); }
.action-count {
  min-width: 1.2em; text-align: center;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.like-btn.is-on {
  color: #ff5a7a; border-color: rgba(255, 90, 122, 0.5);
  background: rgba(255, 90, 122, 0.12);
}
.like-btn.is-on svg { fill: #ff5a7a; }
.like-btn.is-on .action-count { color: #ff5a7a; }

/* composer is now a real input (stars + textarea + submit) */
.review-composer { border-style: solid; }
textarea.review-input {
  width: 100%; resize: vertical; min-height: 64px;
  padding: 10px 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text); font: inherit; font-size: 0.94rem; line-height: 1.5;
  opacity: 1;
}
textarea.review-input:focus { outline: none; border-color: var(--blurple); }
.review-actions { display: flex; justify-content: flex-end; }
.review-actions .btn-sm { width: auto; margin-top: 0; }
.reviews-count { color: var(--muted); font-size: 0.9rem; font-weight: 600; }
.reviews-login, .reviews-empty { color: var(--muted); font-size: 0.92rem; padding: 6px 0 2px; }

/* "digitando resenha" bar (TL-style) at the top of the reviews list */
.reviews-typing {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 14px; padding: 8px 12px;
  border-radius: 999px;
  background: rgba(88, 101, 242, 0.08);
  border: 1px solid rgba(88, 101, 242, 0.22);
  color: var(--muted); font-size: 0.85rem;
}
.reviews-typing.hidden { display: none; }
.reviews-typing-text { font-weight: 600; }
.reviews-typing .np-avatars { display: inline-flex; }

/* upvote/downvote row under each review (reuses .vote-group/.vote-btn/.vote-score) */
.review-foot { margin-top: 8px; display: flex; align-items: center; gap: 12px; }
/* "Excluir" da sua própria resenha: botão-texto discreto, empurrado pra direita;
   vira vermelho no hover, como o "Excluir" do menu de publicações. */
.review-del {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  padding: 4px 6px;
  font: inherit;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}
.review-del svg { width: 15px; height: 15px; }
.review-del:hover { color: var(--danger); background: rgba(240, 97, 109, 0.1); }
.review-del:disabled { opacity: 0.5; cursor: default; }

/* logged-out chapter preview: fade the last paragraphs, then a login invite */
.chapter-body.is-preview {
  position: relative;
  max-height: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
}
.chapter-paywall {
  max-width: 460px; margin: -20px auto 40px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 26px 22px; position: relative; z-index: 2;
}
.chapter-paywall-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.01em; }
.chapter-paywall-sub { margin: 0; color: var(--muted); line-height: 1.6; }
.chapter-paywall .hero-btn { margin-top: 8px; }

/* Tablet (769–1060px): painel de nota desce pra linha própria, capa ainda ao
   lado do texto. FAIXA fechada de propósito: abaixo de 769px quem manda é o
   bloco mobile (capa acima do título) — este bloco vem depois no arquivo e,
   sem o min-width, venceria a cascata no celular e quebraria o empilhamento. */
@media (min-width: 769px) and (max-width: 1060px) {
  .story-hero.has-rating {
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-areas: "cover main" "rating rating";
  }
  .story-hero.has-rating.wide-cover {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "cover" "main" "rating";
  }
  .story-hero.has-rating .rating-panel { max-width: 460px; }
}

/* stories list */
.stories-page { width: 100%; max-width: var(--page-w); align-self: start; text-align: left; }
.stories-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 22px; }
.stories-head h1 { margin: 0; }
.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 22px;
}
/* Cada card ocupa DUAS faixas do grid (capa | texto) via subgrid: capas de
   proporções diferentes (retrato 2:3 e larga 3:2) dividem a mesma linha e os
   títulos nascem todos na mesma altura — sem cortar nenhuma capa. */
.story-card {
  display: grid;
  grid-row: span 2;
  grid-template-rows: subgrid;
  row-gap: 8px;
  align-content: start;
  text-decoration: none; color: var(--text);
}
.story-card > * { min-width: 0; }
@supports not (grid-template-rows: subgrid) {
  .story-card { display: flex; flex-direction: column; gap: 8px; }
}
.story-card-cover {
  aspect-ratio: 2 / 3;
  align-self: end; /* "estante": capas de alturas diferentes alinham pela base */
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  transition: border-color 0.15s ease, transform 0.12s ease;
}
.story-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.story-card:hover .story-card-cover { border-color: var(--blurple); transform: translateY(-3px); }
.story-card-title { font-weight: 700; font-size: 0.95rem; line-height: 1.3; }
.story-card-author { color: var(--muted); font-size: 0.82rem; }
/* card de capa LARGA ocupa 2 colunas do grid pra a capa caber sem distorcer */
.story-card--wide { grid-column: span 2; }
.story-card--wide .story-card-cover { aspect-ratio: 3 / 2; }
@media (max-width: 380px) { .story-card--wide { grid-column: span 1; } }

/* ===== profile page (Letterboxd-style) ===== */
.profile-page { width: 100%; max-width: var(--page-w); align-self: start; text-align: left; }
.profile-page.hidden { display: none !important; }
.profile-empty { color: var(--muted); font-size: 0.9rem; padding: 6px 2px; }

/* Banner: capa desfocada que dissolve no fundo — sem borda nem caixa visível. */
.pf-banner { position: relative; height: 360px; overflow: hidden; }
.pf-banner-img { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0.9; }
/* Dissolve nos 4 lados até o fundo da página (sem caixa/borda). */
.pf-banner-fade {
  position: absolute; inset: 0;
  background:
    linear-gradient(to bottom, rgba(11, 11, 15, 0) 30%, rgba(11, 11, 15, 0.62) 74%, var(--bg) 100%),
    linear-gradient(to top, rgba(11, 11, 15, 0) 72%, var(--bg) 100%),
    linear-gradient(to right, rgba(11, 11, 15, 0) 86%, var(--bg) 100%),
    linear-gradient(to left, rgba(11, 11, 15, 0) 86%, var(--bg) 100%);
}
/* Edição da capa (dono): botão trocar + arrastar pra reposicionar. */
.pf-banner-editable { cursor: grab; }
.pf-banner-editable.is-dragging { cursor: grabbing; }
.pf-banner-btn {
  position: absolute; top: 16px; right: 16px; z-index: 3;
  background: rgba(0, 0, 0, 0.55); color: #fff; border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px; padding: 7px 12px; font: inherit; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; opacity: 0; transition: opacity 0.15s ease;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.pf-banner-editable:hover .pf-banner-btn { opacity: 1; }
.pf-banner-btn:hover { background: rgba(0, 0, 0, 0.78); }
.pf-banner-hint {
  position: absolute; top: 18px; left: 16px; z-index: 3;
  font-size: 0.76rem; color: rgba(255, 255, 255, 0.9); background: rgba(0, 0, 0, 0.45);
  padding: 5px 10px; border-radius: 7px; opacity: 0; transition: opacity 0.15s ease; pointer-events: none;
}
.pf-banner-editable:hover .pf-banner-hint { opacity: 1; }
/* Edição do avatar (dono): overlay de câmera no hover. */
.pf-avatar-editable { position: relative; cursor: pointer; }
.pf-avatar-cam {
  position: absolute; inset: 4px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.5); color: #fff; opacity: 0; transition: opacity 0.15s ease;
}
.pf-avatar-editable:hover .pf-avatar-cam, .pf-avatar-editable.is-busy .pf-avatar-cam { opacity: 1; }
/* Edição do nome (dono): clicar vira input com autosave. */
.pf-name-editable { cursor: text; border-radius: 6px; transition: background 0.12s ease; }
.pf-name-editable:hover { background: rgba(255, 255, 255, 0.07); box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.07); }
.pf-name-input {
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: 2rem; font-weight: 700; letter-spacing: -0.01em; text-align: center;
  color: var(--text); background: transparent; border: none; border-radius: 0;
  padding: 0; outline: none; width: min(90vw, 520px);
}

/* Identidade centrada, flutuando sobre o banner (sem caixa). */
.pf-identity {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  margin-top: -84px; padding: 0 24px 4px;
}
.pf-avatar-ring {
  width: 132px; height: 132px; border-radius: 50%; padding: 4px;
  background: var(--bg); box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55);
}
.pf-avatar { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.pf-name-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; justify-content: center; }
.pf-name {
  margin: 0; font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: 2rem; font-weight: 700; letter-spacing: -0.01em;
}
.pf-badge {
  font-size: 0.66rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: #fff; background: var(--blurple); padding: 4px 9px; border-radius: 6px;
}
.pf-badge-author { background: rgba(88, 101, 242, 0.16); color: var(--blurple-hi); }
.pf-handle { font-size: 0.92rem; color: var(--muted); margin-top: 6px; }

.pf-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.pf-actions .btn { width: auto; margin-top: 0; }
.pf-actions:empty { display: none; }

.pf-stats {
  display: flex; flex-wrap: wrap; justify-content: center; margin-top: 24px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.pf-stat {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 14px 26px; min-width: 92px;
  background: none; border: none; font: inherit; color: inherit; text-decoration: none; cursor: pointer;
  transition: background 0.12s ease;
}
.pf-stat:hover { background: rgba(255, 255, 255, 0.05); }
.pf-stat.is-active { background: rgba(88, 101, 242, 0.14); }
.pf-stat.is-active .pf-stat-num { color: var(--blurple-hi); }
.pf-stat + .pf-stat { border-left: 1px solid var(--line); }
.pf-stat-num { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.pf-stat-label { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* Seções + grades. Favoritas e Minhas histórias dividem uma linha em duas
   colunas; Avaliações vai embaixo em largura cheia. Capas do tamanho da home
   (~150px), bem menores que o grid 4-col anterior. */
.pf-main { display: flex; flex-direction: column; gap: 40px; margin-top: 36px; }
.pf-columns { display: flex; flex-wrap: wrap; gap: 40px; align-items: flex-start; }
.pf-columns > .pf-section { flex: 1 1 420px; min-width: 0; }
.pf-section { min-width: 0; }
.pf-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding-bottom: 12px; margin-bottom: 18px; border-bottom: 1px solid var(--line);
}
.pf-head-title {
  margin: 0; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
}
.pf-head-more { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; color: var(--muted); text-decoration: none; }
.pf-head-more:hover { color: var(--text); }

.pf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); align-items: start; gap: 18px 14px; }
.pf-columns .pf-grid { grid-template-columns: repeat(4, 1fr); }
.pf-book { position: relative; min-width: 0; display: flex; flex-direction: column; gap: 7px; text-decoration: none; }
.pf-book-link { display: block; text-decoration: none; }
.pf-cover {
  width: 100%; aspect-ratio: 2 / 3; border-radius: 8px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line);
  display: grid; place-items: center; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
a.pf-book:hover .pf-cover, .pf-book-link:hover .pf-cover { transform: translateY(-4px); border-color: var(--blurple); }
.pf-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-cover .cover-fallback { font-size: 1.7rem; color: var(--muted); }
.pf-book-title {
  font-size: 0.84rem; font-weight: 600; line-height: 1.25; color: var(--text);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.pf-book-author { font-size: 0.74rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-book-remove {
  position: absolute; top: 7px; right: 7px; z-index: 2;
  width: 24px; height: 24px; border-radius: 50%; border: none;
  background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 0.75rem; cursor: pointer;
  opacity: 0; transition: opacity 0.15s ease;
}
.pf-book:hover .pf-book-remove { opacity: 1; }
.pf-book-remove:hover { background: var(--danger); }
.pf-review-foot { display: flex; align-items: center; min-height: 15px; }
.pf-review .stars-sm { font-size: 12px; }
.pf-add {
  aspect-ratio: 2 / 3; border: 1px dashed var(--line); border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer; font: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
}
.pf-add:hover { border-color: var(--blurple); color: var(--text); }
.pf-add-plus { font-size: 1.7rem; font-weight: 300; line-height: 1; }
.pf-add-label { font-size: 0.7rem; padding: 0 8px; }
/* seletor de favorito abre mais largo que o slot de 150px */
.pf-grid .fav-picker { grid-column: 1 / -1; width: auto; max-width: 360px; }

/* Histórico de leitura: grade densa de capinhas (estilo "watched"). */
.pf-read-count { font-size: 0.78rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.pf-read-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 14px 10px; }
.pf-read { display: flex; flex-direction: column; gap: 5px; text-decoration: none; min-width: 0; }
.pf-read-cover {
  width: 100%; aspect-ratio: 2 / 3; border-radius: 6px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line);
  display: grid; place-items: center; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.pf-read:hover .pf-read-cover { transform: translateY(-3px); border-color: var(--blurple); }
.pf-read-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-read-cover .cover-fallback { font-size: 1.1rem; color: var(--muted); }
.pf-read-foot { display: flex; align-items: center; gap: 5px; min-height: 12px; }
.pf-read-foot .stars { font-size: 9px; }
.pf-read-heart { color: var(--danger); display: inline-flex; align-items: center; }

/* Listas sociais (seguidores/seguindo/amigos): grade de perfis + paginação. */
.pf-list-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 26px; padding-top: 8px; }
.pf-list-back { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.92rem; }
.pf-list-back:hover { color: var(--text); }
.pf-list-title { margin: 0; font-family: ui-serif, Georgia, "Times New Roman", serif; font-size: 1.8rem; font-weight: 700; }
.pf-list-count { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.pf-user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 16px 14px; }
.pf-user {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none;
  padding: 16px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.pf-user:hover { transform: translateY(-3px); border-color: var(--blurple); }
.pf-user-av { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: var(--surface-2); flex: none; }
.pf-user-av-fallback { display: grid; place-items: center; font-weight: 700; font-size: 1.6rem; color: var(--muted); }
.pf-user-name { font-size: 0.9rem; font-weight: 600; color: var(--text); text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-user-handle { font-size: 0.76rem; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-list-pager { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 32px; }
.pf-list-pager .btn-sm { width: auto; margin-top: 0; }

@media (max-width: 720px) {
  .pf-banner { height: 220px; }
  .pf-name { font-size: 1.6rem; }
  .pf-stat { padding: 12px 18px; min-width: 0; }
}

/* favorites: 4 slots (empty ones clickable on your own profile) */
.fav-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.fav-slot { position: relative; min-width: 0; }
.fav-cover-link { display: block; }
.fav-cover, .fav-slot-empty {
  aspect-ratio: 2 / 3; border-radius: 9px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line);
  display: grid; place-items: center;
}
.fav-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fav-cover .cover-fallback { font-size: 1.6rem; }
.fav-slot-empty {
  width: 100%; border-style: dashed; color: var(--muted); cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease;
}
.fav-slot-empty:hover { border-color: var(--blurple); color: var(--text); }
.fav-plus { font-size: 1.7rem; font-weight: 300; }
.fav-remove {
  position: absolute; top: 5px; right: 5px;
  width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 6px; cursor: pointer;
  background: rgba(0, 0, 0, 0.62); color: #fff; font-size: 0.68rem;
  opacity: 0; transition: opacity 0.12s ease, background 0.12s ease;
}
.fav-slot:hover .fav-remove { opacity: 1; }
.fav-remove:hover { background: var(--danger); }

/* favorites picker (autofill — só histórias reais) */
.fav-picker { position: relative; min-width: 0; }
.fav-picker-field {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 11px; border-radius: 12px;
  background: var(--surface);
  border: 1px solid rgba(88, 101, 242, 0.65);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.16), 0 12px 30px rgba(0, 0, 0, 0.45);
}
.fav-picker-icon { display: inline-flex; color: var(--muted); flex: none; }
.fav-picker-input {
  flex: 1; min-width: 0; border: none; background: none;
  color: var(--text); font: inherit; font-size: 0.82rem;
}
.fav-picker-input::placeholder { color: var(--muted); }
.fav-picker-input:focus { outline: none; }
.fav-picker-drop {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 45;
  width: max(290px, 100%);
  background: rgba(20, 21, 27, 0.94);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.6);
  max-height: 300px; overflow-y: auto; padding: 6px;
}
.fav-pick-head {
  padding: 8px 10px 5px;
  font-size: 0.64rem; font-weight: 800;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted);
}
.fav-pick-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 8px 9px; border: none; border-radius: 10px;
  background: none; color: var(--text); /* botões não herdam cor — sem isso o texto some */
  font: inherit; cursor: pointer; text-align: left;
  transition: background 0.1s ease;
}
.fav-pick-item:hover { background: rgba(88, 101, 242, 0.16); }
.fav-pick-cover {
  width: 34px; aspect-ratio: 2 / 3; flex: none; border-radius: 6px; overflow: hidden;
  background: var(--surface-2); border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  display: grid; place-items: center;
}
.fav-pick-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fav-pick-cover .cover-fallback { font-size: 0.85rem; }
.fav-pick-info { min-width: 0; }
.fav-pick-title { font-size: 0.88rem; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-pick-author { font-size: 0.75rem; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-pick-empty { padding: 12px 10px; color: var(--muted); font-size: 0.82rem; }

/* recent reviews (cover + stars below, à la Letterboxd) */
.revs-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.rev-item { display: flex; flex-direction: column; gap: 6px; text-decoration: none; min-width: 0; }
.rev-cover {
  aspect-ratio: 2 / 3; border-radius: 9px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line);
  display: grid; place-items: center;
  transition: border-color 0.12s ease, transform 0.12s ease;
}
.rev-item:hover .rev-cover { border-color: var(--blurple); transform: translateY(-2px); }
.rev-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rev-cover .cover-fallback { font-size: 1.4rem; }
.rev-item .stars { font-size: 12px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 30px; }
.pager .btn-sm { width: auto; margin-top: 0; }

/* --- chapter list on the story page --- */
.switch-row { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 18px; color: var(--muted); font-size: 0.9rem; cursor: pointer; }
.switch {
  appearance: none; -webkit-appearance: none;
  width: 38px; height: 22px; flex: none; position: relative; cursor: pointer;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
  transition: background 0.15s, border-color 0.15s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: var(--muted);
  transition: transform 0.15s, background 0.15s;
}
.switch:checked { background: var(--blurple); border-color: var(--blurple); }
.switch:checked::after { transform: translateX(16px); background: #fff; }

.chapter-rows { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.chapter-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chapter-row:last-child { border-bottom: none; }
.chapter-row:hover { background: rgba(255, 255, 255, 0.02); }
.chapter-row.is-nested { box-shadow: inset 2px 0 0 rgba(88, 101, 242, 0.3); }
.chapter-num { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; min-width: 22px; }
.chapter-draft, .chapter-status.is-draft { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #e0a53d; background: rgba(224, 165, 61, 0.14); padding: 3px 8px; border-radius: 6px; }
.chapter-link { flex: 1; min-width: 0; color: var(--text); text-decoration: none; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-link:hover { color: var(--blurple-hi); }
.chapter-tools { display: flex; align-items: center; gap: 4px; flex: none; }
.chapter-move, .chapter-edit {
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 8px; border: 1px solid var(--line); background: transparent;
  color: var(--muted); cursor: pointer; text-decoration: none;
}
.chapter-move:hover:not(:disabled), .chapter-edit:hover { color: var(--text); background: var(--surface-2); }
.chapter-move:disabled { opacity: 0.35; cursor: default; }

/* --- chapter page (read + edit) --- */
.chapter-page { width: 100%; max-width: 760px; align-self: start; text-align: left; }
.chapter-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.chapter-topbar-right { display: flex; align-items: center; gap: 12px; }
.chapter-topbar-right .btn-sm { width: auto; margin-top: 0; }
.chapter-back { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.92rem; }
.chapter-back:hover { color: var(--text); }
.chapter-head { margin-bottom: 22px; }
.chapter-head .chapter-status { display: inline-block; margin-bottom: 8px; }
.chapter-title { font-family: ui-serif, Georgia, "Times New Roman", serif; font-size: 2.2rem; line-height: 1.15; margin: 0; }
.chapter-status.is-pub { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #43b581; background: rgba(67, 181, 129, 0.14); padding: 3px 8px; border-radius: 6px; }

.chapter-body { font-size: 1.08rem; line-height: 1.78; color: #d6dae2; }
.chapter-body p { margin: 0 0 1em; }
.chapter-body h2 { font-family: ui-serif, Georgia, serif; font-size: 1.5rem; color: var(--text); margin: 1.4em 0 0.5em; }
.chapter-body h3 { font-size: 1.2rem; color: var(--text); margin: 1.2em 0 0.4em; }
.chapter-body blockquote { margin: 1em 0; padding: 6px 16px; border-left: 3px solid var(--blurple); color: var(--muted); font-style: italic; }
.chapter-body ul, .chapter-body ol { margin: 0 0 1em 1.4em; }
.chapter-body li { margin: 0.3em 0; }
.chapter-body a { color: var(--blurple-hi); }
.chapter-body img { max-width: 100%; height: auto; border-radius: 10px; margin: 0.5em 0; display: block; }
.chapter-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); }
.chapter-nav .btn-sm { width: auto; margin-top: 0; }
.chapter-nav .btn-sm:only-child { margin-left: auto; }

/* ===== reading bar: progresso + ETA + presença (Google-Docs-style) ===== */
.reading-bar {
  position: sticky; top: 60px; z-index: 15; /* logo abaixo do topbar fixo (60px) */
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 24px; padding: 12px 4px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
}
.reading-progress {
  flex: 1; height: 6px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.08); overflow: hidden;
}
.reading-progress-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--blurple), var(--blurple-hi));
  transition: width 0.15s ease-out;
}
.reading-meta { color: var(--muted); font-size: 0.8rem; font-weight: 600; white-space: nowrap; flex: none; }
.reading-readers { display: flex; align-items: center; gap: 0; flex: none; }
.reading-readers.hidden { display: none; }
.reader-av {
  width: 26px; height: 26px; border-radius: 50%;
  object-fit: cover; background: var(--surface-2);
  border: 2px solid var(--bg); margin-left: -8px;
}
.reader-av:first-child { margin-left: 0; }
.reader-more { margin-left: 4px; color: var(--muted); font-size: 0.78rem; font-weight: 700; }
.reader-label { margin-left: 8px; color: var(--muted); font-size: 0.76rem; }
@media (max-width: 640px) { .reading-meta { display: none; } }

/* ===== paragraph comment balloons (hover to reveal) =====
   O balão fica num GUTTER reservado dentro do próprio parágrafo (padding-right),
   então o caminho texto→gutter→balão é contínuo: não há vão onde o hover se
   perca, e a área clicável é grande. */
.chapter-body .has-para-comment { position: relative; padding-right: 2.6rem; }
.para-balloon {
  position: absolute; top: 0; right: 0;
  width: 2.3rem; height: 2rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  border: none; border-radius: 9px;
  background: transparent; color: var(--muted); cursor: pointer;
  opacity: 0; transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.para-balloon svg { display: block; }
.has-para-comment:hover .para-balloon,
.para-balloon.has-count { opacity: 1; }
.para-balloon:hover { background: var(--surface-2); color: var(--text); }
.para-balloon.has-count { color: var(--blurple-hi); }
.para-balloon-n { font-size: 0.72rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ===== paragraph comments drawer (right side, like Google Docs) ===== */
.para-drawer {
  position: fixed; top: 0; right: 0; z-index: 60;
  width: min(400px, 92vw); height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.5);
  transform: translateX(100%); transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}
.para-drawer.open { transform: translateX(0); }
.para-drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.para-drawer-title { font-weight: 800; font-size: 1.02rem; letter-spacing: -0.01em; }
.para-drawer-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex: none;
  border: none; background: none; color: var(--muted); cursor: pointer;
  font-size: 1.05rem; line-height: 1; border-radius: 9px;
  transition: background 0.12s ease, color 0.12s ease;
}
.para-drawer-close:hover { background: var(--surface-2); color: var(--text); }
.para-drawer-list { flex: 1; overflow-y: auto; padding: 18px 20px 28px; display: flex; flex-direction: column; gap: 4px; }

/* composer inside the drawer: compact, borderless, sits on a subtle panel */
.para-drawer-list .review-composer {
  gap: 10px; padding: 12px; margin-bottom: 18px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface-2);
}
.para-drawer-list .review-composer .review-avatar { width: 34px; height: 34px; }
.para-drawer-list textarea.review-input { background: var(--surface); min-height: 52px; }

/* comment cards in the drawer: tighter, clean separators */
.para-drawer-list .review { padding: 14px 0; gap: 11px; }
.para-drawer-list .review:first-of-type { padding-top: 4px; }
.para-drawer-list .review-avatar { width: 34px; height: 34px; }
.para-drawer-list .review-text { font-size: 0.92rem; margin-top: 5px; }
.para-drawer-list .reviews-empty { padding: 4px 0 0; }

/* comment vote row + small "excluir" link */
.comment-del {
  border: none; background: none; color: var(--muted); cursor: pointer;
  font-size: 0.78rem; text-decoration: none; margin-left: auto;
  padding: 2px 4px; border-radius: 6px;
}
.comment-del:hover { color: var(--danger); background: rgba(240, 97, 109, 0.1); }
.chapter-comments .review-foot,
.para-drawer-list .review-foot { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.para-drawer-list .vote-btn { width: 26px; height: 26px; }
.para-drawer-list .vote-btn svg { width: 14px; height: 14px; }

/* reference pill on a paragraph comment in the bottom list (jumps to the para) */
.para-ref {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  margin-bottom: 7px; padding: 4px 10px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  font: inherit; font-size: 0.78rem; cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.para-ref:hover { background: rgba(88, 101, 242, 0.14); color: var(--blurple-hi); border-color: rgba(88, 101, 242, 0.4); }
.para-ref svg { flex: none; }
.para-ref-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: italic; }
.para-flash { animation: paraFlash 1.3s ease; border-radius: 6px; }
@keyframes paraFlash { 0%, 100% { background: transparent; } 25% { background: rgba(88, 101, 242, 0.2); } }

/* ========================== editor de capítulo =========================== */
/* Canvas "folha em branco": nenhum input mostra fundo/borda — só o texto,
   como se a página inteira fosse o papel. Grade: canvas + trilho de capítulos
   fixado à direita. */
.chapter-page.is-editing { max-width: 1200px; }
/* Modo edição = foco: esconde o nav global e zera a calha (layout determinístico,
   igual no primeiro acesso e após refresh); a busca do topo volta ao centro. */
body.editing-chapter .home-rail { display: none; }
@media (min-width: 1060px) {
  body.editing-chapter.has-rail .stage { padding-left: 24px; }
}
@media (min-width: 1180px) {
  body.editing-chapter.has-rail .top-search { left: 50%; }
}
/* Cabeçalho do editor fixado na tela (logo abaixo do topbar global de 60px). */
.chapter-page.is-editing .chapter-topbar {
  position: sticky; top: 56px; z-index: 20;
  margin: 0 0 26px; padding: 12px 0;
  background: rgba(12, 13, 18, 0.9);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.editor-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 264px;
  gap: 44px;
  align-items: start;
}
.editor-canvas { min-width: 0; }

.ed-title {
  width: 100%;
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: 2.5rem; font-weight: 700; line-height: 1.15;
  padding: 0; margin: 0 0 6px;
  border: none; background: transparent; color: var(--text);
}
.ed-title:focus { outline: none; }
.ed-title::placeholder { color: rgba(155, 163, 178, 0.45); }

.ed-toolbar {
  display: flex; flex-wrap: wrap; gap: 2px;
  padding: 6px;
  margin: 10px 0 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(18, 20, 27, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: sticky; top: 120px; z-index: 5;
  width: fit-content;
}
.tb {
  min-width: 34px; height: 34px; padding: 0 8px;
  display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 8px; background: transparent;
  color: var(--muted); font: inherit; font-weight: 700; font-size: 0.9rem; cursor: pointer;
}
.tb:hover { color: var(--text); background: var(--surface-2); border-color: var(--line); }

.ed-body {
  min-height: 52vh;
  padding: 4px 0 40px;
}
.wysiwyg-body { outline: none; color: #d6dae2; font-size: 1.08rem; line-height: 1.82; }
.wysiwyg-body:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.wysiwyg-body img { max-width: 100%; height: auto; border-radius: 10px; }
.wysiwyg-body h2 { font-family: ui-serif, Georgia, serif; font-size: 1.5rem; color: var(--text); }
.wysiwyg-body blockquote { margin: 1em 0; padding-left: 14px; border-left: 3px solid var(--blurple); color: var(--muted); font-style: italic; }
.wysiwyg-body ul, .wysiwyg-body ol { margin-left: 1.4em; }
.wysiwyg-body a { color: var(--blurple-hi); cursor: pointer; }

/* Notas do autor no editor: bloco discreto com acento à esquerda, sem fundo. */
.ed-note {
  margin: 6px 0 18px;
  padding: 8px 0 8px 14px;
  border-left: 3px solid rgba(88, 101, 242, 0.45);
}
.ed-note-label {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 4px;
}
.ed-note-input {
  display: block; width: 100%; resize: none; overflow: hidden;
  border: none; background: transparent; color: #c9cede;
  font: inherit; font-size: 0.95rem; line-height: 1.6; padding: 0;
}
.ed-note-input:focus { outline: none; }
.ed-note-input::placeholder { color: rgba(155, 163, 178, 0.4); }
.ed-save { white-space: nowrap; }

/* Trilho de capítulos do editor (fixado à direita, rola junto). */
.editor-rail {
  position: sticky; top: 124px;
  display: flex; flex-direction: column; gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 14px;
  max-height: calc(100vh - 148px);
}
.editor-rail .btn-publish { width: 100%; margin-top: 0; }
.editor-rail-head { display: flex; align-items: baseline; justify-content: space-between; }
.editor-rail-list {
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto; min-height: 0;
}
.rail-ch {
  position: relative;
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px; border-radius: 9px;
  color: var(--muted); font-size: 0.9rem; font-weight: 600;
  border: 1px solid transparent;
}
.rail-ch:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.rail-ch.is-current { background: rgba(88, 101, 242, 0.16); color: var(--text); }
.rail-ch.is-dragging { opacity: 0.4; }
.rail-ch-grip {
  flex: none; display: grid; place-items: center; width: 16px; color: var(--muted);
  cursor: grab; opacity: 0; transition: opacity 0.15s ease;
}
.rail-ch:hover .rail-ch-grip { opacity: 0.6; }
.rail-ch-grip:active { cursor: grabbing; }
.rail-ch-num { flex: none; font-variant-numeric: tabular-nums; font-weight: 700; min-width: 16px; }
.rail-ch-badge {
  flex: none; font-size: 0.62rem; font-weight: 800; min-width: 16px; text-align: center;
  color: #e0a53d; background: rgba(224, 165, 61, 0.14); border-radius: 5px; padding: 2px 0;
}
.rail-ch-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; text-decoration: none; }
.rail-ch-dot { flex: none; color: #e0a53d; font-size: 0.55rem; }
/* Indicadores de soltura: linha antes/depois (irmão) ou caixa (aninhar). */
.rail-ch.drop-before::before,
.rail-ch.drop-after::after {
  content: ''; position: absolute; left: 8px; right: 8px; height: 2px;
  background: var(--blurple-hi); border-radius: 2px;
}
.rail-ch.drop-before::before { top: -1px; }
.rail-ch.drop-after::after { bottom: -1px; }
.rail-ch.drop-inside { border-color: var(--blurple); background: rgba(88, 101, 242, 0.12); }

/* Notas do autor no leitor. */
.author-note {
  margin: 0 0 26px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--blurple);
  border-radius: 10px;
  background: rgba(88, 101, 242, 0.05);
}
.chapter-body + .author-note { margin: 30px 0 0; }
.author-note-label {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.author-note-body { font-size: 0.96rem; line-height: 1.65; color: #c9cede; }
.author-note-body p { margin: 0 0 0.5em; }
.author-note-body p:last-child { margin-bottom: 0; }
.author-note-body a { color: var(--blurple-hi); word-break: break-all; }

/* Estreito: o trilho desce pra baixo do canvas. */
@media (max-width: 980px) {
  .editor-shell { grid-template-columns: minmax(0, 1fr); }
  .editor-rail { position: static; max-height: none; order: 2; }
  .ed-title { font-size: 1.9rem; }
}

/* -------------------------- mention popup -------------------------------- */
.mention-pop {
  position: absolute;
  z-index: 100;
  min-width: 240px;
  max-width: 320px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.mention-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 12px;
  border: none; background: none; cursor: pointer; text-align: left;
  border-bottom: 1px solid var(--line);
}
.mention-item:last-child { border-bottom: none; }
.mention-item:hover { background: var(--surface-2); }
.mention-avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; object-fit: cover; background: var(--surface-2); }
.mention-info { display: flex; flex-direction: column; min-width: 0; }
.mention-name { color: var(--text); font-weight: 600; font-size: 0.88rem; }
.mention-handle { color: var(--muted); font-size: 0.78rem; }

/* ======================= logged-out hero (front page) ====================== */
/* Full-viewport, single view — position:fixed + overflow:hidden = never scrolls. */
.hero {
  position: fixed;
  inset: 0;
  /* Cobre também a calha reservada pelo scrollbar-gutter (o hero não rola),
     pra não sobrar uma faixa do fundo na direita na tela de login. */
  right: auto;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #04050c;
}

/* --- the sky: stars, planet rim, haze, orbit line --- */
.hero-sky { position: absolute; inset: 0; pointer-events: none; }

.hero-stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.6px 1.6px at 12% 28%, rgba(255,255,255,.9), transparent 100%),
    radial-gradient(1.2px 1.2px at 26% 62%, rgba(255,255,255,.6), transparent 100%),
    radial-gradient(1.8px 1.8px at 38% 18%, rgba(255,255,255,.85), transparent 100%),
    radial-gradient(1.1px 1.1px at 47% 74%, rgba(255,255,255,.55), transparent 100%),
    radial-gradient(1.5px 1.5px at 58% 38%, rgba(255,255,255,.8), transparent 100%),
    radial-gradient(1.2px 1.2px at 66% 82%, rgba(255,255,255,.5), transparent 100%),
    radial-gradient(1.9px 1.9px at 74% 22%, rgba(255,255,255,.95), transparent 100%),
    radial-gradient(1.2px 1.2px at 83% 55%, rgba(255,255,255,.6), transparent 100%),
    radial-gradient(1.5px 1.5px at 91% 34%, rgba(255,255,255,.8), transparent 100%),
    radial-gradient(1.1px 1.1px at 7% 84%, rgba(255,255,255,.5), transparent 100%),
    radial-gradient(1.4px 1.4px at 95% 78%, rgba(255,255,255,.65), transparent 100%),
    radial-gradient(1.3px 1.3px at 31% 90%, rgba(255,255,255,.5), transparent 100%);
  animation: twinkle 7s ease-in-out infinite alternate;
}
.hero-stars-2 {
  background-image:
    radial-gradient(1.1px 1.1px at 18% 46%, rgba(200,208,255,.6), transparent 100%),
    radial-gradient(1.4px 1.4px at 43% 32%, rgba(200,208,255,.7), transparent 100%),
    radial-gradient(1.1px 1.1px at 55% 60%, rgba(200,208,255,.5), transparent 100%),
    radial-gradient(1.6px 1.6px at 70% 44%, rgba(200,208,255,.75), transparent 100%),
    radial-gradient(1.1px 1.1px at 88% 14%, rgba(200,208,255,.6), transparent 100%),
    radial-gradient(1.3px 1.3px at 60% 12%, rgba(200,208,255,.6), transparent 100%),
    radial-gradient(1.2px 1.2px at 22% 12%, rgba(200,208,255,.55), transparent 100%),
    radial-gradient(1.2px 1.2px at 79% 68%, rgba(200,208,255,.5), transparent 100%);
  animation-delay: -3.5s;
}
@keyframes twinkle {
  from { opacity: 0.55; }
  to   { opacity: 1; }
}

/* A huge sphere mostly above the viewport — only its glowing lower rim shows. */
.hero-planet {
  position: absolute;
  left: 50%;
  top: 0;
  width: 175vmax;
  height: 175vmax;
  transform: translate(-56%, -91.5%);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 112%, #241028 0%, #140a1e 42%, #070510 68%);
  box-shadow:
    inset 0 -16px 44px -12px rgba(255, 148, 92, 0.85),
    0 10px 34px -8px rgba(255, 128, 70, 0.5),
    0 40px 130px -30px rgba(190, 90, 240, 0.35);
}

/* Soft blurple nebula glow behind the copy. */
.hero-haze {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(700px 420px at 22% 62%, rgba(88, 101, 242, 0.16), transparent 65%),
    radial-gradient(560px 400px at 82% 30%, rgba(160, 107, 245, 0.12), transparent 65%);
}

.hero-orbit {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: min(28vw, 400px);
  filter: drop-shadow(0 0 6px rgba(111, 123, 247, 0.65));
}
.orbit-dot { filter: drop-shadow(0 0 8px #8f9bff); }

/* --- nav --- */
.hero-nav {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(16px, 3vh, 28px) clamp(20px, 4.5vw, 56px);
}
.hero-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.hero-brand-glyph {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(160deg, var(--blurple), #3b45c9);
  color: #fff;
  font-size: 0.8rem;
  box-shadow: 0 4px 16px rgba(88, 101, 242, 0.5);
}
.hero-signin {
  padding: 8px 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.hero-signin:hover { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.32); }

/* --- body: copy left, visual right, vertically centered, never overflowing --- */
.hero-body {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  gap: clamp(24px, 5vw, 80px);
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4.5vw, 56px) clamp(16px, 4vh, 44px);
}

.hero-badge { margin-bottom: clamp(10px, 2vh, 20px); }

.hero-title {
  margin: 0 0 clamp(12px, 2.2vh, 22px);
  font-size: clamp(2.1rem, 4.6vw, 4rem);
  line-height: 1.06;
  font-weight: 800;
  letter-spacing: -0.035em;
  background: linear-gradient(115deg, #ffffff 30%, #b7bfff 75%, #c9a6ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  margin: 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: clamp(0.98rem, 1.35vw, 1.18rem);
  line-height: 1.6;
}

.hero-cta { margin-top: clamp(18px, 3.4vh, 34px); }
.hero-btn {
  width: auto;
  margin-top: 0;
  padding: 14px 26px;
  font-size: 1.02rem;
  border-radius: 13px;
  box-shadow: 0 10px 34px rgba(88, 101, 242, 0.45);
}

.hero-note {
  margin: clamp(10px, 1.8vh, 16px) 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  opacity: 0.85;
}
.hero .error { max-width: 46ch; }

/* --- right visual: faux story card + floating tag chips --- */
.hero-visual {
  position: relative;
  height: min(58vh, 480px);
  align-self: center;
}

.hero-card {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(3.5deg);
  width: min(240px, 22vw);
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), 0 0 60px rgba(88, 101, 242, 0.18);
  animation: heroFloat 7s ease-in-out infinite alternate;
}
.hero-card-cover {
  aspect-ratio: 2 / 2.6;
  display: flex;
  align-items: flex-end;
  padding: 14px;
  background:
    radial-gradient(140% 90% at 80% 0%, rgba(255, 148, 92, 0.5), transparent 55%),
    linear-gradient(200deg, #46409b 0%, #232052 55%, #131129 100%);
}
.hero-card-cover span {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  line-height: 1.25;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}
/* card VIVO (obra real): capa é imagem — a altura segue a proporção real
   (retrato fica alto, 600x400 fica baixo), com teto pra não dominar o hero */
a.hero-card-live { display: block; text-decoration: none; color: inherit; cursor: pointer; }
a.hero-card-live:hover { border-color: rgba(139, 148, 255, 0.55); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), 0 0 70px rgba(88, 101, 242, 0.32); }
.hero-card-cover.has-image { aspect-ratio: auto; padding: 0; display: block; background: var(--surface-2); }
.hero-card-cover.has-image img {
  width: 100%; height: auto; max-height: 320px;
  object-fit: cover; display: block;
}
.hero-card-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem; line-height: 1.3; color: #fff;
  margin-bottom: 4px;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.hero-card-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-card-live { transition: opacity 0.26s ease; }
.hero-card-live.is-swapping { opacity: 0; }
.hero-card-body { padding: 12px 14px 14px; }
.hero-card-meta { color: var(--muted); font-size: 0.75rem; }
.hero-card-tags { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.hero-card-tags span {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.68rem;
}

.hero-chip {
  position: absolute;
  z-index: 2;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(23, 24, 28, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  animation: heroFloat 6s ease-in-out infinite alternate;
}
.chip-1 {
  top: 5%;
  left: -4%;
  border-color: rgba(111, 123, 247, 0.65);
  color: #b7bfff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 22px rgba(88, 101, 242, 0.35);
  animation-delay: -1.2s;
}
.chip-2 { top: 26%; right: -5%; animation-delay: -3.8s; }
.chip-3 { bottom: 30%; left: -7%; animation-delay: -2.4s; }
.chip-4 {
  bottom: 7%;
  right: 2%;
  border-color: rgba(255, 148, 92, 0.55);
  color: #ffc9a8;
  animation-delay: -5s;
}

@keyframes heroFloat {
  from { translate: 0 -7px; }
  to   { translate: 0 7px; }
}

/* --- responsive: drop the visual, center the copy --- */
@media (max-width: 960px) {
  .hero-body { grid-template-columns: 1fr; text-align: center; }
  .hero-visual { display: none; }
  .hero-sub, .hero .error { margin-inline: auto; }
  .hero-orbit { opacity: 0.5; }
}
@media (max-height: 640px) {
  .hero-badge { display: none; }
  .hero-title { font-size: clamp(1.8rem, 4vw, 2.6rem); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-stars, .hero-card, .hero-chip { animation: none; }
}

/* ================= /stats — réplica fiel do card do !nivel ================ */
/* A fonte do card original (Inter, via Google Fonts no Playwright) é servida
   local aqui — o CSP só permite 'self'. Variável: cobre os pesos 400–900. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-var-latin.woff2') format('woff2');
}

.stats-page { width: 100%; max-width: 900px; align-self: start; display: flex; flex-direction: column; align-items: center; }
.stats-page.hidden { display: none !important; }

/* card-wrapper do drawer.py: 820px de body - 2x30 de padding = 760px */
.stats-card {
  font-family: 'Inter', sans-serif;
  width: 100%; max-width: 760px; min-width: 0;
  background: linear-gradient(160deg, #141821 0%, #0d0f16 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 24px;
  padding: 34px 38px;
  position: relative;
  overflow: hidden;
  color: #F3F4F6;
  text-align: left;
}
.stats-card::before {
  content: ""; position: absolute; top: -60px; right: -40px;
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(var(--accent-r), var(--accent-g), var(--accent-b), 0.13) 0%, transparent 70%);
  pointer-events: none;
}

/* PERFIL */
.st-header { display: flex; align-items: center; gap: 22px; position: relative; z-index: 1; margin-bottom: 30px; }
.st-avatar {
  width: 96px; height: 96px; border-radius: 22px; object-fit: cover;
  box-shadow: 0 0 0 3px var(--accent), 0 8px 24px rgba(0, 0, 0, 0.5);
}
.st-user-info { display: flex; flex-direction: column; gap: 12px; }
.st-user-name { font-size: 34px; font-weight: 800; color: #fff; letter-spacing: -0.5px; line-height: 1; }
.st-badges { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.st-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; padding: 6px 12px; border-radius: 10px; }
.st-b-lvl { background: var(--accent); color: #0b0d12; }
.st-b-league { background: rgba(255, 255, 255, 0.06); color: #c7d4e0; }
.st-b-league .st-dia { color: var(--accent); }
.st-b-streak { background: rgba(255, 138, 60, 0.14); color: #ff9d4d; }

/* BARRAS DE PROGRESSO */
.st-bars { display: flex; flex-direction: column; gap: 20px; position: relative; z-index: 1; }
.st-stat-row { display: flex; flex-direction: column; gap: 9px; }
.st-stat-labels { display: flex; justify-content: space-between; align-items: baseline; }
.st-stat-title { font-size: 16px; font-weight: 600; color: #9aa1ad; }
.st-stat-value { font-size: 16px; font-weight: 700; color: #fff; }
.st-progress-track {
  width: 100%; height: 9px;
  background: rgba(255, 255, 255, 0.05); border-radius: 20px;
  overflow: hidden;
}
.st-progress-fill { height: 100%; border-radius: 20px; }

/* SEÇÕES DETALHADAS (jornada, obras, ligas, ritmo mensal) */
.st-detail { position: relative; z-index: 1; }
.st-sec-title { margin: 30px 0 14px; font-size: 15px; font-weight: 700; color: #C9CFD9; }
.st-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 12px; }
.st-tile { background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 14px; padding: 15px 16px; }
.st-tile-val { font-size: 23px; font-weight: 800; color: var(--accent); line-height: 1.1; font-variant-numeric: tabular-nums; }
.st-tile-label { margin-top: 6px; font-size: 12.5px; font-weight: 600; color: #8991a0; }
.st-works { display: flex; flex-direction: column; gap: 15px; }
.st-work-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.st-work-name { font-size: 15px; font-weight: 700; color: #fff; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.st-work-name:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.st-work-words { font-size: 13px; font-weight: 700; color: #9aa1ad; white-space: nowrap; flex: none; font-variant-numeric: tabular-nums; }
.st-monthly { display: flex; align-items: flex-end; gap: 6px; height: 132px; padding: 10px 6px 0; background: rgba(255, 255, 255, 0.02); border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 14px; overflow-x: auto; }
.st-mo-col { flex: 1 1 0; min-width: 24px; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.st-mo-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; min-height: 0; }
.st-mo-bar { width: 62%; min-height: 3px; border-radius: 5px 5px 0 0; opacity: 0.78; transition: opacity 0.15s ease; }
.st-mo-bar.is-best { opacity: 1; box-shadow: 0 0 10px var(--accent); }
.st-mo-col:hover .st-mo-bar { opacity: 1; }
.st-mo-lbl { font-size: 10px; font-weight: 700; color: #6B7280; text-transform: uppercase; letter-spacing: 0.04em; }
/* tiles ganham vida no hover */
.st-tile { transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease; }
.st-tile:hover { transform: translateY(-3px); border-color: rgba(var(--accent-r), var(--accent-g), var(--accent-b), 0.5); background: rgba(255, 255, 255, 0.05); }

/* EGO — comparação social */
.st-ego { position: relative; z-index: 1; }
.st-gauge { background: rgba(var(--accent-r), var(--accent-g), var(--accent-b), 0.07); border: 1px solid rgba(var(--accent-r), var(--accent-g), var(--accent-b), 0.25); border-radius: 16px; padding: 20px 22px; }
.st-gauge-lead { font-size: 17px; font-weight: 600; color: #C9CFD9; }
.st-gauge-pct { font-size: 30px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.st-gauge-track { margin-top: 14px; height: 12px; background: rgba(255, 255, 255, 0.06); border-radius: 20px; overflow: hidden; }
.st-gauge-fill { height: 100%; width: 0; border-radius: 20px; box-shadow: 0 0 14px var(--accent); transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1); }
.st-gauge-sub { margin-top: 10px; font-size: 13px; font-weight: 600; color: #8991a0; font-variant-numeric: tabular-nums; }
.st-lb { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.st-lb-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.05); font-size: 14px; }
.st-lb-me { background: rgba(var(--accent-r), var(--accent-g), var(--accent-b), 0.14); border-color: rgba(var(--accent-r), var(--accent-g), var(--accent-b), 0.4); }
.st-lb-arrow { flex: none; width: 15px; text-align: center; font-size: 11px; color: #8991a0; }
.st-lb-me .st-lb-arrow { color: var(--accent); }
.st-lb-name { flex: 1; min-width: 0; font-weight: 700; color: #e6e9ee; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.st-lb-name:hover { color: var(--accent); }
.st-lb-me .st-lb-name { color: #fff; }
.st-lb-words { font-weight: 700; color: #cfd6e0; font-variant-numeric: tabular-nums; }
.st-lb-extra { flex: none; font-size: 11.5px; color: #8991a0; }
.st-vs { background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 14px; padding: 16px 18px; }
.st-vs-top { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.st-vs-you { color: var(--accent); }
.st-vs-rival { color: #cfd6e0; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.st-vs-rival:hover { color: #fff; text-decoration: underline; }
.st-vs-bar { display: flex; height: 14px; border-radius: 20px; overflow: hidden; background: rgba(255, 255, 255, 0.06); }
.st-vs-left { height: 100%; width: 0; transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1); }
.st-vs-right { height: 100%; flex: 1; background: rgba(255, 255, 255, 0.12); }
.st-vs-verdict { margin-top: 10px; font-size: 13px; font-weight: 600; color: #8991a0; }

/* RIVAL / GUARDIÃO */
.st-rival-container {
  position: relative; z-index: 1; margin-top: 26px;
  padding: 18px 20px; background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05); border-left: 3px solid var(--accent);
  border-radius: 14px;
}
.st-rival-header { font-size: 13px; font-weight: 600; color: #8991a0; margin-bottom: 12px; }
.st-rival-rank { color: #6B7280; font-weight: 500; }
.st-rival-bar-wrapper { display: flex; gap: 14px; align-items: center; }
.st-rival-avatar { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; background: #2c3340; flex: none; }
.st-rival-track { flex: 1; height: 34px; background: rgba(255, 255, 255, 0.04); border-radius: 10px; position: relative; overflow: hidden; }
.st-rival-fill { height: 100%; position: absolute; left: 0; top: 0; border-radius: 10px; }
.st-rival-text {
  position: absolute; inset: 0; display: flex; align-items: center; gap: 4px;
  justify-content: flex-start; padding-left: 16px;
  font-size: 13px; font-weight: 600; color: #cfd6e0; z-index: 2; white-space: nowrap;
}
.st-rival-link { color: #fff; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.st-rival-link:hover { color: var(--accent); }
.st-rival-name { font-weight: 700; color: #fff; }
.st-top1-track { background: rgba(253, 224, 71, 0.08) !important; }
.st-top1-fill { background: linear-gradient(90deg, #D97706 0%, #FDE047 100%) !important; }
.st-top1-text { color: #1a1205 !important; font-weight: 800; }

/* HEATMAP */
.st-heatmap {
  margin-top: 26px; position: relative; z-index: 1;
  padding: 20px; background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 14px;
}
.st-hm-header { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 18px; font-size: 15px; }
.st-hm-title { color: #C9CFD9; font-weight: 700; }
.st-hm-total { font-weight: 700; }
.st-hm-grid {
  display: grid;
  /* auto-fit: 6 colunas no desktop, quebra sozinho pra 4/3/2/1 conforme encolhe */
  grid-template-columns: repeat(auto-fit, 102px);
  justify-content: center;
  gap: 22px 16px;
  align-items: start;
}
.st-month-block { display: flex; flex-direction: column; gap: 8px; }
.st-month-label { font-size: 11px; color: #6B7280; font-weight: 700; letter-spacing: 1px; }
.st-days-grid { display: grid; grid-template-columns: repeat(7, 12px); gap: 3px; grid-auto-rows: 12px; }
.st-day-cell { width: 12px; height: 12px; border-radius: 3px; display: inline-block; box-sizing: border-box; }
.st-day-cell:not(.st-empty) { cursor: pointer; }
.st-day-cell.st-empty { background: transparent !important; border: none !important; cursor: default; }
.st-hm-legend { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 18px; font-size: 12px; color: #8991a0; }
.st-legend-cells { display: inline-flex; gap: 3px; align-items: center; }

/* balãozinho do heatmap (hover/clique num dia) */
.st-hm-tip {
  position: absolute; z-index: 30;
  transform: translate(-50%, calc(-100% - 8px));
  padding: 6px 10px; border-radius: 8px;
  background: #1F2430; border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  color: #F3F4F6; font-size: 12px; font-weight: 600; white-space: nowrap;
  pointer-events: none;
}
.st-hm-tip::after {
  content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: #1F2430;
}
.st-hm-tip.hidden { display: none; }

/* anônimo: prévia — só o comecinho real, fade da metade pra baixo (igual capítulo) */
.stats-card.is-preview {
  -webkit-mask-image: linear-gradient(to bottom, #000 42%, transparent 84%);
  mask-image: linear-gradient(to bottom, #000 42%, transparent 84%);
}
.stats-card.is-preview .st-day-cell { pointer-events: none; }
.stats-paywall {
  max-width: 460px; margin: -70px auto 40px; text-align: center;
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 26px 22px;
}
.stats-paywall-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.01em; }
.stats-paywall-sub { margin: 0; color: var(--muted); line-height: 1.6; }
.stats-paywall .hero-btn { margin-top: 8px; }

/* ABAS da página de stats (fixadas no topo, como as da timeline) */
.st-tabs { position: sticky; top: 60px; z-index: 20; display: flex; gap: 4px; margin-bottom: 22px; background: var(--bg); border-bottom: 1px solid var(--line); }
.st-tab { flex: 1; padding: 14px 8px; border: none; background: none; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.st-tab:hover { color: var(--text); }
.st-tab.is-active { color: var(--text); border-bottom-color: var(--blurple); }
.st-tabpanel.hidden { display: none; }

/* RANKING DO SERVIDOR */
.rk-head { margin-bottom: 18px; }
.rk-title { font-size: 1.7rem; font-weight: 800; letter-spacing: 0.01em; margin: 0; }
.rk-sub { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 4px; }
.rk-scroll { overflow-x: auto; }
.rk-table { min-width: 720px; }
.rk-row { display: grid; grid-template-columns: 46px minmax(190px, 1.5fr) repeat(5, minmax(82px, 1fr)); align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.025); border: 1px solid rgba(255, 255, 255, 0.05); border-left: 4px solid var(--elo, #444); text-decoration: none; color: #cfd6e0; }
a.rk-row { transition: background 0.15s ease; }
a.rk-row:hover { background: rgba(255, 255, 255, 0.06); }
.rk-row.is-me { outline: 1px solid var(--blurple); outline-offset: -1px; }
.rk-elo-11 { background: linear-gradient(90deg, rgba(255, 215, 0, 0.16), rgba(255, 215, 0, 0.02)); border-color: rgba(255, 215, 0, 0.4); }
.rk-elo-10 { background: linear-gradient(90deg, rgba(255, 64, 64, 0.12), rgba(255, 64, 64, 0.02)); }
.rk-colhead { background: none; border: none; border-left: 4px solid transparent; padding: 0 16px 6px; margin-bottom: 2px; }
.rk-colhead .rk-num { color: #6B7280; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.rk-rank { font-size: 20px; font-weight: 800; color: var(--elo); text-align: center; font-variant-numeric: tabular-nums; }
.rk-user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rk-av { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); }
.rk-name-wrap { min-width: 0; display: flex; flex-direction: column; }
.rk-name { font-weight: 800; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-elo-11 .rk-name { color: #FFD700; }
.rk-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--elo); }
.rk-num { text-align: right; display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.rk-num-v { font-weight: 700; color: #e6e9ee; font-size: 15px; }
.rk-num.is-max .rk-num-v { color: #38d3ff; }
.rk-num.is-zero .rk-num-v { color: #4b5563; }
.rk-num-sub { font-size: 10px; color: #6B7280; margin-top: 1px; }

/* PROJETOS: dropdown + gráfico de progresso */
.pj-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.pj-bar-label { font-weight: 700; color: var(--muted); flex: none; }
.pj-select { flex: 1; max-width: 460px; }
.pj-card { background: rgba(255, 255, 255, 0.02); border: 1px solid var(--line); border-radius: 16px; padding: 24px 22px; }
.pj-title { text-align: center; font-size: 1.55rem; font-weight: 800; color: #f5433a; line-height: 1.2; }
.pj-subtitle { text-align: center; color: var(--muted); margin: 10px 0 18px; line-height: 1.6; font-size: 0.95rem; }
.pj-subtitle b { color: var(--text); }
.pj-svgwrap { width: 100%; overflow-x: auto; }
.pj-svg { width: 100%; min-width: 560px; height: auto; display: block; }
.pj-grid { stroke: rgba(255, 255, 255, 0.06); stroke-width: 1; }
.pj-ylab, .pj-xlab { fill: #6B7280; font-size: 13px; }
.pj-line { fill: none; stroke: #f5433a; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.pj-pt { fill: #f5433a; stroke: #fff; stroke-width: 2; }
.pj-delta { fill: #fff; font-size: 13px; font-weight: 700; }

@media (max-width: 720px) {
  .stats-card { padding: 24px 18px; border-radius: 18px; }
  .st-header { gap: 16px; margin-bottom: 24px; }
  .st-avatar { width: 72px; height: 72px; border-radius: 18px; }
  .st-user-name { font-size: 26px; }
  .st-badge { font-size: 12px; padding: 5px 10px; }
  .st-stat-title, .st-stat-value { font-size: 14px; }
  .st-heatmap { padding: 16px; }
}
@media (max-width: 480px) {
  .stats-card { padding: 18px 14px; }
  .st-header { gap: 12px; margin-bottom: 20px; }
  .st-avatar { width: 60px; height: 60px; border-radius: 16px; }
  .st-user-name { font-size: 22px; }
  .st-badges { gap: 6px; }
  .st-badge { font-size: 11px; padding: 4px 8px; }
  .st-hm-grid { gap: 18px 12px; }
  .st-rival-text { font-size: 12px; padding-left: 12px; }
  .st-rival-avatar { width: 34px; height: 34px; }
  .stats-paywall { margin-top: -50px; }
  .stats-paywall-title { font-size: 1.25rem; }
}
.profile-stats-link { width: auto; margin-top: 12px; display: inline-flex; }

/* ============ atividades do servidor (sidebar da TL, paginado) ============ */
.activity-panel {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 14px 10px;
  text-align: left;
}
.activity-head {
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
  margin: 0 4px 10px;
}
.activity-list { display: flex; flex-direction: column; }
.act-row {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 7px 6px; border-radius: 10px;
  text-decoration: none; color: var(--text);
}
a.act-row:hover { background: var(--surface-2); }
.act-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  object-fit: cover; background: var(--surface-2); margin-top: 1px;
}
.act-body { min-width: 0; }
.act-text { font-size: 0.8rem; line-height: 1.4; color: #c6cbd6; }
.act-text strong { color: var(--text); font-weight: 700; }
.act-title { font-style: normal; color: var(--blurple-hi); }
.act-when { font-size: 0.7rem; color: var(--muted); margin-top: 1px; }
.act-empty { padding: 8px 6px; color: var(--muted); font-size: 0.8rem; }
.activity-pager {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line);
}
.act-pg {
  width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px; background: none;
  color: var(--text); font-size: 1rem; line-height: 1; cursor: pointer;
}
.act-pg:hover:not(:disabled) { background: var(--surface-2); }
.act-pg:disabled { opacity: 0.35; cursor: default; }
.act-pg-label { font-size: 0.74rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* curtida nas respostas (coração pequeno + contador) */
.reply-foot { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.reply-like {
  display: inline-flex; align-items: center; gap: 5px;
  border: none; background: none; padding: 2px 6px; border-radius: 8px;
  color: var(--muted); cursor: pointer; font: inherit;
  transition: background 0.12s ease, color 0.12s ease;
}
.reply-like svg { width: 14px; height: 14px; display: block; }
.reply-like:hover { background: var(--surface-2); color: var(--text); }
.reply-like.is-on { color: #ff5a7a; }
.reply-like.is-on svg { fill: #ff5a7a; }
.reply-like-n { font-size: 0.76rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ==================== home logada (vitrine streaming) ==================== */
/* Mesma largura (--page-w) e mesmo eixo de todas as páginas — a home não pode
   destoar do resto do site. As fileiras horizontais rolam dentro dessa largura. */
.browse {
  width: 100%;
  max-width: var(--page-w);
  align-self: start;
  text-align: left;
}

/* ------------------------ trilho de navegação global --------------------- */
/* Fixo à esquerda, centrado na vertical, SEMPRE aberto (ícone + rótulo), em
   toda página de quem está logado. O ícone ganha o mesmo "brilho" da marca
   (.brand:hover): escala + drop-shadow blurple. O conteúdo centrado recua
   (body.has-rail .stage) pra nunca passar por baixo. */
.home-rail {
  position: fixed;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  width: 184px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(18, 20, 27, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.rail-item {
  display: flex;
  align-items: center;
  height: 48px;
  border-radius: 14px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}
.rail-ico {
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  height: 48px;
}
.rail-ico svg { transition: transform 0.3s ease, filter 0.35s ease; }
.rail-label {
  font-size: 0.92rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  padding-right: 14px;
}
.rail-item:hover {
  color: var(--text);
  background: rgba(88, 101, 242, 0.16);
}
.rail-item:hover .rail-ico svg {
  transform: translateY(-1px) scale(1.14);
  filter: drop-shadow(0 0 9px rgba(88, 101, 242, 0.6));
}
.rail-item.is-active {
  color: var(--text);
  background: rgba(88, 101, 242, 0.2);
}
/* Badge de não lidas ao lado da Timeline (ao vivo). */
.rail-badge {
  margin-left: auto;
  margin-right: 12px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--blurple);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}
.rail-badge.hidden { display: none; }
.rail-item.is-active .rail-ico svg {
  filter: drop-shadow(0 0 7px rgba(88, 101, 242, 0.5));
}
/* Atividade ao vivo abaixo do menu — campo pequeno, sem fundo próprio (usa o do
   trilho), separado por um filete. Fotinhas sobrepostas + texto curto. */
.rail-live { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; padding: 9px 12px 2px; border-top: 1px solid rgba(255, 255, 255, 0.05); }
.rail-live.hidden { display: none; }
.rl-head { display: flex; align-items: center; gap: 5px; font-size: 0.55rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255, 255, 255, 0.3); margin-bottom: 1px; }
.rl-dot { width: 5px; height: 5px; border-radius: 50%; background: #3cb576; box-shadow: 0 0 0 0 rgba(60, 181, 118, 0.5); animation: imp-pulse 2s infinite; flex: none; }
.rl-line { display: flex; align-items: center; gap: 7px; text-decoration: none; color: rgba(255, 255, 255, 0.42); font-size: 0.68rem; line-height: 1.2; }
a.rl-line { cursor: pointer; }
a.rl-line:hover { color: rgba(255, 255, 255, 0.7); }
.rl-avs { display: flex; flex: none; }
.rl-av { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; border: 1.5px solid rgba(18, 20, 27, 0.9); background: var(--surface-2); }
.rl-av:not(:first-child) { margin-left: -6px; }
.rl-text { min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rl-name { color: rgba(255, 255, 255, 0.68); font-weight: 600; }

/* Reserva a calha à esquerda pro conteúdo centrado não ficar sob o trilho. */
@media (min-width: 1060px) {
  body.has-rail .stage { padding-left: 224px; }
}
/* Estreito: sem espaço pro trilho — some (a navegação vive no menu do topo). */
@media (max-width: 1059px) {
  .home-rail { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .rail-ico svg { transition: none; }
}

/* ----------------------- /entrar: servidores parceiros ------------------- */
.partners-page { max-width: 620px; margin: 0 auto; padding: 48px 20px 80px; }
.pt-head { text-align: center; margin-bottom: 26px; }
.pt-back { display: inline-block; font-size: 0.85rem; color: var(--muted); text-decoration: none; margin-bottom: 22px; }
.pt-back:hover { color: var(--text); }
.pt-brand { font-family: var(--serif, Georgia, serif); font-weight: 800; font-size: 1.5rem; letter-spacing: -0.01em; }
.pt-title { margin: 14px 0 8px; font-size: 1.9rem; }
.pt-sub { color: var(--muted); font-size: 0.98rem; line-height: 1.5; margin: 0 auto; max-width: 460px; }
.pt-error { margin: 0 0 18px; padding: 12px 16px; border-radius: 12px; font-size: 0.9rem;
  background: rgba(224, 85, 61, 0.12); border: 1px solid rgba(224, 85, 61, 0.4); color: #f0a89b; }
.pt-list { margin-bottom: 26px; }
.pt-muted { color: var(--muted); text-align: center; padding: 24px 0; }
.pt-grid { display: flex; flex-direction: column; gap: 10px; }
.pt-card { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--surface); text-decoration: none; color: inherit; transition: border-color 0.15s ease, background 0.15s ease; }
a.pt-card:hover { border-color: var(--blurple); background: var(--surface-2); }
.pt-icon { flex: none; width: 52px; height: 52px; border-radius: 16px; overflow: hidden; background: var(--surface-2);
  display: grid; place-items: center; }
.pt-icon img { width: 100%; height: 100%; object-fit: cover; }
.pt-icon-ph { font-size: 1.4rem; font-weight: 700; color: var(--muted); }
.pt-meta { min-width: 0; }
.pt-name { font-weight: 700; font-size: 1rem; }
.pt-join { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
a.pt-card:hover .pt-join { color: var(--blurple-hi); }
.pt-login { width: 100%; justify-content: center; font-size: 1rem; padding: 14px; }
.pt-note { text-align: center; color: var(--muted); font-size: 0.8rem; margin: 14px 0 0; }

/* /admin — painel de moderadores */
.admin-page { max-width: 720px; margin: 0 auto; padding: 8px 0 60px; }
.adm-h1 { margin: 6px 0 20px; }
.adm-empty { color: var(--muted); padding: 24px 0; text-align: center; }
.adm-section { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; }
.adm-sec-title { margin: 0 0 6px; font-size: 1.15rem; }
.adm-sec-desc { margin: 0 0 18px; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
.adm-partners { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.adm-row { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.adm-ic { flex: none; width: 46px; height: 46px; border-radius: 14px; overflow: hidden; background: var(--surface); display: grid; place-items: center; }
.adm-ic img { width: 100%; height: 100%; object-fit: cover; }
.adm-ic-ph { font-size: 1.3rem; font-weight: 700; color: var(--muted); }
.adm-meta { flex: 1; min-width: 0; }
.adm-name { display: flex; align-items: center; gap: 8px; }
.adm-name-txt { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-badge { flex: none; font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--blurple-hi); background: rgba(88, 101, 242, 0.14); border-radius: 999px; padding: 2px 8px; }
.adm-invite { display: block; font-size: 0.8rem; color: var(--muted); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
a.adm-invite:hover { color: var(--blurple-hi); }
.adm-rm { flex: none; border: 1px solid var(--line); background: none; color: var(--muted); border-radius: 8px; padding: 7px 12px; font-size: 0.82rem; cursor: pointer; }
.adm-rm:hover:not(:disabled) { border-color: #e0553d; color: #f0a89b; }
.adm-rm:disabled { opacity: 0.5; cursor: default; }
.adm-add { display: flex; gap: 10px; align-items: stretch; }
.adm-input { flex: 1 1 auto; min-width: 0; }
.adm-add .btn { flex: none; width: auto; margin-top: 0; white-space: nowrap; }
.adm-msg { margin-top: 10px; font-size: 0.85rem; min-height: 1.2em; }
.adm-msg.ok { color: #43b581; }
.adm-msg.err { color: #f0a89b; }

/* --------------------------------- hero ---------------------------------- */
.browse-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  min-height: 420px;
  display: flex;
}
.browse-hero-bg { position: absolute; inset: 0; }
.browse-hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(30px) saturate(1.15);
  transform: scale(1.2); /* esconde a borda "lavada" do blur */
  opacity: 0.4;
}
.browse-hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(11, 11, 15, 0.85), rgba(11, 11, 15, 0) 45%),
    linear-gradient(to right, rgba(11, 11, 15, 0.92) 30%, rgba(11, 11, 15, 0.55) 62%, rgba(11, 11, 15, 0.25));
}
.browse-hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 44px;
  padding: 40px 44px;
}
.bh-copy { max-width: 640px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.bh-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--blurple-hi);
}
.bh-kicker::before { content: ""; width: 22px; height: 3px; background: var(--blurple); border-radius: 2px; }
.bh-title {
  margin: 0;
  font-family: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-size: clamp(1.7rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.bh-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}
.bh-author { color: var(--text); font-weight: 600; text-decoration: none; }
.bh-author:hover { color: var(--blurple-hi); }
.bh-dot::before { content: "•"; color: #4d4f58; }
.bh-tag {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 9px;
  font-size: 0.76rem;
  color: #cdd1da;
  white-space: nowrap;
}
.bh-syn {
  margin: 0;
  color: #cdd1da;
  line-height: 1.55;
  max-width: 560px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bh-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.bh-cta .btn { width: auto; margin-top: 0; text-decoration: none; }
/* Capa nítida à direita, proporção livro (2:3) */
.bh-cover {
  flex: none;
  width: 240px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65);
  text-decoration: none;
}
.bh-cover-img {
  width: 100%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Sem imagem (fallback da letra): mantém o formato de capa 2:3. Com imagem real,
   o container se ajusta à proporção NATURAL da capa — nada de corte. */
.bh-cover-img:not(.has-image) { aspect-ratio: 2 / 3; }
.bh-cover-img img { width: 100%; height: auto; max-height: 460px; object-fit: contain; display: block; }
@media (max-width: 900px) {
  .browse-hero { min-height: 0; }
  .browse-hero-inner { padding: 28px 22px; }
  .bh-cover { display: none; } /* no celular a capa de fundo já conta a história */
}

/* ------------------- faixa "o feed virou a Timeline" --------------------- */
.browse-strip {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 18px;
}
.browse-strip-text { color: var(--muted); font-size: 0.9rem; }
.browse-strip .btn { width: auto; margin-top: 0; text-decoration: none; white-space: nowrap; }

/* ------------------------------- fileiras -------------------------------- */
.browse-rows { display: flex; flex-direction: column; gap: 34px; margin-top: 30px; }
.browse-row-head { display: flex; align-items: baseline; gap: 14px; margin: 0 2px 12px; }
.browse-row-head h2 { margin: 0; font-size: 1.12rem; font-weight: 700; letter-spacing: -0.01em; }
.browse-row-head h2 em { font-family: ui-serif, Georgia, serif; font-weight: 600; }
.browse-more { font-size: 0.8rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.browse-more:hover { color: var(--text); }
.browse-scroller {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.browse-scroller::-webkit-scrollbar { height: 8px; }
.browse-scroller::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.browse-scroller::-webkit-scrollbar-track { background: transparent; }

/* card de capa 2:3 com título embaixo */
.browse-card {
  flex: none;
  width: 156px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s ease;
}
.browse-card:hover { transform: translateY(-4px); }
.browse-cover-box { position: relative; }
.browse-cover {
  width: 156px;
  height: 234px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}
.browse-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.browse-cover .cover-fallback { font-size: 2.4rem; }
/* Capa paisagem: mesma altura das retrato (títulos alinham na fileira), mas
   largura 3:2 — o card ocupa ~2 slots do scroller em vez de espremer a arte. */
.browse-card--wide { width: auto; }
.browse-card--wide .browse-cover { width: auto; height: 234px; aspect-ratio: 3 / 2; }
.bc-text { display: flex; flex-direction: column; gap: 3px; }
/* Título sempre reserva 2 linhas e o autor 1 — assim todo card tem a MESMA
   altura, independentemente do tamanho do texto, e as capas alinham na fileira
   (inclusive na de "Em alta", que ancora os cards pela base). */
.bc-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.25;
  min-height: 2.5em; /* 2 linhas */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bc-sub {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bc-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--blurple);
  color: #fff;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 3px 7px;
  border-radius: 5px;
}
.bc-badge.gold {
  background: rgba(11, 11, 15, 0.85);
  color: #e3b34c;
  border: 1px solid rgba(227, 179, 76, 0.4);
  letter-spacing: 0.4px;
}
.bc-progress {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  height: 4px;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 2px;
  overflow: hidden;
}
.bc-progress span { display: block; height: 100%; background: var(--blurple-hi); border-radius: 2px; }

/* "Em alta": numerão vazado atrás do card, estilo top 10 */
.rank-card { flex: none; display: flex; align-items: flex-end; }
.rank-num {
  font-size: 118px;
  font-weight: 800;
  line-height: 0.72;
  color: var(--bg);
  -webkit-text-stroke: 3px #3b3e49;
  margin-right: -20px;
  margin-bottom: 40px; /* alinha com a base da capa, acima do título */
  position: relative;
  z-index: 1;
  font-variant-numeric: tabular-nums;
  user-select: none;
}
.rank-card .browse-card { position: relative; z-index: 2; }

/* estantes (fandoms) */
.shelf-card {
  flex: none;
  width: 224px;
  height: 118px;
  border-radius: 12px;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px 18px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s ease;
}
.shelf-card:hover { transform: translateY(-4px); }
.shelf-name {
  font-family: ui-serif, Georgia, serif;
  font-size: 1.16rem;
  font-weight: 700;
  line-height: 1.15;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.shelf-count { font-size: 0.75rem; color: rgba(243, 244, 246, 0.6); margin-top: 4px; }

/* =================== /tags — vocabulário + importação ==================== */
.tags-page { width: 100%; max-width: var(--page-w); align-self: start; text-align: left; }

/* cartão de status vivo da importação */
.imp-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.imp-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.imp-dot { width: 10px; height: 10px; border-radius: 50%; background: #555a66; flex: none; }
.imp-dot.is-live { background: #3cb576; box-shadow: 0 0 0 0 rgba(60, 181, 118, 0.55); animation: imp-pulse 1.8s infinite; }
@keyframes imp-pulse {
  0% { box-shadow: 0 0 0 0 rgba(60, 181, 118, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(60, 181, 118, 0); }
  100% { box-shadow: 0 0 0 0 rgba(60, 181, 118, 0); }
}
.imp-phase { font-weight: 700; }
.imp-sub { color: var(--muted); font-size: 0.85rem; }
.imp-bars { display: flex; flex-direction: column; gap: 7px; }
.imp-bar-row { display: grid; grid-template-columns: 76px 1fr auto; align-items: center; gap: 12px; }
.imp-bar-label { font-size: 0.8rem; color: var(--muted); }
.imp-bar { height: 7px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.imp-fill { height: 100%; background: linear-gradient(90deg, var(--blurple), var(--blurple-hi)); border-radius: 4px; transition: width 0.6s ease; }
.imp-bar-val { font-size: 0.76rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.imp-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; border-top: 1px solid var(--line); padding-top: 10px; }
.imp-stat { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.imp-stat b { color: var(--text); font-variant-numeric: tabular-nums; }
/* importador de livros: título do card, estado pausado e painel de disco */
.imp-card-title { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.imp-dot.is-paused { background: #e0a53d; box-shadow: none; animation: none; }
.imp-storage { display: flex; flex-direction: column; gap: 7px; border-top: 1px solid var(--line); padding-top: 12px; }
.imp-storage-head { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.imp-disk { position: relative; height: 10px; }
.imp-disk .imp-fill { background: linear-gradient(90deg, #2f9e63, #43b581); }
.imp-disk-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #e0a53d; border-radius: 2px; }
.imp-storage-line { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.imp-more { align-self: flex-start; margin-top: 2px; font-size: 0.82rem; font-weight: 600; color: var(--blurple-hi); text-decoration: none; border-top: 1px solid var(--line); padding-top: 12px; width: 100%; }
.imp-more:hover { color: var(--text); }
.imp-more-arrow { transition: margin-left 0.15s ease; display: inline-block; }
.imp-more:hover .imp-more-arrow { margin-left: 3px; }

/* --- Biblioteca (admin): navegador detalhado dos livros importados --- */
.library-page { max-width: 920px; margin: 0 auto; padding: 8px 0 60px; }
.lib-head { margin-bottom: 18px; }
.lib-back { font-size: 0.82rem; color: var(--muted); text-decoration: none; }
.lib-back:hover { color: var(--text); }
.lib-head h1 { margin: 8px 0 4px; }
.lib-sub { color: var(--muted); font-size: 0.9rem; margin: 0; }
.lib-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.lib-stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; display: flex; flex-direction: column; min-width: 96px; }
.lib-stat b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.lib-stat span { font-size: 0.72rem; color: var(--muted); }
.lib-stat.ok b { color: #43b581; }
.lib-stat.warn b { color: #e0a53d; }
.lib-stat.bad b { color: #e0553d; }
.lib-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.lib-search { flex: 1 1 240px; }
.lib-sort { flex: 0 0 auto; width: auto; }
.lib-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.lib-chip { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 6px 12px; font-size: 0.8rem; cursor: pointer; }
.lib-chip:hover { color: var(--text); }
.lib-chip.is-on { background: var(--blurple); border-color: var(--blurple); color: #fff; }
.lib-list { display: flex; flex-direction: column; gap: 8px; }
.lib-loading, .lib-empty { color: var(--muted); padding: 30px 0; text-align: center; }
.lib-row { display: flex; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; color: inherit; transition: border-color 0.15s ease, background 0.15s ease; }
.lib-row:hover { border-color: var(--blurple); background: var(--surface-2); }
.lib-cov { flex: none; width: 58px; height: 84px; border-radius: 6px; overflow: hidden; background: var(--surface-2); display: flex; align-items: center; justify-content: center; }
.lib-cov img { width: 100%; height: 100%; object-fit: cover; }
.lib-cov-none { color: var(--muted); font-size: 1.4rem; }
.lib-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.lib-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lib-title { font-weight: 700; font-size: 0.98rem; }
.lib-badge { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.lib-badge.is-real { color: #43b581; border-color: rgba(67, 181, 129, 0.4); background: rgba(67, 181, 129, 0.08); }
.lib-badge.is-keep { color: #8a90a0; }
.lib-badge.is-pending { color: #e0a53d; border-color: rgba(224, 165, 61, 0.4); background: rgba(224, 165, 61, 0.08); }
.lib-author { font-size: 0.82rem; color: var(--muted); }
.lib-meta { display: flex; flex-wrap: wrap; gap: 5px 8px; }
.lib-m { font-size: 0.74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.lib-m.warn { color: #e0a53d; }
.lib-m.bad { color: #e0553d; font-weight: 600; }
.lib-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.lib-tag { font-size: 0.7rem; color: var(--muted); background: var(--surface-2); border-radius: 5px; padding: 2px 7px; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.lib-tag.is-more { color: var(--blurple-hi); }
.lib-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 22px; }
.lib-page-btn { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 8px; padding: 8px 14px; font-size: 0.85rem; cursor: pointer; }
.lib-page-btn:hover:not(:disabled) { border-color: var(--blurple); }
.lib-page-btn:disabled { opacity: 0.4; cursor: default; }
.lib-page-ind { font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* busca + filtros */
.tag-controls { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.tag-search { width: 100%; }
.tag-type-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.type-chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.type-chip:hover { color: var(--text); border-color: #3a3d47; }
.type-chip.is-on { background: var(--blurple); border-color: var(--blurple); color: #fff; }

/* grade de tags */
.tag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 10px; }
.tag-chip {
  --tc: var(--blurple-hi);
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--tc);
  border-radius: 10px;
  padding: 11px 14px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.12s ease, border-color 0.12s ease;
  min-width: 0;
}
.tag-chip:hover { transform: translateY(-2px); border-color: var(--tc); }
.tag-chip-name { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-chip-sub { font-size: 0.74rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-chip-type { color: var(--tc); font-weight: 600; }
.tag-more { width: auto; margin: 18px auto 0; display: block; }

/* detalhe da tag */
.tag-detail-head { margin: 6px 0 4px; }
.tag-detail-name {
  --tc: var(--blurple-hi);
  font-family: ui-serif, Georgia, serif;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  margin: 0 0 10px;
  border-left: 5px solid var(--tc);
  padding-left: 14px;
  line-height: 1.1;
}
.tag-detail-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-badge {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
}
.tag-badge.is-type { color: var(--text); }
.tag-badge.is-src { color: #8ab4f8; }
a.tag-badge:hover { border-color: #3a3d47; color: var(--text); }

/* grafo radial */
.tag-graph {
  width: 100%;
  height: auto;
  margin: 10px 0 4px;
  background: radial-gradient(ellipse at center, rgba(88, 101, 242, 0.07), transparent 65%);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.tg-edge { stroke-width: 1.2; opacity: 0.35; }
.tg-box { fill: var(--surface); stroke-width: 1.4; }
.tg-node.is-link { cursor: pointer; }
.tg-node.is-link:hover .tg-box { fill: var(--surface-2); }
.tg-text { fill: var(--text); font-size: 11.5px; font-family: inherit; pointer-events: none; }
.tg-center .tg-box { fill: var(--surface-2); stroke-width: 2.2; }
.tg-text-center { font-size: 13.5px; font-weight: 700; }

/* grupos em lista */
.tag-groups { display: flex; flex-direction: column; gap: 18px; margin-top: 18px; }
.tag-group-head { font-weight: 700; font-size: 0.95rem; margin-bottom: 8px; }
.tag-group-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-mini {
  --tc: var(--blurple-hi);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.82rem;
  color: var(--text);
  text-decoration: none;
  box-shadow: inset 3px 0 0 var(--tc);
}
a.tag-mini:hover { border-color: var(--tc); }
.tag-mini.is-alias { color: var(--muted); font-style: italic; box-shadow: none; }
.tag-mini-n { color: var(--muted); font-size: 0.72rem; }
.tag-stories-head { margin-top: 22px; }
