/* ── Toggle buttons: compact circles on mobile, pills on desktop ── */

[data-testid="readability-toggle"],
[data-testid="bandwidth-toggle"] {
  position: fixed !important;
  isolation: isolate;
  overflow: hidden !important;
  font-size: 16px !important;
}

/* ── Mobile: small circles stacked bottom-right ── */
@media (max-width: 768px) {
  [data-testid="readability-toggle"],
  [data-testid="bandwidth-toggle"] {
    left: auto !important;
    right: 12px !important;
    width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    max-width: 44px !important;
    padding: 0 !important;
    border-radius: 9999px !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: none !important;
  }

  [data-testid="readability-toggle"] {
    top: auto !important;
    bottom: 32px !important;
  }

  [data-testid="bandwidth-toggle"] {
    top: auto !important;
    bottom: 84px !important;
  }

  [data-testid="readability-toggle"] > div,
  [data-testid="bandwidth-toggle"] > div {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
  }

  [data-testid="readability-toggle"] > div > span:first-child,
  [data-testid="bandwidth-toggle"] > div > span:first-child {
    width: 100% !important;
    height: 100% !important;
    border-radius: 9999px !important;
    font-size: 0.85rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  [data-testid="readability-toggle"] > div > span:last-child,
  [data-testid="bandwidth-toggle"] > div > span:last-child {
    display: none !important;
  }
}

/* ── Desktop: small pills at bottom corners ── */
@media (min-width: 769px) {
  [data-testid="readability-toggle"],
  [data-testid="bandwidth-toggle"] {
    width: auto !important;
    max-width: 11rem !important;
    padding: 0.5rem 0.7rem !important;
    border-radius: 9999px !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22) !important;
  }

  [data-testid="readability-toggle"] {
    left: 1rem !important;
    bottom: 1rem !important;
  }

  [data-testid="bandwidth-toggle"] {
    right: 1rem !important;
    bottom: 1rem !important;
  }

  [data-testid="readability-toggle"] > div > span:first-child,
  [data-testid="bandwidth-toggle"] > div > span:first-child {
    width: 1.8rem !important;
    height: 1.8rem !important;
    border-radius: 9999px !important;
    font-size: 0.85rem !important;
  }

  [data-testid="readability-toggle"] > div > span:last-child > span:last-child,
  [data-testid="bandwidth-toggle"] > div > span:last-child > span:last-child {
    display: none !important;
  }

  [data-testid="readability-toggle"] > div > span:last-child > span:first-child,
  [data-testid="bandwidth-toggle"] > div > span:last-child > span:first-child {
    font-size: 0.72rem !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }
}

/* ── State indicator dot (inside circle, never clipped) ── */
[data-testid="readability-toggle"]::after,
[data-testid="bandwidth-toggle"]::after {
  content: "";
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  z-index: 2;
  pointer-events: none;
  transition: background-color 160ms ease, box-shadow 160ms ease;
}

/* Readability ON */
[data-testid="readability-toggle"][aria-pressed="true"] {
  border-color: rgba(96, 165, 250, 0.9) !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2), 0 10px 28px rgba(37, 99, 235, 0.25) !important;
}
[data-testid="readability-toggle"][aria-pressed="true"]::after {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

/* Readability OFF */
[data-testid="readability-toggle"][aria-pressed="false"] {
  border-color: rgba(148, 163, 184, 0.45) !important;
  opacity: 0.85;
}
[data-testid="readability-toggle"][aria-pressed="false"]::after {
  background: #64748b;
  box-shadow: none;
}

/* Bandwidth ON */
[data-testid="bandwidth-toggle"][aria-pressed="true"] {
  border-color: rgba(74, 222, 128, 0.9) !important;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2), 0 10px 28px rgba(22, 163, 74, 0.22) !important;
}
[data-testid="bandwidth-toggle"][aria-pressed="true"]::after {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

/* Bandwidth OFF */
[data-testid="bandwidth-toggle"][aria-pressed="false"] {
  border-color: rgba(148, 163, 184, 0.45) !important;
  opacity: 0.85;
}
[data-testid="bandwidth-toggle"][aria-pressed="false"]::after {
  background: #64748b;
  box-shadow: none;
}
