:root {
  --ink: #081638;
  --muted: #6c7894;
  --blue: #2f73ff;
  --purple: #9d54f2;
  --panel: rgba(255, 255, 255, 0.76);
  --line: rgba(76, 103, 160, 0.16);
  --shadow: 0 22px 55px rgba(61, 105, 190, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #f8fbff;
}

button {
  font: inherit;
}

.app-shell {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 560px;
  overflow: hidden;
  isolation: isolate;
  --bg-image: url("https://i0.wp.com/picjumbo.com/wp-content/uploads/green-natural-background-with-wooden-surface-free-image.jpeg?w=2210&quality=70");
  background: #edf5ff;
}

.app-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--bg-image) center / cover no-repeat;
  transform: scale(1);
}

.app-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(255, 255, 255, 0.28);
}

.topbar {
  position: relative;
  z-index: 3;
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(22px, 4.8vw, 72px);
}

.top-actions {
  position: relative;
  display: flex;
  gap: 10px;
}

.pill-button {
  min-height: 38px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 24px rgba(8, 22, 56, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.options-menu {
  position: relative;
}

.menu-lines {
  display: inline-flex;
  width: 18px;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.menu-lines i {
  width: 18px;
  height: 2px;
  display: block;
  border-radius: 999px;
  background: var(--ink);
}

.options-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 142px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 32px rgba(8, 22, 56, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
}

.options-panel button {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.options-panel button:hover {
  background: rgba(47, 115, 255, 0.12);
}

.privacy-card {
  position: absolute;
  top: 84px;
  right: clamp(22px, 4.8vw, 72px);
  z-index: 4;
  width: min(310px, calc(100vw - 28px));
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 18px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 38px rgba(8, 22, 56, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
}

.privacy-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
}

.privacy-card p {
  margin: 0;
  color: #34415d;
  font-size: 13px;
  line-height: 1.45;
}

.privacy-card p + p {
  margin-top: 6px;
}

.speed-stage {
  position: relative;
  z-index: 2;
  height: calc(100dvh - 92px);
  min-height: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 18px 52px;
}

.is-hidden {
  display: none;
}

.start-button {
  min-height: 58px;
  padding: 0 34px;
  border: 0;
  border-radius: 999px;
  color: #081638;
  background: #a9c9ff;
  box-shadow: 0 14px 30px rgba(8, 22, 56, 0.22);
  font-size: 18px;
  font-weight: 500;
  cursor: pointer;
}

.start-button:hover {
  background: #b8d3ff;
}

.brand {
  position: fixed;
  left: clamp(22px, 4.8vw, 72px);
  top: 22px;
  z-index: 5;
}

.brand-logo {
  width: 88px;
  aspect-ratio: 1;
  display: block;
  object-fit: contain;
  border-radius: 20px;
  box-shadow: 0 12px 28px rgba(7, 22, 56, 0.13);
}

.speed-card {
  width: min(620px, calc(100vw - 32px));
  margin-top: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 28px 70px rgba(8, 22, 56, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
}

.card-title {
  height: 64px;
  padding: 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(8, 22, 56, 0.1);
  color: var(--ink);
  font-size: 21px;
  font-weight: 800;
}

.card-title button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  background: transparent;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.gauge-wrap {
  position: relative;
  height: 350px;
  display: grid;
  place-items: center;
  padding-top: 18px;
}

.gauge {
  position: absolute;
  width: 440px;
  max-width: calc(100% - 44px);
  height: auto;
  transform: translateY(-10px);
}

.gauge-svg-labels {
  fill: rgba(8, 22, 56, 0.55);
  font-size: 9px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
}

.gauge-track,
.gauge-glow,
.gauge-progress {
  fill: none;
  stroke-linecap: round;
}

.gauge-track {
  stroke: rgba(8, 22, 56, 0.11);
  stroke-width: 18;
}

.gauge-glow {
  stroke: url("#gaugeGradient");
  stroke-width: 24;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  filter: blur(9px);
  opacity: 0.22;
  transition: stroke-dashoffset 160ms linear;
}

.gauge-progress {
  stroke: url("#gaugeGradient");
  stroke-width: 18;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  filter: drop-shadow(0 8px 14px rgba(122, 57, 228, 0.24));
  transition: stroke-dashoffset 160ms linear;
}

.gauge-value {
  position: relative;
  z-index: 2;
  margin-top: 2px;
  text-align: center;
}

.gauge-value strong {
  display: block;
  color: #1b2333;
  font-size: 56px;
  line-height: 1;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.gauge-value span,
.test-status,
.meter-stats span {
  color: #65728c;
}

.gauge-value span {
  display: block;
  margin-top: 10px;
  font-size: 13px;
}

.test-status {
  position: absolute;
  bottom: 26px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  font-weight: 600;
}

.test-status span {
  min-height: 34px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(76, 103, 160, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.meter-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid rgba(8, 22, 56, 0.1);
  border-bottom: 1px solid rgba(8, 22, 56, 0.1);
}

.meter-stats div {
  min-height: 104px;
  display: grid;
  place-items: center;
  align-content: center;
}

.meter-stats div + div {
  border-left: 1px solid rgba(8, 22, 56, 0.1);
}

.meter-stats strong {
  color: #1b2333;
  font-size: 36px;
  line-height: 1;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.meter-stats span {
  margin-top: 6px;
  font-size: 13px;
}

.speed-card.is-complete .gauge-wrap,
.speed-card.is-complete .meter-stats {
  display: none;
}

.result-message {
  width: 100%;
  max-height: 0;
  overflow: hidden;
  padding: 0 28px;
  color: #1b2333;
  opacity: 0;
  transition: max-height 220ms ease, padding 220ms ease, opacity 180ms ease;
}

.result-message.show {
  max-height: 280px;
  padding: 28px 28px 18px;
  opacity: 1;
}

.result-message p {
  margin: 0;
  font-size: 16px;
  line-height: 1.45;
}

.result-message p + p {
  margin-top: 3px;
}

.result-message p:nth-child(6) {
  margin-top: 20px;
}

.result-message p:nth-child(7) {
  margin-top: 18px;
}

.card-actions {
  min-height: 82px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.size-control {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(8, 22, 56, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
}

.size-option {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  color: #65728c;
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.size-option.is-active {
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(8, 22, 56, 0.12);
}

.size-option:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.refresh-button {
  min-height: 48px;
  padding: 0 26px;
  border: 1px solid rgba(8, 22, 56, 0.14);
  border-radius: 999px;
  color: var(--ink);
  background: #a9c9ff;
  box-shadow: 0 10px 20px rgba(8, 22, 56, 0.14);
  text-transform: uppercase;
  font-weight: 700;
  cursor: pointer;
}

.refresh-button.is-running {
  background: #eef3fb;
  color: #65728c;
}

.server-note {
  margin: 0;
  padding: 0 20px 16px;
  color: #65728c;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.made-by {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 4;
  min-height: 42px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 28px rgba(8, 22, 56, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  font-size: 15px;
  font-weight: 700;
}

.mesh {
  display: none;
}

.mesh-left {
  display: none;
}

.mesh-right {
  display: none;
}

.sparkles::before,
.sparkles::after {
  display: none;
}

.sparkles::after {
  display: none;
}

@media (max-height: 760px) {
  .topbar {
    height: 76px;
  }

  .speed-stage {
    height: calc(100dvh - 76px);
    min-height: 430px;
    padding-bottom: 34px;
  }

  .brand-logo {
    width: 72px;
  }

  .speed-card {
    width: min(540px, calc(100vw - 28px));
    margin-top: 8px;
  }

  .gauge-wrap {
    height: 286px;
  }

  .gauge {
    width: 350px;
  }

  .gauge-value strong {
    font-size: 42px;
  }

  .meter-stats div {
    min-height: 74px;
  }

  .card-actions {
    min-height: 66px;
  }

}

@media (max-width: 720px) {
  .app-shell {
    min-height: 520px;
  }

  .topbar {
    height: 62px;
    padding: 0 14px;
  }

  .privacy-card {
    top: 58px;
    right: 14px;
  }

  .top-actions {
    gap: 6px;
  }

  .pill-button {
    min-height: 32px;
    padding: 0 10px;
    gap: 6px;
    font-size: 12px;
  }

  .menu-lines {
    width: 15px;
    gap: 2px;
  }

  .menu-lines i {
    width: 15px;
  }

  .speed-stage {
    height: calc(100dvh - 62px);
    min-height: 340px;
    padding-bottom: 42px;
  }

  .brand {
    left: 14px;
    top: 12px;
  }

  .brand-logo {
    width: 50px;
    border-radius: 12px;
  }

  .speed-card {
    width: min(360px, calc(100vw - 24px));
    border-radius: 22px;
  }

  .card-title {
    height: 48px;
    font-size: 16px;
  }

  .gauge-wrap {
    height: 256px;
    padding-top: 10px;
  }

  .gauge {
    width: 312px;
  }

  .gauge-value strong {
    font-size: 38px;
  }

  .meter-stats strong {
    font-size: 30px;
  }

  .card-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .size-control {
    width: 100%;
    justify-content: center;
    border-radius: 18px;
  }

  .size-option {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

  .result-message.show {
    max-height: 360px;
    padding: 22px 20px 12px;
  }

  .result-message p {
    font-size: 14px;
  }

  .refresh-button {
    width: 100%;
  }

  .made-by {
    left: 12px;
    bottom: 12px;
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
  }
}
