:root {
  --brand: #1297f0;
  --brand-2: #55c1ea;
  --ink: #f4f8fc;
  --ink-2: #c3d0de;
  --ink-3: #8fa2b7;
  --panel: rgba(9, 19, 32, .72);
  --panel-2: rgba(255, 255, 255, .06);
  --line: rgba(255, 255, 255, .13);
  --ok: #2fd27c;
  --warn: #ffb547;
  --bad: #ff5d6c;
  --radius: 14px;
  --font: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--font); font-size: 17px; line-height: 1.5; color: var(--ink);
  background: #0b1624;
}
a { color: var(--brand-2); }
img { max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ic { flex: none; display: inline-block; vertical-align: middle; }
.muted { color: var(--ink-3); }
.mono { font-family: var(--mono); }

/* Sfondo */
.bg { position: fixed; inset: 0; z-index: -2; background: #0b1624 center / cover no-repeat; }
.haze { position: fixed; inset: 0; z-index: -1; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* Barra superiore */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(8, 17, 29, .78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { display: flex; align-items: center; gap: 20px; min-height: 64px; }
.brand { display: flex; align-items: center; }
.brand img { height: 34px; width: auto; display: block; }
.nav { display: flex; gap: 2px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 9px;
  color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--panel-2); color: #fff; }
.nav a.on { background: var(--brand); color: #fff; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); color: #fff; border-radius: 10px; padding: 7px; cursor: pointer; }

@media (max-width: 1040px) {
  .nav-toggle { display: inline-flex; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 64px; flex-direction: column; padding: 10px 16px 16px; background: rgba(8, 17, 29, .97); border-bottom: 1px solid var(--line); }
  .nav.open { display: flex; }
  .nav a { padding: 12px; font-size: 16px; }
}

.main { flex: 1; padding-top: 48px; padding-bottom: 72px; }

/* Footer (come l'originale: barra traslucida) */
.footer { background: rgba(255, 255, 255, .1); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: #fff; font-size: 15px; font-weight: 300; }
.footer-in { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 20px 16px; }
.page-home .footer-in, .footer-in { padding-right: 150px; } /* spazio per il selettore lingue */
@media (max-width: 600px) { .footer-in { padding-right: 20px; padding-bottom: 70px; } }
.footer a { color: #fff; }

/* Pannelli */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  padding: 26px;
}
.panel + .panel { margin-top: 20px; }
.grid > .panel + .panel { margin-top: 0; }
.panel h2 { margin: 0 0 14px; font-size: 20px; font-weight: 700; }
.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 860px) { .g2, .g3 { grid-template-columns: 1fr; } }

/* Home */
.hero { text-align: center; max-width: 720px; margin: 0 auto; }
.hero .logo { display: inline-block; padding-bottom: 34px; border-bottom: 1px solid rgba(255,255,255,.7); }
.hero .logo img { height: 64px; width: auto; }
.hero .slogan { font-size: clamp(22px, 3.2vw, 30px); font-weight: 300; margin: 32px 0 10px; line-height: 1.3; }
.hero .sub { color: var(--ink-2); margin: 0 0 36px; }
.codebox { text-align: left; margin-top: 26px; }
.codebox-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; flex-wrap: wrap; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 6px; border: 0;
  background: var(--brand); color: #fff; font: 600 15px var(--font); cursor: pointer;
}
.pill-btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink-2); }
.pill-btn.ghost.on { border-color: var(--brand-2); color: #fff; }
.code-line { display: flex; align-items: stretch; background: #fff; border-radius: 10px; overflow: hidden; }
.code-line input { flex: 1; min-width: 0; border: 0; padding: 12px 14px; font: 14px var(--mono); color: #13202f; background: transparent; }
.code-line button { border: 0; background: #e8f3fd; color: #0d5ea1; padding: 0 16px; font: 600 14px var(--font); cursor: pointer; display: flex; gap: 6px; align-items: center; }
.code-line button:hover { background: #d4eafc; }

.features { margin-top: 64px; }
.features > h2 { text-align: center; font-weight: 300; font-size: 28px; margin: 0 0 26px; }
.tool-card {
  display: block; text-decoration: none; color: var(--ink); padding: 22px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: transform .18s, border-color .18s;
}
.tool-card:hover { transform: translateY(-3px); border-color: var(--brand-2); }
.tool-card .t-ic { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; background: rgba(18, 151, 240, .2); color: var(--brand-2); margin-bottom: 14px; }
.tool-card h3 { margin: 0 0 4px; font-size: 19px; }
.tool-card p { margin: 0; color: var(--ink-2); font-size: 15px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.steps li { counter-increment: s; display: flex; gap: 14px; align-items: flex-start; color: var(--ink-2); }
.steps li::before { content: counter(s); flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; }
.steps b { color: #fff; }
.netlist { display: flex; flex-wrap: wrap; gap: 8px; }
.netlist span { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px 5px 5px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.netlist img { width: 22px; height: 22px; }

/* Strumenti */
.tool-head { display: flex; gap: 18px; align-items: center; margin-bottom: 26px; }
.tool-ic { width: 58px; height: 58px; border-radius: 15px; background: var(--brand); display: grid; place-items: center; color: #fff; flex: none; box-shadow: 0 10px 30px rgba(18, 151, 240, .35); }
.tool-head h1 { margin: 0; font-size: clamp(26px, 4vw, 36px); line-height: 1.1; }
.tool-head p { margin: 4px 0 0; color: var(--ink-2); }

.form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.field { flex: 1; min-width: 200px; position: relative; }
.input, .select {
  width: 100%; padding: 13px 15px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .95); color: #10202f; font: 17px var(--font);
}
.input:focus, .select:focus { outline: 3px solid rgba(85, 193, 234, .5); outline-offset: 1px; }
.select { width: auto; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px; border-radius: 10px; border: 0; cursor: pointer;
  background: var(--brand); color: #fff; font: 700 16px var(--font); text-decoration: none;
  transition: filter .15s, transform .1s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn.secondary { background: var(--panel-2); border: 1px solid var(--line); }
.hint { font-size: 14px; color: var(--ink-3); margin-top: 10px; }
.hint code, .chips button { font-family: var(--mono); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chips button { background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-2); border-radius: 99px; padding: 4px 11px; font-size: 13px; cursor: pointer; }
.chips button:hover { color: #fff; border-color: var(--brand-2); }

.kv { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; gap: 0; margin: 0; }
.kv dt, .kv dd { padding: 10px 0; border-bottom: 1px solid var(--line); margin: 0; }
.kv dt { color: var(--ink-3); font-size: 15px; padding-right: 12px; }
.kv dd { word-break: break-word; }
.kv dd:last-of-type, .kv dt:last-of-type { border-bottom: 0; }

.big-ip { font: 600 clamp(28px, 6vw, 52px)/1.1 var(--mono); letter-spacing: -.5px; word-break: break-all; margin: 6px 0 12px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 13px; font-weight: 700; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-2); }
.badge.ok { background: rgba(47, 210, 124, .15); color: #7af0b1; border-color: rgba(47, 210, 124, .35); }
.badge.bad { background: rgba(255, 93, 108, .15); color: #ff9aa4; border-color: rgba(255, 93, 108, .35); }
.badge.warn { background: rgba(255, 181, 71, .15); color: #ffd08a; border-color: rgba(255, 181, 71, .35); }
.alert { padding: 14px 16px; border-radius: 10px; background: rgba(255, 93, 108, .14); border: 1px solid rgba(255, 93, 108, .4); color: #ffc2c8; }
.hidden { display: none !important; }

.raw { background: rgba(0, 0, 0, .45); border: 1px solid var(--line); border-radius: 10px; padding: 16px; max-height: 520px; overflow: auto; font: 13px/1.55 var(--mono); color: #d6e2ee; white-space: pre-wrap; word-break: break-word; margin: 0; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-2); padding: 8px 16px; border-radius: 9px; cursor: pointer; font: 600 15px var(--font); }
.tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat .l { font-size: 13px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 14px; color: var(--ink-3); font-weight: 600; margin-left: 3px; }

.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.map-panel { display: flex; }
#map { flex: 1; min-height: 380px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #1a2a3c; }
.flag { font-size: 1.25em; margin-right: 4px; }

/* Speed test */
.gauge-wrap { display: grid; place-items: center; position: relative; }
.gauge { width: min(360px, 100%); height: auto; }
.gauge-val { position: absolute; top: 46%; left: 0; right: 0; text-align: center; }
.gauge-val .n { font: 700 54px/1 var(--font); font-variant-numeric: tabular-nums; }
.gauge-val .u { color: var(--ink-3); font-weight: 600; }
.gauge-val .phase { color: var(--brand-2); font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: .1em; margin-top: 6px; min-height: 20px; }
.speed-go { width: 128px; height: 128px; border-radius: 50%; font-size: 26px; letter-spacing: .05em; margin: 10px auto 0; display: flex; box-shadow: 0 0 0 10px rgba(18,151,240,.18), 0 18px 40px rgba(18,151,240,.4); }

/* Ping */
.ping-bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ping-bars div { flex: 1; background: linear-gradient(to top, var(--brand), var(--brand-2)); border-radius: 5px 5px 0 0; min-height: 3px; position: relative; }
.ping-bars div.lost { background: var(--bad); opacity: .6; height: 100% !important; }
.ping-bars div span { position: absolute; top: -20px; left: 0; right: 0; text-align: center; font-size: 12px; color: var(--ink-2); }

/* Whois */
.ns-list { margin: 0; padding: 0; list-style: none; font-family: var(--mono); font-size: 15px; }
.status-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tld-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.tld-list span { font: 12px var(--mono); padding: 2px 7px; border-radius: 6px; background: rgba(18,151,240,.18); color: #bfe4ff; }
.domain-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.domain-title h2 { margin: 0; font: 600 26px var(--mono); word-break: break-all; }
.timeline { height: 8px; border-radius: 9px; background: var(--panel-2); overflow: hidden; margin: 8px 0 4px; }
.timeline div { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }

table.simple { width: 100%; border-collapse: collapse; font-size: 15px; }
table.simple th, table.simple td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
table.simple th { color: var(--ink-3); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }

/* Banner */
.ad-slot { margin: 22px auto; text-align: center; max-width: 100%; overflow: hidden; clear: both; }
.ad-slot img { max-width: 100%; height: auto; display: inline-block; border-radius: 8px; vertical-align: middle; }
.ad-slot a { display: inline-block; max-width: 100%; }
.ad-top { margin-top: 0; margin-bottom: 30px; }
.ad-bottom { margin-top: 40px; margin-bottom: 0; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); background: #fff; color: #10202f; padding: 10px 18px; border-radius: 99px; font-weight: 700; opacity: 0; transition: .25s; z-index: 99999999; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .main { padding-top: 28px; }
  .panel { padding: 18px; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { border-bottom: 0; padding-bottom: 0; }
  .tool-ic { width: 48px; height: 48px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
