:root {
  color-scheme: light;

  /* Brand tokens — mode-agnostic */
  --accent: #c84f2a;
  --accent-soft: #f0b86a;
  --sage: #596b56;
  --charcoal: #171612;

  /* Surfaces & text — light mode */
  --background: #f2f0ea;
  --surface: #ffffff;
  --surface-muted: #ebe7df;
  --ink: #14120f;
  --ink-soft: #5c574f;
  --ink-muted: #827b6f;
  --line: #ddd6ca;
  --line-strong: #b9afa0;
  --shadow: 0 26px 80px rgba(36, 28, 18, 0.16);

  /* Panel / card backgrounds (the rgba versions used to be hardcoded) */
  --panel-bg: rgba(255, 255, 255, 0.86);
  --panel-bg-strong: rgba(255, 255, 255, 0.94);
  --panel-grad-1: rgba(255, 255, 255, 0.98);
  --panel-grad-2: rgba(249, 247, 242, 0.94);
  --header-bg: rgba(242, 240, 234, 0.82);

  /* Body background overlays */
  --body-overlay-1: rgba(255, 255, 255, 0.9);
  --body-overlay-2: rgba(242, 240, 234, 0.66);
  --body-stripe: rgba(20, 18, 15, 0.035);
  --brand-wash: rgba(200, 79, 42, 0.18);
}

[data-theme="dark"] {
  color-scheme: dark;

  --background: #0d0d0f;
  --surface: #18181b;
  --surface-muted: #1f1f23;
  --ink: #f5f5f7;
  --ink-soft: #c8c9cf;
  --ink-muted: #898a90;
  --line: #2a2a30;
  --line-strong: #3c3c44;
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.55);

  --panel-bg: rgba(28, 28, 32, 0.78);
  --panel-bg-strong: rgba(34, 34, 38, 0.92);
  --panel-grad-1: rgba(34, 34, 38, 0.98);
  --panel-grad-2: rgba(28, 28, 32, 0.94);
  --header-bg: rgba(13, 13, 15, 0.86);

  --body-overlay-1: rgba(13, 13, 15, 0.62);
  --body-overlay-2: rgba(13, 13, 15, 0.32);
  --body-stripe: rgba(255, 255, 255, 0.025);
  --brand-wash: rgba(200, 79, 42, 0.06);
}

* {
  box-sizing: border-box;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 16px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--charcoal);
  color: #fff7ec;
  font-weight: 700;
  text-decoration: none;
  border-radius: 6px;
  transition: top 160ms ease;
}

.skip-link:focus {
  top: 16px;
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.button:focus-visible {
  outline-color: var(--accent-soft);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(120deg, var(--body-overlay-1), var(--body-overlay-2)),
    repeating-linear-gradient(
      135deg,
      var(--body-stripe) 0,
      var(--body-stripe) 1px,
      transparent 1px,
      transparent 18px
    ),
    linear-gradient(145deg, var(--brand-wash), transparent 42%),
    var(--background);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button {
  font: inherit;
}

.page-shell {
  width: min(1280px, calc(100% - 48px));
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  padding: 42px 0 24px;
}

.ip-panel {
  border: 1px solid var(--line);
  background: var(--panel-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.ip-panel {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  padding: clamp(24px, 4vw, 48px);
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}

@media (min-width: 880px) {
  .ip-panel {
    grid-template-columns: 1.05fr 1fr;
    grid-template-areas:
      "hero hero"
      "ip   client";
    column-gap: 36px;
    row-gap: 32px;
    align-items: stretch;
  }
  .ip-panel > .hero-copy { grid-area: hero; }
  .ip-panel > .ip-card { grid-area: ip; display: flex; flex-direction: column; }
  .ip-panel > .client-card { grid-area: client; }
  .ip-card > .ip-card-content { flex: 1; display: flex; flex-direction: column; }
  .ip-card > .ip-card-content > .hero-chips { margin-top: auto; }
}

.ip-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft), var(--sage));
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border: 1px solid var(--charcoal);
  background:
    linear-gradient(145deg, var(--charcoal), #2a221b);
  color: var(--surface);
  display: inline-grid;
  place-items: center;
  font-size: 0.78rem;
  letter-spacing: 0;
}

.brand-mark-img {
  width: 96px;
  height: 96px;
  border: none;
  background: none;
  padding: 0;
  object-fit: contain;
  border-radius: 6px;
}

.status-pill {
  border: 1px solid rgba(20, 18, 15, 0.12);
  background: rgba(235, 231, 223, 0.78);
  color: var(--ink-soft);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-pill.ready {
  border-color: rgba(89, 107, 86, 0.34);
  background: #e4ebde;
  color: #2d472f;
}

.status-pill.ready::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 999px;
  background: #3f8d45;
  display: inline-block;
  box-shadow: 0 0 0 4px rgba(63, 141, 69, 0.12);
}

.status-pill {
  display: inline-flex;
  align-items: center;
}

.status-pill.error {
  border-color: #9f4e40;
  background: #fae8e1;
  color: #7d2c1f;
}

.status-pill.error::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 999px;
  background: #b44835;
  display: inline-block;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 760px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.3rem, 3.35vw, 2.8rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.ip-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 36%),
    linear-gradient(155deg, #181612, #2d241c 58%, #62331f);
  padding: clamp(20px, 4vw, 34px);
  color: #fff7ec;
  box-shadow: 0 28px 70px rgba(20, 18, 15, 0.22);
}

.ip-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 22px,
      rgba(255, 255, 255, 0.035) 22px,
      rgba(255, 255, 255, 0.035) 23px
    );
  pointer-events: none;
}

.ip-card-content {
  position: relative;
  z-index: 1;
}

.client-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-grad-1), var(--panel-grad-2));
  padding: clamp(18px, 3vw, 28px);
  box-shadow: 0 18px 42px rgba(36, 28, 18, 0.08);
}

.client-card-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.client-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.5rem, 3vw, 2.3rem);
  line-height: 1.1;
}

.client-card .eyebrow {
  margin-bottom: 0;
}

.client-details {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 22px 0 0;
}

.client-details div {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding: 14px 0;
  display: grid;
  grid-template-columns: minmax(120px, 0.38fr) minmax(0, 1fr);
  gap: 18px;
  align-items: baseline;
  transition: border-color 160ms ease;
}

.client-details div:hover {
  border-color: rgba(200, 79, 42, 0.3);
}

.client-details dt {
  color: var(--ink-muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.client-details dd {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

#name-address,
#ipv4-address,
#ipv6-address,
#ip-asn {
  color: var(--accent);
  font-weight: 700;
}

.client-note {
  border-top: 1px solid var(--line);
  margin: 0;
  padding-top: 14px;
  color: var(--ink-soft);
  font-size: 0.94rem;
  line-height: 1.5;
}

.ip-label {
  color: rgba(255, 247, 236, 0.66);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.ip-address {
  margin-top: 12px;
  color: #fff7ec;
  font-size: clamp(2rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.ip-address.loading {
  color: rgba(255, 247, 236, 0.62);
}

.ip-note {
  max-width: 560px;
  margin: 16px 0 0;
  color: rgba(255, 247, 236, 0.72);
  line-height: 1.6;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button {
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 800;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.primary {
  background: #fff7ec;
  color: var(--charcoal);
}

.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff7ec;
}

.bottom-ad {
  width: min(1280px, calc(100% - 48px));
  min-height: 90px;
  margin: 0 auto 24px;
}

.text-page {
  min-height: auto;
}

.legal-copy {
  display: grid;
  gap: 10px;
}

.legal-copy h1 {
  font-size: clamp(2.7rem, 7vw, 5.8rem);
}

.legal-copy h2 {
  margin: 24px 0 0;
  color: var(--ink);
  font-size: clamp(1.25rem, 2.4vw, 1.75rem);
  line-height: 1.18;
}

.legal-copy p {
  max-width: 780px;
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.68;
}

.site-footer {
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
  padding: 24px 0;
  color: var(--ink-muted);
  font-size: 0.88rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid var(--line);
  margin-top: 36px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-links a {
  color: var(--ink-soft);
  font-weight: 700;
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--accent);
}

.tool-page .ip-panel {
  min-height: auto;
  gap: 28px;
}

.tool-intro {
  display: grid;
  gap: 8px;
  max-width: 760px;
}

.tool-intro p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.tool-form {
  display: grid;
  gap: 14px;
}

.tool-form label {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.tool-form .field-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.tool-form input[type="text"],
.tool-form input[type="search"],
.tool-form select,
.tool-form textarea {
  min-height: 46px;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 14px;
  font: inherit;
  background: var(--panel-bg-strong);
  color: var(--ink);
}

.tool-form textarea {
  min-height: 140px;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.5;
  resize: vertical;
}

.tool-form input:focus,
.tool-form select:focus,
.tool-form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tool-form .button.primary {
  background: var(--charcoal);
  color: #fff7ec;
  border-color: var(--charcoal);
}

.tool-form .button.primary:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.tool-result {
  display: grid;
  gap: 18px;
}

.tool-result[hidden] {
  display: none;
}

.tool-status {
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink-muted);
  border-radius: 6px;
  background: var(--panel-bg);
  padding: 12px 14px;
  color: var(--ink-soft);
  font-size: 0.94rem;
  line-height: 1.5;
}

.tool-status.error {
  border-left-color: #b44835;
  color: #7d2c1f;
  background: #fae8e1;
}

.tool-status.ok {
  border-left-color: #3f8d45;
  color: #2d472f;
  background: #e4ebde;
}

.tool-status.warn {
  border-left-color: #c9881e;
  color: #7a5413;
  background: #fbf0d9;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-grad-1), var(--panel-grad-2));
  padding: clamp(18px, 3vw, 24px);
  box-shadow: 0 18px 42px rgba(36, 28, 18, 0.08);
}

.result-card h3 {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: clamp(1.1rem, 2.4vw, 1.3rem);
}

.kv-grid {
  display: grid;
  grid-template-columns: 1fr;
  margin: 0;
}

.kv-grid div {
  border-top: 1px solid var(--line);
  padding: 10px 0;
  display: grid;
  grid-template-columns: minmax(140px, 0.4fr) minmax(0, 1fr);
  gap: 16px;
  align-items: baseline;
}

.kv-grid div:first-child {
  border-top: none;
  padding-top: 0;
}

.kv-grid dt {
  color: var(--ink-muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.kv-grid dd {
  margin: 0;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.kv-grid dd.plain {
  font-family: inherit;
}

.record-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.record-table th,
.record-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.record-table th {
  color: var(--ink-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.record-table td.mono,
.record-table th.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.code-block {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #18181b;
  color: #f5f5f7;
  padding: 14px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

[data-theme="dark"] .code-block {
  background: #232328;
  border-color: #2a2a30;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.tool-grid a {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-bg-strong);
  padding: 16px 18px;
  color: var(--ink);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.tool-grid a:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 16px 32px rgba(36, 28, 18, 0.1);
}

.tool-grid a strong {
  font-size: 1rem;
  color: var(--ink);
}

.tool-grid a span {
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.45;
}

.tool-grid .group-heading {
  grid-column: 1 / -1;
  margin: 18px 0 -4px;
  color: var(--ink-muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tag-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(200, 79, 42, 0.12);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  vertical-align: middle;
}

.tag-badge.muted {
  background: rgba(20, 18, 15, 0.08);
  color: var(--ink-muted);
}

.tools-section {
  width: min(1280px, calc(100% - 48px));
  margin: 32px auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 740px) {
  .tools-section { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}

@media (min-width: 1120px) {
  .tools-section { grid-template-columns: repeat(3, 1fr); gap: 18px; }
}

.tools-section .section-head {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: end;
  padding: 4px 4px 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}

@media (min-width: 860px) {
  .tools-section .section-head {
    grid-template-columns: 1fr 360px;
    gap: 32px;
  }
}

.tools-section .section-head-text {
  display: grid;
  gap: 6px;
  max-width: 720px;
}

.tools-section .section-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.55rem, 3vw, 2.25rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.tools-section .section-head p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.tools-section .section-head-actions {
  display: grid;
  gap: 10px;
}

.tools-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tools-controls button {
  border: 1px solid var(--line-strong);
  background: var(--panel-bg);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease;
}

.tools-controls button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tools-filter-empty {
  grid-column: 1 / -1;
}

.tool-group-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0 0;
  color: var(--ink-muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.tool-group-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line) 0%, transparent 100%);
}

.tool-group-heading:first-of-type {
  margin-top: 4px;
}

.tool-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-bg-strong);
  overflow: hidden;
  transition: border-color 200ms ease, transform 200ms ease, background 200ms ease;
  display: flex;
  flex-direction: column;
}

.tool-card:hover {
  border-color: rgba(200, 79, 42, 0.45);
  transform: translateY(-1px);
}

.tool-card[open] {
  grid-column: 1 / -1;
  border-color: rgba(200, 79, 42, 0.55);
  background: var(--panel-grad-1);
  transform: none;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18);
}

.tool-card[open]::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  pointer-events: none;
}

.tool-card[data-featured="1"] {
  grid-column: 1 / -1;
  background:
    radial-gradient(circle at 0% 0%, rgba(200, 79, 42, 0.12), transparent 55%),
    var(--panel-grad-1);
  border-color: rgba(200, 79, 42, 0.35);
}

.tool-card[data-featured="1"]::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(200, 79, 42, 0.6), transparent 40%, transparent 60%, rgba(240, 184, 106, 0.45));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.7;
}

.tool-card[data-featured="1"] > summary .tool-title strong {
  font-size: 1.05rem;
}

.tool-card[data-featured="1"] > summary .tool-icon {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.tool-card > summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  user-select: none;
  flex: 1;
}

.tool-card > summary::-webkit-details-marker {
  display: none;
}

.tool-card > summary:hover {
  background: rgba(200, 79, 42, 0.04);
}

.tool-card > summary .tool-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.tool-card > summary .tool-title strong {
  color: var(--ink);
  font-size: 0.96rem;
  line-height: 1.25;
  letter-spacing: -0.005em;
}

.tool-card > summary .tool-title span {
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tool-card[open] > summary .tool-title span {
  -webkit-line-clamp: unset;
  overflow: visible;
}

.tool-card > summary .tool-toggle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-soft);
  display: inline-grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: transform 200ms ease, background 200ms ease, color 200ms ease, border-color 200ms ease;
}

.tool-card:hover > summary .tool-toggle {
  border-color: var(--accent);
  color: var(--accent);
}

.tool-card[open] > summary .tool-toggle {
  background: var(--accent);
  color: #fff7ec;
  border-color: var(--accent);
  transform: rotate(45deg);
}

.tool-card-body {
  padding: 4px 20px 22px;
  display: grid;
  gap: 18px;
  border-top: 1px solid var(--line);
}

.tool-card-body .tool-form {
  margin-top: 14px;
}

/* When a featured/open card spans 3 cols, give the body a constrained inner width
   so very wide single-line inputs don't stretch awkwardly */
@media (min-width: 1120px) {
  .tool-card[open] .tool-card-body,
  .tool-card[data-featured="1"] .tool-card-body {
    grid-template-columns: minmax(0, 1fr);
  }
  .tool-card[open] .tool-card-body > .tool-form,
  .tool-card[open] .tool-card-body > .tool-result,
  .tool-card[data-featured="1"] .tool-card-body > .tool-form,
  .tool-card[data-featured="1"] .tool-card-body > .tool-result {
    max-width: 1100px;
  }
}

@media (max-width: 560px) {
  .tool-card > summary {
    padding: 14px 16px;
  }

  .tool-card-body {
    padding: 4px 16px 18px;
  }
}

@media (max-width: 860px) {
  .page-shell {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 24px;
  }
}

@media (max-width: 560px) {
  .tool-form .field-row {
    grid-template-columns: 1fr;
  }

  .kv-grid div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 560px) {
  .page-shell,
  .bottom-ad,
  .site-footer,
  .tools-section {
    width: min(100% - 20px, 1280px);
  }

  .brand-row,
  .actions {
    align-items: stretch;
  }

  .brand-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .client-card-header {
    display: grid;
  }

  .client-details div {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .button {
    width: 100%;
  }
}


/* ---------- Top navigation header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.header-inner {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 12px 0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.site-header .brand {
  flex-shrink: 0;
}

.site-header .brand .brand-mark-img {
  width: 32px;
  height: 32px;
}

.primary-nav {
  margin-left: auto;
  position: relative;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 4px;
  align-items: center;
}

.nav-list a {
  display: inline-block;
  color: var(--ink-soft);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.92rem;
  padding: 8px 12px;
  border-radius: 6px;
  transition: color 160ms ease, background 160ms ease;
}

.nav-list a:hover,
.nav-list a:focus-visible {
  color: var(--accent);
  background: rgba(200, 79, 42, 0.08);
}

.nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-strong);
  background: var(--panel-bg-strong);
  color: var(--ink);
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  align-items: center;
  justify-content: center;
}

.nav-toggle .nav-burger,
.nav-toggle .nav-burger::before,
.nav-toggle .nav-burger::after {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 160ms ease, opacity 160ms ease;
}

.nav-toggle .nav-burger {
  position: relative;
}

.nav-toggle .nav-burger::before,
.nav-toggle .nav-burger::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle .nav-burger::before { top: -6px; }
.nav-toggle .nav-burger::after  { top: 6px; }

.nav-toggle[aria-expanded="true"] .nav-burger {
  background: transparent;
}
.nav-toggle[aria-expanded="true"] .nav-burger::before {
  top: 0;
  transform: rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-burger::after {
  top: 0;
  transform: rotate(-45deg);
}

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

.theme-toggle {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  background: var(--panel-bg-strong);
  color: var(--ink);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  transition: border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.theme-toggle .theme-icon {
  display: none;
}

[data-theme-pref="auto"]  .theme-toggle [data-icon="auto"]  { display: inline; }
[data-theme-pref="light"] .theme-toggle [data-icon="light"] { display: inline; }
[data-theme-pref="dark"]  .theme-toggle [data-icon="dark"]  { display: inline; }

@media (max-width: 720px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav-list {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--panel-bg-strong);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    min-width: 220px;
    box-shadow: var(--shadow);
    transform: scale(0.96) translateY(-6px);
    opacity: 0;
    pointer-events: none;
    transition: transform 160ms ease, opacity 160ms ease;
    z-index: 60;
  }

  .nav-list.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-list a {
    display: block;
    padding: 10px 12px;
  }

  .header-inner {
    padding: 10px 0;
  }
}

/* ---------- Dark mode tweaks for hardcoded color states ---------- */

[data-theme="dark"] .status-pill {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-soft);
}

[data-theme="dark"] .status-pill.ready {
  border-color: rgba(143, 197, 130, 0.4);
  background: rgba(63, 141, 69, 0.18);
  color: #c4e4c0;
}

[data-theme="dark"] .status-pill.error {
  border-color: rgba(180, 72, 53, 0.55);
  background: rgba(180, 72, 53, 0.22);
  color: #f7c9bd;
}

[data-theme="dark"] .tool-status.error {
  background: rgba(180, 72, 53, 0.18);
  color: #f7c9bd;
}

[data-theme="dark"] .tool-status.ok {
  background: rgba(63, 141, 69, 0.18);
  color: #c4e4c0;
}

[data-theme="dark"] .tool-status.warn {
  background: rgba(201, 136, 30, 0.18);
  color: #f3d599;
}

[data-theme="dark"] .nav-list a:hover,
[data-theme="dark"] .nav-list a:focus-visible {
  background: rgba(232, 122, 82, 0.12);
}

/* ---------- Hero additions: country flag + CTA chips ---------- */

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.ip-label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.country-flag {
  width: 22px;
  height: 16px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
  vertical-align: middle;
  object-fit: cover;
  flex-shrink: 0;
}

.country-name {
  color: rgba(255, 247, 236, 0.66);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.hero-chips-label {
  color: rgba(255, 247, 236, 0.62);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 4px;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #fff7ec;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.hero-chip:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.32);
  transform: translateY(-1px);
}

/* ---------- Tools filter ---------- */

.tools-filter {
  position: relative;
  margin-top: 12px;
}

.tools-filter input[type="search"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 14px 0 38px;
  font: inherit;
  background:
    var(--panel-bg-strong)
    url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23827b6f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.5' y2='16.5'/%3E%3C/svg%3E")
    no-repeat 12px center / 16px;
  color: var(--ink);
}

.tools-filter input[type="search"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tools-filter-empty {
  display: block;
  margin-top: 8px;
  color: var(--ink-muted);
  font-size: 0.88rem;
}

.tool-card[hidden] {
  display: none;
}

.tool-group-heading[hidden] {
  display: none;
}

/* ---------- Tool icon in summary ---------- */

.tool-card > summary {
  grid-template-columns: 22px 1fr auto;
}

.tool-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--ink-soft);
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-card[open] > summary .tool-icon {
  color: var(--accent);
}

@media (max-width: 480px) {
  .tool-card > summary {
    grid-template-columns: 20px 1fr auto;
    gap: 10px;
  }
  .tool-icon { width: 20px; height: 20px; }
}

/* ---------- Tool source / trust signal ---------- */

.tool-source {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--line-strong);
  background: var(--surface-muted);
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.5;
  border-radius: 0 6px 6px 0;
}

.tool-source a {
  color: var(--accent);
}

/* ---------- Chip group (DNS record types, encoder modes) ---------- */

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-group .chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.chip-group .chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip-group .chip span {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  background: var(--panel-bg);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.chip-group .chip:hover span {
  border-color: var(--accent);
  color: var(--accent);
}

.chip-group .chip input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff7ec;
}

.chip-group .chip input:focus-visible + span {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
}

/* ---------- Result actions row ---------- */

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.result-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  background: var(--panel-bg);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.result-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.result-action-btn[data-copy-state="copied"] {
  border-color: #3f8d45;
  color: #2d472f;
  background: #e4ebde;
}

[data-theme="dark"] .result-action-btn[data-copy-state="copied"] {
  background: rgba(63, 141, 69, 0.18);
  color: #c4e4c0;
}

/* Per-field copy: hover affordance on dd */

.kv-grid dd[data-copyable] {
  cursor: copy;
  transition: color 160ms ease;
}

.kv-grid dd[data-copyable]:hover {
  color: var(--accent);
}

.kv-grid dd[data-copy-state="copied"] {
  color: #3f8d45;
}

[data-theme="dark"] .kv-grid dd[data-copy-state="copied"] {
  color: #8fc582;
}

/* ---------- Mobile: hide expand-all (still keep collapse-all) ---------- */

@media (max-width: 720px) {
  .tools-controls [data-expand-all] {
    display: none;
  }
}

/* ---------- Email header analyzer + encoder textareas: monospace input ---------- */

.tool-form textarea[data-input] {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- Dark-mode neutralization of brand-warm surfaces ----------
   In light mode the IP-card hero and its text intentionally stay warm to
   carry the brand. In dark-mode (neutral graphite chrome), the warm brown
   hero card fights the rest of the palette, so we re-tint it to match. */

[data-theme="dark"] .ip-card {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 36%),
    linear-gradient(155deg, #0e0e10, #1a1a22 58%, #26262e);
  color: #f5f5f7;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .ip-card .ip-label,
[data-theme="dark"] .ip-card .country-name {
  color: rgba(245, 245, 247, 0.66);
}

[data-theme="dark"] .ip-card .ip-address {
  color: #f5f5f7;
}

[data-theme="dark"] .ip-card .ip-address.loading {
  color: rgba(245, 245, 247, 0.55);
}

[data-theme="dark"] .ip-card .ip-note,
[data-theme="dark"] .ip-card .hero-chips-label {
  color: rgba(245, 245, 247, 0.7);
}

[data-theme="dark"] .ip-card .primary {
  background: #f5f5f7;
  color: #0d0d0f;
}

[data-theme="dark"] .ip-card .secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #f5f5f7;
  border-color: rgba(255, 255, 255, 0.18);
}

[data-theme="dark"] .ip-card .hero-chip {
  background: rgba(255, 255, 255, 0.06);
  color: #f5f5f7;
  border-color: rgba(255, 255, 255, 0.16);
}

[data-theme="dark"] .ip-card .hero-chip:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.32);
}

/* Top stripe on the hero panel: dim the brand accent in dark mode so the
   neutral chrome dominates. Stripe still reads as a thin accent. */

[data-theme="dark"] .ip-panel::before {
  background: linear-gradient(90deg, rgba(200, 79, 42, 0.7), rgba(240, 184, 106, 0.55), rgba(89, 107, 86, 0.5));
  opacity: 0.6;
}

/* Featured tool card: in dark mode, soften the orange radial glow so it
   reads as an elevation hint rather than a brand wash. */

[data-theme="dark"] .tool-card[data-featured="1"] {
  background:
    radial-gradient(circle at 0% 0%, rgba(200, 79, 42, 0.08), transparent 55%),
    var(--panel-grad-1);
  border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .tool-card[data-featured="1"] > summary .tool-icon {
  color: var(--accent-soft);
}
