/* IP Subnet Calculator — professional light theme */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #dde3ea;
  --text: #1d2733;
  --muted: #5b6877;
  --accent: #0b5fff;
  --accent-dark: #084ccc;
  --danger-bg: #fdecea;
  --danger-text: #9f1c14;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 30, 54, .08), 0 4px 14px rgba(16, 30, 54, .05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand-logo { height: 32px; width: auto; display: block; }
.brand-mark {
  background: var(--accent); color: #fff; font-size: .8rem; font-weight: 800;
  padding: 4px 7px; border-radius: 6px; letter-spacing: .5px;
}
.admin-nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
.admin-nav a:hover { color: var(--text); }

/* Hamburger (hidden on desktop) */
.nav-toggle { display: none; background: none; border: none; padding: 10px 6px; cursor: pointer; }
.nav-toggle span {
  display: block; width: 22px; height: 2px; background: var(--text);
  border-radius: 2px; transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle span + span { margin-top: 5px; }
.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.site-nav { display: flex; flex-wrap: nowrap; }
.site-nav a {
  color: var(--muted); text-decoration: none; margin-left: 18px; font-weight: 500;
  padding: 6px 2px; border-bottom: 2px solid transparent; white-space: nowrap; font-size: .95rem;
}
.site-nav a:hover { color: var(--text); }
.site-nav a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Hero */
.hero { text-align: center; padding: 34px 0 10px; }
.hero h1 { margin: 0 0 8px; font-size: 2rem; }
.lead { color: var(--muted); max-width: 640px; margin: 0 auto; }

/* Layout */
.layout-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; margin: 24px 0 40px; }
.main-col { min-width: 0; }
@media (max-width: 860px) { .layout-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 24px;
}
.card h2 { margin-top: 0; font-size: 1.15rem; }

/* Form */
label { font-weight: 600; display: block; margin-bottom: 8px; }
.input-row { display: flex; gap: 10px; }
.input-row input {
  flex: 1; font-family: var(--mono); font-size: 1rem;
  padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px;
  min-width: 0;
}
.input-row input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }

.btn {
  border: none; border-radius: 8px; font-size: 1rem; font-weight: 600;
  padding: 11px 22px; cursor: pointer; transition: background .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-row { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; }

.hint { color: var(--muted); font-size: .85rem; }
.hint code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }

.quick-examples { margin-top: 10px; font-size: .85rem; color: var(--muted); }
.chip {
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
  font-family: var(--mono); font-size: .78rem; padding: 3px 10px; margin: 2px;
  cursor: pointer; color: var(--text);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.tool-jump { margin-top: 14px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tool-jump .chip { text-decoration: none; font-family: inherit; font-size: .85rem; padding: 6px 14px; background: var(--surface); }
section.card[id] { scroll-margin-top: 70px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; margin-top: 16px; }
.alert-error { background: var(--danger-bg); color: var(--danger-text); }

/* Scope banner — public / private / special colour coding */
.scope-banner {
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: 14px;
}
.scope-public  { background: #fff3e6; color: #9a4a00; border: 1px solid #f5c897; }
.scope-private { background: #e8f7ee; color: #176339; border: 1px solid #a9dfc0; }
.scope-special { background: #e9f1fd; color: #1c4f9c; border: 1px solid #b6cff2; }
#calc-results.results-public  { border-left: 4px solid #e8830c; padding-left: 14px; }
#calc-results.results-private { border-left: 4px solid #16a34a; padding-left: 14px; }
#calc-results.results-special { border-left: 4px solid #3b76d6; padding-left: 14px; }

/* Results */
#calc-results { margin-top: 22px; }
#calc-results h2 { font-size: 1.05rem; font-family: var(--mono); }
.result-table { width: 100%; border-collapse: collapse; }
.result-table th, .result-table td {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border);
  vertical-align: top; font-size: .92rem;
}
.result-table th { width: 38%; font-weight: 600; color: var(--muted); }
.result-table code { font-family: var(--mono); word-break: break-all; }
.copy-btn {
  border: none; background: none; cursor: pointer; color: var(--muted);
  font-size: .9rem; margin-left: 6px; vertical-align: middle;
}
.copy-btn:hover { color: var(--accent); }

.binary-block { margin-top: 18px; }
.binary-block h3 { font-size: .95rem; margin-bottom: 6px; }
.binary-block .muted { color: var(--muted); font-weight: 400; font-size: .8rem; }
.binary-block pre {
  background: #0f1722; color: #9fd4a3; font-family: var(--mono);
  font-size: .78rem; padding: 14px; border-radius: 8px; overflow-x: auto;
}

/* Subnet splitter */
.split-section { margin-top: 26px; border-top: 1px solid var(--border); padding-top: 16px; }
.split-section h3 { font-size: 1rem; margin: 0 0 10px; }
.split-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-label { font-weight: 500; margin: 0; }
.inline-label code { background: var(--bg); padding: 1px 6px; border-radius: 4px; font-family: var(--mono); }
.split-controls select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: .9rem; background: var(--surface);
}
.btn-small { padding: 8px 16px; font-size: .9rem; }
.table-scroll { overflow-x: auto; max-height: 420px; overflow-y: auto; margin-top: 10px; }
.split-table th { width: auto; white-space: nowrap; }
.split-table td { white-space: nowrap; }
.split-table td code { word-break: normal; }
.split-table .num-col { color: var(--muted); font-size: .8rem; width: 36px; }
.split-row { cursor: pointer; }
.split-row:hover td { background: #eef4ff; }

/* DNS tools */
#dns-form select, .selector-input {
  padding: 11px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: .95rem; background: var(--surface);
}
.selector-input { max-width: 220px; font-family: var(--mono); font-size: .85rem; }
.mono-title { font-family: var(--mono); font-size: 1rem; }

.check-block {
  border: 1px solid var(--border); border-left-width: 4px; border-radius: 8px;
  padding: 14px 16px; margin-top: 16px;
}
.check-pass { border-left-color: #16a34a; }
.check-warn { border-left-color: #e8830c; }
.check-fail { border-left-color: #dc2626; }
.check-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.check-head h3 { margin: 0; font-size: 1rem; }
.status-badge {
  font-size: .72rem; font-weight: 800; letter-spacing: .5px;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.status-pass { background: #e8f7ee; color: #176339; }
.status-warn { background: #fff3e6; color: #9a4a00; }
.status-fail { background: #fdecea; color: #9f1c14; }
.record-pre {
  background: var(--bg); font-family: var(--mono); font-size: .8rem;
  padding: 10px 12px; border-radius: 6px; overflow-x: auto; white-space: pre-wrap;
  word-break: break-all; margin: 10px 0;
}
.issue-list { list-style: none; margin: 8px 0 0; padding: 0; }
.issue-list li { padding: 4px 0 4px 24px; position: relative; font-size: .88rem; overflow-wrap: anywhere; }
.check-block { min-width: 0; overflow-wrap: anywhere; }
.issue-list li::before { position: absolute; left: 0; font-weight: 700; }
.issue-ok::before   { content: "\2713"; color: #16a34a; }
.issue-warn::before { content: "\26A0"; color: #e8830c; }
.issue-fail::before { content: "\2717"; color: #dc2626; }

/* Header analyzer + SPF IP verdict */
.input-row.wrap { flex-wrap: wrap; }
/* MAC bulk vendor breakdown */
.breakdown-label { font-weight: 700; color: var(--text); font-size: .85rem; margin-bottom: 8px; }
.vendor-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.vendor-chip {
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 12px; font-size: .82rem; color: var(--text); white-space: nowrap;
}
.vendor-chip strong { color: var(--accent); margin-right: 4px; }
.vendor-chip-more { color: var(--muted); font-style: italic; }
.vendor-chip-click { cursor: pointer; user-select: none; transition: background .12s, border-color .12s; }
.vendor-chip-click:hover { border-color: var(--accent); }
.vendor-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.vendor-chip.active strong { color: #fff; }

#headers-input, #arp-input {
  width: 100%; font-family: var(--mono); font-size: .8rem;
  padding: 12px; border: 1px solid var(--border); border-radius: 8px; resize: vertical;
}
#headers-input:focus, #arp-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.auth-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.auth-badge {
  font-size: .8rem; font-weight: 700; padding: 5px 12px; border-radius: 999px;
}
.hop-slow td { background: #fff3e6; }
.ip-verdict {
  border-radius: 8px; padding: 10px 14px; margin: 10px 0; font-size: .9rem;
}
.ip-verdict-pass { background: #e8f7ee; }
.ip-verdict-warn { background: #fff3e6; }
.ip-verdict-fail { background: #fdecea; }
.ip-verdict .status-badge { margin-right: 6px; }

/* SSL chain display */
.chain-title { font-size: 1rem; margin: 18px 0 8px; }
.chain-cert {
  border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 8px; padding: 10px 14px; margin: 8px 0;
}
.chain-cert code { font-family: var(--mono); word-break: break-all; }
.chain-cert .chain-name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chain-cert .chain-type {
  font-size: .72rem; font-weight: 800; letter-spacing: .5px;
  color: var(--muted); text-transform: uppercase; margin-bottom: 2px;
}
.chain-expired { border-left-color: #dc2626; background: var(--danger-bg); }
.chain-order { border-left-color: #e8830c; background: #fff3e6; }
.chain-missing { border-left-color: #dc2626; background: var(--danger-bg); border-style: dashed; }
.chain-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%; margin-right: 7px;
  font-size: .72rem; font-weight: 800; color: #fff; vertical-align: middle;
}
.chain-icon-ok    { background: #16a34a; }
.chain-icon-order { background: #e8830c; }
.chain-icon-bad   { background: #dc2626; }
.status-private { background: #e9f1fd; color: #1c4f9c; }
#ssl-verdict .check-head h3 { font-family: var(--mono); font-size: 1rem; }

/* Speed test */
.speed-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 700px) { .speed-tiles { grid-template-columns: 1fr; } }
.speed-tile { background: var(--bg); border-radius: 10px; padding: 18px 14px; text-align: center; }
.speed-label { color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.speed-value { font-size: 2.2rem; font-weight: 800; color: var(--text); line-height: 1.2; margin: 6px 0 2px; }
.speed-unit { font-size: .9rem; font-weight: 600; color: var(--muted); }
.speed-sub { color: var(--muted); font-size: .8rem; min-height: 1.2em; }
.speed-bar { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; margin: 6px 0 10px; }
.speed-bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .15s linear; }
.speed-status { text-align: center; color: var(--muted); font-size: .9rem; min-height: 1.3em; }

/* Consent banner */
.consent-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(16, 30, 54, .08);
}
.consent-inner {
  max-width: 1080px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.consent-inner p { margin: 0; flex: 1; min-width: 240px; font-size: .88rem; color: var(--muted); }
.consent-actions { display: flex; gap: 10px; }

/* Password generator */
.pw-output-row { display: flex; gap: 10px; align-items: stretch; }
.pw-output {
  flex: 1; min-width: 0; font-family: var(--mono); font-size: 1.15rem;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg);
}
.pw-strength { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; margin: 14px 0 4px; }
.pw-strength-fill { height: 100%; width: 0; border-radius: 999px; transition: width .2s, background .2s; }
.pw-strength-label { font-size: .85rem; font-weight: 600; margin: 0 0 8px; min-height: 1.2em; }
.pw-mode { display: flex; gap: 18px; margin: 18px 0; flex-wrap: wrap; }
.pw-radio { font-weight: 600; display: flex; align-items: center; gap: 7px; }
.pw-range { width: 100%; margin: 6px 0 4px; }
.pw-checks { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; }
.pw-checks label { display: flex; align-items: center; gap: 8px; font-size: .92rem; }
.pw-checks select { padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; }

/* My IP panel */
.myip-row { margin: 8px 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.myip-label { color: var(--muted); font-size: .85rem; min-width: 64px; }
.myip-row code { font-family: var(--mono); background: var(--bg); padding: 3px 8px; border-radius: 6px; word-break: break-all; }

/* Mini table (sidebar reference) */
.mini-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.mini-table th, .mini-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.mini-table th { font-family: var(--mono); color: var(--accent); width: 56px; }

/* Learn page */
.prose { max-width: 780px; }
.prose h2 { margin-top: 36px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.prose table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: .9rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.prose th { background: var(--bg); }
.prose code { font-family: var(--mono); background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.callout {
  border-left: 4px solid var(--accent); background: var(--surface);
  padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 16px 0;
  box-shadow: var(--shadow);
}

/* Ads */
.ad-unit { margin: 18px 0; text-align: center; min-height: 50px; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: .85rem; padding: 18px 0; margin-top: 30px;
}

/* ============================== Mobile ============================== */
@media (max-width: 960px) {
  /* Header: brand + hamburger on one row; tapping the burger drops down a
     full-width vertical menu. Header stays sticky (one row tall) so the menu
     is always reachable. */
  .header-inner { height: auto; min-height: 56px; flex-wrap: wrap; }
  .nav-toggle { display: block; }
  .site-nav {
    display: none; width: 100%; flex-direction: column; gap: 6px;
    padding: 4px 0 14px;
  }
  .nav-open .site-nav { display: flex; }
  .site-nav a {
    margin-left: 0; font-size: .95rem; font-weight: 600;
    padding: 12px 16px; border-radius: 10px; border-bottom: none;
    background: var(--bg); border: 1px solid var(--border); color: var(--text);
  }
  .site-nav a.active {
    background: var(--accent); border-color: var(--accent); color: #fff;
  }
  .admin-nav a { font-size: .9rem; }

  .hero { padding: 20px 0 4px; }
  .hero h1 { font-size: 1.45rem; }
  .lead { font-size: .95rem; }

  .card { padding: 16px; }
  .layout-grid { gap: 16px; margin: 16px 0 28px; }

  /* Forms: every field and button goes full-width */
  .input-row { flex-wrap: wrap; }
  .input-row input, .input-row select, .input-row .btn { flex: 1 1 100%; min-width: 0; }
  .selector-input { max-width: none; }

  /* Tables: tighter type; key-value tables keep labels readable */
  .result-table th { width: 40%; }
  .result-table th, .result-table td { font-size: .85rem; padding: 7px 8px; }
  .mini-table th, .mini-table td { font-size: .82rem; }

  /* Wide reference tables scroll sideways instead of breaking the page */
  .prose table { display: block; overflow-x: auto; }
  .prose h2 { font-size: 1.25rem; }

  .binary-block pre { font-size: .68rem; }
  .stat-tiles { grid-template-columns: repeat(2, 1fr); }
  .check-head { flex-wrap: wrap; }
  .auth-badge { font-size: .74rem; padding: 4px 10px; }
  .quick-examples { line-height: 2; }
  .myip-label { min-width: 100%; margin-bottom: -4px; font-weight: 600; }
}

/* Admin */
.admin-form label { margin-top: 16px; }
.admin-form input[type="text"], .admin-form input[type="password"] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: .95rem;
}
.admin-form .check-row { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin: 18px 0; }
.stat-tile { background: var(--bg); border-radius: 8px; padding: 14px; text-align: center; }
.stat-tile .num { font-size: 1.6rem; font-weight: 700; color: var(--accent); }
.stat-tile .lbl { color: var(--muted); font-size: .8rem; }
