/* ── CUSTOM SPEEDTEST PREMIUM COMPONENT STYLING ── */
.speedtest-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px; /* espaçamento único entre todos os blocos */
}

/* Speedometer Canvas Gauge */
.speed-dial-wrapper {
    position: relative;
    width: 260px;
    height: 220px;
    margin: 0 auto;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.45);
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    box-shadow: 
        0 10px 30px rgba(30, 64, 175, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.speed-dial-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 36px rgba(30, 64, 175, 0.08);
    background: rgba(255, 255, 255, 0.65);
    border-color: rgba(255, 255, 255, 0.85);
}
.speed-gauge-canvas {
    display: block;
    width: 260px;
    height: 220px;
    image-rendering: -webkit-optimize-contrast;
}
.speed-dial-content {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    white-space: nowrap;
}
.speed-dial-number {
    display: block;
    font-family: 'Outfit', sans-serif;
    font-size: 3.2rem;
    font-weight: 900;
    background: linear-gradient(135deg, #1e40af 0%, #0ea5e9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.04em;
    text-shadow: 0 4px 12px rgba(14, 165, 233, 0.1);
}
.speed-dial-unit {
    display: block;
    font-family: 'Outfit', sans-serif;
    font-size: 0.68rem;
    font-weight: 800;
    color: #6080c0;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    margin-top: 4px;
}

/* Grid de Resultados — 4 tiles */
.results-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    width: 100%;
}
@media (max-width: 380px) {
    .results-grid { grid-template-columns: repeat(2, 1fr); }
}
.result-tile {
    background: rgba(255, 255, 255, 0.55);
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 
        0 4px 10px rgba(15, 23, 42, 0.02),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.result-tile:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(30, 64, 175, 0.2);
    box-shadow: 0 8px 20px rgba(20, 60, 180, 0.06);
}
.result-tile.active {
    border-color: #1a4ed8;
    background: rgba(239, 246, 255, 0.9);
    box-shadow: 0 10px 20px rgba(26, 78, 216, 0.12);
    transform: translateY(-4px) scale(1.03);
}
.result-tile i {
    font-size: 1.25rem;
    color: #94a3b8;
    margin-bottom: 6px;
    transition: color 0.3s ease, transform 0.3s ease;
}
.result-tile:hover i {
    color: #1e40af;
    transform: scale(1.1);
}
.result-tile.active i {
    color: #1a4ed8;
    will-change: transform, opacity;
    animation: pulse-icon 1.5s infinite ease-in-out;
}
@keyframes pulse-icon {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.7; }
}
.result-tile-lbl {
    font-size: 0.65rem;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
}
.result-tile-val {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
}

/* Dynamic Assessment Box */
.assessment-banner {
    width: 100%;
    border-radius: 18px;
    padding: 14px 16px;
    font-size: 0.82rem;
    line-height: 1.5;
    display: none;
    align-items: flex-start;
    gap: 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
    animation: slide-up-fade 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.assessment-banner.show {
    display: flex;
}
.assessment-banner.excellent {
    background: linear-gradient(135deg, rgba(240, 253, 244, 0.95) 0%, rgba(220, 252, 231, 0.95) 100%);
    border: 1.5px solid rgba(74, 222, 128, 0.45);
    color: #14532d;
}
.assessment-banner.moderate {
    background: linear-gradient(135deg, rgba(254, 252, 232, 0.95) 0%, rgba(254, 240, 138, 0.95) 100%);
    border: 1.5px solid rgba(234, 179, 8, 0.45);
    color: #713f12;
}
.assessment-banner.poor {
    background: linear-gradient(135deg, rgba(254, 242, 242, 0.95) 0%, rgba(254, 226, 226, 0.95) 100%);
    border: 1.5px solid rgba(248, 113, 113, 0.45);
    color: #7f1d1d;
}
.assessment-banner i {
    font-size: 1.25rem;
    margin-top: 2px;
}
.assessment-banner.show {
    will-change: opacity, transform;
}
@keyframes slide-up-fade {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Botão de Controle */
.btn-speedtest {
    height: 52px;
    width: 100%;
    background: linear-gradient(135deg, #1e40af 0%, #0ea5e9 50%, #10b981 100%);
    background-size: 200% auto;
    color: #fff;
    border: none;
    border-radius: 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.88rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(14, 165, 233, 0.3);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.btn-speedtest:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(14, 165, 233, 0.45);
    background-position: right center; /* efeito de aceleração mudando do azul para o ciano/verde no hover! */
}
.btn-speedtest:active:not(:disabled) {
    transform: translateY(0);
}
.btn-speedtest:disabled {
    background: #cbd5e1;
    color: #64748b;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* Painel de Metadados de Conexão Premium */
.metadata-panel {
    width: 100%;
    background: rgba(255, 255, 255, 0.45);
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    border-radius: 18px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
    font-size: 0.82rem;
    color: #334155;
    text-align: left;
    box-shadow: 0 4px 15px rgba(20, 60, 180, 0.02);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    transition: all 0.3s ease;
}
.metadata-panel:hover {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(255, 255, 255, 0.85);
}
.metadata-title {
    font-size: 0.72rem;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    padding-bottom: 6px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.metadata-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.metadata-label {
    font-weight: 600;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
}
.metadata-value {
    font-weight: 700;
    color: #0f172a;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.result-tile-val {
    font-family: 'Outfit', sans-serif;
    font-size: 0.82rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.3;
    word-break: break-word;
    margin-top: 2px;
}

/* Badge de Status do Emulador */
.emu-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 50px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.7rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 14px;
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.emu-badge.inactive {
    background: rgba(239, 246, 255, 0.8);
    color: #1e40af;
    border: 1.5px solid rgba(30, 64, 175, 0.15);
}
.emu-badge.active {
    background: rgba(254, 243, 199, 0.9);
    color: #d97706;
    border: 1.5px solid rgba(217, 119, 6, 0.25);
    position: relative;
}
/* Pulso via ::after com transform+opacity — GPU composited, sem Paint */
.emu-badge.active::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    border: 2px solid rgba(217, 119, 6, 0.45);
    will-change: transform, opacity;
    animation: pulse-badge 1.8s ease-out infinite;
    pointer-events: none;
}
@keyframes pulse-badge {
    0%   { transform: scale(1);   opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* Rodapé customizado */
.speedtest-footer {
    margin-top: 15px;
    padding-top: 14px;
    border-top: 1px solid rgba(208, 216, 240, 0.7);
    width: 100%;
    display: flex;
    justify-content: center;
}

/* ── DIAGNOSTICS & TELEMETRY WIDGET STYLING ── */
.diagnostics-panel {
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.45);
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 15px rgba(20, 60, 180, 0.02);
    transition: all 0.3s ease;
}
.diagnostics-panel:hover {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(255, 255, 255, 0.85);
}
.diagnostics-title {
    color: #1e40af !important;
    border-bottom-color: rgba(219, 234, 254, 0.8) !important;
}
.diagnostics-text {
    font-size: 0.76rem;
    color: #475569;
    margin-bottom: 12px;
    line-height: 1.45;
}
.diagnostics-links-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
}
.diagnostics-link-btn {
    flex: 1 1 120px;
    min-width: 120px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: rgba(30, 64, 175, 0.08);
    color: #1e40af;
    border: 1px solid rgba(30, 64, 175, 0.15);
    border-radius: 12px;
    text-decoration: none;
    font-weight: 800;
    font-size: 0.72rem;
    text-transform: uppercase;
    transition: all 0.25s ease;
    box-sizing: border-box;
}
.diagnostics-link-btn:hover {
    background: rgba(30, 64, 175, 0.15);
    transform: translateY(-1.5px);
    color: #1d4ed8;
}

/* ── PARTICLE REPLACEMENTS FOR ZERO-INLINE COMPLIANCE (CSP SANITIZATION) ── */
.particle-1 { left: 12%; animation-duration: 17s; animation-delay: -2s; }
.particle-2 { left: 30%; animation-duration: 21s; animation-delay: -5s; }
.particle-3 { left: 50%; animation-duration: 15s; animation-delay: -1s; }
.particle-4 { left: 75%; animation-duration: 23s; animation-delay: -8s; }
.particle-5 { left: 90%; animation-duration: 18s; animation-delay: -11s; }

/* ── Ações (botão iniciar + compartilhar) ── */
.speedtest-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    align-items: stretch;
}
.speedtest-actions .btn-speedtest {
    flex: 1;
}
.btn-share {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.45);
    color: #1e40af;
    font-size: 1.15rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 
        0 4px 10px rgba(15, 23, 42, 0.02),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-share:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(30, 64, 175, 0.2);
    color: #1d4ed8;
    box-shadow: 0 6px 16px rgba(30, 64, 175, 0.08);
}
.btn-share:active {
    transform: translateY(0);
}

/* ── Histórico de testes ── */
.history-panel {
    width: 100%;
    background: rgba(255, 255, 255, 0.45);
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    border-radius: 18px;
    padding: 14px 14px 10px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 15px rgba(20, 60, 180, 0.02);
    transition: all 0.3s ease;
}
.history-panel:hover {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(255, 255, 255, 0.85);
}

/* Tag "seus testes" ao lado do título */
.hist-mine-tag {
    margin-left: auto;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #dbeafe;
    border-radius: 20px;
    padding: 2px 8px;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;   /* larguras controladas — sem scroll horizontal */
}
.history-table colgroup { display: table-column-group; }

/* Larguras fixas das 5 colunas */
.history-table th:nth-child(1),
.history-table td:nth-child(1) { width: 44%; }   /* data/hora */
.history-table th:nth-child(2),
.history-table td:nth-child(2) { width: 17%; }   /* ping */
.history-table th:nth-child(3),
.history-table td:nth-child(3) { width: 15%; }   /* download */
.history-table th:nth-child(4),
.history-table td:nth-child(4) { width: 15%; }   /* upload */
.history-table th:nth-child(5),
.history-table td:nth-child(5) { width: 9%; }    /* emoji */

.history-table th {
    font-size: 0.58rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    padding: 0 4px 7px;
    text-align: left;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}
.history-table td {
    padding: 7px 4px;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-bottom: 1px solid rgba(226, 232, 240, 0.4);
    font-size: 0.74rem;
    font-weight: 600;
    color: #334155;
}
.history-table tr:last-child td { border-bottom: none; }

/* Linha mais recente — destaque sutil */
.history-table tr.hist-latest td {
    color: #0d1f6e;
    font-weight: 700;
}

.hist-ts {
    font-size: 0.7rem;
    font-weight: 500;
    color: #64748b;
}
.hist-latest .hist-ts { color: #1e40af; font-weight: 700; }

.hist-num {
    font-variant-numeric: tabular-nums;
    text-align: right;
    padding-right: 6px !important;
}
.hist-em {
    font-size: 0.85rem;
    text-align: center;
}

/* ── Accordion ── */
.acc-panel { gap: 0; }

/* Título vira botão clicável */
button.acc-toggle {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    padding: 0;
    /* Herda o visual de .metadata-title */
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    padding-bottom: 6px;
    margin-bottom: 0; /* reseta margem — o acc-body cuida do espaçamento */
}
button.acc-toggle:hover { color: #1a4ed8; }

.acc-arrow {
    margin-left: auto;
    font-size: 0.7rem;
    color: #94a3b8;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}
.acc-panel[data-open="true"] .acc-arrow  { transform: rotate(180deg); }
.acc-panel[data-open="false"] .acc-arrow { transform: rotate(0deg); }

/* Corpo colapsável via max-height */
.acc-body {
    overflow: hidden;
    max-height: 600px;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity    0.25s ease,
                margin     0.25s ease;
    opacity: 1;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.acc-body[hidden] {
    display: flex !important; /* substitui o hidden nativo p/ usar max-height */
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    pointer-events: none;
    gap: 0;
}

/* Compacta o card e a área do logo nesta página */
.lv2-layout .lv2-card      { padding: 20px 24px 18px; }
.lv2-layout .lv2-logo-scene { width: 100px; height: 100px; margin-bottom: 8px; }
.lv2-layout .lv2-logo-img   { width:  92px; height:  92px; }
.lv2-layout .lv2-title      { margin-bottom: 2px; }

.lv2-subtitle.speedtest-subtitle { margin-bottom: 6px; }
.assessment-content strong {
    display: block;
    font-weight: 700;
    margin-bottom: 2px;
}

/* Badge waiting Service Worker state */
.emu-badge.waiting-sw {
    background: #fee2e2 !important;
    color: #ef4444 !important;
    border-color: #fecaca !important;
}

