*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: #fff;
  color: #111;
  font-family: Helvetica, "Helvetica Neue", Arial, "Liberation Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- page shell ---------- */

#page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: filter .45s ease;
}

body.locked #page {
  filter: blur(11px);
  pointer-events: none;
  user-select: none;
}

/* ---------- top nav ---------- */

.topbar {
  padding: 14px 22px 0;
  flex: 0 0 auto;
}

.topnav {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 26px;
  font-size: 13.5px;
  color: #2b2b2b;
}

.navItem {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #2b2b2b;
  text-decoration: none;
  cursor: pointer;
}

.navItem:hover { text-decoration: underline; }
.caret { display: block; margin-top: 1px; }

/* ---------- main ---------- */

.main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 16px;
}

/* brand mark */

.brand {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logoImg {
  display: block;
  width: clamp(200px, 17vw, 300px);
  height: auto;
  object-fit: contain;
}

/* shown only if logo.png is not found, so the slot stays obvious */
.logoImg.missing {
  width: clamp(140px, 17vw, 215px);
  height: clamp(82px, 10vw, 126px);
  border: 2px dashed #d5d5d5;
  border-radius: 8px;
  position: relative;
}

.logoImg.missing::after {
  content: "logo.png";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #bbb;
  letter-spacing: .5px;
}

/* status headline */

#statusText {
  margin: 22px 0 0;
  font-size: clamp(21px, 2.9vw, 37px);
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.15;
  color: #111;
}

/* ---------- speed readout ---------- */

.readout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(8px, 1.4vw, 18px);
  margin-top: clamp(6px, 1vw, 14px);
}

#speedValue {
  font-size: clamp(110px, 24vw, 310px);
  font-weight: 700;
  line-height: .92;
  letter-spacing: -6px;
  color: #111;
  font-variant-numeric: tabular-nums;
  transition: color .35s ease;
}

/* while the fake test runs, the number is light gray */
#speedValue.testing { color: #b8b8b8; }

.readoutSide {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 2vw, 26px);
  padding-top: clamp(12px, 2.1vw, 28px);
}

#speedUnit {
  font-size: clamp(26px, 5.9vw, 76px);
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1;
  color: #111;
  transition: color .35s ease;
}

#speedUnit.testing { color: #b8b8b8; }

/* green refresh ring — hidden during the test */

#refreshBtn {
  width: clamp(44px, 6.3vw, 80px);
  height: clamp(44px, 6.3vw, 80px);
  border-radius: 50%;
  border: 3px solid #35b34a;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  transform: scale(.75);
  transition: opacity .35s ease, transform .35s ease, visibility .35s;
}

#refreshBtn svg {
  width: 52%;
  height: 52%;
}

body.done #refreshBtn {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

#refreshBtn:hover { background: #f2fbf3; }
#refreshBtn.spin svg { animation: spin .6s ease; }

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

/* ---------- more info ---------- */

#moreBtn {
  margin-top: clamp(28px, 5.5vw, 62px);
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 3px;
  color: #444;
  font-family: inherit;
  font-size: 15px;
  padding: 13px 24px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity .4s ease, visibility .4s, border-color .2s ease, background .2s ease;
}

body.done #moreBtn {
  opacity: 1;
  visibility: visible;
}

#moreBtn:hover { border-color: #999; background: #fafafa; }

#moreInfo {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height .4s ease, opacity .4s ease, margin .4s ease;
}

#moreInfo.open {
  max-height: 260px;
  opacity: 1;
  margin-top: 26px;
}

.infoGrid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px 48px;
  padding-top: 6px;
}

.infoItem { min-width: 128px; }

.infoLabel {
  font-size: 11px;
  letter-spacing: 1.1px;
  color: #8b8b8b;
  margin-bottom: 7px;
}

.infoValue {
  font-size: 28px;
  font-weight: 700;
  color: #111;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 5px;
}

.infoUnit {
  font-size: 13px;
  font-weight: 400;
  color: #8b8b8b;
}

/* ---------- social ---------- */

.socialRow {
  display: flex;
  gap: 14px;
  margin-top: clamp(34px, 6vw, 72px);
  margin-bottom: 10px;
  opacity: 0;
  transition: opacity .4s ease;
}

body.done .socialRow { opacity: 1; }

.socialIcon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #6d6d6d;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background .2s ease;
}

.socialIcon:hover { background: #555; }

.qmark {
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}

/* ---------- footer ---------- */

.footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  padding: 12px 22px 22px;
}

.poweredBy {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pbText {
  font-size: 10.5px;
  letter-spacing: 1.4px;
  color: #9a9a9a;
}

.pbBrand {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: #E50914;
}

/* ---------- intro overlay ---------- */

#promptOverlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(255,255,255,.45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  transition: opacity .35s ease;
}

#promptOverlay.hide { opacity: 0; pointer-events: none; }

#promptBox {
  background: rgba(255,255,255,.93);
  border: 1px solid rgba(0,0,0,.09);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0,0,0,.18);
  padding: 34px 40px 28px;
  text-align: center;
  max-width: 100%;
}

#promptTitle {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: #E50914;
  margin-bottom: 14px;
}

#promptText {
  margin: 0 0 20px;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #111;
}

.promptRow {
  display: flex;
  gap: 9px;
  justify-content: center;
  flex-wrap: wrap;
}

#speedInput, #unitSelect {
  font-family: inherit;
  font-size: 17px;
  color: #111;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 11px 12px;
  outline: none;
}

#speedInput {
  width: 118px;
  text-align: center;
  -moz-appearance: textfield;
}

#speedInput::-webkit-outer-spin-button,
#speedInput::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#speedInput::placeholder { color: #bbb; }
#speedInput:focus, #unitSelect:focus { border-color: #E50914; }
#speedInput.err { border-color: #E50914; background: #fff5f5; }

#unitSelect { cursor: pointer; padding-right: 8px; }

#promptBtn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #fff;
  background: #E50914;
  border: none;
  border-radius: 8px;
  padding: 11px 24px;
  cursor: pointer;
  transition: background .2s ease;
}

#promptBtn:hover { background: #c40812; }

#promptHint {
  margin-top: 14px;
  font-size: 12px;
  color: #999;
}

/* ---------- small screens ---------- */

@media (max-width: 620px) {
  #speedValue { letter-spacing: -3px; }
  .socialIcon { width: 46px; height: 46px; }
  .qmark { font-size: 22px; }
  #promptBox { padding: 26px 22px 22px; }
  .infoGrid { gap: 16px 28px; }
  .infoValue { font-size: 23px; }
}
