.pa-panel-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 999999998;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.pa-panel-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}
.pa-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 100vw;
  height: 100dvh;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  z-index: 999999999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--sh1);
  font-family: var(--font-body);
}
.pa-panel.visible {
  transform: translateX(0);
}
.pa-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pa-panel-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  color: var(--white);
}
.pa-panel-close {
  width: 30px;
  height: 30px;
  border-radius: var(--br-none);
  background: var(--bg-card-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray);
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.pa-panel-close svg {
  width: 14px;
  height: 14px;
}
.pa-panel-close:hover {
  background: var(--gray-dark);
  color: var(--white);
}
.pa-panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pa-panel-tab {
  flex: 1;
  padding: 13px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray);
  cursor: pointer;
  background: 0 0;
  border: none;
  text-align: center;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  font-family: var(--font-body);
}
.pa-panel-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.pa-panel-tab:hover:not(.active) {
  color: var(--gray-light);
}
.pa-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
}
.pa-panel-body::-webkit-scrollbar {
  width: 4px;
}
.pa-panel-body::-webkit-scrollbar-track {
  background: 0 0;
}
.pa-panel-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--br-none);
}
.pa-panel-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--card-gap-sm);
  flex-shrink: 0;
}
.pa-form-group {
  margin-bottom: 17px;
}
.pa-form-group.mt-8 {
  margin-top: 8px;
}
.pa-form-label {
  display: flex;
  align-items: center;
  gap: var(--card-gap-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-light);
  margin-bottom: 1rem;
}
.pa-btn {
  padding: 9px 20px;
  border-radius: var(--br-none);
  border: 1px solid var(--border);
  background: var(--bg-card-hover);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.pa-btn:hover {
  background: var(--gray-dark);
}
.pa-btn-cancel:hover {
  background: var(--gray-dark);
}
.pa-toast-wrap {
  position: fixed;
  bottom: 15px;
  right: 24px;
  z-index: 999999999;
  display: flex;
  flex-direction: column;
  gap: var(--card-gap-sm);
  max-width: 340px;
}
.pa-toast {
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--br-none);
  padding: 12px 14px;
  font-size: 0.8rem;
  color: var(--white);
  display: flex;
  align-items: flex-start;
  gap: var(--card-gap-sm);
  animation: paToastIn 0.25s ease;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  font-family: var(--font-body);
}
.pa-toast.removing {
  animation: paToastOut 0.2s ease forwards;
}
.pa-toast-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--accent);
}
.pa-toast-close {
  margin-left: auto;
  background: 0 0;
  border: none;
  color: var(--gray);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  display: flex;
  align-items: center;
}
.pa-toast-close svg {
  width: 13px;
  height: 13px;
}
.pa-toast-close:hover {
  color: var(--white);
}
@keyframes paToastIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes paToastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}
.pa-tab-panel {
  display: none;
}
.pa-tab-panel.active {
  display: block;
  animation: paFadeIn 0.2s ease;
}
@keyframes paFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.custom-theme-group {
  display: flex;
  gap: var(--card-gap-sm);
  margin-top: 1rem;
}
.custom-theme-card {
  position: relative;
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: var(--br-none);
  background: 0 0;
  padding: 5px;
  text-align: center;
  width: 90px;
  transition:
    border-color 0.2s,
    background 0.2s,
    box-shadow 0.2s;
  outline: 0;
  font-family: var(--font-body);
  color: var(--gray);
}
.custom-theme-card:hover {
  border-color: var(--gray-dim);
  color: var(--white);
}
.custom-theme-card:focus-visible {
  box-shadow: 0 0 0 2px var(--accent);
}
.custom-theme-card.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--white);
}
.custom-theme-thumb {
  width: 100%;
  height: 60px;
  padding: 4px;
  border-radius: calc(var(--br-none) - 5px);
  overflow: hidden;
  margin-bottom: 7px;
  position: relative;
}
.thumb-light {
  background: #d6d5d5;
}
.thumb-light .th-bar,
.thumb-light .th-bar2 {
  background: #8d8d8d;
  height: 5px;
  border-radius: var(--br-none);
  margin: 6px 6px 3px;
}
.thumb-light .th-bar2 {
  margin: 0 6px;
  width: 55%;
}
.thumb-light .th-block,
.thumb-light .th-block2 {
  position: absolute;
  bottom: 5px;
  width: 24px;
  height: 16px;
  background: #8d8d8d;
  border-radius: var(--br-none);
}
.thumb-light .th-block {
  left: 6px;
}
.thumb-light .th-block2 {
  right: 6px;
  width: 16px;
}
.thumb-dark {
  background:#242424;
}
.thumb-dark .th-bar,
.thumb-dark .th-bar2 {
  background: #575757;
  height: 5px;
  border-radius: var(--br-none);
  margin: 6px 6px 3px;
}
.thumb-dark .th-bar2 {
  margin: 0 6px;
  width: 55%;
}
.thumb-dark .th-block,
.thumb-dark .th-block2 {
  position: absolute;
  bottom: 5px;
  width: 24px;
  height: 16px;
  background: #575757;
  border-radius: var(--br-none);
}
.thumb-dark .th-block {
  left: 6px;
}
.thumb-dark .th-block2 {
  right: 6px;
  width: 16px;
}
.thumb-system {
  background: linear-gradient(90deg, var(--white-dim) 50%, var(--border) 50%);
}
.thumb-system .th-bar,
.thumb-system .th-bar2 {
  background: linear-gradient(90deg, var(--white-dim) 50%, var(--bg-card-hover) 50%);
  height: 5px;
  border-radius: var(--br-none);
  margin: 6px 6px 3px;
}
.thumb-system .th-bar2 {
  margin: 0 6px;
  width: 55%;
}
.custom-theme-radio {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--card-gap-sm);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray);
}
.custom-theme-card.active .custom-theme-radio {
  color: var(--white);
}
.custom-theme-radio .radio-dot {
  width: 13px;
  height: 13px;
  border-radius: var(--br-none);
  border: 1.5px solid var(--gray-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.custom-theme-card.active .radio-dot {
  border-color: var(--accent);
  background: var(--accent);
}
.radio-dot::after {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: var(--br-none);
  background: var(--bg-card);
  display: none;
}
.custom-theme-card.active .radio-dot::after {
  display: block;
}
.custom-color-row {
  display: flex;
  gap: var(--card-gap-md, 10px);
  align-items: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.custom-swatch {
  width: 42px;
  height: 42px;
  border-radius: var(--br-none);
  cursor: pointer;
  border: 2.5px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
  outline: 0;
  flex-shrink: 0;
}
.custom-swatch:hover {
  transform: scale(1.12);
}
.custom-swatch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.custom-swatch.active {
  box-shadow:
    0 0 0 2.5px var(--bg-card),
    0 0 0 4.5px currentColor;
}
.custom-swatch svg {
  display: none;
}
.custom-swatch.active svg {
  display: block;
}
.pa-orange {
  background: var(--accent-orange);
  color: var(--accent-orange);
}
.pa-pink {
  background: var(--accent-pink);
  color: var(--accent-pink);
}
.pa-green {
  background: var(--accent-green);
  color: var(--accent-green);
}
.pa-yellow {
  background: var(--accent-yellow);
  color: var(--accent-yellow);
}
.pa-blue {
  background: var(--accent-blue);
  color: var(--accent-blue);
}
.pa-purple {
  background: var(--accent-purple);
  color: var(--accent-purple);
}
.custom-font-size-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  border-radius: var(--br-none);
  overflow: hidden;
}
.custom-fs-seg {
  display: flex;
  height: 35px;
  width: 100%;
}
.custom-fs-btn {
  background: 0 0;
  border: none;
  color: var(--gray);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0 8px;
  height: 100%;
  width: 100%;
  cursor: pointer;
  transition:
    background 0.12s,
    color 0.12s;
  border-right: 1px solid var(--border);
  white-space: nowrap;
  outline: 0;
}
.custom-fs-btn:last-child {
  border-right: none;
}
.custom-fs-btn:hover {
  background: var(--bg-card);
  color: var(--white);
}
.custom-fs-btn:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent);
}
.custom-fs-btn.active {
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
}
.custom-cr-group {
  display: flex;
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  border-radius: var(--br-none);
  overflow: hidden;
  margin-top: 4px;
  flex-wrap: wrap;
}
.custom-cr-btn {
  flex: 1;
  background: 0 0;
  border: none;
  color: var(--gray);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0 10px;
  height: 35px;
  cursor: pointer;
  transition:
    background 0.12s,
    color 0.12s;
  border-right: 1px solid var(--border);
  white-space: nowrap;
  outline: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--card-gap-sm);
  min-width: 60px;
}
.custom-cr-btn:last-child {
  border-right: none;
}
.custom-cr-btn:hover {
  background: var(--bg-card);
  color: var(--white);
}
.custom-cr-btn:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent);
}
.custom-cr-btn.active {
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
}
.custom-cr-icon {
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-radius: var(--br-none);
  flex-shrink: 0;
  display: block;
  background: 0 0;
  transition: border-radius 0.2s ease;
}
.rad-0 .custom-cr-icon {
  border-radius: 0;
}
.rad-sm .custom-cr-icon {
  border-radius: 4px;
}
.rad-md .custom-cr-icon {
  border-radius: 6px;
}
.rad-lg .custom-cr-icon {
  border-radius: 10px;
}
html.theme-light .pa-panel {
  box-shadow: var(--sh3);
}
html.theme-light .thumb-light {
  border: 1px solid var(--border);
}
@media (max-width: 540px) {
  .pa-panel {
    width: 100vw;
  }
  .custom-theme-card {
    width: auto;
    flex: 1;
  }
}
.custom-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--card-gap-sm);
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.custom-toggle-row:last-child {
  border-bottom: none;
}
.custom-toggle-text {
  display: flex;
  flex-direction: column;
  gap: var(--card-gap-sm);
}
.custom-toggle-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--white);
}
.custom-toggle-desc {
  font-size: 0.72rem;
  color: var(--gray);
  line-height: 1.4;
}
.custom-toggle-switch {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 22px;
  border-radius: var(--br-none);
  border: 1px solid var(--border);
  background: var(--bg-card-hover);
  cursor: pointer;
  padding: 0;
  transition:
    background 0.18s ease,
    border-color 0.18s ease;
  outline: 0;
}
.custom-toggle-switch:focus-visible {
  box-shadow: 0 0 0 2px var(--accent-dim);
}
.custom-toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: var(--br-none);
  background: var(--gray);
  transition:
    transform 0.18s ease,
    background 0.18s ease;
}
.custom-toggle-switch.on {
  background: var(--accent-dim);
  border-color: var(--accent-dimmer);
}
.custom-toggle-switch.on::after {
  transform: translateX(18px);
  background: var(--accent);
}
.custom-speed-seg .custom-fs-btn {
  font-size: 0.68rem;
}
#customSpeedGroup.disabled {
  opacity: 0.45;
  pointer-events: none;
}
