/* FONTS -----------------*/
@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("..fonts/roboto-v30-latin-regular.eot"); /* IE9 Compat Modes */
  src: local(""),
    url("../fonts/roboto-v30-latin-regular.eot?#iefix")
      format("embedded-opentype"),
    /* IE6-IE8 */ url("../fonts/roboto-v30-latin-regular.woff2")
      format("woff2"),
    /* Super Modern Browsers */
      url("../fonts/roboto-v30-latin-regular.woff") format("woff"),
    /* Modern Browsers */ url("../fonts/roboto-v30-latin-regular.ttf")
      format("truetype"),
    /* Safari, Android, iOS */
      url("../fonts/roboto-v30-latin-regular.svg#Roboto") format("svg"); /* Legacy iOS */
}
@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("assets/fonts/roboto-v30-latin-500.eot"); /* IE9 Compat Modes */
  src: local(""),
    url("assets/fonts/roboto-v30-latin-500.eot?#iefix")
      format("embedded-opentype"),
    /* IE6-IE8 */ url("../fonts/roboto-v30-latin-500.woff2")
      format("woff2"),
    /* Super Modern Browsers */ url("../fonts/roboto-v30-latin-500.woff")
      format("woff"),
    /* Modern Browsers */ url("../fonts/roboto-v30-latin-500.ttf")
      format("truetype"),
    /* Safari, Android, iOS */
      url("../fonts/roboto-v30-latin-500.svg#Roboto") format("svg"); /* Legacy iOS */
}

/* OpenSpeedTest Required Config --------------------------------------- */
.darkmode {
  margin-bottom: -15px;
  fill: #75757a99;
  padding-top: 16px;
  display: none;
  cursor: pointer;
  margin-right: 30px;
}

/* Dark mode button disable */
#daymode {
  margin-right: 40px;
}

.darkmode:hover {
  fill: #000000;
}

.ConnectError {
  display: none;
}

.openSpeedtestApp {
  height: 70vh;
  width: 90vw;
  display: none;
  overflow: hidden;
}

.main-Gaugebg {
  fill: none;
  stroke: rgb(231, 231, 232);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 22px;
  stroke-dasharray: 681;
}

.main-GaugeBlue {
  fill: none;
  stroke: url(#gradient);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 22px;
  stroke-dasharray: 681;
  stroke-opacity: 0;
}

.main-GaugeWhite {
  fill: none;
  stroke: rgb(255, 255, 255);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 15px;
  stroke-dasharray: 0, 681;
  stroke-dashoffset: 1;
  stroke-opacity: 0;
}

.oDo-Meter {
  font-size: 16.633283615112305px;
  fill: gray;
  font-family: Roboto-Medium, Roboto;
  font-weight: 500;
}

.oDoLive-Speed {
  font-size: 28px;
  fill: #201e1e;
  font-family: Roboto-Medium, Roboto;
  font-weight: 500;
  text-anchor: middle;
}

.oDoLive-Status {
  font-size: 10px;
  fill: #d2d1d2;
  font-family: Roboto-Medium, Roboto;
  font-weight: 500;
  text-anchor: middle;
}

.uiBg {
  fill: #d2d1d2;
}

.progressbg {
  stroke: rgb(231, 231, 232);
  stroke-width: 8px;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 400;
  stroke-dashoffset: 0;
}

.Cards {
  fill: #f2f2f2;
}

.Symbol {
  fill: url(#gradient);
}

.rtext {
  font-size: 12px;
  fill: #333;
  font-family: Roboto-Medium, Roboto;
  font-weight: 500;
}

.rtextnum {
  font-size: 23px;
  fill: #201e1e;
  font-family: Roboto-Medium, Roboto;
  font-weight: 500;
  text-anchor: middle;
}

.rtextmbms {
  font-size: 12px;
  fill: #5f5f5f;
  font-family: Roboto-Medium, Roboto;
  font-weight: 500;
  text-anchor: middle;
}

.jitter-Mob {
  font-size: 9px;
  fill: #5f5f5f;
  font-family: Roboto-Medium, Roboto;
  font-weight: 500;
  text-anchor: middle;
}

.startButton {
  fill: url(#RadialGradient1);
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  pointer-events: visible;
}

.buttonTxt {
  font-size: 40px;
  fill: #ffffff;
  font-family: Roboto-Medium, Roboto;
  font-weight: 500;
  text-anchor: middle;
}

.intro-Progress {
  stroke: #880000;
  stroke-width: 8px;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 400;
  stroke-dashoffset: 0;
}

.progressElmstart {
  stroke: #880000;
  stroke-width: 8px;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 400;
  stroke-dashoffset: 0;
  display: block;
}

.Startsettings {
  fill: url(#RadialGradient1);
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  pointer-events: visible;
  opacity: 0.1;
  transition: opacity 1s ease-in-out;
}

.Startsettings:hover {
  opacity: 1;
}

.progressbg {
  stroke: rgb(231, 231, 232);
  stroke-width: 8px;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 400;
  stroke-dashoffset: 0;
}

.deskStart {
  fill: none;
  stroke: rgb(231, 231, 232);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 22px;
  stroke-dasharray: 681;
  stroke: url(#gradient);
}

#UI-Desk {
  display: none;
}

#UI-Mob {
  display: none;
}

.oDoTop-Speed {
  font-size: 16.96px;
  fill: gray;
  font-family: Roboto-Medium, Roboto;
  font-weight: 500;
  text-anchor: end;
}

#upSymbolDesk {
  fill: #880000;
  display: none;
}

#downSymbolDesk {
  fill: #880000;
  display: none;
}

#upSymbolMob {
  fill: #880000;
  display: none;
}

#downSymbolMob {
  fill: #880000;
  display: none;
}

#ipMob {
  font-size: 15px;
  fill: #201e1e;
  font-family: Roboto-Medium, Roboto;
  font-weight: 500;
  text-anchor: middle;
  display: none;
}

#ipDesk {
  font-size: 15px;
  fill: #201e1e;
  font-family: Roboto-Medium, Roboto;
  font-weight: 500;
  text-anchor: middle;
  display: none;
}

.spinner > div {
  width: 20px;
  height: 20px;
  background-color: #ddb917;

  border-radius: 100%;
  display: inline-block;
  -webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
  animation: sk-bouncedelay 1.4s infinite ease-in-out both;
}

.spinner .bounce1 {
  -webkit-animation-delay: -0.32s;
  animation-delay: -0.32s;
}

.spinner .bounce2 {
  -webkit-animation-delay: -0.16s;
  animation-delay: -0.16s;
}

@-webkit-keyframes sk-bouncedelay {
  0%,
  80%,
  100% {
    -webkit-transform: scale(0);
  }
  40% {
    -webkit-transform: scale(1);
  }
}

@keyframes sk-bouncedelay {
  0%,
  80%,
  100% {
    -webkit-transform: scale(0);
    transform: scale(0);
  }
  40% {
    -webkit-transform: scale(1);
    transform: scale(1);
  }
}

.Mobile,
.Desktop {
  visibility: hidden;
  width: 100vw;
  height: 100vh;
}

@media only screen and (orientation: landscape) {
  .Mobile {
    visibility: hidden;
  }
  .Desktop {
    visibility: visible;
  }
}

@media only screen and (orientation: portrait) {
  .spinner {
    top: 42vh;
    left: 42vw;
  }
  .Mobile {
    visibility: visible;
  }
  .Desktop {
    visibility: hidden;
  }
}
@media only screen and (max-width: 300px) {
  .Credits{
    display: none;
  }
}

#OpenSpeedTestDiv {
  width: 100%;
  height: auto;
  display: flex;
  justify-content: center;
}

#OpenSpeedTest-UI {
  width: 40%;
  height: auto;
  max-width: 40%;
  display: block;
}
/*--END OpenSpeedTest necessary config ------------------------*/
/*-------------------------------------------------------------*/



/* ========== Base Setup ========== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  html, body {
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
  }

  body {
    font-family: "Roboto", sans-serif;
    background-color: #fff;
    color: #222;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  main {
    flex: 1;
  }

  main.main-container {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    justify-content: center;
  }

  #triggerButton {
    justify-self: center;
  }

  .spinner {
    position: static;
    display: block; /* instead of flex, since flex inside flex can get tricky */
    margin: 1rem auto; /* auto-center horizontally */
    text-align: center;
  }


  /* ========== Header/Navbar ========== */
  .navbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    background-color: #ddb917;
    padding: 1rem 2rem;
    gap: 1rem;
  }

  .navbar-title {
    text-align: center;
    font-weight: 600;
    font-size: 1.3rem;
  }

  .logo img {
    height: 80px;
  }

  /* ========== Footer ========== */
  .Credits {
    font-size: 0.85rem;
    text-align: center;
    grid-template-columns: 1fr;
    color: black;
    background: linear-gradient(to top,  #ddb917, transparent);
    width: 100%;
  }
  
  .Credits a {
    text-decoration: none;
    color: #9e0000;
  }
  
  .Credits a:hover {
    color: #ff5454;
  }

  .AetherforgeTag {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: transparent;
    font-family: "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;
    color: #880000;
    padding: .5rem 0;
  }

  .AetherforgeTag a {
    color: #880000;
    text-decoration: none;
    font-weight: bold;
    text-shadow: 0 0 5px #ffaaaa, 0 0 10px #ffaaaa;
    transition: color 0.3s ease, text-shadow 0.3s ease;
  }
  
  .AetherforgeTag a:hover {
    color: #ff4444;
    text-shadow: 0 0 8px #ff6666, 0 0 12px #ff9999;
  }
  
  /* ========== Button ========== */
  .savedata_button {
    width: 100%;
    margin-top: 0.5rem;
    background: rgb(0, 102, 0);
    color: black;
    padding: 0.75rem 2rem;
    font-size: 1.25rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.3s ease;
  }
  
  .savedata_button:hover {
    background: #93ff8f;
  }
  
  .savedata_button:disabled {
    background-color: darkslategray;
    color: darkgray;
  }

  .savedata_button:disabled:hover {
    cursor: not-allowed;
  }

  .address-input-wrapper {
    display: flex;
    align-items: center;
    position: relative;
  }
  
  #address-validity-icon {
    margin-left: 0.5rem;
    font-size: 1.5rem;
    color: red;
    flex-shrink: 0;
  }

  #form-block {
    position: relative;
    height: 100%;
    background: transparent;
    border-radius: 0;
  }

  .info-block {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
  }

  .infobutton {
    background: #9a3a3f;
    color: black;
    padding: 1rem 1.5rem;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    width: 100%;
    text-align: center;
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }
  
  .infobutton:hover {
    background: darkorange;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  }

 /* ===== SECOND PAGE =================== */
  .image-page {
    background-color: #111;
    color: #eee;
    font-family: 'Georgia', serif;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    min-height: 100vh;
    text-align: center;
  }
  
  .image-container {
    max-width: 800px;
    width: 100%;
  }
  
  .image-container img {
    max-width: 100%;
    height: auto;
    border: 4px solid #555;
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(0, 255, 255, 0.2);
    margin-top: 1rem;
  }
  
  .image-container h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
  }
  
  .caption {
    font-style: italic;
    margin-top: 0.5rem;
    color: #ccc;
  }
  
  .back-link {
    display: inline-block;
    margin-top: 2rem;
    text-decoration: none;
    color: #00bfff;
    font-weight: bold;
    transition: color 0.2s;
  }
  
  .back-link:hover {
    color: #66d9ef;
  }

/* ========== Main Panel ========== */
/* === Container for Form + Sidebar === */
  .form-and-sidebar {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .form-section {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 3;
    min-width: 60%;
    background: #ddb917;
    border-radius: 10px;
    padding: 1rem;
    gap: 1rem;
  }

  .form-section.open {
    padding: 1rem;
  }

  .trigger {
    background: #ddb917;
    color: black;
    border: none;
    padding: 1rem 1rem;
    width: 50%;
    font-size: 1.0rem;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: background 0.3s ease;
  }

  .trigger:hover {
    background: #c2a215;
  }

  .popovertop {
    background: #ddb917;
    border-radius: 10px;
    height: 100%;
  }

  .popovertop.open {
    max-height: 2000px;
    padding: 1rem;
  }

  /* Submit button + checkbox row */
  .submit-consent-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap; /* Enable wrapping for small screens */
  }

  .submit-consent-row .savedata_button {
    white-space: nowrap;
    flex-direction: column;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }

  
  /* Make the button inside stretch to full height */
  .consent-column.submit-button .savedata_button {
    height: 100%;
    width: 100%;
  }

  .submit-consent-row .consentbox {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap; /* Optional for smaller screens */
  }

  .toprow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    width: 100%;
    flex-wrap: nowrap;
  }

  .consentbox {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    flex: 2;
    font-size: 1rem;
    font-weight: bold;
    line-height: 1.4;
    color: black;
    cursor: pointer;
  }

  .consentbox input[type="checkbox"] {
    transform: scale(2);
    margin-right: 1rem;
    margin-left: 0;
    padding: 0;
    width: auto;
    height: auto;
    line-height: normal;
    vertical-align: middle;
  }

  .instructionscolumn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    height: 100%;
  }

  #test-instructions {
    background-color: #0fafff;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    color: whitesmoke;
    font-weight: bold;
    font-size: 1.25rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /* Optional: subtle shadow */
    display: inline-block; /* Shrink to fit the text */
    align-items: center; /* centers text vertically */
    height: 100%; /* fills parent container height */
    width: 100%; /* optional: fills width of its column */
  }

  #test-instructions p {
    margin: 0;
    font-size: 1.25rem;
    color: black;
  }

  .instructions {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .instructions p {
    margin: 0;
  }
  
  /* Field pairs: Organization, Names, Address, Speeds */
  .field-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .field-group1 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .field-group3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .field-groupvertical {
    display: grid;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
  }

  .field-group80 {
    display: grid;
    grid-template-columns: 70% 15%;
    gap: 0.75rem;
    width: 100%;
    max-height: 100%;
    margin-bottom: 1rem;
  }

  .field-group75 {
    display: grid;
    grid-template-columns: 80%;
    gap: 0.75rem;
  }

  .field-group20 {
    display: grid;
    grid-template-columns: 20% 75%;
    gap: 0.75rem;
    margin-right: 1rem;
    margin-bottom: 1rem;
    width: 95%;
  }

  /* Single-column exceptions, use helper class if needed */
  .field-group.single-column {
    grid-template-columns: 1fr;
  }

  /* Measured speed group */
  .field-group.measured-speed {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .form-content {
    display: flex;
    grid-template-columns: 65% 25%;
    padding-right: 1rem;
    gap: 1rem;
    width: 100%;
    flex-direction: row;
  }

  /* Inputs and selects full width inside grid cells */
  input,
  select {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid #ccc;
    border-radius: 6px;
  }

  .form-status-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 600px; /* Match or auto-follow form panel */
    margin: 0 auto;
  }

  /* === SIDEBAR BUTTONS (ORANGE) === */
  .info-block {
    flex: 1;
    height: 100%;
    min-width: 200px;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: flex-start;
    align-items: stretch;
  }
  
  .infobutton {
    background: rgb(255, 140, 0); /* Brighter orange tone */
    color: black;
    padding: 1rem 1.5rem; /* Larger padding for bigger button */
    font-size: 1.2rem; /* Larger text */
    font-weight: bold;
    border: none; /* No border */
    border-radius: 25px; /* Rounded corners */
    cursor: pointer;
    width: 100%; /* Full width of container */
    text-align: center;
    transition: background 0.3s ease, transform 0.2s ease;
  }
  
  .infobutton:hover {
    background: darkorange;
    transform: translateY(-2px); /* Nice subtle lift effect */
  }

  #submission_button {
    height: 100%;
    width: 100%;
  }
  
  /* === INFO PANELS ======================*/
  .form-and-sidebar {
    position: relative;
    height: 100%;
    display: flex;
    gap: 3rem;
    align-items: flex-start;
    flex-wrap: wrap;
    overflow: visible;
  }
  
  /* === SLIDEOUT PANELS CONTAINER === */
  .slideout-panels {
    position: fixed;
    top: 0;
    left: 0;
    width: 400px;
    height: 100vh; /* Full viewport height */
    background: #fff8e1;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
    padding: 2rem 0; /* vertical padding only */
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .slideout-panels.open {
    transform: translateX(0);
    pointer-events: auto;
  }

  /* === INDIVIDUAL PANEL === */
  .slideout-panel {
    display: none; 
    width: 100%;
    height: auto;
    background: #fff8e1;
    padding: 2rem;
    position: relative;
    overflow-y: auto;
    box-sizing: border-box;
    flex-shrink: 0;
  }

  .slideout-panel.open {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
  }

  .slideout-panel .close-panel {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
  }

  /* improve hover effect */
  .infobutton.open {
    background: rgb(206, 113, 0);
    transform: translateY(-2px);
  }

  /* === TEST STATUS PANEL === */
  .status-panel {
    background-color: #fff8e1;
    border: 2px solid #ddb917;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    font-weight: bold;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
  }

  .status-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
  }
  
  .status-item {
    flex: 1;
    text-align: center;
    background: #f9e7b5;
    padding: 0.75rem;
    border-radius: 6px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    font-size: 1rem;
  }
  
  .status-server {
    background: #ffe58f;
    font-size: 1.1rem;
  }

  .test-complete-banner {
    background-color: #4caf50; /* Green for success */
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    animation: fadeInBanner 0.6s ease-out;
  }
  
  @keyframes fadeInBanner {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* DEFAULT STATE — show desktop info block, hide mobile */
  .mobile-only,
  .hamburger-toggle,
  .hamburger-menu,
  .info-block-mobile {
    display: none !important;
  }

  .info-block-desktop {
    display: flex !important;
  }

/* === ADDITION: IMPROVE MOBILE LAYOUT ON SMALL PHONES === */
/* ========== Responsive Layout ========== */
@media (max-width: 768px) {
  .mobile-only {
    display: block !important;
  }

  .navbar {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .navbar-title {
    margin-top: 1rem;
  }

  .form-section {
    padding-right: 0;
    border-right: none;
    min-height: 100vh;
  }

  .form-block {
    grid-template-columns: 1fr;
  }

  .field-group {
    grid-template-columns: 1fr;
  }

  .form-and-sidebar {
    flex-direction: column;
  }

  .info-block {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    display: none !important; /* hide sidebar */
  }

  .info-block span {
    flex: 1 1 45%;
  }

  .info-block-mobile {
    display: flex !important;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  
  .infobutton {
    flex: 1 1 45%;
  }

  .slideout-panel {
    width: 100%;
    max-width: none;
  }

  .slideout-panels {
    width: 100%;
  }

  .hamburger-container {
    display: flex;
  }

  .hamburger-toggle {
    display: block !important;
    background: #9a3a3f;
    color: white;
    font-size: 1.2rem;
    padding: 1rem;
    width: 100%;
    border: none;
    border-radius: 10px;
    margin: 1rem 0;
    cursor: pointer;
  }

  .hamburger-menu {
    display: none;
    background: #fff8e1;
    border-radius: 0 0 10px 10px;
    padding: 1rem 0;
    animation: slideDown 0.3s ease-out;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  }

  .hamburger-menu.open {
    display: block !important;
    animation: slideDown 0.3s ease-out;
  }

  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Hide original info block on mobile */
  .info-block:not(.info-block-mobile) {
    display: none !important;
  }

  .info-block-mobile {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
  }

  .info-block-mobile .infobutton {
    flex: 1 1 45%;
  }

  /* Hide desktop info block */
  .info-block-desktop {
    display: none !important;
  }


}

@media (max-width: 480px) {
  .info-block span {
    flex: 1 1 100%;
  }

  .infobutton {
    flex: 1 1 100%; /* Stack fully on very small screens */
  }

  .field-group3 {
    grid-template-columns: 1fr; /* Stack name/email fields vertically */
    grid-template-columns: 1fr !important;
  }

  .field-group80 {
    grid-template-columns: 1fr; /* Address field full width */
    grid-template-columns: 1fr !important;
  }

  .field-group {
    grid-template-columns: 1fr; /* Other grouped fields */
    grid-template-columns: 1fr !important;
  }

  .form-content {
    flex: 1 1 100%;
  }

  .form-section {
    flex: 1 1 100%;
    min-width: 100% !important;
    width: 100%;
  }

  .spinner {
    position: relative;
    display: flex;
    justify-content: center;
    margin: 2rem 0;
  }

  .navbar-title {
    font-size: 1rem;
  }

  .logo img {
    height: 50px;
  }

  input,
  select {
    padding: 0.75rem;
    font-size: 1.1rem;
    min-width: 0; /* Avoid shrinkage */
  }

  .status-item {
    font-size: 0.9rem;
    padding: 0.5rem;
  }

  .status-server {
    font-size: 1rem;
  }

  #address-validity-icon {
    font-size: 1.25rem;
    margin-left: 0.25rem;
  }

  main.main-container {
    display: block;
    padding: 1rem;
    min-height: calc(100vh - 150px);
  }

  .info-block-mobile .infobutton {
    flex: 1 1 100%;
  }
}

@media (max-width: 420px) {
  html, body {
    font-size: 14px;
    padding: 0;
    margin: 0;
    overflow-x: hidden;
  }

  .main-container {
    padding: 1rem;
    gap: 1rem;
    min-height: calc(100vh - 150px);
  }

  .form-and-sidebar {
    flex-direction: column;
    gap: 1rem;
  }

  .form-content {
    flex-direction: column;
    gap: 1rem;
    padding: 0;
  }

  .form-section {
    min-width: 100%;
    padding: 1rem;
    min-height: 100vh;
  }

  .toprow {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .consentbox {
    font-size: 1rem;
    flex-direction: row;
    align-items: flex-start;
  }

  .instructionscolumn {
    align-items: stretch;
  }

  .field-group3,
  .field-group,
  .field-group80,
  .field-group.measured-speed {
    grid-template-columns: 1fr;
  }

  #submission_button {
    font-size: 1rem;
    padding: 0.75rem;
  }

  .navbar {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 1rem;
  }

  .navbar-title {
    font-size: 1rem;
  }

  .logo img {
    height: 48px;
  }

  .slideout-panels {
    width: 100%;
    padding: 1rem;
  }

  .slideout-panel {
    padding: 1rem;
  }

  .status-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .status-item {
    font-size: 0.9rem;
    padding: 0.5rem;
  }

  .test-complete-banner {
    font-size: 1rem;
    padding: 0.75rem;
  }

  #OpenSpeedTestDiv,
  #OpenSpeedTest-UI {
    width: 100%;
    max-width: 100%;
  }

  input,
  select {
    font-size: 1rem;
    padding: 0.5rem;
  }

  #address-validity-icon {
    font-size: 1.25rem;
    margin-left: 0.25rem;
  }
}

/* === END OF MOBILE OPTIMIZATION PATCH === */

/* Hamburger Container */
.hamburger-container {
  display: none;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

#hamburger-toggle {
  background-color: #9a3a3f;
  color: white;
  border: none;
  padding: 0.75rem 1.25rem;
  font-size: 1.1rem;
  font-weight: bold;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.3s ease;
}

#hamburger-toggle:hover {
  background-color: darkorange;
}

/* Slide-Down Menu (initially hidden) */
.hamburger-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.4s ease;
}

/* Active menu */
.hamburger-menu.open {
  max-height: 1000px; /* arbitrary high value to allow full expansion */
  padding-bottom: 1rem;
}

/* Hide hamburger on desktop */
.hamburger-toggle,
.hamburger-menu {
  display: none;
}
