/* Router & IP Guide - White theme, mobile-friendly */
:root {
  --bg: #ffffff;
  --surface: #f8f9fa;
  --text: #1a1a1a;
  --muted: #5a5a5a;
  --accent: #0066cc;
  --border: #e0e0e0;
  --ad-bg: #f0f0f0;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem;
  min-width: 0;
  width: 100%;
}

/* Header: logo | nav – no search */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 0.35rem;
  padding: 0.4rem 1rem;
  min-height: 44px;
  width: 100%;
  max-width: 100%;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  flex-shrink: 0;
}
.logo:hover { text-decoration: none; color: var(--accent); }
.logo:hover .logo-icon { color: var(--accent); }
.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  color: var(--accent);
}
.logo-icon svg { width: 100%; height: 100%; }
.logo-text { font-family: "Consolas", "Monaco", monospace; font-size: 1rem; letter-spacing: 0.02em; }

/* Nav – simple links, professional */
.nav-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-toggle {
  display: none;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}
nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}
nav > ul > li { position: relative; }
nav > ul > li > a {
  display: block;
  padding: 0.5rem 0.6rem;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s;
}
nav > ul > li > a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* Dropdown */
nav .dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  margin-top: 0.2rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  padding: 0.25rem 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, visibility 0.15s;
  z-index: 50;
}
nav .dropdown:hover .dropdown-menu,
nav .dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
}
nav .dropdown-menu a {
  display: block;
  padding: 0.45rem 0.75rem;
  color: var(--text);
  font-size: 0.875rem;
  border-radius: 4px;
  margin: 0 0.2rem;
}
nav .dropdown-menu a:hover { background: var(--surface); text-decoration: none; }

/* Mobile: logo + menu button; menu opens as overlay (page stays fixed) */
@media (max-width: 768px) {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 101;
  }
  .site-header .wrap {
    padding: 0.5rem 0.75rem;
    flex-wrap: nowrap;
    min-height: 48px;
  }
  .nav-wrap {
    flex: 0 0 auto;
    min-width: 0;
    justify-content: flex-end;
  }
  .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 44px;
    padding: 0 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    background: var(--surface);
    border: 1px solid var(--border);
  }
  .nav-toggle:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
  nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    width: 100%;
    pointer-events: none;
    z-index: 100;
  }
  .nav-wrap.nav-open nav {
    pointer-events: auto;
  }
  nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    padding: 0;
    margin: 0;
    background: var(--bg);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    transition: max-height 0.25s ease-out;
    pointer-events: none;
    border: 1px solid var(--border);
    border-top: none;
  }
  nav ul.open {
    max-height: calc(100vh - 52px);
    overflow-y: auto;
    padding: 0.4rem 0;
    margin: 0;
    pointer-events: auto;
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 0;
    border-top: 1px solid var(--border);
  }
  nav > ul > li {
    border-bottom: 1px solid var(--surface);
    flex-shrink: 0;
  }
  nav > ul > li:last-child { border-bottom: none; }
  nav > ul > li > a {
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    min-height: 46px;
    display: flex;
    align-items: center;
    background: transparent;
    border: none;
    border-radius: 0;
    margin: 0;
  }
  /* Mobile dropdown: no gap between trigger and submenu */
  nav .dropdown {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  nav .dropdown > a {
    flex-shrink: 0;
  }
  nav .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    box-shadow: none;
    border: none;
    border-left: 3px solid var(--accent);
    margin: 0 0 0 0.75rem;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: none;
    background: var(--surface);
    flex-shrink: 0;
    min-height: 0;
    border-radius: 0 0 6px 6px;
  }
  nav .dropdown.open .dropdown-menu {
    max-height: 120px;
    padding: 0 0 0.25rem 0.4rem;
    margin-top: 0;
    overflow: visible;
    pointer-events: auto;
    position: relative;
    z-index: 2;
    transition: none;
  }
  nav .dropdown-menu li {
    pointer-events: auto;
    list-style: none;
    margin: 0;
    padding: 0;
  }
  nav .dropdown-menu li:first-child {
    margin-top: 0;
    padding-top: 0;
  }
  nav .dropdown-menu a {
    padding: 0.5rem 0.5rem;
    font-size: 0.9rem;
    min-height: 42px;
    display: flex;
    align-items: center;
    pointer-events: auto;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    margin: 0;
    border-radius: 4px;
  }
}
/* Prevent body scroll when mobile menu is open */
body.menu-open {
  overflow: hidden;
}

/* Search – below navbar, above first ad */
.site-search-bar {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 0.5rem 0 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}
.site-search-bar .search-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
}

/* Search – bottom of page (fallback if used elsewhere) */
.site-search-bottom {
  padding: 1rem 0 1.5rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}
.site-search-bottom .search-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
}

.search-wrap input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  background: var(--surface);
  color: var(--text);
}
.search-wrap input::placeholder { color: var(--muted); }
.search-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
}
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}
.search-results.open { display: block; }
.search-results a {
  display: block;
  padding: 0.6rem 0.75rem;
  color: var(--text);
  border-bottom: 1px solid var(--surface);
  font-size: 0.9rem;
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--surface); text-decoration: none; }
.search-results .no-result { padding: 0.75rem; color: var(--muted); font-size: 0.9rem; }

/* Router IP buttons (index) – single column on small screens */
.router-ip-buttons {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.5rem;
  margin: 1rem 0;
  width: 100%;
  max-width: 100%;
}
.ip-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  padding: 0.6rem 1rem;
  min-height: 48px;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
  line-height: 1.4;
}
.ip-btn:hover {
  border-color: var(--accent);
  background: var(--bg);
  text-decoration: none;
}
.ip-note { font-size: 0.9rem; color: var(--muted); margin-top: 0.5rem; }

/* Main CTA login button (index) */
.login-cta { margin: 1rem 0; display: block; }
.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  padding: 0.65rem 1.25rem;
  min-height: 48px;
  box-sizing: border-box;
  background: var(--accent);
  color: var(--bg) !important;
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
  line-height: 1.4;
}
.login-btn:hover {
  background: #0052a3;
  border-color: #0052a3;
  text-decoration: none;
  color: var(--bg) !important;
}
@media (min-width: 400px) {
  .login-btn { width: auto; display: inline-flex; }
}

/* What is my IP CTA (index) */
.ip-cta { margin: 1rem 0; display: block; }
.ip-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  min-height: 44px;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
  margin-top: 0.35rem;
}
.ip-cta-btn:hover {
  border-color: var(--accent);
  background: var(--bg);
  text-decoration: none;
  color: var(--accent);
}
@media (max-width: 480px) {
  .ip-cta-btn { width: 100%; display: flex; }
}

@media (max-width: 480px) {
  .site-header .wrap { padding: 0.5rem 0.6rem; }
  .logo { font-size: 1rem; }
  .logo-icon { width: 24px; height: 24px; }
  .logo-text { font-size: 0.95rem; }
  .search-wrap input { font-size: 16px; }
}

/* Ad – reserved space to prevent layout shift when AdSense loads */
.ad-wrap {
  width: 100%;
  max-width: 100%;
  margin: 1rem 0;
  overflow: hidden;
  contain: layout;
}
.ad-wrap.header-ad { margin: 0.5rem 0; }
.ad-wrap--horizontal {
  min-height: 90px;
}
.ad-wrap--square {
  min-height: 280px;
  max-width: 336px;
  margin-left: auto;
  margin-right: auto;
}
.ad-wrap .adsbygoogle {
  display: block;
  min-height: inherit;
}
.ad-wrap--horizontal .adsbygoogle { min-height: 90px; }
.ad-wrap--square .adsbygoogle { min-height: 250px; }
@media (max-width: 400px) {
  .ad-wrap--horizontal { min-height: 50px; }
  .ad-wrap--horizontal .adsbygoogle { min-height: 50px; }
  .ad-wrap--square { min-height: 250px; max-width: 100%; }
  .ad-wrap--square .adsbygoogle { min-height: 250px; }
}

/* Main – block layout, no overlap */
main {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 1.5rem 0 1.5rem;
}
article {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-bottom: 1rem;
}
h1 { font-size: 1.75rem; margin: 0 0 1rem; line-height: 1.3; color: var(--text); }
h2 { font-size: 1.35rem; margin: 1.5rem 0 0.75rem; line-height: 1.3; color: var(--text); }
h3 { font-size: 1.15rem; margin: 1.25rem 0 0.5rem; line-height: 1.3; color: var(--text); }
p { margin: 0 0 1rem; color: var(--muted); }
strong { color: var(--text); }

.ip-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  margin: 1.5rem 0;
}
.ip-box .label { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.25rem; }
.ip-box .value { font-size: 1.5rem; font-weight: 700; color: var(--accent); font-family: monospace; }

pre, .cmd {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 0.9rem;
  margin: 1rem 0;
  color: var(--text);
}
code { font-family: "Consolas", "Monaco", monospace; font-size: 0.9em; background: var(--surface); padding: 0.15em 0.4em; border-radius: 4px; color: var(--text); }

ul.content-list, ol.content-list {
  color: var(--muted);
  margin: 0 0 1rem;
  padding-left: 1.25rem;
  max-width: 100%;
}
ul.content-list li, ol.content-list li { margin-bottom: 0.5rem; }

/* Section blocks – clear spacing, no overlap */
.section-block {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-bottom: 2rem;
}
.section-block:last-of-type { margin-bottom: 0; }
.section-block h2 { margin-top: 0; }

/* Brand list (router-brands page) */
.brand-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  max-width: 100%;
}
.brand-list li {
  margin-bottom: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
}
.brand-list a { font-weight: 600; color: var(--accent); }
.brand-list a:hover { text-decoration: underline; }

.card-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1.5rem 0;
  width: 100%;
  list-style: none;
  padding: 0;
}
.card-list a {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  min-height: 48px;
  box-sizing: border-box;
  color: var(--text);
  width: 100%;
  max-width: 100%;
}
.card-list a:hover { border-color: var(--accent); text-decoration: none; }
.card-list strong { display: block; margin-bottom: 0.25rem; }

/* Extras (index bottom – inline text, no cards) */
.extras {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.extras h2 { font-size: 1.25rem; margin: 0 0 0.75rem; color: var(--text); }
.extras p { font-size: 0.95rem; color: var(--muted); margin: 0; line-height: 1.6; }
.extras a { color: var(--accent); }

/* Footer */
.site-footer {
  display: block;
  width: 100%;
  max-width: 100%;
  border-top: 1px solid var(--border);
  padding: 2rem 0 1.5rem;
  background: var(--surface);
  margin-top: 2rem;
}
.site-footer .wrap { font-size: 0.9rem; color: var(--muted); }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }
.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem 2rem;
  margin-bottom: 1.5rem;
}
.footer-block strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.footer-block p { margin: 0 0 0.5rem; font-size: 0.85rem; line-height: 1.5; }
.footer-block ul { list-style: none; margin: 0; padding: 0; }
.footer-block ul li { margin-bottom: 0.35rem; }
.footer-disclaimer {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 1rem 0 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  line-height: 1.5;
}
.footer-copy { font-size: 0.8rem; color: var(--muted); margin: 0; }
@media (min-width: 601px) {
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; }
}
@media (max-width: 600px) {
  .footer-grid { grid-template-columns: 1fr; gap: 1.25rem; }
}

/* Related articles (below main content) */
.related-articles {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.related-articles h2 { font-size: 1.2rem; margin: 0 0 1rem; }
.related-articles ul { list-style: none; margin: 0; padding: 0; }
.related-articles li { margin-bottom: 0.5rem; }
.related-articles a { color: var(--accent); }
.related-articles a:hover { text-decoration: underline; }

.breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 1rem; }
.breadcrumb a { color: var(--muted); }

/* Tables – scroll on small screens, no overlap */
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0;
}
table { width: 100%; min-width: 260px; border-collapse: collapse; margin: 0; font-size: 0.9rem; }
th, td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text); font-weight: 600; }
td { color: var(--muted); }

/* Desktop: IP buttons in a row */
@media (min-width: 520px) {
  .router-ip-buttons {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .ip-btn { width: auto; min-width: 0; }
}

/* Mobile: tighter padding and font sizes */
@media (max-width: 480px) {
  .wrap { padding: 0 0.75rem; }
  h1 { font-size: 1.5rem; margin-bottom: 0.75rem; }
  h2 { font-size: 1.2rem; margin-top: 1.25rem; margin-bottom: 0.5rem; }
  h3 { font-size: 1.1rem; }
  .card-list a { padding: 0.85rem 1rem; min-height: 48px; }
  table { font-size: 0.85rem; }
  th, td { padding: 0.5rem 0.5rem; }
}

@media (max-width: 768px) {
  main { padding: 1rem 0 1.5rem; }
  article { margin-bottom: 0.5rem; }
  .section-block { margin-bottom: 1.5rem; }
  .related-articles { margin-top: 1.5rem; padding-top: 1rem; }
  .extras { margin-top: 1.5rem; padding-top: 1rem; }
  .brand-list li { padding: 0.6rem 0.85rem; min-height: 44px; display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem; }
}
