/* ============================================================
   BigMIS SpeedTest — 3D Liquid Glass Design System
   ============================================================ */

/* ---------- Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ---------- Custom Properties ---------- */
:root {
    /* Liquid glass palette */
    --glass-bg: rgba(255, 255, 255, 0.06);
    --glass-bg-hover: rgba(255, 255, 255, 0.10);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-border-bright: rgba(255, 255, 255, 0.22);
    --glass-shadow: rgba(0, 0, 0, 0.35);
    --glass-inner-glow: rgba(255, 255, 255, 0.05);
    --glass-blur: 24px;
    --glass-blur-heavy: 40px;

    /* Accent colors */
    --accent-cyan: #00e5ff;
    --accent-cyan-glow: rgba(0, 229, 255, 0.4);
    --accent-purple: #b388ff;
    --accent-purple-glow: rgba(179, 136, 255, 0.35);
    --accent-green: #69f0ae;
    --accent-green-glow: rgba(105, 240, 174, 0.35);
    --accent-orange: #ffab40;
    --accent-orange-glow: rgba(255, 171, 64, 0.35);
    --accent-red: #ff5252;
    --accent-pink: #ff4081;

    /* Text */
    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: rgba(255, 255, 255, 0.60);
    --text-muted: rgba(255, 255, 255, 0.35);

    /* Misc */
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --radius-xl: 36px;
    --radius-full: 50%;

    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-spring: 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;

    /* Deep space background */
    background: #050510;
    background-image:
        radial-gradient(ellipse 80% 60% at 20% 0%, rgba(0, 100, 180, 0.18) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 100%, rgba(120, 40, 200, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 50% 50%, rgba(0, 229, 255, 0.04) 0%, transparent 50%);
}

/* ---------- Animated Background Orbs ---------- */
.bg-orbs {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    animation: orbFloat 20s ease-in-out infinite;
    opacity: 0.5;
}

.bg-orb:nth-child(1) {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(0, 229, 255, 0.15), transparent 70%);
    top: -10%; left: -5%;
    animation-duration: 25s;
}

.bg-orb:nth-child(2) {
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(120, 40, 200, 0.12), transparent 70%);
    bottom: -15%; right: -10%;
    animation-duration: 30s;
    animation-delay: -5s;
}

.bg-orb:nth-child(3) {
    width: 350px; height: 350px;
    background: radial-gradient(circle, rgba(105, 240, 174, 0.10), transparent 70%);
    top: 50%; left: 60%;
    animation-duration: 22s;
    animation-delay: -10s;
}

.bg-orb:nth-child(4) {
    width: 280px; height: 280px;
    background: radial-gradient(circle, rgba(255, 171, 64, 0.08), transparent 70%);
    top: 20%; right: 20%;
    animation-duration: 18s;
    animation-delay: -7s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(40px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 50px) scale(0.95); }
    75% { transform: translate(30px, 20px) scale(1.02); }
}

/* ---------- Liquid Glass Mixin via Class ---------- */
.liquid-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
    border: 1px solid var(--glass-border);
    box-shadow:
        0 8px 32px var(--glass-shadow),
        inset 0 1px 0 var(--glass-inner-glow),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.liquid-glass::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.08) 0%,
        transparent 40%,
        transparent 60%,
        rgba(255, 255, 255, 0.03) 100%
    );
    pointer-events: none;
    z-index: 1;
}

/* Liquid glass with refraction highlight */
.liquid-glass-refract {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur-heavy)) saturate(1.6);
    -webkit-backdrop-filter: blur(var(--glass-blur-heavy)) saturate(1.6);
    border: 1px solid var(--glass-border-bright);
    box-shadow:
        0 12px 48px var(--glass-shadow),
        0 4px 16px rgba(0, 229, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.liquid-glass-refract::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg,
        transparent 0%,
        rgba(255, 255, 255, 0.03) 10%,
        transparent 20%,
        rgba(0, 229, 255, 0.02) 30%,
        transparent 40%,
        rgba(179, 136, 255, 0.02) 50%,
        transparent 60%
    );
    animation: liquidRefract 15s linear infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes liquidRefract {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ---------- 3D Perspective Container ---------- */
.scene-3d {
    perspective: 1200px;
    perspective-origin: 50% 40%;
}

/* ---------- Layout ---------- */
.app-container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 24px 60px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ---------- Header / Navbar ---------- */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    border-radius: var(--radius-lg);
    transform: translateZ(20px);
    transition: transform var(--transition-smooth);
}

.header:hover {
    transform: translateZ(30px) scale(1.005);
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
}

.logo-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 20px var(--accent-cyan-glow);
    transition: transform var(--transition-spring), box-shadow var(--transition-smooth);
}

.logo:hover .logo-icon {
    transform: rotateY(180deg) scale(1.1);
    box-shadow: 0 6px 30px var(--accent-cyan-glow);
}

.logo-text {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff, var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-sub {
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.ip-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.ip-badge:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.ip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green-glow);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.85); }
}

.history-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.history-btn:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.18);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.history-btn svg {
    width: 18px;
    height: 18px;
}

/* ---------- Main Test Card ---------- */
.test-card {
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    text-align: center;
    transform-style: preserve-3d;
    transform: rotateX(2deg) translateZ(0);
    transition: transform var(--transition-smooth);
}

.test-card:hover {
    transform: rotateX(0deg) translateZ(10px);
}

.test-card > * {
    position: relative;
    z-index: 2;
}

/* ---------- Speedometer / Gauge ---------- */
.gauge-container {
    position: relative;
    width: 320px;
    height: 320px;
    margin: 0 auto 32px;
    transform-style: preserve-3d;
}

.gauge-3d-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    transform: rotateX(15deg);
    transform-style: preserve-3d;
}

.gauge-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-135deg);
}

.gauge-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 12;
    stroke-linecap: round;
}

.gauge-fill {
    fill: none;
    stroke-width: 12;
    stroke-linecap: round;
    stroke-dasharray: 0 680;
    transition: stroke-dasharray 0.3s ease-out, stroke 0.3s ease;
    filter: drop-shadow(0 0 8px var(--accent-cyan-glow));
}

.gauge-fill.phase-ping {
    stroke: url(#gradientPing);
    filter: drop-shadow(0 0 10px var(--accent-green-glow));
}

.gauge-fill.phase-download {
    stroke: url(#gradientDownload);
    filter: drop-shadow(0 0 10px var(--accent-cyan-glow));
}

.gauge-fill.phase-upload {
    stroke: url(#gradientUpload);
    filter: drop-shadow(0 0 10px var(--accent-purple-glow));
}

/* Gauge glow ring (3D depth) */
.gauge-glow {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: transparent;
    box-shadow:
        inset 0 0 30px rgba(0, 229, 255, 0.05),
        0 0 40px rgba(0, 229, 255, 0.03);
    transform: translateZ(-10px);
    pointer-events: none;
}

/* Center display */
.gauge-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(20px);
    text-align: center;
}

.gauge-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(180deg, #fff 40%, rgba(255, 255, 255, 0.6));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.2s;
}

.gauge-unit {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 4px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.gauge-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-cyan);
    margin-top: 8px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* ---------- Start Button ---------- */
.start-btn-container {
    margin: 20px auto 0;
}

.start-btn {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: transparent;
    outline: none;
    transition: transform var(--transition-spring);
    transform-style: preserve-3d;
}

.start-btn:hover {
    transform: scale(1.06) translateZ(15px);
}

.start-btn:active {
    transform: scale(0.97);
}

.start-btn-outer {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.15), rgba(179, 136, 255, 0.15));
    border: 2px solid rgba(0, 229, 255, 0.25);
    backdrop-filter: blur(20px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 60px rgba(0, 229, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all var(--transition-smooth);
}

.start-btn:hover .start-btn-outer {
    border-color: rgba(0, 229, 255, 0.4);
    box-shadow:
        0 12px 48px rgba(0, 0, 0, 0.4),
        0 0 80px rgba(0, 229, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.start-btn-inner {
    position: absolute;
    inset: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.08), rgba(179, 136, 255, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all var(--transition-smooth);
}

.start-btn:hover .start-btn-inner {
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.12), rgba(179, 136, 255, 0.12));
}

.start-btn-text {
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.start-btn-sub {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* Rotating border animation */
.start-btn-ring {
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        transparent 0%,
        var(--accent-cyan) 25%,
        transparent 50%,
        var(--accent-purple) 75%,
        transparent 100%
    );
    opacity: 0;
    animation: none;
    transition: opacity var(--transition-smooth);
    z-index: -1;
}

.start-btn:hover .start-btn-ring {
    opacity: 0.5;
    animation: spinRing 3s linear infinite;
}

.start-btn.testing .start-btn-ring {
    opacity: 0.8;
    animation: spinRing 1.5s linear infinite;
}

@keyframes spinRing {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.start-btn.testing .start-btn-text {
    animation: textPulse 1.5s ease-in-out infinite;
}

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

/* Hidden when testing */
.start-btn.hidden {
    display: none;
}

/* ---------- Results Grid ---------- */
.results-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 32px;
}

.result-card {
    border-radius: var(--radius-md);
    padding: 24px 16px;
    text-align: center;
    transition: all var(--transition-smooth);
    transform-style: preserve-3d;
    transform: translateZ(0);
    cursor: default;
}

.result-card:hover {
    transform: translateY(-4px) translateZ(10px);
    border-color: var(--glass-border-bright);
}

.result-card .result-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: transform var(--transition-spring);
}

.result-card:hover .result-icon {
    transform: scale(1.1) rotateZ(-5deg);
}

.result-card.ping-card .result-icon {
    background: linear-gradient(135deg, rgba(105, 240, 174, 0.15), rgba(105, 240, 174, 0.05));
    box-shadow: 0 4px 16px rgba(105, 240, 174, 0.1);
}

.result-card.download-card .result-icon {
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.15), rgba(0, 229, 255, 0.05));
    box-shadow: 0 4px 16px rgba(0, 229, 255, 0.1);
}

.result-card.upload-card .result-icon {
    background: linear-gradient(135deg, rgba(179, 136, 255, 0.15), rgba(179, 136, 255, 0.05));
    box-shadow: 0 4px 16px rgba(179, 136, 255, 0.1);
}

.result-card.jitter-card .result-icon {
    background: linear-gradient(135deg, rgba(255, 171, 64, 0.15), rgba(255, 171, 64, 0.05));
    box-shadow: 0 4px 16px rgba(255, 171, 64, 0.1);
}

.result-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.result-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.result-unit {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Active highlight */
.result-card.active {
    border-color: var(--glass-border-bright);
    box-shadow:
        0 8px 32px var(--glass-shadow),
        0 0 20px rgba(0, 229, 255, 0.05);
}

.result-card.active.ping-card { border-color: rgba(105, 240, 174, 0.3); }
.result-card.active.download-card { border-color: rgba(0, 229, 255, 0.3); }
.result-card.active.upload-card { border-color: rgba(179, 136, 255, 0.3); }

/* ---------- Phase Progress Bar ---------- */
.progress-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
    padding: 0 10px;
    opacity: 0;
    transition: opacity var(--transition-smooth);
}

.progress-wrapper.visible {
    opacity: 1;
}

.phase-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.phase-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    transition: all var(--transition-smooth);
    flex-shrink: 0;
}

.phase-dot.active {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 14px var(--accent-cyan-glow);
}

.phase-dot.done {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.phase-line {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}

.phase-line-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.phase-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 0 4px;
}

.phase-label-item {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.phase-label-item.active {
    color: var(--accent-cyan);
}

.phase-label-item.done {
    color: var(--accent-green);
}

/* ---------- Server Info Bar ---------- */
.server-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 14px 28px;
    border-radius: var(--radius-md);
    margin-top: 8px;
}

.server-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.server-item svg {
    width: 16px;
    height: 16px;
    opacity: 0.6;
}

.server-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
}

/* ---------- History Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 16, 0.75);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-smooth);
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 90%;
    max-width: 720px;
    max-height: 80vh;
    border-radius: var(--radius-xl);
    padding: 32px;
    overflow-y: auto;
    transform: translateY(30px) scale(0.96);
    transition: transform var(--transition-spring);
}

.modal-overlay.open .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255, 82, 82, 0.15);
    border-color: rgba(255, 82, 82, 0.3);
    color: var(--accent-red);
}

/* History Table */
.history-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 6px;
}

.history-table th {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 8px 12px;
    text-align: left;
    white-space: nowrap;
}

.history-table td {
    padding: 14px 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    transition: background var(--transition-fast);
}

.history-table tr:hover td {
    background: rgba(255, 255, 255, 0.06);
}

.history-table td:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.history-table td:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.history-table .val-good { color: var(--accent-green); font-weight: 600; }
.history-table .val-ok { color: var(--accent-orange); font-weight: 600; }
.history-table .val-bad { color: var(--accent-red); font-weight: 600; }

.no-history {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ---------- Footer ---------- */
.footer {
    text-align: center;
    padding: 16px 24px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer a {
    color: var(--accent-cyan);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer a:hover {
    color: #fff;
}

/* ---------- Particle Canvas ---------- */
#particles-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .app-container {
        padding: 12px 14px 40px;
        gap: 16px;
    }

    .header {
        flex-direction: column;
        gap: 12px;
        padding: 14px 18px;
    }

    .header-info {
        width: 100%;
        justify-content: center;
    }

    .test-card {
        padding: 32px 18px;
        border-radius: var(--radius-lg);
    }

    .gauge-container {
        width: 240px;
        height: 240px;
    }

    .gauge-value {
        font-size: 2.6rem;
    }

    .start-btn {
        width: 160px;
        height: 160px;
    }

    .start-btn-inner {
        inset: 16px;
    }

    .start-btn-text {
        font-size: 0.9rem;
    }

    .results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .result-value {
        font-size: 1.4rem;
    }

    .server-bar {
        flex-wrap: wrap;
        gap: 10px 20px;
        padding: 12px 18px;
    }

    .server-divider {
        display: none;
    }

    .phase-labels {
        padding: 0 2px;
    }
}

@media (max-width: 480px) {
    .gauge-container {
        width: 200px;
        height: 200px;
    }

    .gauge-value {
        font-size: 2.2rem;
    }

    .gauge-unit {
        font-size: 0.75rem;
    }

    .start-btn {
        width: 140px;
        height: 140px;
    }

    .results-grid {
        gap: 8px;
    }

    .result-card {
        padding: 18px 10px;
    }

    .result-value {
        font-size: 1.2rem;
    }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ---------- Utility Animations ---------- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.animate-in {
    animation: fadeInUp 0.6s var(--transition-smooth) both;
}

.animate-in-delay-1 { animation-delay: 0.1s; }
.animate-in-delay-2 { animation-delay: 0.2s; }
.animate-in-delay-3 { animation-delay: 0.3s; }
.animate-in-delay-4 { animation-delay: 0.4s; }

/* ---------- Liquid drip effect on gauge ---------- */
.liquid-drip {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 20px;
    background: radial-gradient(ellipse at center, rgba(0, 229, 255, 0.15), transparent 70%);
    border-radius: 0 0 50% 50%;
    filter: blur(4px);
    animation: dripPulse 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes dripPulse {
    0%, 100% { opacity: 0.3; transform: translateX(-50%) scaleY(1); }
    50% { opacity: 0.6; transform: translateX(-50%) scaleY(1.3); }
}

/* ---------- Noise overlay for glass realism ---------- */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.015;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 128px 128px;
}
