.cdx-theme-toggle {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius, 8px);
  overflow: hidden;
  background: var(--surface);
}

.cdx-theme-btn {
  margin: 0;
  min-height: 44px;
  min-width: 44px;
  padding: 0.4rem 0.65rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.cdx-theme-btn + .cdx-theme-btn {
  border-left: 1px solid var(--border);
}

.cdx-theme-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.cdx-theme-btn.is-active,
.cdx-theme-btn[aria-checked="true"] {
  color: var(--text);
  background: var(--surface-2);
  font-weight: 600;
}

.sidebar-theme-mount {
  margin-bottom: 0.75rem;
}

.sidebar-theme-mount .cdx-theme-toggle {
  width: 100%;
}

.sidebar-theme-mount .cdx-theme-btn {
  flex: 1;
}

.m-theme-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.m-theme-bar-label {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.m-theme-mount {
  display: flex;
  align-items: center;
}

.m-topbar-end .m-theme-mount {
  margin: 0;
}

.m-theme-mount .cdx-theme-btn {
  min-height: 40px;
  min-width: 2.75rem;
  padding: 0.35rem 0.55rem;
}

.m-nav-theme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

.m-nav-theme .m-theme-bar-label {
  color: rgba(255, 255, 255, 0.85);
}

.m-nav-theme .cdx-theme-toggle {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.15);
}

.m-nav-theme .cdx-theme-btn {
  color: rgba(255, 255, 255, 0.75);
}

.m-nav-theme .cdx-theme-btn.is-active,
.m-nav-theme .cdx-theme-btn[aria-checked="true"] {
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
}

.m-nav-theme .cdx-theme-btn + .cdx-theme-btn {
  border-left-color: rgba(255, 255, 255, 0.35);
}

@media (max-width: 520px) {
  .m-appearance-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .m-appearance-toggle .cdx-theme-toggle {
    width: 100%;
  }

  .m-appearance-toggle .cdx-theme-btn {
    flex: 1;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cdx-theme-btn {
    transition: none;
  }
}
