/* Redesign global — card layout, fundal, lizibilitate desktop (baoyu-design) */

[data-theme="dark"] {
  --background-backup-color: #060a12;
  --html-bg-image:
    radial-gradient(ellipse 90% 55% at 50% -5%, rgba(56, 189, 248, 0.09), transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 50%, rgba(0, 255, 0, 0.04), transparent),
    radial-gradient(ellipse 45% 35% at 0% 80%, rgba(0, 80, 255, 0.05), transparent),
    linear-gradient(180deg, #04060c 0%, #080c14 40%, #0a1018 100%);
  --gauge-fill-upload: #0000ff;
  --surface-panel: rgba(17, 24, 39, 0.72);
  --surface-panel-strong: rgba(17, 24, 39, 0.88);
  --surface-muted: rgba(15, 23, 42, 0.65);
  --popup-background-color: #111827;
}

[data-theme="light"] {
  --background-backup-color: #f1f5f9;
}

:root {
  --root-size-min: 10px;
  --root-size-max: 12px;

  --page-max: min(96rem, 100%);
  --layout-content-width: min(100%, 40rem);
  --card-radius: 1rem;
  --card-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.22);

  --hero-title: clamp(1.75rem, 2.5vw + 1rem, 3.4rem);
  --hero-tagline: clamp(1rem, 1vw + 0.75rem, 1.35rem);

  --dial-btn-ratio: 0.38;
  --dial-btn-max: 16.5rem;
  --dial-stat-value: clamp(2rem, 5vw, 3rem);
  --dial-go-label: clamp(1.2rem, 3.8vw, 1.65rem);
}

@media (min-width: 48rem) {
  :root {
    --layout-content-width: min(100%, 52rem);
    --dial-stat-value: clamp(2.2rem, 6vw, 3.6rem);
  }
}

@media (min-width: 64rem) {
  :root {
    --layout-content-width: min(100%, 64rem);
    --dial-stat-value: clamp(2.4rem, 4vw, 4.2rem);
    --dial-go-label: clamp(1.35rem, 2.5vw, 2rem);
  }
}

@media (min-width: 90rem) {
  :root {
    --layout-content-width: min(100%, 72rem);
  }
}

[data-theme="light"] {
  --card-shadow: 0 0.25rem 1rem rgba(15, 23, 42, 0.06), 0 0.65rem 1.6rem rgba(14, 116, 144, 0.07);
}

/* Header nav */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  flex: 1 1 auto;
  justify-content: center;
}

@media screen and (max-width: 720px) {
  header .header-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }
}

.header-nav a {
  color: var(--secondary-text-color);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid transparent;
  letter-spacing: normal;
  margin-top: 0 !important;
  line-height: 1.4 !important;
}

.header-nav a:hover {
  color: var(--primary-text-color);
  border-color: var(--border-subtle);
  background: var(--header-hover-bg);
  text-underline-offset: unset;
}

/* Page shell */
.page-wrap {
  width: min(95%, var(--page-max));
  margin: 0 auto;
  padding: 0 0 2rem;
  flex: 1;
}

.hero-block {
  text-align: center;
  padding: 0.05rem 0 0.1rem;
  width: var(--layout-content-width);
  margin-left: auto;
  margin-right: auto;
}

.hero-block > h1 {
  margin-bottom: 0.15rem !important;
  font-size: var(--hero-title);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  opacity: 0.92;
}

.hero-block > .tagline {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  max-width: 36em;
  margin-left: auto !important;
  margin-right: auto !important;
  font-size: var(--hero-tagline);
  line-height: 1.55;
  opacity: 0.65;
}

/* Surface cards */
.surface-card {
  background: var(--surface-panel-strong);
  border: 1px solid var(--border-subtle);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(10px);
  margin-bottom: 1.35rem;
}

[data-theme="light"] .surface-card {
  background: #ffffff;
}

.test-zone {
  padding: 0 1.25rem 0.85rem;
  text-align: center;
  container-type: inline-size;
  container-name: test-zone;
}

.test-zone .server-selector {
  margin-bottom: 0.5rem;
}

.test-zone .gauge-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    "download upload"
    "ping jitter";
  gap: 1.25rem 2.5rem;
  width: 100%;
  max-width: 50rem;
  margin: 1.25rem auto 0.75rem;
  justify-items: center;
  align-items: start;
  /* variabile mostenite de div.gauge si pseudo-elemente */
  --gauge-width: clamp(11rem, 19vw, 17rem);
  --gauge-height: calc(var(--gauge-width) * 0.75);
  --gauge-label-gap: 1rem;
  --progress-width: 0.5rem;
  /* arc gros mai subțire ca să rămână în interiorul track-ului */
  --speed-width: min(1.35rem, calc(var(--gauge-width) * 0.072));
}

.test-zone div.gauge {
  width: var(--gauge-width);
  height: var(--gauge-height);
  max-width: 100%;
  flex-shrink: 0;
}

.test-zone div.gauge > .progress {
  z-index: 2;
}

.test-zone div.gauge > .speed {
  z-index: 1;
}

.test-zone div.gauge > .speed:after {
  left: calc(var(--progress-width) + 0.05rem);
  width: calc(var(--gauge-width) - var(--progress-width) * 2 - var(--speed-width) * 0.35);
  height: calc(var(--gauge-width) / 2 - var(--progress-width) - var(--speed-width) * 0.45);
}

@media screen and (max-width: 560px) {
  .test-zone .gauge-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "download"
      "upload"
      "ping"
      "jitter";
    max-width: 20rem;
    gap: 0.75rem;
    --gauge-width: min(16rem, 86vw);
  }
}

.test-zone div.gauge > .progress,
.test-zone div.gauge > .speed {
  --progress-rotation: 0deg;
  --speed-rotation: 0deg;
}

.test-zone div.gauge.download > .speed:before {
  border-right-color: var(--gauge-pointer-download);
}

.test-zone div.gauge.upload > .speed:before {
  border-right-color: var(--gauge-pointer-upload);
}

.test-zone div.gauge > .progress:before {
  border-color: var(--gauge-track-color);
}

.test-zone div.gauge > .progress:after {
  border-color: var(--gauge-progress-fill);
}

.test-zone div.gauge.download > .speed:after {
  border-color: var(--gauge-fill-download) !important;
}

.test-zone div.gauge.upload > .speed:after {
  border-color: var(--gauge-fill-upload) !important;
}

.test-zone div.gauge > .gauge-speed {
  font-size: clamp(0.85rem, 1.6vw, 1.2rem);
}

.test-zone div.gauge > .gauge-speed > span {
  font-size: clamp(2.2rem, 6.5vw, 4rem);
  letter-spacing: -0.12rem;
}

.test-zone div.gauge > h2 {
  font-size: clamp(0.85rem, 1.6vw, 1.2rem);
}

.test-zone .speed-panel > p#privacy-warning {
  margin-top: 0 !important;
  min-height: auto !important;
  max-width: 22em;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.55;
}

.test-zone .speed-panel > p#privacy-warning #choose-privacy {
  display: inline;
  margin-top: 0;
  font-size: inherit;
  opacity: 0.88;
}

.test-zone #start-button {
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

.test-zone #share-results:not(.speed-share-btn--corner) {
  margin-top: 0.25rem;
  margin-bottom: 0;
}

/* Comparison + intro as cards */
.comparison.surface-card,
.site-intro.surface-card {
  width: 100%;
  max-width: none;
  margin-left: auto;
  margin-right: auto;
  padding: 1.5rem 1.35rem 1.55rem;
}

.site-intro.surface-card {
  text-align: left;
  padding: 1.35rem 1.4rem 1.5rem;
}

/* Stats / legal pages */
main.stats-page.page-wrap {
  max-width: 56rem;
}

.stats-page .stats-prose.surface-card,
.stats-page .stats-disclaimer.surface-card {
  padding: 1.15rem 1.25rem;
  margin-bottom: 1.25rem;
}

.stats-page .stats-panel.surface-card,
.stats-page #year-panel.surface-card {
  padding: 1.4rem 1.3rem 1.55rem;
}

.stats-page .year-tabs-wrap {
  margin-top: 1rem;
}

/* Classic page notice */
.classic-notice {
  text-align: center;
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
  background: var(--surface-accent);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--link-accent-color, var(--theme-green));
}

.classic-notice a {
  font-weight: 700;
  color: inherit;
}

