* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    background-color: #0a0c0e;
    color: #fff;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.5rem;
    height: 100vh;
}

.container {
    max-width: 1200px;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 0;
    padding: 0.5rem 0;
}

h1 {
    font-weight: 500;
    font-size: 2.2rem;
    letter-spacing: 2px;
    color: #e5e9f0;
    text-align: center;
    margin-bottom: 0.25rem;
    flex-shrink: 0;
}

.subhead {
    text-align: center;
    color: #8c8f9c;
    margin-bottom: 1rem;
    font-size: 1rem;
    border-bottom: 1px solid #23262b;
    padding-bottom: 0.8rem;
    flex-shrink: 0;
}

/* Layout de dos columnas para escritorio */
.test-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
    flex: 1;
    min-height: 0;
}

@media (min-width: 800px) {
    .test-row {
        grid-template-columns: 1fr 1fr;
    }
}

.speed-card {
    background: #13171a;
    border-radius: 32px;
    padding: 1.2rem;
    border: 1px solid #252a30;
    box-shadow: 0 12px 28px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.speed-label {
    color: #a0a5b0;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.speed-display {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 0;
}

.speed-number {
    font-size: 10rem;
    font-weight: 700;
    line-height: 1;
    color: #FFD700;
    font-feature-settings: "tnum";
}

.speed-unit {
    font-size: 2.5rem;
    color: #7f8490;
    margin-left: 0.5rem;
}

.ping-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #262c32;
    color: #b5bac4;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #262c32;
    border-radius: 3px;
    margin: 0.8rem 0 0.3rem;
    overflow: hidden;
    flex-shrink: 0;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: #45b7d1;
    border-radius: 3px;
    transition: width 0.2s ease;
}

.chart-container {
    background: #13171a;
    border-radius: 16px;
    padding: 1rem;
    border: 1px solid #252a30;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 250px;
}

#speedChart {
    width: 100% !important;
    height: 100% !important;
    max-height: 100%;
}

.info-panel {
    background: #0f1215;
    border-radius: 24px;
    padding: 1.2rem;
    margin-bottom: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #2a2f36;
    backdrop-filter: blur(4px);
    flex-shrink: 0;
}

.ip-badge {
    display: flex;
    flex-direction: column;
}

.ip-main {
    font-size: 1.6rem;
    font-weight: 600;
    font-family: monospace;
    letter-spacing: 0.5px;
}

.ip-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #9096a2;
    letter-spacing: 2px;
    margin-bottom: 0.2rem;
}

.isp-info {
    text-align: right;
}

.isp-name {
    font-size: 1.3rem;
    font-weight: 600;
}

.country-flag {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.3rem;
    justify-content: flex-end;
}

.flag-emoji {
    font-size: 1.8rem;
}

.button {
    background: #1e262c;
    color: white;
    font-size: 1.4rem;
    font-weight: 600;
    padding: 0.8rem 2.5rem;
    border-radius: 60px;
    width: 100%;
    cursor: pointer;
    border: 1px solid #3a424a;
    transition: all 0.2s;
    margin: 0.5rem 0;
    flex-shrink: 0;
}

.button:hover:not(:disabled) {
    background: #2d3740;
    border-color: #5f6b78;
}

.button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.status {
    color: #45b7d1;
    text-align: center;
    margin: 0.3rem 0;
    font-weight: 400;
    min-height: 1.5rem;
    flex-shrink: 0;
}

.error {
    color: #ff7a75;
    text-align: center;
    margin: 0.3rem 0;
    flex-shrink: 0;
}

.footer {
    color: #5d646e;
    text-align: center;
    font-size: 0.8rem;
    border-top: 1px solid #1f252b;
    padding-top: 0.5rem;
    margin-top: 0.3rem;
    flex-shrink: 0;
}

/* Estilos para los botones de compartir */
.share-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.share-button {
    background: #1e262c;
    color: white;
    border: 1px solid #3a424a;
    border-radius: 30px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: background 0.2s;
}

.share-button:hover {
    background: #2d3740;
}

/* Responsive para móvil y tablet */
@media (max-width: 800px) {
    body {
        padding: 0.2rem;
    }
    h1 {
        font-size: 1.6rem;
        margin-bottom: 0.1rem;
    }
    .subhead {
        font-size: 0.8rem;
        margin-bottom: 0.4rem;
        padding-bottom: 0.4rem;
    }
    .test-row {
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }
    .speed-card {
        padding: 0.8rem;
    }
    .speed-number {
        font-size: 4rem;
        color: #FFD700;
    }
    .speed-unit {
        font-size: 1.5rem;
    }
    .ping-row {
        font-size: 1rem;
        margin-top: 0.3rem;
        padding-top: 0.3rem;
    }
    .progress-bar {
        margin: 0.5rem 0 0.2rem;
    }
    .chart-container {
        min-height: 140px;
        padding: 0.5rem;
    }
    .info-panel {
        padding: 0.8rem;
        margin-bottom: 0.4rem;
    }
    .ip-main {
        font-size: 1.1rem;
    }
    .isp-name {
        font-size: 1rem;
    }
    .flag-emoji {
        font-size: 1.4rem;
    }
    .button {
        font-size: 1rem;
        padding: 0.5rem 1.5rem;
        margin: 0.2rem 0;
    }
    .footer {
        font-size: 0.7rem;
        padding-top: 0.3rem;
        margin-top: 0.2rem;
    }
    .speed-display {
        margin-bottom: 0.5rem;
    }
    .progress-bar {
        margin-top: 0.2rem;
    }

    /* Botones de compartir en móvil: en fila horizontal */
    .share-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    .share-button {
        width: auto;
        min-width: 120px;
        flex: 1 1 auto;
        justify-content: center;
    }
}

@media (max-width: 400px) {
    .speed-number {
        font-size: 3rem;
    }
    .speed-unit {
        font-size: 1.2rem;
    }
    .chart-container {
        min-height: 120px;
    }
    .ip-main {
        font-size: 1rem;
    }
    .speed-display {
        margin-bottom: 0.3rem;
    }
    .share-button {
        min-width: 100px;
        font-size: 0.8rem;
    }
}