/* Nerdhalla native LibreSpeed integration */

html,
body {
    width: 100% !important;
    min-height: 0 !important;
    overflow-x: hidden;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
}

body {
    color: #eaf3ff !important;
    font-family: Inter, Arial, sans-serif;
}

/* Remove the second site's branding */
body > header,
body > footer,
main > h1:first-child,
main > p.tagline {
    display: none !important;
}

/* Center the speed-test controls */
main {
    box-sizing: border-box;
    flex: 1;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 12px 30px !important;
}

/* Harmonize the location selector */
.server-selector {
    max-width: 720px;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Keep interface elements readable */
.server-selector,
.gauge-layout,
#start-button {
    position: relative;
}

@media (max-width: 800px) {
    main {
        padding: 12px 6px 22px !important;
    }
}

/* NERDHALLA SEAMLESS DARK BLUE FIX */

:root {
  --background-backup-color: #0b1528;
  --background-overlay-color: #0b1528;
  --primary-text-color: #edf4ff;
  --secondary-text-color: #adbdd3;
  --server-selector-background-color: #142640;
  --server-selector-border-color: #35516e;
  --server-selector-hover-background-color: #203a5a;
  --gauge-background-color: #233954;
  --popup-background-color: #142640;
}

html, body {
  background: #0b1528 !important;
  background-image: none !important;
  color: #edf4ff !important;
  overflow-x: hidden;
}

body > header,
body > footer,
main > h1:first-child,
main > p.tagline {
  display: none !important;
}

main {
  width: 100% !important;
  max-width: 1100px !important;
  margin: 0 auto !important;
  padding: 18px 12px 35px !important;
}

.server-selector {
  max-width: 100%;
}

.server-selector > .chosen,
.server-selector > ul.servers {
  background: #142640 !important;
  border-color: #35516e !important;
}


/* NERDHALLA COMPACT SPEEDTEST V1 */

body {
    min-height: 0 !important;
}

main {
    flex: 0 0 auto !important;
    padding: 0 12px 12px !important;
}

.server-selector {
    margin: 0 auto !important;
}

.server-selector > p.sponsor {
    margin: 4px 0 10px !important;
}

main > p#privacy-warning {
    margin: 4px auto !important;
    min-height: 0 !important;
}

main > p#privacy-warning.hidden {
    display: none !important;
}

.gauge-layout {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

#start-button {
    margin-top: 8px !important;
    margin-bottom: 8px !important;
}


/* NERDHALLA COMPACT CONTROLS V2 */

/* Smaller server dropdown */
.server-selector {
    width: 38rem !important;
    max-width: calc(100% - 16px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.server-selector > .chosen {
    height: 6.4rem !important;
    border-radius: 10px !important;
}

.server-selector > .chosen > p {
    top: 0.7rem !important;
    left: 1.8rem !important;
    font-size: 1.3rem !important;
}

.server-selector > .chosen > h2 {
    left: 1.8rem !important;
    right: 4rem !important;
    bottom: 0.8rem !important;
    font-size: 1.9rem !important;
}

.server-selector > .chosen > .chevron {
    top: 0.9rem !important;
    right: 1.1rem !important;
}

/* Match dropdown menu width */
.server-selector > ul.servers {
    width: 100% !important;
}

.server-selector > ul.servers > li > a {
    font-size: 1.8rem !important;
    padding: 0.8rem 1.8rem !important;
}

/* Smaller Let's Start button */
#start-button {
    font-size: 1.8rem !important;
    min-width: 0 !important;
    width: auto !important;
    padding: 1.2rem 3.4rem !important;
    margin: 8px auto !important;
    border-radius: 12px !important;
}

/* Maintain comfortable mobile sizing */
@media (max-width: 500px) {
    .server-selector {
        width: 100% !important;
    }

    .server-selector > .chosen > h2 {
        font-size: 1.7rem !important;
    }

    #start-button {
        padding: 1.1rem 2.8rem !important;
    }
}


/* NERDHALLA COMPACT LAYOUT V3 */

main {
    max-width: 820px !important;
    padding: 0 8px 8px !important;
}

.server-selector {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.server-selector > p.sponsor {
    margin-bottom: 4px !important;
}

.gauge-layout {
    max-width: 720px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

#start-button {
    margin-top: 4px !important;
    margin-bottom: 4px !important;
}

/* NERDHALLA RAINBOW V3 START */

/*
 * Apply animated colors to LibreSpeed's existing
 * curved borders without filling the gauge interior.
 */

@property --nh-hue {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@keyframes nhHueShift {
  from { --nh-hue: 0deg; }
  to   { --nh-hue: 360deg; }
}

/* Preserve original border geometry and rotation */
.gauge.enabled.download > .speed::after,
.gauge.enabled.upload > .speed::after,
.gauge.enabled.download > .progress::after,
.gauge.enabled.upload > .progress::after {
  border-image: none !important;
  border-color: #ff3059 !important;
  filter: hue-rotate(var(--nh-hue));
  animation: nhHueShift 20s linear infinite;
}

/* Preserve the original gauge needle colors */
.gauge.enabled.download > .speed::before,
.gauge.enabled.upload > .speed::before {
  filter: none !important;
}

/* Reduced motion accessibility */
@media (prefers-reduced-motion: reduce) {
  .gauge.enabled > .speed::after,
  .gauge.enabled > .progress::after {
    animation: none !important;
  }
}

/* NERDHALLA RAINBOW V3 END */
