/* HIT BIT VPN — dark/yellow premium theme for Xray Checker */
:root {
  --bg-primary: #0b0b09;
  --bg-secondary: #11110e;
  --bg-tertiary: #181812;
  --bg-elevated: #202017;

  --border: rgba(255, 219, 32, 0.12);
  --border-hover: rgba(255, 219, 32, 0.38);

  --text-primary: #f7f5e9;
  --text-secondary: #c6c2ad;
  --text-muted: #7d7a6d;

  --hover-bg: rgba(255, 219, 32, 0.07);
  --segment-empty: #2a291f;

  --accent: #ffdb20;
  --accent-strong: #ffd000;
  --accent-soft: rgba(255, 219, 32, 0.12);

  --color-green: #ffdb20;
  --color-red: #ff6257;
  --color-yellow: #ffdb20;

  --filter-online-bg: rgba(255, 219, 32, 0.13);
  --filter-offline-bg: rgba(255, 98, 87, 0.12);
  --btn-active-bg: #ffdb20;
  --btn-active-border: #ffdb20;

  --hit-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  --hit-glow: 0 0 34px rgba(255, 219, 32, 0.10);
}

/* Light theme stays brand-consistent instead of turning into a hospital dashboard. */
.light {
  --bg-primary: #f2f0e8;
  --bg-secondary: #fffdf6;
  --bg-tertiary: #ece8da;
  --bg-elevated: #e5dfcc;

  --border: rgba(81, 69, 0, 0.13);
  --border-hover: rgba(81, 69, 0, 0.32);

  --text-primary: #16150f;
  --text-secondary: #545145;
  --text-muted: #8a8576;

  --hover-bg: rgba(138, 111, 0, 0.07);
  --segment-empty: #d9d3bf;

  --accent: #d5aa00;
  --accent-strong: #c49a00;
  --accent-soft: rgba(213, 170, 0, 0.11);

  --color-green: #b58b00;
  --color-red: #cf4f45;
  --color-yellow: #b58b00;

  --filter-online-bg: rgba(181, 139, 0, 0.10);
  --filter-offline-bg: rgba(207, 79, 69, 0.10);
  --btn-active-bg: #e0b800;
  --btn-active-border: #d4aa00;

  --hit-shadow: 0 18px 50px rgba(57, 48, 8, 0.10);
  --hit-glow: 0 0 26px rgba(213, 170, 0, 0.08);
}

html {
  background: var(--bg-primary);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  position: relative;
  background-color: var(--bg-primary);
  background-image:
    radial-gradient(circle at 18% 8%, rgba(255, 219, 32, 0.08), transparent 26rem),
    radial-gradient(circle at 82% 22%, rgba(255, 219, 32, 0.035), transparent 24rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.014), transparent 42%);
  background-attachment: fixed;
  color: var(--text-primary);
  letter-spacing: -0.012em;
  overflow-x: hidden;
}

/* Dotted "world map / network" texture from the HIT BIT references. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.34;
  background-image:
    radial-gradient(circle, rgba(255, 219, 32, 0.12) 1px, transparent 1.4px),
    radial-gradient(circle, rgba(255, 255, 255, 0.045) 1px, transparent 1.4px);
  background-size: 10px 10px, 10px 10px;
  background-position: 0 0, 5px 5px;
  mask-image:
    radial-gradient(ellipse at 8% 25%, #000 0 15%, transparent 35%),
    radial-gradient(ellipse at 92% 34%, #000 0 16%, transparent 36%),
    radial-gradient(ellipse at 56% 90%, #000 0 14%, transparent 32%);
  -webkit-mask-image:
    radial-gradient(ellipse at 8% 25%, #000 0 15%, transparent 35%),
    radial-gradient(ellipse at 92% 34%, #000 0 16%, transparent 36%),
    radial-gradient(ellipse at 56% 90%, #000 0 14%, transparent 32%);
}

.light body {
  background-image:
    radial-gradient(circle at 18% 8%, rgba(213, 170, 0, 0.10), transparent 26rem),
    radial-gradient(circle at 82% 22%, rgba(213, 170, 0, 0.05), transparent 24rem),
    linear-gradient(135deg, rgba(0, 0, 0, 0.018), transparent 42%);
}

body > div.max-w-screen-2xl {
  position: relative;
  z-index: 1;
  max-width: 1480px;
  padding-top: 24px;
  padding-bottom: 48px;
}

/* =========================
   HEADER / BRAND BAR
   ========================= */

header[x-show="showHeader"] {
  position: relative;
  min-height: 78px;
  padding: 14px 17px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background:
    linear-gradient(120deg, rgba(255, 219, 32, 0.035), transparent 30%),
    color-mix(in srgb, var(--bg-secondary) 94%, transparent);
  box-shadow: var(--hit-shadow), var(--hit-glow);
  backdrop-filter: blur(18px) saturate(120%);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  overflow: hidden;
}

header[x-show="showHeader"]::before {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -70px;
  top: -105px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 219, 32, 0.15), transparent 68%);
  pointer-events: none;
}

header[x-show="showHeader"]::after {
  content: "";
  position: absolute;
  inset: auto 18px 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), rgba(255, 219, 32, 0.16), transparent 82%);
}

header .w-9.h-9 {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(255, 219, 32, 0.30);
  background:
    linear-gradient(145deg, rgba(255, 219, 32, 0.16), rgba(255, 219, 32, 0.035));
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.06),
    0 0 28px rgba(255, 219, 32, 0.08);
}

header .w-9.h-9 img {
  width: 33px;
  height: 33px;
  object-fit: contain;
}

header h1 {
  margin: 0;
  font-size: 0;
  line-height: 1;
}

header h1::before {
  content: "HIT BIT VPN";
  display: block;
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.05;
}

header h1::after {
  content: "ПРЕМИУМ VPN СЕРВИС";
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
}

/* =========================
   BUTTONS / INPUTS
   ========================= */

.btn,
input,
select {
  border-radius: 12px !important;
}

.btn {
  border-color: var(--border);
  background: color-mix(in srgb, var(--bg-tertiary) 92%, transparent);
  color: var(--text-secondary);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035);
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-hover);
  background: var(--hover-bg);
  color: var(--text-primary);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

.btn:focus-visible,
input:focus-visible,
select:focus-visible,
.group-header:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 72%, transparent);
  outline-offset: 2px;
}

/* Common active-state classes used by the checker become HIT BIT yellow pills. */
.btn-active,
.btn.active,
[aria-pressed="true"] {
  border-color: var(--btn-active-border) !important;
  background: var(--btn-active-bg) !important;
  color: #17150b !important;
  box-shadow: 0 8px 24px rgba(255, 219, 32, 0.14);
}

/* =========================
   SUMMARY CARDS
   ========================= */

div[x-show="showStats"] {
  grid-template-columns: 1.25fr 1fr 1fr 1.25fr;
  gap: 11px;
}

div[x-show="showStats"] > .card {
  position: relative;
  min-height: 104px;
  padding: 19px 19px 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 219, 32, 0.025), transparent 48%),
    var(--bg-secondary);
  text-align: left;
  overflow: hidden;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.18);
}

div[x-show="showStats"] > .card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
  opacity: 0.35;
}

div[x-show="showStats"] > .card::after {
  content: "";
  position: absolute;
  width: 84px;
  height: 84px;
  right: -38px;
  bottom: -38px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 219, 32, 0.10), transparent 70%);
}

div[x-show="showStats"] > .card:nth-child(2)::before {
  background: var(--color-green);
  opacity: 1;
}

div[x-show="showStats"] > .card:nth-child(3)::before {
  background: var(--color-red);
  opacity: 1;
}

div[x-show="showStats"] > .card > div:first-child {
  font-size: clamp(1.55rem, 2.3vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.055em;
  line-height: 1;
}

div[x-show="showStats"] > .card > div:last-child {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

/* =========================
   SERVERS SECTION
   ========================= */

div[x-show="showServersHeader"] {
  min-height: 38px;
  margin-top: 32px;
  margin-bottom: 11px;
}

div[x-show="showServersHeader"] h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

div[x-show="showServersHeader"] h2::before {
  content: "";
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  box-shadow:
    0 0 0 5px rgba(255, 219, 32, 0.10),
    0 0 20px rgba(255, 219, 32, 0.18);
}

div[x-show="showServersHeader"] h2::after {
  content: "HIT BIT NETWORK";
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.13em;
}

div[x-show="showControls"] {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    linear-gradient(120deg, rgba(255, 219, 32, 0.03), transparent 34%),
    color-mix(in srgb, var(--bg-secondary) 91%, transparent);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.13);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

input,
select {
  min-height: 40px;
  border-color: var(--border) !important;
  background: var(--bg-tertiary) !important;
  color: var(--text-primary);
}

input::placeholder {
  color: var(--text-muted);
}

input:focus,
select:focus {
  border-color: color-mix(in srgb, var(--accent) 52%, transparent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 9%, transparent);
}

/* Filters */
.filter-all,
.filter-online,
.filter-offline {
  border-radius: 10px !important;
  font-weight: 700;
}

.filter-all:hover,
.filter-online:hover {
  border-color: rgba(255, 219, 32, 0.34);
  background: var(--filter-online-bg);
}

.filter-offline:hover {
  border-color: rgba(255, 98, 87, 0.34);
  background: var(--filter-offline-bg);
}

/* =========================
   GROUPS / PROXY CARDS
   ========================= */

div[x-show="showProxies"] {
  gap: 10px;
}

.group-header {
  min-height: 46px;
  margin-top: 12px;
  border-width: 0 0 1px;
  border-radius: 0 !important;
  border-color: var(--border);
  background: transparent;
  color: var(--text-primary);
  font-weight: 700;
}

.group-header:hover {
  background: linear-gradient(90deg, rgba(255, 219, 32, 0.065), transparent 76%);
}

.proxy-card {
  position: relative;
  min-height: 68px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 17px !important;
  background:
    linear-gradient(108deg, rgba(255, 219, 32, 0.022), transparent 34%),
    linear-gradient(105deg, var(--bg-secondary), var(--bg-tertiary));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14);
  overflow: hidden;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.proxy-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
  opacity: 0.28;
}

.proxy-card::after {
  content: "";
  position: absolute;
  inset: auto 15px 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 219, 32, 0.62), transparent);
  opacity: 0;
  transform: scaleX(0.5);
  transition: opacity 180ms ease, transform 180ms ease;
}

.proxy-card:hover {
  z-index: 1;
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow:
    0 20px 46px rgba(0, 0, 0, 0.24),
    0 0 26px rgba(255, 219, 32, 0.05);
}

.proxy-card:hover::after {
  opacity: 0.8;
  transform: scaleX(1);
}

.proxy-card:has(.status-online)::before {
  background: var(--accent);
  opacity: 1;
}

.proxy-card:has(.status-offline)::before {
  background: var(--color-red);
  opacity: 1;
}

.proxy-card:has(.status-offline) {
  border-color: rgba(255, 98, 87, 0.16);
  background:
    linear-gradient(108deg, rgba(255, 98, 87, 0.035), transparent 32%),
    linear-gradient(105deg, var(--bg-secondary), var(--bg-tertiary));
}

.proxy-card .text-sm.text-primary {
  font-size: 13px;
  font-weight: 720;
  letter-spacing: -0.018em;
}

.proxy-card .tabular-nums,
.group-header .tabular-nums {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
}

/* Protocol chips look like compact service tags. */
.proto-badge {
  padding: 2px 7px;
  border: 1px solid rgba(255, 219, 32, 0.16);
  border-radius: 999px;
  background: rgba(255, 219, 32, 0.06);
  color: var(--text-secondary);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.07em;
}

/* HIT BIT uses yellow as the main "alive / active" signal. */
.status-online,
.segment-good {
  background-color: var(--accent) !important;
  box-shadow: 0 0 14px rgba(255, 219, 32, 0.34);
}

.status-offline,
.segment-bad {
  box-shadow: 0 0 12px rgba(255, 98, 87, 0.28);
}

.latency-segment {
  width: 4px;
  border-radius: 999px;
}

.latency-segment:nth-child(1) { height: 3px; }
.latency-segment:nth-child(2) { height: 4px; }
.latency-segment:nth-child(3) { height: 5px; }
.latency-segment:nth-child(4) { height: 7px; }
.latency-segment:nth-child(5) { height: 9px; }

/* =========================
   FOOTER / TOASTS
   ========================= */

footer[x-show="showFooter"] {
  margin-top: 40px;
  padding-top: 17px;
  border-color: var(--border);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

.toast,
.badge-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 219, 32, 0.03), transparent 42%),
    color-mix(in srgb, var(--bg-secondary) 95%, transparent);
  box-shadow: var(--hit-shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

@keyframes hit-enter {
  from {
    opacity: 0;
    transform: translateY(9px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.proxy-card.animate {
  animation: hit-enter 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* =========================
   MOBILE
   ========================= */

@media (max-width: 767px) {
  body > div.max-w-screen-2xl {
    padding: 14px 12px 34px;
  }

  header[x-show="showHeader"] {
    min-height: 68px;
    margin-bottom: 14px;
    padding: 10px 11px;
    border-radius: 18px;
  }

  header .w-9.h-9 {
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }

  header h1 {
    max-width: 47vw;
  }

  header h1::before {
    font-size: 15px;
  }

  header h1::after {
    content: "ПРЕМИУМ VPN";
    margin-top: 5px;
    font-size: 8px;
  }

  div[x-show="showStats"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 18px;
  }

  div[x-show="showStats"] > .card {
    min-height: 84px;
    padding: 14px;
    border-radius: 15px;
  }

  div[x-show="showStats"] > .card > div:last-child {
    margin-top: 8px;
  }

  div[x-show="showServersHeader"] {
    margin-top: 24px;
  }

  div[x-show="showControls"] {
    padding: 8px;
    border-radius: 15px;
  }

  .proxy-card {
    min-height: 62px;
    border-radius: 15px !important;
  }

  .proxy-card:hover {
    transform: none;
  }
}

@media (max-width: 420px) {
  header .btn.h-9.px-3 {
    width: 38px;
    padding-left: 0;
    padding-right: 0;
    justify-content: center;
  }

  header .btn.h-9.px-3 span {
    display: none;
  }

  select {
    min-width: 92px !important;
    max-width: 104px;
  }

  .proxy-card .proto-badge {
    display: none;
  }

  div[x-show="showServersHeader"] h2::after {
    content: "NETWORK";
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .proxy-card:hover,
  .btn:hover {
    transform: none;
  }
}

@supports not (backdrop-filter: blur(1px)) {
  header[x-show="showHeader"],
  div[x-show="showControls"],
  .toast,
  .badge-card {
    background: var(--bg-secondary);
  }
}

header h1 {
  font-size: 0 !important;
}

header h1 > * {
  display: none !important;
}

header h1::before {
  content: "HIT BIT VPN";
  display: block;
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.18em;
  color: var(--text-primary);
}

header h1::after {
  content: "ПРЕМИУМ VPN СЕРВИС";
  display: block;
  margin-top: 8px;
  font-size: 9px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.18em;
  color: var(--text-muted);
}

/* =========================
   PING COLORS
   < 500ms     green
   500-999ms   yellow
   >= 1000ms   red
   ========================= */

.latency-good {
  color: #36d17c !important;
  text-shadow: 0 0 10px rgba(54, 209, 124, 0.22);
}

.latency-medium {
  color: #ffdb20 !important;
  text-shadow: 0 0 10px rgba(255, 219, 32, 0.20);
}

.latency-bad {
  color: #ff6257 !important;
  text-shadow: 0 0 10px rgba(255, 98, 87, 0.20);
}

/* Если в интерфейсе отображаются полоски latency */
.bar-good {
  background: #36d17c !important;
  box-shadow: 0 0 8px rgba(54, 209, 124, 0.28);
}

.bar-medium {
  background: #ffdb20 !important;
  box-shadow: 0 0 8px rgba(255, 219, 32, 0.26);
}

.bar-bad {
  background: #ff6257 !important;
  box-shadow: 0 0 8px rgba(255, 98, 87, 0.26);
}

/* =========================
   PING COLORS
   ========================= */

/* Текст пинга */
.latency-good {
  color: #36d17c !important;
}

.latency-medium {
  color: #ffdb20 !important;
}

.latency-bad {
  color: #ff6257 !important;
}

/* Точки / сегменты под пингом */
.segment-good {
  background: #36d17c !important;
  box-shadow: 0 0 8px rgba(54, 209, 124, 0.45);
}

.segment-medium {
  background: #ffdb20 !important;
  box-shadow: 0 0 8px rgba(255, 219, 32, 0.45);
}

.segment-bad {
  background: #ff6257 !important;
  box-shadow: 0 0 8px rgba(255, 98, 87, 0.45);
}

/* Пустые точки */
.latency-segment:not(.segment-good):not(.segment-medium):not(.segment-bad) {
  background: #2a291f !important;
  box-shadow: none;
}
