.wh {
  --bg: #000;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-hi: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.08);
  --line-hi: rgba(255, 255, 255, 0.14);
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #6e6e73;
  --green: #30d158;
  --green-soft: rgba(48, 209, 88, 0.14);
  --amber: #ff9f0a;
  --amber-soft: rgba(255, 159, 10, 0.14);
  --red: #ff453a;
  --red-soft: rgba(255, 69, 58, 0.14);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", system-ui, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, monospace;
  --radius: 22px;

  position: relative;
  max-width: 1180px;
  margin: 0 auto !important;
  padding: 40px 28px 72px !important;
  font-family: var(--sans);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.wh::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 520px;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 70% at 50% 0%, rgba(48, 209, 88, 0.10), transparent 70%),
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.07) 1px, transparent 0) 0 0 / 22px 22px;
  -webkit-mask-image: radial-gradient(70% 80% at 50% 0%, #000 30%, transparent 75%);
  mask-image: radial-gradient(70% 80% at 50% 0%, #000 30%, transparent 75%);
}

.wh-mono { font-family: var(--mono); }

/* ---------- top bar ---------- */

.wh-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wh-prompt {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-3);
}

.wh-prompt-sym { color: var(--green); margin-right: 4px; }

.wh-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}

.wh-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  animation: wh-breathe 1.4s ease-in-out infinite;
}

.wh-pill[data-state="done"] .wh-pill-dot { background: var(--green); animation-duration: 2.8s; }
.wh-pill[data-state="error"] .wh-pill-dot { background: var(--red); animation: none; }

@keyframes wh-breathe {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.25; }
}

/* ---------- hero ---------- */

.wh-hero {
  padding: 72px 0 56px;
  text-align: center;
}

.wh-eyebrow {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-2);
}

.wh-ip {
  margin-top: 14px;
  font-family: var(--mono);
  font-size: clamp(2.4rem, 7.4vw, 5.6rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.035em;
  word-break: break-all;
}

.wh-ip #whIp {
  background: linear-gradient(180deg, #ffffff 30%, #8e8e93 120%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.wh-caret {
  display: inline-block;
  width: 0.08em;
  height: 0.82em;
  margin-left: 0.12em;
  vertical-align: -0.04em;
  border-radius: 2px;
  background: var(--green);
  animation: wh-caret 1.1s steps(1) infinite;
}

@keyframes wh-caret { 50% { opacity: 0; } }

.wh-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 18px;
  font-size: 15px;
  color: var(--text);
}

.wh-meta .wh-mono { font-size: 13px; color: var(--text-2); }

.wh-meta-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-3);
}

/* ---------- stats ---------- */

.wh-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.wh-stat {
  padding: 20px 22px;
  min-width: 0;
}

.wh-stat + .wh-stat { border-left: 1px solid var(--line); }

.wh-stat-k {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}

.wh-stat-v {
  margin-top: 8px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.wh-stat-s {
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- map ---------- */

.wh-map-card {
  position: relative;
  height: 540px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #0b0c0d;
  isolation: isolate;
}

.wh-map {
  position: absolute !important;
  inset: 0;
  background: #0b0c0d !important;
  font-family: var(--sans);
}

.wh-map img {
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
}

.wh-map .wh-tiles-map {
  filter: grayscale(1) brightness(0.62) contrast(1.25);
}

.wh-map .wh-tiles-sat {
  filter: grayscale(0.85) brightness(0.7) contrast(1.15);
}

.wh-map .wh-tiles-label { opacity: 0.55; }

.wh-map .leaflet-control-attribution {
  background: transparent !important;
  color: var(--text-3) !important;
  font-size: 10px;
}

.wh-map .leaflet-control-attribution a { color: var(--text-3) !important; text-shadow: none !important; }

.wh-map-vignette {
  position: absolute;
  inset: 0;
  z-index: 400;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

.wh-chip {
  position: absolute;
  z-index: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  background: rgba(22, 22, 24, 0.62);
  border: 1px solid var(--line-hi);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  pointer-events: none;
}

.wh-chip.wh-mono { font-size: 11.5px; font-weight: 400; color: var(--text-2); }

.wh-chip--tl { top: 16px; left: 16px; }
.wh-chip--bl { bottom: 16px; left: 16px; }

.wh-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  animation: wh-breathe 1s ease-in-out infinite;
}

.wh-chip.is-locked .wh-chip-dot { background: var(--green); animation: none; }

.wh-seg {
  position: absolute;
  z-index: 500;
  top: 16px;
  right: 16px;
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(22, 22, 24, 0.62);
  border: 1px solid var(--line-hi);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
}

.wh-seg button {
  height: 26px;
  padding: 0 14px !important;
  border: 0 !important;
  border-radius: 999px;
  background: transparent !important;
  color: var(--text-2) !important;
  font-family: var(--sans) !important;
  font-size: 12px;
  font-weight: 500 !important;
  transition: background 0.2s ease, color 0.2s ease;
}

.wh-seg button.is-active {
  background: rgba(255, 255, 255, 0.14) !important;
  color: var(--text) !important;
}

/* target marker: crosshair + dot */

.wh-target { position: relative; }

.wh-target-h,
.wh-target-v {
  position: absolute;
  background: rgba(48, 209, 88, 0.28);
}

.wh-target-h { left: -2000px; width: 4000px; top: 0; height: 1px; }
.wh-target-v { top: -2000px; height: 4000px; left: 0; width: 1px; }

.wh-target-ring {
  position: absolute;
  left: -28px;
  top: -28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(48, 209, 88, 0.55);
  animation: wh-ripple 2.4s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
}

.wh-target-ring--2 { animation-delay: 1.2s; }

@keyframes wh-ripple {
  from { transform: scale(0.2); opacity: 1; }
  to   { transform: scale(2.2); opacity: 0; }
}

.wh-target-dot {
  position: absolute;
  left: -7px;
  top: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green);
  border: 2.5px solid #fff;
  box-sizing: border-box;
}

.wh-origin-dot {
  position: absolute;
  left: -3.5px;
  top: -3.5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.8;
}

/* ---------- cards ---------- */

.wh-cards {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.wh-cards--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wh-cards--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* lookup mode (?chw=): connection/device/privacy hidden → keep the remaining cards balanced */
.wh-lookup .wh-cards--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.wh-card {
  min-width: 0;
  padding: 22px 24px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.wh-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.wh-card-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.wh-card-tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wh-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.wh-row:first-child { border-top: 0; }

.wh-card--wide { grid-column: span 2; }

.wh-rows--2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 32px;
}

.wh-rows--2 .wh-row:nth-child(2) { border-top: 0; }

.wh-row-k {
  flex: none;
  font-size: 13px;
  color: var(--text-2);
}

.wh-row-v {
  min-width: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  text-align: right;
  word-break: break-word;
}

.wh-row-v.is-pending { color: var(--text-3); }
.wh-row-v.is-good    { color: var(--green); }
.wh-row-v.is-warn    { color: var(--amber); }
.wh-row-v.is-bad     { color: var(--red); }

.wh-verdict {
  height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-hi);
  color: var(--text-2);
}

.wh-verdict[data-level="good"] { background: var(--green-soft); color: var(--green); }
.wh-verdict[data-level="warn"] { background: var(--amber-soft); color: var(--amber); }
.wh-verdict[data-level="bad"]  { background: var(--red-soft); color: var(--red); }

.wh-card-note {
  margin: 6px 0 12px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-3);
}

.wh-card-note:empty { display: none; }

/* ---------- console ---------- */

.wh-console { margin-top: 16px; padding-bottom: 20px; }

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

.wh-btn {
  height: 30px;
  padding: 0 14px !important;
  border-radius: 999px;
  border: 1px solid var(--line-hi) !important;
  background: transparent !important;
  color: var(--text) !important;
  font-family: var(--sans) !important;
  font-size: 12px;
  font-weight: 500 !important;
  transition: background 0.2s ease;
}

.wh-btn:hover { background: var(--surface-hi) !important; }

.wh-log {
  max-height: 220px;
  overflow-y: auto;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.85;
  color: var(--text-2);
}

.wh-log-line { display: flex; gap: 14px; }
.wh-log-ts { flex: none; color: var(--text-3); }
.wh-log-msg { min-width: 0; word-break: break-all; }
.wh-log-msg.ok   { color: var(--text); }
.wh-log-msg.ok::before   { content: "✓ "; color: var(--green); }
.wh-log-msg.warn::before { content: "! "; color: var(--amber); }
.wh-log-msg.err  { color: var(--red); }
.wh-log-msg.err::before  { content: "× "; }
.wh-log-msg.step::before { content: "› "; color: var(--text-3); }

.wh-foot {
  margin: 28px auto 0;
  max-width: 640px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-3);
}

/* ---------- responsive ---------- */

@media (max-width: 980px) {
  .wh-cards--3 { grid-template-columns: minmax(0, 1fr); }
  .wh-lookup .wh-cards--3 { grid-template-columns: minmax(0, 1fr); }
  .wh-card--wide { grid-column: auto; }
  .wh-rows--2 { grid-template-columns: minmax(0, 1fr); }
  .wh-rows--2 .wh-row:nth-child(2) { border-top: 1px solid var(--line); }
  .wh-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wh-stat:nth-child(3) { border-left: 0; }
  .wh-stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .wh-map-card { height: 440px; }
}

@media (max-width: 560px) {
  .wh { padding: 28px 16px 56px !important; }
  .wh-hero { padding: 48px 0 40px; }
  .wh-meta { flex-direction: column; gap: 6px; }
  .wh-meta-sep { display: none; }
  .wh-stat { padding: 16px 18px; }
  .wh-stat-v { font-size: 18px; }
  .wh-map-card { height: 380px; }
  .wh-card { padding: 20px 18px 8px; }
  .wh-log-ts { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .wh-target-ring, .wh-caret, .wh-pill-dot, .wh-chip-dot { animation: none; }
}
