/* My IP. The base (colours, top bar, buttons, footer) follows the other tools of the site. */
:root {
  --bg: #f5f8fd;
  --surface: #ffffff;
  --surface-alt: #eef4fb;
  --text: #272829;
  --text-muted: #5f6d7c;
  --heading: #173b6c;
  --accent: #149ddd;
  --link: #0c6fa3; /* accent as text colour: 4.8:1 and better on the light backgrounds */
  --accent-hover: #37b3ed;
  --accent-soft: #e4f3fb;
  --border: #dde6f0;
  --shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
  --success: #23804a;
  --success-soft: #e3f4ea;
  --danger: #c0392b;
  --danger-soft: #fbe9e7;
  --warn: #9a6400;
  --warn-soft: #fdf3dc;
  --eve: #7b3fa8;
  --eve-soft: #f3eafa;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* field colours of the byte view */
  --f0: #d6e9fb;
  --f1: #d9f2df;
  --f2: #fbecc6;
  --f3: #f9dbe9;
  --f4: #e5defa;
  --f5: #cdeff2;
  --f-len: #eceff3;
  --f-type: #dfe4ea;
  --sel: #173b6c;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1320;
  --surface: #101b2c;
  --surface-alt: #16263d;
  --text: #c9d1d9;
  --text-muted: #93a1b1;
  --heading: #e6edf3;
  --accent: #37b3ed;
  --link: #37b3ed;
  --accent-hover: #6cc8f2;
  --accent-soft: #16263d;
  --border: #1f3350;
  --shadow: 0 2px 15px rgba(0, 0, 0, 0.4);
  --success: #4cc685;
  --success-soft: #12301f;
  --danger: #ff7b6b;
  --danger-soft: #3a1714;
  --warn: #f0b84a;
  --warn-soft: #33270c;
  --eve: #c79bf0;
  --eve-soft: #281a38;
  --f0: #1d3a5c;
  --f1: #1b4029;
  --f2: #4a3a12;
  --f3: #4b1f36;
  --f4: #312757;
  --f5: #12454a;
  --f-len: #1c2838;
  --f-type: #263549;
  --sel: #e6edf3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Open Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

a {
  color: var(--link);
  text-decoration: none;
}

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

code,
.mono {
  font-family: var(--mono);
  font-size: 0.92em;
}

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

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

[hidden] {
  display: none !important;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #040b14;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.back-link,
.lang-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  color: #fff;
}

.back-link:hover,
.lang-link:hover {
  color: #37b3ed;
}

.theme-toggle {
  border: 0;
  font-size: 18px;
  background-color: #149ddd;
  color: #fff;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50px;
  cursor: pointer;
}

.theme-toggle:hover {
  background-color: #2eafec;
}

.theme-toggle .bi-sun,
[data-theme="dark"] .theme-toggle .bi-moon-stars {
  display: none;
}

[data-theme="dark"] .theme-toggle .bi-sun {
  display: inline;
}

/* ---------- layout ---------- */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px;
}

.page-title {
  text-align: center;
  padding: 40px 0 20px;
}

.page-title h1 {
  font-family: "Raleway", sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--heading);
  margin: 0 0 20px;
  padding-bottom: 20px;
  position: relative;
}

.page-title h1::after {
  content: "";
  position: absolute;
  width: 50px;
  height: 3px;
  background: var(--accent);
  bottom: 0;
  left: calc(50% - 25px);
}

.page-title p {
  margin: 0 auto 8px;
  max-width: 760px;
}

.page-title .privacy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-muted);
}

h2,
h3,
h4 {
  font-family: "Raleway", sans-serif;
  color: var(--heading);
}

/* ---------- buttons and controls ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 50px;
  padding: 9px 20px;
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
  white-space: nowrap;
  min-height: 40px;
}

.btn-primary {
  background: #0e75a8;
  color: #fff;
}

.btn-primary:hover {
  background: #149ddd;
}

.btn-secondary {
  background: var(--accent-soft);
  color: #0f6f9e;
}

.btn-secondary:hover {
  background: var(--border);
}

[data-theme="dark"] .btn-secondary {
  background: #1f3350;
  color: #e6edf3;
}

[data-theme="dark"] .btn-secondary:hover {
  background: #2a4468;
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn.busy {
  cursor: wait;
}

.btn-small {
  min-height: 32px;
  padding: 4px 12px;
  font-size: 14px;
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
}

.seg {
  display: inline-flex;
  flex-wrap: wrap;
  padding: 3px;
  border-radius: 22px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  gap: 2px;
}

.seg button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  font-size: 14px;
  padding: 6px 14px;
  border-radius: 50px;
  cursor: pointer;
  min-height: 34px;
}

.seg button[aria-pressed="true"] {
  background: #0e75a8;
  color: #fff;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  min-height: 40px;
}

input.mono {
  font-family: var(--mono);
  font-size: 14px;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 157, 221, 0.2);
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #127fb3;
  flex: none;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.hint {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.form-error {
  color: var(--danger);
  font-weight: 600;
  margin: 8px 0 0;
}

.form-error:empty {
  display: none;
}

.center {
  text-align: center;
}

.muted {
  color: var(--text-muted);
}

.banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  border-radius: 8px;
  margin: 0 0 14px;
}

.banner > .bi {
  font-size: 18px;
  line-height: 1.4;
}

.banner.ok {
  background: var(--success-soft);
  color: var(--success);
}

.banner.bad {
  background: var(--danger-soft);
  color: var(--danger);
}

.banner.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.banner.info {
  background: var(--accent-soft);
}

.banner.eve {
  background: var(--eve-soft);
  color: var(--eve);
  border: 0;
}

.banner div {
  color: var(--text);
}

.info {
  margin: 40px 0 24px;
  max-width: 860px;
}

.info h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 24px 0 10px;
}

/* ---------- footer ---------- */
.footer {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  padding: 0 16px 32px;
}

.more-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
  margin-bottom: 8px;
}

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin: 0 0 16px;
  min-width: 0;
}

.card h2 {
  font-size: 18px;
  margin: 0 0 10px;
}

.card h3 {
  font-size: 15px;
  margin: 16px 0 6px;
}

/* ---------- the address ---------- */
.ip-card {
  text-align: center;
  padding: 24px 18px;
}

.ip-card .ip-title {
  font-family: "Poppins", sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  margin: 0;
}

.ip-value {
  font-size: 44px;
  font-weight: 600;
  color: var(--heading);
  margin: 6px 0 10px;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.ip-value.long {
  font-size: 28px;
}

.ip-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 16px;
}

.ip-meta .banner {
  text-align: left;
}

.badge {
  font-family: "Poppins", sans-serif;
  font-size: 13px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--link);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 10px;
}

.hostname {
  overflow-wrap: anywhere;
}

#curl {
  margin-top: 14px;
}

#curl code {
  background: var(--surface-alt);
  padding: 2px 6px;
  border-radius: 4px;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 16px;
  margin: 0;
  font-size: 15px;
}

.facts dt {
  font-weight: 600;
  color: var(--heading);
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.ua-string {
  background: var(--surface-alt);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  overflow-wrap: anywhere;
  margin: 0 0 8px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
}

tbody th {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--heading);
  white-space: nowrap;
}

tbody td {
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

@media (max-width: 800px) {
  .two-col {
    grid-template-columns: minmax(0, 1fr);
  }

  .ip-value {
    font-size: 32px;
  }

  .ip-value.long {
    font-size: 20px;
  }

  tbody th {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
