/* ===== Tela cheia: esquema de cores do zapBot (OKLCH claro/escuro dirigido por --brand-h/--brand-c),
   arredondamento configurável de botões e caixas, e botão flutuante de tema no canto superior
   direito. Tudo em html:not(.embed): o compacto (embed) segue só com claro/escuro, como antes. ===== */
html:not(.embed) {
  --brand-h: 255;
  --brand-c: 0.17;
  --radius-button-level: 0.75rem;
  --radius-card-level: 1rem;
  --zs-bg: oklch(0.99 0.004 var(--brand-h));
  --zs-surface: oklch(1 0 0);
  --zs-surface-muted: oklch(0.97 0.006 var(--brand-h));
  --zs-border: oklch(0.9 0.01 var(--brand-h));
  --zs-text: oklch(0.22 0.015 var(--brand-h));
  --zs-text-muted: oklch(0.5 0.02 var(--brand-h));
  --zs-primary: oklch(0.54 var(--brand-c) var(--brand-h));
  --zs-primary-hover: oklch(0.47 var(--brand-c) var(--brand-h));
  --zs-primary-subtle: oklch(0.95 0.04 var(--brand-h));
  --zs-on-primary: oklch(0.99 0 0);
  /* mapeia nas variáveis que as páginas já usam */
  --bg: var(--zs-bg);
  --fg: var(--zs-text);
  --card-bg: var(--zs-surface);
  --accent: var(--zs-primary);
  --muted: var(--zs-text-muted);
  --muted-border: var(--zs-border);
  --chart-bg: var(--zs-surface);
  --chart-border: var(--zs-border);
  --disabled-fg: var(--zs-text-muted);
  --disabled-border: var(--zs-border);
}
html:not(.embed)[data-theme="dark"] {
  color-scheme: dark;
  --zs-bg: oklch(0.17 0.012 var(--brand-h));
  --zs-surface: oklch(0.21 0.014 var(--brand-h));
  --zs-surface-muted: oklch(0.25 0.014 var(--brand-h));
  --zs-border: oklch(0.31 0.016 var(--brand-h));
  --zs-text: oklch(0.94 0.008 var(--brand-h));
  --zs-text-muted: oklch(0.72 0.02 var(--brand-h));
  --zs-primary: oklch(0.62 var(--brand-c) var(--brand-h));
  --zs-primary-hover: oklch(0.68 var(--brand-c) var(--brand-h));
  --zs-primary-subtle: oklch(0.3 0.06 var(--brand-h));
  /* repete o mapeamento: as regras escuras antigas da página (:root[data-theme="dark"]) têm mais
     especificidade que o mapeamento do bloco claro e o sobrescreveriam com cinzas neutros */
  --bg: var(--zs-bg);
  --fg: var(--zs-text);
  --card-bg: var(--zs-surface);
  --accent: var(--zs-primary);
  --muted: var(--zs-text-muted);
  --muted-border: var(--zs-border);
  --chart-bg: var(--zs-surface);
  --chart-border: var(--zs-border);
  --disabled-fg: var(--zs-text-muted);
  --disabled-border: var(--zs-border);
}
html:not(.embed) #startStopBtn,
html:not(.embed) #startBtn,
html:not(.embed) #resetBtn,
html:not(.embed) #durationSelect,
html:not(.embed) #downloadCsvBtn,
html:not(.embed) .history-csv-btn,
html:not(.embed) .history-clear,
html:not(.embed) .accordion-share-copy {
  border-radius: var(--radius-button-level);
}
html:not(.embed) .ipcard,
html:not(.embed) .accordion,
html:not(.embed) #pingChart,
html:not(.embed) #uplotHost,
html:not(.embed) .accordion-share-img {
  border-radius: var(--radius-card-level);
}
html:not(.embed) .accordion-header:hover {
  background: var(--zs-primary-subtle);
}
html:not(.embed) body {
  background:
    radial-gradient(60rem 30rem at 50% -10%, color-mix(in oklch, var(--zs-primary) 16%, transparent), transparent 70%),
    var(--bg);
}
html:not(.embed) .accordion-share-url {
  background: var(--zs-surface-muted);
  color: var(--zs-text);
  border: 1px solid var(--zs-border);
  border-radius: var(--radius-button-level);
}
html:not(.embed) input[type="range"] {
  accent-color: var(--zs-primary);
}
.zs-chartstyles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.zs-chartstyle {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--zs-border);
  border-radius: var(--radius-button-level);
  background: var(--zs-surface-muted);
  color: var(--zs-text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.zs-chartstyle[aria-checked="true"] {
  border-color: transparent;
  background: var(--zs-primary);
  color: var(--zs-on-primary);
}
.zs-chartstyle:focus-visible {
  outline: 2px solid var(--zs-primary);
  outline-offset: 2px;
}
.zs-fab {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  font-size: 14px;
  font-weight: 400;
  text-align: left;
}
.zs-fab-btn {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--zs-border);
  border-radius: 9999px;
  background: var(--zs-surface);
  color: var(--zs-text);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.zs-fab-btn:hover,
.zs-fab-btn[aria-expanded="true"] {
  border-color: var(--zs-primary);
  color: var(--zs-primary);
}
.zs-fab-btn:focus-visible,
.zs-mode:focus-visible,
.zs-swatch:focus-visible,
.zs-radius:focus-visible,
.zs-more:focus-visible {
  outline: 2px solid var(--zs-primary);
  outline-offset: 2px;
}
.zs-pop {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 18rem;
  max-width: calc(100vw - 2rem);
  box-sizing: border-box;
  padding: 1rem;
  border: 1px solid var(--zs-border);
  border-radius: var(--radius-card-level);
  background: var(--zs-surface);
  color: var(--zs-text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.zs-pop[hidden] {
  display: none;
}
.zs-mode {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--zs-border);
  border-radius: var(--radius-button-level);
  background: none;
  color: var(--zs-text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.zs-mode small {
  color: var(--zs-text-muted);
  font-size: 12px;
  font-weight: 400;
}
.zs-title {
  margin: 0.9rem 0 0.4rem;
  color: var(--zs-text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.zs-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.zs-swatch {
  position: relative;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  cursor: pointer;
}
.zs-swatch[aria-checked="true"],
.zs-radius[aria-checked="true"] {
  box-shadow: 0 0 0 2px var(--zs-surface), 0 0 0 4px var(--zs-primary);
}
.zs-swatch[aria-checked="true"]::after {
  content: "\2713";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--zs-on-primary);
  font-size: 14px;
  font-weight: 700;
}
.zs-more {
  margin-top: 0.5rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--zs-primary);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.zs-radii {
  display: flex;
  gap: 6px;
}
.zs-radius {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid var(--zs-border);
  background: var(--zs-surface-muted);
  cursor: pointer;
}
