/* Network tools (IP lookup, ping test, speed test).
   Colours come ONLY from the site's theme variables so light/dark themes work automatically.
   All class names are prefixed `tool-`; `btn`, `btn-primary`, `btn-ghost`, `input`, `card` are site classes. */

.tool { display: grid; gap: 1rem; margin: 0 auto; max-width: 1100px; min-width: 0; color: var(--text); }
.tool *, .tool *::before, .tool *::after { box-sizing: border-box; }
.tool [hidden] { display: none !important; }
.tool a:not(.btn) { color: var(--primary); }
.tool a:not(.btn):hover { color: var(--primary-2); }

.tool-panel { padding: 1rem; display: grid; gap: .75rem; min-width: 0; }
.tool-label { display: block; font-size: .8rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); margin-bottom: .35rem; }
.tool-hint, .tool-small { font-size: .85rem; margin: 0; }
.tool-hint, .tool-muted { color: var(--muted); }
.tool-mono { font-family: var(--font-mono); overflow-wrap: anywhere; }
.tool-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.tool-status { margin: 0; min-height: 1.4em; font-size: .95rem; color: var(--muted); }
.tool-status:empty { min-height: 0; }
.tool-status-error { color: var(--danger); font-weight: 600; }

/* Forms */
.tool-form { display: grid; gap: .5rem; margin: 0; min-width: 0; }
.tool-input-row { display: flex; flex-direction: column; gap: .5rem; }
.tool-input, .tool-select { width: 100%; min-width: 0; font-size: 1rem; }
.tool-form-grid { display: grid; gap: .75rem; grid-template-columns: 1fr; }
.tool-field { min-width: 0; }
.tool-field-btn { display: flex; align-items: flex-end; }
.tool-field-btn .btn, .tool-input-row .btn { width: 100%; justify-content: center; }
.tool .btn:focus-visible, .tool .input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tool-btn-sm { padding: .35rem .75rem; font-size: .85rem; white-space: nowrap; }

@media (min-width: 560px) {
  .tool-input-row { flex-direction: row; }
  .tool-input-row .btn { width: auto; flex: 0 0 auto; }
  .tool-form-grid { grid-template-columns: minmax(0, 1fr) 10rem auto; align-items: end; }
  .tool-field-btn .btn { width: auto; }
  .tool-panel { padding: 1.25rem 1.5rem; }
}

/* Badges */
.tool-badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; line-height: 1.4;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); white-space: nowrap; vertical-align: middle; }
.tool-badge-ok { color: var(--success); border-color: var(--success); }
.tool-badge-partial { color: var(--warning); border-color: var(--warning); }
.tool-badge-timeout, .tool-badge-error { color: var(--danger); border-color: var(--danger); }
.tool-badge-pending { color: var(--muted); }
.tool-badge-pending::before { content: ""; display: inline-block; width: .5em; height: .5em; margin-right: .35em; border-radius: 50%;
  background: var(--muted); vertical-align: middle; animation: tool-pulse 1s ease-in-out infinite; }
@keyframes tool-pulse { 50% { opacity: .25; } }

/* ---------- IP lookup ---------- */
.tool-myip { min-width: 0; }
.tool-myip-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.tool-myip-value { font-family: var(--font-mono); font-size: clamp(1.25rem, 5vw, 1.9rem); font-weight: 700; color: var(--primary); overflow-wrap: anywhere; min-width: 0; }
.tool-myip-meta { display: block; color: var(--muted); font-size: .9rem; margin-top: .25rem; }

.tool-result { display: grid; gap: 1rem; min-width: 0; }
.tool-ip-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; }
.tool-ip-head-main { min-width: 0; }
.tool-ip-big { font-family: var(--font-mono); font-size: clamp(1.1rem, 4.5vw, 1.6rem); font-weight: 700; overflow-wrap: anywhere; }

.tool-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); margin: 0; }
.tool-cell { padding: .85rem 1rem; min-width: 0; margin: 0; }
.tool-cell dt { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-bottom: .25rem; }
.tool-cell dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.tool-flag { font-size: 1.15em; }

.tool-map { padding: 0; overflow: hidden; }
.tool-map-frame { display: block; width: 100%; height: 300px; border: 0; background: var(--surface-2); }
.tool-map-note { padding: .6rem 1rem; }
@media (min-width: 768px) { .tool-map-frame { height: 380px; } }

/* ---------- Summary / stat cards (ping + speed) ---------- */
.tool-summary { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .tool-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tool-stat { padding: .85rem 1rem; display: grid; gap: .2rem; min-width: 0; }
.tool-stat-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.tool-stat-value { font-size: clamp(1.2rem, 4vw, 1.6rem); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); }
.tool-stat-value small { font-size: .55em; font-weight: 600; color: var(--muted); }

/* ---------- Ping table ---------- */
.tool-progress { height: 4px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.tool-progress-bar { display: block; height: 100%; width: 0; background: var(--primary); transition: width .4s ease; }

.tool-table-wrap { padding: 0; overflow-x: auto; min-width: 0; }
.tool-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tool-table th, .tool-table td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tool-table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.tool-table tbody tr:last-child td { border-bottom: 0; }
.tool-table .tool-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tool-cc { font-family: var(--font-mono); font-weight: 700; font-size: .85em; }
.tool-loc { min-width: 10rem; }

/* Mobile: rows become cards, no horizontal scroll */
@media (max-width: 639px) {
  .tool-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tool-table, .tool-table tbody, .tool-table tr, .tool-table td { display: block; width: 100%; }
  .tool-table tr { padding: .6rem .9rem; border-bottom: 1px solid var(--border); }
  .tool-table tbody tr:last-child { border-bottom: 0; }
  .tool-table td { border: 0; padding: .2rem 0; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  .tool-table td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 600; text-align: left; }
  .tool-table td.tool-loc { display: block; text-align: left; font-weight: 600; padding-bottom: .35rem; }
  .tool-table td.tool-loc::before { content: none; }
  .tool-table .tool-num { text-align: right; }
}

/* ---------- Speed test ---------- */
.tool-speed-panel { justify-items: center; text-align: center; }
.tool-phases { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; margin: 0; padding: 0; counter-reset: tool-phase; }
.tool-phases li { counter-increment: tool-phase; font-size: .8rem; font-weight: 600; padding: .3rem .7rem; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); background: var(--surface); }
.tool-phases li::before { content: counter(tool-phase) ". "; }
.tool-phases li.is-active { color: var(--primary); border-color: var(--primary); }
.tool-phases li.is-done { color: var(--success); border-color: var(--success); }
.tool-phases li.is-done::before { content: "\2713  "; }

.tool-gauge { position: relative; width: 100%; max-width: 380px; }
.tool-gauge-svg { display: block; width: 100%; height: auto; overflow: visible; }
.tool-gauge-track, .tool-gauge-fill { fill: none; stroke-width: 14; stroke-linecap: round; }
.tool-gauge-track { stroke: var(--surface-2); }
.tool-gauge-fill { stroke-dasharray: 100 100; transition: stroke-dashoffset .25s linear; }
.tool-gauge-stop1 { stop-color: var(--primary); }
.tool-gauge-stop2 { stop-color: var(--accent); }
.tool-gauge-tick { font-size: 7px; fill: var(--muted); font-family: var(--font-mono); }
.tool-gauge-readout { position: absolute; left: 0; right: 0; bottom: 4%; display: grid; justify-items: center; line-height: 1.1; }
.tool-gauge-value { font-size: clamp(2rem, 11vw, 3.25rem); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); }
.tool-gauge-unit { font-size: .9rem; font-weight: 600; color: var(--muted); }
.tool-gauge-phase { margin-top: .2rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); font-weight: 700; }

.tool-speed-actions { display: flex; justify-content: center; }
.tool-btn-start { min-width: 9rem; min-height: 3.25rem; font-size: 1.15rem; font-weight: 700; border-radius: 999px; box-shadow: var(--shadow); }

.tool-speed-client { grid-template-columns: 1fr; }
.tool-speed-client > div { min-width: 0; overflow-wrap: anywhere; }
@media (min-width: 640px) { .tool-speed-client { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

@media (prefers-reduced-motion: reduce) {
  .tool-gauge-fill, .tool-progress-bar { transition: none; }
  .tool-badge-pending::before { animation: none; }
}

/* ---------- Domain search + prices ---------- */
.tool-domain-search { gap: .6rem; }
.tool-domain-title { display: block; font-size: clamp(1.1rem, 3.5vw, 1.35rem); font-weight: 800; color: var(--text); margin: 0 0 .35rem; }
.tool-domain-bar { display: flex; flex-direction: column; gap: .5rem; padding: .35rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.tool-domain-bar:focus-within { border-color: var(--primary); }
.tool .tool-domain-input { font-size: 1.1rem; min-height: 3.1rem; padding-left: 1rem; padding-right: 1rem; }
.tool-domain-btn { width: 100%; justify-content: center; min-height: 3.1rem; font-size: 1.05rem; padding-left: 1.6rem; padding-right: 1.6rem; }
@media (min-width: 560px) {
  .tool-domain-bar { flex-direction: row; align-items: stretch; }
  .tool-domain-input { flex: 1 1 auto; }
  .tool-domain-btn { width: auto; flex: 0 0 auto; }
}
.tool-domain-recaptcha-note { font-size: .75rem; }
.tool-domain-recaptcha-note a { color: inherit; text-decoration: underline; }
/* Invisible reCAPTCHA: the notice above replaces the badge (allowed by Google's FAQ); the widget still works. */
.tool-recaptcha { height: 0; overflow: hidden; }
.tool-recaptcha .grecaptcha-badge { visibility: hidden; }
.tool-domain-busy .tool-domain-btn { cursor: progress; }

.tool-domain-exact { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 1.5rem;
  padding: 1.1rem 1.25rem; border-left: 4px solid var(--border); min-width: 0; }
.tool-domain-exact.is-available { border-left-color: var(--success); }
.tool-domain-exact.is-taken { border-left-color: var(--danger); }
.tool-domain-exact.is-unknown { border-left-color: var(--warning); }
.tool-domain-exact-main { display: flex; gap: .9rem; align-items: flex-start; min-width: 0; flex: 1 1 18rem; }
.tool-domain-exact-text { min-width: 0; }
.tool-domain-exact-text p { margin: 0; }
.tool-domain-exact-icon { flex: 0 0 auto; display: inline-grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  border: 2px solid currentColor; font-weight: 800; font-size: 1.2rem; color: var(--muted); }
.is-available .tool-domain-exact-icon, .is-available .tool-domain-exact-headline { color: var(--success); }
.is-taken .tool-domain-exact-icon, .is-taken .tool-domain-exact-headline { color: var(--danger); }
.is-unknown .tool-domain-exact-icon, .is-unknown .tool-domain-exact-headline { color: var(--warning); }
.tool-domain-exact-name { font-size: clamp(1.3rem, 5vw, 1.9rem); font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; color: var(--text); }
.tool-domain-exact-headline { font-weight: 700; margin-top: .15rem !important; }
.tool-domain-exact-side { display: grid; gap: .45rem; justify-items: start; min-width: 0; }
.tool-domain-exact-price { margin: 0; font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); }
.tool-domain-exact-price small { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); }
.tool-domain-cta { min-width: 10rem; justify-content: center; }
@media (min-width: 720px) { .tool-domain-exact-side { justify-items: end; text-align: right; } }

.tool-domain-alt { padding: 0; overflow: hidden; min-width: 0; }
.tool-domain-alt-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem 1rem;
  padding: .85rem 1.25rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.tool-domain-h2, .tool-domain-h3 { margin: 0; font-weight: 800; color: var(--text); }
.tool-domain-h2 { font-size: 1.2rem; }
.tool-domain-h3 { font-size: 1rem; }
.tool-domain-list { list-style: none; margin: 0; padding: 0; }
.tool-domain-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem;
  padding: .7rem 1.25rem; border-bottom: 1px solid var(--border); min-width: 0; }
.tool-domain-item:last-child { border-bottom: 0; }
.tool-domain-item-main { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; min-width: 0; }
.tool-domain-item-name { font-weight: 700; overflow-wrap: anywhere; }
.tool-domain-item.is-taken .tool-domain-item-name { color: var(--muted); }
.tool-domain-item-side { display: flex; align-items: center; gap: .75rem; margin-left: auto; }
.tool-domain-item-price { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tool-domain-item-price small { font-weight: 600; color: var(--muted); }
.tool-domain-item-side .btn { min-width: 6.25rem; justify-content: center; }

.tool-domain-finalize { margin: 0; padding: .9rem 1.25rem; font-size: .92rem; border-left: 4px solid var(--primary); overflow-wrap: anywhere; }

.tool-domain-pricing-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem 1.5rem; }
.tool-domain-filter { flex: 0 1 16rem; min-width: 0; width: 100%; }
@media (min-width: 560px) { .tool-domain-filter { width: auto; } }
.tool-domain-pricing .tool-table-wrap { border: 1px solid var(--border); border-radius: var(--radius); }
.tool-domain-prices th.tool-domain-tld { font-family: var(--font-mono); font-weight: 700; color: var(--text); }
.tool-domain-prices tbody tr:nth-child(even) { background: var(--surface-2); }
/* Keep the price list a real table on phones (5 short columns fit), instead of the stacked-card layout. */
@media (max-width: 639px) {
  .tool-table.tool-domain-prices { display: table; font-size: .8rem; }
  .tool-domain-prices thead { position: static; width: auto; height: auto; overflow: visible; clip: auto; display: table-header-group; }
  .tool-domain-prices tbody { display: table-row-group; width: auto; }
  .tool-domain-prices tr { display: table-row; width: auto; padding: 0; }
  .tool-table.tool-domain-prices th, .tool-table.tool-domain-prices td { display: table-cell; width: auto; padding: .5rem .35rem; text-align: right; border-bottom: 1px solid var(--border); }
  .tool-table.tool-domain-prices th:first-child, .tool-table.tool-domain-prices td:first-child { text-align: left; padding-left: .6rem; }
  .tool-table.tool-domain-prices th:last-child, .tool-table.tool-domain-prices td:last-child { padding-right: .6rem; }
  .tool-domain-prices td::before { content: none; }
  .tool-domain-prices thead th { font-size: .65rem; letter-spacing: 0; }
}
