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

:root {
    --bg: #0a0a0f;
    --bg-grad-1: #0a0a1a;
    --bg-grad-2: #14102a;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-solid: #16161f;
    --card: rgba(255, 255, 255, 0.045);
    --card-hover: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(139, 92, 246, 0.5);
    --accent: #8b5cf6;
    --accent-2: #6366f1;
    --accent-light: #c4b5fd;
    --text: #f1f1f5;
    --text-muted: #9ca3af;
    --green: #34d399;
    --yellow: #fbbf24;
    --red: #f87171;
    --favorite: #fbbf24;
    --radius: 14px;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    --glow: 0 0 40px rgba(139, 92, 246, 0.15);
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(139, 92, 246, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 90% 10%, rgba(99, 102, 241, 0.1), transparent),
        radial-gradient(ellipse 50% 40% at 10% 90%, rgba(139, 92, 246, 0.08), transparent);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Um bloco so. Header e quickbar eram dois sticky top:0 independentes que se
   sobrepunham no scroll; agora a navegacao inteira e um header unico. */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 15, 0.82);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border-bottom: 1px solid var(--border);
    transition: box-shadow .25s;
}

/* Desceu a pagina, o header encolhe de verdade: 139px -> 120px medido no Chrome.
   regra so trocava a sombra e o comentario prometia uma compressao que nao
   existia. O que some e a assinatura e o respiro — busca, atalhos e categorias
   continuam acesos, porque filtro escondido e filtro inexistente. */
header.condensed {
    box-shadow: 0 8px 30px rgba(0, 0, 0, .45);
    background: rgba(8, 8, 12, .93);
}

header.condensed .nav-row { padding-top: .4rem; padding-bottom: .4rem; }
header.condensed .brand-sub { opacity: 0; height: 0; }
header.condensed .chip-row { padding-bottom: .4rem; }
header.condensed .cat-tab { padding-top: .45rem; padding-bottom: .4rem; }

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
}

/* Linha principal: marca compacta, busca dominante, acoes a direita.
   A busca cresce porque e o que o visitante usa em 100% das visitas — o logo
   e a acao ficam em tamanho util. */
.nav-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1.25rem;
    padding: 0.75rem 2rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    min-width: 0;
}

.brand-mark {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-size: 0.9rem;
    box-shadow: 0 4px 14px rgba(139, 92, 246, .35);
    transition: transform .2s cubic-bezier(.2, .8, .2, 1);
}

.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); }

.brand-text { display: flex; flex-direction: column; min-width: 0; }

/* h1, nao span: o titulo da pagina precisa ser o unico h1 do documento para
   leitor de tela e para o outline. Era span quando a marca era so logotipo e
   o h1 vivia no <header> antigo. */
.brand-name {
    font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--text);
    line-height: 1.15;
    margin: 0;
}

.brand-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity .25s;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.icon-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
    border-radius: 9px;
    color: var(--text-muted);
}

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

/* Linha dos atalhos. Sem rotulo "Atalhos": os icones ja dizem do que se trata
   e o rotulo comia uma largura util da linha. */
.chip-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 2rem 0.6rem;
}

/* Botao de topo: aparece so depois de 500px, porque antes disso ele cobre
   conteudo sem necessidade. */
.to-top {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 120;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface-solid);
    border: 1px solid var(--border-hover);
    color: var(--text);
    box-shadow: var(--shadow);
    justify-content: center;
    padding: 0;
    animation: pop .22s cubic-bezier(.2, .9, .3, 1.3) both;
}

.to-top:hover { border-color: var(--accent); color: var(--accent-light); transform: translateY(-2px); }

@media (max-width: 900px) {
    .nav-row { grid-template-columns: 1fr; gap: 0.7rem; }
    .brand-sub { display: none; }
    .nav-actions { justify-content: space-between; }
}

/* Space Grotesk nos titulos e nos numeros grandes: tem personality geometrica
   propria, enquanto Inter e a fonte default de metade da internet e nao
   distingue este site de qualquer outro. O corpo continua em Inter, que e o
   que sustenta leitura longa de descricao. */
h1,
h2,
h3,
.card-header h3,
.brand-sub,
.stats-content strong,
.pg-metric strong,
.rank-badge,
.cmp-table thead th,
.tray-chip,
.quick-chip {
    font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
}

/* Sobrou do header antigo: o unico h1 do documento agora e .brand-name, que
   ja tem fonte, cor e tamanho proprios. Manter estas regras aplicaria
   -webkit-text-fill-color: transparent sobre o titulo novo, que ficaria com o
   gradiente antigo num elemento de 16px ao lado de um logo de 34px. */

.lang-switch {
    display: flex;
    gap: 0.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.25rem;
    border-radius: 10px;
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.lang-btn i { font-size: 0.8rem; }

.lang-btn.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.4);
}

.lang-btn:hover:not(.active) {
    background: var(--card-hover);
    color: var(--text);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* A busca e o elemento principal da navegacao: ocupa a coluna do meio e cresce.
   Antes era um input de 280px fixos entre a marca e os botoes. */
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.search-icon {
    position: absolute;
    left: 13px;
    color: var(--text-muted);
    font-size: 0.82rem;
    pointer-events: none;
    transition: color .2s;
}

#search {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.6rem 2.6rem 0.6rem 2.4rem;
    border-radius: 11px;
    font-size: 0.92rem;
    width: 100%;
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

#search:focus {
    border-color: var(--accent);
    background: var(--card-hover);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, .15);
}

#search:focus ~ .search-icon,
.search-wrapper:focus-within .search-icon { color: var(--accent-light); }

#search::placeholder { color: var(--text-muted); }

.search-kbd {
    position: absolute;
    right: 12px;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 0.68rem;
    color: var(--text-muted);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0.1rem 0.4rem;
    pointer-events: none;
    transition: opacity .2s;
}

.search-wrapper:focus-within .search-kbd { opacity: 0; }

.search-clear {
    position: absolute;
    right: 10px;
    width: 20px;
    height: 20px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.6rem;
    color: var(--text-muted);
    background: var(--card);
    border: 1px solid var(--border);
}

.search-clear:hover { color: #fff; background: var(--red); border-color: var(--red); }

select, button {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.55rem 0.8rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

select:hover, button:hover {
    border-color: var(--accent);
    background: var(--card-hover);
}

select:focus { border-color: var(--accent); }

/* Dropdown nativo do select — fundo escuro (evita menu branco) */
select option {
    background: var(--surface-solid);
    color: var(--text);
}

select option:hover,
select option:checked {
    background: var(--accent);
    color: white;
}

/* A barra de numeros saiu de dentro do header. Como indicador de posicao ela
   nao precisa grudar — gruda, rouba altura de tela sem informacao nova. */
.stats-bar {
    background: rgba(10, 10, 15, 0.35);
    border-bottom: 1px solid var(--border);
    padding: 0.55rem 2rem;
}

.stats-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.stat-item { display: flex; align-items: center; gap: 0.4rem; }
.stat-item i { font-size: 0.9rem; color: var(--accent-light); }
.stat-item strong { color: var(--text); font-size: 1rem; font-weight: 700; }

.refresh-btn {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    border: none;
    padding: 0.45rem 1.1rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s;
    margin-left: auto;
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.3);
}

.refresh-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.refresh-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.export-btn {
    background: linear-gradient(135deg, var(--green), #10b981);
    color: white;
    border: none;
    font-weight: 600;
    box-shadow: 0 2px 12px rgba(52, 211, 153, 0.25);
}

.export-btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* Categorias como tabs dentro do header. Antes eram um wrapper proprio com
   scroll horizontal e dois botoes circulares que apareciam so no fim do rail —
   sem indicador de "voce esta aqui". Agora o rail tem tinta que segue a tab
   ativa, bordas laterais que desvanecem nas pontas (sinal de "tem mais"), e o
   scroll do mouse vira scroll horizontal. */
.cat-tabs {
    position: relative;
    margin: 0 -2rem;
    padding: 0 2rem;
    border-top: 1px solid var(--border);
}

.cat-rail {
    display: flex;
    gap: 0.15rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.cat-rail::-webkit-scrollbar { display: none; }

.cat-tab {
    position: relative;
    flex: 0 0 auto;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    padding: 0.6rem 0.85rem 0.55rem;
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: color .18s, border-color .18s;
}

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

.cat-tab.active {
    color: var(--text);
    font-weight: 600;
    border-bottom-color: transparent;
}

/* A tinta e o unico indicador de posicao que funciona num rail de 52 itens. */
.cat-ink {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 0;
    border-radius: 2px 2px 0 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    box-shadow: 0 0 12px rgba(139, 92, 246, .6);
    opacity: 0;
    transition: transform .32s cubic-bezier(.2, .8, .2, 1), width .32s cubic-bezier(.2, .8, .2, 1), opacity .2s;
    pointer-events: none;
}

.cat-count {
    font-size: 0.7rem;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    padding: 0.05rem 0.34rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .06);
    color: var(--text-muted);
    transition: background .18s, color .18s;
}

.cat-tab.active .cat-count { background: rgba(139, 92, 246, .25); color: var(--accent-light); }

main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

.api-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
}

.api-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.api-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2), transparent);
    opacity: 0;
    transition: opacity 0.25s;
}

.api-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow), var(--glow);
    background: var(--card-hover);
}

.api-card:hover::before { opacity: 1; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.card-header h3 {
    font-size: 1.05rem;
    flex: 1;
    line-height: 1.3;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.card-header h3 a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s;
}

.card-header h3 a:hover { color: var(--accent-light); }

/* A estrela ficava apagada demais: --text-muted sobre card translucido nao
   passa em contraste. A caixa de 30x30 e o estado ativo estao no bloco do
   .pick-btn, mais abaixo, junto dos outros botoes da fileira. */
/* A regra completa do estado favoritado esta junto dos outros botoes de acao,
   mais abaixo. Aqui sobrava so um resto que a regra nova ja cobre. */

.rank-badge {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.card-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.55;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    -webkit-line-clamp: 3;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag {
    font-size: 0.72rem;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: help;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    backdrop-filter: blur(4px);
}

.tag i { font-size: 0.65rem; }

.tag-category {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-light);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.tag-auth-true { background: rgba(52, 211, 153, 0.12); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.2); }
.tag-auth-false { background: rgba(251, 191, 36, 0.12); color: var(--yellow); border: 1px solid rgba(251, 191, 36, 0.2); }
.tag-https { background: rgba(52, 211, 153, 0.12); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.2); }
.tag-http { background: rgba(248, 113, 113, 0.12); color: var(--red); border: 1px solid rgba(248, 113, 113, 0.2); }
.tag-cors-yes { background: rgba(52, 211, 153, 0.12); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.2); }
.tag-cors-no { background: rgba(248, 113, 113, 0.12); color: var(--red); border: 1px solid rgba(248, 113, 113, 0.2); }
.tag-cors-unknown { background: rgba(156, 163, 175, 0.12); color: var(--text-muted); border: 1px solid rgba(156, 163, 175, 0.2); }

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.page-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 500;
}

.page-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: transparent;
    color: white;
}

.page-btn.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: transparent;
    color: white;
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.3);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.items-per-page {
    margin-left: 1rem;
    padding: 0.45rem;
    width: auto;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-msg {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--red);
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.2);
    border-radius: var(--radius);
}

.last-updated {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.last-updated i { margin-right: 0.3rem; }

.last-updated a {
    color: var(--accent-light);
    text-decoration: none;
}

.last-updated a:hover { text-decoration: underline; }

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 1000;
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow);
}

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

/* Animação de entrada dos cards */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.api-card {
    animation: fadeInUp 0.3s ease both;
}

/* Barra de progresso de tradução (degradação progressiva) */
.translate-progress {
    grid-column: 1 / -1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
}

.translate-progress-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    z-index: 1;
}

.translate-progress-inner i {
    color: var(--accent-light);
    animation: pulse 1.5s ease infinite;
}

.translate-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--progress, 0%);
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.25), rgba(99, 102, 241, 0.35));
    transition: width 0.3s ease;
}

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

/* Loading real com shimmer */
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
}

.loading p {
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton cards enquanto carrega (feedback visual real) */
.skeleton-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
}

.skeleton-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
}

.skeleton-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    to { left: 100%; }
}

.skeleton-line {
    height: 14px;
    border-radius: 4px;
    background: var(--border);
    margin-bottom: 0.75rem;
}

.skeleton-line.short { width: 40%; }
.skeleton-line.long { width: 100%; }

@media (max-width: 600px) {
    header { padding: 1rem; }
    .api-grid { grid-template-columns: 1fr; }
    #search { width: 100%; }
    .header-controls { flex-direction: column; align-items: stretch; }
    .stats-content { flex-direction: column; align-items: flex-start; }
    .refresh-btn { margin-left: 0; }
    .categories-wrapper { padding: 0.6rem 1rem; }
}

/* ========================================================================
   BLOCO NOVO — site ao vivo (playground, teste em lote, header v2).
   O CSS antigo acima foi mantido: as classes que sumiram (.translate-progress,
   .refresh-btn, .export-btn) sao inertes, as que voltaram nao conflitam.
   ======================================================================== */

[hidden] { display: none !important; }
body.modal-open { overflow: hidden; }

/* ---------- header v2 ---------- */
.brand h1 { margin-bottom: 0.15rem; }
.tagline {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0;
    background: none;
    -webkit-text-fill-color: var(--text-muted);
    -webkit-background-clip: unset;
    background-clip: unset;
}

.ghost-btn {
    background: var(--surface);
    color: var(--text-muted);
    white-space: nowrap;
}
.ghost-btn:hover { color: var(--text); }
.ghost-btn.small { padding: 0.35rem 0.65rem; font-size: 0.78rem; }
.ghost-btn.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    border-color: transparent;
}
.ghost-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.primary-btn {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    border-color: transparent;
    font-weight: 600;
}
.primary-btn:hover { filter: brightness(1.1); }
.primary-btn:disabled { opacity: 0.6; cursor: wait; }

.search-kbd {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0.05rem 0.35rem;
    pointer-events: none;
}

/* ---------- card: acoes ---------- */
.card-actions { display: flex; align-items: center; gap: 0.4rem; }

.test-btn {
    width: 30px;
    height: 30px;
    justify-content: center;
    padding: 0;
    border-radius: 8px;
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.35);
    color: var(--green);
    font-size: 0.75rem;
}
.test-btn:hover { background: rgba(52, 211, 153, 0.25); border-color: var(--green); }

.health-badge {
    font-family: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', monospace;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
}
.health-badge.ok { background: rgba(52, 211, 153, 0.14); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.35); }
.health-badge.dead { background: rgba(248, 113, 113, 0.12); color: var(--red); border: 1px solid rgba(248, 113, 113, 0.3); }

.fa-xs { font-size: 0.65em; opacity: 0.55; }

/* ---------- barra de teste em lote ---------- */
.probe-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}
.probe-info { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 0.85rem; color: var(--text-muted); }
.probe-info > i { color: var(--accent); }
.probe-hint { color: var(--text-muted); opacity: 0.7; font-size: 0.72rem; flex-basis: 100%; }
.probe-progress {
    flex: 1;
    min-width: 160px;
    height: 6px;
    background: var(--card);
    border-radius: 999px;
    overflow: hidden;
}
.probe-progress-inner {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width 0.25s ease;
}

/* ---------- modal / playground ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(6px);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: 18px;
    width: min(760px, 100%);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: 0.55rem; }
.modal-head h2 i { color: var(--accent); }
.modal-close { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: 8px; }
.modal-body { padding: 1.25rem 1.4rem; overflow-y: auto; }

.pg-desc { font-size: 0.87rem; color: var(--text-muted); margin-bottom: 1rem; }
.pg-field { display: block; }
.pg-field > span { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.35rem; }
#pg-endpoint {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    font-family: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', monospace;
    font-size: 0.82rem;
    outline: none;
}
#pg-endpoint:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15); }
.pg-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 0.85rem 0; }

.pg-result {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.9rem;
    margin-bottom: 1.1rem;
}
.pg-metrics { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.pg-metric { display: flex; flex-direction: column; gap: 0.15rem; }
.pg-metric > span { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.pg-metric strong { font-family: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', monospace; font-size: 0.95rem; }
.pg-metric strong.good { color: var(--green); }
.pg-metric strong.bad { color: var(--red); }

.pg-body, .snippet-body {
    font-family: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', monospace;
    font-size: 0.76rem;
    line-height: 1.55;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.8rem;
    max-height: 260px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    color: #cbd5e1;
    margin-bottom: 0.6rem;
}
.pg-body.error { color: #fca5a5; }

.pg-snippets h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.4rem; }
.snippet-tabs { display: flex; gap: 0.3rem; margin-bottom: 0.55rem; }
.snippet-tab { padding: 0.3rem 0.7rem; font-size: 0.76rem; border-radius: 8px; }
.snippet-tab.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: white; border-color: transparent; }

.toast { transition: opacity 0.25s ease, transform 0.25s ease; }
.toast:not(.show) { opacity: 0; transform: translateX(20px); pointer-events: none; }

@media (max-width: 640px) {
    .nav-row, .chip-row { padding-left: 1rem; padding-right: 1rem; }
    .cat-tabs { margin: 0 -1rem; padding: 0 1rem; }
    .stats-bar { padding-left: 1rem; padding-right: 1rem; }
    .modal-body { padding: 1rem; }
}

/* Linha da sondagem externa: a unica que responde "o host esta no ar",
   separada da do browser, que so responde "dá para ler daqui". */
.pg-ci-line {
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 2px solid var(--accent);
    border-radius: 8px;
    padding: 0.5rem 0.7rem;
    margin-bottom: 0.6rem;
}
.pg-ci-line i { color: var(--green); margin-right: 0.25rem; }
.pg-ci-line strong { color: var(--text); font-family: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', monospace; }

.health-badge.cors { background: rgba(251, 191, 36, 0.12); color: var(--yellow); border: 1px solid rgba(251, 191, 36, 0.3); }

/* ==================================================================
   Atalhos, comparador, barra de latencia.
   Tudo que responde pergunta, nao so refina lista.
   ================================================================== */

/* ---------- barra de atalhos ---------- */

.quick-chips {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.quick-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.38rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    transition: transform .18s cubic-bezier(.2,.8,.2,1), background .18s, border-color .18s, color .18s;
    white-space: nowrap;
}

.quick-chip em {
    font-style: normal;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', monospace;
    padding: 0.05rem 0.35rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text);
    transition: background .18s, color .18s;
}

.quick-chip:hover:not(.empty) {
    transform: translateY(-2px);
    border-color: var(--border-hover);
    color: var(--text);
}

.quick-chip:active:not(.empty) { transform: translateY(0) scale(.97); }

.quick-chip.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, .25), rgba(99, 102, 241, .18));
    border-color: var(--accent);
    color: var(--text);
    box-shadow: 0 0 0 1px rgba(139, 92, 246, .35), 0 4px 16px rgba(139, 92, 246, .2);
}

.quick-chip.active em { background: var(--accent); color: #fff; }

.quick-chip i { font-size: 0.75rem; }

.quick-chip[data-quick="usable"] i { color: var(--green); }
.quick-chip[data-quick="fast"] i { color: var(--green); }
.quick-chip[data-quick="dead"] i { color: var(--red); }
.quick-chip[data-quick="cors"] i { color: var(--yellow); }

/* Subconjunto vazio nao convida ao clique: mostra o tamanho, nao um beco. */
.quick-chip.empty { opacity: .35; cursor: not-allowed; }
.quick-chip.empty:hover { transform: none; border-color: var(--border); }

/* ---------- barra de latencia no card ---------- */
.lat-bar {
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
    margin: 0.55rem 0 0.15rem;
}

.lat-fill {
    height: 100%;
    border-radius: 999px;
    transform-origin: left;
    animation: lat-in .6s cubic-bezier(.2,.8,.2,1) both;
}

.lat-fill.fast { background: linear-gradient(90deg, #34d399, #10b981); }
.lat-fill.mid  { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.lat-fill.slow { background: linear-gradient(90deg, #f87171, #ef4444); }

@keyframes lat-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- botoes de acao do card ----------
   Os tres (pick / test / favorite) medem 30x30: sem isso a fileira fica com
   alturas diferentes e o icone de balanca, que e largo, sai da caixa. O
   favorite historicamente nao tinha caixa nenhuma — por isso entra aqui. */
.pick-btn,
.favorite-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: .78rem;
    flex: 0 0 auto;
    transition: transform .18s cubic-bezier(.2,.8,.2,1), background .18s, border-color .18s, color .18s;
}

.pick-btn:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    color: var(--accent-light);
    background: rgba(139, 92, 246, .12);
}

.pick-btn:active { transform: translateY(0) scale(.94); }

/* A estrela precisa ser visivel ANTES de favoritar. Dois defeitos se
   somavam: `fa-star-o` e nome do FA5 e nao existe no FA6 free (medido:
   ::before content="none", caixa 0x0 — o botao ficava literalmente vazio), e a
   borda era transparente, entao nem vazando do que nao renderizava aparecia
   caixa. Agora o estado vazado e `far fa-star` (contorno), com a mesma caixa
   dos outros dois botoes. */
.favorite-btn {
    font-size: .95rem;
    color: #b9c0d6;
    border-color: var(--border);
    background: var(--surface);
}

.favorite-btn:hover {
    transform: translateY(-2px) scale(1.06);
    background: rgba(251, 191, 36, .14);
    border-color: rgba(251, 191, 36, .45);
    color: var(--favorite);
}

/* Favoritada: fundo, borda e brilho — nao so a cor do glifo. */
.favorite-btn.active {
    color: var(--favorite);
    background: rgba(251, 191, 36, .16);
    border-color: rgba(251, 191, 36, .5);
    filter: drop-shadow(0 0 6px rgba(251, 191, 36, .5));
}

.pick-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 0 14px rgba(139, 92, 246, .45);
}

/* ---------- bandeja de comparacao ---------- */
.tray {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 95;
    background: rgba(10, 10, 15, .93);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-hover);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, .5);
    animation: tray-up .32s cubic-bezier(.2,.8,.2,1) both;
}

@keyframes tray-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

.tray-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: .8rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.tray-label {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--text-muted);
    font-weight: 600;
}

.tray-label i { color: var(--accent); }
.tray-items { display: flex; gap: .45rem; flex: 1; flex-wrap: wrap; }

.tray-chip {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .3rem .5rem .3rem .65rem;
    border-radius: 999px;
    border: 1px solid var(--border-hover);
    background: var(--card);
    font-size: .82rem;
    animation: pop .24s cubic-bezier(.2,.9,.3,1.3) both;
}

@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.tray-chip button {
    width: 18px; height: 18px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: .62rem;
    transition: all .15s;
}

.tray-chip button:hover { background: var(--red); color: #fff; }
.tray-actions { display: flex; gap: .5rem; }


/* ---------- entrada dos cards ---------- */
@keyframes card-in {
    from { opacity: 0; transform: translateY(10px) scale(.985); }
    to   { opacity: 1; transform: none; }
}

.api-card { animation: card-in .42s cubic-bezier(.2,.8,.2,1) both; }

@media (prefers-reduced-motion: reduce) {
    .api-card, .lat-fill, .tray, .tray-chip, .modal-overlay, .modal { animation: none !important; }
    .quick-chip, .api-card { transition: none !important; }
}

/* ---------- foco visivel: sem isso o teclado some ---------- */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 6px;
}

@media (max-width: 640px) {
    .quickbar-inner, .tray-inner { padding-left: 1rem; padding-right: 1rem; }
    .quick-chip { font-size: .76rem; padding: .32rem .55rem; }
    .cmp-table tbody th { width: auto; }
}

/* Comparador reusa .modal-overlay/.modal do playground: um segundo overlay
   seria o mesmo componente escrito duas vezes, e a segunda cópia envelhece
   sozinha. Só o que é exclusivo da tabela fica aqui. */
.modal.wide { width: min(1100px, 100%); }
.modal.wide .modal-body { padding: .4rem 1.25rem 1.25rem; }

.cmp-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.cmp-table th, .cmp-table td {
    padding: .7rem .8rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.cmp-table thead th {
    font-size: .95rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border-hover);
    position: sticky;
    top: 0;
    background: var(--surface-solid);
    z-index: 1;
}
.cmp-table thead th a { color: var(--text); text-decoration: none; }
.cmp-table thead th a:hover { color: var(--accent-light); text-decoration: underline; }
.cmp-table tbody th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: .8rem;
    white-space: nowrap;
    width: 130px;
}
.cmp-table td { color: var(--text); }
.cmp-table td.wide { font-size: .84rem; line-height: 1.45; color: var(--text-muted); }
.cmp-good { color: var(--green); font-weight: 600; }
.cmp-bad  { color: var(--red);   font-weight: 600; }
.cmp-warn { color: var(--yellow);font-weight: 600; }

/* A celula que decide: melhor latencia entre as comparadas. */
.cmp-table td.best {
    background: rgba(52, 211, 153, .08);
    box-shadow: inset 2px 0 0 var(--green);
    font-weight: 700;
}
.cmp-table tr:hover td { background: rgba(255, 255, 255, .025); }
.cmp-table tr:hover td.best { background: rgba(52, 211, 153, .13); }
