/* A3 Telecom — página do teste de velocidade (velocidade.html).
   O painel do medidor é sempre escuro (um instrumento, como nos testes de velocidade conhecidos), nos dois temas;
   o restante da página segue o tema do site. Download em azul/ciano da marca, upload em dourado. */

/* minmax(0, 1fr): a coluna nunca passa da largura da tela. Com a coluna automática, a tabela do histórico (5 colunas
   sem quebra de linha) esticava a página para ~714 px depois do primeiro teste, e o celular afastava o zoom. */
.vel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.vel-painel {
  --vp-ink: #EEF3FF; --vp-ink-2: #AFBCE8; --vp-ink-3: #8394CC; --vp-line: rgba(255, 255, 255, 0.1);
  --vp-down: #8FDCFF; --vp-up: #F5C25A;
  position: relative; overflow: hidden; isolation: isolate;
  border-radius: 28px; padding: clamp(16px, 3vw, 30px) clamp(14px, 3vw, 30px) clamp(18px, 3vw, 28px);
  background: radial-gradient(120% 70% at 50% 0%, #142A86 0%, #0A1550 48%, #050A2C 100%);
  color: var(--vp-ink); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 40px 80px -40px rgba(3, 8, 45, 0.75);
}
/* estrelinhas discretas no fundo do painel */
.vel-painel::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0.55;
  background-image: radial-gradient(1px 1px at 12% 22%, #fff 50%, transparent 52%), radial-gradient(1px 1px at 82% 14%, #fff 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 68% 64%, #fff 50%, transparent 52%), radial-gradient(1px 1px at 24% 74%, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 92% 82%, #fff 50%, transparent 52%), radial-gradient(1.2px 1.2px at 40% 8%, #fff 50%, transparent 52%); }

/* ---------- números de cima ---------- */
.vel-metricas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.vel-m { min-width: 0; border-radius: 18px; padding: 12px 14px 14px; background: rgba(255, 255, 255, 0.045); border: 1px solid var(--vp-line); }
.vel-m-rot { display: flex; align-items: center; gap: 6px; font-size: 0.875rem; font-weight: 650; color: var(--vp-ink-2); white-space: nowrap; }
.vel-m-rot small { font-size: 0.75rem; font-weight: 500; color: var(--vp-ink-3); }
.vel-m-rot .ico { width: 17px; height: 17px; }
.vel-m-down .vel-m-rot .ico { color: var(--vp-down); }
.vel-m-up .vel-m-rot .ico { color: var(--vp-up); }
.vel-m-ping .vel-m-rot .ico { color: #C9B6FF; }
.vel-m strong { display: block; margin-top: 4px; font-family: var(--f-display); font-weight: 600; font-size: clamp(1.45rem, 1.05rem + 1.9vw, 2.35rem); line-height: 1.1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vel-carga { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 4px; font-size: 0.8125rem; color: var(--vp-ink-3); }
.vel-carga span { display: inline-flex; align-items: center; gap: 3px; }
.vel-carga .ico { width: 13px; height: 13px; }
.vel-carga b { font-weight: 650; color: var(--vp-ink-2); font-variant-numeric: tabular-nums; }
/* O número sempre cabe inteiro no cartão (sem reticências): a letra da fonte de destaque é larga, e "812,45" ocupa
   ~4,2 vezes o tamanho da fonte. Com o tamanho preso a 23% da largura do cartão, 6 caracteres sempre cabem. */
@supports (font-size: 1cqi) {
  .vel-m { container-type: inline-size; }
  .vel-m strong { font-size: min(clamp(1.45rem, 1.05rem + 1.9vw, 2.35rem), 23cqi); }
}
/* Celular: download e upload lado a lado, em destaque (em três colunas, "812,45" não cabia); o ping vira uma linha
   compacta em cima, com o ping durante o download e o upload à direita. */
@media (max-width: 479px) {
  .vel-metricas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vel-metricas .vel-m-ping { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 9px 12px; }
  .vel-metricas .vel-m-ping strong { margin-top: 0; font-size: 1.375rem; }
  .vel-metricas .vel-m-ping .vel-carga { margin: 0 0 0 auto; }
}
/* antes do primeiro teste os números ainda são traços: ficam apagados */
[data-vel-estado="pronto"] .vel-m strong, [data-vel-estado="pronto"] .vel-carga b { color: var(--vp-ink-3); }
[data-vel-fase="download"] .vel-m-down, [data-vel-fase="upload"] .vel-m-up, [data-vel-fase="ping"] .vel-m-ping { border-color: rgba(143, 220, 255, 0.45); background: rgba(143, 220, 255, 0.07); }
[data-vel-fase="upload"] .vel-m-up { border-color: rgba(245, 194, 90, 0.5); background: rgba(245, 194, 90, 0.07); }

/* ---------- medidor ---------- */
.vel-medidor { position: relative; width: min(100%, 440px); margin: 6px auto 0; aspect-ratio: 400 / 330; }
.vel-gauge { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.vg-trilho { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 18; stroke-linecap: round; }
.vg-arco { fill: none; stroke: url(#vg-down); stroke-width: 18; stroke-linecap: round; }
.vg-brilho { fill: none; stroke: #4FB4FF; stroke-opacity: 0.16; stroke-width: 38; stroke-linecap: round; }
[data-vel-fase="upload"] .vg-arco { stroke: url(#vg-up); }
[data-vel-fase="upload"] .vg-brilho { stroke: #F2A93B; }
.vg-miudas { fill: none; stroke: rgba(255, 255, 255, 0.16); stroke-width: 1; }
.vg-marcas path { fill: none; stroke: rgba(255, 255, 255, 0.5); stroke-width: 2; stroke-linecap: round; }
.vg-marcas text { fill: var(--vp-ink-2); font-family: var(--f-body, system-ui), sans-serif; font-size: 14px; font-weight: 600; text-anchor: middle; }
.vg-agulha path { fill: url(#vg-agulha); }
.vg-eixo { fill: #0A1550; stroke: rgba(255, 255, 255, 0.55); stroke-width: 2; }
.vg-eixo-luz { fill: var(--vp-down); }
[data-vel-fase="upload"] .vg-eixo-luz { fill: var(--vp-up); }
.vel-centro { position: absolute; left: 0; right: 0; top: 66%; display: grid; justify-items: center; gap: 2px; text-align: center; pointer-events: none; }
.vel-centro strong { font-family: var(--f-display); font-weight: 600; font-size: clamp(2.3rem, 1.5rem + 3.4vw, 3.5rem); line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.vel-centro span { font-size: 0.9375rem; font-weight: 600; color: var(--vp-ink-2); }
/* antes de começar (e no fim): o medidor fica apagado atrás do botão */
.vel-gauge, .vel-centro { transition: opacity 400ms ease; }
[data-vel-estado="pronto"] .vel-gauge, [data-vel-estado="fim"] .vel-gauge, [data-vel-estado="erro"] .vel-gauge { opacity: 0.32; }
[data-vel-estado="pronto"] .vel-centro, [data-vel-estado="fim"] .vel-centro, [data-vel-estado="erro"] .vel-centro,
[data-vel-estado="pronto"] .vg-agulha, [data-vel-estado="fim"] .vg-agulha, [data-vel-estado="erro"] .vg-agulha { opacity: 0; }

/* botão Iniciar: círculo grande no centro do medidor */
.vel-iniciar {
  position: absolute; left: 50%; top: 55%; width: min(46%, 196px); aspect-ratio: 1; border-radius: 50%;
  transform: translate(-50%, -50%); display: grid; place-items: center; cursor: pointer;
  background: radial-gradient(circle at 50% 35%, #2A5BE8 0%, #1638B8 55%, #0D2580 100%);
  box-shadow: 0 0 0 2px rgba(143, 220, 255, 0.55), 0 0 0 10px rgba(143, 220, 255, 0.08), 0 18px 40px -12px rgba(42, 120, 255, 0.7), inset 0 2px 0 rgba(255, 255, 255, 0.25);
  color: #fff; transition: transform 220ms cubic-bezier(0.32, 0.72, 0, 1), opacity 220ms ease, box-shadow 220ms ease;
}
.vel-iniciar span { font-family: var(--f-display); font-weight: 600; font-size: clamp(1.15rem, 0.9rem + 1.2vw, 1.6rem); letter-spacing: 0.04em; text-transform: uppercase; max-width: 80%; line-height: 1.1; text-align: center; text-wrap: balance; }
/* O texto acompanha o tamanho do círculo: no celular o círculo encolhe (46% do medidor), e com a fonte fixa
   "DE NOVO" encostava na borda (96% do círculo em 320 px) e "TENTAR" passava dela em 280 px. Com 11,5% da largura do
   botão, a palavra mais longa ocupa ~61% e "DE NOVO" ~68%; "TENTAR DE NOVO" quebra em duas linhas. */
@supports (font-size: 1cqi) {
  .vel-iniciar { container-type: inline-size; }
  .vel-iniciar span { font-size: min(clamp(1.15rem, 0.9rem + 1.2vw, 1.6rem), 11.5cqi); }
}
.vel-iniciar::before { content: ""; position: absolute; inset: -14px; border-radius: 50%; border: 2px solid rgba(143, 220, 255, 0.35); opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduce"]) [data-vel-estado="pronto"] .vel-iniciar::before { animation: vel-onda 2.4s cubic-bezier(0.2, 0.7, 0.3, 1) infinite; }
}
@keyframes vel-onda { 0% { transform: scale(0.9); opacity: 0.8; } 100% { transform: scale(1.35); opacity: 0; } }
@media (hover: hover) and (pointer: fine) { .vel-iniciar:hover { transform: translate(-50%, -50%) scale(1.04); box-shadow: 0 0 0 2px rgba(143, 220, 255, 0.85), 0 0 0 12px rgba(143, 220, 255, 0.12), 0 22px 46px -12px rgba(42, 120, 255, 0.85), inset 0 2px 0 rgba(255, 255, 255, 0.3); } }
.vel-iniciar:active { transform: translate(-50%, -50%) scale(0.97); }
.vel-iniciar:focus-visible { outline: 3px solid #8FDCFF; outline-offset: 6px; }
[data-vel-estado="rodando"] .vel-iniciar { opacity: 0; transform: translate(-50%, -50%) scale(0.85); pointer-events: none; }
[data-vel-estado="fim"] .vel-iniciar, [data-vel-estado="erro"] .vel-iniciar { width: min(34%, 150px); }
[data-vel-estado="fim"] .vel-iniciar span, [data-vel-estado="erro"] .vel-iniciar span { font-size: clamp(0.95rem, 0.8rem + 0.6vw, 1.15rem); letter-spacing: 0.02em; }

/* ---------- status e gráfico ---------- */
.vel-status { min-height: 1.5em; margin-top: 4px; text-align: center; font-size: 0.9375rem; color: var(--vp-ink-2); }
[data-vel-estado="erro"] .vel-status { color: #FFC9C9; }
.vel-grafico { display: block; width: 100%; height: 56px; margin-top: 8px; }
.vg-area { fill: rgba(143, 220, 255, 0.14); }
.vg-linha { fill: none; stroke: var(--vp-down); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
[data-vel-fase="upload"] .vg-area { fill: rgba(245, 194, 90, 0.14); }
[data-vel-fase="upload"] .vg-linha { stroke: var(--vp-up); }
[data-vel-estado="pronto"] .vel-grafico { visibility: hidden; }

/* ---------- provedor e servidor ---------- */
.vel-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--vp-line); }
.vel-i { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.vel-i > .ico { flex: none; width: 36px; height: 36px; padding: 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); color: var(--vp-down); stroke-width: 1.7; }
.vel-i > div { min-width: 0; }
.vel-i-rot { font-size: 0.75rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--vp-ink-3); }
.vel-i strong { display: block; font-weight: 650; overflow-wrap: anywhere; }
.vel-i span { display: block; font-size: 0.875rem; color: var(--vp-ink-2); overflow-wrap: anywhere; }
.vel-trocar { margin-top: 4px; padding: 6px 0; background: none; border: 0; color: var(--vp-down); font-weight: 650; font-size: 0.875rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; min-height: 32px; }
.vel-trocar:focus-visible { outline: 2px solid #8FDCFF; outline-offset: 3px; border-radius: 4px; }
[data-vel-estado="rodando"] .vel-trocar { visibility: hidden; }

/* ---------- lista de servidores ---------- */
.vel-servidores { margin-top: 12px; padding: 12px; border-radius: 16px; background: rgba(255, 255, 255, 0.045); border: 1px solid var(--vp-line); }
.vel-servidores ul { display: grid; gap: 6px; margin-top: 8px; }
.vel-servidores li[hidden] { display: none; }
.vel-srv { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 12px; border-radius: 12px; border: 1px solid transparent; cursor: pointer; transition: background-color 160ms ease, border-color 160ms ease; }
@media (hover: hover) and (pointer: fine) { .vel-srv:hover { background: rgba(255, 255, 255, 0.05); } }
.vel-srv input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: #8FDCFF; }
.vel-srv:has(input:checked) { border-color: rgba(143, 220, 255, 0.5); background: rgba(143, 220, 255, 0.08); }
.vel-srv:has(input:focus-visible) { outline: 2px solid #8FDCFF; outline-offset: 2px; }
.vel-srv-txt { display: grid; flex: 1; min-width: 0; }
.vel-srv-txt strong { font-weight: 650; overflow-wrap: anywhere; }
.vel-srv-txt span { font-size: 0.8125rem; color: var(--vp-ink-2); overflow-wrap: anywhere; }
.vel-srv-ms { flex: none; font-variant-numeric: tabular-nums; font-size: 0.875rem; font-weight: 650; color: var(--vp-ink-2); }
.vel-srv-nota { margin-top: 8px; font-size: 0.8125rem; color: var(--vp-ink-3); }

/* ---------- resultado ---------- */
.vel-resultado { border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); padding: clamp(18px, 3vw, 28px); }
.vel-resultado h2, .vel-historico h2, .vel-card h2 { font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.6rem); }
.vel-notas { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.vel-notas li { display: grid; justify-items: center; gap: 6px; padding: 14px 8px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); text-align: center; }
.vel-notas .ico { width: 26px; height: 26px; color: var(--glow); }
.vel-nota-nome { font-weight: 650; font-size: 0.9375rem; }
.vel-pontos { display: inline-flex; gap: 4px; }
.vel-pontos i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.vel-pontos[data-n="1"] i:nth-child(-n+1), .vel-pontos[data-n="2"] i:nth-child(-n+2), .vel-pontos[data-n="3"] i:nth-child(-n+3),
.vel-pontos[data-n="4"] i:nth-child(-n+4), .vel-pontos[data-n="5"] i:nth-child(-n+5) { background: var(--brand); }
.vel-nota-rot { font-size: 0.8125rem; color: var(--ink-3); }
.vel-fino { margin-top: 14px; font-size: 0.875rem; color: var(--ink-3); }
.vel-acoes { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* ---------- histórico ---------- */
.vel-historico { border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); padding: clamp(18px, 3vw, 28px); }
.vel-hist-topo { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.vel-historico table { width: 100%; margin-top: 12px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.vel-historico th, .vel-historico td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.vel-historico th { font-size: 0.8125rem; font-weight: 650; color: var(--ink-3); }
.vel-historico button.link { background: none; border: 0; padding: 6px 0; color: var(--brand); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- dicas e como funciona ---------- */
.vel-extras { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 26px; }
.vel-card { border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); padding: clamp(18px, 3vw, 28px); }
.vel-card p { margin-top: 10px; color: var(--ink-2); }
.vel-lista { display: grid; gap: 10px; margin-top: 12px; color: var(--ink-2); }
.vel-lista li { position: relative; padding-left: 22px; }
.vel-lista li::before { content: ""; position: absolute; left: 4px; top: 0.6em; width: 7px; height: 7px; border-radius: 50%; background: var(--glow); }

@media (max-width: 719px) {
  .vel-notas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vel-extras { grid-template-columns: minmax(0, 1fr); }
  .vel-info { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
  .vel-metricas { gap: 6px; }
  .vel-m { padding: 10px 10px 12px; border-radius: 14px; }
  .vel-m-rot { font-size: 0.8125rem; gap: 4px; }
  .vel-m-rot small { display: none; }
}
/* histórico no celular: cada teste vira um cartão (data em cima, os três números lado a lado, servidor embaixo), em vez
   de uma tabela de 5 colunas que não cabe. Os nomes das colunas vêm de data-rot (velocidade.js); os papéis ARIA na
   tabela mantêm a leitura de tela como tabela mesmo com display trocado. */
@media (max-width: 599px) {
  .vel-historico thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .vel-historico table, .vel-historico tbody { display: block; }
  .vel-historico tbody tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .vel-historico td { padding: 0; border: 0; white-space: normal; }
  .vel-historico td:first-child { grid-column: 1 / -1; font-weight: 650; }
  .vel-historico td:last-child { grid-column: 1 / -1; font-size: 0.8125rem; color: var(--ink-3); overflow-wrap: anywhere; }
  .vel-historico td[data-rot] { font-size: 1.0625rem; font-weight: 650; }
  .vel-historico td[data-rot]::before { content: attr(data-rot); display: block; margin-bottom: 2px; font-size: 0.75rem; font-weight: 500; color: var(--ink-3); }
  .vel-historico td[data-uni]::after { content: " " attr(data-uni); font-size: 0.75rem; font-weight: 500; color: var(--ink-3); }
}
@media (forced-colors: active) { .vel-gauge { display: none; } .vel-iniciar { border: 2px solid ButtonText; } }
