:root {
  --bg: #020617;
  --panel: rgba(15, 23, 42, 0.94);
  --panel-2: rgba(12, 18, 33, 0.96);
  --text: #f9fafb;
  --muted: #9ca3af;
  --accent: #60a5fa;
  --accent-2: #a7f3d0;
  --danger: #fb7185;
  --border: rgba(148, 163, 184, 0.16);
  --radius: 18px;
  --radius-sm: 12px;
  -webkit-tap-highlight-color: transparent;
}

@keyframes auroraShift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(0, -18px, 0) scale(1.03);
  }
  100% {
    transform: translate3d(0, 18px, 0) scale(1.05);
  }
}

@keyframes floatInSoft {
  0% {
    opacity: 0;
    transform: translate3d(0, 12px, 0) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes dotPulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 10px var(--accent);
    opacity: 0.95;
  }
  50% {
    transform: scale(1.2);
    box-shadow: 0 0 18px var(--accent);
    opacity: 1;
  }
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.6) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.45);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.75);
}
*::-webkit-scrollbar-corner {
  background: transparent;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, system-ui, BlinkMacSystemFont, "SF Pro Text",
    sans-serif;
  background: radial-gradient(
      1200px 900px at -10% 0%,
      rgba(96, 165, 250, 0.28),
      transparent 60%
    ),
    radial-gradient(
      1100px 800px at 110% 0%,
      rgba(45, 212, 191, 0.24),
      transparent 60%
    ),
    radial-gradient(
      900px 900px at 50% 120%,
      rgba(244, 114, 182, 0.22),
      transparent 65%
    ),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 24px;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: -20%;
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(
      1200px 900px at -10% 0%,
      rgba(96, 165, 250, 0.4),
      transparent 60%
    ),
    radial-gradient(
      1100px 800px at 110% 0%,
      rgba(45, 212, 191, 0.32),
      transparent 60%
    ),
    radial-gradient(
      900px 900px at 50% 120%,
      rgba(244, 114, 182, 0.3),
      transparent 65%
    );
  filter: blur(2px);
  opacity: 0.9;
  animation: auroraShift 26s ease-in-out infinite alternate;
}

.body-output {
  display: grid;
  gap: 12px;
}

.output-toolbar {
  align-items: center;
}

.output-actions {
  padding-top: 0;
}

.output-toolbar .status {
  padding-top: 0;
}

body.rtl {
  direction: rtl;
}

body.rtl .brand-action {
  flex-direction: row-reverse;
}

body.rtl .brand-actions,
body.rtl .brand-inner,
body.rtl .row,
body.rtl .section-title,
body.rtl .section-heading {
  direction: rtl;
}
body.rtl .lang-menu {
  left: auto;
  right: 0;
}

.brand-header {
  width: min(1200px, 100%);
  margin: 0 auto 18px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(148, 163, 184, 0.08);
  background: linear-gradient(
      180deg,
      rgba(15, 23, 42, 0.96),
      rgba(15, 23, 42, 0.78)
    ),
    radial-gradient(circle at 0 0, rgba(148, 163, 184, 0.16), transparent 60%);
  box-shadow: 0 18px 55px rgba(15, 23, 42, 0.95),
    0 0 0 1px rgba(15, 23, 42, 0.9) inset;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  opacity: 0;
  transform: translate3d(0, 12px, 0) scale(0.98);
  animation: floatInSoft 0.55s ease-out forwards;
  animation-delay: 0.05s;

  position: relative;
  z-index: 50;
}

.brand-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 auto;
  min-width: 0;
}

.brand-logo {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  image-rendering: auto;
  -ms-interpolation-mode: bicubic;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.brand-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.3px;
  line-height: 1.1;
  color: var(--text);
  text-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.brand-subtitle {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.brand-action {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: radial-gradient(
    circle at 0 0,
    rgba(96, 165, 250, 0.32),
    rgba(15, 23, 42, 0.96)
  );
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 120ms ease, border-color 120ms ease,
    background-color 120ms ease, box-shadow 120ms ease;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6);
}

.brand-action-label {
  display: inline-block;
  font-size: 18px;
  line-height: 1;
}

.brand-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.lang-control {
  position: relative;
  flex: 0 0 auto;
}

.lang-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: radial-gradient(
    circle at 20% 20%,
    rgba(96, 165, 250, 0.32),
    rgba(15, 23, 42, 0.96)
  );
  color: var(--text);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.2px;
  cursor: pointer;
  padding: 7px 11px;
  transition: transform 120ms ease, box-shadow 120ms ease,
    border-color 120ms ease, background 120ms ease;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}

@media (max-width: 700px) {
  .lang-button {
    width: auto;
    height: auto;
    font-size: 13px;
    border-radius: 999px;
  }
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 180px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid rgba(148, 163, 184, 0.14);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.7);
  padding: 6px;
  z-index: 999;
  backdrop-filter: blur(18px) saturate(140%);

  opacity: 0;
  transform: translate3d(0, 6px, 0) scale(0.98);
  pointer-events: none;
  transition: opacity 0.16s ease-out,
    transform 0.18s cubic-bezier(0.16, 0.82, 0.29, 0.99),
    box-shadow 0.16s ease-out, border-color 0.16s ease-out;
}

.lang-menu.open {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  pointer-events: auto;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.9);
  border-color: rgba(148, 163, 184, 0.2);
}

.lang-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: transparent;
  border: none;
  color: var(--text);
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease, box-shadow 120ms ease;
  text-align: left;
}

.lang-current-flag,
.lang-flag {
  font-size: 18px;
  display: inline-block;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji",
    "Twemoji Mozilla", "EmojiOne Color", system-ui, sans-serif;
}

img.emoji {
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.18em;
}

.lang-prefix {
  font-size: 18px;
  display: inline-block;
}

@media (max-width: 700px) {
  .lang-prefix {
    font-size: 13px;
  }
}

.lang-name {
  font-size: 14px;
  color: var(--text);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (hover: hover) and (pointer: fine) {
  .brand-action:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: radial-gradient(
      circle at 0 0,
      rgba(96, 165, 250, 0.36),
      rgba(15, 23, 42, 0.99)
    );
    transform: translateY(-1px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
  }

  .lang-button:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.75);
    background: radial-gradient(
      circle at 20% 15%,
      rgba(129, 199, 255, 0.38),
      rgba(15, 23, 42, 0.98)
    );
  }

  .lang-option:hover {
    background: rgba(96, 165, 250, 0.16);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.8);
  }
}

.brand-action:active {
  transform: translateY(0) scale(0.97);
}

.lang-button:active {
  transform: translateY(0) scale(0.97);
}

.brand-action-icon {
  display: block;
  width: 20px;
  height: 20px;
  filter: invert(1) drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
}

@media (max-width: 700px) {
  .brand-header {
    margin: 0 auto 12px;
    padding: 10px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .brand-logo {
    width: 52px;
    height: 52px;
  }
  .brand-title {
    font-size: 20px;
  }
  .brand-subtitle {
    font-size: 12px;
  }
  .brand-action {
    padding: 8px;
    font-size: 13px;
    gap: 0;
  }
  .brand-action-icon {
    width: 18px;
    height: 18px;
  }
  .brand-action-label {
    font-size: 13px;
    padding-left: 7px;
    padding-right: 2px;
  }
  .brand-actions {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
}

.app {
  width: min(1200px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  align-items: start;
  margin: 0 auto 32px;
}

@media (max-width: 1000px) {
  .app {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 768px) {
  .app {
    width: 100%;
    margin: 0;
  }
  .card {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  }
}

.card,
.card-yaml {
  background: var(--panel);
  border: 1px solid rgba(148, 163, 184, 0.08);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.9),
    0 0 0 1px rgba(15, 23, 42, 0.95) inset;
  overflow: hidden;
  backdrop-filter: blur(20px) saturate(150%);
  opacity: 0;
  transform: translate3d(0, 12px, 0) scale(0.985);
  animation: floatInSoft 0.55s ease-out forwards;
  animation-delay: 0.12s;
  transition: transform 0.18s ease-out, box-shadow 0.18s ease-out,
    border-color 0.16s ease-out;
}

.card-yaml {
  animation-delay: 0.18s;
}

@media (hover: hover) and (pointer: fine) {
  .card:hover,
  .card-yaml:hover {
    transform: translate3d(0, -2px, 0) scale(1.01);
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.95);
    border-color: rgba(30, 64, 175, 0.7);
  }
}

.card:hover .header,
.card-yaml:hover .header {
  border-bottom-color: rgba(148, 163, 184, 0.18);
}

.header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(
    180deg,
    rgba(249, 250, 251, 0.05),
    rgba(15, 23, 42, 0.96)
  );
}

.header-secondary {
  background: linear-gradient(
    180deg,
    rgba(187, 247, 208, 0.08),
    rgba(15, 23, 42, 0.96)
  );
  border-bottom-color: rgba(148, 163, 184, 0.08);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  flex: 0 0 auto;
  animation: dotPulse 2.6s ease-in-out infinite;
}

h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.2px;
}
h2 {
  font-size: 15px;
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.body {
  padding: 16px 14px 14px;
}

.stack {
  display: grid;
  gap: 18px;
}

.section {
  border-radius: var(--radius-sm);
  padding: 13px 12px 12px;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.02),
    rgba(15, 23, 42, 0.96)
  );
  display: grid;
  gap: 13px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(148, 163, 184, 0.06);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0 4px;
}

textarea {
  width: 100%;
  min-height: 220px;
  resize: none;
  background: rgba(15, 23, 42, 0.86);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font-size: 13px;
  line-height: 1.5;
  outline: none;
  backdrop-filter: blur(18px);
}
textarea.small {
  min-height: 140px;
}
textarea:focus {
  border-color: rgba(56, 189, 248, 0.9);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.55),
    0 0 24px rgba(56, 189, 248, 0.35);
}

input[type="text"],
input[type="url"],
select {
  width: 100%;
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 13px;
  outline: none;
  backdrop-filter: blur(18px);
}

input[type="text"]:focus,
input[type="url"]:focus,
select:focus {
  border-color: rgba(56, 189, 248, 0.9);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.45),
    0 0 14px rgba(56, 189, 248, 0.3);
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.row > * {
  flex: 1 1 auto;
}
.row.tight {
  gap: 6px;
}
.row.tight input {
  flex: 1 1 0;
}
.row.tight .pill {
  flex: 0 0 auto;
}
#geositeStatus,
#geoipStatus {
  min-width: 90px;
  text-align: center;
}

.rule-card,
.item {
  min-width: 0;
}

.rule-title,
.rule-name,
.rule-meta strong {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.group-card,
.rules-column,
.rules-grid,
.listbox {
  min-width: 0;
}

.row.between {
  justify-content: space-between;
}
.row.nowrap {
  flex-wrap: nowrap;
}

@media (max-width: 768px) {
  .row.nowrap {
    flex-wrap: wrap;
  }
}

button {
  appearance: none;
  border-radius: 999px;
  border: 1px solid transparent;
  background: radial-gradient(
    circle at 20% 0%,
    rgba(255, 255, 255, 0.05),
    rgba(15, 23, 42, 0.98)
  );
  color: var(--text);
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease,
    border-color 0.16s ease, background 0.16s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
}

@media (hover: hover) and (pointer: fine) {
  button:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.08);
    background: radial-gradient(
      circle at 20% 0%,
      rgba(255, 255, 255, 0.08),
      rgba(15, 23, 42, 1)
    );
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.8);
  }
}

button:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.7);
}

.primary {
  background: linear-gradient(135deg, #4f9dff, #6366f1);
  border-color: transparent;
  box-shadow: 0 18px 40px rgba(59, 130, 246, 0.6),
    0 0 0 1px rgba(129, 140, 248, 0.6);
  font-weight: 600;
}

.good {
  color: var(--accent-2);
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow: 0 0 18px rgba(22, 163, 74, 0.35);
}
.danger {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.5);
}

.ghost {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(148, 163, 184, 0.16);
  color: var(--muted);
}

pre {
  margin: 0;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font-size: 13px;
  line-height: 1.5;
  min-height: 320px;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.8);
}

pre#output {
  height: 320px;
  overflow: auto;
}

pre#output[data-placeholder="true"] {
  color: #757575;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  background: radial-gradient(
      circle at 0 0,
      rgba(148, 163, 184, 0.08),
      transparent 55%
    ),
    rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 12px;
  font-size: 13px;
}
.switch {
  position: relative;
  width: 50px;
  height: 30px;
  flex: 0 0 auto;
  direction: ltr;
}
body.rtl .switch {
  direction: ltr;
}
.switch > input[type="checkbox"] {
  position: absolute;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background: transparent !important;
  border: 0 !important;
  outline: 0 !important;
}
.track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #020617, #020617);
  border: 1px solid rgba(37, 99, 235, 0.7);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 1) inset, 0 0 0 1px rgba(15, 23, 42, 1),
    0 0 10px rgba(15, 23, 42, 0.9);
  transition: 0.2s;
  z-index: 1;
}
.thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #e5efff;
  transition: 0.2s;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.75);
}
.track.is-on {
  background: radial-gradient(circle at 0 0, #1e293b, #020617);
  border-color: rgba(59, 130, 246, 1);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.9), 0 0 16px rgba(59, 130, 246, 0.9);
}

.track.is-on .thumb {
  transform: translateX(20px);
  background: #bbf7d0;
  box-shadow: 0 3px 12px rgba(34, 197, 94, 0.85);
}

.track,
.thumb {
  transform: translateZ(0);
  will-change: transform;
}

.listbox {
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.92);
  padding: 9px 9px;
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  gap: 9px;
  font-size: 13px;
  overscroll-behavior: contain;
  backdrop-filter: blur(14px) saturate(140%);
}

.item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: 0.15s;
}

@media (hover: hover) and (pointer: fine) {
  .item:hover {
    background: rgba(15, 23, 42, 0.96);
    border-color: rgba(148, 163, 184, 0.16);
  }
}

.item label {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  cursor: pointer;
}
.item small {
  color: var(--muted);
  text-wrap: auto;
  overflow-wrap: anywhere;
}

#subsList .item label {
  display: grid;
  align-items: center;
  gap: 10px;
  grid-auto-flow: column;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  outline: none;
  background: transparent;
  grid-template-columns: 1fr auto auto;
}

#subsList .item label > div {
  min-width: 0;
}
#subsList .item label > div small {
  word-break: break-all;
}

#subsList .item select[data-sub-proxy-mode],
#subsList .item button[data-sub-del],
#subsList .item input[data-sub-skipcert] {
  width: auto;
  justify-self: end;
}

@media (max-width: 768px) {
  #subsList .item label {
    grid-auto-flow: row;
    grid-template-columns: 1fr;
    justify-items: stretch;
    align-items: start;
  }

  #subsList .item label > div {
    text-align: center;
    justify-self: stretch;
  }

  #subsList .item select[data-sub-proxy-mode] {
    width: 100%;
    justify-self: stretch;
  }

  #subsList .item button[data-sub-del] {
    width: 100%;
    justify-self: stretch;
    text-align: center;
  }
}

.pill {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
}

.group-card {
  border: 1px solid rgba(148, 163, 184, 0.1);
  background: linear-gradient(
    180deg,
    rgba(15, 23, 42, 0.96),
    rgba(15, 23, 42, 0.88)
  );
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(14px) saturate(140%);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 700px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

.quick-rule {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
}
.quick-rule select {
  width: auto;
  min-width: 150px;
}
.rule-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(51, 65, 85, 0.75);
  background: #020617;
  color: var(--muted);
}
.rule-pill.ok {
  color: var(--accent-2);
  border-color: rgba(34, 197, 94, 0.75);
}
.rule-pill.block {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.8);
}
.rule-pill.proxy {
  color: var(--accent);
  border-color: rgba(59, 130, 246, 0.75);
}

.status {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 5px;
}
.status .pill {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(51, 65, 85, 0.75);
  background: #020617;
  color: var(--muted);
}
.status.ok .pill {
  color: var(--accent-2);
  border-color: rgba(34, 197, 94, 0.75);
}
.status.err .pill {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.8);
}

.rule-item {
  position: relative;
  display: grid;
  padding: 11px 12px 13px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: linear-gradient(
    180deg,
    rgba(10, 16, 32, 0.9),
    rgba(5, 8, 20, 0.96)
  );
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  transition: 0.2s ease;
  cursor: default;
  width: 100%;
}

@media (hover: hover) and (pointer: fine) {
  .rule-item:hover {
    border-color: rgba(148, 163, 184, 0.26);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
    background: linear-gradient(
      180deg,
      rgba(12, 18, 36, 0.95),
      rgba(6, 10, 22, 0.98)
    );
  }
}

.rule-item.is-active {
  border-color: rgba(59, 130, 246, 0.9);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.4),
    0 14px 42px rgba(37, 99, 235, 0.5);
  background: linear-gradient(
    180deg,
    rgba(10, 23, 46, 0.98),
    rgba(7, 13, 28, 1)
  );
}
.rule-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}
.rule-kind {
  background: rgba(59, 130, 246, 0.18);
  color: var(--accent);
  border-color: rgba(59, 130, 246, 0.45);
}
.rule-name {
  display: flex;
  align-items: center;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: normal;
  line-height: 1.4;
  min-width: 0;
  flex: 1 1 auto;
  position: relative;
  color: var(--text);
  text-wrap: auto;
}
.rule-name mark {
  display: inline;
}
.rule-name:hover::after {
  content: attr(data-full);
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  background: rgba(10, 16, 32, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  padding: 8px 10px;
  white-space: normal;
  max-width: 420px;
  color: var(--text);
  z-index: 5;
}
.rule-actions {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.rule-actions select[data-action] {
  min-width: 100%;
}
.rule-actions .target-select {
  min-width: 100%;
}
.rule-actions .target-select.is-hidden {
  display: none !important;
}

.show-more-btn {
  margin-top: 8px;
  width: 100%;
  justify-content: center;
  font-size: 12px;
  padding-block: 7px;
}

.icon-btn {
  padding: 0;
  width: 20px;
  height: 20px;
  font-size: 10px;
  line-height: 1;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border-color: rgba(248, 113, 113, 0.4);
  color: var(--muted);
  background: transparent;
  position: static;
}

@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover {
    color: var(--danger);
    background: rgba(248, 113, 113, 0.1);
  }
}

.footer {
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(15, 23, 42, 0.9);
  color: var(--muted);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
}
.section-heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}
@media (max-width: 900px) {
  .rules-grid {
    grid-template-columns: 1fr;
  }
}
.rules-column {
  display: grid;
  gap: 10px;
}
.rules-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.rules-head .title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.soft-hint {
  color: var(--muted);
  font-size: 12px;
}
.rules-toolbar {
  display: grid;
  gap: 8px;
}
.rules-toolbar .row {
  align-items: flex-start;
}
.match-card {
  display: grid;
  gap: 12px;
}
.match-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.match-title {
  font-weight: 600;
  font-size: 16px;
}
.match-control {
  display: grid;
  gap: 6px;
  min-width: 240px;
}
.match-control select {
  min-width: 240px;
}

mark {
  background: rgba(59, 130, 246, 0.2);
  color: var(--text);
  padding: 0 2px;
  border-radius: 4px;
}

.empty-state {
  padding: 14px 12px;
  border: 1px dashed rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  background: rgba(10, 16, 32, 0.7);
}

#manualRuleTarget.is-hidden {
  display: none !important;
}

#rulesOrderList {
  padding: 8px;
  display: grid;
  gap: 8px;
}

.rule-order-item {
  display: grid;
  grid-template-columns: minmax(0, 2fr) auto;
  column-gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: linear-gradient(
    180deg,
    rgba(10, 16, 32, 0.92),
    rgba(5, 8, 20, 0.97)
  );
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    background 0.15s ease, transform 0.1s ease;
}

@media (hover: hover) and (pointer: fine) {
  .rule-order-item:hover {
    border-color: rgba(148, 163, 184, 0.3);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.75);
    background: linear-gradient(
      180deg,
      rgba(14, 22, 42, 0.96),
      rgba(7, 11, 24, 0.99)
    );
  }
}

.rule-order-item.rule-order-match {
  border-color: rgba(59, 130, 246, 0.9);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.55),
    0 12px 34px rgba(37, 99, 235, 0.5);
  background: radial-gradient(circle at 0 0, #0b172b, #050814);
}

.rule-order-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.rule-order-main .pill {
  flex: 0 0 auto;
}

.rule-order-label {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rule-order-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.rule-order-actions .move-down {
  order: 1;
}
.rule-order-actions .move-bottom {
  order: 2;
}
.rule-order-actions .move-top {
  order: 3;
}
.rule-order-actions .move-up {
  order: 4;
}

.rule-order-actions .icon-btn {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: rgba(148, 163, 184, 0.45);
  background: radial-gradient(circle at 30% 20%, #1e293b, #020617);
  color: var(--muted);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}

@media (hover: hover) and (pointer: fine) {
  .rule-order-actions .icon-btn:hover {
    border-color: rgba(59, 130, 246, 0.9);
    color: var(--accent);
    background: radial-gradient(circle at 30% 20%, #1e293b, #020617);
    transform: translateY(-1px);
  }
}

@media (max-width: 600px) {
  .rule-order-item {
    grid-template-columns: 1fr;
    row-gap: 6px;
  }

  .rule-order-actions {
    justify-content: flex-start;
  }

  .rule-order-actions .move-up {
    order: 1;
  }
  .rule-order-actions .move-top {
    order: 2;
  }
  .rule-order-actions .move-bottom {
    order: 3;
  }
  .rule-order-actions .move-down {
    order: 4;
  }
}

@media (min-width: 1000px) and (min-height: 800px) {
  .card-yaml {
    position: sticky;
    top: 24px;
    align-self: flex-start;
  }
}

@media (hover: hover) and (pointer: fine) {
  .primary:hover {
    transform: translateY(-1px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand-header,
  .card,
  .card-yaml {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  body::before {
    animation: none !important;
  }

  .lang-menu {
    transition: none !important;
  }
}

#manualRulesList .rule-item {
  position: relative;
  display: block;
  padding-right: 40px;
}

#manualRulesList .rule-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#manualRulesList .rule-name {
  flex: 1 1 auto;
  min-width: 0;
}

#manualRulesList .rule-actions {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

#manualRulesList .icon-btn {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  margin: 0;
}

@media (max-width: 600px) {
  #manualRulesList .rule-item {
    padding-right: 12px;
  }

  #manualRulesList .rule-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  #manualRulesList .icon-btn {
    top: 11px;
    right: 10px;
    transform: none;
  }

  #manualRulesList .rule-name {
    width: 100%;
    white-space: normal;
  }

  #manualRulesList .rule-actions {
    margin-top: 10px;
  }
}
