/* Decorative backgrounds stay static in every mode. */
.license-gate::before,
.license-brand,
.sidebar::before,
.sidebar-status-panel::before,
.codx-workbench::before,
.codx-workbench::after,
.page[data-page="dashboard"],
.dashboard-top-card,
.dashboard-top-card::before,
.dashboard-hot-row,
.dist-seg::after,
[data-theme="sakura"] body::before,
[data-theme="sakura"] .sidebar::before,
[data-theme="simon-star"] body,
[data-theme="simon-star"] body::before,
[data-theme="simon-star"] body::after,
[data-theme="simon-star"] .layout::after,
[data-theme="simon-star"] .sidebar::before,
[data-theme="midnight"] .layout::after {
  animation: none !important;
}

.sidebar-power-mode {
  width: 100%;
  min-height: 50px;
  margin-top: auto;
  margin-bottom: 10px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 9px;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent);
  border-radius: 12px;
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--card) 64%, transparent);
  cursor: pointer;
  user-select: none;
}

.sidebar-power-mode:hover,
.sidebar-power-mode:focus-within {
  border-color: color-mix(in srgb, var(--primary) 34%, transparent);
  color: var(--text);
}

.sidebar-power-mode.is-active {
  border-color: color-mix(in srgb, var(--primary) 42%, transparent);
  background: color-mix(in srgb, var(--primary) 9%, var(--card));
}

.sidebar-power-mode,
.sidebar-power-mode:hover,
.sidebar-power-mode:focus-within,
.sidebar-power-mode.is-active,
.sidebar-power-icon,
.sidebar-power-copy strong,
.sidebar-power-copy small,
.sidebar-power-track,
.sidebar-power-track::before {
  box-shadow: none !important;
  filter: none !important;
  text-shadow: none !important;
}

.sidebar-power-icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.sidebar-power-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.sidebar-power-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-power-copy strong,
.sidebar-power-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-power-copy strong {
  color: var(--text);
  font-size: 12px;
  line-height: 1.3;
  font-weight: 700;
}

.sidebar-power-copy small {
  color: var(--sub);
  font-size: 10px;
  line-height: 1.2;
}

.sidebar-power-mode.is-active .sidebar-power-copy small {
  color: var(--primary);
}

.sidebar-power-switch {
  position: relative;
  width: 42px;
  height: 24px;
  display: block;
}

.sidebar-power-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.sidebar-power-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sub) 30%, transparent);
  transition: background-color 160ms ease;
}

.sidebar-power-track::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.24);
  transition: transform 160ms ease;
}

.sidebar-power-switch input:checked + .sidebar-power-track {
  background: var(--primary);
}

.sidebar-power-switch input:checked + .sidebar-power-track::before {
  transform: translateX(18px);
}

.sidebar-power-switch input:focus-visible + .sidebar-power-track {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.sidebar-power-mode + .sidebar-status-panel {
  margin-top: 0 !important;
}

/* Low-power mode removes compositor-heavy effects while keeping the layout intact. */
html[data-low-power="true"] *,
html[data-low-power="true"] *::before,
html[data-low-power="true"] *::after {
  animation: none !important;
  transition-duration: 0.001ms !important;
  transition-delay: 0ms !important;
  scroll-behavior: auto !important;
}

html[data-low-power="true"] * {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background-attachment: scroll !important;
  filter: none !important;
  mix-blend-mode: normal !important;
  box-shadow: none !important;
  text-shadow: none !important;
  will-change: auto !important;
}

html[data-low-power="true"] :where(
  .brand,
  .license-brand,
  .dashboard-kpi-icon,
  .codx-product-icon,
  .trae-product-icon
) {
  filter: none !important;
  text-shadow: none !important;
}

html[data-low-power="true"] .license-gate::before,
html[data-low-power="true"] body::before,
html[data-low-power="true"] body::after,
html[data-low-power="true"] .layout::after,
html[data-low-power="true"] .sidebar::before,
html[data-low-power="true"] .sidebar::after,
html[data-low-power="true"] .codx-workbench::before,
html[data-low-power="true"] .codx-workbench::after,
html[data-low-power="true"] .dashboard-top-card::before,
html[data-low-power="true"] .dashboard-top-card::after,
html[data-low-power="true"] .dashboard-kpi-orb {
  display: none !important;
}

html[data-low-power="true"] :where(
  .card,
  .settings-box,
  .progress-wrap,
  .dashboard-overview-box,
  .dashboard-top-card,
  .workspace-summary-card,
  .dashboard-detail-card,
  .account-row,
  .account-card,
  .modal-box,
  .skin-picker-panel,
  .codx-tools-panel
) {
  box-shadow: none !important;
}

html[data-low-power="true"] :where(
  .tools-stage,
  .tools-catalog,
  .tools-recent-strip,
  .model-ranking-table,
  .model-source-strip,
  .model-insight-cell,
  .model-api-panel
) {
  background: color-mix(in srgb, var(--card) 88%, var(--bg)) !important;
  box-shadow: none !important;
}

/* 选中态原本靠 inset box-shadow 描边，低功耗会整体剥离，改用 outline 保住可辨识度 */
html[data-low-power="true"] .codx-tab.active {
  outline: 1px solid color-mix(in srgb, var(--primary) 42%, transparent);
  outline-offset: -1px;
}

html[data-low-power="true"] :where(
  .circle-invite-stage,
  .circle-invite-panel,
  .circle-vip-spotlight,
  .circle-proof-card,
  .circle-community-close,
  .circle-final-join
) {
  background: color-mix(in srgb, var(--card) 94%, var(--bg)) !important;
  box-shadow: none !important;
}

html[data-low-power="true"] .circle-invite-stage {
  background: color-mix(in srgb, var(--card) 96%, var(--bg-deep)) !important;
}

html[data-low-power="true"] .circle-proof-media,
html[data-low-power="true"] .circle-proof-media::after {
  box-shadow: none !important;
}

html[data-low-power="true"] .url-converter-flow svg {
  box-shadow: none !important;
}

html[data-low-power="true"] .api-probe-run {
  box-shadow: none !important;
}

@media (max-height: 760px) {
  .sidebar-power-mode {
    min-height: 42px;
    margin-bottom: 7px;
    padding-block: 6px;
  }

  .sidebar-power-icon {
    width: 26px;
    height: 26px;
  }
}
