.rules-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.rules-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.rules-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .1);
  color: var(--muted);
  transition: border-color .15s ease;
}

.rules-search:focus-within {
  border-color: rgba(255, 48, 48, .4);
}

.rules-search i {
  font-size: 13px;
}

.rules-search input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: "Kanit", sans-serif;
  font-size: 14px;
  width: 200px;
}

.rules-search input::placeholder {
  color: var(--muted);
}

.rules-empty {
  text-align: center;
  color: var(--muted);
  padding: 50px 0;
}

.rule-card {
  position: relative;
}

.rule-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.rule-card-head b {
  margin-bottom: 0;
}

.rule-updated {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  padding: 4px 10px;
  border-radius: 999px;
}

.rule-edit-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  color: var(--muted);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}

.rule-edit-btn:hover {
  color: #fff;
  border-color: rgba(255, 48, 48, .35);
}

.rule-modal-ov {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4, 5, 7, .72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.rule-modal-ov.active {
  opacity: 1;
  pointer-events: auto;
}

.rule-modal {
  width: min(640px, calc(100% - 32px));
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.rule-modal-body {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rule-modal-body label {
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
}

.rule-modal-body input,
.rule-modal-body textarea {
  width: 100%;
  padding: 13px 15px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .1);
  color: var(--text);
  font-family: "Kanit", sans-serif;
  font-size: 16px;
  resize: vertical;
}

.rule-modal-body textarea {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .22) transparent;
}

.rule-modal-body textarea::-webkit-scrollbar {
  width: 6px;
}

.rule-modal-body textarea::-webkit-scrollbar-track {
  background: transparent;
}

.rule-modal-body textarea::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .2);
  border-radius: 10px;
}

.rule-modal-body textarea::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, .32);
}

.rule-modal-body input:focus,
.rule-modal-body textarea:focus {
  outline: none;
  border-color: rgba(255, 48, 48, .4);
}

.rule-modal-err {
  color: #ff7676;
  font-size: 13px;
}

.rule-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.rule-tb-btn {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .1);
  color: var(--muted);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}

.rule-tb-btn:hover {
  color: #fff;
  border-color: rgba(255, 48, 48, .35);
}

.rule-tb-hint {
  font-size: 11px;
  color: var(--muted);
}

.rule-mark {
  background: rgba(255, 48, 48, .28);
  color: #fff;
  padding: 0 3px;
  border-radius: 4px;
}

[data-tip] {
  position: relative;
}

[data-tip]::after,
[data-tip]::before {
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}

[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 9px);
  left: 50%;
  transform: translate(-50%, 3px);
  background: #0c0e12;
  border: 1px solid rgba(255, 255, 255, .1);
  color: var(--text);
  font-size: 11px;
  font-family: "Kanit", sans-serif;
  padding: 5px 9px;
  border-radius: 7px;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .35);
  z-index: 20;
}

[data-tip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translate(-50%, 3px);
  border: 5px solid transparent;
  border-top-color: #0c0e12;
  z-index: 20;
}

[data-tip]:hover::after,
[data-tip]:hover::before {
  opacity: 1;
  transform: translate(-50%, 0);
}

.rule-tb-group {
  position: relative;
  display: flex;
}

.rule-tb-colors {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  display: flex;
  gap: 7px;
  padding: 8px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity .15s ease, transform .15s ease;
  z-index: 15;
}

.rule-tb-colors.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.rule-tb-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--dot);
  border: 1px solid rgba(255, 255, 255, .3);
  cursor: pointer;
  padding: 0;
  transition: transform .12s ease;
}

.rule-tb-dot:hover {
  transform: scale(1.18);
}

.rule-tb-linkbox {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity .15s ease, transform .15s ease;
  z-index: 15;
}

.rule-tb-linkbox.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.rule-tb-linkbox input {
  width: 220px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .12);
  color: var(--text);
  font-family: "Kanit", sans-serif;
  font-size: 13px;
  outline: none;
}

.rule-tb-linkbox input:focus {
  border-color: rgba(255, 48, 48, .4);
}

.rule-tb-linkgo {
  color: #7cffa0;
  border-color: rgba(60, 220, 130, .3);
}

.rule-tb-linkgo:hover {
  color: #fff;
  border-color: rgba(60, 220, 130, .5);
}

.rule-link {
  color: #5cb3ff;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.rule-link:hover {
  color: #8cccff;
}

.rule-scroll {
  display: inline-block;
  width: 160px;
  overflow-x: hidden;
  white-space: nowrap;
  vertical-align: bottom;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 6px;
  padding: 0 6px;
  cursor: grab;
  user-select: none;
}

.rule-scroll.dragging {
  cursor: grabbing;
}

.rule-scroll-inner {
  display: inline-block;
  white-space: nowrap;
}

.rule-modal-body .btn {
  margin-top: 10px;
  width: 100%;
}
