:root {
  --tb-bg: #ffffff;
  --tb-fg: #1f2933;
  --tb-muted: #6b7280;
  --tb-border: #e5e7eb;
  --tb-accent: #0d6efd;
  --tb-code-bg: #f6f8fa;
  --app-gradient: linear-gradient(135deg, #eff6ff 0%, #ffffff 40%, #f5f3ff 100%);
  --tb-hero-metric-bg: rgba(255, 255, 255, 0.75);
}

[data-bs-theme="dark"] {
  --tb-bg: #111418;
  --tb-fg: #e6edf3;
  --tb-muted: #9aa4b2;
  --tb-border: #2a3138;
  --tb-code-bg: #161b22;
  --app-gradient: linear-gradient(135deg, #161b22 0%, #111418 40%, #1a1626 100%);
  --tb-hero-metric-bg: rgba(255, 255, 255, 0.04);
}

body {
  color: var(--tb-fg);
  background-color: var(--tb-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

.site-footer {
  flex-shrink: 0;
  color: var(--tb-muted);
}

.font-monospace {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

pre, code {
  white-space: pre-wrap;
  word-break: break-word;
}

.card {
  border-color: var(--tb-border);
}

.hero-panel {
  background: var(--app-gradient);
  border: 1px solid var(--tb-border);
  box-shadow: 0 1rem 2.5rem rgba(15, 23, 42, 0.06);
}

.hero-metric {
  background: var(--tb-hero-metric-bg);
  border: 1px solid var(--tb-border);
}

.hero-ip-box {
  max-width: 100%;
}

.hero-ip-value {
  font-size: clamp(1.75rem, 2.5vw + 1rem, 3.25rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.hero-ip-value a {
  color: inherit;
}

.link-unstyled,
.link-unstyled:visited,
.link-unstyled:hover,
.link-unstyled:active {
  color: inherit;
  text-decoration: none;
}

.link-unstyled:hover {
  text-decoration: underline;
}

.small-detail-grid dt {
  font-weight: 600;
}

.raw-block {
  max-height: 24rem;
  overflow: auto;
  padding: 1rem;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 0.75rem;
}

.footer-attribution-list {
  display: grid;
  gap: 0.35rem;
  max-width: 42rem;
}

.footer-attribution-list a {
  color: inherit;
}

.site-footer {
  border-color: var(--tb-border) !important;
}

.result-table th {
  width: 28%;
  color: var(--tb-muted);
  font-weight: 600;
  vertical-align: top;
}

.result-table td {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-word;
}

.copyable {
  cursor: pointer;
}

.badge-open { background-color: #198754; }
.badge-closed { background-color: #dc3545; }
.badge-filtered { background-color: #fd7e14; }
.badge-unknown { background-color: #6c757d; }

.tool-card-grid > .col {
  margin-bottom: 1rem;
}

/* Finance calculator stat cards: keep large numbers from breaking layout */
.finance-calc .display-5,
.finance-calc .display-6 {
  font-size: clamp(1rem, 1.4vw + 0.5rem, 2rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Target only the colored result stat cards (not plain input/chart cards) */
.finance-calc .card.bg-primary,
.finance-calc .card.bg-success,
.finance-calc .card.bg-warning,
.finance-calc .card.bg-info,
.finance-calc .card.bg-secondary,
.finance-calc .card.bg-danger,
.finance-calc .card.bg-dark,
.finance-calc .card.bg-light {
  height: 100%;
}

.spinner-border-sm {
  width: 1rem;
  height: 1rem;
}

.json-valid { color: #198754; }
.json-invalid { color: #dc3545; }

.oui-result,
.subnet-result {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.binary-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
  line-height: 1.6;
}

.navbar .dropdown-menu {
  max-height: 80vh;
  overflow-y: auto;
}

.map-shell {
  min-height: 22rem;
  width: 100%;
  background-color: var(--tb-code-bg);
}

.map-shell .leaflet-control-attribution {
  font-size: 0.7rem;
}

.qr-image {
  image-rendering: pixelated;
  background: #fff;
  padding: .5rem;
  border-radius: .375rem;
  max-width: 100%;
}

/* The QR is rendered to a PNG blob and shown as a fixed-size <img> so the
   chosen export size never affects the on-screen layout. */
.qr-image-wrapper {
  width: 100%;
  display: block;
  text-align: center;
}

.qr-img {
  display: block;
  margin: 0 auto;
  width: 100%;
  max-width: 320px;
  height: auto;
}

.qr-size-range {
  max-width: 160px;
}

.border-dashed {
  border-style: dashed !important;
}

.qr-placeholder-icon {
  font-size: 2.5rem;
  line-height: 1;
  opacity: 0.5;
}

/* Keep the sticky QR preview below the navbar's dropdown menus (z-index 1000),
   which open over this right-hand column. Bootstrap's .sticky-lg-top sets
   z-index 1020, which would otherwise cover the dropdown items. */
.qr-sticky {
  z-index: 5;
}

.progress-log {
  max-height: 320px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .85rem;
}

.chip {
  display: inline-block;
  padding: .15rem .5rem;
  margin: .1rem .15rem .1rem 0;
  border: 1px solid var(--tb-border);
  border-radius: 999px;
  font-size: .8rem;
}

/* Cookie consent: fixed floating banner at the bottom of the viewport */
.cookie-consent {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1080;
  padding: .75rem;
  pointer-events: none;
}

.cookie-consent__panel {
  pointer-events: auto;
  max-width: 720px;
  margin: 0 auto;
  background-color: var(--tb-bg);
  color: var(--tb-fg);
  border: 1px solid var(--tb-border);
  border-radius: .75rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
  padding: 1rem 1.1rem;
}

.cookie-consent__body {
  display: flex;
  gap: .85rem;
  align-items: flex-start;
}

.cookie-consent__icon {
  flex: 0 0 auto;
  color: var(--tb-accent);
  margin-top: .15rem;
}

.cookie-consent__title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 .25rem;
}

.cookie-consent__message {
  margin: 0;
  font-size: .9rem;
  line-height: 1.45;
}

.cookie-consent__links {
  margin: .5rem 0 0;
  font-size: .85rem;
}

.cookie-consent__link {
  color: var(--tb-accent);
  text-decoration: underline;
}

.cookie-consent__prefs {
  margin-top: 1rem;
  padding-top: .75rem;
  border-top: 1px solid var(--tb-border);
  display: grid;
  gap: .75rem;
}

.cookie-consent__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

@media (max-width: 575.98px) {
  .cookie-consent__actions {
    justify-content: stretch;
  }
  .cookie-consent__actions .btn {
    flex: 1 1 auto;
  }
}
