:root {
      --bg:      #080c14;
      --surface: #0d1421;
      --panel:   #131f30;
      --border:  #243347;
      --accent:  #00e5ff;
      --accent2: #7c3aed;
      --accent3: #10b981;
      --warn:    #f59e0b;
      --danger:  #ef4444;
      --text:    #f0f4f8;        /* brightened from #e2e8f0 */
      --text2:   #c8d8e8;        /* secondary text — readable on dark */
      --muted:   #8ba3bf;        /* brightened from #64748b */
      --glow:    rgba(0,229,255,0.15);
    }

    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    html { scroll-behavior: smooth; }

    body {
      background: var(--bg);
      color: var(--text);
      font-family: 'Space Mono', monospace;
      min-height: 100vh;
      overflow-x: hidden;
      position: relative;
    }

    /* ── BACKGROUND GRID ── */
    body::before {
      content: '';
      position: fixed; inset: 0;
      background-image:
        linear-gradient(rgba(0,229,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,229,255,0.04) 1px, transparent 1px);
      background-size: 40px 40px;
      pointer-events: none; z-index: 0;
    }
    body::after {
      content: '';
      position: fixed; top: -40%; left: -20%;
      width: 80vw; height: 80vw;
      background: radial-gradient(circle, rgba(124,58,237,0.08) 0%, transparent 65%);
      pointer-events: none; z-index: 0;
    }

    .page-wrap { position: relative; z-index: 1; }

    /* ── HEADER ── */
    header {
      display: flex; align-items: center; justify-content: space-between;
      padding: 16px 28px;
      border-bottom: 1px solid var(--border);
      background: rgba(8,12,20,0.85);
      backdrop-filter: blur(14px);
      position: sticky; top: 0; z-index: 100;
    }
    .logo {
      font-family: 'Orbitron', sans-serif;
      font-weight: 900; font-size: 1.3rem; letter-spacing: 0.05em;
      color: var(--accent);
      text-shadow: 0 0 20px rgba(0,229,255,0.5);
    }
    .logo span { color: var(--text); }
    .header-badge {
      font-size: 0.62rem; letter-spacing: 0.14em;
      color: var(--text2);            /* readable, not muted */
      text-transform: uppercase;
      border: 1px solid var(--border);
      padding: 4px 10px; border-radius: 20px;
      background: rgba(255,255,255,0.04);
    }

    /* ── AD HELPERS ── */
    .ad-label {
      font-size: 0.6rem; color: var(--muted);
      letter-spacing: 0.14em; text-transform: uppercase;
      margin-bottom: 5px; text-align: center;
    }
    .ad-placeholder {
      background: var(--panel);
      border: 1px dashed var(--border);
      border-radius: 8px;
      display: flex; align-items: center; justify-content: center;
      color: var(--text2);            /* readable placeholder text */
      font-size: 0.72rem; letter-spacing: 0.08em;
    }
    .ad-placeholder.banner     { height: 90px; }
    .ad-placeholder.mobile-ad  { height: 60px; }
    .ad-placeholder.square     { height: 250px; }
    .ad-placeholder.skyscraper { height: 600px; width: 160px; }

    /* ── TOP AD — desktop leaderboard + mobile banner ── */
    .ad-top {
      width: 100%; max-width: 728px;
      margin: 14px auto; padding: 0 14px;
    }
    /* Mobile-only ad strip (shown only on small screens) */
    .ad-mobile-top {
      display: none;
      width: 100%; padding: 8px 14px 0;
    }

    /* ── MAIN GRID ── */
    .main-grid {
      display: grid;
      grid-template-columns: 180px minmax(0, 860px) 180px;
      gap: 0;
      padding: 28px 12px 48px;
      max-width: 1400px;
      margin: 0 auto;
    }
    .sidebar {
      padding: 0 16px;
      display: flex; flex-direction: column;
      gap: 16px;
    }
    .sidebar.left  { align-items: flex-end; }
    .sidebar.right { align-items: flex-start; }
    .center-col { min-width: 0; }

    /* ── TEST CARD ── */
    .test-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 20px;
      padding: 36px 28px;
      box-shadow: 0 0 60px rgba(0,229,255,0.05), 0 40px 80px rgba(0,0,0,0.55);
      position: relative; overflow: hidden;
    }
    .test-card::before {
      content: '';
      position: absolute; top: 0; left: 0; right: 0; height: 2px;
      background: linear-gradient(90deg, transparent, var(--accent), var(--accent2), transparent);
    }

    /* ── GAUGE ── */
    .gauge-wrap {
      position: relative;
      width: 100%; max-width: 380px;
      margin: 0 auto 24px;
    }
    .gauge-svg { width: 100%; display: block; }

    .speed-readout {
      position: absolute;
      bottom: 10%; left: 50%;
      transform: translateX(-50%);
      text-align: center; pointer-events: none;
      white-space: nowrap;
    }
    .speed-num {
      font-family: 'Orbitron', sans-serif;
      font-size: clamp(2.2rem, 8vw, 3.4rem);
      font-weight: 900;
      color: var(--accent);
      line-height: 1;
      text-shadow: 0 0 30px rgba(0,229,255,0.55);
      transition: color 0.3s ease;
    }
    .speed-unit {
      font-family: 'Orbitron', sans-serif;
      font-size: 0.68rem;
      color: var(--text2);             /* readable */
      letter-spacing: 0.18em;
      margin-top: 5px;
    }

    /* ── PHASE LABEL ── */
    .phase-label {
      text-align: center;
      font-size: 0.72rem; letter-spacing: 0.18em;
      text-transform: uppercase;
      color: var(--text2);             /* always readable */
      margin-bottom: 24px; min-height: 1.2em;
      transition: color 0.3s;
    }
    .phase-label.active { color: var(--accent); }

    /* ── START BUTTON ── */
    .btn-wrap { text-align: center; margin-bottom: 28px; }
    #startBtn {
      font-family: 'Orbitron', sans-serif;
      font-weight: 700; font-size: 0.92rem;
      letter-spacing: 0.15em; text-transform: uppercase;
      padding: 15px 48px;
      border: 2px solid var(--accent);
      background: transparent;
      color: var(--accent);
      border-radius: 50px; cursor: pointer;
      position: relative; overflow: hidden;
      transition: all 0.3s ease;
      box-shadow: 0 0 20px rgba(0,229,255,0.15), inset 0 0 20px rgba(0,229,255,0.05);
    }
    #startBtn::before {
      content: '';
      position: absolute; inset: 0;
      background: var(--accent);
      transform: scaleX(0); transform-origin: left;
      transition: transform 0.3s ease; z-index: -1;
    }
    #startBtn:hover:not(:disabled)::before { transform: scaleX(1); }
    #startBtn:hover:not(:disabled) { color: #080c14; box-shadow: 0 0 40px rgba(0,229,255,0.4); }
    #startBtn:disabled { opacity: 0.5; cursor: not-allowed; border-color: var(--muted); color: var(--muted); box-shadow: none; }

    /* ── LIVE PROGRESS BAR ── */
    .live-bar-wrap { margin: 0 0 24px; display: none; }
    .live-bar-wrap.visible { display: block; }
    .live-bar-label {
      display: flex; justify-content: space-between;
      font-size: 0.65rem; letter-spacing: 0.12em;
      color: var(--text2);             /* readable */
      text-transform: uppercase; margin-bottom: 8px;
    }
    .live-bar-track {
      height: 6px; background: var(--panel);
      border-radius: 3px; overflow: hidden;
    }
    .live-bar-fill {
      height: 100%; width: 0%; border-radius: 3px;
      background: linear-gradient(90deg, var(--accent2), var(--accent));
      box-shadow: 0 0 12px rgba(0,229,255,0.5);
      transition: width 0.25s ease;
    }

    /* ── RESULTS ROW ── */
    .results-row {
      display: grid; grid-template-columns: repeat(3,1fr);
      gap: 14px; margin-bottom: 20px;
    }
    .result-card {
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 12px; padding: 16px 10px;
      text-align: center; position: relative; overflow: hidden;
      transition: border-color 0.3s, box-shadow 0.3s;
    }
    .result-card.active-card {
      border-color: var(--accent);
      box-shadow: 0 0 20px rgba(0,229,255,0.12);
    }
    .result-card::after {
      content: '';
      position: absolute; bottom: 0; left: 0; right: 0; height: 2px;
      background: var(--accent);
      transform: scaleX(0); transition: transform 0.3s ease;
    }
    .result-card.active-card::after { transform: scaleX(1); }

    .result-icon { font-size: 1.1rem; margin-bottom: 5px; }
    .result-label {
      font-size: 0.62rem; letter-spacing: 0.16em;
      text-transform: uppercase;
      color: var(--text2);             /* readable */
      margin-bottom: 8px;
    }
    .result-val {
      font-family: 'Orbitron', sans-serif;
      font-size: 1.4rem; font-weight: 700;
      color: var(--text);              /* bright white */
      transition: color 0.3s;
    }
    .result-val.lit { color: var(--accent); }
    .result-unit {
      font-size: 0.6rem; color: var(--text2); /* readable */
      letter-spacing: 0.1em; margin-top: 3px;
    }

    /* ── INFO CHIPS ── */
    .info-row {
      display: flex; justify-content: center;
      gap: 20px; flex-wrap: wrap; margin-top: 4px;
    }
    .info-chip {
      font-size: 0.64rem; letter-spacing: 0.1em;
      color: var(--text2);             /* readable */
      display: flex; align-items: center; gap: 6px;
    }
    .info-dot {
      width: 6px; height: 6px; border-radius: 50%;
      background: var(--accent3);
      box-shadow: 0 0 8px rgba(16,185,129,0.6);
      flex-shrink: 0;
    }

    /* ── ADS BELOW CARD ── */
    .ad-below { margin: 20px 0; }

    /* ── FEATURES ── */
    .features {
      display: grid; grid-template-columns: repeat(3,1fr);
      gap: 14px; margin: 8px 0;
    }
    .feature-item {
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 12px; padding: 18px 14px; text-align: center;
    }
    .feature-icon { font-size: 1.4rem; margin-bottom: 8px; }
    .feature-title {
      font-family: 'Orbitron', sans-serif;
      font-size: 0.68rem; font-weight: 700;
      color: var(--text);              /* bright */
      margin-bottom: 7px; letter-spacing: 0.04em;
    }
    .feature-desc {
      font-size: 0.64rem;
      color: var(--text2);             /* readable */
      line-height: 1.65;
    }

    /* ── FOOTER ── */
    footer {
      border-top: 1px solid var(--border);
      padding: 18px 28px; text-align: center;
      font-size: 0.64rem; color: var(--text2); /* readable */
      letter-spacing: 0.1em;
      position: relative; z-index: 1;
    }

    /* ── PULSE ANIMATION ── */
    @keyframes pulse-glow {
      0%,100% { box-shadow: 0 0 20px rgba(0,229,255,0.08); }
      50%      { box-shadow: 0 0 40px rgba(0,229,255,0.28); }
    }
    .testing-pulse { animation: pulse-glow 1.5s ease-in-out infinite; }

    /* ── RESPONSIVE ── */
    @media (max-width: 1100px) {
      .main-grid { grid-template-columns: 1fr; }
      .sidebar   { display: none; }
    }

    @media (max-width: 640px) {
      header        { padding: 12px 14px; }
      .header-badge { display: none; }         /* keep header clean on tiny screens */
      .ad-top       { display: none; }         /* hide desktop leaderboard on mobile */
      .ad-mobile-top{ display: block; }        /* show mobile banner instead */
      .test-card    { padding: 22px 14px; }
      .results-row  { gap: 8px; }
      .result-val   { font-size: 1.1rem; }
      .result-label { font-size: 0.55rem; }
      .features     { grid-template-columns: 1fr; }
      .info-row     { gap: 12px; }
      .info-chip    { font-size: 0.6rem; }
    }