:root {
  --bg: #0f1117;
  --bg-2: #161922;
  --card: #1b1f2a;
  --line: #2a3040;
  --text: #e6e9f0;
  --muted: #8b94a7;
  --primary: #4f8cff;
  --primary-2: #3a6fd8;
  --ok: #2ecc71;
  --warn: #f1c40f;
  --danger: #e74c3c;
  --vpn: #e74c3c;
  --proxy: #e67e22;
  --tor: #9b59b6;
  --hosting: #3498db;
  --clean: #2ecc71;
  --unknown: #7f8c8d;
  --radius: 12px;
}

* { box-sizing: border-box; }

.formless { display: inline; margin: 0; }
.topbar form { display: inline-flex; margin: 0; align-items: center; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 20% -10%, #1e2433, var(--bg));
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(15, 17, 23, .85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-wrap: wrap;
  gap: 10px;
}
.topbar .brand { font-weight: 700; font-size: 16px; color: var(--text); }
.topbar nav { display: flex; flex-wrap: wrap; gap: 16px; }
.topbar nav a { color: var(--muted); font-weight: 500; }
.topbar nav a:hover { color: var(--text); }
.topbar nav { align-items: center; }

main { max-width: 1280px; margin: 0 auto; padding: 24px; }

/* --- Публичная главная: проверка IP --- */
.check-hero { margin-bottom: 14px; }
.check-panel { margin-bottom: 20px; }
.check-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.check-form input {
  flex: 1 1 320px;
  min-width: 220px;
  padding: 14px 16px;
  font-size: 16px;
}
.check-form button { padding: 14px 22px; font-size: 15px; }
.check-form + .flash { margin-top: 12px; }

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px 20px;
  margin: 14px 0 6px;
}
.kv { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding: 6px 0; }
.kv .k { color: var(--muted); font-size: 12px; }
.kv .v { text-align: right; word-break: break-word; }

.result h3 { font-size: 14px; margin: 18px 0 6px; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin: 16px 0 4px;
}
.info-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px 14px;
}
.info-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 6px;
}
.info-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
}
.info-item:last-child { border-bottom: none; }
.info-k { color: var(--muted); font-size: 12px; flex: 0 0 auto; }
.info-v { text-align: right; word-break: break-word; font-weight: 500; }
.table-wrap { overflow-x: auto; }
.rounds { display: grid; gap: 8px; }
.round { background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.round-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.api-card { margin-top: 20px; }
.api-card pre.json { max-height: none; margin: 10px 0; }

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.hero h1 { margin: 0 0 4px; font-size: 26px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.error { color: var(--danger); }

.inline { display: flex; gap: 8px; flex-wrap: wrap; }

input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, .18);
}
textarea { resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; margin: 10px 0; }
.inline input { min-width: 240px; }

button, .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
button:hover, .btn:hover { background: #222838; text-decoration: none; }
button:active { transform: translateY(1px); }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-2); }
button.danger { color: var(--danger); border-color: rgba(231, 76, 60, .4); }
button.danger:hover { background: rgba(231, 76, 60, .12); }
button.small, .btn.small { padding: 4px 9px; font-size: 12px; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}
.stat span { font-size: 24px; font-weight: 700; }
.stat small { color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
  gap: 20px;
}
@media (max-width: 960px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  overflow: hidden;
}
.card.wide { grid-column: 1 / -1; }
.card h2 { margin: 0 0 14px; font-size: 16px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.form-grid button { align-self: end; height: 36px; }

.upload { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
.upload .file { font-size: 12px; color: var(--muted); }
.upload input[type=file] { padding: 6px; }

table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
tr:hover td { background: rgba(255, 255, 255, .015); }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #fff;
  background: var(--unknown);
}
.v-vpn { background: var(--vpn); }
.v-proxy { background: var(--proxy); }
.v-tor { background: var(--tor); }
.v-hosting { background: var(--hosting); }
.v-clean { background: var(--clean); color: #062; }
.v-unknown { background: var(--unknown); }

.row-gap { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }

.result {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
  scroll-margin-top: 80px;
}
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.verdict-big { display: flex; align-items: center; gap: 12px; }
.verdict-big .ip { font-size: 20px; font-weight: 700; }
.verdict-big .badge { font-size: 13px; padding: 5px 14px; }
.score { color: var(--muted); }
.score b { color: var(--text); }
.signals td { font-size: 12px; }
details { margin-top: 12px; }
pre.json {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px;
  overflow: auto;
  max-height: 420px;
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  z-index: 100;
  animation: slide .2s ease;
}
.toast.ok { border-color: rgba(46, 204, 113, .5); }
.toast.error { border-color: rgba(231, 76, 60, .6); }
@keyframes slide { from { transform: translateY(10px); opacity: 0; } }

.flash.error { background: rgba(231, 76, 60, .12); border: 1px solid rgba(231, 76, 60, .5); padding: 8px 12px; border-radius: 8px; }

.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  width: min(380px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-card h1 { margin: 0; font-size: 22px; }
.login-card p { margin: 0; color: var(--muted); }
.login-card button { justify-content: center; background: var(--primary); border-color: var(--primary); color: #fff; }
