/* ==============================================================
   CloudPing — Anthropic/Claude-inspired design system
   ============================================================== */

:root {
  --bg: #faf9f5;
  --bg-soft: #f0eee6;
  --surface: #ffffff;
  --surface-2: #f5f3ec;
  --ink: #1f1e1d;
  --ink-2: #5e5d59;
  --ink-3: #91908c;
  --line: #e4e1d7;
  --accent: #d97757;
  --accent-ink: #b85c3e;
  --accent-soft: #f6e3da;
  --good: #6a9b5e;
  --warn: #c98a2d;
  --bad: #c4543e;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(31, 30, 29, 0.04), 0 8px 24px rgba(31, 30, 29, 0.06);
  --shadow-lift: 0 2px 4px rgba(31, 30, 29, 0.06), 0 16px 40px rgba(31, 30, 29, 0.12);
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-sans: ui-sans-serif, -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg: #262624;
  --bg-soft: #21201e;
  --surface: #30302e;
  --surface-2: #383735;
  --ink: #f0eee6;
  --ink-2: #b8b5ad;
  --ink-3: #807e76;
  --line: #44423d;
  --accent: #d97757;
  --accent-ink: #e08b6d;
  --accent-soft: #463530;
  --good: #8fbf7f;
  --warn: #d9a553;
  --bad: #e07a62;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.3), 0 16px 40px rgba(0, 0, 0, 0.4);
}

/* ==============================================================
   UI/UX Pro Max Skill — Global baseline rules
   Priority 1: Accessibility  |  Priority 2: Touch & Interaction
   ============================================================== */

/* Fix: CSS display rules must not override the HTML `hidden` attribute */
[hidden] { display: none !important; }

/* Screen-reader only utility — visible label pattern per skill §8 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skill §2: touch-action manipulation on all interactive controls
   reduces 300ms tap delay on mobile browsers */
button, [role="checkbox"], [role="button"],
a, select, input, textarea {
  touch-action: manipulation;
}

/* Skill §1: Visible focus rings — never remove, 2–4px per HIG/MD */
:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.35s ease, color 0.35s ease;
}

::selection { background: var(--accent-soft); }

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ---------------- header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  position: relative;
  flex: none;
}
.brand-dot::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  animation: ping-ring 2.2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping-ring {
  0% { transform: scale(0.6); opacity: 0.9; }
  70%, 100% { transform: scale(1.8); opacity: 0; }
}

.header-actions { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  min-width: 38px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.icon-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); text-decoration: none; }

/* ================================================================
   CINEMATIC 3D HERO — perspective grid + orbs + parallax layers
   UI/UX Pro Max Skill: Style #5 3D & Hyperrealism + Style #31 Parallax
   ================================================================ */

/* ---------------- hero ---------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 72px 0 56px;
  background:
    radial-gradient(1100px 480px at 85% -10%, var(--accent-soft) 0%, transparent 60%),
    var(--bg-soft);
  border-bottom: 1px solid var(--line);
}

.hero .wrap { position: relative; z-index: 2; }
.hero-content { position: relative; z-index: 4; }

/* ── Perspective grid floor ── */
.hero-grid {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.hero-grid::before {
  content: "";
  position: absolute;
  bottom: -20%;
  left: -30%;
  right: -30%;
  height: 130%;
  background-image:
    linear-gradient(var(--accent) 1px, transparent 1px),
    linear-gradient(90deg, var(--accent) 1px, transparent 1px);
  background-size: 52px 52px;
  opacity: 0.045;
  transform: perspective(500px) rotateX(62deg);
  transform-origin: 50% 100%;
}
html[data-theme="dark"] .hero-grid::before { opacity: 0.07; }

/* ── Floating depth orbs ── */
.hero-orbs {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
}
.orb-1 {
  width: 520px; height: 520px;
  top: -160px; right: -80px;
  background: radial-gradient(circle at 35% 35%, var(--accent-soft), transparent 65%);
  opacity: 0.7;
  animation: orb-float 9s ease-in-out infinite;
}
.orb-2 {
  width: 320px; height: 320px;
  bottom: -80px; left: -40px;
  background: radial-gradient(circle at 40% 30%, var(--accent-soft), transparent 65%);
  opacity: 0.45;
  animation: orb-float 12s ease-in-out infinite reverse;
}
.orb-3 {
  width: 180px; height: 180px;
  top: 30%; left: 38%;
  background: radial-gradient(circle at 50% 50%, var(--accent-soft), transparent 70%);
  opacity: 0.25;
  animation: orb-float 7s ease-in-out infinite 2s;
}
.orb-4 {
  width: 240px; height: 240px;
  top: 0; left: 25%;
  background: radial-gradient(circle at 60% 40%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%);
  opacity: 0.3;
  animation: orb-float 14s ease-in-out infinite 4s;
}
@keyframes orb-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-22px) scale(1.04); }
}

/* ── Floating provider chips ── */
.hero-floats {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
.float-chip {
  position: absolute;
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  will-change: transform;
  box-shadow: 0 4px 16px rgba(31,30,29,0.08);
}
.float-1  { top: 18%; right: 18%; animation: chip-float 8s ease-in-out infinite; }
.float-2  { top: 55%; right: 8%;  animation: chip-float 10s ease-in-out infinite 1.5s; }
.float-3  { top: 28%; right: 36%; animation: chip-float 7s ease-in-out infinite 0.7s; }
.float-4  { top: 70%; right: 22%; animation: chip-float 11s ease-in-out infinite 3s; }
.float-5  { top: 42%; right: 12%; animation: chip-float 9s ease-in-out infinite 2s; }
.float-6  { top: 12%; right: 30%; animation: chip-float 13s ease-in-out infinite 4.5s; }
@keyframes chip-float {
  0%, 100% { transform: translateY(0px) translateX(0px); }
  33% { transform: translateY(-10px) translateX(4px); }
  66% { transform: translateY(-4px) translateX(-6px); }
}

/* ── Radar blip glow rings ── */
.blip-glow {
  opacity: 0;
  animation: blip-pulse 3s ease-in-out infinite;
}
.blip-glow:nth-of-type(3) { animation-delay: 0.9s; }
.blip-glow:nth-of-type(5) { animation-delay: 1.7s; }
@keyframes blip-pulse {
  0%, 100% { opacity: 0; transform: scale(0.8); }
  50% { opacity: 0.7; transform: scale(1.2); }
}

.hero h1 {
  font-family: var(--font-serif);
  font-weight: 560;
  font-size: clamp(34px, 5.4vw, 58px);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 18px;
  max-width: 14em;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent-ink);
}

.hero p.lede {
  font-size: 17.5px;
  color: var(--ink-2);
  max-width: 38em;
  margin: 0 0 30px;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin-top: 8px;
}

.hero-stat .num {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.hero-stat .lbl {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-3);
}

.radar {
  position: absolute;
  right: -60px;
  top: 50%;
  transform: translateY(-50%);
  width: 420px;
  height: 420px;
  opacity: 0.85;
  pointer-events: none;
  z-index: 1;
}

@media (max-width: 900px) { .radar { display: none; } .hero-floats { display: none; } }

.radar circle.ring {
  fill: none;
  stroke: var(--accent);
  stroke-opacity: 0.22;
}
.radar .sweep {
  transform-origin: 210px 210px;
  animation: sweep 5.5s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }

.radar .blip {
  fill: var(--accent);
  animation: blip 3s ease-in-out infinite;
}
.radar .blip:nth-of-type(2) { animation-delay: 0.9s; }
.radar .blip:nth-of-type(3) { animation-delay: 1.7s; }
@keyframes blip {
  0%, 100% { opacity: 0.25; r: 4; }
  50% { opacity: 1; r: 6; }
}

/* ---------------- sections ---------------- */
section.block { padding: 44px 0 8px; }

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.block-head h2 {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.block-head .hint { color: var(--ink-3); font-size: 13.5px; }

.mini-actions { display: flex; gap: 8px; }

.chip-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.chip-btn:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ---------------- provider grid ---------------- */
.providers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.provider-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  /* 3D — JS overrides transform, keep transition only for leave */
  transition: box-shadow 0.3s ease, border-color 0.2s ease;
  will-change: transform;
  transform-style: preserve-3d;
}
/* Holographic sheen — follows --cx --cy set by JS */
.provider-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    circle at var(--cx, 50%) var(--cy, 50%),
    rgba(255,255,255,0.22) 0%,
    transparent 65%
  );
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  z-index: 1;
}
.provider-card:hover::before { opacity: 1; }
/* depth glow on the card edge */
.provider-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  z-index: 0;
}
.provider-card:hover::after { opacity: 1; }

.provider-card.on {
  border-color: var(--accent);
  background: linear-gradient(0deg, var(--accent-soft), var(--accent-soft)), var(--surface);
  background-blend-mode: normal;
}

.provider-card .logo {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.provider-card .meta { min-width: 0; }
.provider-card .name { font-weight: 600; font-size: 14.5px; line-height: 1.25; }
.provider-card .count { font-size: 12px; color: var(--ink-3); }

.provider-card .tick {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  opacity: 0;
  transform: scale(0.4);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.provider-card.on .tick { opacity: 1; transform: scale(1); }

/* ---------------- control bar ---------------- */
.controls {
  margin: 30px 0 10px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.btn-run {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 13px 30px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn-run:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 45%, transparent); }
.btn-run:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn-run.running { background: var(--ink); }
html[data-theme="dark"] .btn-run.running { background: var(--bg-soft); color: var(--ink); border: 1px solid var(--line); }

/* ---------------- round picker ---------------- */
.round-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--bg-soft);
  transition: opacity 0.2s ease;
}
.round-picker[hidden] { display: none; }

.round-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

#roundSelect {
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--accent-ink);
  cursor: pointer;
  padding: 2px 4px;
  appearance: auto;
}
#roundSelect:focus-visible {
  outline: 2px solid var(--accent);
  border-radius: 4px;
}

.run-status { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 220px; }

.run-line {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-size: 13.5px;
  color: var(--ink-2);
}
.run-line b { color: var(--ink); font-variant-numeric: tabular-nums; }

.progress {
  height: 6px;
  border-radius: 99px;
  background: var(--bg-soft);
  overflow: hidden;
  border: 1px solid var(--line);
}
.progress > i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-ink));
  transition: width 0.25s ease;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
  padding: 9px 16px;
  min-width: 200px;
}
.search-box input {
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  color: var(--ink);
  width: 100%;
}
.search-box input::placeholder { color: var(--ink-3); }

/* ---------------- podium ---------------- */
.podium {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin: 26px 0 8px;
}

.podium-card {
  position: relative;
  overflow: visible; /* allow 3D shadow to bleed */
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(30px) translateZ(-40px);
  animation: rise-3d 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  will-change: transform;
  transform-style: preserve-3d;
}
.podium-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    circle at var(--cx, 50%) var(--cy, 50%),
    rgba(255,255,255,0.18) 0%,
    transparent 65%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.podium-card:hover::before { opacity: 1; }
.podium-card:nth-child(2) { animation-delay: 0.1s; }
.podium-card:nth-child(3) { animation-delay: 0.2s; }
@keyframes rise-3d {
  to { opacity: 1; transform: translateY(0) translateZ(0); }
}

.podium-card .medal {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 22px;
}
.podium-card .place {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.podium-card .where { font-weight: 650; font-size: 15.5px; margin-bottom: 2px; }
.podium-card .prov { font-size: 12.5px; color: var(--ink-2); margin-bottom: 12px; }
.podium-card .ms {
  font-family: var(--font-serif);
  font-size: 38px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.podium-card .ms small { font-size: 16px; color: var(--ink-3); font-family: var(--font-sans); font-weight: 500; }

/* ---------------- results table ---------------- */
.table-wrap {
  margin: 18px 0 50px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: auto;
  max-height: 72vh;
}

table.results {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 880px;
}

table.results thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface-2);
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
table.results thead th:hover { color: var(--accent-ink); }
table.results thead th.sorted { color: var(--accent-ink); }
table.results thead th .arrow { font-size: 9px; margin-left: 4px; }

table.results tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
table.results tbody tr { transition: background 0.15s ease; }
table.results tbody tr:hover { background: var(--bg-soft); }
table.results tbody tr.testing {
  background: color-mix(in srgb, var(--accent-soft) 55%, transparent);
}

td.rank { color: var(--ink-3); font-size: 12.5px; width: 40px; }

.prov-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.prov-chip i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

td.region .flag { margin-right: 8px; }
td.region .city { font-weight: 600; }
td.region .area { color: var(--ink-3); font-size: 12.5px; margin-left: 6px; }
td.code { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); }

td.ms { font-weight: 650; }
td.ms.na { color: var(--ink-3); font-weight: 400; }
td.ms .fail { color: var(--bad); font-size: 12px; font-weight: 600; }

.lat-cell { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.lat-num { width: 64px; text-align: right; font-weight: 650; }
.lat-bar {
  flex: 1;
  height: 7px;
  background: var(--bg-soft);
  border-radius: 99px;
  overflow: hidden;
}
.lat-bar > i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 99px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.3s ease;
}

svg.spark { display: block; }
svg.spark polyline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}
svg.spark circle { fill: var(--accent); }

.empty-note {
  padding: 60px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 15px;
}
.empty-note .big {
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--ink-2);
  margin-bottom: 6px;
}

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translate(-50%, 16px);
  background: var(--ink);
  color: var(--bg);
  font-size: 13.5px;
  padding: 10px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 100;
  box-shadow: var(--shadow-lift);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- footer ---------------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  margin-top: 30px;
  padding: 34px 0 44px;
  color: var(--ink-2);
  font-size: 13.5px;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 18px;
}

/* ==============================================================
   UI/UX Pro Max Skill — Interaction quality
   Priority 2: cursor-pointer on ALL clickable elements
   ============================================================== */

/* Skill pre-delivery checklist: cursor-pointer on all clickable elements */
button:not(:disabled),
[role="checkbox"],
[role="button"],
label[for],
summary,
.chip-btn,
.icon-btn,
.ai-chip,
.ai-key-toggle,
.ai-key-save,
.ai-send-btn:not(:disabled),
table.results thead th {
  cursor: pointer;
}

/* Skill §4: No emoji as icons — SVG rank badge styles */
.rank-badge { display: block; flex: none; }
.rank-badge text { font-feature-settings: "tnum"; }

/* Skill §6: tabular-nums on ALL numeric data cells */
.podium-card .ms,
td.ms,
.lat-num,
.run-line b,
.hero-stat .num {
  font-variant-numeric: tabular-nums;
}

/* Skill §5: Breakpoint consistency — 375px / 640px / 768px / 1024px / 1440px */
@media (max-width: 640px) {
  .hero { padding: 48px 0 38px; }
  /* Skill §5: horizontal-scroll prevention, safe content width */
  .hero h1 { font-size: clamp(28px, 8vw, 40px); }
  .hero p.lede { font-size: 15.5px; }
  .hero-stats { gap: 18px; }
  .hero-stat .num { font-size: 24px; }

  .controls { flex-direction: column; align-items: stretch; }
  .btn-run { justify-content: center; }

  /* Skill §5: min-touch-target 44px on mobile */
  .chip-btn, .ai-chip {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* Skill §5: 375px — podium cards stack */
  .podium { grid-template-columns: 1fr; }

  /* Skill §5: wrap providers grid tighter on tiny screens */
  .providers { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

  /* Skill §5: footer readable on small screens */
  .site-footer .wrap { flex-direction: column; gap: 10px; }
}

/* Skill §5: 375px — min safe padding */
@media (max-width: 400px) {
  .wrap { padding: 0 16px; }
  .ai-body { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}

/* ================================================================
   SCROLL-DRIVEN 3D REVEALS
   UI/UX Pro Max §7: motion-meaning, continuity, stagger-sequence
   ================================================================ */

.reveal-3d {
  opacity: 0;
  transform: translateY(40px) perspective(900px) rotateX(5deg);
  transition:
    opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.reveal-3d.in-view {
  opacity: 1;
  transform: translateY(0) perspective(900px) rotateX(0deg);
}

/* Stagger children for list/grid reveals */
.reveal-3d .provider-card {
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transition:
    opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.3s ease,
    border-color 0.2s ease;
}
.reveal-3d.in-view .provider-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}
/* Stagger delay via JS data-index OR nth-child fallback */
.reveal-3d.in-view .provider-card:nth-child(1)  { transition-delay: 0.04s; }
.reveal-3d.in-view .provider-card:nth-child(2)  { transition-delay: 0.08s; }
.reveal-3d.in-view .provider-card:nth-child(3)  { transition-delay: 0.12s; }
.reveal-3d.in-view .provider-card:nth-child(4)  { transition-delay: 0.16s; }
.reveal-3d.in-view .provider-card:nth-child(5)  { transition-delay: 0.20s; }
.reveal-3d.in-view .provider-card:nth-child(6)  { transition-delay: 0.24s; }
.reveal-3d.in-view .provider-card:nth-child(7)  { transition-delay: 0.28s; }
.reveal-3d.in-view .provider-card:nth-child(8)  { transition-delay: 0.32s; }
.reveal-3d.in-view .provider-card:nth-child(9)  { transition-delay: 0.36s; }
.reveal-3d.in-view .provider-card:nth-child(10) { transition-delay: 0.40s; }
.reveal-3d.in-view .provider-card:nth-child(11) { transition-delay: 0.44s; }
.reveal-3d.in-view .provider-card:nth-child(12) { transition-delay: 0.48s; }
.reveal-3d.in-view .provider-card:nth-child(n+13){ transition-delay: 0.52s; }

/* Block-head titles get a left-slide reveal */
.reveal-3d .block-head h2 {
  opacity: 0;
  transform: translateX(-18px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal-3d.in-view .block-head h2 {
  opacity: 1;
  transform: translateX(0);
  transition-delay: 0.05s;
}

/* ================================================================
   CINEMATIC HEADER — 3D depth on scroll
   ================================================================ */
.site-header {
  transform-style: preserve-3d;
  will-change: transform;
}

/* ================================================================
   3D HERO PARALLAX TARGETS — class applied by JS for clean separation
   ================================================================ */
#heroContent  { will-change: transform; }
#heroRadar    { will-change: transform; }
.hero-orbs    { will-change: transform; }
.float-chip   { will-change: transform; }

/* ==============================================================
   AI Analysis panel — Claude 3.5 Sonnet integration
   Indigo accent to distinguish from site's terracotta palette
   ============================================================== */

:root {
  --ai: #5b5bd6;
  --ai-ink: #4040b8;
  --ai-soft: #f3f3ff;
  --ai-line: #e0e0fa;
}
html[data-theme="dark"] {
  --ai: #818cf8;
  --ai-ink: #a5b4fc;
  --ai-soft: #1c1c2e;
  --ai-line: #2e2e50;
}

.ai-panel {
  margin: 18px 0 50px;
  border: 1px solid var(--ai-line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Multiple badge support */
.ai-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.ai-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 22px;
  border-bottom: 1px solid var(--ai-line);
  background: var(--ai-soft);
}

.ai-title {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.ai-logo {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: var(--ai);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.ai-logo svg { width: 16px; height: 16px; fill: #fff; flex: none; }

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--ai);
  background: color-mix(in srgb, var(--ai) 10%, transparent);
  border: 1px solid var(--ai-line);
  padding: 3px 10px;
  border-radius: 999px;
}
.ai-badge-free  { color: var(--good); background: color-mix(in srgb, var(--good) 10%, transparent); border-color: color-mix(in srgb, var(--good) 25%, transparent); }
.ai-badge-claude { color: var(--ai); }

/* Location bar */
.ai-location-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 22px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: color-mix(in srgb, var(--bg-soft) 60%, transparent);
  border-bottom: 1px solid var(--ai-line);
}
.ai-location-bar svg { color: var(--ai); flex: none; }
.ai-location-isp { color: var(--ink-3); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Claude upgrade section — subtle collapsible */
.ai-claude-upgrade {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.ai-claude-upgrade summary {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.ai-claude-upgrade summary::-webkit-details-marker { display: none; }
.ai-claude-upgrade summary svg { color: var(--ink-3); flex: none; }
.ai-claude-upgrade summary:hover { color: var(--ink); }

.ai-upgrade-body {
  padding: 4px 14px 16px;
}
.ai-upgrade-body p {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
}
.ai-key-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--font-mono);
}

.ai-body { padding: 22px 24px 20px; }

/* quick-question chips */
.ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.ai-chip {
  border: 1px solid var(--ai-line);
  background: var(--ai-soft);
  color: var(--ai-ink);
  font: inherit;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.ai-chip:hover {
  background: var(--ai);
  color: #fff;
  border-color: var(--ai);
}

/* prompt input row — mono/terminal aesthetic */
.ai-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 18px;
}

.ai-input-row textarea {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  resize: none;
  min-height: 52px;
  outline: none;
  transition: border-color 0.18s ease;
}
.ai-input-row textarea:focus { border-color: var(--ai); }
.ai-input-row textarea::placeholder { color: var(--ink-3); }

.ai-send-btn {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--ai);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, opacity 0.2s ease;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--ai) 35%, transparent);
}
.ai-send-btn:hover:not(:disabled) { transform: scale(1.08); }
.ai-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.ai-send-btn svg { width: 18px; height: 18px; fill: currentColor; }

/* response — margin-annotation aesthetic */
.ai-response {
  display: none;
  padding: 18px 20px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--ai);
  background: var(--ai-soft);
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  margin-bottom: 4px;
}
.ai-response.streaming,
.ai-response.has-content { display: block; }

.ai-response p { margin: 0 0 0.7em; }
.ai-response p:last-child { margin-bottom: 0; }
.ai-response h3,
.ai-response h4 {
  font-family: var(--font-serif);
  font-weight: 700;
  margin: 1em 0 0.35em;
  color: var(--ink);
}
.ai-response h3 { font-size: 17px; }
.ai-response h4 { font-size: 15.5px; }
.ai-response strong { font-weight: 700; }
.ai-response code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: color-mix(in srgb, var(--ai) 12%, transparent);
  color: var(--ai-ink);
  padding: 1px 6px;
  border-radius: 4px;
}

/* blinking cursor during stream */
.ai-cursor {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  background: var(--ai);
  vertical-align: text-bottom;
  margin-left: 2px;
  border-radius: 1px;
  animation: ai-blink 0.85s step-end infinite;
}
@keyframes ai-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.ai-error {
  color: var(--bad);
  font-family: var(--font-sans);
  font-size: 14px;
}

/* key management — subtle footer inside panel */
.ai-key-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid var(--ai-line);
  font-size: 12.5px;
  color: var(--ink-3);
}
.ai-key-bar .lbl { font-weight: 600; color: var(--ink-2); }
.ai-key-display {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
}
.ai-key-display[data-set="1"] { color: var(--good); }

.ai-key-toggle {
  background: none;
  border: none;
  color: var(--ai-ink);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ai-key-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}
.ai-key-row input {
  flex: 1;
  max-width: 420px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 13px;
  outline: none;
}
.ai-key-row input:focus { border-color: var(--ai); }

.ai-key-save {
  border: none;
  border-radius: 999px;
  background: var(--ai);
  color: #fff;
  font: inherit;
  font-size: 13px;
  padding: 8px 18px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.ai-key-save:hover { opacity: 0.88; }

.ai-key-note {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: var(--ink-3);
}

@media (max-width: 640px) {
  .ai-input-row { flex-direction: column; align-items: stretch; }
  .ai-send-btn { width: 100%; height: 42px; border-radius: var(--radius-sm); }
}

/* ==============================================================
   Language Picker
   ============================================================== */

.lang-picker {
  position: relative;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.lang-btn span { pointer-events: none; }

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 300;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift);
  padding: 5px;
  list-style: none;
  margin: 0;
  animation: fadeIn 0.15s ease;
}

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

.lang-option {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
}
.lang-option:hover { background: var(--bg-soft); }
.lang-option[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}

/* ==============================================================
   RTL Support (Arabic, Persian)
   ============================================================== */

[dir="rtl"] {
  --font-main: "Vazirmatn", "Source Serif 4", Georgia, serif;
}

[dir="rtl"] body,
[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] p,
[dir="rtl"] button,
[dir="rtl"] input,
[dir="rtl"] textarea,
[dir="rtl"] select,
[dir="rtl"] label {
  font-family: "Vazirmatn", ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0;
}

/* Header — keep logo on left, actions on right (flex naturally reverses in RTL) */
[dir="rtl"] .site-header .wrap {
  flex-direction: row-reverse;
}
[dir="rtl"] .header-actions {
  flex-direction: row-reverse;
}

/* Lang menu opens to the left side in RTL */
[dir="rtl"] .lang-menu {
  right: auto;
  left: 0;
}

/* Block heads */
[dir="rtl"] .block-head { flex-direction: row-reverse; text-align: right; }
[dir="rtl"] .mini-actions { flex-direction: row-reverse; }

/* Controls row */
[dir="rtl"] .controls { flex-direction: row-reverse; flex-wrap: wrap; }

/* Run-line status */
[dir="rtl"] .run-line { flex-direction: row-reverse; }

/* Table */
[dir="rtl"] table { direction: rtl; }
[dir="rtl"] th, [dir="rtl"] td { text-align: right; }
[dir="rtl"] td:first-child, [dir="rtl"] th:first-child { text-align: center; }

/* AI panel */
[dir="rtl"] .ai-panel-head { flex-direction: row-reverse; }
[dir="rtl"] .ai-badges     { flex-direction: row-reverse; }
[dir="rtl"] .ai-chips      { justify-content: flex-end; }
[dir="rtl"] .ai-input-row  { flex-direction: row-reverse; }
[dir="rtl"] .ai-location-bar { flex-direction: row-reverse; }
[dir="rtl"] .ai-upgrade-body p { text-align: right; }
[dir="rtl"] .ai-key-row   { flex-direction: row-reverse; }
[dir="rtl"] .ai-key-status { flex-direction: row-reverse; }

/* Hero text */
[dir="rtl"] .hero-content  { text-align: right; }
[dir="rtl"] .hero-stats    { justify-content: flex-start; }

/* Footer */
[dir="rtl"] .site-footer .wrap { text-align: right; }

/* Podium */
[dir="rtl"] .podium { flex-direction: row-reverse; }

/* Provider grid cards */
[dir="rtl"] .provider-card { text-align: right; }

/* Empty note */
[dir="rtl"] .empty-note { text-align: right; }

/* Round picker */
[dir="rtl"] .round-picker { flex-direction: row-reverse; }

/* Block head hint */
[dir="rtl"] .hint { text-align: right; }
