/* =========================
   ROOT
========================= */
:root {
  --bg-1: #020617;
  --bg-2: #0f172a;
  --card: rgba(255, 255, 255, 0.05);
  --card-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --white: #ffffff;

  --primary: #38bdf8;
  --primary-2: #6366f1;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;

  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.25);

  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;

  --container: 1180px;
}

/* =========================
   RESET
========================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: Inter, Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, #111c3a 0%, var(--bg-1) 58%);
  overflow-x: hidden;
  line-height: 1.5;
}

body::before {
  content: "";
  position: fixed;
  inset: -20%;
  background:
    radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.16), transparent 35%),
    radial-gradient(circle at 80% 70%, rgba(99, 102, 241, 0.16), transparent 35%),
    radial-gradient(circle at 50% 90%, rgba(34, 197, 94, 0.08), transparent 30%);
  filter: blur(50px);
  animation: bgFloat 70s linear infinite;
  z-index: 0;
  pointer-events: none;
}

@keyframes bgFloat {
  0% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(-6%, -4%, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font: inherit;
}

::selection {
  background: rgba(56, 189, 248, 0.25);
}

/* =========================
   GLOBAL LAYOUT
========================= */
main,
.page-container,
.hero,
.tools,
.info,
.info-panel,
.quick-grid {
  position: relative;
  z-index: 2;
}

.page-container {
  width: min(var(--container), calc(100% - 32px));
  margin: 120px auto 60px;
  padding: 32px;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.page-container::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(120deg, transparent, rgba(56, 189, 248, 0.22), transparent);
  opacity: 0.35;
  filter: blur(16px);
  z-index: -1;
  pointer-events: none;
}

/* =========================
   HEADER
========================= */
#btHeader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: rgba(2, 6, 23, 0.75);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.logo {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btMenu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btMenu a {
  color: #cbd5e1;
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 12px;
  transition: 0.2s ease;
}

.btMenu a:hover {
  color: #fff;
  background: rgba(56, 189, 248, 0.12);
}

.menu-toggle {
  display: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 10px;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 3px;
  background: #fff;
  border-radius: 2px;
  margin: 5px 0;
}

/* =========================
   HERO
========================= */
.hero {
  min-height: calc(100vh - 76px);
  display: grid;
  place-items: center;
  padding: 120px 20px 60px;
  text-align: center;
}

.hero-inner,
.hero-content {
  width: min(980px, 100%);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin-bottom: 18px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.08);
  color: #d9f6ff;
  font-size: 13px;
  font-weight: 700;
}

.hero h1,
.hero-title {
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.03;
  font-weight: 900;
  letter-spacing: -0.04em;
  margin-bottom: 16px;
  background: linear-gradient(90deg, #ffffff 0%, #cbd5e1 32%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p,
.hero-desc {
  width: min(760px, 100%);
  margin: 0 auto;
  color: rgba(226, 232, 240, 0.78);
  font-size: clamp(16px, 2vw, 19px);
}

.hero-actions,
.hero-buttons {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.hero-stats {
  margin: 28px auto 0;
  width: min(760px, 100%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.stat,
.mini-box {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-soft);
}

.stat strong {
  display: block;
  font-size: 18px;
  margin-bottom: 4px;
  color: #fff;
}

.stat span,
.mini-box span {
  color: rgba(226, 232, 240, 0.74);
  font-size: 13px;
}

/* =========================
   BUTTONS
========================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 13px 18px;
  border-radius: 14px;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
  transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  user-select: none;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 14px 36px rgba(56, 189, 248, 0.24);
}

.btn.secondary {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn.secondary:hover {
  background: rgba(255, 255, 255, 0.09);
}

/* =========================
   TOOL / QUICK CARDS
========================= */
.tools,
.quick-grid {
  width: min(var(--container), calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.tool-card,
.quick-card {
  position: relative;
  overflow: hidden;
  display: block;
  text-decoration: none;
  color: #fff;
  padding: 22px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-soft);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.tool-card::before,
.quick-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(56, 189, 248, 0.22), transparent);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.tool-card:hover,
.quick-card:hover {
  transform: translateY(-8px);
  border-color: rgba(56, 189, 248, 0.22);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
}

.tool-card:hover::before,
.quick-card:hover::before {
  opacity: 1;
}

.tool-card h3,
.quick-card h3 {
  margin-top: 10px;
  margin-bottom: 8px;
  font-size: 18px;
}

.tool-card p,
.quick-card p {
  color: rgba(226, 232, 240, 0.74);
  font-size: 14px;
  line-height: 1.6;
}

.tool-icon,
.icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 24px;
  border-radius: 14px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.14);
}

.quick-card.main {
  min-height: 190px;
}

.quick-card.main .icon,
.tool-card .tool-icon {
  margin-bottom: 8px;
}

/* =========================
   INFO AREAS
========================= */
.info,
.info-panel {
  width: min(var(--container), calc(100% - 32px));
  margin: 34px auto 70px;
  padding: 28px;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-soft);
}

.info h2,
.info-panel h2 {
  font-size: clamp(24px, 3vw, 34px);
  margin-bottom: 10px;
  letter-spacing: -0.03em;
}

.info p,
.info-panel p {
  color: rgba(226, 232, 240, 0.76);
}

.info-boxes {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

/* =========================
   TYPOGRAPHY
========================= */
h1 {
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 10px;
}

.subtitle {
  color: rgba(226, 232, 240, 0.72);
  margin-top: 8px;
  font-size: 15px;
}

p {
  line-height: 1.7;
}

.critical {
  margin-top: 20px;
  color: #ff7070;
  font-weight: 700;
  font-size: 15px;
}

/* =========================
   FORMS
========================= */
.form-area {
  margin-top: 24px;
  text-align: left;
}

.form-group {
  position: relative;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.2px;
}

.form-group::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 14px;
  background: linear-gradient(120deg, transparent, rgba(56, 189, 248, 0.18), transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.form-group:hover::after {
  opacity: 1;
}

.input-group input,
.form-select {
  width: 100%;
  min-height: 48px;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.045);
  color: #fff;
  outline: none;
  transition: 0.2s ease;
}

.input-group input::placeholder {
  color: rgba(148, 163, 184, 0.75);
}

.input-group input:focus,
.form-select:focus {
  border-color: rgba(56, 189, 248, 0.65);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15), 0 0 22px rgba(56, 189, 248, 0.18);
  background: rgba(255, 255, 255, 0.065);
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg fill='%23cbd5e1' height='20' viewBox='0 0 24 24' width='20' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 42px;
}

.form-select option {
  background: #020617;
  color: #fff;
}

.form-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hint {
  margin-top: 8px;
  color: rgba(226, 232, 240, 0.48);
  font-size: 13px;
}

/* =========================
   LOADING
========================= */
.loading {
  margin-top: 22px;
  display: grid;
  place-items: center;
  gap: 10px;
  color: rgba(226, 232, 240, 0.82);
  font-size: 14px;
}

.spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =========================
   RESULTS (SIMPLE)
========================= */
.result-box {
  margin-top: 24px;
  padding: 18px;
  border-radius: 18px;
  line-height: 1.65;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(12px);
}

.result-box.success {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.25);
}

.result-box.error {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
}

.result-box .note {
  margin-top: 10px;
  font-size: 13px;
  opacity: 0.75;
}

.port.success {
  color: #86efac;
}

.port.error {
  color: #fca5a5;
}

/* =========================
   RESULT SUMMARY / MODAL
========================= */
.result-summary {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.95), rgba(2, 6, 23, 0.98));
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 22px;
  padding: 20px;
  color: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.result-summary.is-off {
  border-color: rgba(239, 68, 68, 0.4);
}

.result-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.badge.ok,
.badge-green {
  background: rgba(34, 197, 94, 0.14);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.badge.bad,
.badge-red {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.speed-box {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
}

.speed-label {
  font-size: 13px;
  opacity: 0.8;
}

.speed-value {
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

.speed-sub {
  font-size: 14px;
  opacity: 0.85;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 16px;
  padding: 12px 14px;
}

.summary-item span {
  display: block;
  font-size: 12px;
  opacity: 0.72;
  margin-bottom: 4px;
}

.summary-item strong {
  font-size: 14px;
  line-height: 1.35;
}

.detail-btn {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--primary-2), var(--success));
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(34, 197, 94, 0.16);
  transition: transform 0.2s ease, filter 0.2s ease;
}

.detail-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.detail-modal[hidden] {
  display: none;
}

.detail-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(8px);
}

.detail-modal__card {
  position: relative;
  width: min(920px, calc(100% - 24px));
  max-height: min(86vh, 900px);
  overflow: auto;
  margin: 5vh auto;
  background: #0f172a;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 22px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.detail-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  padding: 18px 20px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.detail-modal__header h2 {
  margin: 0;
  font-size: 20px;
}

.detail-modal__header p {
  margin: 4px 0 0;
  opacity: 0.72;
  font-size: 13px;
}

.detail-modal__close {
  border: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}

.detail-modal__body {
  padding: 18px 20px 22px;
}

.detail-section {
  margin-bottom: 18px;
}

.detail-section h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.detail-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: top;
  font-size: 14px;
}

.detail-table td:first-child {
  width: 38%;
  color: rgba(255, 255, 255, 0.72);
}

.detail-table tr:last-child td {
  border-bottom: 0;
}

.warn-mini {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(245, 158, 11, 0.12);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.28);
  font-size: 13px;
}

/* =========================
   MISC
========================= */
.info-box {
  margin-top: 30px;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.7;
}

.info-box a {
  color: #38bdf8;
  text-decoration: none;
}

.info-box a:hover {
  text-decoration: underline;
}

.btFooter {
  width: min(var(--container), calc(100% - 32px));
  margin: 50px auto 30px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}

.btFooter a {
  color: #38bdf8;
  text-decoration: none;
}

.btFooter a:hover {
  text-decoration: underline;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1024px) {
  .hero-stats,
  .info-boxes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-container {
    margin-top: 104px;
  }
}

@media (max-width: 768px) {
  #btHeader {
    padding: 12px 16px;
  }

  .menu-toggle {
    display: block;
  }

  .btMenu {
    position: absolute;
    top: 60px;
    left: 0;
    width: 100%;
    display: none;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    align-items: stretch;
    background: rgba(2, 6, 23, 0.96);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(16px);
  }

  .btMenu.active {
    display: flex;
  }

  .btMenu a {
    text-align: center;
    padding: 12px;
    border-radius: 12px;
  }

  .hero {
    min-height: auto;
    padding: 112px 16px 40px;
  }

  .page-container {
    width: calc(100% - 24px);
    padding: 22px;
    margin: 96px auto 40px;
    border-radius: 22px;
  }

  .tools,
  .quick-grid {
    width: calc(100% - 24px);
    gap: 14px;
  }

  .info,
  .info-panel {
    width: calc(100% - 24px);
    padding: 22px;
  }

  .hero-stats,
  .info-boxes,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .speed-value {
    font-size: 34px;
  }

  .detail-table td {
    display: block;
    width: 100%;
  }

  .detail-table td:first-child {
    font-weight: 700;
    padding-bottom: 4px;
  }

  .detail-table tr {
    display: block;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .detail-modal__card {
    width: calc(100% - 16px);
    margin: 4vh auto;
    max-height: 90vh;
  }

  .detail-modal__header {
    padding: 16px 16px 10px;
  }

  .detail-modal__body {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .hero-badge {
    font-size: 12px;
  }

  .hero h1,
  .hero-title {
    font-size: 32px;
  }

  .btn {
    width: 100%;
  }

  .tool-card,
  .quick-card {
    padding: 18px;
    border-radius: 18px;
  }

  .page-container {
    padding: 18px;
  }
}